@marimo-team/frontend 0.10.7-dev9 → 0.10.7

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 (127) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-BNCgbQY2.js → ConnectedDataExplorerComponent-TfH_6iOi.js} +1 -1
  2. package/dist/assets/VegaLite-CG3JtT5c.js +11 -0
  3. package/dist/assets/_baseEach-fmc3zLor.js +1 -0
  4. package/dist/assets/_baseMap-BwqkuE75.js +1 -0
  5. package/dist/assets/{_baseUniq-BGBzJPjO.js → _baseUniq-Co9GIZ92.js} +1 -1
  6. package/dist/assets/{any-language-editor-Cn1Y6cYj.js → any-language-editor-BMX06HTh.js} +1 -1
  7. package/dist/assets/{arc-D7sUY4s3.js → arc-y9WbYkJu.js} +1 -1
  8. package/dist/assets/architectureDiagram-IFBEXTG3-BHLdWJ-6.js +1 -0
  9. package/dist/assets/blockDiagram-TCMKQVZ6-BlKski_6.js +1 -0
  10. package/dist/assets/c4Diagram-ZCSEYPFN-B5n36dye.js +1 -0
  11. package/dist/assets/channel-CHnM0q4L.js +1 -0
  12. package/dist/assets/{chunk-4LC2V6XN-DLxsUrVM.js → chunk-4LC2V6XN-DiCD8UW_.js} +1 -1
  13. package/dist/assets/{chunk-5RIWM3LS-AiCBuBic.js → chunk-5RIWM3LS-ZvRk1UXb.js} +1 -1
  14. package/dist/assets/{chunk-6JKP7OK7-CNMUXhiF.js → chunk-6JKP7OK7-XXHRSWrC.js} +1 -1
  15. package/dist/assets/{chunk-NGC4727B-ldJMaZkI.js → chunk-NGC4727B-CO3v7Ghw.js} +1 -1
  16. package/dist/assets/{chunk-REEJFE46-DsjHX5H2.js → chunk-REEJFE46-pDbyExtH.js} +1 -1
  17. package/dist/assets/{chunk-RYO7GUH3-CwPXkctm.js → chunk-RYO7GUH3-VkcPC0x4.js} +1 -1
  18. package/dist/assets/{chunk-V35ELUW5-B0vnr5tO.js → chunk-V35ELUW5-CzrC77ja.js} +1 -1
  19. package/dist/assets/classDiagram-Q73GJZWF-Vxqk18Dh.js +1 -0
  20. package/dist/assets/classDiagram-v2-C6QPLPW4-CNQrizV-.js +1 -0
  21. package/dist/assets/clone-Cr0ountK.js +1 -0
  22. package/dist/assets/compile-CuHwJDKs.js +1 -0
  23. package/dist/assets/{createWsUrl-wavgDO_8.js → createWsUrl-BeYzOCD_.js} +1 -1
  24. package/dist/assets/dagre-7KT5K2WU-DOt1G5zY.js +1 -0
  25. package/dist/assets/{data-editor-BUuN30qs.js → data-editor-Di80Mrpu.js} +1 -1
  26. package/dist/assets/diagram-AVGMFHF7-BSFxAFME.js +1 -0
  27. package/dist/assets/edit-page-CmI2AI6u.js +14 -0
  28. package/dist/assets/erDiagram-DKC2X5TE-BtWxtGp6.js +1 -0
  29. package/dist/assets/flowDiagram-NWEUNK3L-D-BRD_56.js +1 -0
  30. package/dist/assets/ganttDiagram-HLVPPPRE-CwRVIOtn.js +1 -0
  31. package/dist/assets/{gitGraph-YCYPL57B-oC8b4d4Z.js → gitGraph-YCYPL57B-dD4eYAH1.js} +1 -1
  32. package/dist/assets/gitGraphDiagram-JPZ3KUXI-CTv_PJio.js +1 -0
  33. package/dist/assets/{graph-CmH5dNnU.js → graph-S7F5Wm7J.js} +1 -1
  34. package/dist/assets/home-page-DEIbDqse.js +13 -0
  35. package/dist/assets/{index-BN8WCiDY.js → index-BBIKUc0T.js} +1 -1
  36. package/dist/assets/{index-DyBHoqvR.js → index-BDIgmJj6.js} +6 -6
  37. package/dist/assets/{index-DHdab34S.js → index-Bl_uexm2.js} +1 -1
  38. package/dist/assets/{index-B96XJyR-.js → index-Bn0S4auU.js} +1 -1
  39. package/dist/assets/{index-C37o7Rxm.js → index-BvC2ykh3.js} +1 -1
  40. package/dist/assets/{index-VoRQvwS9.js → index-C7Dqx8jS.js} +1 -1
  41. package/dist/assets/index-C7Hj70vM.css +1 -0
  42. package/dist/assets/{index-BzRQTPpn.js → index-CUyeT1nC.js} +1 -1
  43. package/dist/assets/{index-DrqNiiJ7.js → index-CophT8iZ.js} +1 -1
  44. package/dist/assets/{index-C7tGwQQJ.js → index-Cu0-nFwJ.js} +1 -1
  45. package/dist/assets/{index-ftli4yR-.js → index-Cwqc7fb0.js} +1 -1
  46. package/dist/assets/{index-U5UX3lFH.js → index-DJQque5A.js} +1 -1
  47. package/dist/assets/index-DM58f8zW.js +1 -0
  48. package/dist/assets/{index-FUUhEA_H.js → index-DYMRfTRu.js} +1 -1
  49. package/dist/assets/{index-CdQkjnP0.js → index-D_6SMn_2.js} +1 -1
  50. package/dist/assets/{index-BOVBv8In.js → index-DiI6Ailv.js} +1 -1
  51. package/dist/assets/{index-FHivOciY.js → index-Dojr0Iq2.js} +1 -1
  52. package/dist/assets/{index-CqMed68b.js → index-pkd7nJUJ.js} +1 -1
  53. package/dist/assets/infoDiagram-RZZSJVI2-CeRC8aw7.js +1 -0
  54. package/dist/assets/journeyDiagram-BLD6N6MZ-lQpinW9P.js +1 -0
  55. package/dist/assets/json-DAxL3yxf.js +1 -0
  56. package/dist/assets/{layout-C9ZD2rdc.js → layout-BcoO_dxe.js} +1 -1
  57. package/dist/assets/linear-DeZhevmN.js +1 -0
  58. package/dist/assets/mermaid-BezMJi2d.js +13 -0
  59. package/dist/assets/min-A9Pie6I4.js +1 -0
  60. package/dist/assets/mindmap-definition-OEB2RXX2-CLgcjXda.js +1 -0
  61. package/dist/assets/pieDiagram-X7YZ5ZEZ-oFrLUn1p.js +1 -0
  62. package/dist/assets/quadrantDiagram-F36EZAVT-COTGx-mP.js +1 -0
  63. package/dist/assets/{react-plotly-BEKP8qUx.js → react-plotly-CNmKNnSR.js} +1 -1
  64. package/dist/assets/requirementDiagram-JG2LMPGF-D5avqJuB.js +1 -0
  65. package/dist/assets/run-page-BRBEeakK.js +1 -0
  66. package/dist/assets/sankeyDiagram-ATFNWWW6-Dpo4znli.js +1 -0
  67. package/dist/assets/sequenceDiagram-WK7YDQ3N-Dm0s8GJv.js +1 -0
  68. package/dist/assets/{slides-component-DZ-pIIfA.js → slides-component-B4c0307R.js} +1 -1
  69. package/dist/assets/sortBy-DmmQPxuV.js +1 -0
  70. package/dist/assets/stateDiagram-4JV6CC6H-Cf3yx3HZ.js +1 -0
  71. package/dist/assets/stateDiagram-v2-7KT6RKTD-BH-6hDbh.js +1 -0
  72. package/dist/assets/step-DY8hpDjU.js +1 -0
  73. package/dist/assets/{terminal-B1av4R2I.js → terminal-CcoDMgCr.js} +1 -1
  74. package/dist/assets/time-CMdbP5-y.js +1 -0
  75. package/dist/assets/timeline-definition-3ZMEY6HS-BlWLtr5m.js +1 -0
  76. package/dist/assets/transform-C6EuPmuu.js +1 -0
  77. package/dist/assets/tree-CjUFyJlP.js +14 -0
  78. package/dist/assets/{useMarimoWebSocket-DhpBdbFu.js → useMarimoWebSocket-M5f3T7-m.js} +5 -5
  79. package/dist/assets/vega-component-B96KnH8_.js +1 -0
  80. package/dist/assets/xychartDiagram-KECQ2H5Q-C0rUpquC.js +1 -0
  81. package/dist/index.html +2 -2
  82. package/package.json +3 -3
  83. package/dist/assets/VegaLite-BNPGNaQq.js +0 -11
  84. package/dist/assets/_baseEach-CcIQKFGK.js +0 -1
  85. package/dist/assets/_baseMap-BhfQhDjB.js +0 -1
  86. package/dist/assets/architectureDiagram-IFBEXTG3-zrA3TD3t.js +0 -1
  87. package/dist/assets/blockDiagram-TCMKQVZ6-BNKkJTUf.js +0 -1
  88. package/dist/assets/c4Diagram-ZCSEYPFN-BsLWErL_.js +0 -1
  89. package/dist/assets/channel-By0bv9da.js +0 -1
  90. package/dist/assets/classDiagram-Q73GJZWF-Dj-CIpYp.js +0 -1
  91. package/dist/assets/classDiagram-v2-C6QPLPW4-BwDu_vVw.js +0 -1
  92. package/dist/assets/clone-DXk4rlod.js +0 -1
  93. package/dist/assets/dagre-7KT5K2WU-icHXkzlK.js +0 -1
  94. package/dist/assets/diagram-AVGMFHF7-D2tn-8GF.js +0 -1
  95. package/dist/assets/edit-page-Cr0kvxUF.js +0 -14
  96. package/dist/assets/erDiagram-DKC2X5TE-DBRH1asm.js +0 -1
  97. package/dist/assets/flowDiagram-NWEUNK3L-CfHUVKuJ.js +0 -1
  98. package/dist/assets/ganttDiagram-HLVPPPRE-DJag5Egp.js +0 -1
  99. package/dist/assets/gitGraphDiagram-JPZ3KUXI-74w21NVt.js +0 -1
  100. package/dist/assets/home-page-BxCoTdel.js +0 -13
  101. package/dist/assets/index-BDWSyl3J.css +0 -1
  102. package/dist/assets/index-BjrcdWWT.js +0 -1
  103. package/dist/assets/infoDiagram-RZZSJVI2-Bm1GBEub.js +0 -1
  104. package/dist/assets/journeyDiagram-BLD6N6MZ-80IHou03.js +0 -1
  105. package/dist/assets/json-DbOjVQnr.js +0 -1
  106. package/dist/assets/linear-BTorkJHe.js +0 -1
  107. package/dist/assets/mermaid-BC5FlxMb.js +0 -13
  108. package/dist/assets/min-GkL-jVft.js +0 -1
  109. package/dist/assets/mindmap-definition-OEB2RXX2-BL0xRQqb.js +0 -1
  110. package/dist/assets/pieDiagram-X7YZ5ZEZ-CFRmoAdQ.js +0 -1
  111. package/dist/assets/quadrantDiagram-F36EZAVT-CW886My3.js +0 -1
  112. package/dist/assets/requirementDiagram-JG2LMPGF-D6TAJFBg.js +0 -1
  113. package/dist/assets/run-page-BepNVgbg.js +0 -1
  114. package/dist/assets/sankeyDiagram-ATFNWWW6--BEgg7Mb.js +0 -1
  115. package/dist/assets/sequenceDiagram-WK7YDQ3N-CwfOx1zl.js +0 -1
  116. package/dist/assets/sortBy-Ckx-evDh.js +0 -1
  117. package/dist/assets/stateDiagram-4JV6CC6H-DBRKUSnC.js +0 -1
  118. package/dist/assets/stateDiagram-v2-7KT6RKTD-DViFjy6S.js +0 -1
  119. package/dist/assets/step-CNn2V7Th.js +0 -1
  120. package/dist/assets/time-NUI2A8HX.js +0 -1
  121. package/dist/assets/timeline-definition-3ZMEY6HS-D2hFCzzy.js +0 -1
  122. package/dist/assets/timer-CK-RIWfW.js +0 -1
  123. package/dist/assets/transform-B3MLqdQw.js +0 -1
  124. package/dist/assets/tree-B1L24vyj.js +0 -14
  125. package/dist/assets/vega-component-Dwc4uMjd.js +0 -1
  126. package/dist/assets/xychartDiagram-KECQ2H5Q-v_0dRIMF.js +0 -1
  127. package/dist/assets/zoom-COrs4lFh.js +0 -1
@@ -1,11 +0,0 @@
1
- var e;import{cb as t,g as n,fC as i,fD as r,fE as o,fF as a,fG as s,fH as l,fI as u,fJ as c,fK as f,fL as d,fM as h,fN as p,fO as m,fP as g,fQ as y,fR as v,fS as b,fT as x,fU as w,fV as _,fW as k,fX as E,fY as $,fZ as A,f_ as D,f$ as S,g0 as F,g1 as C,g2 as M,g3 as O,g4 as z,g5 as N,g6 as R,aB as T,g7 as P,g8 as L,g9 as B,ga as j,gb as I,gc as q,gd as U,ge as W,ci as H,cc as G,ch as V,gf as X,aH as Y,aO as J,aP as Q,gg as K,aR as Z,aS as ee,aF as te,gh as ne,gi as ie,gj as re,gk as oe,gl as ae,gm as se,gn as le,go as ue,gp as ce,gq as fe,gr as de,gs as he,aC as pe,gt as me,gu as ge,gv as ye,gw as ve,gx as be,gy as xe,gz as we,gA as _e,gB as ke,gC as Ee,gD as $e,gE as Ae,gF as De,gG as Se,gH as Fe,gI as Ce,gJ as Me,gK as Oe,gL as ze,gM as Ne,gN as Re,gO as Te,gP as Pe,gQ as Le,gR as Be,gS as je,gT as Ie,gU as qe,gV as Ue,gW as We,gX as He,gY as Ge,gZ as Ve,g_ as Xe,g$ as Ye,h0 as Je,h1 as Qe,h2 as Ke,h3 as Ze,h4 as et,h5 as tt,h6 as nt,h7 as it,h8 as rt,h9 as ot,ha as at,hb as st,hc as lt,hd as ut,he as ct,hf as ft,hg as dt,hh as ht,hi as pt,hj as mt,hk as gt,R as yt,hl as vt}from"./index-DyBHoqvR.js";import{m as bt,a as xt,r as wt,d as _t,l as kt,i as Et,h as $t,n as At,c as Dt,u as St,b as Ft,t as Ct,e as Mt}from"./time-NUI2A8HX.js";import{n as Ot,b as zt,i as Nt,d as Rt,e as Tt,f as Pt,o as Lt,g as Bt,h as jt,j as It,t as qt,a as Ut,k as Wt,m as Ht,l as Gt,p as Vt,q as Xt}from"./linear-BTorkJHe.js";import{r as Yt}from"./range-CtcPcB_L.js";import{R as Jt,r as Qt,d as Kt,e as Zt,C as en,m as tn,o as nn,h as rn,p as on,n as an,q as sn,s as ln,i as un,b as cn,u as fn,v as dn,f as hn,k as pn,j as mn,l as gn,T as yn,w as vn,t as bn,g as xn}from"./timer-CK-RIWfW.js";import{i as wn}from"./zoom-COrs4lFh.js";import{i as _n,a as kn}from"./init-DLRA0X12.js";import{I as En,o as $n,i as An}from"./ordinal-DDUp3AbE.js";import{c as Dn}from"./colors-bszWmPJw.js";import{d as Sn}from"./arc-D7sUY4s3.js";import{w as Fn,a as Cn,n as Mn,J as On,K as zn,o as Nn,l as Rn,t as Tn,b as Pn,p as Ln,k as Bn,q as jn,r as In,u as qn,y as Un,x as Wn,v as Hn,B as Gn,z as Vn,A as Xn,C as Yn,E as Jn,D as Qn,F as Kn,G as Zn,H as ei,I as ti,L as ni}from"./step-CNn2V7Th.js";import{e as ii}from"./index-CqMed68b.js";class ri{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let n=0;for(let i=0;i<this._n&&i<32;i++){const r=t[i],o=e+r,a=Math.abs(e)<Math.abs(r)?e-(o-r):r-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){const e=this._partials;let t,n,i,r=this._n,o=0;if(r>0){for(o=e[--r];r>0&&(t=o,n=e[--r],o=t+n,i=n-(o-t),!i););r>0&&(i<0&&e[r-1]<0||i>0&&e[r-1]>0)&&(n=2*i,t=o+n,n==t-o&&(o=t))}return o}}function oi(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:e>t?1:0)}function ai(e,n,i=0,r=1/0,o){if(n=Math.floor(n),i=Math.floor(Math.max(0,i)),r=Math.floor(Math.min(e.length-1,r)),!(i<=n&&n<=r))return e;for(o=void 0===o?oi:function(e=t){if(e===t)return oi;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const i=e(t,n);return i||0===i?i:(0===e(n,n))-(0===e(t,t))}}(o);r>i;){if(r-i>600){const t=r-i+1,a=n-i+1,s=Math.log(t),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(t-l)/t)*(a-t/2<0?-1:1);ai(e,n,Math.max(i,Math.floor(n-a*l/t+u)),Math.min(r,Math.floor(n+(t-a)*l/t+u)),o)}const t=e[n];let a=i,s=r;for(si(e,i,n),o(e[r],t)>0&&si(e,i,r);a<s;){for(si(e,a,s),++a,--s;o(e[a],t)<0;)++a;for(;o(e[s],t)>0;)--s}0===o(e[i],t)?si(e,i,s):(++s,si(e,s,r)),s<=n&&(i=s+1),n<=s&&(r=s-1)}return e}function si(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function li(e,t,n){if((i=(e=Float64Array.from(Ot(e,n))).length)&&!isNaN(t=+t)){if(t<=0||i<2)return bt(e);if(t>=1)return xt(e);var i,r=(i-1)*t,o=Math.floor(r),a=xt(ai(e,o).subarray(0,o+1));return a+(bt(e.subarray(o+1))-a)*(r-o)}}function ui(e,t,n=zt){if((i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return+n(e[0],0,e);if(t>=1)return+n(e[i-1],i-1,e);var i,r=(i-1)*t,o=Math.floor(r),a=+n(e[o],o,e);return a+(+n(e[o+1],o+1,e)-a)*(r-o)}}function ci(e,t){return li(e,.5,t)}function fi(e){return Array.from(function*(e){for(const t of e)yield*t}(e))}function di(e,t){let n=0;for(let i of e)(i=+i)&&(n+=i);return n}function hi(e){return e instanceof En?e:new En(e)}var pi=-.14861,mi=1.78277,gi=-.29227,yi=-.90649,vi=1.97294,bi=vi*yi,xi=vi*mi,wi=mi*gi-yi*pi;function _i(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof ki)return new ki(e.h,e.s,e.l,e.opacity);e instanceof Jt||(e=Qt(e));var t=e.r/255,n=e.g/255,i=e.b/255,r=(wi*i+bi*t-xi*n)/(wi+bi-xi),o=i-r,a=(vi*(n-r)-gi*o)/yi,s=Math.sqrt(a*a+o*o)/(vi*r*(1-r)),l=s?Math.atan2(a,o)*_t-120:NaN;return new ki(l<0?l+360:l,s,r,e.opacity)}(e):new ki(e,t,n,null==i?1:i)}function ki(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function Ei(e){return function(t,n){var i=e((t=on(t)).h,(n=on(n)).h),r=an(t.s,n.s),o=an(t.l,n.l),a=an(t.opacity,n.opacity);return function(e){return t.h=i(e),t.s=r(e),t.l=o(e),t.opacity=a(e),t+""}}}Kt(ki,_i,Zt(en,{brighter(e){return e=null==e?tn:Math.pow(tn,e),new ki(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?nn:Math.pow(nn,e),new ki(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*wt,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),i=Math.cos(e),r=Math.sin(e);return new Jt(255*(t+n*(pi*i+mi*r)),255*(t+n*(gi*i+yi*r)),255*(t+n*(vi*i)),this.opacity)}}));const $i=Ei(rn);var Ai=Ei(an);function Di(e){return function t(n){function i(t,i){var r=e((t=_i(t)).h,(i=_i(i)).h),o=an(t.s,i.s),a=an(t.l,i.l),s=an(t.opacity,i.opacity);return function(e){return t.h=r(e),t.s=o(e),t.l=a(Math.pow(e,n)),t.opacity=s(e),t+""}}return n=+n,i.gamma=t,i}(1)}const Si=Di(rn);var Fi=Di(an);function Ci(e,t){void 0===t&&(t=e,e=Nt);for(var n=0,i=t.length-1,r=t[0],o=new Array(i<0?0:i);n<i;)o[n]=e(r,r=t[++n]);return function(e){var t=Math.max(0,Math.min(i-1,Math.floor(e*=i)));return o[t](e-t)}}const Mi=Object.freeze(Object.defineProperty({__proto__:null,interpolate:Nt,interpolateArray:Rt,interpolateBasis:sn,interpolateBasisClosed:ln,interpolateCubehelix:Si,interpolateCubehelixLong:Fi,interpolateDate:Tt,interpolateDiscrete:function(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}},interpolateHcl:Et,interpolateHclLong:$t,interpolateHsl:$i,interpolateHslLong:Ai,interpolateHue:function(e,t){var n=rn(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}},interpolateLab:function(e,t){var n=an((e=kt(e)).l,(t=kt(t)).l),i=an(e.a,t.a),r=an(e.b,t.b),o=an(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=i(t),e.b=r(t),e.opacity=o(t),e+""}},interpolateNumber:un,interpolateNumberArray:Pt,interpolateObject:Lt,interpolateRgb:cn,interpolateRgbBasis:fn,interpolateRgbBasisClosed:dn,interpolateRound:Bt,interpolateString:hn,interpolateTransformCss:pn,interpolateTransformSvg:mn,interpolateZoom:wn,piecewise:Ci,quantize:function(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e(i/(t-1));return n}},Symbol.toStringTag,{value:"Module"}));const Oi={};function zi(e,t){void 0===e&&(e=Oi),void 0===t&&(t=Oi);const n=Object.keys(e),i=Object.keys(t);return e===t||n.length===i.length&&n.every((n=>e[n]===t[n]))}
2
- /*!
3
- * https://github.com/Starcounter-Jack/JSON-Patch
4
- * (c) 2017-2022 Joachim Wester
5
- * MIT licensed
6
- */var Ni=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Ri=Object.prototype.hasOwnProperty;function Ti(e,t){return Ri.call(e,t)}function Pi(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);var i=[];for(var r in e)Ti(e,r)&&i.push(r);return i}function Li(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Bi(e){for(var t,n=0,i=e.length;n<i;){if(!((t=e.charCodeAt(n))>=48&&t<=57))return!1;n++}return!0}function ji(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ii(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function qi(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(qi(e[t]))return!0}else if("object"==typeof e)for(var i=Pi(e),r=i.length,o=0;o<r;o++)if(qi(e[i[o]]))return!0;return!1}function Ui(e,t){var n=[e];for(var i in t){var r="object"==typeof t[i]?JSON.stringify(t[i],null,2):t[i];void 0!==r&&n.push(i+": "+r)}return n.join("\n")}var Wi=function(e){function t(t,n,i,r,o){var a=this.constructor,s=e.call(this,Ui(t,{name:n,index:i,operation:r,tree:o}))||this;return s.name=n,s.index=i,s.operation=r,s.tree=o,Object.setPrototypeOf(s,a.prototype),s.message=Ui(t,{name:n,index:i,operation:r,tree:o}),s}return Ni(t,e),t}(Error),Hi=Wi,Gi=Li,Vi={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var i=e[t];return delete e[t],{newDocument:n,removed:i}},replace:function(e,t,n){var i=e[t];return e[t]=this.value,{newDocument:n,removed:i}},move:function(e,t,n){var i=Yi(n,this.path);i&&(i=Li(i));var r=Ji(n,{op:"remove",path:this.from}).removed;return Ji(n,{op:"add",path:this.path,value:r}),{newDocument:n,removed:i}},copy:function(e,t,n){var i=Yi(n,this.from);return Ji(n,{op:"add",path:this.path,value:Li(i)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:er(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},Xi={add:function(e,t,n){return Bi(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var i=e[t];return e[t]=this.value,{newDocument:n,removed:i}},move:Vi.move,copy:Vi.copy,test:Vi.test,_get:Vi._get};function Yi(e,t){if(""==t)return e;var n={op:"_get",path:t};return Ji(e,n),n.value}function Ji(e,t,n,i,r,o){if(void 0===n&&(n=!1),void 0===i&&(i=!0),void 0===r&&(r=!0),void 0===o&&(o=0),n&&("function"==typeof n?n(t,0,e,t.path):Ki(t,0)),""===t.path){var a={newDocument:e};if("add"===t.op)return a.newDocument=t.value,a;if("replace"===t.op)return a.newDocument=t.value,a.removed=e,a;if("move"===t.op||"copy"===t.op)return a.newDocument=Yi(e,t.from),"move"===t.op&&(a.removed=e),a;if("test"===t.op){if(a.test=er(e,t.value),!1===a.test)throw new Hi("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a.newDocument=e,a}if("remove"===t.op)return a.removed=e,a.newDocument=null,a;if("_get"===t.op)return t.value=e,a;if(n)throw new Hi("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,t,e);return a}i||(e=Li(e));var s=(t.path||"").split("/"),l=e,u=1,c=s.length,f=void 0,d=void 0,h=void 0;for(h="function"==typeof n?n:Ki;;){if((d=s[u])&&-1!=d.indexOf("~")&&(d=Ii(d)),r&&("__proto__"==d||"prototype"==d&&u>0&&"constructor"==s[u-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===f&&(void 0===l[d]?f=s.slice(0,u).join("/"):u==c-1&&(f=t.path),void 0!==f&&h(t,0,e,f)),u++,Array.isArray(l)){if("-"===d)d=l.length;else{if(n&&!Bi(d))throw new Hi("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",o,t,e);Bi(d)&&(d=~~d)}if(u>=c){if(n&&"add"===t.op&&d>l.length)throw new Hi("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);if(!1===(a=Xi[t.op].call(t,l,d,e)).test)throw new Hi("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}}else if(u>=c){if(!1===(a=Vi[t.op].call(t,l,d,e)).test)throw new Hi("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}if(l=l[d],n&&u<c&&(!l||"object"!=typeof l))throw new Hi("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,t,e)}}function Qi(e,t,n,i,r){if(void 0===i&&(i=!0),void 0===r&&(r=!0),n&&!Array.isArray(t))throw new Hi("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");i||(e=Li(e));for(var o=new Array(t.length),a=0,s=t.length;a<s;a++)o[a]=Ji(e,t[a],n,!0,r,a),e=o[a].newDocument;return o.newDocument=e,o}function Ki(e,t,n,i){if("object"!=typeof e||null===e||Array.isArray(e))throw new Hi("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(!Vi[e.op])throw new Hi("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n);if("string"!=typeof e.path)throw new Hi("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new Hi('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new Hi("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new Hi("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&qi(e.value))throw new Hi("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var r=e.path.split("/").length,o=i.split("/").length;if(r!==o+1&&r!==o)throw new Hi("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==i)throw new Hi("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var a=Zi([{op:"_get",path:e.from,value:void 0}],n);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new Hi("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function Zi(e,t,n){try{if(!Array.isArray(e))throw new Hi("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Qi(Li(t),Li(e),n||!0);else{n=n||Ki;for(var i=0;i<e.length;i++)n(e[i],i,t,void 0)}}catch(r){if(r instanceof Hi)return r;throw r}}function er(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,i,r,o=Array.isArray(e),a=Array.isArray(t);if(o&&a){if((i=e.length)!=t.length)return!1;for(n=i;0!=n--;)if(!er(e[n],t[n]))return!1;return!0}if(o!=a)return!1;var s=Object.keys(e);if((i=s.length)!==Object.keys(t).length)return!1;for(n=i;0!=n--;)if(!t.hasOwnProperty(s[n]))return!1;for(n=i;0!=n--;)if(!er(e[r=s[n]],t[r]))return!1;return!0}return e!=e&&t!=t}const tr=Object.freeze(Object.defineProperty({__proto__:null,JsonPatchError:Hi,_areEquals:er,applyOperation:Ji,applyPatch:Qi,applyReducer:function(e,t,n){var i=Ji(e,t);if(!1===i.test)throw new Hi("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return i.newDocument},deepClone:Gi,getValueByPointer:Yi,validate:Zi,validator:Ki},Symbol.toStringTag,{value:"Module"}));
7
- /*!
8
- * https://github.com/Starcounter-Jack/JSON-Patch
9
- * (c) 2017-2021 Joachim Wester
10
- * MIT license
11
- */var nr=new WeakMap,ir=function(){return function(e){this.observers=new Map,this.obj=e}}(),rr=function(){return function(e,t){this.callback=e,this.observer=t}}();function or(e,t){void 0===t&&(t=!1);var n=nr.get(e.object);ar(n.value,e.object,e.patches,"",t),e.patches.length&&Qi(n.value,e.patches);var i=e.patches;return i.length>0&&(e.patches=[],e.callback&&e.callback(i)),i}function ar(e,t,n,i,r){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=Pi(t),a=Pi(e),s=!1,l=a.length-1;l>=0;l--){var u=e[f=a[l]];if(!Ti(t,f)||void 0===t[f]&&void 0!==u&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(r&&n.push({op:"test",path:i+"/"+ji(f),value:Li(u)}),n.push({op:"remove",path:i+"/"+ji(f)}),s=!0):(r&&n.push({op:"test",path:i,value:e}),n.push({op:"replace",path:i,value:t}));else{var c=t[f];"object"==typeof u&&null!=u&&"object"==typeof c&&null!=c&&Array.isArray(u)===Array.isArray(c)?ar(u,c,n,i+"/"+ji(f),r):u!==c&&(r&&n.push({op:"test",path:i+"/"+ji(f),value:Li(u)}),n.push({op:"replace",path:i+"/"+ji(f),value:Li(c)}))}}if(s||o.length!=a.length)for(l=0;l<o.length;l++){var f;Ti(e,f=o[l])||void 0===t[f]||n.push({op:"add",path:i+"/"+ji(f),value:Li(t[f])})}}}const sr=Object.freeze(Object.defineProperty({__proto__:null,compare:function(e,t,n){void 0===n&&(n=!1);var i=[];return ar(e,t,i,"",n),i},generate:or,observe:function(e,t){var n,i=function(e){return nr.get(e)}(e);if(i){var r=function(e,t){return e.observers.get(t)}(i,t);n=r&&r.observer}else i=new ir(e),nr.set(e,i);if(n)return n;if(n={},i.value=Li(e),t){n.callback=t,n.next=null;var o=function(){or(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(o)};"undefined"!=typeof window&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=[],n.object=e,n.unobserve=function(){or(n),clearTimeout(n.next),function(e,t){e.observers.delete(t.callback)}(i,n),"undefined"!=typeof window&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},i.observers.set(t,new rr(t,n)),n},unobserve:function(e,t){t.unobserve()}},Symbol.toStringTag,{value:"Module"}));Object.assign({},tr,sr,{JsonPatchError:Wi,deepClone:Li,escapePathComponent:ji,unescapePathComponent:Ii});var lr=/("(?:[^\\"]|\\.)*")|[:,]/g;const ur=n((function(e,t){var n,i,r;return t=t||{},n=JSON.stringify([1],void 0,void 0===t.indent?2:t.indent).slice(2,-3),i=""===n?1/0:void 0===t.maxLength?80:t.maxLength,r=t.replacer,function e(t,o,a){var s,l,u,c,f,d,h,p,m,g,y,v;if(t&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0===(y=JSON.stringify(t,r)))return y;if(h=i-o.length-a,y.length<=h&&(m=y.replace(lr,(function(e,t){return t||e+" "}))).length<=h)return m;if(null!=r&&(t=JSON.parse(y),r=void 0),"object"==typeof t&&null!==t){if(p=o+n,u=[],l=0,Array.isArray(t))for(g="[",s="]",h=t.length;l<h;l++)u.push(e(t[l],p,l===h-1?0:1)||"null");else for(g="{",s="}",h=(d=Object.keys(t)).length;l<h;l++)c=d[l],f=JSON.stringify(c)+": ",void 0!==(v=e(t[c],p,f.length+(l===h-1?0:1)))&&u.push(f+v);if(u.length>0)return[g,n+u.join(",\n"+p),s].join("\n"+o)}return y}(e,"",0)}));function cr(e){const t=e||u,n=[],i={};return n.add=e=>{const r=t(e);return i[r]||(i[r]=1,n.push(e)),n},n.remove=e=>{const r=t(e);if(i[r]){i[r]=0;const t=n.indexOf(e);t>=0&&n.splice(t,1)}return n},n}async function fr(e,t){try{await t(e)}catch(n){e.error(n)}}const dr=Symbol("vega_id");let hr=1;function pr(e){return!(!e||!mr(e))}function mr(e){return e[dr]}function gr(e,t){return e[dr]=t,e}function yr(e){const t=e===Object(e)?e:{data:e};return mr(t)?t:gr(t,hr++)}function vr(e){return br(e,yr({}))}function br(e,t){for(const n in e)t[n]=e[n];return t}function xr(e,t){return gr(t,mr(e))}function wr(e,t){return e?t?(n,i)=>e(n,i)||mr(t(n))-mr(t(i)):(t,n)=>e(t,n)||mr(t)-mr(n):null}function _r(e){return e&&e.constructor===kr}function kr(){const e=[],t=[],n=[],i=[],a=[];let s=null,l=!1;return{constructor:kr,insert(t){const n=r(t),i=n.length;for(let r=0;r<i;++r)e.push(n[r]);return this},remove(e){const n=o(e)?i:t,a=r(e),s=a.length;for(let t=0;t<s;++t)n.push(a[t]);return this},modify(e,t,i){const r={field:t,value:g(i)};return o(e)?(r.filter=e,a.push(r)):(r.tuple=e,n.push(r)),this},encode(e,t){return o(e)?a.push({filter:e,field:t}):n.push({tuple:e,field:t}),this},clean(e){return s=e,this},reflow(){return l=!0,this},pulse(r,o){const u={},c={};let f,d,h,p,m,g;for(f=0,d=o.length;f<d;++f)u[mr(o[f])]=1;for(f=0,d=t.length;f<d;++f)m=t[f],u[mr(m)]=-1;for(f=0,d=i.length;f<d;++f)p=i[f],o.forEach((e=>{p(e)&&(u[mr(e)]=-1)}));for(f=0,d=e.length;f<d;++f)m=e[f],g=mr(m),u[g]?u[g]=1:r.add.push(yr(e[f]));for(f=0,d=o.length;f<d;++f)m=o[f],u[mr(m)]<0&&r.rem.push(m);function y(e,t,n){n?e[t]=n(e):r.encode=t,l||(c[mr(e)]=e)}for(f=0,d=n.length;f<d;++f)h=n[f],m=h.tuple,p=h.field,g=u[mr(m)],g>0&&(y(m,p,h.value),r.modifies(p));for(f=0,d=a.length;f<d;++f)h=a[f],p=h.filter,o.forEach((e=>{p(e)&&u[mr(e)]>0&&y(e,h.field,h.value)})),r.modifies(h.field);if(l)r.mod=t.length||i.length?o.filter((e=>u[mr(e)]>0)):o.slice();else for(g in c)r.mod.push(c[g]);return(s||null==s&&(t.length||i.length))&&r.clean(!0),r}}}const Er="_:mod:_";function $r(){Object.defineProperty(this,Er,{writable:!0,value:{}})}$r.prototype={set(e,t,n,i){const r=this,o=r[e],s=r[Er];return null!=t&&t>=0?(o[t]!==n||i)&&(o[t]=n,s[t+":"+e]=-1,s[e]=-1):(o!==n||i)&&(r[e]=n,s[e]=a(n)?1+n.length:-1),r},modified(e,t){const n=this[Er];if(!arguments.length){for(const e in n)if(n[e])return!0;return!1}if(a(e)){for(let t=0;t<e.length;++t)if(n[e[t]])return!0;return!1}return null!=t&&t>=0?t+1<n[e]||!!n[t+":"+e]:!!n[e]},clear(){return this[Er]={},this}};let Ar=0;const Dr=new $r;function Sr(e,t,n,i){this.id=++Ar,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,i)}function Fr(e){return function(t){const n=this.flags;return 0===arguments.length?!!(n&e):(this.flags=t?n|e:n&~e,this)}}Sr.prototype={targets(){return this._targets||(this._targets=cr(x))},set(e){return this.value!==e?(this.value=e,1):0},skip:Fr(1),modified:Fr(2),parameters(e,t,n){t=!1!==t;const i=this._argval=this._argval||new $r,o=this._argops=this._argops||[],l=[];let u,c,f,d;const h=(e,n,r)=>{r instanceof Sr?(r!==this&&(t&&r.targets().add(this),l.push(r)),o.push({op:r,name:e,index:n})):i.set(e,n,r)};for(u in e)if(c=e[u],"pulse"===u)r(c).forEach((e=>{e instanceof Sr?e!==this&&(e.targets().add(this),l.push(e)):s("Pulse parameters must be operator instances.")})),this.source=c;else if(a(c))for(i.set(u,-1,Array(f=c.length)),d=0;d<f;++d)h(u,d,c[d]);else h(u,-1,c);return this.marshall().clear(),n&&(o.initonly=!0),l},marshall(e){const t=this._argval||Dr,n=this._argops;let i,r,o,a;if(n){const s=n.length;for(r=0;r<s;++r)i=n[r],o=i.op,a=o.modified()&&o.stamp===e,t.set(i.name,i.index,o.value,a);if(n.initonly){for(r=0;r<s;++r)i=n[r],i.op.targets().remove(this);this._argops=null,this._update=null}}return t},detach(){const e=this._argops;let t,n,i,r;if(e)for(t=0,n=e.length;t<n;++t)i=e[t],r=i.op,r._targets&&r._targets.remove(this);this.pulse=null,this.source=null},evaluate(e){const t=this._update;if(t){const n=this.marshall(e.stamp),i=t.call(this,n,e);if(n.clear(),i!==this.value)this.value=i;else if(!this.modified())return e.StopPropagation}},run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?(this.skip(!1),t=0):t=this.evaluate(e),this.pulse=t||e}};let Cr=0;function Mr(e,t,n){this.id=++Cr,this.value=null,n&&(this.receive=n),e&&(this._filter=e),t&&(this._apply=t)}function Or(e,t,n){return new Mr(e,t,n)}Mr.prototype={_filter:l,_apply:u,targets(){return this._targets||(this._targets=cr(x))},consume(e){return arguments.length?(this._consume=!!e,this):!!this._consume},receive(e){if(this._filter(e)){const t=this.value=this._apply(e),n=this._targets,i=n?n.length:0;for(let e=0;e<i;++e)n[e].receive(t);this._consume&&(e.preventDefault(),e.stopPropagation())}},filter(e){const t=Or(e);return this.targets().add(t),t},apply(e){const t=Or(null,e);return this.targets().add(t),t},merge(){const e=Or();this.targets().add(e);for(let t=0,n=arguments.length;t<n;++t)arguments[t].targets().add(e);return e},throttle(e){let t=-1;return this.filter((()=>{const n=Date.now();return n-t>e?(t=n,1):0}))},debounce(e){const t=Or();return this.targets().add(Or(null,null,y(e,(e=>{const n=e.dataflow;t.receive(e),n&&n.run&&n.run()})))),t},between(e,t){let n=!1;return e.targets().add(Or(null,null,(()=>n=!0))),t.targets().add(Or(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=l,this._targets=null}};const zr={skip:!0};function Nr(e,t,n,i,r,a){const s=w({},a,zr);let l,u;o(n)||(n=g(n)),void 0===i?l=t=>e.touch(n(t)):o(i)?(u=new Sr(null,i,r,!1),l=t=>{u.evaluate(t);const i=n(t),r=u.value;_r(r)?e.pulse(i,r,a):e.update(i,r,s)}):l=t=>e.update(n(t),i,s),t.apply(l)}function Rr(e,t,n,i,r,a){if(void 0===i)t.targets().add(n);else{const s=a||{},l=new Sr(null,function(e,t){return t=o(t)?t:g(t),e?function(n,i){const r=t(n,i);return e.skip()||(e.skip(r!==this.value).value=r),r}:t}(n,i),r,!1);l.modified(s.force),l.rank=t.rank,t.targets().add(l),n&&(l.skip(!0),l.value=n.value,l.targets().add(n),e.connect(n,[l]))}}const Tr={};function Pr(e,t,n){this.dataflow=e,this.stamp=null==t?-1:t,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function Lr(e,t){const n=[];return c(e,t,(e=>n.push(e))),n}function Br(e,t){const n={};return e.visit(t,(e=>{n[mr(e)]=1})),e=>n[mr(e)]?null:e}function jr(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}function Ir(e,t,n,i){const r=this;let o=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=i||null,this.pulses=n;for(const a of n)if(a.stamp===t){if(a.fields){const e=r.fields||(r.fields={});for(const t in a.fields)e[t]=1}a.changed(r.ADD)&&(o|=r.ADD),a.changed(r.REM)&&(o|=r.REM),a.changed(r.MOD)&&(o|=r.MOD)}this.changes=o}function qr(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}Pr.prototype={StopPropagation:Tr,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(e){return new Pr(this.dataflow).init(this,e)},clone(){const e=this.fork(7);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new Pr(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){const n=this;return n.stamp=e.stamp,n.encode=e.encode,!e.fields||64&t||(n.fields=e.fields),1&t?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),2&t?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),4&t?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),32&t?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||7;return 1&t&&this.add.length||2&t&&this.rem.length||4&t&&this.mod.length},reflow(e){if(e)return this.fork(7).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(4,Br(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return a(e)?e.forEach((e=>t[e]=!0)):t[e]=!0,this},modified(e,t){const n=this.fields;return!(!t&&!this.mod.length||!n)&&(arguments.length?a(e)?e.some((e=>n[e])):n[e]:!!n)},filter(e,t){const n=this;return 1&e&&(n.addF=jr(n.addF,t)),2&e&&(n.remF=jr(n.remF,t)),4&e&&(n.modF=jr(n.modF,t)),16&e&&(n.srcF=jr(n.srcF,t)),n},materialize(e){const t=this;return 1&(e=e||7)&&t.addF&&(t.add=Lr(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=Lr(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=Lr(t.mod,t.modF),t.modF=null),16&e&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,i=t;if(16&e)return c(n.source,n.srcF,i),n;1&e&&c(n.add,n.addF,i),2&e&&c(n.rem,n.remF,i),4&e&&c(n.mod,n.modF,i);const r=n.source;if(8&e&&r){const e=n.add.length+n.mod.length;e===r.length||c(r,e?Br(n,5):n.srcF,i)}return n}},i(Ir,Pr,{fork(e){const t=new Pr(this.dataflow).init(this,e&this.NO_FIELDS);return void 0!==e&&(e&t.ADD&&this.visit(t.ADD,(e=>t.add.push(e))),e&t.REM&&this.visit(t.REM,(e=>t.rem.push(e))),e&t.MOD&&this.visit(t.MOD,(e=>t.mod.push(e)))),t},changed(e){return this.changes&e},modified(e){const t=this,n=t.fields;return n&&t.changes&t.MOD?a(e)?e.some((e=>n[e])):n[e]:0},filter(){s("MultiPulse does not support filtering.")},materialize(){s("MultiPulse does not support materialization.")},visit(e,t){const n=this,i=n.pulses,r=i.length;let o=0;if(e&n.SOURCE)for(;o<r;++o)i[o].visit(e,t);else for(;o<r;++o)i[o].stamp===n.stamp&&i[o].visit(e,t);return n}});const Ur={skip:!1,force:!1};function Wr(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),Hr(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let i;return t.length?(i=t[0],t[0]=n,function(e,t,n){const i=t,r=e.length,o=e[t];let a,s=1+(t<<1);for(;s<r;)a=s+1,a<r&&n(e[s],e[a])>=0&&(s=a),e[t]=e[s],s=1+((t=s)<<1);e[t]=o,Hr(e,i,t,n)}(t,0,e)):i=n,i}}}function Hr(e,t,n,i){let r,o;const a=e[n];for(;n>t&&(o=n-1>>1,r=e[o],i(a,r)<0);)e[n]=r,n=o;return e[n]=a}function Gr(){this.logger(f()),this.logLevel(d),this._clock=0,this._rank=0,this._locale=h();try{this._loader=p()}catch(e){}this._touched=cr(x),this._input={},this._pulse=null,this._heap=Wr(((e,t)=>e.qrank-t.qrank)),this._postrun=[]}function Vr(e){return function(){return this._log[e].apply(this,arguments)}}function Xr(e,t){Sr.call(this,e,null,t)}Gr.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:Vr("error"),warn:Vr("warn"),info:Vr("info"),debug:Vr("debug"),logLevel:Vr("level"),cleanThreshold:1e4,add:function(e,t,n,i){let r,a=1;return e instanceof Sr?r=e:e&&e.prototype instanceof Sr?r=new e:o(e)?r=new Sr(null,e):(a=0,r=new Sr(e,t)),this.rank(r),a&&(i=n,n=t),n&&this.connect(r,r.parameters(n,i)),this.touch(r),r},connect:function(e,t){const n=e.rank,i=t.length;for(let r=0;r<i;++r)if(n<t[r].rank)return void this.rerank(e)},rank:function(e){e.rank=++this._rank},rerank:function(e){const t=[e];let n,i,r;for(;t.length;)if(this.rank(n=t.pop()),i=n._targets)for(r=i.length;--r>=0;)t.push(n=i[r]),n===e&&s("Cycle detected in dataflow graph.")},pulse:function(e,t,n){this.touch(e,n||Ur);const i=new Pr(this,this._clock+(this._pulse?0:1)),r=e.pulse&&e.pulse.source||[];return i.target=e,this._input[e.id]=t.pulse(i,r),this},touch:function(e,t){const n=t||Ur;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},update:function(e,t,n){const i=n||Ur;return(e.set(t)||i.force)&&this.touch(e,i),this},changeset:kr,ingest:function(e,t,n){return t=this.parse(t,n),this.pulse(e,this.changeset().insert(t))},parse:function(e,t){const n=this.locale();return v(e,t,n.timeParse,n.utcParse)},preload:async function(e,t,n){const i=this,r=i._pending||function(e){let t;const n=new Promise((e=>t=e));return n.requests=0,n.done=()=>{0==--n.requests&&(e._pending=null,t(e))},e._pending=n}(i);r.requests+=1;const o=await i.request(t,n);return i.pulse(e,i.changeset().remove(l).insert(o.data||[])),r.done(),o},request:async function(e,t){const n=this;let i,r=0;try{i=await n.loader().load(e,{context:"dataflow",response:b(t&&t.type)});try{i=n.parse(i,t)}catch(o){r=-2,n.warn("Data ingestion failed",e,o)}}catch(o){r=-1,n.warn("Loading failed",e,o)}return{data:i,status:r}},events:function(e,t,n,i){const o=this,a=Or(n,i),s=function(e){e.dataflow=o;try{a.receive(e)}catch(t){o.error(t)}finally{o.run()}};let l;l="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):r(e);const u=l.length;for(let r=0;r<u;++r)l[r].addEventListener(t,s);return a},on:function(e,t,n,i,r){return(e instanceof Sr?Rr:Nr)(this,e,t,n,i,r),this},evaluate:async function(e,t,n){const i=this,r=[];if(i._pulse)return qr(i);if(i._pending&&await i._pending,t&&await fr(i,t),!i._touched.length)return i.debug("Dataflow invoked, but nothing to do."),i;const o=++i._clock;i._pulse=new Pr(i,o,e),i._touched.forEach((e=>i._enqueue(e,!0))),i._touched=cr(x);let a,s,l,u=0;try{for(;i._heap.size()>0;)a=i._heap.pop(),a.rank===a.qrank?(s=a.run(i._getPulse(a,e)),s.then?s=await s:s.async&&(r.push(s.async),s=Tr),s!==Tr&&a._targets&&a._targets.forEach((e=>i._enqueue(e))),++u):i._enqueue(a,!0)}catch(c){i._heap.clear(),l=c}if(i._input={},i._pulse=null,i.debug(`Pulse ${o}: ${u} operators`),l&&(i._postrun=[],i.error(l)),i._postrun.length){const e=i._postrun.sort(((e,t)=>t.priority-e.priority));i._postrun=[];for(let t=0;t<e.length;++t)await fr(i,e[t].callback)}return n&&await fr(i,n),r.length&&Promise.all(r).then((e=>i.runAsync(null,(()=>{e.forEach((e=>{try{e(i)}catch(c){i.error(c)}}))})))),i},run:function(e,t,n){return this._pulse?qr(this):(this.evaluate(e,t,n),this)},runAsync:async function(e,t,n){for(;this._running;)await this._running;const i=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(i,i),this._running},runAfter:function(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(i){this.error(i)}},_enqueue:function(e,t){const n=e.stamp<this._clock;n&&(e.stamp=this._clock),(n||t)&&(e.qrank=e.rank,this._heap.push(e))},_getPulse:function(e,t){const n=e.source,i=this._clock;return n&&a(n)?new Ir(this,i,n.map((e=>e.pulse)),t):this._input[e.id]||function(e,t){if(t&&t.stamp===e.stamp)return t;e=e.fork(),t&&t!==Tr&&(e.source=t.source);return e}(this._pulse,n&&n.pulse)}},i(Xr,Sr,{run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?this.skip(!1):t=this.evaluate(e),t=t||e,t.then?t=t.then((e=>this.pulse=e)):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});const Yr={};function Jr(e){const t=Qr(e);return t&&t.Definition||null}function Qr(e){return e=e&&e.toLowerCase(),m(Yr,e)?Yr[e]:null}function*Kr(e,t){if(null==t)for(let n of e)null!=n&&""!==n&&(n=+n)>=n&&(yield n);else{let n=-1;for(let i of e)i=t(i,++n,e),null!=i&&""!==i&&(i=+i)>=i&&(yield i)}}function Zr(e,n,i){const r=Float64Array.from(Kr(e,i));return r.sort(t),n.map((e=>ui(r,e)))}function eo(e,t){return Zr(e,[.25,.5,.75],t)}function to(e,t){const n=e.length,i=function(e,t){const n=function(e,t){let n,i=0,r=0,o=0;if(void 0===t)for(let a of e)null!=a&&(a=+a)>=a&&(n=a-r,r+=n/++i,o+=n*(a-r));else{let a=-1;for(let s of e)null!=(s=t(s,++a,e))&&(s=+s)>=s&&(n=s-r,r+=n/++i,o+=n*(s-r))}if(i>1)return o/(i-1)}(e,t);return n?Math.sqrt(n):n}(e,t),r=eo(e,t),o=(r[2]-r[0])/1.34;return 1.06*(Math.min(i,o)||i||Math.abs(r[0])||1)*Math.pow(n,-.2)}function no(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let o,a,s,l,u,c,f=e.extent[0],d=e.extent[1];const h=e.span||d-f||Math.abs(f)||1;if(e.step)o=e.step;else if(e.steps){for(l=h/t,u=0,c=e.steps.length;u<c&&e.steps[u]<l;++u);o=e.steps[Math.max(0,u-1)]}else{for(a=Math.ceil(Math.log(t)/i),s=e.minstep||0,o=Math.max(s,Math.pow(n,Math.round(Math.log(h)/i)-a));Math.ceil(h/o)>t;)o*=n;for(u=0,c=r.length;u<c;++u)l=o/r[u],l>=s&&h/l<=t&&(o=l)}l=Math.log(o);const p=l>=0?0:1+~~(-l/i),m=Math.pow(n,-p-1);return(e.nice||void 0===e.nice)&&(l=Math.floor(f/o+m)*o,f=f<l?l-o:l,d=Math.ceil(d/o)*o),{start:f,stop:d===f?f+o:d,step:o}}var io=Math.random;function ro(e,n,i,r){if(!e.length)return[void 0,void 0];const o=Float64Array.from(Kr(e,r)),a=o.length,s=n;let l,u,c,f;for(c=0,f=Array(s);c<s;++c){for(l=0,u=0;u<a;++u)l+=o[~~(io()*a)];f[c]=l/a}return f.sort(t),[li(f,i/2),li(f,1-i/2)]}function oo(e,t,n,i){i=i||(e=>e);const r=e.length,o=new Float64Array(r);let a,s=0,l=1,u=i(e[0]),c=u,f=u+t;for(;l<r;++l){if(a=i(e[l]),a>=f){for(c=(u+c)/2;s<l;++s)o[s]=c;f=a+t,u=a}c=a}for(c=(u+c)/2;s<l;++s)o[s]=c;return n?function(e,t){const n=e.length;let i,r,o=0,a=1;for(;e[o]===e[a];)++a;for(;a<n;){for(i=a+1;e[a]===e[i];)++i;if(e[a]-e[a-1]<t){for(r=a+(o+i-a-a>>1);r<a;)e[r++]=e[a];for(;r>a;)e[r--]=e[o]}o=a,a=i}return e}(o,t+t/4):o}const ao=Math.sqrt(2*Math.PI),so=Math.SQRT2;let lo=NaN;function uo(e,t){e=e||0,t=null==t?1:t;let n,i,r=0,o=0;if(lo==lo)r=lo,lo=NaN;else{do{r=2*io()-1,o=2*io()-1,n=r*r+o*o}while(0===n||n>1);i=Math.sqrt(-2*Math.log(n)/n),r*=i,lo=o*i}return e+r*t}function co(e,t,n){const i=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*i*i)/(n*ao)}function fo(e,t,n){const i=(e-(t=t||0))/(n=null==n?1:n),r=Math.abs(i);let o;if(r>37)o=0;else{const e=Math.exp(-r*r/2);let t;r<7.07106781186547?(t=.0352624965998911*r+.700383064443688,t=t*r+6.37396220353165,t=t*r+33.912866078383,t=t*r+112.079291497871,t=t*r+221.213596169931,t=t*r+220.206867912376,o=e*t,t=.0883883476483184*r+1.75566716318264,t=t*r+16.064177579207,t=t*r+86.7807322029461,t=t*r+296.564248779674,t=t*r+637.333633378831,t=t*r+793.826512519948,t=t*r+440.413735824752,o/=t):(t=r+.65,t=r+4/t,t=r+3/t,t=r+2/t,t=r+1/t,o=e/t/2.506628274631)}return i>0?1-o:o}function ho(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*so*function(e){let t,n=-Math.log((1-e)*(1+e));n<6.25?(n-=3.125,t=-364441206401782e-35,t=t*n-16850591381820166e-35,t=128584807152564e-32+t*n,t=11157877678025181e-33+t*n,t=t*n-1333171662854621e-31,t=20972767875968562e-33+t*n,t=6637638134358324e-30+t*n,t=t*n-4054566272975207e-29,t=t*n-8151934197605472e-29,t=26335093153082323e-28+t*n,t=t*n-12975133253453532e-27,t=t*n-5415412054294628e-26,t=1.0512122733215323e-9+t*n,t=t*n-4.112633980346984e-9,t=t*n-2.9070369957882005e-8,t=4.2347877827932404e-7+t*n,t=t*n-13654692000834679e-22,t=t*n-13882523362786469e-21,t=.00018673420803405714+t*n,t=t*n-.000740702534166267,t=t*n-.006033670871430149,t=.24015818242558962+t*n,t=1.6536545626831027+t*n):n<16?(n=Math.sqrt(n)-3.25,t=2.2137376921775787e-9,t=9.075656193888539e-8+t*n,t=t*n-2.7517406297064545e-7,t=1.8239629214389228e-8+t*n,t=15027403968909828e-22+t*n,t=t*n-4013867526981546e-21,t=29234449089955446e-22+t*n,t=12475304481671779e-21+t*n,t=t*n-47318229009055734e-21,t=6828485145957318e-20+t*n,t=24031110387097894e-21+t*n,t=t*n-.0003550375203628475,t=.0009532893797373805+t*n,t=t*n-.0016882755560235047,t=.002491442096107851+t*n,t=t*n-.003751208507569241,t=.005370914553590064+t*n,t=1.0052589676941592+t*n,t=3.0838856104922208+t*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,t=-27109920616438573e-27,t=t*n-2.555641816996525e-10,t=1.5076572693500548e-9+t*n,t=t*n-3.789465440126737e-9,t=7.61570120807834e-9+t*n,t=t*n-1.496002662714924e-8,t=2.914795345090108e-8+t*n,t=t*n-6.771199775845234e-8,t=2.2900482228026655e-7+t*n,t=t*n-9.9298272942317e-7,t=4526062597223154e-21+t*n,t=t*n-1968177810553167e-20,t=7599527703001776e-20+t*n,t=t*n-.00021503011930044477,t=t*n-.00013871931833623122,t=1.0103004648645344+t*n,t=4.849906401408584+t*n):t=1/0;return t*e}(2*e-1)}function po(e,t){let n,i;const r={mean(e){return arguments.length?(n=e||0,r):n},stdev(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>uo(n,i),pdf:e=>co(e,n,i),cdf:e=>fo(e,n,i),icdf:e=>ho(e,n,i)};return r.mean(e).stdev(t)}function mo(e,t){const n=po();let i=0;const r={data(n){return arguments.length?(e=n,i=n?n.length:0,r.bandwidth(t)):e},bandwidth(n){return arguments.length?(!(t=n)&&e&&(t=to(e)),r):t},sample:()=>e[~~(io()*i)]+t*n.sample(),pdf(r){let o=0,a=0;for(;a<i;++a)o+=n.pdf((r-e[a])/t);return o/t/i},cdf(r){let o=0,a=0;for(;a<i;++a)o+=n.cdf((r-e[a])/t);return o/i},icdf(){throw Error("KDE icdf not supported.")}};return r.data(e)}function go(e,t){return e=e||0,t=null==t?1:t,Math.exp(e+uo()*t)}function yo(e,t,n){if(e<=0)return 0;t=t||0,n=null==n?1:n;const i=(Math.log(e)-t)/n;return Math.exp(-.5*i*i)/(n*ao*e)}function vo(e,t,n){return fo(Math.log(e),t,n)}function bo(e,t,n){return Math.exp(ho(e,t,n))}function xo(e,t){let n,i;const r={mean(e){return arguments.length?(n=e||0,r):n},stdev(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>go(n,i),pdf:e=>yo(e,n,i),cdf:e=>vo(e,n,i),icdf:e=>bo(e,n,i)};return r.mean(e).stdev(t)}function wo(e,t){let n,i=0;const r={weights(e){return arguments.length?(n=function(e){const t=[];let n,r=0;for(n=0;n<i;++n)r+=t[n]=null==e[n]?1:+e[n];for(n=0;n<i;++n)t[n]/=r;return t}(t=e||[]),r):t},distributions(n){return arguments.length?(n?(i=n.length,e=n):(i=0,e=[]),r.weights(t)):e},sample(){const t=io();let r=e[i-1],o=n[0],a=0;for(;a<i-1;o+=n[++a])if(t<o){r=e[a];break}return r.sample()},pdf(t){let r=0,o=0;for(;o<i;++o)r+=n[o]*e[o].pdf(t);return r},cdf(t){let r=0,o=0;for(;o<i;++o)r+=n[o]*e[o].cdf(t);return r},icdf(){throw Error("Mixture icdf not supported.")}};return r.distributions(e).weights(t)}function _o(e,t){return null==t&&(t=null==e?1:e,e=0),e+(t-e)*io()}function ko(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=t&&e<=n?1/(n-t):0}function Eo(e,t,n){return null==n&&(n=null==t?1:t,t=0),e<t?0:e>n?1:(e-t)/(n-t)}function $o(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function Ao(e,t){let n,i;const r={min(e){return arguments.length?(n=e||0,r):n},max(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>_o(n,i),pdf:e=>ko(e,n,i),cdf:e=>Eo(e,n,i),icdf:e=>$o(e,n,i)};return null==t&&(t=null==e?1:e,e=0),r.min(e).max(t)}function Do(e,t,n){let i=0,r=0;for(const o of e){const e=n(o);null==t(o)||null==e||isNaN(e)||(i+=(e-i)/++r)}return{coef:[i],predict:()=>i,rSquared:0}}function So(e,t,n,i){const r=i-e*e,o=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-o*e,o]}function Fo(e,t,n,i){e=e.filter((e=>{let i=t(e),r=n(e);return null!=i&&(i=+i)>=i&&null!=r&&(r=+r)>=r})),i&&e.sort(((e,n)=>t(e)-t(n)));const r=e.length,o=new Float64Array(r),a=new Float64Array(r);let s,l,u,c=0,f=0,d=0;for(u of e)o[c]=s=+t(u),a[c]=l=+n(u),++c,f+=(s-f)/c,d+=(l-d)/c;for(c=0;c<r;++c)o[c]-=f,a[c]-=d;return[o,a,f,d]}function Co(e,t,n,i){let r,o,a=-1;for(const s of e)r=t(s),o=n(s),null!=r&&(r=+r)>=r&&null!=o&&(o=+o)>=o&&i(r,o,++a)}function Mo(e,t,n,i,r){let o=0,a=0;return Co(e,t,n,((e,t)=>{const n=t-r(e),s=t-i;o+=n*n,a+=s*s})),1-o/a}function Oo(e,t,n){let i=0,r=0,o=0,a=0,s=0;Co(e,t,n,((e,t)=>{++s,i+=(e-i)/s,r+=(t-r)/s,o+=(e*t-o)/s,a+=(e*e-a)/s}));const l=So(i,r,o,a),u=e=>l[0]+l[1]*e;return{coef:l,predict:u,rSquared:Mo(e,t,n,r,u)}}function zo(e,t,n){let i=0,r=0,o=0,a=0,s=0;Co(e,t,n,((e,t)=>{++s,e=Math.log(e),i+=(e-i)/s,r+=(t-r)/s,o+=(e*t-o)/s,a+=(e*e-a)/s}));const l=So(i,r,o,a),u=e=>l[0]+l[1]*Math.log(e);return{coef:l,predict:u,rSquared:Mo(e,t,n,r,u)}}function No(e,t,n){const[i,r,o,a]=Fo(e,t,n);let s,l,u,c=0,f=0,d=0,h=0,p=0;Co(e,t,n,((e,t)=>{s=i[p++],l=Math.log(t),u=s*t,c+=(t*l-c)/p,f+=(u-f)/p,d+=(u*l-d)/p,h+=(s*u-h)/p}));const[m,g]=So(f/a,c/a,d/a,h/a),y=e=>Math.exp(m+g*(e-o));return{coef:[Math.exp(m-g*o),g],predict:y,rSquared:Mo(e,t,n,a,y)}}function Ro(e,t,n){let i=0,r=0,o=0,a=0,s=0,l=0;Co(e,t,n,((e,t)=>{const n=Math.log(e),u=Math.log(t);++l,i+=(n-i)/l,r+=(u-r)/l,o+=(n*u-o)/l,a+=(n*n-a)/l,s+=(t-s)/l}));const u=So(i,r,o,a),c=e=>u[0]*Math.pow(e,u[1]);return u[0]=Math.exp(u[0]),{coef:u,predict:c,rSquared:Mo(e,t,n,s,c)}}function To(e,t,n){const[i,r,o,a]=Fo(e,t,n),s=i.length;let l,u,c,f,d=0,h=0,p=0,m=0,g=0;for(l=0;l<s;)u=i[l],c=r[l++],f=u*u,d+=(f-d)/l,h+=(f*u-h)/l,p+=(f*f-p)/l,m+=(u*c-m)/l,g+=(f*c-g)/l;const y=p-d*d,v=d*y-h*h,b=(g*d-m*h)/v,x=(m*y-g*h)/v,w=-b*d,_=e=>b*(e-=o)*e+x*e+w+a;return{coef:[w-x*o+b*o*o+a,x-2*b*o,b],predict:_,rSquared:Mo(e,t,n,a,_)}}function Po(e,t,n,i){if(0===i)return Do(e,t,n);if(1===i)return Oo(e,t,n);if(2===i)return To(e,t,n);const[r,o,a,s]=Fo(e,t,n),l=r.length,u=[],c=[],f=i+1;let d,h,p,m,g;for(d=0;d<f;++d){for(p=0,m=0;p<l;++p)m+=Math.pow(r[p],d)*o[p];for(u.push(m),g=new Float64Array(f),h=0;h<f;++h){for(p=0,m=0;p<l;++p)m+=Math.pow(r[p],d+h);g[h]=m}c.push(g)}c.push(u);const y=function(e){const t=e.length-1,n=[];let i,r,o,a,s;for(i=0;i<t;++i){for(a=i,r=i+1;r<t;++r)Math.abs(e[i][r])>Math.abs(e[i][a])&&(a=r);for(o=i;o<t+1;++o)s=e[o][i],e[o][i]=e[o][a],e[o][a]=s;for(r=i+1;r<t;++r)for(o=t;o>=i;o--)e[o][r]-=e[o][i]*e[i][r]/e[i][i]}for(r=t-1;r>=0;--r){for(s=0,o=r+1;o<t;++o)s+=e[o][r]*n[o];n[r]=(e[t][r]-s)/e[r][r]}return n}(c),v=e=>{e-=a;let t=s+y[0]+y[1]*e+y[2]*e*e;for(d=3;d<f;++d)t+=y[d]*Math.pow(e,d);return t};return{coef:Lo(f,y,-a,s),predict:v,rSquared:Mo(e,t,n,s,v)}}function Lo(e,t,n,i){const r=Array(e);let o,a,s,l;for(o=0;o<e;++o)r[o]=0;for(o=e-1;o>=0;--o)for(s=t[o],l=1,r[o]+=s,a=1;a<=o;++a)l*=(o+1-a)/a,r[o-a]+=s*Math.pow(n,a)*l;return r[0]+=i,r}function Bo(e,t,n,i){const[r,o,a,s]=Fo(e,t,n,!0),l=r.length,u=Math.max(2,~~(i*l)),c=new Float64Array(l),f=new Float64Array(l),d=new Float64Array(l).fill(1);for(let h=-1;++h<=2;){const e=[0,u-1];for(let n=0;n<l;++n){const t=r[n],i=e[0],a=e[1],s=t-r[i]>r[a]-t?i:a;let l=0,u=0,h=0,p=0,m=0;const g=1/Math.abs(r[s]-t||1);for(let e=i;e<=a;++e){const n=r[e],i=o[e],a=jo(Math.abs(t-n)*g)*d[e],s=n*a;l+=a,u+=s,h+=i*a,p+=i*s,m+=n*s}const[y,v]=So(u/l,h/l,p/l,m/l);c[n]=y+v*t,f[n]=Math.abs(o[n]-c[n]),Io(r,n+1,e)}if(2===h)break;const t=ci(f);if(Math.abs(t)<1e-12)break;for(let n,i,r=0;r<l;++r)n=f[r]/(6*t),d[r]=n>=1?1e-12:(i=1-n*n)*i}return function(e,t,n,i){const r=e.length,o=[];let a,s=0,l=0,u=[];for(;s<r;++s)a=e[s]+n,u[0]===a?u[1]+=(t[s]-u[1])/++l:(l=0,u[1]+=i,u=[a,t[s]],o.push(u));return u[1]+=i,o}(r,c,a,s)}function jo(e){return(e=1-e*e*e)*e*e}function Io(e,t,n){const i=e[t];let r=n[0],o=n[1]+1;if(!(o>=e.length))for(;t>r&&e[o]-i<=i-e[r];)n[0]=++r,n[1]=o,++o}const qo=.5*Math.PI/180;function Uo(e,t,n,i){n=n||25,i=Math.max(n,i||200);const r=t=>[t,e(t)],o=t[0],a=t[1],s=a-o,l=s/i,u=[r(o)],c=[];if(n===i){for(let e=1;e<i;++e)u.push(r(o+e/n*s));return u.push(r(a)),u}c.push(r(a));for(let m=n;--m>0;)c.push(r(o+m/n*s));let f=u[0],d=c[c.length-1];const h=1/s,p=function(e,t){let n=e,i=e;const r=t.length;for(let o=0;o<r;++o){const e=t[o][1];e<n&&(n=e),e>i&&(i=e)}return 1/(i-n)}(f[1],c);for(;d;){const e=r((f[0]+d[0])/2);e[0]-f[0]>=l&&Wo(f,e,d,h,p)>qo?c.push(e):(f=d,u.push(d),c.pop()),d=c[c.length-1]}return u}function Wo(e,t,n,i,r){const o=Math.atan2(r*(n[1]-e[1]),i*(n[0]-e[0])),a=Math.atan2(r*(t[1]-e[1]),i*(t[0]-e[0]));return Math.abs(o-a)}function Ho(e){return e&&e.length?1===e.length?e[0]:(t=e,e=>{const n=t.length;let i=1,r=String(t[0](e));for(;i<n;++i)r+="|"+t[i](e);return r}):function(){return""};var t}function Go(e,t,n){return n||e+(t?"_"+t:"")}const Vo=()=>{},Xo={init:Vo,add:Vo,rem:Vo,idx:0},Yo={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.valid?e.sum:void 0,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t<e.min||void 0===e.min)&&(e.min=t)},rem:(e,t)=>{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||void 0===e.max)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t<e.min&&(e.argmin=n)},rem:(e,t)=>{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:["exponential"],idx:1}},Jo=Object.keys(Yo).filter((e=>"__count__"!==e));function Qo(e,t,n){return Yo[e](n,t)}function Ko(e,t){return e.idx-t.idx}function Zo(){this.valid=0,this.missing=0,this._ops.forEach((e=>null==e.aggregate_param?e.init(this):e.init(this,e.aggregate_param)))}function ea(e,t){null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach((n=>n.add(this,e,t)))):++this.missing}function ta(e,t){null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach((n=>n.rem(this,e,t)))):--this.missing}function na(e){return this._out.forEach((t=>e[t.out]=t.value(this))),e}function ia(e,t){const n=t||u,i=function(e){const t={};e.forEach((e=>t[e.name]=e));const n=e=>{e.req&&e.req.forEach((e=>{t[e]||n(t[e]=Yo[e]())}))};return e.forEach(n),Object.values(t).sort(Ko)}(e),r=e.slice().sort(Ko);function o(e){this._ops=i,this._out=r,this.cell=e,this.init()}return o.prototype.init=Zo,o.prototype.add=ea,o.prototype.rem=ta,o.prototype.set=na,o.prototype.get=n,o.fields=e.map((e=>e.out)),o}function ra(e){this._key=e?P(e):mr,this.reset()}[...Jo,"__count__"].forEach((e=>{Yo[e]=function(e,t){return(n,i)=>w({name:e,aggregate_param:i,out:n||e},Xo,t)}(e,Yo[e])}));const oa=ra.prototype;function aa(e){Xr.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}oa.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},oa.add=function(e){this._add.push(e)},oa.rem=function(e){this._rem.push(e)},oa.values=function(){if(this._get=null,0===this._rem.length)return this._add;const e=this._add,t=this._rem,n=this._key,i=e.length,r=t.length,o=Array(i-r),a={};let s,l,u;for(s=0;s<r;++s)a[n(t[s])]=1;for(s=0,l=0;s<i;++s)a[n(u=e[s])]?a[n(u)]=0:o[l++]=u;return this._rem=[],this._add=o},oa.distinct=function(e){const t=this.values(),n={};let i,r=t.length,o=0;for(;--r>=0;)i=e(t[r])+"",m(n,i)||(n[i]=1,++o);return o},oa.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=L(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},oa.argmin=function(e){return this.extent(e)[0]||{}},oa.argmax=function(e){return this.extent(e)[1]||{}},oa.min=function(e){const t=this.extent(e)[0];return null!=t?e(t):void 0},oa.max=function(e){const t=this.extent(e)[1];return null!=t?e(t):void 0},oa.quartile=function(e){return this._get===e&&this._q||(this._q=eo(this.values(),e),this._get=e),this._q},oa.q1=function(e){return this.quartile(e)[0]},oa.q2=function(e){return this.quartile(e)[1]},oa.q3=function(e){return this.quartile(e)[2]},oa.ci=function(e){return this._get===e&&this._ci||(this._ci=ro(this.values(),1e3,.05,e),this._get=e),this._ci},oa.ci0=function(e){return this.ci(e)[0]},oa.ci1=function(e){return this.ci(e)[1]},aa.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Jo},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},i(aa,Xr,{transform(e,t){const n=this,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.modified();return n.stamp=i.stamp,n.value&&(r||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=r?n.init(e):Object.create(null),t.visit(t.SOURCE,(e=>n.add(e)))):(n.value=n.value||n.init(e),t.visit(t.REM,(e=>n.rem(e))),t.visit(t.ADD,(e=>n.add(e)))),i.modifies(n._outputs),n._drop=!1!==e.drop,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&i.clean(!0).runAfter((()=>this.clean())),n.changes(i)},cross(){const e=this,t=e.value,n=e._dnames,i=n.map((()=>({}))),r=n.length;function o(e){let t,o,a,s;for(t in e)for(a=e[t].tuple,o=0;o<r;++o)i[o][s=a[n[o]]]=s}o(e._prev),o(t),function o(a,s,l){const u=n[l],c=i[l++];for(const n in c){const i=a?a+"|"+n:n;s[u]=c[n],l<r?o(i,s,l):t[i]||e.cell(i,s)}}("",{},0)},init(e){const t=this._inputs=[],n=this._outputs=[],i={};function o(e){const n=r(_(e)),o=n.length;let a,s=0;for(;s<o;++s)i[a=n[s]]||(i[a]=1,t.push(a))}this._dims=r(e.groupby),this._dnames=this._dims.map((e=>{const t=$(e);return o(e),n.push(t),t})),this.cellkey=e.key?e.key:Ho(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const a=e.fields||[null],l=e.ops||["count"],u=e.aggregate_params||[null],c=e.as||[],f=a.length,d={};let h,p,m,g,y,v,b;for(f!==l.length&&s("Unmatched number of fields and aggregate ops."),b=0;b<f;++b)h=a[b],p=l[b],m=u[b]||null,null==h&&"count"!==p&&s("Null aggregate field specified."),y=$(h),v=Go(p,y,c[b]),n.push(v),"count"!==p?(g=d[y],g||(o(h),g=d[y]=[],g.field=h,this._measures.push(g)),"count"!==p&&(this._countOnly=!1),g.push(Qo(p,m,v))):this._counts.push(v);return this._measures=this._measures.map((e=>ia(e,e.field))),Object.create(null)},cellkey:Ho(),cell(e,t){let n=this.value[e];return n?0===n.num&&this._drop&&n.stamp<this.stamp?(n.stamp=this.stamp,this._adds[this._alen++]=n):n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n):(n=this.value[e]=this.newcell(e,t),this._adds[this._alen++]=n),n},newcell(e,t){const n={key:e,num:0,agg:null,tuple:this.newtuple(t,this._prev&&this._prev[e]),stamp:this.stamp,store:!1};if(!this._countOnly){const e=this._measures,t=e.length;n.agg=Array(t);for(let i=0;i<t;++i)n.agg[i]=new e[i](n)}return n.store&&(n.data=new ra),n},newtuple(e,t){const n=this._dnames,i=this._dims,r=i.length,o={};for(let a=0;a<r;++a)o[n[a]]=i[a](e);return t?xr(t.tuple,o):yr(o)},clean(){const e=this.value;for(const t in e)0===e[t].num&&delete e[t]},add(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num+=1,this._countOnly)return;n.store&&n.data.add(e);const i=n.agg;for(let r=0,o=i.length;r<o;++r)i[r].add(i[r].get(e),e)},rem(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num-=1,this._countOnly)return;n.store&&n.data.rem(e);const i=n.agg;for(let r=0,o=i.length;r<o;++r)i[r].rem(i[r].get(e),e)},celltuple(e){const t=e.tuple,n=this._counts;e.store&&e.data.values();for(let i=0,r=n.length;i<r;++i)t[n[i]]=e.num;if(!this._countOnly){const n=e.agg;for(let e=0,i=n.length;e<i;++e)n[e].set(t)}return t},changes(e){const t=this._adds,n=this._mods,i=this._prev,r=this._drop,o=e.add,a=e.rem,s=e.mod;let l,u,c,f;if(i)for(u in i)l=i[u],r&&!l.num||a.push(l.tuple);for(c=0,f=this._alen;c<f;++c)o.push(this.celltuple(t[c])),t[c]=null;for(c=0,f=this._mlen;c<f;++c)l=n[c],(0===l.num&&r?a:s).push(this.celltuple(l)),n[c]=null;return this._alen=this._mlen=0,this._prev=null,e}});function sa(e){Xr.call(this,null,e)}function la(e,t,n){const i=e;let r=t||[],o=n||[],a={},s=0;return{add:e=>o.push(e),remove:e=>a[i(e)]=++s,size:()=>r.length,data:(e,t)=>(s&&(r=r.filter((e=>!a[i(e)])),a={},s=0),t&&e&&r.sort(e),o.length&&(r=e?B(e,r,o.sort(e)):r.concat(o),o=[]),r)}}function ua(e){Xr.call(this,[],e)}function ca(e){Sr.call(this,null,fa,e)}function fa(e){return this.value&&!e.modified()?this.value:j(e.fields,e.orders)}function da(e){Xr.call(this,null,e)}function ha(e){Xr.call(this,null,e)}sa.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},i(sa,Xr,{transform(e,t){const n=!1!==e.interval,i=this._bins(e),r=i.start,o=i.step,a=e.as||["bin0","bin1"],s=a[0],l=a[1];let u;return u=e.modified()?(t=t.reflow(!0)).SOURCE:t.modified(_(e.field))?t.ADD_MOD:t.ADD,t.visit(u,n?e=>{const t=i(e);e[s]=t,e[l]=null==t?null:r+o*(1+(t-r)/o)}:e=>e[s]=i(e)),t.modifies(n?a:s)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=no(e),i=n.step;let r,o,a=n.start,s=a+Math.ceil((n.stop-a)/i)*i;null!=(r=e.anchor)&&(o=r-(a+i*Math.floor((r-a)/i)),a+=o,s+=o);const l=function(e){let n=D(t(e));return null==n?null:n<a?-1/0:n>s?1/0:(n=Math.max(a,Math.min(n,s-i)),a+i*Math.floor(1e-14+(n-a)/i))};return l.start=a,l.stop=n.stop,l.step=i,this.value=k(l,_(t),e.name||"bin_"+$(t))}}),ua.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},i(ua,Xr,{transform(e,t){const n=t.fork(t.ALL),i=la(mr,this.value,n.materialize(n.ADD).add),r=e.sort,o=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return n.visit(n.REM,i.remove),this.modified(o),this.value=n.source=i.data(wr(r),o),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),i(ca,Sr),da.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},i(da,Xr,{transform(e,t){const n=t=>n=>{for(var i,r=function(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase()}return e.match(n)}(s(n),e.case,o)||[],l=0,u=r.length;l<u;++l)a.test(i=r[l])||t(i)},i=this._parameterCheck(e,t),r=this._counts,o=this._match,a=this._stop,s=e.field,l=e.as||["text","count"],u=n((e=>r[e]=1+(r[e]||0))),c=n((e=>r[e]-=1));return i?t.visit(t.SOURCE,u):(t.visit(t.ADD,u),t.visit(t.REM,c)),this._finish(t,l)},_parameterCheck(e,t){let n=!1;return!e.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),!e.modified("pattern")&&this._match||(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){const n=this._counts,i=this._tuples||(this._tuples={}),r=t[0],o=t[1],a=e.fork(e.NO_SOURCE|e.NO_FIELDS);let s,l,u;for(s in n)l=i[s],u=n[s]||0,!l&&u?(i[s]=l=yr({}),l[r]=s,l[o]=u,a.add.push(l)):0===u?(l&&a.rem.push(l),n[s]=null,i[s]=null):l[o]!==u&&(l[o]=u,a.mod.push(l));return a.modifies(t)}}),ha.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},i(ha,Xr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.as||["a","b"],r=i[0],o=i[1],a=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let s=this.value;return a?(s&&(n.rem=s),s=t.materialize(t.SOURCE).source,n.add=this.value=function(e,t,n,i){for(var r,o,a=[],s={},l=e.length,u=0;u<l;++u)for(s[t]=o=e[u],r=0;r<l;++r)s[n]=e[r],i(s)&&(a.push(yr(s)),(s={})[t]=o);return a}(s,r,o,e.filter||l)):n.mod=s,n.source=this.value,n.modifies(i)}});const pa={kde:mo,mixture:wo,normal:po,lognormal:xo,uniform:Ao},ma="function";function ga(e,t){const n=e[ma];m(pa,n)||s("Unknown distribution function: "+n);const i=pa[n]();for(const r in e)"field"===r?i.data((e.from||t()).map(e[r])):"distributions"===r?i[r](e[r].map((e=>ga(e,t)))):typeof i[r]===ma&&i[r](e[r]);return i}function ya(e){Xr.call(this,null,e)}const va=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],ba={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:va},{name:"weights",type:"number",array:!0}]};function xa(e,t){return e?e.map(((e,n)=>t[n]||$(e))):null}function wa(e,t,n){const i=[],r=e=>e(l);let o,a,s,l,u,c;if(null==t)i.push(e.map(n));else for(o={},a=0,s=e.length;a<s;++a)l=e[a],u=t.map(r),c=o[u],c||(o[u]=c=[],c.dims=u,i.push(c)),c.push(n(l));return i}ya.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:va.concat(ba)},{name:"as",type:"string",array:!0,default:["value","density"]}]},i(ya,Xr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=ga(e.distribution,function(e){return()=>e.materialize(e.SOURCE).source}(t)),r=e.steps||e.minsteps||25,o=e.steps||e.maxsteps||200;let a=e.method||"pdf";"pdf"!==a&&"cdf"!==a&&s("Invalid density method: "+a),e.extent||i.data||s("Missing density extent parameter."),a=i[a];const l=e.as||["value","density"],u=Uo(a,e.extent||A(i.data()),r,o).map((e=>{const t={};return t[l[0]]=e[0],t[l[1]]=e[1],yr(t)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=u}return n}});function _a(e){Xr.call(this,null,e)}_a.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]};function ka(e){Sr.call(this,null,Ea,e),this.modified(!0)}function Ea(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:k((n=>t(n,e)),_(t),$(t))}function $a(e){Xr.call(this,[void 0,void 0],e)}function Aa(e,t){Sr.call(this,e),this.parent=t,this.count=0}function Da(e){Xr.call(this,{},e),this._keys=q();const t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,i=t.active;n<i;++n)e(t[n],n,t)}}function Sa(e){Sr.call(this,null,Fa,e)}function Fa(e){return this.value&&!e.modified()?this.value:a(e.name)?r(e.name).map((e=>P(e))):P(e.name,e.as)}function Ca(e){Xr.call(this,q(),e)}function Ma(e){Xr.call(this,[],e)}function Oa(e){Xr.call(this,[],e)}function za(e){Xr.call(this,null,e)}function Na(e){Xr.call(this,[],e)}i(_a,Xr,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,i=wa(t.source,e.groupby,u),r=e.smooth||!1,o=e.field,a=e.step||((e,t)=>I(A(e,t))/30)(n,o),s=wr(((e,t)=>o(e)-o(t))),l=e.as||"bin",c=i.length;let f,d=1/0,h=-1/0,p=0;for(;p<c;++p){const e=i[p].sort(s);f=-1;for(const t of oo(e,a,r,o))t<d&&(d=t),t>h&&(h=t),e[++f][l]=t}return this.value={start:d,stop:h,step:a},t.reflow(!0).modifies(l)}}),i(ka,Sr),$a.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},i($a,Xr,{transform(e,t){const n=this.value,i=e.field,r=t.changed()||t.modified(i.fields)||e.modified("field");let o=n[0],a=n[1];if((r||null==o)&&(o=1/0,a=-1/0),t.visit(r?t.SOURCE:t.ADD,(e=>{const t=D(i(e));null!=t&&(t<o&&(o=t),t>a&&(a=t))})),!Number.isFinite(o)||!Number.isFinite(a)){let e=$(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),i(Aa,Sr,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),i(Da,Xr,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,i){const r=this.value;let o,a,s=m(r,e)&&r[e];return s?s.value.stamp<n.stamp&&(s.init(n),this.activate(s)):(a=i||(a=this._group[e])&&a.tuple,o=n.dataflow,s=new Aa(n.fork(n.NO_SOURCE),this),o.add(s).connect(t(o,e,a)),r[e]=s,this.activate(s)),s},clean(){const e=this.value;let t=0;for(const n in e)if(0===e[n].count){const i=e[n].detachSubflow;i&&i(),delete e[n],++t}if(t){const e=this._targets.filter((e=>e&&e.count>0));this.initTargets(e)}},initTargets(e){const t=this._targets,n=t.length,i=e?e.length:0;let r=0;for(;r<i;++r)t[r]=e[r];for(;r<n&&null!=t[r];++r)t[r]=null;t.active=i},transform(e,t){const n=t.dataflow,i=e.key,r=e.subflow,o=this._keys,a=e.modified("key"),s=e=>this.subflow(e,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,(e=>{const t=mr(e),n=o.get(t);void 0!==n&&(o.delete(t),s(n).rem(e))})),t.visit(t.ADD,(e=>{const t=i(e);o.set(mr(e),t),s(t).add(e)})),a||t.modified(i.fields)?t.visit(t.MOD,(e=>{const t=mr(e),n=o.get(t),r=i(e);n===r?s(r).mod(e):(o.set(t,r),s(n).rem(e),s(r).add(e))})):t.changed(t.MOD)&&t.visit(t.MOD,(e=>{s(o.get(mr(e))).mod(e)})),a&&t.visit(t.REFLOW,(e=>{const t=mr(e),n=o.get(t),r=i(e);n!==r&&(o.set(t,r),s(n).rem(e),s(r).add(e))})),t.clean()?n.runAfter((()=>{this.clean(),o.clean()})):o.empty>n.cleanThreshold&&n.runAfter(o.clean),t}}),i(Sa,Sr),Ca.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},i(Ca,Xr,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),o=r.add,a=r.rem,s=r.mod,l=e.expr;let u=!0;function c(t){const n=mr(t),r=l(t,e),c=i.get(n);r&&c?(i.delete(n),o.push(t)):r||c?u&&r&&!c&&s.push(t):(i.set(n,1),a.push(t))}return t.visit(t.REM,(e=>{const t=mr(e);i.has(t)?i.delete(t):a.push(e)})),t.visit(t.ADD,(t=>{l(t,e)?o.push(t):i.set(mr(t),1)})),t.visit(t.MOD,c),e.modified()&&(u=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}}),Ma.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},i(Ma,Xr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=xa(i,e.as||[]),o=e.index||null,a=r.length;return n.rem=this.value,t.visit(t.SOURCE,(e=>{const t=i.map((t=>t(e))),s=t.reduce(((e,t)=>Math.max(e,t.length)),0);let l,u,c,f=0;for(;f<s;++f){for(u=vr(e),l=0;l<a;++l)u[r[l]]=null==(c=t[l][f])?null:c;o&&(u[o]=f),n.add.push(u)}})),this.value=n.source=n.add,o&&n.modifies(o),n.modifies(r)}}),Oa.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},i(Oa,Xr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=i.map($),o=e.as||["key","value"],a=o[0],s=o[1],l=i.length;return n.rem=this.value,t.visit(t.SOURCE,(e=>{for(let t,o=0;o<l;++o)t=vr(e),t[a]=r[o],t[s]=i[o](e),n.add.push(t)})),this.value=n.source=n.add,n.modifies(o)}}),za.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},i(za,Xr,{transform(e,t){const n=e.expr,i=e.as,r=e.modified(),o=e.initonly?t.ADD:r?t.SOURCE:t.modified(n.fields)||t.modified(i)?t.ADD_MOD:t.ADD;return r&&(t=t.materialize().reflow(!0)),e.initonly||t.modifies(i),t.visit(o,(t=>t[i]=n(t,e)))}}),i(Na,Xr,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r,o,a,s=this.value,l=e.size-s.length;if(l>0){for(r=[];--l>=0;)r.push(a=yr(i(e))),s.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(r):r}else o=s.slice(0,-l),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,s=s.slice(-l);return n.source=this.value=s,n}});const Ra={value:"value",median:ci,mean:function(e,t){let n=0,i=0;if(void 0===t)for(let r of e)null!=r&&(r=+r)>=r&&(++n,i+=r);else{let r=-1;for(let o of e)null!=(o=t(o,++r,e))&&(o=+o)>=o&&(++n,i+=o)}if(n)return i/n},min:bt,max:xt},Ta=[];function Pa(e){Xr.call(this,[],e)}function La(e){aa.call(this,e)}function Ba(e){Xr.call(this,null,e)}function ja(e){Sr.call(this,null,Ia,e)}function Ia(e){return this.value&&!e.modified()?this.value:U(e.fields,e.flat)}function qa(e){Xr.call(this,[],e),this._pending=null}function Ua(e,t,n){n.forEach(yr);const i=t.fork(t.NO_FIELDS&t.NO_SOURCE);return i.rem=e.value,e.value=i.source=i.add=n,e._pending=null,i.rem.length&&i.clean(!0),i}function Wa(e){Xr.call(this,{},e)}function Ha(e){Sr.call(this,null,Ga,e)}function Ga(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let i,r,o=1/0,a=-1/0;for(i=0;i<n;++i)r=t[i],r[0]<o&&(o=r[0]),r[1]>a&&(a=r[1]);return[o,a]}function Va(e){Sr.call(this,null,Xa,e)}function Xa(e){return this.value&&!e.modified()?this.value:e.values.reduce(((e,t)=>e.concat(t)),[])}function Ya(e){Xr.call(this,null,e)}function Ja(e){aa.call(this,e)}function Qa(e){Da.call(this,e)}function Ka(e){Xr.call(this,null,e)}function Za(e){Xr.call(this,null,e)}function es(e){Xr.call(this,null,e)}Pa.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},i(Pa,Xr,{transform(e,t){var n,i,r,o,a,l,u,c,f,d,h=t.fork(t.ALL),p=function(e){var t,n=e.method||Ra.value;if(null!=Ra[n])return n===Ra.value?(t=void 0!==e.value?e.value:0,()=>t):Ra[n];s("Unrecognized imputation method: "+n)}(e),m=function(e){const t=e.field;return e=>e?t(e):NaN}(e),g=$(e.field),y=$(e.key),v=(e.groupby||[]).map($),b=function(e,t,n,i){var r,o,a,s,l,u,c,f,d=e=>e(f),h=[],p=i?i.slice():[],m={},g={};for(p.forEach(((e,t)=>m[e]=t+1)),s=0,c=e.length;s<c;++s)u=n(f=e[s]),l=m[u]||(m[u]=p.push(u)),(a=g[o=(r=t?t.map(d):Ta)+""])||(a=g[o]=[],h.push(a),a.values=r),a[l-1]=f;return h.domain=p,h}(t.source,e.groupby,e.key,e.keyvals),x=[],w=this.value,_=b.domain.length;for(a=0,c=b.length;a<c;++a)for(r=(n=b[a]).values,i=NaN,u=0;u<_;++u)if(null==n[u]){for(o=b.domain[u],d={_impute:!0},l=0,f=r.length;l<f;++l)d[v[l]]=r[l];d[y]=o,d[g]=Number.isNaN(i)?i=p(n,m):i,x.push(yr(d))}return x.length&&(h.add=h.materialize(h.ADD).add.concat(x)),w.length&&(h.rem=h.materialize(h.REM).rem.concat(w)),this.value=x,h}}),La.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:Jo},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},i(La,aa,{transform(e,t){const n=this,i=e.modified();let r;return n.value&&(i||t.modified(n._inputs,!0))?(r=n.value=i?n.init(e):{},t.visit(t.SOURCE,(e=>n.add(e)))):(r=n.value=n.value||this.init(e),t.visit(t.REM,(e=>n.rem(e))),t.visit(t.ADD,(e=>n.add(e)))),n.changes(),t.visit(t.SOURCE,(e=>{w(e,r[n.cellkey(e)].tuple)})),t.reflow(i).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let n,i;for(n=0,i=this._alen;n<i;++n)this.celltuple(e[n]),e[n]=null;for(n=0,i=this._mlen;n<i;++n)this.celltuple(t[n]),t[n]=null;this._alen=this._mlen=0}}),Ba.Definition={type:"KDE",metadata:{generates:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"cumulative",type:"boolean",default:!1},{name:"counts",type:"boolean",default:!1},{name:"bandwidth",type:"number",default:0},{name:"extent",type:"number",array:!0,length:2},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"as",type:"string",array:!0,default:["value","density"]}]},i(Ba,Xr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=t.materialize(t.SOURCE).source,r=wa(i,e.groupby,e.field),o=(e.groupby||[]).map($),a=e.bandwidth,l=e.cumulative?"cdf":"pdf",u=e.as||["value","density"],c=[];let f=e.extent,d=e.steps||e.minsteps||25,h=e.steps||e.maxsteps||200;"pdf"!==l&&"cdf"!==l&&s("Invalid density method: "+l),"shared"===e.resolve&&(f||(f=A(i,e.field)),d=h=e.steps||h),r.forEach((t=>{const n=mo(t,a)[l],i=e.counts?t.length:1;Uo(n,f||A(t),d,h).forEach((e=>{const n={};for(let i=0;i<o.length;++i)n[o[i]]=t.dims[i];n[u[0]]=e[0],n[u[1]]=e[1]*i,c.push(yr(n))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=c}return n}}),i(ja,Sr),i(qa,Xr,{transform(e,t){const n=t.dataflow;if(this._pending)return Ua(this,t,this._pending);if(function(e){return e.modified("async")&&!(e.modified("values")||e.modified("url")||e.modified("format"))}(e))return t.StopPropagation;if(e.values)return Ua(this,t,n.parse(e.values,e.format));if(e.async){return{async:n.request(e.url,e.format).then((e=>(this._pending=r(e.data),e=>e.touch(this))))}}return n.request(e.url,e.format).then((e=>Ua(this,t,r(e.data))))}}),Wa.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},i(Wa,Xr,{transform(e,t){const n=e.fields,i=e.index,r=e.values,o=null==e.default?null:e.default,a=e.modified(),l=n.length;let u,c,f,d=a?t.SOURCE:t.ADD,h=t,p=e.as;return r?(c=r.length,l>1&&!p&&s('Multi-field lookup requires explicit "as" parameter.'),p&&p.length!==l*c&&s('The "as" parameter has too few output field names.'),p=p||r.map($),u=function(e){for(var t,a,s=0,u=0;s<l;++s)if(null==(a=i.get(n[s](e))))for(t=0;t<c;++t,++u)e[p[u]]=o;else for(t=0;t<c;++t,++u)e[p[u]]=r[t](a)}):(p||s("Missing output field names."),u=function(e){for(var t,r=0;r<l;++r)t=i.get(n[r](e)),e[p[r]]=null==t?o:t}),a?h=t.reflow(!0):(f=n.some((e=>t.modified(e.fields))),d|=f?t.MOD:0),t.visit(d,u),h.modifies(p)}}),i(Ha,Sr),i(Va,Sr),i(Ya,Xr,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),Ja.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:Jo,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},i(Ja,aa,{_transform:aa.prototype.transform,transform(e,t){return this._transform(function(e,t){const n=e.field,i=e.value,r=("count"===e.op?"__count__":e.op)||"sum",o=_(n).concat(_(i)),a=function(e,t,n){const i={},r=[];return n.visit(n.SOURCE,(t=>{const n=e(t);i[n]||(i[n]=1,r.push(n))})),r.sort(E),t?r.slice(0,t):r}(n,e.limit||0,t);t.changed()&&e.set("__pivot__",null,null,!0);return{key:e.key,groupby:e.groupby,ops:a.map((()=>r)),fields:a.map((e=>function(e,t,n,i){return k((i=>t(i)===e?n(i):NaN),i,e+"")}(e,n,i,o))),as:a.map((e=>e+"")),modified:e.modified.bind(e)}}(e,t),t)}}),i(Qa,Da,{transform(e,t){const n=e.subflow,i=e.field,r=e=>this.subflow(mr(e),n,t,e);return(e.modified("field")||i&&t.modified(_(i)))&&s("PreFacet does not support field modification."),this.initTargets(),i?(t.visit(t.MOD,(e=>{const t=r(e);i(e).forEach((e=>t.mod(e)))})),t.visit(t.ADD,(e=>{const t=r(e);i(e).forEach((e=>t.add(yr(e))))})),t.visit(t.REM,(e=>{const t=r(e);i(e).forEach((e=>t.rem(e)))}))):(t.visit(t.MOD,(e=>r(e).mod(e))),t.visit(t.ADD,(e=>r(e).add(e))),t.visit(t.REM,(e=>r(e).rem(e)))),t.clean()&&t.runAfter((()=>this.clean())),t}}),Ka.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},i(Ka,Xr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=xa(e.fields,e.as||[]),o=i?(e,t)=>function(e,t,n,i){for(let r=0,o=n.length;r<o;++r)t[i[r]]=n[r](e);return t}(e,t,i,r):br;let a;return this.value?a=this.value:(t=t.addAll(),a=this.value={}),t.visit(t.REM,(e=>{const t=mr(e);n.rem.push(a[t]),a[t]=null})),t.visit(t.ADD,(e=>{const t=o(e,yr({}));a[mr(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{n.mod.push(o(e,a[mr(e)]))})),n}}),i(Za,Xr,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),es.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]};function ts(e){Xr.call(this,null,e)}function ns(e){Xr.call(this,[],e),this.count=0}function is(e){Xr.call(this,null,e)}function rs(e){Xr.call(this,null,e),this.modified(!0)}function os(e){Xr.call(this,null,e)}i(es,Xr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.as||["prob","value"];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;const r=wa(t.materialize(t.SOURCE).source,e.groupby,e.field),o=(e.groupby||[]).map($),a=[],s=e.step||.01,l=e.probs||Yt(s/2,1-1e-14,s),u=l.length;return r.forEach((e=>{const t=Zr(e,l);for(let n=0;n<u;++n){const r={};for(let t=0;t<o.length;++t)r[o[t]]=e.dims[t];r[i[0]]=l[n],r[i[1]]=t[n],a.push(yr(r))}})),this.value&&(n.rem=this.value),this.value=n.add=n.source=a,n}}),i(ts,Xr,{transform(e,t){let n,i;return this.value?i=this.value:(n=t=t.addAll(),i=this.value={}),e.derive&&(n=t.fork(t.NO_SOURCE),t.visit(t.REM,(e=>{const t=mr(e);n.rem.push(i[t]),i[t]=null})),t.visit(t.ADD,(e=>{const t=vr(e);i[mr(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{const t=i[mr(e)];for(const i in e)t[i]=e[i],n.modifies(i);n.mod.push(t)}))),n}}),ns.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},i(ns,Xr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,o=this.value.reduce(((e,t)=>(e[mr(t)]=1,e)),{});let a=this.value,s=this.count,l=0;function u(e){let t,i;a.length<r?a.push(e):(i=~~((s+1)*io()),i<a.length&&i>=l&&(t=a[i],o[mr(t)]&&n.rem.push(t),a[i]=e)),++s}if(t.rem.length&&(t.visit(t.REM,(e=>{const t=mr(e);o[t]&&(o[t]=-1,n.rem.push(e)),--s})),a=a.filter((e=>-1!==o[mr(e)]))),(t.rem.length||i)&&a.length<r&&t.source&&(l=s=a.length,t.visit(t.SOURCE,(e=>{o[mr(e)]||u(e)})),l=-1),i&&a.length>r){const e=a.length-r;for(let t=0;t<e;++t)o[mr(a[t])]=-1,n.rem.push(a[t]);a=a.slice(e)}return t.mod.length&&t.visit(t.MOD,(e=>{o[mr(e)]&&n.mod.push(e)})),t.add.length&&t.visit(t.ADD,u),(t.add.length||l<0)&&(n.add=a.filter((e=>!o[mr(e)]))),this.count=s,this.value=n.source=a,n}}),is.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},i(is,Xr,{transform(e,t){if(this.value&&!e.modified())return;const n=t.materialize().fork(t.MOD),i=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=Yt(e.start,e.stop,e.step||1).map((e=>{const t={};return t[i]=e,yr(t)})),n.add=t.add.concat(this.value),n}}),i(rs,Xr,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});const as=["unit0","unit1"];function ss(e){Xr.call(this,q(),e)}function ls(e){Xr.call(this,null,e)}os.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:S,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:as}]},i(os,Xr,{transform(e,t){const n=e.field,i=!1!==e.interval,r="utc"===e.timezone,o=this._floor(e,t),a=(r?F:C)(o.unit).offset,s=e.as||as,l=s[0],u=s[1],c=o.step;let f=o.start||1/0,d=o.stop||-1/0,h=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(_(n)))&&(h=(t=t.reflow(!0)).SOURCE,f=1/0,d=-1/0),t.visit(h,(e=>{const t=n(e);let r,s;null==t?(e[l]=null,i&&(e[u]=null)):(e[l]=r=s=o(t),i&&(e[u]=s=a(r,c)),r<f&&(f=r),s>d&&(d=s))})),o.start=f,o.stop=d,t.modifies(i?s:l)},_floor(e,t){const n="utc"===e.timezone,{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:M({extent:e.extent||A(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),o=O(i),a=this.value||{},s=(n?z:N)(o,r);return s.unit=R(o),s.units=o,s.step=r,s.start=a.start,s.stop=a.stop,this.value=s}}),i(ss,Xr,{transform(e,t){const n=t.dataflow,i=e.field,r=this.value,o=e=>r.set(i(e),e);let a=!0;return e.modified("field")||t.modified(i.fields)?(r.clear(),t.visit(t.SOURCE,o)):t.changed()?(t.visit(t.REM,(e=>r.delete(i(e)))),t.visit(t.ADD,o)):a=!1,this.modified(a),r.empty>n.cleanThreshold&&n.runAfter(r.clean),t.fork()}}),i(ls,Xr,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(wr(e.sort)):t.source).map(e.field))}});const us={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?++e:e}}},percent_rank:function(){const e=us.rank(),t=e.next;return{init:e.init,next:e=>(t(e)-1)/(e.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const n=t.data,i=t.compare;let r=t.index;if(e<r){for(;r+1<n.length&&!i(n[r],n[r+1]);)++r;e=r}return(1+e)/n.length}}},ntile:function(e,t){(t=+t)>0||s("ntile num must be greater than zero.");const n=us.cume_dist(),i=n.next;return{init:n.init,next:e=>Math.ceil(t*i(e))}},lag:function(e,t){return t=+t||1,{next:n=>{const i=n.index-t;return i>=0?e(n.data[i]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{const i=n.index+t,r=n.data;return i<r.length?e(r[i]):null}}},first_value:function(e){return{next:t=>e(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return(t=+t)>0||s("nth_value nth must be greater than zero."),{next:n=>{const i=n.i0+(t-1);return i<n.i1?e(n.data[i]):null}}},prev_value:function(e){let t;return{init:()=>t=null,next:n=>{const i=e(n.data[n.index]);return null!=i?t=i:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:i=>{const r=i.data;return i.index<=n?t:(n=function(e,t,n){for(let i=t.length;n<i;++n){if(null!=e(t[n]))return n}return-1}(e,r,i.index))<0?(n=r.length,t=null):t=e(r[n])}}}};const cs=Object.keys(us);function fs(e){const t=r(e.ops),n=r(e.fields),i=r(e.params),o=r(e.aggregate_params),a=r(e.as),l=this.outputs=[],u=this.windows=[],c={},f={},d=[],h=[];let p=!0;function g(e){r(_(e)).forEach((e=>c[e]=1))}g(e.sort),t.forEach(((e,t)=>{const r=n[t],c=i[t],y=o[t]||null,v=$(r),b=Go(e,v,a[t]);if(g(r),l.push(b),m(us,e))u.push(function(e,t,n,i){const r=us[e](t,n);return{init:r.init||W,update:function(e,t){t[i]=r.next(e)}}}(e,r,c,b));else{if(null==r&&"count"!==e&&s("Null aggregate field specified."),"count"===e)return void d.push(b);p=!1;let t=f[v];t||(t=f[v]=[],t.field=r,h.push(t)),t.push(Qo(e,y,b))}})),(d.length||h.length)&&(this.cell=function(e,t,n){e=e.map((e=>ia(e,e.field)));const i={num:0,agg:null,store:!1,count:t};if(!n)for(var r=e.length,o=i.agg=Array(r),a=0;a<r;++a)o[a]=new e[a](i);if(i.store)var s=i.data=new ra;return i.add=function(e){if(i.num+=1,!n){s&&s.add(e);for(let t=0;t<r;++t)o[t].add(o[t].get(e),e)}},i.rem=function(e){if(i.num-=1,!n){s&&s.rem(e);for(let t=0;t<r;++t)o[t].rem(o[t].get(e),e)}},i.set=function(e){let r,a;for(s&&s.values(),r=0,a=t.length;r<a;++r)e[t[r]]=i.num;if(!n)for(r=0,a=o.length;r<a;++r)o[r].set(e)},i.init=function(){i.num=0,s&&s.reset();for(let e=0;e<r;++e)o[e].init()},i}(h,d,p)),this.inputs=Object.keys(c)}const ds=fs.prototype;function hs(e){Xr.call(this,{},e),this._mlen=0,this._mods=[]}function ps(e,t,n,i){const r=i.sort,o=r&&!i.ignorePeers,a=i.frame||[null,0],s=e.data(n),l=s.length,u=o?T(r):null,c={i0:0,i1:0,p0:0,p1:0,index:0,data:s,compare:r||g(-1)};t.init();for(let f=0;f<l;++f)ms(c,a,f,l),o&&gs(c,u),t.update(c,s[f])}function ms(e,t,n,i){e.p0=e.i0,e.p1=e.i1,e.i0=null==t[0]?0:Math.max(0,n-Math.abs(t[0])),e.i1=null==t[1]?i:Math.min(i,n+Math.abs(t[1])+1),e.index=n}function gs(e,t){const n=e.i0,i=e.i1-1,r=e.compare,o=e.data,a=o.length-1;n>0&&!r(o[n],o[n-1])&&(e.i0=t.left(o,o[n])),i<a&&!r(o[i],o[i+1])&&(e.i1=t.right(o,o[i]))}ds.init=function(){this.windows.forEach((e=>e.init())),this.cell&&this.cell.init()},ds.update=function(e,t){const n=this.cell,i=this.windows,r=e.data,o=i&&i.length;let a;if(n){for(a=e.p0;a<e.i0;++a)n.rem(r[a]);for(a=e.p1;a<e.i1;++a)n.add(r[a]);n.set(t)}for(a=0;a<o;++a)i[a].update(e,t)},hs.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:cs.concat(Jo)},{name:"params",type:"number",null:!0,array:!0},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]},i(hs,Xr,{transform(e,t){this.stamp=t.stamp;const n=e.modified(),i=wr(e.sort),r=Ho(e.groupby),o=e=>this.group(r(e));let a=this.state;a&&!n||(a=this.state=new fs(e)),n||t.modified(a.inputs)?(this.value={},t.visit(t.SOURCE,(e=>o(e).add(e)))):(t.visit(t.REM,(e=>o(e).remove(e))),t.visit(t.ADD,(e=>o(e).add(e))));for(let s=0,l=this._mlen;s<l;++s)ps(this._mods[s],a,i,e);return this._mlen=0,this._mods=[],t.reflow(n).modifies(a.outputs)},group(e){let t=this.value[e];return t||(t=this.value[e]=la(mr),t.stamp=-1),t.stamp<this.stamp&&(t.stamp=this.stamp,this._mods[this._mlen++]=t),t}});const ys=Object.freeze(Object.defineProperty({__proto__:null,aggregate:aa,bin:sa,collect:ua,compare:ca,countpattern:da,cross:ha,density:ya,dotbin:_a,expression:ka,extent:$a,facet:Da,field:Sa,filter:Ca,flatten:Ma,fold:Oa,formula:za,generate:Na,impute:Pa,joinaggregate:La,kde:Ba,key:ja,load:qa,lookup:Wa,multiextent:Ha,multivalues:Va,params:Ya,pivot:Ja,prefacet:Qa,project:Ka,proxy:Za,quantile:es,relay:ts,sample:ns,sequence:is,sieve:rs,subflow:Aa,timeunit:os,tupleindex:ss,values:ls,window:hs},Symbol.toStringTag,{value:"Module"}));function vs(e,t,n){var i=null,r=Cn(!0),o=null,a=Mn,s=null,l=Fn(u);function u(u){var c,f,d,h,p,m=(u=Nn(u)).length,g=!1,y=new Array(m),v=new Array(m);for(null==o&&(s=a(p=l())),c=0;c<=m;++c){if(!(c<m&&r(h=u[c],c,u))===g)if(g=!g)f=c,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),d=c-1;d>=f;--d)s.point(y[d],v[d]);s.lineEnd(),s.areaEnd()}g&&(y[c]=+e(h,c,u),v[c]=+t(h,c,u),s.point(i?+i(h,c,u):y[c],n?+n(h,c,u):v[c]))}if(p)return s=null,p+""||null}function c(){return Rn().defined(r).curve(a).context(o)}return e="function"==typeof e?e:void 0===e?On:Cn(+e),t="function"==typeof t?t:Cn(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?zn:Cn(+n),u.x=function(t){return arguments.length?(e="function"==typeof t?t:Cn(+t),i=null,u):e},u.x0=function(t){return arguments.length?(e="function"==typeof t?t:Cn(+t),u):e},u.x1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:Cn(+e),u):i},u.y=function(e){return arguments.length?(t="function"==typeof e?e:Cn(+e),n=null,u):t},u.y0=function(e){return arguments.length?(t="function"==typeof e?e:Cn(+e),u):t},u.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:Cn(+e),u):n},u.lineX0=u.lineY0=function(){return c().x(e).y(t)},u.lineY1=function(){return c().x(e).y(n)},u.lineX1=function(){return c().x(i).y(t)},u.defined=function(e){return arguments.length?(r="function"==typeof e?e:Cn(!!e),u):r},u.curve=function(e){return arguments.length?(a=e,null!=o&&(s=a(o)),u):a},u.context=function(e){return arguments.length?(null==e?o=s=null:s=a(o=e),u):o},u}const bs={draw(e,t){const n=Pn(t/Ln);e.moveTo(n,0),e.arc(0,0,n,0,Tn)}};function xs(e,t){if("undefined"!=typeof document&&document.createElement){const n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}function ws(e){return Math.log(e)}function _s(e){return Math.exp(e)}function ks(e){return-Math.log(-e)}function Es(e){return-Math.exp(-e)}function $s(e){return isFinite(e)?+("1e"+e):e<0?0:e}function As(e){return(t,n)=>-e(-t,n)}function Ds(e){const t=e(ws,_s),n=t.domain;let i,r,o=10;function a(){return i=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(o),r=function(e){return 10===e?$s:e===Math.E?Math.exp:t=>Math.pow(e,t)}(o),n()[0]<0?(i=As(i),r=As(r),e(ks,Es)):e(ws,_s),t}return t.base=function(e){return arguments.length?(o=+e,a()):o},t.domain=function(e){return arguments.length?(n(e),a()):n()},t.ticks=e=>{const t=n();let a=t[0],s=t[t.length-1];const l=s<a;l&&([a,s]=[s,a]);let u,c,f=i(a),d=i(s);const h=null==e?10:+e;let p=[];if(!(o%1)&&d-f<h){if(f=Math.floor(f),d=Math.ceil(d),a>0){for(;f<=d;++f)for(u=1;u<o;++u)if(c=f<0?u/r(-f):u*r(f),!(c<a)){if(c>s)break;p.push(c)}}else for(;f<=d;++f)for(u=o-1;u>=1;--u)if(c=f>0?u/r(-f):u*r(f),!(c<a)){if(c>s)break;p.push(c)}2*p.length<h&&(p=H(a,s,h))}else p=H(f,d,Math.min(d-f,h)).map(r);return l?p.reverse():p},t.tickFormat=(e,n)=>{if(null==e&&(e=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=G(n)).precision||(n.trim=!0),n=V(n)),e===1/0)return n;const a=Math.max(1,o*e/t.ticks().length);return e=>{let t=e/r(Math.round(i(e)));return t*o<o-.5&&(t*=o),t<=a?n(e):""}},t.nice=()=>n(At(n(),{floor:e=>r(Math.floor(i(e))),ceil:e=>r(Math.ceil(i(e)))})),t}function Ss(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Fs(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Cs(e){var t=1,n=e(Ss(t),Fs(t));return n.constant=function(n){return arguments.length?e(Ss(t=+n),Fs(t)):t},It(n)}function Ms(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Os(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function zs(e){return e<0?-e*e:e*e}function Ns(e){var t=e(Wt,Wt),n=1;return t.exponent=function(t){return arguments.length?1===(n=+t)?e(Wt,Wt):.5===n?e(Os,zs):e(Ms(n),Ms(1/n)):n},It(t)}function Rs(){var e=Ns(qt());return e.copy=function(){return Ut(e,Rs()).exponent(e.exponent())},_n.apply(e,arguments),e}function Ts(){var e,t,n,i,r,o=0,a=1,s=Wt,l=!1;function u(t){return null==t||isNaN(t=+t)?r:s(0===n?.5:(t=(i(t)-e)*n,l?Math.max(0,Math.min(1,t)):t))}function c(e){return function(t){var n,i;return arguments.length?([n,i]=t,s=e(n,i),u):[s(0),s(1)]}}return u.domain=function(r){return arguments.length?([o,a]=r,e=i(o=+o),t=i(a=+a),n=e===t?0:1/(t-e),u):[o,a]},u.clamp=function(e){return arguments.length?(l=!!e,u):l},u.interpolator=function(e){return arguments.length?(s=e,u):s},u.range=c(Nt),u.rangeRound=c(Bt),u.unknown=function(e){return arguments.length?(r=e,u):r},function(r){return i=r,e=r(o),t=r(a),n=e===t?0:1/(t-e),u}}function Ps(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Ls(){var e=It(Ts()(Wt));return e.copy=function(){return Ps(e,Ls())},kn.apply(e,arguments)}function Bs(){var e=Ns(Ts());return e.copy=function(){return Ps(e,Bs()).exponent(e.exponent())},kn.apply(e,arguments)}function js(){var e,t,n,i,r,o,a,s=0,l=.5,u=1,c=1,f=Wt,d=!1;function h(e){return isNaN(e=+e)?a:(e=.5+((e=+o(e))-t)*(c*e<c*t?i:r),f(d?Math.max(0,Math.min(1,e)):e))}function p(e){return function(t){var n,i,r;return arguments.length?([n,i,r]=t,f=Ci(e,[n,i,r]),h):[f(0),f(.5),f(1)]}}return h.domain=function(a){return arguments.length?([s,l,u]=a,e=o(s=+s),t=o(l=+l),n=o(u=+u),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,h):[s,l,u]},h.clamp=function(e){return arguments.length?(d=!!e,h):d},h.interpolator=function(e){return arguments.length?(f=e,h):f},h.range=p(Nt),h.rangeRound=p(Bt),h.unknown=function(e){return arguments.length?(a=e,h):a},function(a){return o=a,e=a(s),t=a(l),n=a(u),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,h}}function Is(){var e=Ns(js());return e.copy=function(){return Ps(e,Is()).exponent(e.exponent())},kn.apply(e,arguments)}const qs=Dn("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),Us=Dn("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Ws=Dn("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Hs=Dn("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),Gs=Dn("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Vs=Dn("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),Xs=Dn("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),Ys=Dn("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),Js=Dn("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),Qs=Dn("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function Ks(e,t,n){const i=e-t+2*n;return e?i>0?i:1:0}const Zs="linear",el="log",tl="pow",nl="sqrt",il="symlog",rl="time",ol="utc",al="sequential",sl="diverging",ll="quantile",ul="quantize",cl="threshold",fl="ordinal",dl="point",hl="band",pl="bin-ordinal",ml="continuous",gl="discrete",yl="discretizing",vl="interpolating",bl="temporal";function xl(){const e=$n().unknown(void 0),t=e.domain,n=e.range;let i,r,o=[0,1],a=!1,s=0,l=0,u=.5;function c(){const e=t().length,c=o[1]<o[0],f=o[1-c],d=Ks(e,s,l);let h=o[c-0];i=(f-h)/(d||1),a&&(i=Math.floor(i)),h+=(f-h-i*(e-s))*u,r=i*(1-s),a&&(h=Math.round(h),r=Math.round(r));const p=Yt(e).map((e=>h+i*e));return n(c?p.reverse():p)}return delete e.unknown,e.domain=function(e){return arguments.length?(t(e),c()):t()},e.range=function(e){return arguments.length?(o=[+e[0],+e[1]],c()):o.slice()},e.rangeRound=function(e){return o=[+e[0],+e[1]],a=!0,c()},e.bandwidth=function(){return r},e.step=function(){return i},e.round=function(e){return arguments.length?(a=!!e,c()):a},e.padding=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),s=l,c()):s},e.paddingInner=function(e){return arguments.length?(s=Math.max(0,Math.min(1,e)),c()):s},e.paddingOuter=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),c()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),c()):u},e.invertRange=function(e){if(null==e[0]||null==e[1])return;const i=o[1]<o[0],a=i?n().reverse():n(),s=a.length-1;let l,u,c,f=+e[0],d=+e[1];return f!=f||d!=d||(d<f&&(c=f,f=d,d=c),d<a[0]||f>o[1-i])?void 0:(l=Math.max(0,Ht(a,f)-1),u=f===d?l:Ht(a,d)-1,f-a[l]>r+1e-10&&++l,i&&(c=l,l=s-u,u=s-c),l>u?void 0:t().slice(l,u+1))},e.invert=function(t){const n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return xl().domain(t()).range(o).round(a).paddingInner(s).paddingOuter(l).align(u)},c()}function wl(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return wl(t())},e}var _l=Array.prototype.map;const kl=Array.prototype.slice;const El=new Map,$l=Symbol("vega_scale");function Al(e){return e[$l]=!0,e}function Dl(e,t,n){return arguments.length>1?(El.set(e,function(e,t,n){const i=function(){const n=t();return n.invertRange||(n.invertRange=n.invert?function(e){return function(t){let n,i=t[0],r=t[1];return r<i&&(n=i,i=r,r=n),[e.invert(i),e.invert(r)]}}(n):n.invertExtent?function(e){return function(t){const n=e.range();let i,r,o,a,s=t[0],l=t[1],u=-1;for(l<s&&(r=s,s=l,l=r),o=0,a=n.length;o<a;++o)n[o]>=s&&n[o]<=l&&(u<0&&(u=o),i=o);if(!(u<0))return s=e.invertExtent(n[u]),l=e.invertExtent(n[i]),[void 0===s[0]?s[1]:s[0],void 0===l[1]?l[0]:l[1]]}}(n):void 0),n.type=e,Al(n)};return i.metadata=ne(r(n)),i}(e,t,n)),this):Sl(e)?El.get(e):void 0}function Sl(e){return El.has(e)}function Fl(e,t){const n=El.get(e);return n&&n.metadata[t]}function Cl(e){return Fl(e,ml)}function Ml(e){return Fl(e,gl)}function Ol(e){return Fl(e,yl)}function zl(e){return Fl(e,el)}function Nl(e){return Fl(e,vl)}function Rl(e){return Fl(e,ll)}Dl("identity",(function e(t){var n;function i(e){return null==e||isNaN(e=+e)?n:e}return i.invert=i,i.domain=i.range=function(e){return arguments.length?(t=Array.from(e,jt),i):t.slice()},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,jt):[0,1],It(i)})),Dl(Zs,Gt,ml),Dl(el,(function e(){const t=Ds(qt()).domain([1,10]);return t.copy=()=>Ut(t,e()).base(t.base()),_n.apply(t,arguments),t}),[ml,el]),Dl(tl,Rs,ml),Dl(nl,(function(){return Rs.apply(null,arguments).exponent(.5)}),ml),Dl(il,(function e(){var t=Cs(qt());return t.copy=function(){return Ut(t,e()).constant(t.constant())},_n.apply(t,arguments)}),ml),Dl(rl,Ct,[ml,bl]),Dl(ol,(function(){return _n.apply(Dt(Ft,St,te,ee,Z,K,Q,J,Y,X).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[ml,bl]),Dl(al,Ls,[ml,vl]),Dl(`${al}-${Zs}`,Ls,[ml,vl]),Dl(`${al}-${el}`,(function e(){var t=Ds(Ts()).domain([1,10]);return t.copy=function(){return Ps(t,e()).base(t.base())},kn.apply(t,arguments)}),[ml,vl,el]),Dl(`${al}-${tl}`,Bs,[ml,vl]),Dl(`${al}-${nl}`,(function(){return Bs.apply(null,arguments).exponent(.5)}),[ml,vl]),Dl(`${al}-${il}`,(function e(){var t=Cs(Ts());return t.copy=function(){return Ps(t,e()).constant(t.constant())},kn.apply(t,arguments)}),[ml,vl]),Dl(`${sl}-${Zs}`,(function e(){var t=It(js()(Wt));return t.copy=function(){return Ps(t,e())},kn.apply(t,arguments)}),[ml,vl]),Dl(`${sl}-${el}`,(function e(){var t=Ds(js()).domain([.1,1,10]);return t.copy=function(){return Ps(t,e()).base(t.base())},kn.apply(t,arguments)}),[ml,vl,el]),Dl(`${sl}-${tl}`,Is,[ml,vl]),Dl(`${sl}-${nl}`,(function(){return Is.apply(null,arguments).exponent(.5)}),[ml,vl]),Dl(`${sl}-${il}`,(function e(){var t=Cs(js());return t.copy=function(){return Ps(t,e()).constant(t.constant())},kn.apply(t,arguments)}),[ml,vl]),Dl(ll,(function e(){var n,i=[],r=[],o=[];function a(){var e=0,t=Math.max(1,r.length);for(o=new Array(t-1);++e<t;)o[e-1]=ui(i,e/t);return s}function s(e){return null==e||isNaN(e=+e)?n:r[Ht(o,e)]}return s.invertExtent=function(e){var t=r.indexOf(e);return t<0?[NaN,NaN]:[t>0?o[t-1]:i[0],t<o.length?o[t]:i[i.length-1]]},s.domain=function(e){if(!arguments.length)return i.slice();i=[];for(let t of e)null==t||isNaN(t=+t)||i.push(t);return i.sort(t),a()},s.range=function(e){return arguments.length?(r=Array.from(e),a()):r.slice()},s.unknown=function(e){return arguments.length?(n=e,s):n},s.quantiles=function(){return o.slice()},s.copy=function(){return e().domain(i).range(r).unknown(n)},_n.apply(s,arguments)}),[yl,ll]),Dl(ul,(function e(){var t,n=0,i=1,r=1,o=[.5],a=[0,1];function s(e){return null!=e&&e<=e?a[Ht(o,e,0,r)]:t}function l(){var e=-1;for(o=new Array(r);++e<r;)o[e]=((e+1)*i-(e-r)*n)/(r+1);return s}return s.domain=function(e){return arguments.length?([n,i]=e,n=+n,i=+i,l()):[n,i]},s.range=function(e){return arguments.length?(r=(a=Array.from(e)).length-1,l()):a.slice()},s.invertExtent=function(e){var t=a.indexOf(e);return t<0?[NaN,NaN]:t<1?[n,o[0]]:t>=r?[o[r-1],i]:[o[t-1],o[t]]},s.unknown=function(e){return arguments.length?(t=e,s):s},s.thresholds=function(){return o.slice()},s.copy=function(){return e().domain([n,i]).range(a).unknown(t)},_n.apply(It(s),arguments)}),yl),Dl(cl,(function e(){var t,n=[.5],i=[0,1],r=1;function o(e){return null!=e&&e<=e?i[Ht(n,e,0,r)]:t}return o.domain=function(e){return arguments.length?(n=Array.from(e),r=Math.min(n.length,i.length-1),o):n.slice()},o.range=function(e){return arguments.length?(i=Array.from(e),r=Math.min(n.length,i.length-1),o):i.slice()},o.invertExtent=function(e){var t=i.indexOf(e);return[n[t-1],n[t]]},o.unknown=function(e){return arguments.length?(t=e,o):t},o.copy=function(){return e().domain(n).range(i).unknown(t)},_n.apply(o,arguments)}),yl),Dl(pl,(function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[(Ht(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return _l.call(e,D)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=kl.call(e),i):n.slice()},i.tickFormat=function(e,n){return Vt(t[0],R(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i}),[gl,yl]),Dl(fl,$n,gl),Dl(hl,xl,gl),Dl(dl,(function(){return wl(xl().paddingInner(1))}),gl);const Tl=["clamp","base","constant","exponent"];function Pl(e,t){const n=t[0],i=R(t)-n;return function(t){return e(n+t*i)}}function Ll(e,t,n){return Ci(Il(t||"rgb",n),e)}function Bl(e,t){const n=new Array(t),i=t+1;for(let r=0;r<t;)n[r]=e(++r/i);return n}function jl(e,t,n){const i=n-t;let r,o,a;return i&&Number.isFinite(i)?(r=(o=e.type).indexOf("-"),o=r<0?o:o.slice(r+1),a=Dl(o)().domain([t,n]).range([0,1]),Tl.forEach((t=>e[t]?a[t](e[t]()):0)),a):g(.5)}function Il(e,t){const n=Mi[function(e){return"interpolate"+e.toLowerCase().split("-").map((e=>e[0].toUpperCase()+e.slice(1))).join("")}(e)];return null!=t&&n&&n.gamma?n.gamma(t):n}function ql(e){if(a(e))return e;const t=e.length/6|0,n=new Array(t);for(let i=0;i<t;)n[i]="#"+e.slice(6*i,6*++i);return n}function Ul(e,t){for(const n in e)Hl(n,t(e[n]))}const Wl={};function Hl(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(Wl[e]=t,this):Wl[e]}Ul({accent:Us,category10:qs,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:Ws,observable10:Hs,paired:Gs,pastel1:Vs,pastel2:Xs,set1:Ys,set2:Js,set3:Qs,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},ql),Ul({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(e=>Ll(ql(e))));const Gl="symbol",Vl=e=>a(e)?e.map((e=>String(e))):String(e),Xl=(e,t)=>e[1]-t[1],Yl=(e,t)=>t[1]-e[1];function Jl(e,t,n){let i;return ie(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=n&&(t=Math.min(t,Math.floor(I(e.domain())/n||1)+1))),re(t)&&(i=t.step,t=t.interval),oe(t)&&(t=e.type===rl?C(t):e.type==ol?F(t):s("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function Ql(e,t,n){let i=e.range(),r=i[0],o=R(i),a=Xl;if(r>o&&(i=o,o=r,r=i,a=Yl),r=Math.floor(r),o=Math.ceil(o),t=t.map((t=>[t,e(t)])).filter((e=>r<=e[1]&&e[1]<=o)).sort(a).map((e=>e[0])),n>0&&t.length>1){const e=[t[0],R(t)];for(;t.length>n&&t.length>=3;)t=t.filter(((e,t)=>!(t%2)));t.length<3&&(t=e)}return t}function Kl(e,t){return e.bins?Ql(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function Zl(e,t,n,i,r,o){const a=t.type;let s=Vl;if(a===rl||r===rl)s=e.timeFormat(i);else if(a===ol||r===ol)s=e.utcFormat(i);else if(zl(a)){const r=e.formatFloat(i);if(o||t.bins)s=r;else{const e=eu(t,n,!1);s=t=>e(t)?r(t):""}}else if(t.tickFormat){const r=t.domain();s=e.formatSpan(r[0],r[r.length-1],n,i)}else i&&(s=e.format(i));return s}function eu(e,t,n){const i=Kl(e,t),r=e.base(),o=Math.log(r),a=Math.max(1,r*t/i.length),s=e=>{let t=e/Math.pow(r,Math.round(Math.log(e)/o));return t*r<r-.5&&(t*=r),t<=a};return n?i.filter(s):s}const tu={[ll]:"quantiles",[ul]:"thresholds",[cl]:"domain"},nu={[ll]:"quantiles",[ul]:"domain"};function iu(e,t){return e.bins?function(e){const t=e.slice(0,-1);return t.max=R(e),t}(e.bins):e.type===el?eu(e,t,!0):tu[e.type]?function(e){const t=[-1/0].concat(e);return t.max=1/0,t}(e[tu[e.type]]()):Kl(e,t)}function ru(e,t,n,i,r,o,a){const s=nu[t.type]&&o!==rl&&o!==ol?function(e,t,n){const i=t[nu[t.type]](),r=i.length;let o,a=r>1?i[1]-i[0]:i[0];for(o=1;o<r;++o)a=Math.min(a,i[o]-i[o-1]);return e.formatSpan(0,a,30,n)}(e,t,r):Zl(e,t,n,r,o,a);return i===Gl&&(e=>tu[e.type]||e.bins)(t)?ou(s):"discrete"===i?su(s):lu(s)}const ou=e=>(t,n,i)=>{const r=au(i[n+1],au(i.max,1/0)),o=uu(t,e),a=uu(r,e);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},au=(e,t)=>null!=e?e:t,su=e=>(t,n)=>n?e(t):null,lu=e=>t=>e(t),uu=(e,t)=>Number.isFinite(e)?t(e):null;function cu(e,t,n,i){const r=i||t.type;return oe(n)&&Fl(r,bl)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||r!==rl?n||r!==ol?ru(e,t,5,null,n,i,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}function fu(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=cu(e,t,n.format,n.formatType);if(Ol(t.type)){const e=iu(t).slice(1).map(r),n=e.length;return`${n} boundar${1===n?"y":"ies"}: ${e.join(", ")}`}if(Ml(t.type)){const e=t.domain(),n=e.length;return`${n} value${1===n?"":"s"}: ${n>i?e.slice(0,i-2).map(r).join(", ")+", ending with "+e.slice(-1).map(r):e.map(r).join(", ")}`}{const e=t.domain();return`values from ${r(e[0])} to ${r(R(e))}`}}let du=0;const hu="p_";function pu(e){return e&&e.gradient}function mu(e,t,n){const i=e.gradient;let r=e.id,o="radial"===i?hu:"";return r||(r=e.id="gradient_"+du++,"radial"===i?(e.x1=gu(e.x1,.5),e.y1=gu(e.y1,.5),e.r1=gu(e.r1,0),e.x2=gu(e.x2,.5),e.y2=gu(e.y2,.5),e.r2=gu(e.r2,.5),o=hu):(e.x1=gu(e.x1,0),e.y1=gu(e.y1,0),e.x2=gu(e.x2,1),e.y2=gu(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+o+r+")"}function gu(e,t){return null!=e?e:t}function yu(e,t){var n,i=[];return n={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:i,stop:function(e,t){return i.push({offset:e,color:t}),n}}}const vu={basis:{curve:Bn},"basis-closed":{curve:jn},"basis-open":{curve:In},bundle:{curve:qn,tension:"beta",value:.85},cardinal:{curve:Un,tension:"tension",value:0},"cardinal-open":{curve:Wn,tension:"tension",value:0},"cardinal-closed":{curve:Hn,tension:"tension",value:0},"catmull-rom":{curve:Gn,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Vn,tension:"alpha",value:.5},"catmull-rom-open":{curve:Xn,tension:"alpha",value:.5},linear:{curve:Mn},"linear-closed":{curve:Yn},monotone:{horizontal:Jn,vertical:Qn},natural:{curve:Kn},step:{curve:Zn},"step-after":{curve:ei},"step-before":{curve:ti}};function bu(e,t,n){var i=m(vu,e)&&vu[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}const xu={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},wu=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,_u=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,ku=/^((\s+,?\s*)|(,\s*))/,Eu=/^[01]/;function $u(e){const t=[];return(e.match(wu)||[]).forEach((e=>{let n=e[0];const i=n.toLowerCase(),r=xu[i],o=function(e,t,n){const i=[];for(let r=0;t&&r<n.length;)for(let o=0;o<t;++o){const t="a"!==e||3!==o&&4!==o?_u:Eu,a=n.slice(r).match(t);if(null===a)throw Error("Invalid SVG path, incorrect parameter type");r+=a[0].length,i.push(+a[0]);const s=n.slice(r).match(ku);null!==s&&(r+=s[0].length)}return i}(i,r,e.slice(1).trim()),a=o.length;if(a<r||a&&a%r!=0)throw Error("Invalid SVG path, incorrect parameter count");if(t.push([n,...o.slice(0,r)]),a!==r){"m"===i&&(n="M"===n?"L":"l");for(let e=r;e<a;e+=r)t.push([n,...o.slice(e,e+r)])}})),t}const Au=Math.PI/180,Du=Math.PI/2,Su=2*Math.PI,Fu=Math.sqrt(3)/2;var Cu={},Mu={},Ou=[].join;function zu(e){const t=Ou.call(e);if(Mu[t])return Mu[t];var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7];const c=u*a,f=-l*s,d=l*a,h=u*s,p=Math.cos(r),m=Math.sin(r),g=Math.cos(o),y=Math.sin(o),v=.5*(o-r),b=Math.sin(.5*v),x=8/3*b*b/Math.sin(v),w=n+p-x*m,_=i+m+x*p,k=n+g,E=i+y,$=k+x*y,A=E-x*g;return Mu[t]=[c*w+f*_,d*w+h*_,c*$+f*A,d*$+h*A,c*k+f*E,d*k+h*E]}const Nu=["l",0,0,0,0,0,0,0];function Ru(e,t,n){const i=Nu[0]=e[0];if("a"===i||"A"===i)Nu[1]=t*e[1],Nu[2]=n*e[2],Nu[3]=e[3],Nu[4]=e[4],Nu[5]=e[5],Nu[6]=t*e[6],Nu[7]=n*e[7];else if("h"===i||"H"===i)Nu[1]=t*e[1];else if("v"===i||"V"===i)Nu[1]=n*e[1];else for(var r=1,o=e.length;r<o;++r)Nu[r]=(r%2==1?t:n)*e[r];return Nu}function Tu(e,t,n,i,r,o){var a,s,l,u,c,f=null,d=0,h=0,p=0,m=0,g=0,y=0;null==n&&(n=0),null==i&&(i=0),null==r&&(r=1),null==o&&(o=r),e.beginPath&&e.beginPath();for(var v=0,b=t.length;v<b;++v){switch(a=t[v],1===r&&1===o||(a=Ru(a,r,o)),a[0]){case"l":d+=a[1],h+=a[2],e.lineTo(d+n,h+i);break;case"L":d=a[1],h=a[2],e.lineTo(d+n,h+i);break;case"h":d+=a[1],e.lineTo(d+n,h+i);break;case"H":d=a[1],e.lineTo(d+n,h+i);break;case"v":h+=a[1],e.lineTo(d+n,h+i);break;case"V":h=a[1],e.lineTo(d+n,h+i);break;case"m":g=d+=a[1],y=h+=a[2],e.moveTo(d+n,h+i);break;case"M":g=d=a[1],y=h=a[2],e.moveTo(d+n,h+i);break;case"c":s=d+a[5],l=h+a[6],p=d+a[3],m=h+a[4],e.bezierCurveTo(d+a[1]+n,h+a[2]+i,p+n,m+i,s+n,l+i),d=s,h=l;break;case"C":d=a[5],h=a[6],p=a[3],m=a[4],e.bezierCurveTo(a[1]+n,a[2]+i,p+n,m+i,d+n,h+i);break;case"s":s=d+a[3],l=h+a[4],p=2*d-p,m=2*h-m,e.bezierCurveTo(p+n,m+i,d+a[1]+n,h+a[2]+i,s+n,l+i),p=d+a[1],m=h+a[2],d=s,h=l;break;case"S":s=a[3],l=a[4],p=2*d-p,m=2*h-m,e.bezierCurveTo(p+n,m+i,a[1]+n,a[2]+i,s+n,l+i),d=s,h=l,p=a[1],m=a[2];break;case"q":s=d+a[3],l=h+a[4],p=d+a[1],m=h+a[2],e.quadraticCurveTo(p+n,m+i,s+n,l+i),d=s,h=l;break;case"Q":s=a[3],l=a[4],e.quadraticCurveTo(a[1]+n,a[2]+i,s+n,l+i),d=s,h=l,p=a[1],m=a[2];break;case"t":s=d+a[1],l=h+a[2],null===f[0].match(/[QqTt]/)?(p=d,m=h):"t"===f[0]?(p=2*d-u,m=2*h-c):"q"===f[0]&&(p=2*d-p,m=2*h-m),u=p,c=m,e.quadraticCurveTo(p+n,m+i,s+n,l+i),h=l,p=(d=s)+a[1],m=h+a[2];break;case"T":s=a[1],l=a[2],p=2*d-p,m=2*h-m,e.quadraticCurveTo(p+n,m+i,s+n,l+i),d=s,h=l;break;case"a":Pu(e,d+n,h+i,[a[1],a[2],a[3],a[4],a[5],a[6]+d+n,a[7]+h+i]),d+=a[6],h+=a[7];break;case"A":Pu(e,d+n,h+i,[a[1],a[2],a[3],a[4],a[5],a[6]+n,a[7]+i]),d=a[6],h=a[7];break;case"z":case"Z":d=g,h=y,e.closePath()}f=a}}function Pu(e,t,n,i){const r=function(e,t,n,i,r,o,a,s,l){const u=Ou.call(arguments);if(Cu[u])return Cu[u];const c=a*Au,f=Math.sin(c),d=Math.cos(c),h=d*(s-e)*.5+f*(l-t)*.5,p=d*(l-t)*.5-f*(s-e)*.5;let m=h*h/((n=Math.abs(n))*n)+p*p/((i=Math.abs(i))*i);m>1&&(m=Math.sqrt(m),n*=m,i*=m);const g=d/n,y=f/n,v=-f/i,b=d/i,x=g*s+y*l,w=v*s+b*l,_=g*e+y*t,k=v*e+b*t;let E=1/((_-x)*(_-x)+(k-w)*(k-w))-.25;E<0&&(E=0);let $=Math.sqrt(E);o==r&&($=-$);const A=.5*(x+_)-$*(k-w),D=.5*(w+k)+$*(_-x),S=Math.atan2(w-D,x-A);let F=Math.atan2(k-D,_-A)-S;F<0&&1===o?F+=Su:F>0&&0===o&&(F-=Su);const C=Math.ceil(Math.abs(F/(Du+.001))),M=[];for(let O=0;O<C;++O){const e=S+O*F/C,t=S+(O+1)*F/C;M[O]=[A,D,e,t,n,i,f,d]}return Cu[u]=M}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],t,n);for(let o=0;o<r.length;++o){const t=zu(r[o]);e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5])}}const Lu=.5773502691896257,Bu={circle:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,Su)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/2.5;e.moveTo(-n,-i),e.lineTo(-n,i),e.lineTo(-i,i),e.lineTo(-i,n),e.lineTo(i,n),e.lineTo(i,i),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(i,-i),e.lineTo(i,-n),e.lineTo(-i,-n),e.lineTo(-i,-i),e.closePath()}},diamond:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),i=-n/2;e.rect(i,i,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/7,r=n/2.5,o=n/8;e.moveTo(-i,n),e.lineTo(i,n),e.lineTo(i,-o),e.lineTo(r,-o),e.lineTo(0,-n),e.lineTo(-r,-o),e.lineTo(-i,-o),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,i=Fu*n,r=i-n*Lu,o=n/4;e.moveTo(0,-i-r),e.lineTo(-o,i-r),e.lineTo(o,i-r),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,i=Fu*n,r=i-n*Lu;e.moveTo(0,-i-r),e.lineTo(-n,i-r),e.lineTo(n,i-r),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Fu*n;e.moveTo(0,-i),e.lineTo(-n,i),e.lineTo(n,i),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Fu*n;e.moveTo(0,i),e.lineTo(-n,-i),e.lineTo(n,-i),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Fu*n;e.moveTo(i,0),e.lineTo(-i,-n),e.lineTo(-i,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Fu*n;e.moveTo(-i,0),e.lineTo(i,-n),e.lineTo(i,n),e.closePath()}},stroke:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}};function ju(e){return m(Bu,e)?Bu[e]:function(e){if(!m(Iu,e)){const t=$u(e);Iu[e]={draw:function(e,n){Tu(e,t,0,0,Math.sqrt(n)/2)}}}return Iu[e]}(e)}var Iu={};const qu=.448084975506;function Uu(e){return e.x}function Wu(e){return e.y}function Hu(e){return e.width}function Gu(e){return e.height}function Vu(e){return"function"==typeof e?e:()=>+e}function Xu(e,t,n){return Math.max(t,Math.min(e,n))}function Yu(){var e=Uu,t=Wu,n=Hu,i=Gu,r=Vu(0),o=r,a=r,s=r,l=null;function u(u,c,f){var d,h=null!=c?c:+e.call(this,u),p=null!=f?f:+t.call(this,u),m=+n.call(this,u),g=+i.call(this,u),y=Math.min(m,g)/2,v=Xu(+r.call(this,u),0,y),b=Xu(+o.call(this,u),0,y),x=Xu(+a.call(this,u),0,y),w=Xu(+s.call(this,u),0,y);if(l||(l=d=ni()),v<=0&&b<=0&&x<=0&&w<=0)l.rect(h,p,m,g);else{var _=h+m,k=p+g;l.moveTo(h+v,p),l.lineTo(_-b,p),l.bezierCurveTo(_-qu*b,p,_,p+qu*b,_,p+b),l.lineTo(_,k-w),l.bezierCurveTo(_,k-qu*w,_-qu*w,k,_-w,k),l.lineTo(h+x,k),l.bezierCurveTo(h+qu*x,k,h,k-qu*x,h,k-x),l.lineTo(h,p+v),l.bezierCurveTo(h,p+qu*v,h+qu*v,p,h+v,p),l.closePath()}if(d)return l=null,d+""||null}return u.x=function(t){return arguments.length?(e=Vu(t),u):e},u.y=function(e){return arguments.length?(t=Vu(e),u):t},u.width=function(e){return arguments.length?(n=Vu(e),u):n},u.height=function(e){return arguments.length?(i=Vu(e),u):i},u.cornerRadius=function(e,t,n,i){return arguments.length?(r=Vu(e),o=null!=t?Vu(t):r,s=null!=n?Vu(n):r,a=null!=i?Vu(i):o,u):r},u.context=function(e){return arguments.length?(l=null==e?null:e,u):l},u}function Ju(){var e,t,n,i,r,o,a,s,l=null;function u(e,t,n){const i=n/2;if(r){var u=a-t,c=e-o;if(u||c){var f=Math.hypot(u,c),d=(u/=f)*s,h=(c/=f)*s,p=Math.atan2(c,u);l.moveTo(o-d,a-h),l.lineTo(e-u*i,t-c*i),l.arc(e,t,i,p-Math.PI,p),l.lineTo(o+d,a+h),l.arc(o,a,s,p,p+Math.PI)}else l.arc(e,t,i,0,Su);l.closePath()}else r=1;o=e,a=t,s=i}function c(o){var a,s,c,f=o.length,d=!1;for(null==l&&(l=c=ni()),a=0;a<=f;++a)!(a<f&&i(s=o[a],a,o))===d&&(d=!d)&&(r=0),d&&u(+e(s,a,o),+t(s,a,o),+n(s,a,o));if(c)return l=null,c+""||null}return c.x=function(t){return arguments.length?(e=t,c):e},c.y=function(e){return arguments.length?(t=e,c):t},c.size=function(e){return arguments.length?(n=e,c):n},c.defined=function(e){return arguments.length?(i=e,c):i},c.context=function(e){return arguments.length?(l=null==e?null:e,c):l},c}function Qu(e,t){return null!=e?e:t}const Ku=e=>e.x||0,Zu=e=>e.y||0,ec=e=>!(!1===e.defined),tc=Sn().startAngle((e=>e.startAngle||0)).endAngle((e=>e.endAngle||0)).padAngle((e=>e.padAngle||0)).innerRadius((e=>e.innerRadius||0)).outerRadius((e=>e.outerRadius||0)).cornerRadius((e=>e.cornerRadius||0)),nc=vs().x(Ku).y1(Zu).y0((e=>(e.y||0)+(e.height||0))).defined(ec),ic=vs().y(Zu).x1(Ku).x0((e=>(e.x||0)+(e.width||0))).defined(ec),rc=Rn().x(Ku).y(Zu).defined(ec),oc=Yu().x(Ku).y(Zu).width((e=>e.width||0)).height((e=>e.height||0)).cornerRadius((e=>Qu(e.cornerRadiusTopLeft,e.cornerRadius)||0),(e=>Qu(e.cornerRadiusTopRight,e.cornerRadius)||0),(e=>Qu(e.cornerRadiusBottomRight,e.cornerRadius)||0),(e=>Qu(e.cornerRadiusBottomLeft,e.cornerRadius)||0)),ac=function(e,t){let n=null,i=Fn(r);function r(){let r;if(n||(n=r=i()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),r)return n=null,r+""||null}return e="function"==typeof e?e:Cn(e||bs),t="function"==typeof t?t:Cn(void 0===t?64:+t),r.type=function(t){return arguments.length?(e="function"==typeof t?t:Cn(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:Cn(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type((e=>ju(e.shape||"circle"))).size((e=>Qu(e.size,64))),sc=Ju().x(Ku).y(Zu).defined(ec).size((e=>e.size||1));function lc(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function uc(e,t,n,i){return oc.context(e)(t,n,i)}var cc=1;function fc(){cc=1}function dc(e,t,n){var i=t.clip,r=e._defs,a=t.clip_id||(t.clip_id="clip"+cc++),s=r.clipping[a]||(r.clipping[a]={id:a});return o(i)?s.path=i(null):lc(n)?s.path=uc(null,n,0,0):(s.width=n.width||0,s.height=n.height||0),"url(#"+a+")"}function hc(e){this.clear(),e&&this.union(e)}function pc(e){this.mark=e,this.bounds=this.bounds||new hc}function mc(e){pc.call(this,e),this.items=this.items||[]}hc.prototype={clone(){return new hc(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,i){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),i<t?(this.y2=t,this.y1=i):(this.y1=t,this.y2=i),this},add(e,t){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const i=this.rotatedPoints(e,t,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},rotatedPoints(e,t,n){var{x1:i,y1:r,x2:o,y2:a}=this,s=Math.cos(e),l=Math.sin(e),u=t-t*s+n*l,c=n-t*l-n*s;return[s*i-l*r+u,l*i+s*r+c,s*i-l*a+u,l*i+s*a+c,s*o-l*r+u,l*o+s*r+c,s*o-l*a+u,l*o+s*a+c]},union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this},encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)},contains(e,t){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},i(mc,pc);class gc{constructor(e){this._pending=0,this._loader=e||p()}pending(){return this._pending}sanitizeURL(e){const t=this;return yc(t),t._loader.sanitize(e,{context:"href"}).then((e=>(vc(t),e))).catch((()=>(vc(t),null)))}loadImage(e){const t=this,n="undefined"!=typeof Image?Image:null;return yc(t),t._loader.sanitize(e,{context:"image"}).then((e=>{const i=e.href;if(!i||!n)throw{url:i};const r=new n,o=m(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=o&&(r.crossOrigin=o),r.onload=()=>vc(t),r.onerror=()=>vc(t),r.src=i,r})).catch((e=>(vc(t),{complete:!1,width:0,height:0,src:e&&e.url||""})))}ready(){const e=this;return new Promise((t=>{!function n(i){e.pending()?setTimeout((()=>{n(!0)}),10):t(i)}(!1)}))}}function yc(e){e._pending+=1}function vc(e){e._pending-=1}function bc(e,t,n){if(t.stroke&&0!==t.opacity&&0!==t.strokeOpacity){const i=null!=t.strokeWidth?+t.strokeWidth:1;e.expand(i+(n?function(e,t){return e.strokeJoin&&"miter"!==e.strokeJoin?0:t}(t,i):0))}return e}const xc=Su-1e-8;let wc,_c,kc,Ec,$c,Ac,Dc,Sc;const Fc=(e,t)=>wc.add(e,t),Cc=(e,t)=>Fc(_c=e,kc=t),Mc=e=>Fc(e,wc.y1),Oc=e=>Fc(wc.x1,e),zc=(e,t)=>$c*e+Dc*t,Nc=(e,t)=>Ac*e+Sc*t,Rc=(e,t)=>Fc(zc(e,t),Nc(e,t)),Tc=(e,t)=>Cc(zc(e,t),Nc(e,t));function Pc(e,t){return wc=e,t?(Ec=t*Au,$c=Sc=Math.cos(Ec),Ac=Math.sin(Ec),Dc=-Ac):($c=Sc=1,Ec=Ac=Dc=0),Lc}const Lc={beginPath(){},closePath(){},moveTo:Tc,lineTo:Tc,rect(e,t,n,i){Ec?(Rc(e+n,t),Rc(e+n,t+i),Rc(e,t+i),Tc(e,t)):(Fc(e+n,t+i),Cc(e,t))},quadraticCurveTo(e,t,n,i){const r=zc(e,t),o=Nc(e,t),a=zc(n,i),s=Nc(n,i);Bc(_c,r,a,Mc),Bc(kc,o,s,Oc),Cc(a,s)},bezierCurveTo(e,t,n,i,r,o){const a=zc(e,t),s=Nc(e,t),l=zc(n,i),u=Nc(n,i),c=zc(r,o),f=Nc(r,o);jc(_c,a,l,c,Mc),jc(kc,s,u,f,Oc),Cc(c,f)},arc(e,t,n,i,r,o){if(i+=Ec,r+=Ec,_c=n*Math.cos(r)+e,kc=n*Math.sin(r)+t,Math.abs(r-i)>xc)Fc(e-n,t-n),Fc(e+n,t+n);else{const a=i=>Fc(n*Math.cos(i)+e,n*Math.sin(i)+t);let s,l;if(a(i),a(r),r!==i)if((i%=Su)<0&&(i+=Su),(r%=Su)<0&&(r+=Su),r<i&&(o=!o,s=i,i=r,r=s),o)for(r-=Su,s=i-i%Du,l=0;l<4&&s>r;++l,s-=Du)a(s);else for(s=i-i%Du+Du,l=0;l<4&&s<r;++l,s+=Du)a(s)}}};function Bc(e,t,n,i){const r=(e-t)/(e+n-2*t);0<r&&r<1&&i(e+(t-e)*r)}function jc(e,t,n,i,r){const o=i-e+3*t-3*n,a=e+n-2*t,s=e-t;let l,u=0,c=0;Math.abs(o)>1e-14?(l=a*a+s*o,l>=0&&(l=Math.sqrt(l),u=(-a+l)/o,c=(-a-l)/o)):u=.5*s/a,0<u&&u<1&&r(Ic(u,e,t,n,i)),0<c&&c<1&&r(Ic(c,e,t,n,i))}function Ic(e,t,n,i,r){const o=1-e,a=o*o,s=e*e;return a*o*t+3*a*e*n+3*o*s*i+s*e*r}var qc=(qc=xs(1,1))?qc.getContext("2d"):null;const Uc=new hc;function Wc(e){return function(t,n){if(!qc)return!0;e(qc,t),Uc.clear().union(t.bounds).intersect(n).round();const{x1:i,y1:r,x2:o,y2:a}=Uc;for(let e=r;e<=a;++e)for(let t=i;t<=o;++t)if(qc.isPointInPath(t,e))return!0;return!1}}function Hc(e,t){return t.contains(e.x||0,e.y||0)}function Gc(e,t){const n=e.x||0,i=e.y||0,r=e.width||0,o=e.height||0;return t.intersects(Uc.set(n,i,n+r,i+o))}function Vc(e,t){const n=e.x||0,i=e.y||0;return Xc(t,n,i,null!=e.x2?e.x2:n,null!=e.y2?e.y2:i)}function Xc(e,t,n,i,r){const{x1:o,y1:a,x2:s,y2:l}=e,u=i-t,c=r-n;let f,d,h,p,m=0,g=1;for(p=0;p<4;++p){if(0===p&&(f=-u,d=-(o-t)),1===p&&(f=u,d=s-t),2===p&&(f=-c,d=-(a-n)),3===p&&(f=c,d=l-n),Math.abs(f)<1e-10&&d<0)return!1;if(h=d/f,f<0){if(h>g)return!1;h>m&&(m=h)}else if(f>0){if(h<m)return!1;h<g&&(g=h)}}return!0}function Yc(e,t){e.globalCompositeOperation=t.blend||"source-over"}function Jc(e,t){return null==e?t:e}function Qc(e,t){const n=t.length;for(let i=0;i<n;++i)e.addColorStop(t[i].offset,t[i].color);return e}function Kc(e,t,n){return pu(n)?function(e,t,n){const i=n.width(),r=n.height();let o;if("radial"===t.gradient)o=e.createRadialGradient(n.x1+Jc(t.x1,.5)*i,n.y1+Jc(t.y1,.5)*r,Math.max(i,r)*Jc(t.r1,0),n.x1+Jc(t.x2,.5)*i,n.y1+Jc(t.y2,.5)*r,Math.max(i,r)*Jc(t.r2,.5));else{const a=Jc(t.x1,0),s=Jc(t.y1,0),l=Jc(t.x2,1),u=Jc(t.y2,0);if(a!==l&&s!==u&&i!==r){const n=xs(Math.ceil(i),Math.ceil(r)),o=n.getContext("2d");return o.scale(i,r),o.fillStyle=Qc(o.createLinearGradient(a,s,l,u),t.stops),o.fillRect(0,0,i,r),e.createPattern(n,"no-repeat")}o=e.createLinearGradient(n.x1+a*i,n.y1+s*r,n.x1+l*i,n.y1+u*r)}return Qc(o,t.stops)}(e,n,t.bounds):n}function Zc(e,t,n){return(n*=null==t.fillOpacity?1:t.fillOpacity)>0&&(e.globalAlpha=n,e.fillStyle=Kc(e,t,t.fill),!0)}var ef=[];function tf(e,t,n){var i=null!=(i=t.strokeWidth)?i:1;return!(i<=0)&&((n*=null==t.strokeOpacity?1:t.strokeOpacity)>0&&(e.globalAlpha=n,e.strokeStyle=Kc(e,t,t.stroke),e.lineWidth=i,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||ef),e.lineDashOffset=t.strokeDashOffset||0),!0))}function nf(e,t){return e.zindex-t.zindex||e.index-t.index}function rf(e){if(!e.zdirty)return e.zitems;var t,n,i,r=e.items,o=[];for(n=0,i=r.length;n<i;++n)(t=r[n]).index=n,t.zindex&&o.push(t);return e.zdirty=!1,e.zitems=o.sort(nf)}function of(e,t){var n,i,r=e.items;if(!r||!r.length)return;const o=rf(e);if(o&&o.length){for(n=0,i=r.length;n<i;++n)r[n].zindex||t(r[n]);r=o}for(n=0,i=r.length;n<i;++n)t(r[n])}function af(e,t){var n,i,r=e.items;if(!r||!r.length)return null;const o=rf(e);for(o&&o.length&&(r=o),i=r.length;--i>=0;)if(n=t(r[i]))return n;if(r===o)for(i=(r=e.items).length;--i>=0;)if(!r[i].zindex&&(n=t(r[i])))return n;return null}function sf(e){return function(t,n,i){of(n,(n=>{i&&!i.intersects(n.bounds)||lf(e,t,n,n)}))}}function lf(e,t,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(e(t,i)||(Yc(t,n),n.fill&&Zc(t,n,r)&&t.fill(),n.stroke&&tf(t,n,r)&&t.stroke()))}function uf(e){return e=e||l,function(t,n,i,r,o,a){return i*=t.pixelRatio,r*=t.pixelRatio,af(n,(n=>{const s=n.bounds;if((!s||s.contains(o,a))&&s)return e(t,n,i,r,o,a)?n:void 0}))}}function cf(e,t){return function(n,i,r,o){var a,s,l=Array.isArray(i)?i[0]:i,u=null==t?l.fill:t,c=l.stroke&&n.isPointInStroke;return c&&(a=l.strokeWidth,s=l.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=s?s:"butt"),!e(n,i)&&(u&&n.isPointInPath(r,o)||c&&n.isPointInStroke(r,o))}}function ff(e){return uf(cf(e))}function df(e,t){return"translate("+e+","+t+")"}function hf(e){return"rotate("+e+")"}function pf(e){return df(e.x||0,e.y||0)}function mf(e,t,n){function i(e,n){var i=n.x||0,r=n.y||0,o=n.angle||0;e.translate(i,r),o&&e.rotate(o*=Au),e.beginPath(),t(e,n),o&&e.rotate(-o),e.translate(-i,-r)}return{type:e,tag:"path",nested:!1,attr:function(e,n){e("transform",function(e){return df(e.x||0,e.y||0)+(e.angle?" "+hf(e.angle):"")}(n)),e("d",t(null,n))},bound:function(e,n){return t(Pc(e,n.angle),n),bc(e,n).translate(n.x||0,n.y||0)},draw:sf(i),pick:ff(i),isect:n||Wc(i)}}var gf=mf("arc",(function(e,t){return tc.context(e)(t)}));function yf(e,t,n){function i(e,n){e.beginPath(),t(e,n)}const r=cf(i);return{type:e,tag:"path",nested:!0,attr:function(e,n){var i=n.mark.items;i.length&&e("d",t(null,i))},bound:function(e,n){var i=n.items;return 0===i.length?e:(t(Pc(e),i),bc(e,i[0]))},draw:(o=i,function(e,t,n){!t.items.length||n&&!n.intersects(t.bounds)||lf(o,e,t.items[0],t.items)}),pick:function(e,t,n,i,o,a){var s=t.items,l=t.bounds;return!s||!s.length||l&&!l.contains(o,a)?null:(n*=e.pixelRatio,i*=e.pixelRatio,r(e,s,n,i)?s[0]:null)},isect:Hc,tip:n};var o}var vf=yf("area",(function(e,t){const n=t[0],i=n.interpolate||"linear";return("horizontal"===n.orient?ic:nc).curve(bu(i,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,i,r="horizontal"===e[0].orient?t[1]:t[0],o="horizontal"===e[0].orient?"y":"x",a=e.length,s=1/0;--a>=0;)!1!==e[a].defined&&(i=Math.abs(e[a][o]-r))<s&&(s=i,n=e[a]);return n}));function bf(e,t){e.beginPath(),lc(t)?uc(e,t,0,0):e.rect(0,0,t.width||0,t.height||0),e.clip()}function xf(e){const t=Jc(e.strokeWidth,1);return null!=e.strokeOffset?e.strokeOffset:e.stroke&&t>.5&&t<1.5?.5-Math.abs(t-1):0}function wf(e,t){const n=xf(t);e("d",uc(null,t,n,n))}function _f(e,t,n,i){const r=xf(t);e.beginPath(),uc(e,t,(n||0)+r,(i||0)+r)}const kf=cf(_f),Ef=cf(_f,!1),$f=cf(_f,!0);var Af={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",pf(t))},bound:function(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let t=0;t<i;++t)e.union(n[t].bounds)}return(t.clip||t.width||t.height)&&!t.noBound&&e.add(0,0).add(t.width||0,t.height||0),bc(e,t),e.translate(t.x||0,t.y||0)},draw:function(e,t,n,i){of(t,(t=>{const r=t.x||0,o=t.y||0,a=t.strokeForeground,s=null==t.opacity?1:t.opacity;(t.stroke||t.fill)&&s&&(_f(e,t,r,o),Yc(e,t),t.fill&&Zc(e,t,s)&&e.fill(),t.stroke&&!a&&tf(e,t,s)&&e.stroke()),e.save(),e.translate(r,o),t.clip&&bf(e,t),n&&n.translate(-r,-o),of(t,(t=>{("group"===t.marktype||null==i||i.includes(t.marktype))&&this.draw(e,t,n,i)})),n&&n.translate(r,o),e.restore(),a&&t.stroke&&s&&(_f(e,t,r,o),Yc(e,t),tf(e,t,s)&&e.stroke())}))},pick:function(e,t,n,i,r,o){if(t.bounds&&!t.bounds.contains(r,o)||!t.items)return null;const a=n*e.pixelRatio,s=i*e.pixelRatio;return af(t,(l=>{let u,c,f;const d=l.bounds;if(d&&!d.contains(r,o))return;c=l.x||0,f=l.y||0;const h=c+(l.width||0),p=f+(l.height||0),m=l.clip;if(m&&(r<c||r>h||o<f||o>p))return;if(e.save(),e.translate(c,f),c=r-c,f=o-f,m&&lc(l)&&!$f(e,l,a,s))return e.restore(),null;const g=l.strokeForeground,y=!1!==t.interactive;return y&&g&&l.stroke&&Ef(e,l,a,s)?(e.restore(),l):(u=af(l,(e=>function(e,t,n){return(!1!==e.interactive||"group"===e.marktype)&&e.bounds&&e.bounds.contains(t,n)}(e,c,f)?this.pick(e,n,i,c,f):null)),!u&&y&&(l.fill||!g&&l.stroke)&&kf(e,l,a,s)&&(u=l),e.restore(),u||null)}))},isect:Gc,content:function(e,t,n){e("clip-path",t.clip?dc(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),wf(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?wf(e,t):e("d","")}},Df={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function Sf(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then((t=>{e.image=t,e.image.url=e.url}))),n}function Ff(e,t){return null!=e.width?e.width:t&&t.width?!1!==e.aspect&&e.height?e.height*t.width/t.height:t.width:0}function Cf(e,t){return null!=e.height?e.height:t&&t.height?!1!==e.aspect&&e.width?e.width*t.height/t.width:t.height:0}function Mf(e,t){return"center"===e?t/2:"right"===e?t:0}function Of(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var zf={type:"image",tag:"image",nested:!1,attr:function(e,t,n){const i=Sf(t,n),r=Ff(t,i),o=Cf(t,i),a=(t.x||0)-Mf(t.align,r),s=(t.y||0)-Of(t.baseline,o);e("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",Df["xmlns:xlink"],"xlink:href"),e("transform",df(a,s)),e("width",r),e("height",o),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){const n=t.image,i=Ff(t,n),r=Cf(t,n),o=(t.x||0)-Mf(t.align,i),a=(t.y||0)-Of(t.baseline,r);return e.set(o,a,o+i,a+r)},draw:function(e,t,n){of(t,(t=>{if(n&&!n.intersects(t.bounds))return;const i=Sf(t,this);let r=Ff(t,i),o=Cf(t,i);if(0===r||0===o)return;let a,s,l,u,c=(t.x||0)-Mf(t.align,r),f=(t.y||0)-Of(t.baseline,o);!1!==t.aspect&&(s=i.width/i.height,l=t.width/t.height,s==s&&l==l&&s!==l&&(l<s?(u=r/s,f+=(o-u)/2,o=u):(u=o*s,c+=(r-u)/2,r=u))),(i.complete||i.toDataURL)&&(Yc(e,t),e.globalAlpha=null!=(a=t.opacity)?a:1,e.imageSmoothingEnabled=!1!==t.smooth,e.drawImage(i,c,f,r,o))}))},pick:uf(),isect:l,get:Sf,xOffset:Mf,yOffset:Of},Nf=yf("line",(function(e,t){const n=t[0],i=n.interpolate||"linear";return rc.curve(bu(i,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,i,r=Math.pow(e[0].strokeWidth||1,2),o=e.length;--o>=0;)if(!1!==e[o].defined&&(n=e[o].x-t[0])*n+(i=e[o].y-t[1])*i<r)return e[o];return null}));function Rf(e,t){var n=t.path;if(null==n)return!0;var i=t.x||0,r=t.y||0,o=t.scaleX||1,a=t.scaleY||1,s=(t.angle||0)*Au,l=t.pathCache;l&&l.path===n||((t.pathCache=l=$u(n)).path=n),s&&e.rotate&&e.translate?(e.translate(i,r),e.rotate(s),Tu(e,l,0,0,o,a),e.rotate(-s),e.translate(-i,-r)):Tu(e,l,i,r,o,a)}var Tf={type:"path",tag:"path",nested:!1,attr:function(e,t){var n=t.scaleX||1,i=t.scaleY||1;1===n&&1===i||e("vector-effect","non-scaling-stroke"),e("transform",function(e){return df(e.x||0,e.y||0)+(e.angle?" "+hf(e.angle):"")+(e.scaleX||e.scaleY?" "+(t=e.scaleX||1,n=e.scaleY||1,"scale("+t+","+n+")"):"");var t,n}(t)),e("d",t.path)},bound:function(e,t){return Rf(Pc(e,t.angle),t)?e.set(0,0,0,0):bc(e,t,!0)},draw:sf(Rf),pick:ff(Rf),isect:Wc(Rf)};function Pf(e,t){e.beginPath(),uc(e,t)}var Lf={type:"rect",tag:"path",nested:!1,attr:function(e,t){e("d",uc(null,t))},bound:function(e,t){var n,i;return bc(e.set(n=t.x||0,i=t.y||0,n+t.width||0,i+t.height||0),t)},draw:sf(Pf),pick:ff(Pf),isect:Gc};function Bf(e,t,n){var i,r,o,a;return!(!t.stroke||!tf(e,t,n))&&(i=t.x||0,r=t.y||0,o=null!=t.x2?t.x2:i,a=null!=t.y2?t.y2:r,e.beginPath(),e.moveTo(i,r),e.lineTo(o,a),!0)}var jf={type:"rule",tag:"line",nested:!1,attr:function(e,t){e("transform",pf(t)),e("x2",null!=t.x2?t.x2-(t.x||0):0),e("y2",null!=t.y2?t.y2-(t.y||0):0)},bound:function(e,t){var n,i;return bc(e.set(n=t.x||0,i=t.y||0,null!=t.x2?t.x2:n,null!=t.y2?t.y2:i),t)},draw:function(e,t,n){of(t,(t=>{if(!n||n.intersects(t.bounds)){var i=null==t.opacity?1:t.opacity;i&&Bf(e,t,i)&&(Yc(e,t),e.stroke())}}))},pick:uf((function(e,t,n,i){return!!e.isPointInStroke&&(Bf(e,t,1)&&e.isPointInStroke(n,i))})),isect:Vc},If=mf("shape",(function(e,t){return(t.mark.shape||t.shape).context(e)(t)})),qf=mf("symbol",(function(e,t){return ac.context(e)(t)}),Hc);const Uf=ae();var Wf={height:Jf,measureWidth:Xf,estimateWidth:Gf,width:Gf,canvas:Hf};function Hf(e){Wf.width=e&&qc?Xf:Gf}function Gf(e,t){return Vf(ed(e,t),Jf(e))}function Vf(e,t){return~~(.8*e.length*t)}function Xf(e,t){return Jf(e)<=0||!(t=ed(e,t))?0:Yf(t,nd(e))}function Yf(e,t){const n=`(${t}) ${e}`;let i=Uf.get(n);return void 0===i&&(qc.font=t,i=qc.measureText(e).width,Uf.set(n,i)),i}function Jf(e){return null!=e.fontSize?+e.fontSize||0:11}function Qf(e){return null!=e.lineHeight?e.lineHeight:Jf(e)+2}function Kf(e){return t=e.lineBreak&&e.text&&!a(e.text)?e.text.split(e.lineBreak):e.text,a(t)?t.length>1?t:t[0]:t;var t}function Zf(e){const t=Kf(e);return(a(t)?t.length-1:0)*Qf(e)}function ed(e,t){const n=null==t?"":(t+"").trim();return e.limit>0&&n.length?function(e,t){var n=+e.limit,i=function(e){if(Wf.width===Xf){const t=nd(e);return e=>Yf(e,t)}if(Wf.width===Gf){const t=Jf(e);return e=>Vf(e,t)}return t=>Wf.width(e,t)}(e);if(i(t)<n)return t;var r,o=e.ellipsis||"…",a="rtl"===e.dir,s=0,l=t.length;if(n-=i(o),a){for(;s<l;)r=s+l>>>1,i(t.slice(r))>n?s=r+1:l=r;return o+t.slice(s)}for(;s<l;)r=1+(s+l>>>1),i(t.slice(0,r))<n?s=r:l=r-1;return t.slice(0,s)+o}(e,n):n}function td(e,t){var n=e.font;return(t&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function nd(e,t){return(e.fontStyle?e.fontStyle+" ":"")+(e.fontVariant?e.fontVariant+" ":"")+(e.fontWeight?e.fontWeight+" ":"")+Jf(e)+"px "+td(e,t)}function id(e){var t=e.baseline,n=Jf(e);return Math.round("top"===t?.79*n:"middle"===t?.3*n:"bottom"===t?-.21*n:"line-top"===t?.29*n+.5*Qf(e):"line-bottom"===t?.29*n-.5*Qf(e):0)}Hf(!0);const rd={left:"start",center:"middle",right:"end"},od=new hc;function ad(e){var t,n=e.x||0,i=e.y||0,r=e.radius||0;return r&&(t=(e.theta||0)-Du,n+=r*Math.cos(t),i+=r*Math.sin(t)),od.x1=n,od.y1=i,od}function sd(e,t,n){var i,r=Wf.height(t),o=t.align,s=ad(t),l=s.x1,u=s.y1,c=t.dx||0,f=(t.dy||0)+id(t)-Math.round(.8*r),d=Kf(t);if(a(d)?(r+=Qf(t)*(d.length-1),i=d.reduce(((e,n)=>Math.max(e,Wf.width(t,n))),0)):i=Wf.width(t,d),"center"===o?c-=i/2:"right"===o&&(c-=i),e.set(c+=l,f+=u,c+i,f+r),t.angle&&!n)e.rotate(t.angle*Au,l,u);else if(2===n)return e.rotatedPoints(t.angle*Au,l,u);return e}var ld={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,i=t.dx||0,r=(t.dy||0)+id(t),o=ad(t),a=o.x1,s=o.y1,l=t.angle||0;e("text-anchor",rd[t.align]||"start"),l?(n=df(a,s)+" "+hf(l),(i||r)&&(n+=" "+df(i,r))):n=df(a+i,s+r),e("transform",n)},bound:sd,draw:function(e,t,n){of(t,(t=>{var i,r,o,s,l,u,c,f=null==t.opacity?1:t.opacity;if(!(n&&!n.intersects(t.bounds)||0===f||t.fontSize<=0||null==t.text||0===t.text.length)){if(e.font=nd(t),e.textAlign=t.align||"left",r=(i=ad(t)).x1,o=i.y1,t.angle&&(e.save(),e.translate(r,o),e.rotate(t.angle*Au),r=o=0),r+=t.dx||0,o+=(t.dy||0)+id(t),u=Kf(t),Yc(e,t),a(u))for(l=Qf(t),s=0;s<u.length;++s)c=ed(t,u[s]),t.fill&&Zc(e,t,f)&&e.fillText(c,r,o),t.stroke&&tf(e,t,f)&&e.strokeText(c,r,o),o+=l;else c=ed(t,u),t.fill&&Zc(e,t,f)&&e.fillText(c,r,o),t.stroke&&tf(e,t,f)&&e.strokeText(c,r,o);t.angle&&e.restore()}}))},pick:uf((function(e,t,n,i,r,o){if(t.fontSize<=0)return!1;if(!t.angle)return!0;var a=ad(t),s=a.x1,l=a.y1,u=sd(od,t,1),c=-t.angle*Au,f=Math.cos(c),d=Math.sin(c),h=f*r-d*o+(s-f*s+d*l),p=d*r+f*o+(l-d*s-f*l);return u.contains(h,p)})),isect:function(e,t){const n=sd(od,e,2);return Xc(t,n[0],n[1],n[2],n[3])||Xc(t,n[0],n[1],n[4],n[5])||Xc(t,n[4],n[5],n[6],n[7])||Xc(t,n[2],n[3],n[6],n[7])}},ud={arc:gf,area:vf,group:Af,image:zf,line:Nf,path:Tf,rect:Lf,rule:jf,shape:If,symbol:qf,text:ld,trail:yf("trail",(function(e,t){return sc.context(e)(t)}),(function(e,t){for(var n,i,r=e.length;--r>=0;)if(!1!==e[r].defined&&(n=e[r].x-t[0])*n+(i=e[r].y-t[1])*i<(n=e[r].size||1)*n)return e[r];return null}))};function cd(e,t,n){var i=ud[e.mark.marktype],r=t||i.bound;return i.nested&&(e=e.mark),r(e.bounds||(e.bounds=new hc),e,n)}var fd={mark:null};function dd(e,t,n){var i,r,o,a,s=ud[e.marktype],l=s.bound,u=e.items,c=u&&u.length;if(s.nested)return c?o=u[0]:(fd.mark=e,o=fd),a=cd(o,l,n),t=t&&t.union(a)||a;if(t=t||e.bounds&&e.bounds.clear()||new hc,c)for(i=0,r=u.length;i<r;++i)t.union(cd(u[i],l,n));return e.bounds=t}const hd=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","blend","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","strokeForeground","strokeOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","interpolate","tension","orient","defined","url","aspect","smooth","path","scaleX","scaleY","x2","y2","size","shape","text","angle","theta","radius","dir","dx","dy","ellipsis","limit","lineBreak","lineHeight","font","fontSize","fontWeight","fontStyle","fontVariant","description","aria","ariaRole","ariaRoleDescription"];function pd(e,t){return JSON.stringify(e,hd,t)}function md(e){return gd("string"==typeof e?JSON.parse(e):e)}function gd(e){var t,n,i,r=e.marktype,o=e.items;if(o)for(n=0,i=o.length;n<i;++n)t=r?"mark":"group",o[n][t]=e,o[n].zindex&&(o[n][t].zdirty=!0),"group"===(r||t)&&gd(o[n]);return r&&dd(e),e}class yd{constructor(e){arguments.length?this.root=md(e):(this.root=vd({marktype:"group",name:"root",role:"frame"}),this.root.items=[new mc(this.root)])}toJSON(e){return pd(this.root,e||0)}mark(e,t,n){const i=vd(e,t=t||this.root.items[0]);return t.items[n]=i,i.zindex&&(i.group.zdirty=!0),i}}function vd(e,t){const n={bounds:new hc,clip:!!e.clip,group:t,interactive:!1!==e.interactive,items:[],marktype:e.marktype,name:e.name||void 0,role:e.role||void 0,zindex:e.zindex||0};return null!=e.aria&&(n.aria=e.aria),e.description&&(n.description=e.description),n}function bd(e,t,n){return!e&&"undefined"!=typeof document&&document.createElement&&(e=document),e?n?e.createElementNS(n,t):e.createElement(t):null}function xd(e,t){t=t.toLowerCase();for(var n=e.childNodes,i=0,r=n.length;i<r;++i)if(n[i].tagName.toLowerCase()===t)return n[i]}function wd(e,t,n,i){var r,o=e.childNodes[t];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(r=o||null,o=bd(e.ownerDocument,n,i),e.insertBefore(o,r)),o}function _d(e,t){for(var n=e.childNodes,i=n.length;i>t;)e.removeChild(n[--i]);return e}function kd(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function Ed(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}let $d=class{constructor(e,t){this._active=null,this._handlers={},this._loader=e||p(),this._tooltip=t||Ad}initialize(e,t,n){return this._el=e,this._obj=n||null,this.origin(t)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()}scene(e){return arguments.length?(this._scene=e,this):this._scene}on(){}off(){}_handlerIndex(e,t,n){for(let i=e?e.length:0;--i>=0;)if(e[i].type===t&&(!n||e[i].handler===n))return i;return-1}handlers(e){const t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(const i in t)n.push(...t[i]);return n}eventName(e){const t=e.indexOf(".");return t<0?e:e.slice(0,t)}handleHref(e,t,n){this._loader.sanitize(n,{context:"href"}).then((t=>{const n=new MouseEvent(e.type,e),i=bd(null,"a");for(const e in t)i.setAttribute(e,t[e]);i.dispatchEvent(n)})).catch((()=>{}))}handleTooltip(e,t,n){if(t&&null!=t.tooltip){t=function(e,t,n,i){var r,o,a=e&&e.mark;if(a&&(r=ud[a.marktype]).tip){for((o=Ed(t,n))[0]-=i[0],o[1]-=i[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=r.tip(a.items,o)}return e}(t,e,this.canvas(),this._origin);const i=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,i)}}getItemBoundingClientRect(e){const t=this.canvas();if(!t)return;const n=t.getBoundingClientRect(),i=this._origin,r=e.bounds,o=r.width(),a=r.height();let s=r.x1+i[0]+n.left,l=r.y1+i[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,l+=e.y||0;return{x:s,y:l,width:o,height:a,left:s,top:l,right:s+o,bottom:l+a}}};function Ad(e,t,n,i){e.element().setAttribute("title",i||"")}class Dd{constructor(e){this._el=null,this._bgcolor=null,this._loader=new gc(e)}initialize(e,t,n,i,r){return this._el=e,this.resize(t,n,i,r)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(e){return 0===arguments.length?this._bgcolor:(this._bgcolor=e,this)}resize(e,t,n,i){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=i||1,this}dirty(){}render(e,t){const n=this;return n._call=function(){n._render(e,t)},n._call(),n._call=null,n}_render(){}renderAsync(e,t){const n=this.render(e,t);return this._ready?this._ready.then((()=>n)):Promise.resolve(n)}_load(e,t){var n=this,i=n._loader[e](t);if(!n._ready){const e=n._call;n._ready=n._loader.ready().then((t=>{t&&e(),n._ready=null}))}return i}sanitizeURL(e){return this._load("sanitizeURL",e)}loadImage(e){return this._load("loadImage",e)}}const Sd="dragenter",Fd="dragleave",Cd="dragover",Md="pointerdown",Od="pointermove",zd="pointerout",Nd="pointerover",Rd="mousedown",Td="mousemove",Pd="mouseout",Ld="mouseover",Bd="click",jd="mousewheel",Id="touchstart",qd="touchmove",Ud="touchend",Wd=["keydown","keypress","keyup",Sd,Fd,Cd,Md,"pointerup",Od,zd,Nd,Rd,"mouseup",Td,Pd,Ld,Bd,"dblclick","wheel",jd,Id,qd,Ud],Hd=Od,Gd=Pd,Vd=Bd;class Xd extends $d{constructor(e,t){super(e,t),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=Wd,this.pointermove=Kd([Od,Td],[Nd,Ld],[zd,Pd]),this.dragover=Kd([Cd],[Sd],[Fd]),this.pointerout=Zd([zd,Pd]),this.dragleave=Zd([Fd])}initialize(e,t,n){return this._canvas=e&&xd(e,"canvas"),[Bd,Rd,Md,Od,zd,Fd].forEach((e=>Jd(this,e))),super.initialize(e,t,n)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(e){this.fire(jd,e)}pointerdown(e){this._down=this._active,this.fire(Md,e)}mousedown(e){this._down=this._active,this.fire(Rd,e)}click(e){this._down===this._active&&(this.fire(Bd,e),this._down=null)}touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(Id,e,!0)}touchmove(e){this.fire(qd,e,!0)}touchend(e){this.fire(Ud,e,!0),this._touch=null}fire(e,t,n){const i=n?this._touch:this._active,r=this._handlers[e];if(t.vegaType=e,e===Vd&&i&&i.href?this.handleHref(t,i,i.href):e!==Hd&&e!==Gd||this.handleTooltip(t,i,e!==Gd),r)for(let o=0,a=r.length;o<a;++o)r[o].handler.call(this._obj,t,i)}on(e,t){const n=this.eventName(e),i=this._handlers;return this._handlerIndex(i[n],e,t)<0&&(Jd(this,e),(i[n]||(i[n]=[])).push({type:e,handler:t})),this}off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&i.splice(r,1),this}pickEvent(e){const t=Ed(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])}pick(e,t,n,i,r){const o=this.context();return ud[e.marktype].pick.call(this,o,e,t,n,i,r)}}const Yd=e=>e===Id||e===qd||e===Ud?[Id,qd,Ud]:[e];function Jd(e,t){Yd(t).forEach((t=>function(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?n=>e[t](n):n=>e.fire(t,n)))}(e,t)))}function Qd(e,t,n){t.forEach((t=>e.fire(t,n)))}function Kd(e,t,n){return function(i){const r=this._active,o=this.pickEvent(i);o===r||(r&&r.exit||Qd(this,n,i),this._active=o,Qd(this,t,i)),Qd(this,e,i)}}function Zd(e){return function(t){Qd(this,e,t),this._active=null}}function eh(e,t,n,i,r,o){const a="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,s=e.getContext("2d"),l=a?"undefined"!=typeof window&&window.devicePixelRatio||1:r;e.width=t*l,e.height=n*l;for(const u in o)s[u]=o[u];return a&&1!==l&&(e.style.width=t+"px",e.style.height=n+"px"),s.pixelRatio=l,s.setTransform(l,0,0,l,l*i[0],l*i[1]),e}class th extends Dd{constructor(e){super(e),this._options={},this._redraw=!1,this._dirty=new hc,this._tempb=new hc}initialize(e,t,n,i,r,o){return this._options=o||{},this._canvas=this._options.externalContext?null:xs(1,1,this._options.type),e&&this._canvas&&(_d(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(e,t,n,i,r)}resize(e,t,n,i){if(super.resize(e,t,n,i),this._canvas)eh(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const e=this._options.externalContext;e||s("CanvasRenderer is missing a valid canvas or context"),e.scale(this._scale,this._scale),e.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(e){const t=this._tempb.clear().union(e.bounds);let n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)}_render(e,t){const n=this.context(),i=this._origin,r=this._width,o=this._height,a=this._dirty,s=nh(i,r,o);n.save();const l=this._redraw||a.empty()?(this._redraw=!1,s.expand(1)):function(e,t,n){t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio);return t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(n,s.intersect(a),i);return this.clear(-i[0],-i[1],r,o),this.draw(n,e,l,t),n.restore(),a.clear(),this}draw(e,t,n,i){if("group"!==t.marktype&&null!=i&&!i.includes(t.marktype))return;const r=ud[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),o(n)?(e.beginPath(),n(e),e.clip()):bf(e,t.group)}(e,t),r.draw.call(this,e,t,n,i),t.clip&&e.restore()}clear(e,t,n,i){const r=this._options,o=this.context();"pdf"===r.type||r.externalContext||o.clearRect(e,t,n,i),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(e,t,n,i))}}const nh=(e,t,n)=>(new hc).set(0,0,t,n).translate(-e[0],-e[1]);class ih extends $d{constructor(e,t){super(e,t);const n=this;n._hrefHandler=rh(n,((e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=rh(n,((e,t)=>{n.handleTooltip(e,t,e.type!==Gd)}))}initialize(e,t,n){let i=this._svg;return i&&(i.removeEventListener(Vd,this._hrefHandler),i.removeEventListener(Hd,this._tooltipHandler),i.removeEventListener(Gd,this._tooltipHandler)),this._svg=i=e&&xd(e,"svg"),i&&(i.addEventListener(Vd,this._hrefHandler),i.addEventListener(Hd,this._tooltipHandler),i.addEventListener(Gd,this._tooltipHandler)),super.initialize(e,t,n)}canvas(){return this._svg}on(e,t){const n=this.eventName(e),i=this._handlers;if(this._handlerIndex(i[n],e,t)<0){const r={type:e,handler:t,listener:rh(this,t)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this}off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this}}const rh=(e,t)=>n=>{let i=n.target.__data__;i=Array.isArray(i)?i[0]:i,n.vegaType=n.type,t.call(e._obj,n,i)},oh="aria-hidden",ah="aria-label",sh="role",lh="aria-roledescription",uh="graphics-object",ch="graphics-symbol",fh=(e,t,n)=>({[sh]:e,[lh]:t,[ah]:n||void 0}),dh=ne(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),hh={axis:{desc:"axis",caption:function(e){const t=e.datum,n=e.orient,i=t.title?vh(e):null,r=e.context,o=r.scales[t.scale].value,a=r.dataflow.locale(),s=o.type;return("left"===n||"right"===n?"Y":"X")+"-axis"+(i?` titled '${i}'`:"")+` for a ${Ml(s)?"discrete":s} scale with ${fu(a,o,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,n=t.title?vh(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,o=Object.keys(r),a=e.context,s=a.scales[r[o[0]]].value,l=a.dataflow.locale();return u=i,(u.length?u[0].toUpperCase()+u.slice(1):u)+(n?` titled '${n}'`:"")+` for ${function(e){return e=e.map((e=>e+("fill"===e||"stroke"===e?" color":""))),e.length<2?e[0]:e.slice(0,-1).join(", ")+" and "+R(e)}(o)} with ${fu(l,s,e)}`;var u}},"title-text":{desc:"title",caption:e=>`Title text '${yh(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${yh(e)}'`}},ph={ariaRole:sh,ariaRoleDescription:lh,description:ah};function mh(e,t){const n=!1===t.aria;if(e(oh,n||void 0),n||null==t.description)for(const i in ph)e(ph[i],void 0);else{const n=t.mark.marktype;e(ah,t.description),e(sh,t.ariaRole||("group"===n?uh:ch)),e(lh,t.ariaRoleDescription||`${n} mark`)}}function gh(e){return!1===e.aria?{[oh]:!0}:dh[e.role]?null:hh[e.role]?function(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return fh(t.role||ch,t.desc,n.description||i(n))}catch(n){return null}}(e,hh[e.role]):function(e){const t=e.marktype,n="group"===t||"text"===t||e.items.some((e=>null!=e.description&&!1!==e.aria));return fh(n?uh:ch,`${t} mark container`,e.description)}(e)}function yh(e){return r(e.text).join(" ")}function vh(e){try{return r(R(e.items).items[0].text).join(" ")}catch(t){return null}}const bh=e=>(e+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function xh(){let e="",t="",n="";const i=[],r=()=>t=n="",o=(e,n)=>{var i;return null!=n&&(t+=` ${e}="${i=n,bh(i).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;")}"`),a},a={open(s){(o=>{t&&(e+=`${t}>${n}`,r()),i.push(o)})(s),t="<"+s;for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c<l;c++)u[c-1]=arguments[c];for(const e of u)for(const t in e)o(t,e[t]);return a},close(){const o=i.pop();return e+=t?t+(n?`>${n}</${o}>`:"/>"):`</${o}>`,r(),a},attr:o,text:e=>(n+=bh(e),a),toString:()=>e};return a}const wh=e=>_h(xh(),e)+"";function _h(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let t=0;t<i;++t)e.attr(n[t].name,n[t].value)}if(t.hasChildNodes()){const n=t.childNodes;for(const t of n)3===t.nodeType?e.text(t.nodeValue):_h(e,t)}return e.close()}const kh={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},Eh={blend:"mix-blend-mode"},$h={fill:"none","stroke-miterlimit":10},Ah="http://www.w3.org/2000/xmlns/",Dh=Df.xmlns;class Sh extends Dd{constructor(e){super(e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(e,t,n,i,r){return this._defs={},this._clearDefs(),e&&(this._svg=wd(e,0,"svg",Dh),this._svg.setAttributeNS(Ah,"xmlns",Dh),this._svg.setAttributeNS(Ah,"xmlns:xlink",Df["xmlns:xlink"]),this._svg.setAttribute("version",Df.version),this._svg.setAttribute("class","marks"),_d(e,1),this._root=wd(this._svg,0,"g",Dh),Lh(this._root,$h),_d(this._svg,1)),this.background(this._bgcolor),super.initialize(e,t,n,i,r)}background(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),super.background(...arguments)}resize(e,t,n,i){return super.resize(e,t,n,i),this._svg&&(Lh(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this}canvas(){return this._svg}svg(){const e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute("style"),n=wd(e,0,"rect",Dh),Lh(n,{width:this._width,height:this._height,fill:t}));const i=wh(e);return t&&(e.removeChild(n),this._svg.style.setProperty("background-color",t)),i}_render(e,t){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e,void 0,t),_d(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this}dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))}isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID}_dirtyCheck(){this._dirtyAll=!0;const e=this._dirty;if(!e.length||!this._dirtyID)return!0;const t=++this._dirtyID;let n,i,r,o,a,s,l;for(a=0,s=e.length;a<s;++a)n=e[a],i=n.mark,i.marktype!==r&&(r=i.marktype,o=ud[r]),i.zdirty&&i.dirty!==t&&(this._dirtyAll=!1,Fh(n,t),i.items.forEach((e=>{e.dirty=t}))),i.zdirty||(n.exit?(o.nested&&i.items.length?(l=i.items[0],l._svg&&this._update(o,l._svg,l)):n._svg&&(l=n._svg.parentNode,l&&l.removeChild(n._svg)),n._svg=null):(n=o.nested?i.items[0]:n,n._update!==t&&(n._svg&&n._svg.ownerSVGElement?this._update(o,n._svg,n):(this._dirtyAll=!1,Fh(n,t)),n._update=t)));return!this._dirtyAll}mark(e,t,n,i){if(!this.isDirty(t))return t._svg;const r=this._svg,o=t.marktype,a=ud[o],s=!1===t.interactive?"none":null,l="g"===a.tag,u=Oh(t,e,n,"g",r);if("group"!==o&&null!=i&&!i.includes(o))return _d(u,0),t._svg;u.setAttribute("class",kd(t));const c=gh(t);for(const p in c)Bh(u,p,c[p]);l||Bh(u,"pointer-events",s),Bh(u,"clip-path",t.clip?dc(this,t,t.group):null);let f=null,d=0;const h=e=>{const t=this.isDirty(e),n=Oh(e,u,f,a.tag,r);t&&(this._update(a,n,e),l&&function(e,t,n,i){t=t.lastChild.previousSibling;let r,o=0;of(n,(n=>{r=e.mark(t,n,r,i),++o})),_d(t,1+o)}(this,n,e,i)),f=n,++d};return a.nested?t.items.length&&h(t.items[0]):of(t,h),_d(u,d),u}_update(e,t,n){zh=t,Nh=t.__values__,mh(Th,n),e.attr(Th,n,this);const i=Rh[e.type];i&&i.call(this,e,t,n),zh&&this.style(zh,n)}style(e,t){if(null!=t){for(const n in kh){let i="font"===n?td(t):t[n];if(i===Nh[n])continue;const r=kh[n];null==i?e.removeAttribute(r):(pu(i)&&(i=mu(i,this._defs.gradient,jh())),e.setAttribute(r,i+"")),Nh[n]=i}for(const n in Eh)Ph(e,Eh[n],t[n])}}defs(){const e=this._svg,t=this._defs;let n=t.el,i=0;for(const r in t.gradient)n||(t.el=n=wd(e,1,"defs",Dh)),i=Ch(n,t.gradient[r],i);for(const r in t.clipping)n||(t.el=n=wd(e,1,"defs",Dh)),i=Mh(n,t.clipping[r],i);n&&(0===i?(e.removeChild(n),t.el=null):_d(n,i))}_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}}function Fh(e,t){for(;e&&e.dirty!==t;e=e.mark.group){if(e.dirty=t,!e.mark||e.mark.dirty===t)return;e.mark.dirty=t}}function Ch(e,t,n){let i,r,o;if("radial"===t.gradient){let i=wd(e,n++,"pattern",Dh);Lh(i,{id:hu+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),i=wd(i,0,"rect",Dh),Lh(i,{width:1,height:1,fill:`url(${jh()}#${t.id})`}),Lh(e=wd(e,n++,"radialGradient",Dh),{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else Lh(e=wd(e,n++,"linearGradient",Dh),{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(i=0,r=t.stops.length;i<r;++i)o=wd(e,i,"stop",Dh),o.setAttribute("offset",t.stops[i].offset),o.setAttribute("stop-color",t.stops[i].color);return _d(e,i),n}function Mh(e,t,n){let i;return(e=wd(e,n,"clipPath",Dh)).setAttribute("id",t.id),t.path?(i=wd(e,0,"path",Dh),i.setAttribute("d",t.path)):(i=wd(e,0,"rect",Dh),Lh(i,{x:0,y:0,width:t.width,height:t.height})),_d(e,1),n+1}function Oh(e,t,n,i,r){let o,a=e._svg;if(!a&&(o=t.ownerDocument,a=bd(o,i,Dh),e._svg=a,e.mark&&(a.__data__=e,a.__values__={fill:"default"},"g"===i))){const t=bd(o,"path",Dh);a.appendChild(t),t.__data__=e;const n=bd(o,"g",Dh);a.appendChild(n),n.__data__=e;const i=bd(o,"path",Dh);a.appendChild(i),i.__data__=e,i.__values__={fill:"default"}}return(a.ownerSVGElement!==r||function(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}let zh=null,Nh=null;const Rh={group(e,t,n){const i=zh=t.childNodes[2];Nh=i.__values__,e.foreground(Th,n,this),Nh=t.__values__,zh=t.childNodes[1],e.content(Th,n,this);const r=zh=t.childNodes[0];e.background(Th,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==Nh.events&&(Bh(i,"pointer-events",o),Bh(r,"pointer-events",o),Nh.events=o),n.strokeForeground&&n.stroke){const e=n.fill;Bh(i,"display",null),this.style(r,n),Bh(r,"stroke",null),e&&(n.fill=null),Nh=i.__values__,this.style(i,n),e&&(n.fill=e),zh=null}else Bh(i,"display","none")},image(e,t,n){!1===n.smooth?(Ph(t,"image-rendering","optimizeSpeed"),Ph(t,"image-rendering","pixelated")):Ph(t,"image-rendering",null)},text(e,t,n){const i=Kf(n);let r,o,s,l;a(i)?(o=i.map((e=>ed(n,e))),r=o.join("\n"),r!==Nh.text&&(_d(t,0),s=t.ownerDocument,l=Qf(n),o.forEach(((e,i)=>{const r=bd(s,"tspan",Dh);r.__data__=n,r.textContent=e,i&&(r.setAttribute("x",0),r.setAttribute("dy",l)),t.appendChild(r)})),Nh.text=r)):(o=ed(n,i),o!==Nh.text&&(t.textContent=o,Nh.text=o)),Bh(t,"font-family",td(n)),Bh(t,"font-size",Jf(n)+"px"),Bh(t,"font-style",n.fontStyle),Bh(t,"font-variant",n.fontVariant),Bh(t,"font-weight",n.fontWeight)}};function Th(e,t,n){t!==Nh[e]&&(n?function(e,t,n,i){null!=n?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}(zh,e,t,n):Bh(zh,e,t),Nh[e]=t)}function Ph(e,t,n){n!==Nh[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),Nh[t]=n)}function Lh(e,t){for(const n in t)Bh(e,n,t[n])}function Bh(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}function jh(){let e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}class Ih extends Dd{constructor(e){super(e),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(e){const t=xh();t.open("svg",w({},Df,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const n=this._bgcolor;return n&&"transparent"!==n&&"none"!==n&&t.open("rect",{width:this._width,height:this._height,fill:n}).close(),t.open("g",$h,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this}mark(e,t){const n=ud[t.marktype],i=n.tag,r=[mh,n.attr];e.open("g",{class:kd(t),"clip-path":t.clip?dc(this,t,t.group):null},gh(t),{"pointer-events":"g"!==i&&!1===t.interactive?"none":null});const o=o=>{const s=this.href(o);if(s&&e.open("a",s),e.open(i,this.attr(t,o,r,"g"!==i?i:null)),"text"===i){const t=Kf(o);if(a(t)){const n={x:0,dy:Qf(o)};for(let i=0;i<t.length;++i)e.open("tspan",i?n:null).text(ed(o,t[i])).close()}else e.text(ed(o,t))}else if("g"===i){const i=o.strokeForeground,r=o.fill,a=o.stroke;i&&a&&(o.stroke=null),e.open("path",this.attr(t,o,n.background,"bgrect")).close(),e.open("g",this.attr(t,o,n.content)),of(o,(t=>this.mark(e,t))),e.close(),i&&a?(r&&(o.fill=null),o.stroke=a,e.open("path",this.attr(t,o,n.foreground,"bgrect")).close(),r&&(o.fill=r)):e.open("path",this.attr(t,o,n.foreground,"bgfore")).close()}e.close(),s&&e.close()};return n.nested?t.items&&t.items.length&&o(t.items[0]):of(t,o),e.close()}href(e){const t=e.href;let n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then((e=>{e["xlink:href"]=e.href,e.href=null,(this._hrefs||(this._hrefs={}))[t]=e}))}return null}attr(e,t,n,i){const r={},o=(e,t,n,i)=>{r[i||e]=t};return Array.isArray(n)?n.forEach((e=>e(o,t,this))):n(o,t,this),i&&function(e,t,n,i,r){let o;if(null==t)return e;"bgrect"===i&&!1===n.interactive&&(e["pointer-events"]="none");if("bgfore"===i&&(!1===n.interactive&&(e["pointer-events"]="none"),e.display="none",null!==t.fill))return e;"image"===i&&!1===t.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]);"text"===i&&(e["font-family"]=td(t),e["font-size"]=Jf(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const a in kh){let n=t[a];const i=kh[a];("transparent"!==n||"fill"!==i&&"stroke"!==i)&&null!=n&&(pu(n)&&(n=mu(n,r.gradient,"")),e[i]=n)}for(const a in Eh){const e=t[a];null!=e&&(o=o||[],o.push(`${Eh[a]}: ${e};`))}o&&(e.style=o.join(" "))}(r,t,e,i,this._defs),r}defs(e){const t=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(t).length+Object.keys(n).length){e.open("defs");for(const n in t){const i=t[n],r=i.stops;"radial"===i.gradient?(e.open("pattern",{id:hu+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),e.close(),e.open("radialGradient",{id:n,fx:i.x1,fy:i.y1,fr:i.r1,cx:i.x2,cy:i.y2,r:i.r2})):e.open("linearGradient",{id:n,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2});for(let t=0;t<r.length;++t)e.open("stop",{offset:r[t].offset,"stop-color":r[t].color}).close();e.close()}for(const t in n){const i=n[t];e.open("clipPath",{id:t}),i.path?e.open("path",{d:i.path}).close():e.open("rect",{x:0,y:0,width:i.width,height:i.height}).close(),e.close()}e.close()}}}const qh={svgMarkTypes:["text"],svgOnTop:!0,debug:!1};class Uh extends Dd{constructor(e){super(e),this._svgRenderer=new Sh(e),this._canvasRenderer=new th(e)}initialize(e,t,n,i,r){this._root_el=wd(e,0,"div");const o=wd(this._root_el,0,"div"),a=wd(this._root_el,1,"div");return this._root_el.style.position="relative",qh.debug||(o.style.height="100%",a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.height="100%",a.style.width="100%"),this._svgEl=qh.svgOnTop?a:o,this._canvasEl=qh.svgOnTop?o:a,this._svgEl.style.pointerEvents="none",this._canvasRenderer.initialize(this._canvasEl,t,n,i,r),this._svgRenderer.initialize(this._svgEl,t,n,i,r),super.initialize(e,t,n,i,r)}dirty(e){return qh.svgMarkTypes.includes(e.mark.marktype)?this._svgRenderer.dirty(e):this._canvasRenderer.dirty(e),this}_render(e,t){const n=(t??["arc","area","image","line","path","rect","rule","shape","symbol","text","trail"]).filter((e=>!qh.svgMarkTypes.includes(e)));this._svgRenderer.render(e,qh.svgMarkTypes),this._canvasRenderer.render(e,n)}resize(e,t,n,i){return super.resize(e,t,n,i),this._svgRenderer.resize(e,t,n,i),this._canvasRenderer.resize(e,t,n,i),this}background(e){return qh.svgOnTop?this._canvasRenderer.background(e):this._svgRenderer.background(e),this}}class Wh extends Xd{constructor(e,t){super(e,t)}initialize(e,t,n){const i=wd(wd(e,0,"div"),qh.svgOnTop?0:1,"div");return super.initialize(i,t,n)}}const Hh="canvas",Gh="hybrid",Vh="none",Xh={Canvas:Hh,PNG:"png",SVG:"svg",Hybrid:Gh,None:Vh},Yh={};function Jh(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(Yh[e]=t,this):Yh[e]}function Qh(e,t,n){const i=[],r=(new hc).union(t),o=e.marktype;return o?Kh(e,r,n,i):"group"===o?Zh(e,r,n,i):s("Intersect scene must be mark node or group item.")}function Kh(e,t,n,i){if(function(e,t,n){return e.bounds&&t.intersects(e.bounds)&&("group"===e.marktype||!1!==e.interactive&&(!n||n(e)))}(e,t,n)){const r=e.items,o=e.marktype,a=r.length;let s=0;if("group"===o)for(;s<a;++s)Zh(r[s],t,n,i);else for(const e=ud[o].isect;s<a;++s){const n=r[s];ep(n,t,e)&&i.push(n)}}return i}function Zh(e,t,n,i){n&&n(e.mark)&&ep(e,t,ud.group.isect)&&i.push(e);const r=e.items,o=r&&r.length;if(o){const a=e.x||0,s=e.y||0;t.translate(-a,-s);for(let e=0;e<o;++e)Kh(r[e],t,n,i);t.translate(a,s)}return i}function ep(e,t,n){const i=e.bounds;return t.encloses(i)||t.intersects(i)&&n(e,t)}Yh[Hh]=Yh.png={renderer:th,headless:th,handler:Xd},Yh.svg={renderer:Sh,headless:Ih,handler:ih},Yh[Gh]={renderer:Uh,headless:Uh,handler:Wh},Yh[Vh]={};const tp=new hc;function np(e){const t=e.clip;if(o(t))t(Pc(tp.clear()));else{if(!t)return;tp.set(0,0,e.group.width,e.group.height)}e.bounds.intersect(tp)}function ip(e,t,n){return e===t||("path"===n?rp(e,t):e instanceof Date&&t instanceof Date?+e==+t:ie(e)&&ie(t)?Math.abs(e-t)<=1e-9:e&&t&&(re(e)||re(t))?function(e,t){var n,i,r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(r.sort(),o.sort(),i=r.length-1;i>=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(!ip(e[n=r[i]],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function rp(e,t){return ip($u(e),$u(t))}const op="top",ap="left",sp="right",lp="bottom",up="start",cp="middle",fp="end",dp="group",hp="axis",pp="title",mp="frame",gp="scope",yp="legend",vp="row-header",bp="row-footer",xp="row-title",wp="column-header",_p="column-footer",kp="column-title",Ep="padding",$p="fit",Ap="fit-x",Dp="fit-y",Sp="none",Fp="all",Cp="each",Mp="flush",Op="column",zp="row";function Np(e){Xr.call(this,null,e)}function Rp(e,t,n){return t(e.bounds.clear(),e,n)}i(Np,Xr,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,o=ud[r],a=o.bound;let s,l=i.bounds;if(o.nested)i.items.length&&n.dirty(i.items[0]),l=Rp(i,a),i.items.forEach((e=>{e.bounds.clear().union(l)}));else if(r===dp||e.modified())switch(t.visit(t.MOD,(e=>n.dirty(e))),l.clear(),i.items.forEach((e=>l.union(Rp(e,a)))),i.role){case hp:case yp:case pp:t.reflow()}else s=t.changed(t.REM),t.visit(t.ADD,(e=>{l.union(Rp(e,a))})),t.visit(t.MOD,(e=>{s=s||l.alignsWith(e.bounds),n.dirty(e),l.union(Rp(e,a))})),s&&(l.clear(),i.items.forEach((e=>l.union(e.bounds))));return np(i),t.modifies("bounds")}});const Tp=":vega_identifier:";function Pp(e){Xr.call(this,0,e)}function Lp(e){Xr.call(this,null,e)}function Bp(e){Xr.call(this,null,e)}Pp.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},i(Pp,Xr,{transform(e,t){const n=(r=t.dataflow)._signals[Tp]||(r._signals[Tp]=r.add(0)),i=e.as;var r;let o=n.value;return t.visit(t.ADD,(e=>e[i]=e[i]||++o)),n.set(this.value=o),t}}),i(Lp,Xr,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,function(e){const t=e.groups,n=e.parent;return t&&1===t.size?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);const i=n.marktype===dp?mc:pc;return t.visit(t.ADD,(e=>i.call(e,n))),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});const jp={parity:e=>e.filter(((e,t)=>t%2?e.opacity=0:1)),greedy:(e,t)=>{let n;return e.filter(((e,i)=>i&&Ip(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1)))}},Ip=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),qp=(e,t)=>{for(var n,i=1,r=e.length,o=e[0].bounds;i<r;o=n,++i)if(Ip(o,n=e[i].bounds,t))return!0},Up=e=>{const t=e.bounds;return t.width()>1&&t.height()>1},Wp=e=>(e.forEach((e=>e.opacity=1)),e),Hp=(e,t)=>e.reflow(t.modified()).modifies("opacity");function Gp(e){Xr.call(this,null,e)}i(Bp,Xr,{transform(e,t){const n=jp[e.method]||jp.parity,i=e.separation||0;let r,o,a=t.materialize(t.SOURCE).source;if(!a||!a.length)return;if(!e.method)return e.modified("method")&&(Wp(a),t=Hp(t,e)),t;if(a=a.filter(Up),!a.length)return;if(e.sort&&(a=a.slice().sort(e.sort)),r=Wp(a),t=Hp(t,e),r.length>=3&&qp(r,i)){do{r=n(r,i)}while(r.length>=3&&qp(r,i));r.length<3&&!R(a).opacity&&(r.length>1&&(R(r).opacity=0),R(a).opacity=1)}var s,l,u,c,f;e.boundScale&&e.boundTolerance>=0&&(s=e.boundScale,l=e.boundOrient,u=+e.boundTolerance,c=s.range(),f=new hc,l===op||l===lp?f.set(c[0],-1/0,c[1],1/0):f.set(-1/0,c[0],1/0,c[1]),f.expand(u||1),o=e=>f.encloses(e.bounds),a.forEach((e=>{o(e)||(e.opacity=0)})));const d=r[0].mark.bounds.clear();return a.forEach((e=>{e.opacity&&d.union(e.bounds)})),t}}),i(Gp,Xr,{transform(e,t){const n=t.dataflow;if(t.visit(t.ALL,(e=>n.dirty(e))),t.fields&&t.fields.zindex){const e=t.source&&t.source[0];e&&(e.mark.zdirty=!0)}}});const Vp=new hc;function Xp(e,t,n){return e[t]===n?0:(e[t]=n,1)}function Yp(e){var t=e.items[0].orient;return t===ap||t===sp}function Jp(e,t,n,i){var r,o,a=t.items[0],s=a.datum,l=null!=a.translate?a.translate:.5,u=a.orient,c=function(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}(s),f=a.range,d=a.offset,h=a.position,p=a.minExtent,m=a.maxExtent,g=s.title&&a.items[c[2]].items[0],y=a.titlePadding,v=a.bounds,b=g&&Zf(g),x=0,w=0;switch(Vp.clear().union(v),v.clear(),(r=c[0])>-1&&v.union(a.items[r].bounds),(r=c[1])>-1&&v.union(a.items[r].bounds),u){case op:x=h||0,w=-d,o=Math.max(p,Math.min(m,-v.y1)),v.add(0,-o).add(f,0),g&&Qp(e,g,o,y,b,0,-1,v);break;case ap:x=-d,w=h||0,o=Math.max(p,Math.min(m,-v.x1)),v.add(-o,0).add(0,f),g&&Qp(e,g,o,y,b,1,-1,v);break;case sp:x=n+d,w=h||0,o=Math.max(p,Math.min(m,v.x2)),v.add(0,0).add(o,f),g&&Qp(e,g,o,y,b,1,1,v);break;case lp:x=h||0,w=i+d,o=Math.max(p,Math.min(m,v.y2)),v.add(0,0).add(f,o),g&&Qp(e,g,o,y,0,0,1,v);break;default:x=a.x,w=a.y}return bc(v.translate(x,w),a),Xp(a,"x",x+l)|Xp(a,"y",w+l)&&(a.bounds=Vp,e.dirty(a),a.bounds=v,e.dirty(a)),a.mark.bounds.clear().union(v)}function Qp(e,t,n,i,r,o,a,s){const l=t.bounds;if(t.auto){const s=a*(n+r+i);let u=0,c=0;e.dirty(t),o?u=(t.x||0)-(t.x=s):c=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(l.translate(-u,-c)),e.dirty(t)}s.union(l)}const Kp=(e,t)=>Math.floor(Math.min(e,t)),Zp=(e,t)=>Math.ceil(Math.max(e,t));function em(e){return(new hc).set(0,0,e.width||0,e.height||0)}function tm(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function nm(e,t,n){const i=re(e)?e[t]:e;return null!=i?i:void 0!==n?n:0}function im(e){return e<0?Math.ceil(-e):0}function rm(e,t,n){var i,r,o,a,s,l,u,c,f,d,h,p=!n.nodirty,m=n.bounds===Mp?em:tm,g=Vp.set(0,0,0,0),y=nm(n.align,Op),v=nm(n.align,zp),b=nm(n.padding,Op),x=nm(n.padding,zp),w=n.columns||t.length,_=w<=0?1:Math.ceil(t.length/w),k=t.length,E=Array(k),$=Array(w),A=0,D=Array(k),S=Array(_),F=0,C=Array(k),M=Array(k),O=Array(k);for(r=0;r<w;++r)$[r]=0;for(r=0;r<_;++r)S[r]=0;for(r=0;r<k;++r)l=t[r],s=O[r]=m(l),l.x=l.x||0,C[r]=0,l.y=l.y||0,M[r]=0,o=r%w,a=~~(r/w),A=Math.max(A,u=Math.ceil(s.x2)),F=Math.max(F,c=Math.ceil(s.y2)),$[o]=Math.max($[o],u),S[a]=Math.max(S[a],c),E[r]=b+im(s.x1),D[r]=x+im(s.y1),p&&e.dirty(t[r]);for(r=0;r<k;++r)r%w==0&&(E[r]=0),r<w&&(D[r]=0);if(y===Cp)for(o=1;o<w;++o){for(h=0,r=o;r<k;r+=w)h<E[r]&&(h=E[r]);for(r=o;r<k;r+=w)E[r]=h+$[o-1]}else if(y===Fp){for(h=0,r=0;r<k;++r)r%w&&h<E[r]&&(h=E[r]);for(r=0;r<k;++r)r%w&&(E[r]=h+A)}else for(y=!1,o=1;o<w;++o)for(r=o;r<k;r+=w)E[r]+=$[o-1];if(v===Cp)for(a=1;a<_;++a){for(h=0,i=(r=a*w)+w;r<i;++r)h<D[r]&&(h=D[r]);for(r=a*w;r<i;++r)D[r]=h+S[a-1]}else if(v===Fp){for(h=0,r=w;r<k;++r)h<D[r]&&(h=D[r]);for(r=w;r<k;++r)D[r]=h+F}else for(v=!1,a=1;a<_;++a)for(i=(r=a*w)+w;r<i;++r)D[r]+=S[a-1];for(f=0,r=0;r<k;++r)f=E[r]+(r%w?f:0),C[r]+=f-t[r].x;for(o=0;o<w;++o)for(d=0,r=o;r<k;r+=w)d+=D[r],M[r]+=d-t[r].y;if(y&&nm(n.center,Op)&&_>1)for(r=0;r<k;++r)(f=(s=y===Fp?A:$[r%w])-O[r].x2-t[r].x-C[r])>0&&(C[r]+=f/2);if(v&&nm(n.center,zp)&&1!==w)for(r=0;r<k;++r)(d=(s=v===Fp?F:S[~~(r/w)])-O[r].y2-t[r].y-M[r])>0&&(M[r]+=d/2);for(r=0;r<k;++r)g.union(O[r].translate(C[r],M[r]));switch(f=nm(n.anchor,"x"),d=nm(n.anchor,"y"),nm(n.anchor,Op)){case fp:f-=g.width();break;case cp:f-=g.width()/2}switch(nm(n.anchor,zp)){case fp:d-=g.height();break;case cp:d-=g.height()/2}for(f=Math.round(f),d=Math.round(d),g.clear(),r=0;r<k;++r)t[r].mark.bounds.clear();for(r=0;r<k;++r)(l=t[r]).x+=C[r]+=f,l.y+=M[r]+=d,g.union(l.mark.bounds.union(l.bounds.translate(C[r],M[r]))),p&&e.dirty(l);return g}function om(e,t,n){var i,r,o,a,s,l,u,c=function(e){var t,n,i=e.items,r=i.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o<r;++o)if(n=(t=i[o]).items,t.marktype===dp)switch(t.role){case hp:case yp:case pp:break;case vp:a.rowheaders.push(...n);break;case bp:a.rowfooters.push(...n);break;case wp:a.colheaders.push(...n);break;case _p:a.colfooters.push(...n);break;case xp:a.rowtitle=n[0];break;case kp:a.coltitle=n[0];break;default:a.marks.push(...n)}return a}(t),f=c.marks,d=n.bounds===Mp?am:sm,h=n.offset,p=n.columns||f.length,m=p<=0?1:Math.ceil(f.length/p),g=m*p;const y=rm(e,f,n);y.empty()&&y.set(0,0,0,0),c.rowheaders&&(l=nm(n.headerBand,zp,null),i=lm(e,c.rowheaders,f,p,m,-nm(h,"rowHeader"),Kp,0,d,"x1",0,p,1,l)),c.colheaders&&(l=nm(n.headerBand,Op,null),r=lm(e,c.colheaders,f,p,p,-nm(h,"columnHeader"),Kp,1,d,"y1",0,1,p,l)),c.rowfooters&&(l=nm(n.footerBand,zp,null),o=lm(e,c.rowfooters,f,p,m,nm(h,"rowFooter"),Zp,0,d,"x2",p-1,p,1,l)),c.colfooters&&(l=nm(n.footerBand,Op,null),a=lm(e,c.colfooters,f,p,p,nm(h,"columnFooter"),Zp,1,d,"y2",g-p,1,p,l)),c.rowtitle&&(s=nm(n.titleAnchor,zp),u=nm(h,"rowTitle"),u=s===fp?o+u:i-u,l=nm(n.titleBand,zp,.5),um(e,c.rowtitle,u,0,y,l)),c.coltitle&&(s=nm(n.titleAnchor,Op),u=nm(h,"columnTitle"),u=s===fp?a+u:r-u,l=nm(n.titleBand,Op,.5),um(e,c.coltitle,u,1,y,l))}function am(e,t){return"x1"===t?e.x||0:"y1"===t?e.y||0:"x2"===t?(e.x||0)+(e.width||0):"y2"===t?(e.y||0)+(e.height||0):void 0}function sm(e,t){return e.bounds[t]}function lm(e,t,n,i,r,o,a,s,l,u,c,f,d,h){var p,m,g,y,v,b,x,w,_,k=n.length,E=0,$=0;if(!k)return E;for(p=c;p<k;p+=f)n[p]&&(E=a(E,l(n[p],u)));if(!t.length)return E;for(t.length>r&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),E+=o,m=0,y=t.length;m<y;++m)e.dirty(t[m]),t[m].mark.bounds.clear();for(p=c,m=0,y=t.length;m<y;++m,p+=f){for(v=(b=t[m]).mark.bounds,g=p;g>=0&&null==(x=n[g]);g-=d);s?(w=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),_=E):(w=E,_=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),v.union(b.bounds.translate(w-(b.x||0),_-(b.y||0))),b.x=w,b.y=_,e.dirty(b),$=a($,v[u])}return $}function um(e,t,n,i,r,o){if(t){e.dirty(t);var a=n,s=n;i?a=Math.round(r.x1+o*r.width()):s=Math.round(r.y1+o*r.height()),t.bounds.translate(a-(t.x||0),s-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=a,t.y=s,e.dirty(t)}}function cm(e,t,n,i,r,o,a){const s=function(e,t){const n=e[t]||{};return(t,i)=>null!=n[t]?n[t]:null!=e[t]?e[t]:i}(n,t),l=function(e,t){let n=-1/0;return e.forEach((e=>{null!=e.offset&&(n=Math.max(n,e.offset))})),n>-1/0?n:t}(e,s("offset",0)),u=s("anchor",up),c=u===fp?1:u===cp?.5:0,f={align:Cp,bounds:s("bounds",Mp),columns:"vertical"===s("direction")?1:e.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(t){case ap:f.anchor={x:Math.floor(i.x1)-l,column:fp,y:c*(a||i.height()+2*i.y1),row:u};break;case sp:f.anchor={x:Math.ceil(i.x2)+l,y:c*(a||i.height()+2*i.y1),row:u};break;case op:f.anchor={y:Math.floor(r.y1)-l,row:fp,x:c*(o||r.width()+2*r.x1),column:u};break;case lp:f.anchor={y:Math.ceil(r.y2)+l,x:c*(o||r.width()+2*r.x1),column:u};break;case"top-left":f.anchor={x:l,y:l};break;case"top-right":f.anchor={x:o-l,y:l,column:fp};break;case"bottom-left":f.anchor={x:l,y:a-l,row:fp};break;case"bottom-right":f.anchor={x:o-l,y:a-l,column:fp,row:fp}}return f}function fm(e,t){var n,i,r=t.items[0],o=r.datum,a=r.orient,s=r.bounds,l=r.x,u=r.y;return r._bounds?r._bounds.clear().union(s):r._bounds=s.clone(),s.clear(),function(e,t,n){var i=t.padding,r=i-n.x,o=i-n.y;if(t.datum.title){var a=t.items[1].items[0],s=a.anchor,l=t.titlePadding||0,u=i-a.x,c=i-a.y;switch(a.orient){case ap:r+=Math.ceil(a.bounds.width())+l;break;case sp:case lp:break;default:o+=a.bounds.height()+l}switch((r||o)&&hm(e,n,r,o),a.orient){case ap:c+=dm(t,n,a,s,1,1);break;case sp:u+=dm(t,n,a,fp,0,0)+l,c+=dm(t,n,a,s,1,1);break;case lp:u+=dm(t,n,a,s,0,0),c+=dm(t,n,a,fp,-1,0,1)+l;break;default:u+=dm(t,n,a,s,0,0)}(u||c)&&hm(e,a,u,c),(u=Math.round(a.bounds.x1-i))<0&&(hm(e,n,-u,0),hm(e,a,-u,0))}else(r||o)&&hm(e,n,r,o)}(e,r,r.items[0].items[0]),s=function(e,t){return e.items.forEach((e=>t.union(e.bounds))),t.x1=e.padding,t.y1=e.padding,t}(r,s),n=2*r.padding,i=2*r.padding,s.empty()||(n=Math.ceil(s.width()+n),i=Math.ceil(s.height()+i)),"symbol"===o.type&&function(e){const t=e.reduce(((e,t)=>(e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e)),{});e.forEach((e=>{e.width=t[e.column],e.height=e.bounds.y2-e.y}))}(r.items[0].items[0].items[0].items),a!==Sp&&(r.x=l=0,r.y=u=0),r.width=n,r.height=i,bc(s.set(l,u,l+n,u+i),r),r.mark.bounds.clear().union(s),r}function dm(e,t,n,i,r,o,a){const s="symbol"!==e.datum.type,l=n.datum.vgrad,u=(!s||!o&&l||a?t:t.items[0]).bounds[r?"y2":"x2"]-e.padding,c=l&&o?u:0,f=l&&o?0:u,d=r<=0?0:Zf(n);return Math.round(i===up?c:i===fp?f-d:.5*(u-d))}function hm(e,t,n,i){t.x+=n,t.y+=i,t.bounds.translate(n,i),t.mark.bounds.translate(n,i),e.dirty(t)}function pm(e){Xr.call(this,null,e)}i(pm,Xr,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach((t=>{e.layout&&om(n,t,e.layout),function(e,t,n){var i,r,o,a,s,l=t.items,u=Math.max(0,t.width||0),c=Math.max(0,t.height||0),f=(new hc).set(0,0,u,c),d=f.clone(),h=f.clone(),p=[];for(a=0,s=l.length;a<s;++a)switch((r=l[a]).role){case hp:(Yp(r)?d:h).union(Jp(e,r,u,c));break;case pp:i=r;break;case yp:p.push(fm(e,r));break;case mp:case gp:case vp:case bp:case xp:case wp:case _p:case kp:d.union(r.bounds),h.union(r.bounds);break;default:f.union(r.bounds)}if(p.length){const t={};p.forEach((e=>{(o=e.orient||sp)!==Sp&&(t[o]||(t[o]=[])).push(e)}));for(const i in t){const r=t[i];rm(e,r,cm(r,i,n.legends,d,h,u,c))}p.forEach((t=>{const i=t.bounds;if(i.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=i,e.dirty(t)),!n.autosize||n.autosize.type!==$p&&n.autosize.type!==Ap&&n.autosize.type!==Dp)f.union(i);else switch(t.orient){case ap:case sp:f.add(i.x1,0).add(i.x2,0);break;case op:case lp:f.add(0,i.y1).add(0,i.y2)}}))}f.union(d).union(h),i&&f.union(function(e,t,n,i,r){var o,a=t.items[0],s=a.frame,l=a.orient,u=a.anchor,c=a.offset,f=a.padding,d=a.items[0].items[0],h=a.items[1]&&a.items[1].items[0],p=l===ap||l===sp?i:n,m=0,g=0,y=0,v=0,b=0;if(s!==dp?l===ap?(m=r.y2,p=r.y1):l===sp?(m=r.y1,p=r.y2):(m=r.x1,p=r.x2):l===ap&&(m=i,p=0),o=u===up?m:u===fp?p:(m+p)/2,h&&h.text){switch(l){case op:case lp:b=d.bounds.height()+f;break;case ap:v=d.bounds.width()+f;break;case sp:v=-d.bounds.width()-f}Vp.clear().union(h.bounds),Vp.translate(v-(h.x||0),b-(h.y||0)),Xp(h,"x",v)|Xp(h,"y",b)&&(e.dirty(h),h.bounds.clear().union(Vp),h.mark.bounds.clear().union(Vp),e.dirty(h)),Vp.clear().union(h.bounds)}else Vp.clear();switch(Vp.union(d.bounds),l){case op:g=o,y=r.y1-Vp.height()-c;break;case ap:g=r.x1-Vp.width()-c,y=o;break;case sp:g=r.x2+Vp.width()+c,y=o;break;case lp:g=o,y=r.y2+c;break;default:g=a.x,y=a.y}return Xp(a,"x",g)|Xp(a,"y",y)&&(Vp.translate(g,y),e.dirty(a),a.bounds.clear().union(Vp),t.bounds.clear().union(Vp),e.dirty(a)),a.bounds}(e,i,u,c,f));t.clip&&f.set(0,0,t.width||0,t.height||0);!function(e,t,n,i){const r=i.autosize||{},o=r.type;if(e._autosize<1||!o)return;let a=e._width,s=e._height,l=Math.max(0,t.width||0),u=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,t.height||0),f=Math.max(0,Math.ceil(-n.y1));const d=Math.max(0,Math.ceil(n.x2-l)),h=Math.max(0,Math.ceil(n.y2-c));if(r.contains===Ep){const t=e.padding();a-=t.left+t.right,s-=t.top+t.bottom}o===Sp?(u=0,f=0,l=a,c=s):o===$p?(l=Math.max(0,a-u-d),c=Math.max(0,s-f-h)):o===Ap?(l=Math.max(0,a-u-d),s=c+f+h):o===Dp?(a=l+u+d,c=Math.max(0,s-f-h)):"pad"===o&&(a=l+u+d,s=c+f+h);e._resizeView(a,s,l,c,[u,f],r.resize)}(e,t,f,n)}(n,t,e)})),(i=e.mark.group)&&"legend-entry"!==i.mark.role?t.reflow():t;var i}});const mm=Object.freeze(Object.defineProperty({__proto__:null,bound:Np,identifier:Pp,mark:Lp,overlap:Bp,render:Gp,viewlayout:pm},Symbol.toStringTag,{value:"Module"}));function gm(e){Xr.call(this,null,e)}function ym(e){Xr.call(this,null,e)}function vm(){return yr({})}function bm(e){Xr.call(this,null,e)}function xm(e){Xr.call(this,[],e)}i(gm,Xr,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,o=e.scale,a=Jl(o,null==e.count?e.values?e.values.length:10:e.count,e.minstep),s=e.format||Zl(n,o,a,e.formatSpecifier,e.formatType,!!e.values),l=e.values?Ql(o,e.values,a):Kl(o,a);return r&&(i.rem=r),r=l.map(((e,t)=>yr({index:t/(l.length-1||1),value:e,label:s(e)}))),e.extra&&r.length&&r.push(yr({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}}),i(ym,Xr,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||vm,o=e.key||mr,l=this.value;return a(i.encode)&&(i.encode=null),l&&(e.modified("key")||t.modified(o))&&s("DataJoin does not support modified key function or fields."),l||(t=t.addAll(),this.value=l=function(e){const t=q().test((e=>e.exit));return t.lookup=n=>t.get(e(n)),t}(o)),t.visit(t.ADD,(e=>{const t=o(e);let n=l.get(t);n?n.exit?(l.empty--,i.add.push(n)):i.mod.push(n):(n=r(e),l.set(t,n),i.add.push(n)),n.datum=e,n.exit=!1})),t.visit(t.MOD,(e=>{const t=o(e),n=l.get(t);n&&(n.datum=e,i.mod.push(n))})),t.visit(t.REM,(e=>{const t=o(e),n=l.get(t);e!==n.datum||n.exit||(i.rem.push(n),n.exit=!0,++l.empty)})),t.changed(t.ADD_MOD)&&i.modifies("datum"),(t.clean()||e.clean&&l.empty>n.cleanThreshold)&&n.runAfter(l.clean),i}}),i(bm,Xr,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,o=t.encode;if(a(o)){if(!n.changed()&&!o.every((e=>r[e])))return t.StopPropagation;o=o[0],n.encode=null}var s="enter"===o,l=r.update||se,u=r.enter||se,c=r.exit||se,f=(o&&!s?r[o]:l)||se;if(t.changed(t.ADD)&&(t.visit(t.ADD,(t=>{u(t,e),l(t,e)})),n.modifies(u.output),n.modifies(l.output),f!==se&&f!==l&&(t.visit(t.ADD,(t=>{f(t,e)})),n.modifies(f.output))),t.changed(t.REM)&&c!==se&&(t.visit(t.REM,(t=>{c(t,e)})),n.modifies(c.output)),s||f!==se){const r=t.MOD|(e.modified()?t.REFLOW:0);s?(t.visit(r,(t=>{const r=u(t,e)||i;(f(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(u.output)):t.visit(r,(t=>{(f(t,e)||i)&&n.mod.push(t)})),n.mod.length&&n.modifies(f.output)}return n.changed()?n:t.StopPropagation}}),i(xm,Xr,{transform(e,t){if(null!=this.value&&!e.modified())return t.StopPropagation;var n,i,r,a,s,l=t.dataflow.locale(),u=t.fork(t.NO_SOURCE|t.NO_FIELDS),c=this.value,f=e.type||Gl,d=e.scale,h=+e.limit,p=Jl(d,null==e.count?5:e.count,e.minstep),m=!!e.values||f===Gl,y=e.format||ru(l,d,p,f,e.formatSpecifier,e.formatType,m),v=e.values||iu(d,p);return c&&(u.rem=c),f===Gl?(h&&v.length>h?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),c=v.slice(0,h-1),s=!0):c=v,o(r=e.size)?(e.values||0!==d(c[0])||(c=c.slice(1)),a=c.reduce(((t,n)=>Math.max(t,r(n,e))),0)):r=g(a=r||8),c=c.map(((t,n)=>yr({index:n,label:y(t,n,c),value:t,offset:a,size:r(t,e)}))),s&&(s=v[c.length],c.push(yr({index:c.length,label:`…${v.length-c.length} entries`,value:s,offset:a,size:r(s,e)})))):"gradient"===f?(n=d.domain(),i=jl(d,n[0],R(n)),v.length<3&&!e.values&&n[0]!==R(n)&&(v=[n[0],R(n)]),c=v.map(((e,t)=>yr({index:t,label:y(e,t,v),value:e,perc:i(e)})))):(r=v.length-1,i=function(e){const t=e.domain(),n=t.length-1;let i=+t[0],r=+R(t),o=r-i;if(e.type===cl){const e=n?o/n:.1;i-=e,r+=e,o=r-i}return e=>(e-i)/o}(d),c=v.map(((e,t)=>yr({index:t,label:y(e,t,v),value:e,perc:t?i(e):0,perc2:t===r?1:i(v[t+1])})))),u.source=c,u.add=c,this.value=c,u}});const wm=e=>e.source.x,_m=e=>e.source.y,km=e=>e.target.x,Em=e=>e.target.y;function $m(e){Xr.call(this,{},e)}$m.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},i($m,Xr,{transform(e,t){var n=e.sourceX||wm,i=e.sourceY||_m,r=e.targetX||km,o=e.targetY||Em,a=e.as||"path",l=e.orient||"vertical",u=e.shape||"line",c=Fm.get(u+"-"+l)||Fm.get(u);return c||s("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(e=>{e[a]=c(n(e),i(e),r(e),o(e))})),t.reflow(e.modified()).modifies(a)}});const Am=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,Dm=(e,t,n,i)=>{var r=n-e,o=i-t,a=Math.hypot(r,o)/2;return"M"+e+","+t+"A"+a+","+a+" "+180*Math.atan2(o,r)/Math.PI+" 0 1 "+n+","+i},Sm=(e,t,n,i)=>{const r=n-e,o=i-t,a=.2*(r+o),s=.2*(o-r);return"M"+e+","+t+"C"+(e+a)+","+(t+s)+" "+(n+s)+","+(i-a)+" "+n+","+i},Fm=q({line:Am,"line-radial":(e,t,n,i)=>Am(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),arc:Dm,"arc-radial":(e,t,n,i)=>Dm(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),curve:Sm,"curve-radial":(e,t,n,i)=>Sm(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),"orthogonal-horizontal":(e,t,n,i)=>"M"+e+","+t+"V"+i+"H"+n,"orthogonal-vertical":(e,t,n,i)=>"M"+e+","+t+"H"+n+"V"+i,"orthogonal-radial":(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n);return"M"+t*r+","+t*o+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*a+","+t*s+"L"+i*a+","+i*s},"diagonal-horizontal":(e,t,n,i)=>{const r=(e+n)/2;return"M"+e+","+t+"C"+r+","+t+" "+r+","+i+" "+n+","+i},"diagonal-vertical":(e,t,n,i)=>{const r=(t+i)/2;return"M"+e+","+t+"C"+e+","+r+" "+n+","+r+" "+n+","+i},"diagonal-radial":(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n),l=(t+i)/2;return"M"+t*r+","+t*o+"C"+l*r+","+l*o+" "+l*a+","+l*s+" "+i*a+","+i*s}});function Cm(e){Xr.call(this,null,e)}Cm.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},i(Cm,Xr,{transform(e,t){var n,i,r,o=e.as||["startAngle","endAngle"],a=o[0],s=o[1],l=e.field||le,u=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,d=f.map(l),h=d.length,p=u,m=(c-u)/di(d),g=Yt(h);for(e.sort&&g.sort(((e,t)=>d[e]-d[t])),n=0;n<h;++n)r=d[g[n]],(i=f[g[n]])[a]=p,i[s]=p+=r*m;return this.value=d,t.reflow(e.modified()).modifies(o)}});function Mm(e){return Cl(e)&&e!==al}const Om=ne(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function zm(e){Xr.call(this,null,e),this.modified(!0)}function Nm(e,t,n){zl(e)&&(Math.abs(t.reduce(((e,t)=>e+(t<0?-1:t>0?1:0)),0))!==t.length&&n.warn("Log scale domain includes zero: "+he(t)));return t}function Rm(e,t,n){return o(e)&&(t||n)?Pl(e,Tm(t||[0,1],n)):e}function Tm(e,t){return t?e.slice().reverse():e}function Pm(e){Xr.call(this,null,e)}i(zm,Xr,{transform(e,t){var n=t.dataflow,i=this.value,r=function(e){var t,n=e.type,i="";if(n===al)return al+"-"+Zs;(function(e){const t=e.type;return Cl(t)&&t!==rl&&t!==ol&&(e.scheme||e.range&&e.range.length&&e.range.every(oe))})(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?al+"-":3===t?sl+"-":"");return(i+n||Zs).toLowerCase()}(e);for(r in i&&r===i.type||(this.value=i=Dl(r)()),e)if(!Om[r]){if("padding"===r&&Mm(i.type))continue;o(i[r])?i[r](e[r]):n.warn("Unsupported scale property: "+r)}return function(e,t,n){var i=e.type,r=t.round||!1,l=t.range;if(null!=t.rangeStep)l=function(e,t,n){e!==hl&&e!==dl&&s("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,r=e===dl?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*Ks(n,r,i)]}(i,t,n);else if(t.scheme&&(l=function(e,t,n){var i,r=t.schemeExtent;a(t.scheme)?i=Ll(t.scheme,t.interpolate,t.interpolateGamma):(i=Hl(t.scheme.toLowerCase()))||s(`Unrecognized scheme name: ${t.scheme}`);return n=e===cl?n+1:e===pl?n-1:e===ll||e===ul?+t.schemeCount||5:n,Nl(e)?Rm(i,r,t.reverse):o(i)?Bl(Rm(i,r),n):e===fl?i:i.slice(0,n)}(i,t,n),o(l))){if(e.interpolator)return e.interpolator(l);s(`Scale type ${i} does not support interpolating color schemes.`)}if(l&&Nl(i))return e.interpolator(Ll(Tm(l,t.reverse),t.interpolate,t.interpolateGamma));l&&t.interpolate&&e.interpolate?e.interpolate(Il(t.interpolate,t.interpolateGamma)):o(e.round)?e.round(r):o(e.rangeRound)&&e.interpolate(r?Bt:Nt);l&&e.range(Tm(l,t.reverse))}(i,e,function(e,t,n){let i=t.bins;if(i&&!a(i)){const t=e.domain(),n=t[0],r=R(t),o=i.step;let a=null==i.start?n:i.start,l=null==i.stop?r:i.stop;o||s("Scale bins parameter missing step property."),a<n&&(a=o*Math.ceil(n/o)),l>r&&(l=o*Math.floor(r/o)),i=Yt(a,l+o/2,o)}i?e.bins=i:e.bins&&delete e.bins;e.type===pl&&(i?t.domain||t.domainRaw||(e.domain(i),n=i.length):e.bins=e.domain());return n}(i,e,function(e,t,n){const i=function(e,t,n){return t?(e.domain(Nm(e.type,t,n)),t.length):-1}(e,t.domainRaw,n);if(i>-1)return i;var r,o,a=t.domain,s=e.type,l=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===Zs||t===tl||t===nl)}(e);if(!a)return 0;if((l||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(r=(a=a.slice()).length-1||1,l&&(a[0]>0&&(a[0]=0),a[r]<0&&(a[r]=0)),null!=t.domainMin&&(a[0]=t.domainMin),null!=t.domainMax&&(a[r]=t.domainMax),null!=t.domainMid)){const e=(o=t.domainMid)>a[r]?r+1:o<a[0]?0:r;e!==r&&n.warn("Scale domainMid exceeds domain min or max.",o),a.splice(e,0,o)}Mm(s)&&t.padding&&a[0]!==R(a)&&(a=function(e,t,n,i,r,o){var a=Math.abs(R(n)-n[0]),s=a/(a-2*i),l=e===el?ue(t,null,s):e===nl?ce(t,null,s,.5):e===tl?ce(t,null,s,r||1):e===il?fe(t,null,s,o||1):de(t,null,s);return t=t.slice(),t[0]=l[0],t[t.length-1]=l[1],t}(s,a,t.range,t.padding,t.exponent,t.constant));e.domain(Nm(s,a,n)),s===fl&&e.unknown(t.domainImplicit?An:void 0);t.nice&&e.nice&&e.nice(!0!==t.nice&&Jl(e,t.nice)||null);return a.length}(i,e,n))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),i(Pm,Xr,{transform(e,t){const n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(wr(e.sort)),this.modified(n),t}});const Lm="zero",Bm="center",jm="normalize",Im=["y0","y1"];function qm(e){Xr.call(this,null,e)}function Um(e,t,n,i,r){for(var o,a=(t-e.sum)/2,s=e.length,l=0;l<s;++l)(o=e[l])[i]=a,o[r]=a+=Math.abs(n(o))}function Wm(e,t,n,i,r){for(var o,a=1/e.sum,s=0,l=e.length,u=0,c=0;u<l;++u)(o=e[u])[i]=s,o[r]=s=a*(c+=Math.abs(n(o)))}function Hm(e,t,n,i,r){for(var o,a,s=0,l=0,u=e.length,c=0;c<u;++c)(o=+n(a=e[c]))<0?(a[i]=l,a[r]=l+=o):(a[i]=s,a[r]=s+=o)}qm.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:Lm,values:[Lm,Bm,jm]},{name:"as",type:"string",array:!0,length:2,default:Im}]},i(qm,Xr,{transform(e,t){var n,i,r,o,a=e.as||Im,s=a[0],l=a[1],u=wr(e.sort),c=e.field||le,f=e.offset===Bm?Um:e.offset===jm?Wm:Hm;for(n=function(e,t,n,i){var r,o,a,s,l,u,c,f,d,h=[],p=e=>e(l);if(null==t)h.push(e.slice());else for(r={},o=0,a=e.length;o<a;++o)l=e[o],(c=r[u=t.map(p)])||(r[u]=c=[],h.push(c)),c.push(l);for(u=0,d=0,s=h.length;u<s;++u){for(o=0,f=0,a=(c=h[u]).length;o<a;++o)f+=Math.abs(i(c[o]));c.sum=f,f>d&&(d=f),n&&c.sort(n)}return h.max=d,h}(t.source,e.groupby,u,c),i=0,r=n.length,o=n.max;i<r;++i)f(n[i],o,c,s,l);return t.reflow(e.modified()).modifies(a)}});const Gm=Object.freeze(Object.defineProperty({__proto__:null,axisticks:gm,datajoin:ym,encode:bm,legendentries:xm,linkpath:$m,pie:Cm,scale:zm,sortitems:Pm,stack:qm},Symbol.toStringTag,{value:"Module"}));var Vm=1e-6,Xm=1e-12,Ym=Math.PI,Jm=Ym/2,Qm=Ym/4,Km=2*Ym,Zm=180/Ym,eg=Ym/180,tg=Math.abs,ng=Math.atan,ig=Math.atan2,rg=Math.cos,og=Math.ceil,ag=Math.exp,sg=Math.hypot,lg=Math.log,ug=Math.pow,cg=Math.sin,fg=Math.sign||function(e){return e>0?1:e<0?-1:0},dg=Math.sqrt,hg=Math.tan;function pg(e){return e>1?0:e<-1?Ym:Math.acos(e)}function mg(e){return e>1?Jm:e<-1?-Jm:Math.asin(e)}function gg(){}function yg(e,t){e&&bg.hasOwnProperty(e.type)&&bg[e.type](e,t)}var vg={Feature:function(e,t){yg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++i<r;)yg(n[i].geometry,t)}},bg={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)e=n[i],t.point(e[0],e[1],e[2])},LineString:function(e,t){xg(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)xg(n[i],t,0)},Polygon:function(e,t){wg(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)wg(n[i],t)},GeometryCollection:function(e,t){for(var n=e.geometries,i=-1,r=n.length;++i<r;)yg(n[i],t)}};function xg(e,t,n){var i,r=-1,o=e.length-n;for(t.lineStart();++r<o;)i=e[r],t.point(i[0],i[1],i[2]);t.lineEnd()}function wg(e,t){var n=-1,i=e.length;for(t.polygonStart();++n<i;)xg(e[n],t,1);t.polygonEnd()}function _g(e,t){e&&vg.hasOwnProperty(e.type)?vg[e.type](e,t):yg(e,t)}var kg,Eg,$g,Ag,Dg,Sg,Fg,Cg,Mg,Og,zg,Ng,Rg,Tg,Pg,Lg,Bg=new ri,jg=new ri,Ig={point:gg,lineStart:gg,lineEnd:gg,polygonStart:function(){Bg=new ri,Ig.lineStart=qg,Ig.lineEnd=Ug},polygonEnd:function(){var e=+Bg;jg.add(e<0?Km+e:e),this.lineStart=this.lineEnd=this.point=gg},sphere:function(){jg.add(Km)}};function qg(){Ig.point=Wg}function Ug(){Hg(kg,Eg)}function Wg(e,t){Ig.point=Hg,kg=e,Eg=t,$g=e*=eg,Ag=rg(t=(t*=eg)/2+Qm),Dg=cg(t)}function Hg(e,t){var n=(e*=eg)-$g,i=n>=0?1:-1,r=i*n,o=rg(t=(t*=eg)/2+Qm),a=cg(t),s=Dg*a,l=Ag*o+s*rg(r),u=s*i*cg(r);Bg.add(ig(u,l)),$g=e,Ag=o,Dg=a}function Gg(e){return[ig(e[1],e[0]),mg(e[2])]}function Vg(e){var t=e[0],n=e[1],i=rg(n);return[i*rg(t),i*cg(t),cg(n)]}function Xg(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Yg(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Jg(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Qg(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Kg(e){var t=dg(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Zg,ey,ty,ny,iy,ry,oy,ay,sy,ly,uy,cy,fy,dy,hy,py,my={point:gy,lineStart:vy,lineEnd:by,polygonStart:function(){my.point=xy,my.lineStart=wy,my.lineEnd=_y,Tg=new ri,Ig.polygonStart()},polygonEnd:function(){Ig.polygonEnd(),my.point=gy,my.lineStart=vy,my.lineEnd=by,Bg<0?(Sg=-(Cg=180),Fg=-(Mg=90)):Tg>Vm?Mg=90:Tg<-1e-6&&(Fg=-90),Lg[0]=Sg,Lg[1]=Cg},sphere:function(){Sg=-(Cg=180),Fg=-(Mg=90)}};function gy(e,t){Pg.push(Lg=[Sg=e,Cg=e]),t<Fg&&(Fg=t),t>Mg&&(Mg=t)}function yy(e,t){var n=Vg([e*eg,t*eg]);if(Rg){var i=Yg(Rg,n),r=Yg([i[1],-i[0],0],i);Kg(r),r=Gg(r);var o,a=e-Og,s=a>0?1:-1,l=r[0]*Zm*s,u=tg(a)>180;u^(s*Og<l&&l<s*e)?(o=r[1]*Zm)>Mg&&(Mg=o):u^(s*Og<(l=(l+360)%360-180)&&l<s*e)?(o=-r[1]*Zm)<Fg&&(Fg=o):(t<Fg&&(Fg=t),t>Mg&&(Mg=t)),u?e<Og?ky(Sg,e)>ky(Sg,Cg)&&(Cg=e):ky(e,Cg)>ky(Sg,Cg)&&(Sg=e):Cg>=Sg?(e<Sg&&(Sg=e),e>Cg&&(Cg=e)):e>Og?ky(Sg,e)>ky(Sg,Cg)&&(Cg=e):ky(e,Cg)>ky(Sg,Cg)&&(Sg=e)}else Pg.push(Lg=[Sg=e,Cg=e]);t<Fg&&(Fg=t),t>Mg&&(Mg=t),Rg=n,Og=e}function vy(){my.point=yy}function by(){Lg[0]=Sg,Lg[1]=Cg,my.point=gy,Rg=null}function xy(e,t){if(Rg){var n=e-Og;Tg.add(tg(n)>180?n+(n>0?360:-360):n)}else zg=e,Ng=t;Ig.point(e,t),yy(e,t)}function wy(){Ig.lineStart()}function _y(){xy(zg,Ng),Ig.lineEnd(),tg(Tg)>Vm&&(Sg=-(Cg=180)),Lg[0]=Sg,Lg[1]=Cg,Rg=null}function ky(e,t){return(t-=e)<0?t+360:t}function Ey(e,t){return e[0]-t[0]}function $y(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var Ay={sphere:gg,point:Dy,lineStart:Fy,lineEnd:Oy,polygonStart:function(){Ay.lineStart=zy,Ay.lineEnd=Ny},polygonEnd:function(){Ay.lineStart=Fy,Ay.lineEnd=Oy}};function Dy(e,t){e*=eg;var n=rg(t*=eg);Sy(n*rg(e),n*cg(e),cg(t))}function Sy(e,t,n){++Zg,ty+=(e-ty)/Zg,ny+=(t-ny)/Zg,iy+=(n-iy)/Zg}function Fy(){Ay.point=Cy}function Cy(e,t){e*=eg;var n=rg(t*=eg);dy=n*rg(e),hy=n*cg(e),py=cg(t),Ay.point=My,Sy(dy,hy,py)}function My(e,t){e*=eg;var n=rg(t*=eg),i=n*rg(e),r=n*cg(e),o=cg(t),a=ig(dg((a=hy*o-py*r)*a+(a=py*i-dy*o)*a+(a=dy*r-hy*i)*a),dy*i+hy*r+py*o);ey+=a,ry+=a*(dy+(dy=i)),oy+=a*(hy+(hy=r)),ay+=a*(py+(py=o)),Sy(dy,hy,py)}function Oy(){Ay.point=Dy}function zy(){Ay.point=Ry}function Ny(){Ty(cy,fy),Ay.point=Dy}function Ry(e,t){cy=e,fy=t,e*=eg,t*=eg,Ay.point=Ty;var n=rg(t);dy=n*rg(e),hy=n*cg(e),py=cg(t),Sy(dy,hy,py)}function Ty(e,t){e*=eg;var n=rg(t*=eg),i=n*rg(e),r=n*cg(e),o=cg(t),a=hy*o-py*r,s=py*i-dy*o,l=dy*r-hy*i,u=sg(a,s,l),c=mg(u),f=u&&-c/u;sy.add(f*a),ly.add(f*s),uy.add(f*l),ey+=c,ry+=c*(dy+(dy=i)),oy+=c*(hy+(hy=r)),ay+=c*(py+(py=o)),Sy(dy,hy,py)}function Py(e,t){function n(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,i){return(n=t.invert(n,i))&&e.invert(n[0],n[1])}),n}function Ly(e,t){return tg(e)>Ym&&(e-=Math.round(e/Km)*Km),[e,t]}function By(e,t,n){return(e%=Km)?t||n?Py(Iy(e),qy(t,n)):Iy(e):t||n?qy(t,n):Ly}function jy(e){return function(t,n){return tg(t+=e)>Ym&&(t-=Math.round(t/Km)*Km),[t,n]}}function Iy(e){var t=jy(e);return t.invert=jy(-e),t}function qy(e,t){var n=rg(e),i=cg(e),r=rg(t),o=cg(t);function a(e,t){var a=rg(t),s=rg(e)*a,l=cg(e)*a,u=cg(t),c=u*n+s*i;return[ig(l*r-c*o,s*n-u*i),mg(c*r+l*o)]}return a.invert=function(e,t){var a=rg(t),s=rg(e)*a,l=cg(e)*a,u=cg(t),c=u*r-l*o;return[ig(l*r+u*o,s*n+c*i),mg(c*n-s*i)]},a}function Uy(e,t){(t=Vg(t))[0]-=e,Kg(t);var n=pg(-t[1]);return((-t[2]<0?-n:n)+Km-Vm)%Km}function Wy(){var e,t=[];return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){t.push(e=[])},lineEnd:gg,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Hy(e,t){return tg(e[0]-t[0])<Vm&&tg(e[1]-t[1])<Vm}function Gy(e,t,n,i){this.x=e,this.z=t,this.o=n,this.e=i,this.v=!1,this.n=this.p=null}function Vy(e,t,n,i,r){var o,a,s=[],l=[];if(e.forEach((function(e){if(!((t=e.length-1)<=0)){var t,n,i=e[0],a=e[t];if(Hy(i,a)){if(!i[2]&&!a[2]){for(r.lineStart(),o=0;o<t;++o)r.point((i=e[o])[0],i[1]);return void r.lineEnd()}a[0]+=2e-6}s.push(n=new Gy(i,e,null,!0)),l.push(n.o=new Gy(i,null,n,!1)),s.push(n=new Gy(a,e,null,!1)),l.push(n.o=new Gy(a,null,n,!0))}})),s.length){for(l.sort(t),Xy(s),Xy(l),o=0,a=l.length;o<a;++o)l[o].e=n=!n;for(var u,c,f=s[0];;){for(var d=f,h=!0;d.v;)if((d=d.n)===f)return;u=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(o=0,a=u.length;o<a;++o)r.point((c=u[o])[0],c[1]);else i(d.x,d.n.x,1,r);d=d.n}else{if(h)for(u=d.p.z,o=u.length-1;o>=0;--o)r.point((c=u[o])[0],c[1]);else i(d.x,d.p.x,-1,r);d=d.p}u=(d=d.o).z,h=!h}while(!d.v);r.lineEnd()}}}function Xy(e){if(t=e.length){for(var t,n,i=0,r=e[0];++i<t;)r.n=n=e[i],n.p=r,r=n;r.n=n=e[0],n.p=r}}function Yy(e){return tg(e[0])<=Ym?e[0]:fg(e[0])*((tg(e[0])+Ym)%Km-Ym)}function Jy(e,t,n,i){return function(r){var o,a,s,l=t(r),u=Wy(),c=t(u),f=!1,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=y,d.lineStart=v,d.lineEnd=b,a=[],o=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,a=fi(a);var e=function(e,t){var n=Yy(t),i=t[1],r=cg(i),o=[cg(n),-rg(n),0],a=0,s=0,l=new ri;1===r?i=Jm+Vm:-1===r&&(i=-Jm-Vm);for(var u=0,c=e.length;u<c;++u)if(d=(f=e[u]).length)for(var f,d,h=f[d-1],p=Yy(h),m=h[1]/2+Qm,g=cg(m),y=rg(m),v=0;v<d;++v,p=x,g=_,y=k,h=b){var b=f[v],x=Yy(b),w=b[1]/2+Qm,_=cg(w),k=rg(w),E=x-p,$=E>=0?1:-1,A=$*E,D=A>Ym,S=g*_;if(l.add(ig(S*$*cg(A),y*k+S*rg(A))),a+=D?E+$*Km:E,D^p>=n^x>=n){var F=Yg(Vg(h),Vg(b));Kg(F);var C=Yg(o,F);Kg(C);var M=(D^E>=0?-1:1)*mg(C[2]);(i>M||i===M&&(F[0]||F[1]))&&(s+=D^E>=0?1:-1)}}return(a<-1e-6||a<Vm&&l<-1e-12)^1&s}(o,i);a.length?(f||(r.polygonStart(),f=!0),Vy(a,Ky,e,n,r)):e&&(f||(r.polygonStart(),f=!0),r.lineStart(),n(null,null,1,r),r.lineEnd()),f&&(r.polygonEnd(),f=!1),a=o=null},sphere:function(){r.polygonStart(),r.lineStart(),n(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function h(t,n){e(t,n)&&r.point(t,n)}function p(e,t){l.point(e,t)}function m(){d.point=p,l.lineStart()}function g(){d.point=h,l.lineEnd()}function y(e,t){s.push([e,t]),c.point(e,t)}function v(){c.lineStart(),s=[]}function b(){y(s[0][0],s[0][1]),c.lineEnd();var e,t,n,i,l=c.clean(),d=u.result(),h=d.length;if(s.pop(),o.push(s),s=null,h)if(1&l){if((t=(n=d[0]).length-1)>0){for(f||(r.polygonStart(),f=!0),r.lineStart(),e=0;e<t;++e)r.point((i=n[e])[0],i[1]);r.lineEnd()}}else h>1&&2&l&&d.push(d.pop().concat(d.shift())),a.push(d.filter(Qy))}return d}}function Qy(e){return e.length>1}function Ky(e,t){return((e=e.x)[0]<0?e[1]-Jm-Vm:Jm-e[1])-((t=t.x)[0]<0?t[1]-Jm-Vm:Jm-t[1])}Ly.invert=Ly;const Zy=Jy((function(){return!0}),(function(e){var t,n=NaN,i=NaN,r=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?Ym:-Ym,l=tg(o-n);tg(l-Ym)<Vm?(e.point(n,i=(i+a)/2>0?Jm:-Jm),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),e.point(o,i),t=0):r!==s&&l>=Ym&&(tg(n-r)<Vm&&(n-=r*Vm),tg(o-s)<Vm&&(o-=s*Vm),i=function(e,t,n,i){var r,o,a=cg(e-n);return tg(a)>Vm?ng((cg(t)*(o=rg(i))*cg(n)-cg(i)*(r=rg(t))*cg(e))/(r*o*a)):(t+i)/2}(n,i,o,a),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),t=0),e.point(n=o,i=a),r=s},lineEnd:function(){e.lineEnd(),n=i=NaN},clean:function(){return 2-t}}}),(function(e,t,n,i){var r;if(null==e)r=n*Jm,i.point(-Ym,r),i.point(0,r),i.point(Ym,r),i.point(Ym,0),i.point(Ym,-r),i.point(0,-r),i.point(-Ym,-r),i.point(-Ym,0),i.point(-Ym,r);else if(tg(e[0]-t[0])>Vm){var o=e[0]<t[0]?Ym:-Ym;r=n*o/2,i.point(-o,r),i.point(0,r),i.point(o,r)}else i.point(t[0],t[1])}),[-Ym,-Jm]);function ev(e){var t=rg(e),n=2*eg,i=t>0,r=tg(t)>Vm;function o(e,n){return rg(e)*rg(n)>t}function a(e,n,i){var r=[1,0,0],o=Yg(Vg(e),Vg(n)),a=Xg(o,o),s=o[0],l=a-s*s;if(!l)return!i&&e;var u=t*a/l,c=-t*s/l,f=Yg(r,o),d=Qg(r,u);Jg(d,Qg(o,c));var h=f,p=Xg(d,h),m=Xg(h,h),g=p*p-m*(Xg(d,d)-1);if(!(g<0)){var y=dg(g),v=Qg(h,(-p-y)/m);if(Jg(v,d),v=Gg(v),!i)return v;var b,x=e[0],w=n[0],_=e[1],k=n[1];w<x&&(b=x,x=w,w=b);var E=w-x,$=tg(E-Ym)<Vm;if(!$&&k<_&&(b=_,_=k,k=b),$||E<Vm?$?_+k>0^v[1]<(tg(v[0]-x)<Vm?_:k):_<=v[1]&&v[1]<=k:E>Ym^(x<=v[0]&&v[0]<=w)){var A=Qg(h,(-p+y)/m);return Jg(A,d),[v,Gg(A)]}}}function s(t,n){var r=i?e:Ym-e,o=0;return t<-r?o|=1:t>r&&(o|=2),n<-r?o|=4:n>r&&(o|=8),o}return Jy(o,(function(e){var t,n,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,d){var h,p=[f,d],m=o(f,d),g=i?m?0:s(f,d):m?s(f+(f<0?Ym:-Ym),d):0;if(!t&&(u=l=m)&&e.lineStart(),m!==l&&(!(h=a(t,p))||Hy(t,h)||Hy(p,h))&&(p[2]=1),m!==l)c=0,m?(e.lineStart(),h=a(p,t),e.point(h[0],h[1])):(h=a(t,p),e.point(h[0],h[1],2),e.lineEnd()),t=h;else if(r&&t&&i^m){var y;g&n||!(y=a(p,t,!0))||(c=0,i?(e.lineStart(),e.point(y[0][0],y[0][1]),e.point(y[1][0],y[1][1]),e.lineEnd()):(e.point(y[1][0],y[1][1]),e.lineEnd(),e.lineStart(),e.point(y[0][0],y[0][1],3)))}!m||t&&Hy(t,p)||e.point(p[0],p[1]),t=p,l=m,n=g},lineEnd:function(){l&&e.lineEnd(),t=null},clean:function(){return c|(u&&l)<<1}}}),(function(t,i,r,o){!function(e,t,n,i,r,o){if(n){var a=rg(t),s=cg(t),l=i*n;null==r?(r=t+i*Km,o=t-l/2):(r=Uy(a,r),o=Uy(a,o),(i>0?r<o:r>o)&&(r+=i*Km));for(var u,c=r;i>0?c>o:c<o;c-=l)u=Gg([a,-s*rg(c),-s*cg(c)]),e.point(u[0],u[1])}}(o,e,n,r,t,i)}),i?[0,-e]:[-Ym,e-Ym])}var tv=1e9,nv=-tv;function iv(e,t,n,i){function r(r,o){return e<=r&&r<=n&&t<=o&&o<=i}function o(r,o,s,u){var c=0,f=0;if(null==r||(c=a(r,s))!==(f=a(o,s))||l(r,o)<0^s>0)do{u.point(0===c||3===c?e:n,c>1?i:t)}while((c=(c+s+4)%4)!==f);else u.point(o[0],o[1])}function a(i,r){return tg(i[0]-e)<Vm?r>0?0:3:tg(i[0]-n)<Vm?r>0?2:1:tg(i[1]-t)<Vm?r>0?1:0:r>0?3:2}function s(e,t){return l(e.x,t.x)}function l(e,t){var n=a(e,1),i=a(t,1);return n!==i?n-i:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(a){var l,u,c,f,d,h,p,m,g,y,v,b=a,x=Wy(),w={point:_,lineStart:function(){w.point=k,u&&u.push(c=[]);y=!0,g=!1,p=m=NaN},lineEnd:function(){l&&(k(f,d),h&&g&&x.rejoin(),l.push(x.result()));w.point=_,g&&b.lineEnd()},polygonStart:function(){b=x,l=[],u=[],v=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,r=u.length;n<r;++n)for(var o,a,s=u[n],l=1,c=s.length,f=s[0],d=f[0],h=f[1];l<c;++l)o=d,a=h,d=(f=s[l])[0],h=f[1],a<=i?h>i&&(d-o)*(i-a)>(h-a)*(e-o)&&++t:h<=i&&(d-o)*(i-a)<(h-a)*(e-o)&&--t;return t}(),n=v&&t,r=(l=fi(l)).length;(n||r)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),r&&Vy(l,s,t,o,a),a.polygonEnd());b=a,l=u=c=null}};function _(e,t){r(e,t)&&b.point(e,t)}function k(o,a){var s=r(o,a);if(u&&c.push([o,a]),y)f=o,d=a,h=s,y=!1,s&&(b.lineStart(),b.point(o,a));else if(s&&g)b.point(o,a);else{var l=[p=Math.max(nv,Math.min(tv,p)),m=Math.max(nv,Math.min(tv,m))],x=[o=Math.max(nv,Math.min(tv,o)),a=Math.max(nv,Math.min(tv,a))];!function(e,t,n,i,r,o){var a,s=e[0],l=e[1],u=0,c=1,f=t[0]-s,d=t[1]-l;if(a=n-s,f||!(a>0)){if(a/=f,f<0){if(a<u)return;a<c&&(c=a)}else if(f>0){if(a>c)return;a>u&&(u=a)}if(a=r-s,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>u&&(u=a)}else if(f>0){if(a<u)return;a<c&&(c=a)}if(a=i-l,d||!(a>0)){if(a/=d,d<0){if(a<u)return;a<c&&(c=a)}else if(d>0){if(a>c)return;a>u&&(u=a)}if(a=o-l,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>u&&(u=a)}else if(d>0){if(a<u)return;a<c&&(c=a)}return u>0&&(e[0]=s+u*f,e[1]=l+u*d),c<1&&(t[0]=s+c*f,t[1]=l+c*d),!0}}}}}(l,x,e,t,n,i)?s&&(b.lineStart(),b.point(o,a),v=!1):(g||(b.lineStart(),b.point(l[0],l[1])),b.point(x[0],x[1]),s||b.lineEnd(),v=!1)}p=o,m=a,g=s}return w}}function rv(e,t,n){var i=Yt(e,t-Vm,n).concat(t);return function(e){return i.map((function(t){return[e,t]}))}}function ov(e,t,n){var i=Yt(e,t-Vm,n).concat(t);return function(e){return i.map((function(t){return[t,e]}))}}const av=e=>e;var sv,lv,uv,cv,fv=new ri,dv=new ri,hv={point:gg,lineStart:gg,lineEnd:gg,polygonStart:function(){hv.lineStart=pv,hv.lineEnd=yv},polygonEnd:function(){hv.lineStart=hv.lineEnd=hv.point=gg,fv.add(tg(dv)),dv=new ri},result:function(){var e=fv/2;return fv=new ri,e}};function pv(){hv.point=mv}function mv(e,t){hv.point=gv,sv=uv=e,lv=cv=t}function gv(e,t){dv.add(cv*e-uv*t),uv=e,cv=t}function yv(){gv(sv,lv)}var vv=1/0,bv=vv,xv=-vv,wv=xv,_v={point:function(e,t){e<vv&&(vv=e);e>xv&&(xv=e);t<bv&&(bv=t);t>wv&&(wv=t)},lineStart:gg,lineEnd:gg,polygonStart:gg,polygonEnd:gg,result:function(){var e=[[vv,bv],[xv,wv]];return xv=wv=-(bv=vv=1/0),e}};var kv,Ev,$v,Av,Dv=0,Sv=0,Fv=0,Cv=0,Mv=0,Ov=0,zv=0,Nv=0,Rv=0,Tv={point:Pv,lineStart:Lv,lineEnd:Iv,polygonStart:function(){Tv.lineStart=qv,Tv.lineEnd=Uv},polygonEnd:function(){Tv.point=Pv,Tv.lineStart=Lv,Tv.lineEnd=Iv},result:function(){var e=Rv?[zv/Rv,Nv/Rv]:Ov?[Cv/Ov,Mv/Ov]:Fv?[Dv/Fv,Sv/Fv]:[NaN,NaN];return Dv=Sv=Fv=Cv=Mv=Ov=zv=Nv=Rv=0,e}};function Pv(e,t){Dv+=e,Sv+=t,++Fv}function Lv(){Tv.point=Bv}function Bv(e,t){Tv.point=jv,Pv($v=e,Av=t)}function jv(e,t){var n=e-$v,i=t-Av,r=dg(n*n+i*i);Cv+=r*($v+e)/2,Mv+=r*(Av+t)/2,Ov+=r,Pv($v=e,Av=t)}function Iv(){Tv.point=Pv}function qv(){Tv.point=Wv}function Uv(){Hv(kv,Ev)}function Wv(e,t){Tv.point=Hv,Pv(kv=$v=e,Ev=Av=t)}function Hv(e,t){var n=e-$v,i=t-Av,r=dg(n*n+i*i);Cv+=r*($v+e)/2,Mv+=r*(Av+t)/2,Ov+=r,zv+=(r=Av*e-$v*t)*($v+e),Nv+=r*(Av+t),Rv+=3*r,Pv($v=e,Av=t)}function Gv(e){this._context=e}Gv.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,Km)}},result:gg};var Vv,Xv,Yv,Jv,Qv,Kv=new ri,Zv={point:gg,lineStart:function(){Zv.point=eb},lineEnd:function(){Vv&&tb(Xv,Yv),Zv.point=gg},polygonStart:function(){Vv=!0},polygonEnd:function(){Vv=null},result:function(){var e=+Kv;return Kv=new ri,e}};function eb(e,t){Zv.point=tb,Xv=Jv=e,Yv=Qv=t}function tb(e,t){Jv-=e,Qv-=t,Kv.add(dg(Jv*Jv+Qv*Qv)),Jv=e,Qv=t}let nb,ib,rb,ob;class ab{constructor(e){this._append=null==e?sb:function(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return sb;if(t!==nb){const e=10**t;nb=t,ib=function(t){let n=1;this._+=t[0];for(const i=t.length;n<i;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return ib}(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==rb||this._append!==ib){const e=this._radius,t=this._;this._="",this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,rb=e,ib=this._append,ob=this._,this._=t}this._+=ob}}result(){const e=this._;return this._="",e.length?e:null}}function sb(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function lb(e,t){let n,i,r=3,o=4.5;function a(e){return e&&("function"==typeof o&&i.pointRadius(+o.apply(this,arguments)),_g(e,n(i))),i.result()}return a.area=function(e){return _g(e,n(hv)),hv.result()},a.measure=function(e){return _g(e,n(Zv)),Zv.result()},a.bounds=function(e){return _g(e,n(_v)),_v.result()},a.centroid=function(e){return _g(e,n(Tv)),Tv.result()},a.projection=function(t){return arguments.length?(n=null==t?(e=null,av):(e=t).stream,a):e},a.context=function(e){return arguments.length?(i=null==e?(t=null,new ab(r)):new Gv(t=e),"function"!=typeof o&&i.pointRadius(o),a):t},a.pointRadius=function(e){return arguments.length?(o="function"==typeof e?e:(i.pointRadius(+e),+e),a):o},a.digits=function(e){if(!arguments.length)return r;if(null==e)r=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);r=t}return null===t&&(i=new ab(r)),a},a.projection(e).digits(r).context(t)}function ub(e){return function(t){var n=new cb;for(var i in e)n[i]=e[i];return n.stream=t,n}}function cb(){}function fb(e,t,n){var i=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=i&&e.clipExtent(null),_g(n,e.stream(_v)),t(_v.result()),null!=i&&e.clipExtent(i),e}function db(e,t,n){return fb(e,(function(n){var i=t[1][0]-t[0][0],r=t[1][1]-t[0][1],o=Math.min(i/(n[1][0]-n[0][0]),r/(n[1][1]-n[0][1])),a=+t[0][0]+(i-o*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(r-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,s])}),n)}function hb(e,t,n){return db(e,[[0,0],t],n)}function pb(e,t,n){return fb(e,(function(n){var i=+t,r=i/(n[1][0]-n[0][0]),o=(i-r*(n[1][0]+n[0][0]))/2,a=-r*n[0][1];e.scale(150*r).translate([o,a])}),n)}function mb(e,t,n){return fb(e,(function(n){var i=+t,r=i/(n[1][1]-n[0][1]),o=-r*n[0][0],a=(i-r*(n[1][1]+n[0][1]))/2;e.scale(150*r).translate([o,a])}),n)}cb.prototype={constructor:cb,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var gb=rg(30*eg);function yb(e,t){return+t?function(e,t){function n(i,r,o,a,s,l,u,c,f,d,h,p,m,g){var y=u-i,v=c-r,b=y*y+v*v;if(b>4*t&&m--){var x=a+d,w=s+h,_=l+p,k=dg(x*x+w*w+_*_),E=mg(_/=k),$=tg(tg(_)-1)<Vm||tg(o-f)<Vm?(o+f)/2:ig(w,x),A=e($,E),D=A[0],S=A[1],F=D-i,C=S-r,M=v*F-y*C;(M*M/b>t||tg((y*F+v*C)/b-.5)>.3||a*d+s*h+l*p<gb)&&(n(i,r,o,a,s,l,D,S,$,x/=k,w/=k,_,m,g),g.point(D,S),n(D,S,$,x,w,_,u,c,f,d,h,p,m,g))}}return function(t){var i,r,o,a,s,l,u,c,f,d,h,p,m={point:g,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),m.lineStart=x},polygonEnd:function(){t.polygonEnd(),m.lineStart=y}};function g(n,i){n=e(n,i),t.point(n[0],n[1])}function y(){c=NaN,m.point=v,t.lineStart()}function v(i,r){var o=Vg([i,r]),a=e(i,r);n(c,f,u,d,h,p,c=a[0],f=a[1],u=i,d=o[0],h=o[1],p=o[2],16,t),t.point(c,f)}function b(){m.point=g,t.lineEnd()}function x(){y(),m.point=w,m.lineEnd=_}function w(e,t){v(i=e,t),r=c,o=f,a=d,s=h,l=p,m.point=v}function _(){n(c,f,u,d,h,p,r,o,i,a,s,l,16,t),m.lineEnd=b,b()}return m}}(e,t):function(e){return ub({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}(e)}var vb=ub({point:function(e,t){this.stream.point(e*eg,t*eg)}});function bb(e,t,n,i,r,o){if(!o)return function(e,t,n,i,r){function o(o,a){return[t+e*(o*=i),n-e*(a*=r)]}return o.invert=function(o,a){return[(o-t)/e*i,(n-a)/e*r]},o}(e,t,n,i,r);var a=rg(o),s=cg(o),l=a*e,u=s*e,c=a/e,f=s/e,d=(s*n-a*t)/e,h=(s*t+a*n)/e;function p(e,o){return[l*(e*=i)-u*(o*=r)+t,n-u*e-l*o]}return p.invert=function(e,t){return[i*(c*e-f*t+d),r*(h-f*e-c*t)]},p}function xb(e){return wb((function(){return e}))()}function wb(e){var t,n,i,r,o,a,s,l,u,c,f=150,d=480,h=250,p=0,m=0,g=0,y=0,v=0,b=0,x=1,w=1,_=null,k=Zy,E=null,$=av,A=.5;function D(e){return l(e[0]*eg,e[1]*eg)}function S(e){return(e=l.invert(e[0],e[1]))&&[e[0]*Zm,e[1]*Zm]}function F(){var e=bb(f,0,0,x,w,b).apply(null,t(p,m)),i=bb(f,d-e[0],h-e[1],x,w,b);return n=By(g,y,v),s=Py(t,i),l=Py(n,s),a=yb(s,A),C()}function C(){return u=c=null,D}return D.stream=function(e){return u&&c===e?u:u=vb(function(e){return ub({point:function(t,n){var i=e(t,n);return this.stream.point(i[0],i[1])}})}(n)(k(a($(c=e)))))},D.preclip=function(e){return arguments.length?(k=e,_=void 0,C()):k},D.postclip=function(e){return arguments.length?($=e,E=i=r=o=null,C()):$},D.clipAngle=function(e){return arguments.length?(k=+e?ev(_=e*eg):(_=null,Zy),C()):_*Zm},D.clipExtent=function(e){return arguments.length?($=null==e?(E=i=r=o=null,av):iv(E=+e[0][0],i=+e[0][1],r=+e[1][0],o=+e[1][1]),C()):null==E?null:[[E,i],[r,o]]},D.scale=function(e){return arguments.length?(f=+e,F()):f},D.translate=function(e){return arguments.length?(d=+e[0],h=+e[1],F()):[d,h]},D.center=function(e){return arguments.length?(p=e[0]%360*eg,m=e[1]%360*eg,F()):[p*Zm,m*Zm]},D.rotate=function(e){return arguments.length?(g=e[0]%360*eg,y=e[1]%360*eg,v=e.length>2?e[2]%360*eg:0,F()):[g*Zm,y*Zm,v*Zm]},D.angle=function(e){return arguments.length?(b=e%360*eg,F()):b*Zm},D.reflectX=function(e){return arguments.length?(x=e?-1:1,F()):x<0},D.reflectY=function(e){return arguments.length?(w=e?-1:1,F()):w<0},D.precision=function(e){return arguments.length?(a=yb(s,A=e*e),C()):dg(A)},D.fitExtent=function(e,t){return db(D,e,t)},D.fitSize=function(e,t){return hb(D,e,t)},D.fitWidth=function(e,t){return pb(D,e,t)},D.fitHeight=function(e,t){return mb(D,e,t)},function(){return t=e.apply(this,arguments),D.invert=t.invert&&S,F()}}function _b(e){var t=0,n=Ym/3,i=wb(e),r=i(t,n);return r.parallels=function(e){return arguments.length?i(t=e[0]*eg,n=e[1]*eg):[t*Zm,n*Zm]},r}function kb(e,t){var n=cg(e),i=(n+cg(t))/2;if(tg(i)<Vm)return function(e){var t=rg(e);function n(e,n){return[e*t,cg(n)/t]}return n.invert=function(e,n){return[e/t,mg(n*t)]},n}(e);var r=1+n*(2*i-n),o=dg(r)/i;function a(e,t){var n=dg(r-2*i*cg(t))/i;return[n*cg(e*=i),o-n*rg(e)]}return a.invert=function(e,t){var n=o-t,a=ig(e,tg(n))*fg(n);return n*i<0&&(a-=Ym*fg(e)*fg(n)),[a/i,mg((r-(e*e+n*n)*i*i)/(2*i))]},a}function Eb(){return _b(kb).scale(155.424).center([0,33.6442])}function $b(){return Eb().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Ab(e){return function(t,n){var i=rg(t),r=rg(n),o=e(i*r);return o===1/0?[2,0]:[o*r*cg(t),o*cg(n)]}}function Db(e){return function(t,n){var i=dg(t*t+n*n),r=e(i),o=cg(r),a=rg(r);return[ig(t*o,i*a),mg(i&&n*o/i)]}}var Sb=Ab((function(e){return dg(2/(1+e))}));Sb.invert=Db((function(e){return 2*mg(e/2)}));var Fb=Ab((function(e){return(e=pg(e))&&e/cg(e)}));function Cb(e,t){return[e,lg(hg((Jm+t)/2))]}function Mb(e){var t,n,i,r=xb(e),o=r.center,a=r.scale,s=r.translate,l=r.clipExtent,u=null;function c(){var o=Ym*a(),s=r(function(e){function t(t){return(t=e(t[0]*eg,t[1]*eg))[0]*=Zm,t[1]*=Zm,t}return e=By(e[0]*eg,e[1]*eg,e.length>2?e[2]*eg:0),t.invert=function(t){return(t=e.invert(t[0]*eg,t[1]*eg))[0]*=Zm,t[1]*=Zm,t},t}(r.rotate()).invert([0,0]));return l(null==u?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:e===Cb?[[Math.max(s[0]-o,u),t],[Math.min(s[0]+o,n),i]]:[[u,Math.max(s[1]-o,t)],[n,Math.min(s[1]+o,i)]])}return r.scale=function(e){return arguments.length?(a(e),c()):a()},r.translate=function(e){return arguments.length?(s(e),c()):s()},r.center=function(e){return arguments.length?(o(e),c()):o()},r.clipExtent=function(e){return arguments.length?(null==e?u=t=n=i=null:(u=+e[0][0],t=+e[0][1],n=+e[1][0],i=+e[1][1]),c()):null==u?null:[[u,t],[n,i]]},c()}function Ob(e){return hg((Jm+e)/2)}function zb(e,t){var n=rg(e),i=e===t?cg(e):lg(n/rg(t))/lg(Ob(t)/Ob(e)),r=n*ug(Ob(e),i)/i;if(!i)return Cb;function o(e,t){r>0?t<-Jm+Vm&&(t=-Jm+Vm):t>Jm-Vm&&(t=Jm-Vm);var n=r/ug(Ob(t),i);return[n*cg(i*e),r-n*rg(i*e)]}return o.invert=function(e,t){var n=r-t,o=fg(i)*dg(e*e+n*n),a=ig(e,tg(n))*fg(n);return n*i<0&&(a-=Ym*fg(e)*fg(n)),[a/i,2*ng(ug(r/o,1/i))-Jm]},o}function Nb(e,t){return[e,t]}function Rb(e,t){var n=rg(e),i=e===t?cg(e):(n-rg(t))/(t-e),r=n/i+e;if(tg(i)<Vm)return Nb;function o(e,t){var n=r-t,o=i*e;return[n*cg(o),r-n*rg(o)]}return o.invert=function(e,t){var n=r-t,o=ig(e,tg(n))*fg(n);return n*i<0&&(o-=Ym*fg(e)*fg(n)),[o/i,r-fg(i)*dg(e*e+n*n)]},o}Fb.invert=Db((function(e){return e})),Cb.invert=function(e,t){return[e,2*ng(ag(t))-Jm]},Nb.invert=Nb;var Tb=1.340264,Pb=-.081106,Lb=893e-6,Bb=.003796,jb=dg(3)/2;function Ib(e,t){var n=mg(jb*cg(t)),i=n*n,r=i*i*i;return[e*rg(n)/(jb*(Tb+3*Pb*i+r*(7*Lb+9*Bb*i))),n*(Tb+Pb*i+r*(Lb+Bb*i))]}function qb(e,t){var n=rg(t),i=rg(e)*n;return[n*cg(e)/i,cg(t)/i]}function Ub(e,t){var n=t*t,i=n*n;return[e*(.8707-.131979*n+i*(i*(.003971*n-.001529*i)-.013791)),t*(1.007226+n*(.015085+i*(.028874*n-.044475-.005916*i)))]}function Wb(e,t){return[rg(t)*cg(e),cg(t)]}function Hb(e,t){var n=rg(t),i=1+rg(e)*n;return[n*cg(e)/i,cg(t)/i]}function Gb(e,t){return[lg(hg((Jm+t)/2)),-e]}Ib.invert=function(e,t){for(var n,i=t,r=i*i,o=r*r*r,a=0;a<12&&(o=(r=(i-=n=(i*(Tb+Pb*r+o*(Lb+Bb*r))-t)/(Tb+3*Pb*r+o*(7*Lb+9*Bb*r)))*i)*r*r,!(tg(n)<Xm));++a);return[jb*e*(Tb+3*Pb*r+o*(7*Lb+9*Bb*r))/rg(i),mg(cg(i)/jb)]},qb.invert=Db(ng),Ub.invert=function(e,t){var n,i=t,r=25;do{var o=i*i,a=o*o;i-=n=(i*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-t)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(tg(n)>Vm&&--r>0);return[e/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]},Wb.invert=Db(mg),Hb.invert=Db((function(e){return 2*ng(e)})),Gb.invert=function(e,t){return[-t,2*ng(ag(e))-Jm]};var Vb,Xb=Math.abs,Yb=Math.cos,Jb=Math.sin,Qb=Math.PI,Kb=Qb/2,Zb=(Vb=2)>0?Math.sqrt(Vb):0;function ex(e){return e>1?Kb:e<-1?-Kb:Math.asin(e)}function tx(e,t){var n,i=e*Jb(t),r=30;do{t-=n=(t+Jb(t)-i)/(1+Yb(t))}while(Xb(n)>1e-6&&--r>0);return t/2}var nx=function(e,t,n){function i(i,r){return[e*i*Yb(r=tx(n,r)),t*Jb(r)]}return i.invert=function(i,r){return r=ex(r/t),[i/(e*Yb(r)),ex((2*r+Jb(2*r))/n)]},i}(Zb/Kb,Zb,Qb);const ix=lb(),rx=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function ox(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(sx[e]=function(e,t){return function n(){const i=t();return i.type=e,i.path=lb().projection(i),i.copy=i.copy||function(){const e=n();return rx.forEach((t=>{i[t]&&e[t](i[t]())})),e.path.pointRadius(i.path.pointRadius()),e},Al(i)}}(e,t),this):sx[e]||null}function ax(e){return e&&e.path||ix}const sx={albers:$b,albersusa:function(){var e,t,n,i,r,o,a=$b(),s=Eb().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Eb().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(e,t){o=[e,t]}};function c(e){var t=e[0],a=e[1];return o=null,n.point(t,a),o||(i.point(t,a),o)||(r.point(t,a),o)}function f(){return e=t=null,c}return c.invert=function(e){var t=a.scale(),n=a.translate(),i=(e[0]-n[0])/t,r=(e[1]-n[1])/t;return(r>=.12&&r<.234&&i>=-.425&&i<-.214?s:r>=.166&&r<.234&&i>=-.214&&i<-.115?l:a).invert(e)},c.stream=function(n){return e&&t===n?e:(i=[a.stream(t=n),s.stream(n),l.stream(n)],r=i.length,e={point:function(e,t){for(var n=-1;++n<r;)i[n].point(e,t)},sphere:function(){for(var e=-1;++e<r;)i[e].sphere()},lineStart:function(){for(var e=-1;++e<r;)i[e].lineStart()},lineEnd:function(){for(var e=-1;++e<r;)i[e].lineEnd()},polygonStart:function(){for(var e=-1;++e<r;)i[e].polygonStart()},polygonEnd:function(){for(var e=-1;++e<r;)i[e].polygonEnd()}});var i,r},c.precision=function(e){return arguments.length?(a.precision(e),s.precision(e),l.precision(e),f()):a.precision()},c.scale=function(e){return arguments.length?(a.scale(e),s.scale(.35*e),l.scale(e),c.translate(a.translate())):a.scale()},c.translate=function(e){if(!arguments.length)return a.translate();var t=a.scale(),o=+e[0],c=+e[1];return n=a.translate(e).clipExtent([[o-.455*t,c-.238*t],[o+.455*t,c+.238*t]]).stream(u),i=s.translate([o-.307*t,c+.201*t]).clipExtent([[o-.425*t+Vm,c+.12*t+Vm],[o-.214*t-Vm,c+.234*t-Vm]]).stream(u),r=l.translate([o-.205*t,c+.212*t]).clipExtent([[o-.214*t+Vm,c+.166*t+Vm],[o-.115*t-Vm,c+.234*t-Vm]]).stream(u),f()},c.fitExtent=function(e,t){return db(c,e,t)},c.fitSize=function(e,t){return hb(c,e,t)},c.fitWidth=function(e,t){return pb(c,e,t)},c.fitHeight=function(e,t){return mb(c,e,t)},c.scale(1070)},azimuthalequalarea:function(){return xb(Sb).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return xb(Fb).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return _b(zb).scale(109.5).parallels([30,30])},conicequalarea:Eb,conicequidistant:function(){return _b(Rb).scale(131.154).center([0,13.9389])},equalEarth:function(){return xb(Ib).scale(177.158)},equirectangular:function(){return xb(Nb).scale(152.63)},gnomonic:function(){return xb(qb).scale(144.049).clipAngle(60)},identity:function(){var e,t,n,i,r,o,a,s=1,l=0,u=0,c=1,f=1,d=0,h=null,p=1,m=1,g=ub({point:function(e,t){var n=b([e,t]);this.stream.point(n[0],n[1])}}),y=av;function v(){return p=s*c,m=s*f,o=a=null,b}function b(n){var i=n[0]*p,r=n[1]*m;if(d){var o=r*e-i*t;i=i*e+r*t,r=o}return[i+l,r+u]}return b.invert=function(n){var i=n[0]-l,r=n[1]-u;if(d){var o=r*e+i*t;i=i*e-r*t,r=o}return[i/p,r/m]},b.stream=function(e){return o&&a===e?o:o=g(y(a=e))},b.postclip=function(e){return arguments.length?(y=e,h=n=i=r=null,v()):y},b.clipExtent=function(e){return arguments.length?(y=null==e?(h=n=i=r=null,av):iv(h=+e[0][0],n=+e[0][1],i=+e[1][0],r=+e[1][1]),v()):null==h?null:[[h,n],[i,r]]},b.scale=function(e){return arguments.length?(s=+e,v()):s},b.translate=function(e){return arguments.length?(l=+e[0],u=+e[1],v()):[l,u]},b.angle=function(n){return arguments.length?(t=cg(d=n%360*eg),e=rg(d),v()):d*Zm},b.reflectX=function(e){return arguments.length?(c=e?-1:1,v()):c<0},b.reflectY=function(e){return arguments.length?(f=e?-1:1,v()):f<0},b.fitExtent=function(e,t){return db(b,e,t)},b.fitSize=function(e,t){return hb(b,e,t)},b.fitWidth=function(e,t){return pb(b,e,t)},b.fitHeight=function(e,t){return mb(b,e,t)},b},mercator:function(){return Mb(Cb).scale(961/Km)},mollweide:function(){return xb(nx).scale(169.529)},naturalEarth1:function(){return xb(Ub).scale(175.295)},orthographic:function(){return xb(Wb).scale(249.5).clipAngle(90.000001)},stereographic:function(){return xb(Hb).scale(250).clipAngle(142)},transversemercator:function(){var e=Mb(Gb),t=e.center,n=e.rotate;return e.center=function(e){return arguments.length?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return arguments.length?n([e[0],e[1],e.length>2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90]).scale(159.155)}};for(const bJ in sx)ox(bJ,sx[bJ]);function lx(){}const ux=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function cx(){var e=1,t=1,n=a;function i(e,t){return t.map((t=>r(e,t)))}function r(i,r){var a=[],s=[];return function(n,i,r){var a,s,l,u,c,f,d=[],h=[];a=s=-1,u=n[0]>=i,ux[u<<1].forEach(p);for(;++a<e-1;)l=u,u=n[a+1]>=i,ux[l|u<<1].forEach(p);ux[u|0].forEach(p);for(;++s<t-1;){for(a=-1,u=n[s*e+e]>=i,c=n[s*e]>=i,ux[u<<1|c<<2].forEach(p);++a<e-1;)l=u,u=n[s*e+e+a+1]>=i,f=c,c=n[s*e+a+1]>=i,ux[l|u<<1|c<<2|f<<3].forEach(p);ux[u|c<<3].forEach(p)}a=-1,c=n[s*e]>=i,ux[c<<2].forEach(p);for(;++a<e-1;)f=c,c=n[s*e+a+1]>=i,ux[c<<2|f<<3].forEach(p);function p(e){var t,n,i=[e[0][0]+a,e[0][1]+s],l=[e[1][0]+a,e[1][1]+s],u=o(i),c=o(l);(t=h[u])?(n=d[c])?(delete h[t.end],delete d[n.start],t===n?(t.ring.push(l),r(t.ring)):d[t.start]=h[n.end]={start:t.start,end:n.end,ring:t.ring.concat(n.ring)}):(delete h[t.end],t.ring.push(l),h[t.end=c]=t):(t=d[c])?(n=h[u])?(delete d[t.start],delete h[n.end],t===n?(t.ring.push(l),r(t.ring)):d[n.start]=h[t.end]={start:n.start,end:t.end,ring:n.ring.concat(t.ring)}):(delete d[t.start],t.ring.unshift(i),d[t.start=u]=t):d[u]=h[c]={start:u,end:c,ring:[i,l]}}ux[c<<3].forEach(p)}(i,r,(e=>{n(e,i,r),function(e){var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];for(;++t<n;)i+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return i}(e)>0?a.push([e]):s.push(e)})),s.forEach((e=>{for(var t,n=0,i=a.length;n<i;++n)if(-1!==fx((t=a[n])[0],e))return void t.push(e)})),{type:"MultiPolygon",value:r,coordinates:a}}function o(t){return 2*t[0]+t[1]*(e+1)*4}function a(n,i,r){n.forEach((n=>{var o,a=n[0],s=n[1],l=0|a,u=0|s,c=i[u*e+l];a>0&&a<e&&l===a&&(o=i[u*e+l-1],n[0]=a+(r-o)/(c-o)-.5),s>0&&s<t&&u===s&&(o=i[(u-1)*e+l],n[1]=s+(r-o)/(c-o)-.5)}))}return i.contour=r,i.size=function(n){if(!arguments.length)return[e,t];var r=Math.floor(n[0]),o=Math.floor(n[1]);return r>=0&&o>=0||s("invalid size"),e=r,t=o,i},i.smooth=function(e){return arguments.length?(n=e?a:lx,i):n===a},i}function fx(e,t){for(var n,i=-1,r=t.length;++i<r;)if(n=dx(e,t[i]))return n;return 0}function dx(e,t){for(var n=t[0],i=t[1],r=-1,o=0,a=e.length,s=a-1;o<a;s=o++){var l=e[o],u=l[0],c=l[1],f=e[s],d=f[0],h=f[1];if(hx(l,f,t))return 0;c>i!=h>i&&n<(d-u)*(i-c)/(h-c)+u&&(r=-r)}return r}function hx(e,t,n){var i,r,o,a;return function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])==(n[0]-e[0])*(t[1]-e[1])}(e,t,n)&&(r=e[i=+(e[0]===t[0])],o=n[i],a=t[i],r<=o&&o<=a||a<=o&&o<=r)}function px(e,t,n){return function(i){var r=A(i),o=n?Math.min(r[0],0):r[0],a=r[1],s=a-o,l=t?pe(o,a,e):s/(e+1);return Yt(o+l,a,l)}}function mx(e){Xr.call(this,null,e)}function gx(e,t,n,i,r){const o=e.x1||0,a=e.y1||0,s=t*n<0;function l(e){e.forEach(u)}function u(e){s&&e.reverse(),e.forEach(c)}function c(e){e[0]=(e[0]-o)*t+i,e[1]=(e[1]-a)*n+r}return function(e){return e.coordinates.forEach(l),e}}function yx(e,t,n){const i=e>=0?e:to(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function vx(e){return o(e)?e:g(+e)}function bx(){var e=e=>e[0],t=e=>e[1],n=le,i=[-1,-1],o=960,a=500,l=2;function u(r,s){const u=yx(i[0],r,e)>>l,c=yx(i[1],r,t)>>l,f=u?u+2:0,d=c?c+2:0,h=2*f+(o>>l),p=2*d+(a>>l),m=new Float32Array(h*p),g=new Float32Array(h*p);let y=m;r.forEach((i=>{const r=f+(+e(i)>>l),o=d+(+t(i)>>l);r>=0&&r<h&&o>=0&&o<p&&(m[r+o*h]+=+n(i))})),u>0&&c>0?(xx(h,p,m,g,u),wx(h,p,g,m,c),xx(h,p,m,g,u),wx(h,p,g,m,c),xx(h,p,m,g,u),wx(h,p,g,m,c)):u>0?(xx(h,p,m,g,u),xx(h,p,g,m,u),xx(h,p,m,g,u),y=g):c>0&&(wx(h,p,m,g,c),wx(h,p,g,m,c),wx(h,p,m,g,c),y=g);const v=s?Math.pow(2,-2*l):1/di(y);for(let e=0,t=h*p;e<t;++e)y[e]*=v;return{values:y,scale:1<<l,width:h,height:p,x1:f,y1:d,x2:f+(o>>l),y2:d+(a>>l)}}return u.x=function(t){return arguments.length?(e=vx(t),u):e},u.y=function(e){return arguments.length?(t=vx(e),u):t},u.weight=function(e){return arguments.length?(n=vx(e),u):n},u.size=function(e){if(!arguments.length)return[o,a];var t=+e[0],n=+e[1];return t>=0&&n>=0||s("invalid size"),o=t,a=n,u},u.cellSize=function(e){return arguments.length?((e=+e)>=1||s("invalid cell size"),l=Math.floor(Math.log(e)/Math.LN2),u):1<<l},u.bandwidth=function(e){return arguments.length?(1===(e=r(e)).length&&(e=[+e[0],+e[0]]),2!==e.length&&s("invalid bandwidth"),i=e,u):i},u}function xx(e,t,n,i,r){const o=1+(r<<1);for(let a=0;a<t;++a)for(let t=0,s=0;t<e+r;++t)t<e&&(s+=n[t+a*e]),t>=r&&(t>=o&&(s-=n[t-o+a*e]),i[t-r+a*e]=s/Math.min(t+1,e-1+o-t,o))}function wx(e,t,n,i,r){const o=1+(r<<1);for(let a=0;a<e;++a)for(let s=0,l=0;s<t+r;++s)s<t&&(l+=n[a+s*e]),s>=r&&(s>=o&&(l-=n[a+(s-o)*e]),i[a+(s-r)*e]=l/Math.min(s+1,t-1+o-s,o))}function _x(e){Xr.call(this,null,e)}mx.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},i(mx,Xr,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,r=e.field||u,s=cx().smooth(!1!==e.smooth),l=e.thresholds||function(e,t,n){const i=px(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?i:i(e.map((e=>xt(t(e).values))))}(i,r,e),c=null===e.as?null:e.as||"contour",f=[];return i.forEach((t=>{const n=r(t),i=s.size([n.width,n.height])(n.values,a(l)?l:l(n.values));!function(e,t,n,i){let r=i.scale||t.scale,a=i.translate||t.translate;o(r)&&(r=r(n,i));o(a)&&(a=a(n,i));if((1===r||null==r)&&!a)return;const s=(ie(r)?r:r[0])||1,l=(ie(r)?r:r[1])||1,u=a&&a[0]||0,c=a&&a[1]||0;e.forEach(gx(t,s,l,u,c))}(i,n,t,e),i.forEach((e=>{f.push(br(t,yr(null!=c?{[c]:e}:e)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=f,n}}),_x.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const kx=["x","y","weight","size","cellSize","bandwidth"];function Ex(e,t){return kx.forEach((n=>null!=t[n]?e[n](t[n]):0)),e}function $x(e){Xr.call(this,null,e)}i(_x,Xr,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=function(e,t){var n,i,r,o,a,s,l=[],u=e=>e(o);if(null==t)l.push(e);else for(n={},i=0,r=e.length;i<r;++i)o=e[i],(s=n[a=t.map(u)])||(n[a]=s=[],s.dims=a,l.push(s)),s.push(o);return l}(t.materialize(t.SOURCE).source,e.groupby),o=(e.groupby||[]).map($),a=Ex(bx(),e),s=e.as||"grid";return n=r.map((t=>yr(function(e,t){for(let n=0;n<o.length;++n)e[o[n]]=t[n];return e}({[s]:a(t,e.counts)},t.dims)))),this.value&&(i.rem=this.value),this.value=i.source=i.add=n,i}}),$x.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0},{name:"smooth",type:"boolean",default:!0}]},i($x,Xr,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,i,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),o=cx().smooth(!1!==e.smooth),s=e.values,l=e.thresholds||px(e.count||10,e.nice,!!s),u=e.size;return s||(s=t.materialize(t.SOURCE).source,i=gx(n=Ex(bx(),e)(s,!0),n.scale||1,n.scale||1,0,0),u=[n.width,n.height],s=n.values),l=a(l)?l:l(s),s=o.size(u)(s,l),i&&s.forEach(i),this.value&&(r.rem=this.value),this.value=r.source=r.add=(s||[]).map(yr),r}});const Ax="Feature",Dx="FeatureCollection";function Sx(e){Xr.call(this,null,e)}function Fx(e){Xr.call(this,null,e)}function Cx(e){Xr.call(this,null,e)}function Mx(e){Xr.call(this,null,e)}function Ox(e){Xr.call(this,[],e),this.generator=function(){var e,t,n,i,r,o,a,s,l,u,c,f,d=10,h=d,p=90,m=360,g=2.5;function y(){return{type:"MultiLineString",coordinates:v()}}function v(){return Yt(og(i/p)*p,n,p).map(c).concat(Yt(og(s/m)*m,a,m).map(f)).concat(Yt(og(t/d)*d,e,d).filter((function(e){return tg(e%p)>Vm})).map(l)).concat(Yt(og(o/h)*h,r,h).filter((function(e){return tg(e%m)>Vm})).map(u))}return y.lines=function(){return v().map((function(e){return{type:"LineString",coordinates:e}}))},y.outline=function(){return{type:"Polygon",coordinates:[c(i).concat(f(a).slice(1),c(n).reverse().slice(1),f(s).reverse().slice(1))]}},y.extent=function(e){return arguments.length?y.extentMajor(e).extentMinor(e):y.extentMinor()},y.extentMajor=function(e){return arguments.length?(i=+e[0][0],n=+e[1][0],s=+e[0][1],a=+e[1][1],i>n&&(e=i,i=n,n=e),s>a&&(e=s,s=a,a=e),y.precision(g)):[[i,s],[n,a]]},y.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],o=+n[0][1],r=+n[1][1],t>e&&(n=t,t=e,e=n),o>r&&(n=o,o=r,r=n),y.precision(g)):[[t,o],[e,r]]},y.step=function(e){return arguments.length?y.stepMajor(e).stepMinor(e):y.stepMinor()},y.stepMajor=function(e){return arguments.length?(p=+e[0],m=+e[1],y):[p,m]},y.stepMinor=function(e){return arguments.length?(d=+e[0],h=+e[1],y):[d,h]},y.precision=function(d){return arguments.length?(g=+d,l=rv(o,r,90),u=ov(t,e,g),c=rv(s,a,90),f=ov(i,n,g),y):g},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function zx(e){Xr.call(this,null,e)}function Nx(e){if(!o(e))return!1;const t=ne(_(e));return t.$x||t.$y||t.$value||t.$max}function Rx(e){Xr.call(this,null,e),this.modified(!0)}function Tx(e,t,n){o(e[t])&&e[t](n)}Sx.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},i(Sx,Xr,{transform(e,t){var n,i=this._features,r=this._points,o=e.fields,a=o&&o[0],s=o&&o[1],l=e.geojson||!o&&u,c=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(_(l))||a&&t.modified(_(a))||s&&t.modified(_(s)),this.value&&!n||(c=t.SOURCE,this._features=i=[],this._points=r=[]),l&&t.visit(c,(e=>i.push(l(e)))),a&&s&&(t.visit(c,(e=>{var t=a(e),n=s(e);null!=t&&null!=n&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])})),i=i.concat({type:Ax,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:Dx,features:i}}}),Fx.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},i(Fx,Xr,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||u,o=e.as||"path",a=n.SOURCE;!i||e.modified()?(this.value=i=ax(e.projection),n.materialize().reflow()):a=r===u||t.modified(r.fields)?n.ADD_MOD:n.ADD;const s=function(e,t){const n=e.pointRadius();e.context(null),null!=t&&e.pointRadius(t);return n}(i,e.pointRadius);return n.visit(a,(e=>e[o]=i(r(e)))),i.pointRadius(s),n.modifies(o)}}),Cx.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},i(Cx,Xr,{transform(e,t){var n,i=e.projection,r=e.fields[0],o=e.fields[1],a=e.as||["x","y"],s=a[0],l=a[1];function u(e){const t=i([r(e),o(e)]);t?(e[s]=t[0],e[l]=t[1]):(e[s]=void 0,e[l]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,u):(n=t.modified(r.fields)||t.modified(o.fields),t.visit(n?t.ADD_MOD:t.ADD,u)),t.modifies(a)}}),Mx.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},i(Mx,Xr,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.as||"shape",o=n.ADD;return i&&!e.modified()||(this.value=i=function(e,t,n){const i=null==n?n=>e(t(n)):i=>{var r=e.pointRadius(),o=e.pointRadius(n)(t(i));return e.pointRadius(r),o};return i.context=t=>(e.context(t),i),i}(ax(e.projection),e.field||P("datum"),e.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(e=>e[r]=i)),n.modifies(r)}}),Ox.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},i(Ox,Xr,{transform(e,t){var n,i=this.value,r=this.generator;if(!i.length||e.modified())for(const a in e)o(r[a])&&r[a](e[a]);return n=r(),i.length?t.mod.push(xr(i[0],n)):t.add.push(yr(n)),i[0]=n,t}}),zx.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},i(zx,Xr,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,i="shared"===e.resolve,r=e.field||u,a=function(e,t){let n;o(e)?(n=n=>e(n,t),n.dep=Nx(e)):e?n=g(e):(n=e=>e.$value/e.$max||0,n.dep=!0);return n}(e.opacity,e),s=function(e,t){let n;o(e)?(n=n=>vn(e(n,t)),n.dep=Nx(e)):n=g(vn(e||"#888"));return n}(e.color,e),l=e.as||"image",c={$x:0,$y:0,$value:0,$max:i?xt(n.map((e=>xt(r(e).values)))):0};return n.forEach((e=>{const t=r(e),n=w({},e,c);i||(n.$max=xt(t.values||[])),e[l]=function(e,t,n,i){const r=e.width,o=e.height,a=e.x1||0,s=e.y1||0,l=e.x2||r,u=e.y2||o,c=e.values,f=c?e=>c[e]:W,d=xs(l-a,u-s),h=d.getContext("2d"),p=h.getImageData(0,0,l-a,u-s),m=p.data;for(let g=s,y=0;g<u;++g){t.$y=g-s;for(let e=a,o=g*r;e<l;++e,y+=4){t.$x=e-a,t.$value=f(e+o);const r=n(t);m[y+0]=r.r,m[y+1]=r.g,m[y+2]=r.b,m[y+3]=~~(255*i(t))}}return h.putImageData(p,0,0),d}(t,n,s.dep?s:g(s(n)),a.dep?a:g(a(n)))})),t.reflow(!0).modifies(l)}}),i(Rx,Xr,{transform(e,t){let n=this.value;return!n||e.modified("type")?(this.value=n=function(e){const t=ox((e||"mercator").toLowerCase());t||s("Unrecognized projection type: "+e);return t()}(e.type),rx.forEach((t=>{null!=e[t]&&Tx(n,t,e[t])}))):rx.forEach((t=>{e.modified(t)&&Tx(n,t,e[t])})),null!=e.pointRadius&&n.path.pointRadius(e.pointRadius),e.fit&&function(e,t){const n=function(e){return e=r(e),1===e.length?e[0]:{type:Dx,features:e.reduce(((e,t)=>e.concat(function(e){return e.type===Dx?e.features:r(e).filter((e=>null!=e)).map((e=>e.type===Ax?e:{type:Ax,geometry:e}))}(t))),[])}}(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});const Px=Object.freeze(Object.defineProperty({__proto__:null,contour:$x,geojson:Sx,geopath:Fx,geopoint:Cx,geoshape:Mx,graticule:Ox,heatmap:zx,isocontour:mx,kde2d:_x,projection:Rx},Symbol.toStringTag,{value:"Module"}));function Lx(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,o,a,s,l,u,c,f,d,h=e._root,p={data:i},m=e._x0,g=e._y0,y=e._x1,v=e._y1;if(!h)return e._root=p,e;for(;h.length;)if((u=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a,r=h,!(h=h[f=c<<1|u]))return r[f]=p,e;if(s=+e._x.call(null,h.data),l=+e._y.call(null,h.data),t===s&&n===l)return p.next=h,r?r[f]=p:e._root=p,e;do{r=r?r[f]=new Array(4):e._root=new Array(4),(u=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a}while((f=c<<1|u)==(d=(l>=a)<<1|s>=o));return r[d]=h,r[f]=p,e}function Bx(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function jx(e){return e[0]}function Ix(e){return e[1]}function qx(e,t,n){var i=new Ux(null==t?jx:t,null==n?Ix:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function Ux(e,t,n,i,r,o){this._x=e,this._y=t,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function Wx(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Hx=qx.prototype=Ux.prototype;function Gx(e){return function(){return e}}function Vx(e){return 1e-6*(e()-.5)}function Xx(e){return e.x+e.vx}function Yx(e){return e.y+e.vy}function Jx(e){return e.index}function Qx(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}Hx.copy=function(){var e,t,n=new Ux(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return n;if(!i.length)return n._root=Wx(i),n;for(e=[{source:i,target:n._root=new Array(4)}];i=e.pop();)for(var r=0;r<4;++r)(t=i.source[r])&&(t.length?e.push({source:t,target:i.target[r]=new Array(4)}):i.target[r]=Wx(t));return n},Hx.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return Lx(this.cover(t,n),t,n,e)},Hx.addAll=function(e){var t,n,i,r,o=e.length,a=new Array(o),s=new Array(o),l=1/0,u=1/0,c=-1/0,f=-1/0;for(n=0;n<o;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(r=+this._y.call(null,t))||(a[n]=i,s[n]=r,i<l&&(l=i),i>c&&(c=i),r<u&&(u=r),r>f&&(f=r));if(l>c||u>f)return this;for(this.cover(l,u).cover(c,f),n=0;n<o;++n)Lx(this,a[n],s[n],e[n]);return this},Hx.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,i=this._y0,r=this._x1,o=this._y1;if(isNaN(n))r=(n=Math.floor(e))+1,o=(i=Math.floor(t))+1;else{for(var a,s,l=r-n||1,u=this._root;n>e||e>=r||i>t||t>=o;)switch(s=(t<i)<<1|e<n,(a=new Array(4))[s]=u,u=a,l*=2,s){case 0:r=n+l,o=i+l;break;case 1:n=r-l,o=i+l;break;case 2:r=n+l,i=o-l;break;case 3:n=r-l,i=o-l}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=i,this._x1=r,this._y1=o,this},Hx.data=function(){var e=[];return this.visit((function(t){if(!t.length)do{e.push(t.data)}while(t=t.next)})),e},Hx.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Hx.find=function(e,t,n){var i,r,o,a,s,l,u,c=this._x0,f=this._y0,d=this._x1,h=this._y1,p=[],m=this._root;for(m&&p.push(new Bx(m,c,f,d,h)),null==n?n=1/0:(c=e-n,f=t-n,d=e+n,h=t+n,n*=n);l=p.pop();)if(!(!(m=l.node)||(r=l.x0)>d||(o=l.y0)>h||(a=l.x1)<c||(s=l.y1)<f))if(m.length){var g=(r+a)/2,y=(o+s)/2;p.push(new Bx(m[3],g,y,a,s),new Bx(m[2],r,y,g,s),new Bx(m[1],g,o,a,y),new Bx(m[0],r,o,g,y)),(u=(t>=y)<<1|e>=g)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=l)}else{var v=e-+this._x.call(null,m.data),b=t-+this._y.call(null,m.data),x=v*v+b*b;if(x<n){var w=Math.sqrt(n=x);c=e-w,f=t-w,d=e+w,h=t+w,i=m.data}}return i},Hx.remove=function(e){if(isNaN(o=+this._x.call(null,e))||isNaN(a=+this._y.call(null,e)))return this;var t,n,i,r,o,a,s,l,u,c,f,d,h=this._root,p=this._x0,m=this._y0,g=this._x1,y=this._y1;if(!h)return this;if(h.length)for(;;){if((u=o>=(s=(p+g)/2))?p=s:g=s,(c=a>=(l=(m+y)/2))?m=l:y=l,t=h,!(h=h[f=c<<1|u]))return this;if(!h.length)break;(t[f+1&3]||t[f+2&3]||t[f+3&3])&&(n=t,d=f)}for(;h.data!==e;)if(i=h,!(h=h.next))return this;return(r=h.next)&&delete h.next,i?(r?i.next=r:delete i.next,this):t?(r?t[f]=r:delete t[f],(h=t[0]||t[1]||t[2]||t[3])&&h===(t[3]||t[2]||t[1]||t[0])&&!h.length&&(n?n[d]=h:this._root=h),this):(this._root=r,this)},Hx.removeAll=function(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this},Hx.root=function(){return this._root},Hx.size=function(){var e=0;return this.visit((function(t){if(!t.length)do{++e}while(t=t.next)})),e},Hx.visit=function(e){var t,n,i,r,o,a,s=[],l=this._root;for(l&&s.push(new Bx(l,this._x0,this._y0,this._x1,this._y1));t=s.pop();)if(!e(l=t.node,i=t.x0,r=t.y0,o=t.x1,a=t.y1)&&l.length){var u=(i+o)/2,c=(r+a)/2;(n=l[3])&&s.push(new Bx(n,u,c,o,a)),(n=l[2])&&s.push(new Bx(n,i,c,u,a)),(n=l[1])&&s.push(new Bx(n,u,r,o,c)),(n=l[0])&&s.push(new Bx(n,i,r,u,c))}return this},Hx.visitAfter=function(e){var t,n=[],i=[];for(this._root&&n.push(new Bx(this._root,this._x0,this._y0,this._x1,this._y1));t=n.pop();){var r=t.node;if(r.length){var o,a=t.x0,s=t.y0,l=t.x1,u=t.y1,c=(a+l)/2,f=(s+u)/2;(o=r[0])&&n.push(new Bx(o,a,s,c,f)),(o=r[1])&&n.push(new Bx(o,c,s,l,f)),(o=r[2])&&n.push(new Bx(o,a,f,c,u)),(o=r[3])&&n.push(new Bx(o,c,f,l,u))}i.push(t)}for(;t=i.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},Hx.x=function(e){return arguments.length?(this._x=e,this):this._x},Hx.y=function(e){return arguments.length?(this._y=e,this):this._y};const Kx=4294967296;function Zx(e){return e.x}function ew(e){return e.y}var tw=Math.PI*(3-Math.sqrt(5));function nw(e){var t,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,a=.6,s=new Map,l=bn(f),u=xn("tick","end"),c=function(){let e=1;return()=>(e=(1664525*e+1013904223)%Kx)/Kx}();function f(){d(),u.call("tick",t),n<i&&(l.stop(),u.call("end",t))}function d(i){var l,u,c=e.length;void 0===i&&(i=1);for(var f=0;f<i;++f)for(n+=(o-n)*r,s.forEach((function(e){e(n)})),l=0;l<c;++l)null==(u=e[l]).fx?u.x+=u.vx*=a:(u.x=u.fx,u.vx=0),null==u.fy?u.y+=u.vy*=a:(u.y=u.fy,u.vy=0);return t}function h(){for(var t,n=0,i=e.length;n<i;++n){if((t=e[n]).index=n,null!=t.fx&&(t.x=t.fx),null!=t.fy&&(t.y=t.fy),isNaN(t.x)||isNaN(t.y)){var r=10*Math.sqrt(.5+n),o=n*tw;t.x=r*Math.cos(o),t.y=r*Math.sin(o)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function p(t){return t.initialize&&t.initialize(e,c),t}return null==e&&(e=[]),h(),t={tick:d,restart:function(){return l.restart(f),t},stop:function(){return l.stop(),t},nodes:function(n){return arguments.length?(e=n,h(),s.forEach(p),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(i=+e,t):i},alphaDecay:function(e){return arguments.length?(r=+e,t):+r},alphaTarget:function(e){return arguments.length?(o=+e,t):o},velocityDecay:function(e){return arguments.length?(a=1-e,t):1-a},randomSource:function(e){return arguments.length?(c=e,s.forEach(p),t):c},force:function(e,n){return arguments.length>1?(null==n?s.delete(e):s.set(e,p(n)),t):s.get(e)},find:function(t,n,i){var r,o,a,s,l,u=0,c=e.length;for(null==i?i=1/0:i*=i,u=0;u<c;++u)(a=(r=t-(s=e[u]).x)*r+(o=n-s.y)*o)<i&&(l=s,i=a);return l},on:function(e,n){return arguments.length>1?(u.on(e,n),t):u.on(e)}}}const iw={center:function(e,t){var n,i=1;function r(){var r,o,a=n.length,s=0,l=0;for(r=0;r<a;++r)s+=(o=n[r]).x,l+=o.y;for(s=(s/a-e)*i,l=(l/a-t)*i,r=0;r<a;++r)(o=n[r]).x-=s,o.y-=l}return null==e&&(e=0),null==t&&(t=0),r.initialize=function(e){n=e},r.x=function(t){return arguments.length?(e=+t,r):e},r.y=function(e){return arguments.length?(t=+e,r):t},r.strength=function(e){return arguments.length?(i=+e,r):i},r},collide:function(e){var t,n,i,r=1,o=1;function a(){for(var e,a,l,u,c,f,d,h=t.length,p=0;p<o;++p)for(a=qx(t,Xx,Yx).visitAfter(s),e=0;e<h;++e)l=t[e],f=n[l.index],d=f*f,u=l.x+l.vx,c=l.y+l.vy,a.visit(m);function m(e,t,n,o,a){var s=e.data,h=e.r,p=f+h;if(!s)return t>u+p||o<u-p||n>c+p||a<c-p;if(s.index>l.index){var m=u-s.x-s.vx,g=c-s.y-s.vy,y=m*m+g*g;y<p*p&&(0===m&&(y+=(m=Vx(i))*m),0===g&&(y+=(g=Vx(i))*g),y=(p-(y=Math.sqrt(y)))/y*r,l.vx+=(m*=y)*(p=(h*=h)/(d+h)),l.vy+=(g*=y)*p,s.vx-=m*(p=1-p),s.vy-=g*p)}}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function l(){if(t){var i,r,o=t.length;for(n=new Array(o),i=0;i<o;++i)r=t[i],n[r.index]=+e(r,i,t)}}return"function"!=typeof e&&(e=Gx(null==e?1:+e)),a.initialize=function(e,n){t=e,i=n,l()},a.iterations=function(e){return arguments.length?(o=+e,a):o},a.strength=function(e){return arguments.length?(r=+e,a):r},a.radius=function(t){return arguments.length?(e="function"==typeof t?t:Gx(+t),l(),a):e},a},nbody:function(){var e,t,n,i,r,o=Gx(-30),a=1,s=1/0,l=.81;function u(n){var r,o=e.length,a=qx(e,Zx,ew).visitAfter(f);for(i=n,r=0;r<o;++r)t=e[r],a.visit(d)}function c(){if(e){var t,n,i=e.length;for(r=new Array(i),t=0;t<i;++t)n=e[t],r[n.index]=+o(n,t,e)}}function f(e){var t,n,i,o,a,s=0,l=0;if(e.length){for(i=o=a=0;a<4;++a)(t=e[a])&&(n=Math.abs(t.value))&&(s+=t.value,l+=n,i+=n*t.x,o+=n*t.y);e.x=i/l,e.y=o/l}else{(t=e).x=t.data.x,t.y=t.data.y;do{s+=r[t.data.index]}while(t=t.next)}e.value=s}function d(e,o,u,c){if(!e.value)return!0;var f=e.x-t.x,d=e.y-t.y,h=c-o,p=f*f+d*d;if(h*h/l<p)return p<s&&(0===f&&(p+=(f=Vx(n))*f),0===d&&(p+=(d=Vx(n))*d),p<a&&(p=Math.sqrt(a*p)),t.vx+=f*e.value*i/p,t.vy+=d*e.value*i/p),!0;if(!(e.length||p>=s)){(e.data!==t||e.next)&&(0===f&&(p+=(f=Vx(n))*f),0===d&&(p+=(d=Vx(n))*d),p<a&&(p=Math.sqrt(a*p)));do{e.data!==t&&(h=r[e.data.index]*i/p,t.vx+=f*h,t.vy+=d*h)}while(e=e.next)}}return u.initialize=function(t,i){e=t,n=i,c()},u.strength=function(e){return arguments.length?(o="function"==typeof e?e:Gx(+e),c(),u):o},u.distanceMin=function(e){return arguments.length?(a=e*e,u):Math.sqrt(a)},u.distanceMax=function(e){return arguments.length?(s=e*e,u):Math.sqrt(s)},u.theta=function(e){return arguments.length?(l=e*e,u):Math.sqrt(l)},u},link:function(e){var t,n,i,r,o,a,s=Jx,l=function(e){return 1/Math.min(r[e.source.index],r[e.target.index])},u=Gx(30),c=1;function f(i){for(var r=0,s=e.length;r<c;++r)for(var l,u,f,d,h,p,m,g=0;g<s;++g)u=(l=e[g]).source,d=(f=l.target).x+f.vx-u.x-u.vx||Vx(a),h=f.y+f.vy-u.y-u.vy||Vx(a),d*=p=((p=Math.sqrt(d*d+h*h))-n[g])/p*i*t[g],h*=p,f.vx-=d*(m=o[g]),f.vy-=h*m,u.vx+=d*(m=1-m),u.vy+=h*m}function d(){if(i){var a,l,u=i.length,c=e.length,f=new Map(i.map(((e,t)=>[s(e,t,i),e])));for(a=0,r=new Array(u);a<c;++a)(l=e[a]).index=a,"object"!=typeof l.source&&(l.source=Qx(f,l.source)),"object"!=typeof l.target&&(l.target=Qx(f,l.target)),r[l.source.index]=(r[l.source.index]||0)+1,r[l.target.index]=(r[l.target.index]||0)+1;for(a=0,o=new Array(c);a<c;++a)l=e[a],o[a]=r[l.source.index]/(r[l.source.index]+r[l.target.index]);t=new Array(c),h(),n=new Array(c),p()}}function h(){if(i)for(var n=0,r=e.length;n<r;++n)t[n]=+l(e[n],n,e)}function p(){if(i)for(var t=0,r=e.length;t<r;++t)n[t]=+u(e[t],t,e)}return null==e&&(e=[]),f.initialize=function(e,t){i=e,a=t,d()},f.links=function(t){return arguments.length?(e=t,d(),f):e},f.id=function(e){return arguments.length?(s=e,f):s},f.iterations=function(e){return arguments.length?(c=+e,f):c},f.strength=function(e){return arguments.length?(l="function"==typeof e?e:Gx(+e),h(),f):l},f.distance=function(e){return arguments.length?(u="function"==typeof e?e:Gx(+e),p(),f):u},f},x:function(e){var t,n,i,r=Gx(.1);function o(e){for(var r,o=0,a=t.length;o<a;++o)(r=t[o]).vx+=(i[o]-r.x)*n[o]*e}function a(){if(t){var o,a=t.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return"function"!=typeof e&&(e=Gx(null==e?0:+e)),o.initialize=function(e){t=e,a()},o.strength=function(e){return arguments.length?(r="function"==typeof e?e:Gx(+e),a(),o):r},o.x=function(t){return arguments.length?(e="function"==typeof t?t:Gx(+t),a(),o):e},o},y:function(e){var t,n,i,r=Gx(.1);function o(e){for(var r,o=0,a=t.length;o<a;++o)(r=t[o]).vy+=(i[o]-r.y)*n[o]*e}function a(){if(t){var o,a=t.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return"function"!=typeof e&&(e=Gx(null==e?0:+e)),o.initialize=function(e){t=e,a()},o.strength=function(e){return arguments.length?(r="function"==typeof e?e:Gx(+e),a(),o):r},o.y=function(t){return arguments.length?(e="function"==typeof t?t:Gx(+t),a(),o):e},o}},rw="forces",ow=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],aw=["static","iterations"],sw=["x","y","vx","vy"];function lw(e){Xr.call(this,null,e)}function uw(e,t,n,i){var o,a,s,l,u=r(t.forces);for(o=0,a=ow.length;o<a;++o)(s=ow[o])!==rw&&t.modified(s)&&e[s](t[s]);for(o=0,a=u.length;o<a;++o)l=rw+o,(s=n||t.modified(rw,o)?fw(u[o]):i&&cw(u[o],i)?e.force(l):null)&&e.force(l,s);for(a=e.numForces||0;o<a;++o)e.force(rw+o,null);return e.numForces=u.length,e}function cw(e,t){var n,i;for(n in e)if(o(i=e[n])&&t.modified(_(i)))return 1;return 0}function fw(e){var t,n;for(n in m(iw,e.force)||s("Unrecognized force: "+e.force),t=iw[e.force](),e)o(t[n])&&dw(t[n],e[n],e);return t}function dw(e,t,n){e(o(t)?e=>t(e,n):t)}lw.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:sw}]},i(lw,Xr,{transform(e,t){var n,i,r=this.value,o=t.changed(t.ADD_REM),a=e.modified(ow),s=e.iterations||300;if(r?(o&&(t.modifies("index"),r.nodes(t.source)),(a||t.changed(t.MOD))&&uw(r,e,0,t)):(this.value=r=function(e,t){const n=nw(e),i=n.stop,r=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,r()),n.stop=()=>(o=!0,i()),uw(n,t,!0).on("end",(()=>o=!0))}(t.source,e),r.on("tick",(n=t.dataflow,i=this,()=>n.touch(i).run())),e.static||(o=!0,r.tick()),t.modifies("index")),a||o||e.modified(aw)||t.changed()&&e.restart)if(r.alpha(Math.max(r.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(r.alphaMin(),1/s)),e.static)for(r.stop();--s>=0;)r.tick();else if(r.stopped()&&r.restart(),!o)return t.StopPropagation;return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let s,l=this._argops,u=0,c=l.length;u<c;++u)if(s=l[u],s.name===rw&&"link"===s.op._argval.force)for(var i,r=s.op._argops,o=0,a=r.length;o<a;++o)if("links"===r[o].name&&(i=r[o].op.source)){n.pulse(i,n.changeset().reflow());break}return t.reflow(e.modified()).modifies(sw)}});const hw=Object.freeze(Object.defineProperty({__proto__:null,force:lw},Symbol.toStringTag,{value:"Module"}));function pw(e,t){return e.parent===t.parent?1:2}function mw(e,t){return e+t.x}function gw(e,t){return Math.max(e,t.y)}function yw(e){var t=0,n=e.children,i=n&&n.length;if(i)for(;--i>=0;)t+=n[i].value;else t=1;e.value=t}function vw(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=xw)):void 0===t&&(t=bw);for(var n,i,r,o,a,s=new kw(e),l=[s];n=l.pop();)if((r=t(n.data))&&(a=(r=Array.from(r)).length))for(n.children=r,o=a-1;o>=0;--o)l.push(i=r[o]=new kw(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(_w)}function bw(e){return e.children}function xw(e){return Array.isArray(e)?e[1]:null}function ww(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function _w(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function kw(e){this.data=e,this.depth=this.height=0,this.parent=null}function Ew(e){return null==e?null:$w(e)}function $w(e){if("function"!=typeof e)throw new Error;return e}function Aw(){return 0}function Dw(e){return function(){return e}}kw.prototype=vw.prototype={constructor:kw,count:function(){return this.eachAfter(yw)},each:function(e,t){let n=-1;for(const i of this)e.call(t,i,++n,this);return this},eachAfter:function(e,t){for(var n,i,r,o=this,a=[o],s=[],l=-1;o=a.pop();)if(s.push(o),n=o.children)for(i=0,r=n.length;i<r;++i)a.push(n[i]);for(;o=s.pop();)e.call(t,o,++l,this);return this},eachBefore:function(e,t){for(var n,i,r=this,o=[r],a=-1;r=o.pop();)if(e.call(t,r,++a,this),n=r.children)for(i=n.length-1;i>=0;--i)o.push(n[i]);return this},find:function(e,t){let n=-1;for(const i of this)if(e.call(t,i,++n,this))return i},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,i=t.children,r=i&&i.length;--r>=0;)n+=i[r].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),i=t.ancestors(),r=null;e=n.pop(),t=i.pop();for(;e===t;)r=e,e=n.pop(),t=i.pop();return r}(t,e),i=[t];t!==n;)t=t.parent,i.push(t);for(var r=i.length;e!==n;)i.splice(r,0,e),e=e.parent;return i},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return vw(this).eachBefore(ww)},[Symbol.iterator]:function*(){var e,t,n,i,r=this,o=[r];do{for(e=o.reverse(),o=[];r=e.pop();)if(yield r,t=r.children)for(n=0,i=t.length;n<i;++n)o.push(t[n])}while(o.length)}};const Sw=4294967296;function Fw(e,t){var n,i;if(Ow(t,e))return[t];for(n=0;n<e.length;++n)if(Cw(t,e[n])&&Ow(Nw(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(i=n+1;i<e.length;++i)if(Cw(Nw(e[n],e[i]),t)&&Cw(Nw(e[n],t),e[i])&&Cw(Nw(e[i],t),e[n])&&Ow(Rw(e[n],e[i],t),e))return[e[n],e[i],t];throw new Error}function Cw(e,t){var n=e.r-t.r,i=t.x-e.x,r=t.y-e.y;return n<0||n*n<i*i+r*r}function Mw(e,t){var n=e.r-t.r+1e-9*Math.max(e.r,t.r,1),i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function Ow(e,t){for(var n=0;n<t.length;++n)if(!Mw(e,t[n]))return!1;return!0}function zw(e){switch(e.length){case 1:return{x:(t=e[0]).x,y:t.y,r:t.r};case 2:return Nw(e[0],e[1]);case 3:return Rw(e[0],e[1],e[2])}var t}function Nw(e,t){var n=e.x,i=e.y,r=e.r,o=t.x,a=t.y,s=t.r,l=o-n,u=a-i,c=s-r,f=Math.sqrt(l*l+u*u);return{x:(n+o+l/f*c)/2,y:(i+a+u/f*c)/2,r:(f+r+s)/2}}function Rw(e,t,n){var i=e.x,r=e.y,o=e.r,a=t.x,s=t.y,l=t.r,u=n.x,c=n.y,f=n.r,d=i-a,h=i-u,p=r-s,m=r-c,g=l-o,y=f-o,v=i*i+r*r-o*o,b=v-a*a-s*s+l*l,x=v-u*u-c*c+f*f,w=h*p-d*m,_=(p*x-m*b)/(2*w)-i,k=(m*g-p*y)/w,E=(h*b-d*x)/(2*w)-r,$=(d*y-h*g)/w,A=k*k+$*$-1,D=2*(o+_*k+E*$),S=_*_+E*E-o*o,F=-(Math.abs(A)>1e-6?(D+Math.sqrt(D*D-4*A*S))/(2*A):S/D);return{x:i+_+k*F,y:r+E+$*F,r:F}}function Tw(e,t,n){var i,r,o,a,s=e.x-t.x,l=e.y-t.y,u=s*s+l*l;u?(r=t.r+n.r,r*=r,a=e.r+n.r,r>(a*=a)?(i=(u+a-r)/(2*u),o=Math.sqrt(Math.max(0,a/u-i*i)),n.x=e.x-i*s-o*l,n.y=e.y-i*l+o*s):(i=(u+r-a)/(2*u),o=Math.sqrt(Math.max(0,r/u-i*i)),n.x=t.x+i*s-o*l,n.y=t.y+i*l+o*s)):(n.x=t.x+n.r,n.y=t.y)}function Pw(e,t){var n=e.r+t.r-1e-6,i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function Lw(e){var t=e._,n=e.next._,i=t.r+n.r,r=(t.x*n.r+n.x*t.r)/i,o=(t.y*n.r+n.y*t.r)/i;return r*r+o*o}function Bw(e){this._=e,this.next=null,this.previous=null}function jw(e,t){if(!(o=(e=function(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(e)).length))return 0;var n,i,r,o,a,s,l,u,c,f,d;if((n=e[0]).x=0,n.y=0,!(o>1))return n.r;if(i=e[1],n.x=-i.r,i.x=n.r,i.y=0,!(o>2))return n.r+i.r;Tw(i,n,r=e[2]),n=new Bw(n),i=new Bw(i),r=new Bw(r),n.next=r.previous=i,i.next=n.previous=r,r.next=i.previous=n;e:for(l=3;l<o;++l){Tw(n._,i._,r=e[l]),r=new Bw(r),u=i.next,c=n.previous,f=i._.r,d=n._.r;do{if(f<=d){if(Pw(u._,r._)){i=u,n.next=i,i.previous=n,--l;continue e}f+=u._.r,u=u.next}else{if(Pw(c._,r._)){(n=c).next=i,i.previous=n,--l;continue e}d+=c._.r,c=c.previous}}while(u!==c.next);for(r.previous=n,r.next=i,n.next=i.previous=i=r,a=Lw(n);(r=r.next)!==i;)(s=Lw(r))<a&&(n=r,a=s);i=n.next}for(n=[i._],r=i;(r=r.next)!==i;)n.push(r._);for(r=function(e,t){for(var n,i,r=0,o=(e=function(e,t){let n,i,r=e.length;for(;r;)i=t()*r--|0,n=e[r],e[r]=e[i],e[i]=n;return e}(Array.from(e),t)).length,a=[];r<o;)n=e[r],i&&Mw(i,n)?++r:(i=zw(a=Fw(a,n)),r=0);return i}(n,t),l=0;l<o;++l)(n=e[l]).x-=r.x,n.y-=r.y;return r.r}function Iw(e){return Math.sqrt(e.value)}function qw(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function Uw(e,t,n){return function(i){if(r=i.children){var r,o,a,s=r.length,l=e(i)*t||0;if(l)for(o=0;o<s;++o)r[o].r+=l;if(a=jw(r,n),l)for(o=0;o<s;++o)r[o].r-=l;i.r=a+l}}}function Ww(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function Hw(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Gw(e,t,n,i,r){for(var o,a=e.children,s=-1,l=a.length,u=e.value&&(i-t)/e.value;++s<l;)(o=a[s]).y0=n,o.y1=r,o.x0=t,o.x1=t+=o.value*u}var Vw={depth:-1},Xw={},Yw={};function Jw(e){return e.id}function Qw(e){return e.parentId}function Kw(){var e,t=Jw,n=Qw;function i(i){var r,o,a,s,l,u,c,f,d=Array.from(i),h=t,p=n,m=new Map;if(null!=e){const t=d.map(((t,n)=>function(e){e=`${e}`;let t=e.length;e_(e,t-1)&&!e_(e,t-2)&&(e=e.slice(0,-1));return"/"===e[0]?e:`/${e}`}(e(t,n,i)))),n=t.map(Zw),r=new Set(t).add("");for(const e of n)r.has(e)||(r.add(e),t.push(e),n.push(Zw(e)),d.push(Yw));h=(e,n)=>t[n],p=(e,t)=>n[t]}for(a=0,r=d.length;a<r;++a)o=d[a],u=d[a]=new kw(o),null!=(c=h(o,a,i))&&(c+="")&&(f=u.id=c,m.set(f,m.has(f)?Xw:u)),null!=(c=p(o,a,i))&&(c+="")&&(u.parent=c);for(a=0;a<r;++a)if(c=(u=d[a]).parent){if(!(l=m.get(c)))throw new Error("missing: "+c);if(l===Xw)throw new Error("ambiguous: "+c);l.children?l.children.push(u):l.children=[u],u.parent=l}else{if(s)throw new Error("multiple roots");s=u}if(!s)throw new Error("no root");if(null!=e){for(;s.data===Yw&&1===s.children.length;)s=s.children[0],--r;for(let e=d.length-1;e>=0&&(u=d[e]).data===Yw;--e)u.data=null}if(s.parent=Vw,s.eachBefore((function(e){e.depth=e.parent.depth+1,--r})).eachBefore(_w),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(e){return arguments.length?(t=Ew(e),i):t},i.parentId=function(e){return arguments.length?(n=Ew(e),i):n},i.path=function(t){return arguments.length?(e=Ew(t),i):e},i}function Zw(e){let t=e.length;if(t<2)return"";for(;--t>1&&!e_(e,t););return e.slice(0,t)}function e_(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(!(1&n))return!0}return!1}function t_(e,t){return e.parent===t.parent?1:2}function n_(e){var t=e.children;return t?t[0]:e.t}function i_(e){var t=e.children;return t?t[t.length-1]:e.t}function r_(e,t,n){var i=n/(t.i-e.i);t.c-=i,t.s+=n,e.c+=i,t.z+=n,t.m+=n}function o_(e,t,n){return e.a.parent===t.parent?e.a:n}function a_(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function s_(e,t,n,i,r){for(var o,a=e.children,s=-1,l=a.length,u=e.value&&(r-n)/e.value;++s<l;)(o=a[s]).x0=t,o.x1=i,o.y0=n,o.y1=n+=o.value*u}a_.prototype=Object.create(kw.prototype);var l_=(1+Math.sqrt(5))/2;function u_(e,t,n,i,r,o){for(var a,s,l,u,c,f,d,h,p,m,g,y=[],v=t.children,b=0,x=0,w=v.length,_=t.value;b<w;){l=r-n,u=o-i;do{c=v[x++].value}while(!c&&x<w);for(f=d=c,g=c*c*(m=Math.max(u/l,l/u)/(_*e)),p=Math.max(d/g,g/f);x<w;++x){if(c+=s=v[x].value,s<f&&(f=s),s>d&&(d=s),g=c*c*m,(h=Math.max(d/g,g/f))>p){c-=s;break}p=h}y.push(a={value:c,dice:l<u,children:v.slice(b,x)}),a.dice?Gw(a,n,i,r,_?i+=u*c/_:o):s_(a,n,i,_?n+=l*c/_:r,o),_-=c,b=x}return y}const c_=function e(t){function n(e,n,i,r,o){u_(t,e,n,i,r,o)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n}(l_);const f_=function e(t){function n(e,n,i,r,o){if((a=e._squarify)&&a.ratio===t)for(var a,s,l,u,c,f=-1,d=a.length,h=e.value;++f<d;){for(l=(s=a[f]).children,u=s.value=0,c=l.length;u<c;++u)s.value+=l[u].value;s.dice?Gw(s,n,i,r,h?i+=(o-i)*s.value/h:o):s_(s,n,i,h?n+=(r-n)*s.value/h:r,o),h-=s.value}else e._squarify=a=u_(t,e,n,i,r,o),a.ratio=t}return n.ratio=function(t){return e((t=+t)>1?t:1)},n}(l_);function d_(e,t,n){const i={};return e.each((e=>{const r=e.data;n(r)&&(i[t(r)]=e)})),e.lookup=i,e}function h_(e){Xr.call(this,null,e)}h_.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const p_=e=>e.values;function m_(){const e=[],t={entries:e=>i(n(e,0),0),key:n=>(e.push(n),t)};function n(t,i){if(i>=e.length)return t;const r=t.length,o=e[i++],a={},s={};let l,u,c,f=-1;for(;++f<r;)l=o(u=t[f])+"",(c=a[l])?c.push(u):a[l]=[u];for(l in a)s[l]=n(a[l],i);return s}function i(t,n){if(++n>e.length)return t;const r=[];for(const e in t)r.push({key:e,values:i(t[e],n)});return r}return t}function g_(e){Xr.call(this,null,e)}i(h_,Xr,{transform(e,t){t.source||s("Nest transform requires an upstream data source.");var n=e.generate,i=e.modified(),o=t.clone(),a=this.value;return(!a||i||t.changed())&&(a&&a.each((e=>{e.children&&pr(e.data)&&o.rem.push(e.data)})),this.value=a=vw({values:r(e.keys).reduce(((e,t)=>(e.key(t),e)),m_()).entries(o.source)},p_),n&&a.each((e=>{e.children&&(e=yr(e.data),o.add.push(e),o.source.push(e))})),d_(a,mr,mr)),o.source.root=a,o}});const y_=(e,t)=>e.parent===t.parent?1:2;i(g_,Xr,{transform(e,t){t.source&&t.source.root||s(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),i=this.fields,r=t.source.root,o=e.as||i;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(wr(e.sort,(e=>e.data))),function(e,t,n){for(let i,r=0,o=t.length;r<o;++r)i=t[r],i in n&&e[i](n[i])}(n,this.params,e),n.separation&&n.separation(!1!==e.separation?y_:le);try{this.value=n(r)}catch(a){s(a)}return r.each((e=>function(e,t,n){const i=e.data,r=t.length-1;for(let o=0;o<r;++o)i[n[o]]=e[t[o]];i[n[r]]=e.children?e.children.length:0}(e,i,o))),t.reflow(e.modified()).modifies(o).modifies("leaf")}});const v_=["x","y","r","depth","children"];function b_(e){g_.call(this,e)}b_.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:v_.length,default:v_}]},i(b_,g_,{layout:function(){var e=null,t=1,n=1,i=Aw;function r(r){const o=function(){let e=1;return()=>(e=(1664525*e+1013904223)%Sw)/Sw}();return r.x=t/2,r.y=n/2,e?r.eachBefore(qw(e)).eachAfter(Uw(i,.5,o)).eachBefore(Ww(1)):r.eachBefore(qw(Iw)).eachAfter(Uw(Aw,1,o)).eachAfter(Uw(i,r.r/Math.min(t,n),o)).eachBefore(Ww(Math.min(t,n)/(2*r.r))),r}return r.radius=function(t){return arguments.length?(e=Ew(t),r):e},r.size=function(e){return arguments.length?(t=+e[0],n=+e[1],r):[t,n]},r.padding=function(e){return arguments.length?(i="function"==typeof e?e:Dw(+e),r):i},r},params:["radius","size","padding"],fields:v_});const x_=["x0","y0","x1","y1","depth","children"];function w_(e){g_.call(this,e)}function __(e){Xr.call(this,null,e)}w_.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:x_.length,default:x_}]},i(w_,g_,{layout:function(){var e=1,t=1,n=0,i=!1;function r(r){var o=r.height+1;return r.x0=r.y0=n,r.x1=e,r.y1=t/o,r.eachBefore(function(e,t){return function(i){i.children&&Gw(i,i.x0,e*(i.depth+1)/t,i.x1,e*(i.depth+2)/t);var r=i.x0,o=i.y0,a=i.x1-n,s=i.y1-n;a<r&&(r=a=(r+a)/2),s<o&&(o=s=(o+s)/2),i.x0=r,i.y0=o,i.x1=a,i.y1=s}}(t,o)),i&&r.eachBefore(Hw),r}return r.round=function(e){return arguments.length?(i=!!e,r):i},r.size=function(n){return arguments.length?(e=+n[0],t=+n[1],r):[e,t]},r.padding=function(e){return arguments.length?(n=+e,r):n},r},params:["size","round","padding"],fields:x_}),__.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},i(__,Xr,{transform(e,t){t.source||s("Stratify transform requires an upstream data source.");let n=this.value;const i=e.modified(),r=t.fork(t.ALL).materialize(t.SOURCE),o=!n||i||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return r.source=r.source.slice(),o&&(n=r.source.length?d_(Kw().id(e.key).parentId(e.parentKey)(r.source),e.key,l):d_(Kw()([{}]),e.key,e.key)),r.source.root=this.value=n,r}});const k_={tidy:function(){var e=t_,t=1,n=1,i=null;function r(r){var l=function(e){for(var t,n,i,r,o,a=new a_(e,0),s=[a];t=s.pop();)if(i=t._.children)for(t.children=new Array(o=i.length),r=o-1;r>=0;--r)s.push(n=t.children[r]=new a_(i[r],r)),n.parent=t;return(a.parent=new a_(null,0)).children=[a],a}(r);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(a),i)r.eachBefore(s);else{var u=r,c=r,f=r;r.eachBefore((function(e){e.x<u.x&&(u=e),e.x>c.x&&(c=e),e.depth>f.depth&&(f=e)}));var d=u===c?1:e(u,c)/2,h=d-u.x,p=t/(c.x+d+h),m=n/(f.depth||1);r.eachBefore((function(e){e.x=(e.x+h)*p,e.y=e.depth*m}))}return r}function o(t){var n=t.children,i=t.parent.children,r=t.i?i[t.i-1]:null;if(n){!function(e){for(var t,n=0,i=0,r=e.children,o=r.length;--o>=0;)(t=r[o]).z+=n,t.m+=n,n+=t.s+(i+=t.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;r?(t.z=r.z+e(t._,r._),t.m=t.z-o):t.z=o}else r&&(t.z=r.z+e(t._,r._));t.parent.A=function(t,n,i){if(n){for(var r,o=t,a=t,s=n,l=o.parent.children[0],u=o.m,c=a.m,f=s.m,d=l.m;s=i_(s),o=n_(o),s&&o;)l=n_(l),(a=i_(a)).a=t,(r=s.z+f-o.z-u+e(s._,o._))>0&&(r_(o_(s,t,i),t,r),u+=r,c+=r),f+=s.m,u+=o.m,d+=l.m,c+=a.m;s&&!i_(a)&&(a.t=s,a.m+=f-c),o&&!n_(l)&&(l.t=o,l.m+=u-d,i=t)}return i}(t,r,t.parent.A||i[0])}function a(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=t,e.y=e.depth*n}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r},cluster:function(){var e=pw,t=1,n=1,i=!1;function r(r){var o,a=0;r.eachAfter((function(t){var n=t.children;n?(t.x=function(e){return e.reduce(mw,0)/e.length}(n),t.y=function(e){return 1+e.reduce(gw,0)}(n)):(t.x=o?a+=e(t,o):0,t.y=0,o=t)}));var s=function(e){for(var t;t=e.children;)e=t[0];return e}(r),l=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(r),u=s.x-e(s,l)/2,c=l.x+e(l,s)/2;return r.eachAfter(i?function(e){e.x=(e.x-r.x)*t,e.y=(r.y-e.y)*n}:function(e){e.x=(e.x-u)/(c-u)*t,e.y=(1-(r.y?e.y/r.y:1))*n})}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r}},E_=["x","y","depth","children"];function $_(e){g_.call(this,e)}function A_(e){Xr.call(this,[],e)}$_.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:E_.length,default:E_}]},i($_,g_,{layout(e){const t=e||"tidy";if(m(k_,t))return k_[t]();s("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:E_}),A_.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},i(A_,Xr,{transform(e,t){const n=this.value,i=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),o={};return i||s("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,(e=>o[mr(e)]=1)),i.each((e=>{const t=e.data,n=e.parent&&e.parent.data;n&&o[mr(t)]&&o[mr(n)]&&r.add.push(yr({source:n,target:t}))})),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,(e=>o[mr(e)]=1)),n.forEach((e=>{(o[mr(e.source)]||o[mr(e.target)])&&r.mod.push(e)}))),r}});const D_={binary:function(e,t,n,i,r){var o,a,s=e.children,l=s.length,u=new Array(l+1);for(u[0]=a=o=0;o<l;++o)u[o+1]=a+=s[o].value;!function e(t,n,i,r,o,a,l){if(t>=n-1){var c=s[t];return c.x0=r,c.y0=o,c.x1=a,void(c.y1=l)}var f=u[t],d=i/2+f,h=t+1,p=n-1;for(;h<p;){var m=h+p>>>1;u[m]<d?h=m+1:p=m}d-u[h-1]<u[h]-d&&t+1<h&&--h;var g=u[h]-f,y=i-g;if(a-r>l-o){var v=i?(r*y+a*g)/i:a;e(t,h,g,r,o,v,l),e(h,n,y,v,o,a,l)}else{var b=i?(o*y+l*g)/i:l;e(t,h,g,r,o,a,b),e(h,n,y,r,b,a,l)}}(0,l,e.value,t,n,i,r)},dice:Gw,slice:s_,slicedice:function(e,t,n,i,r){(1&e.depth?s_:Gw)(e,t,n,i,r)},squarify:c_,resquarify:f_},S_=["x0","y0","x1","y1","depth","children"];function F_(e){g_.call(this,e)}F_.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:S_.length,default:S_}]},i(F_,g_,{layout(){const e=function(){var e=c_,t=!1,n=1,i=1,r=[0],o=Aw,a=Aw,s=Aw,l=Aw,u=Aw;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=i,e.eachBefore(f),r=[0],t&&e.eachBefore(Hw),e}function f(t){var n=r[t.depth],i=t.x0+n,c=t.y0+n,f=t.x1-n,d=t.y1-n;f<i&&(i=f=(i+f)/2),d<c&&(c=d=(c+d)/2),t.x0=i,t.y0=c,t.x1=f,t.y1=d,t.children&&(n=r[t.depth+1]=o(t)/2,i+=u(t)-n,c+=a(t)-n,(f-=s(t)-n)<i&&(i=f=(i+f)/2),(d-=l(t)-n)<c&&(c=d=(c+d)/2),e(t,i,c,f,d))}return c.round=function(e){return arguments.length?(t=!!e,c):t},c.size=function(e){return arguments.length?(n=+e[0],i=+e[1],c):[n,i]},c.tile=function(t){return arguments.length?(e=$w(t),c):e},c.padding=function(e){return arguments.length?c.paddingInner(e).paddingOuter(e):c.paddingInner()},c.paddingInner=function(e){return arguments.length?(o="function"==typeof e?e:Dw(+e),c):o},c.paddingOuter=function(e){return arguments.length?c.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):c.paddingTop()},c.paddingTop=function(e){return arguments.length?(a="function"==typeof e?e:Dw(+e),c):a},c.paddingRight=function(e){return arguments.length?(s="function"==typeof e?e:Dw(+e),c):s},c.paddingBottom=function(e){return arguments.length?(l="function"==typeof e?e:Dw(+e),c):l},c.paddingLeft=function(e){return arguments.length?(u="function"==typeof e?e:Dw(+e),c):u},c}();return e.ratio=t=>{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{m(D_,t)?e.tile(D_[t]):s("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:S_});const C_=Object.freeze(Object.defineProperty({__proto__:null,nest:h_,pack:b_,partition:w_,stratify:__,tree:$_,treelinks:A_,treemap:F_},Symbol.toStringTag,{value:"Module"})),M_=4278190080;function O_(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function z_(e,t,n){if(!t.length)return;const i=t[0].mark.marktype;"group"===i?t.forEach((t=>{t.items.forEach((t=>z_(e,t.items,n)))})):ud[i].draw(e,{items:n?t.map(N_):t})}function N_(e){const t=br(e,{});return t.stroke&&0!==t.strokeOpacity||t.fill&&0!==t.fillOpacity?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const R_=31,T_=new Uint32Array(33),P_=new Uint32Array(33);P_[0]=0,T_[0]=~P_[0];for(let bJ=1;bJ<=32;++bJ)P_[bJ]=P_[bJ-1]<<1|1,T_[bJ]=~P_[bJ];function L_(e,t,n){const i=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+i)/i),o=~~((t+2*n+i)/i),a=e=>~~((e+n)/i);return a.invert=e=>e*i-n,a.bitmap=()=>function(e,t){const n=new Uint32Array(~~((e*t+32)/32));function i(e,t){n[e]|=t}function r(e,t){n[e]&=t}return{array:n,get:(t,i)=>{const r=i*e+t;return n[r>>>5]&1<<(r&R_)},set:(t,n)=>{const r=n*e+t;i(r>>>5,1<<(r&R_))},clear:(t,n)=>{const i=n*e+t;r(i>>>5,~(1<<(i&R_)))},getRange:(t,i,r,o)=>{let a,s,l,u,c=o;for(;c>=i;--c)if(a=c*e+t,s=c*e+r,l=a>>>5,u=s>>>5,l===u){if(n[l]&T_[a&R_]&P_[1+(s&R_)])return!0}else{if(n[l]&T_[a&R_])return!0;if(n[u]&P_[1+(s&R_)])return!0;for(let e=l+1;e<u;++e)if(n[e])return!0}return!1},setRange:(t,n,r,o)=>{let a,s,l,u,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+r,l=a>>>5,u=s>>>5,l===u)i(l,T_[a&R_]&P_[1+(s&R_)]);else for(i(l,T_[a&R_]),i(u,P_[1+(s&R_)]),c=l+1;c<u;++c)i(c,4294967295)},clearRange:(t,n,i,o)=>{let a,s,l,u,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+i,l=a>>>5,u=s>>>5,l===u)r(l,P_[a&R_]|T_[1+(s&R_)]);else for(r(l,P_[a&R_]),r(u,T_[1+(s&R_)]),c=l+1;c<u;++c)r(c,0)},outOfBounds:(n,i,r,o)=>n<0||i<0||o>=t||r>=e}}(r,o),a.ratio=i,a.padding=n,a.width=e,a.height=t,a}function B_(e,t,n,i,r,o){let a=n/2;return e-a<0||e+a>r||t-(a=i/2)<0||t+a>o}function j_(e,t,n,i,r,o,a,s){const l=r*o/(2*i),u=e(t-l),c=e(t+l),f=e(n-(o/=2)),d=e(n+o);return a.outOfBounds(u,f,c,d)||a.getRange(u,f,c,d)||s&&s.getRange(u,f,c,d)}const I_=[-1,-1,1,1],q_=[-1,1,-1,1];const U_=["right","center","left"],W_=["bottom","middle","top"];function H_(e,t,n,i,r,o,a,s,l,u,c,f){return!(r.outOfBounds(e,n,t,i)||(f&&o||r).getRange(e,n,t,i))}const G_={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},V_={naive:function(e,t,n,i){const r=e.width,o=e.height;return function(e){const t=e.datum.datum.items[i].items,n=t.length,a=e.datum.fontSize,s=Wf.width(e.datum,e.datum.text);let l,u,c,f,d,h,p,m=0;for(let i=0;i<n;++i)l=t[i].x,c=t[i].y,u=void 0===t[i].x2?l:t[i].x2,f=void 0===t[i].y2?c:t[i].y2,d=(l+u)/2,h=(c+f)/2,p=Math.abs(u-l+f-c),p>=m&&(m=p,e.x=d,e.y=h);return d=s/2,h=a/2,l=e.x-d,u=e.x+d,c=e.y-h,f=e.y+h,e.align="center",l<0&&u<=r?e.align="left":0<=l&&r<u&&(e.align="right"),e.baseline="middle",c<0&&f<=o?e.baseline="top":0<=c&&o<f&&(e.baseline="bottom"),!0}},"reduced-search":function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1];function l(t,n,i,l,u){const c=e.invert(t),f=e.invert(n);let d,h=i,p=o;if(!B_(c,f,l,u,r,o)&&!j_(e,c,f,u,l,h,a,s)&&!j_(e,c,f,u,l,u,a,null)){for(;p-h>=1;)d=(h+p)/2,j_(e,c,f,u,l,d,a,s)?p=d:h=d;if(h>i)return[c,f,h,!0]}}return function(t){const s=t.datum.datum.items[i].items,u=s.length,c=t.datum.fontSize,f=Wf.width(t.datum,t.datum.text);let d,h,p,m,g,y,v,b,x,w,_,k,E,$,A,D,S,F=n?c:0,C=!1,M=!1,O=0;for(let i=0;i<u;++i){for(d=s[i].x,p=s[i].y,h=void 0===s[i].x2?d:s[i].x2,m=void 0===s[i].y2?p:s[i].y2,d>h&&(S=d,d=h,h=S),p>m&&(S=p,p=m,m=S),x=e(d),_=e(h),w=~~((x+_)/2),k=e(p),$=e(m),E=~~((k+$)/2),v=w;v>=x;--v)for(b=E;b>=k;--b)D=l(v,b,F,f,c),D&&([t.x,t.y,F,C]=D);for(v=w;v<=_;++v)for(b=E;b<=$;++b)D=l(v,b,F,f,c),D&&([t.x,t.y,F,C]=D);C||n||(A=Math.abs(h-d+m-p),g=(d+h)/2,y=(p+m)/2,A>=O&&!B_(g,y,f,c,r,o)&&!j_(e,g,y,c,f,c,a,null)&&(O=A,t.x=g,t.y=y,M=!0))}return!(!C&&!M)&&(g=f/2,y=c/2,a.setRange(e(t.x-g),e(t.y-y),e(t.x+g),e(t.y+y)),t.align="center",t.baseline="middle",!0)}},floodfill:function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],l=e.bitmap();return function(t){const u=t.datum.datum.items[i].items,c=u.length,f=t.datum.fontSize,d=Wf.width(t.datum,t.datum.text),h=[];let p,m,g,y,v,b,x,w,_,k,E,$,A=n?f:0,D=!1,S=!1,F=0;for(let i=0;i<c;++i){for(p=u[i].x,g=u[i].y,m=void 0===u[i].x2?p:u[i].x2,y=void 0===u[i].y2?g:u[i].y2,h.push([e((p+m)/2),e((g+y)/2)]);h.length;)if([x,w]=h.pop(),!(a.get(x,w)||s.get(x,w)||l.get(x,w))){l.set(x,w);for(let e=0;e<4;++e)v=x+I_[e],b=w+q_[e],l.outOfBounds(v,b,v,b)||h.push([v,b]);if(v=e.invert(x),b=e.invert(w),_=A,k=o,!B_(v,b,d,f,r,o)&&!j_(e,v,b,f,d,_,a,s)&&!j_(e,v,b,f,d,f,a,null)){for(;k-_>=1;)E=(_+k)/2,j_(e,v,b,f,d,E,a,s)?k=E:_=E;_>A&&(t.x=v,t.y=b,A=_,D=!0)}}D||n||($=Math.abs(m-p+y-g),v=(p+m)/2,b=(g+y)/2,$>=F&&!B_(v,b,d,f,r,o)&&!j_(e,v,b,f,d,f,a,null)&&(F=$,t.x=v,t.y=b,S=!0))}return!(!D&&!S)&&(v=d/2,b=f/2,a.setRange(e(t.x-v),e(t.y-b),e(t.x+v),e(t.y+b)),t.align="center",t.baseline="middle",!0)}}};function X_(e,t,n,i,r,o,a,s,l,u,c){if(!e.length)return e;const f=Math.max(i.length,r.length),d=function(e,t){const n=new Float64Array(t),i=e.length;for(let r=0;r<i;++r)n[r]=e[r]||0;for(let r=i;r<t;++r)n[r]=n[i-1];return n}(i,f),h=function(e,t){const n=new Int8Array(t),i=e.length;for(let r=0;r<i;++r)n[r]|=G_[e[r]];for(let r=i;r<t;++r)n[r]=n[i-1];return n}(r,f),p=(x=e[0].datum)&&x.mark&&x.mark.marktype,m="group"===p&&e[0].datum.items[l].marktype,g="area"===m,y=function(e,t,n,i){const r=e=>[e.x,e.x,e.x,e.y,e.y,e.y];return e?"line"===e||"area"===e?e=>r(e.datum):"line"===t?e=>{const t=e.datum.items[i].items;return r(t.length?t["start"===n?0:t.length-1]:{x:NaN,y:NaN})}:e=>{const t=e.datum.bounds;return[t.x1,(t.x1+t.x2)/2,t.x2,t.y1,(t.y1+t.y2)/2,t.y2]}:r}(p,m,s,l),v=null===u||u===1/0,b=g&&"naive"===c;var x;let w=-1,_=-1;const k=e.map((e=>{const t=v?Wf.width(e,e.text):void 0;return w=Math.max(w,t),_=Math.max(_,e.fontSize),{datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(e),textWidth:t}}));u=null===u||u===1/0?Math.max(w,_)+Math.max(...i):u;const E=L_(t[0],t[1],u);let $;if(!b){n&&k.sort(((e,t)=>n(e.datum,t.datum)));let t=!1;for(let e=0;e<h.length&&!t;++e)t=5===h[e]||d[e]<0;const i=(p&&a||g)&&e.map((e=>e.datum));$=o.length||i?function(e,t,n,i,r){const o=e.width,a=e.height,s=i||r,l=xs(o,a).getContext("2d"),u=xs(o,a).getContext("2d"),c=s&&xs(o,a).getContext("2d");n.forEach((e=>z_(l,e,!1))),z_(u,t,!1),s&&z_(c,t,!0);const f=O_(l,o,a),d=O_(u,o,a),h=s&&O_(c,o,a),p=e.bitmap(),m=s&&e.bitmap();let g,y,v,b,x,w,_,k;for(y=0;y<a;++y)for(g=0;g<o;++g)x=y*o+g,w=f[x]&M_,k=d[x]&M_,_=s&&h[x]&M_,(w||_||k)&&(v=e(g),b=e(y),r||!w&&!k||p.set(v,b),s&&(w||_)&&m.set(v,b));return[p,m]}(E,i||[],o,t,g):function(e,t){const n=e.bitmap();return(t||[]).forEach((t=>n.set(e(t.boundary[0]),e(t.boundary[3])))),[n,void 0]}(E,a&&k)}const A=g?V_[c](E,$,a,l):function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],l=i.length;return function(t){const u=t.boundary,c=t.datum.fontSize;if(u[2]<0||u[5]<0||u[0]>r||u[3]>o)return!1;let f,d,h,p,m,g,y,v,b,x,w,_,k,E,$,A=t.textWidth??0;for(let r=0;r<l;++r){if(f=(3&n[r])-1,d=(n[r]>>>2&3)-1,h=0===f&&0===d||i[r]<0,p=f&&d?Math.SQRT1_2:1,m=i[r]<0?-1:1,g=u[1+f]+i[r]*f*p,w=u[4+d]+m*c*d/2+i[r]*d*p,v=w-c/2,b=w+c/2,_=e(g),E=e(v),$=e(b),!A){if(!H_(_,_,E,$,a,s,0,0,0,0,0,h))continue;A=Wf.width(t.datum,t.datum.text)}if(x=g+m*A*f/2,g=x-A/2,y=x+A/2,_=e(g),k=e(y),H_(_,k,E,$,a,s,0,0,0,0,0,h))return t.x=f?f*m<0?y:g:x,t.y=d?d*m<0?b:v:w,t.align=U_[f*m+1],t.baseline=W_[d*m+1],a.setRange(_,E,k,$),!0}return!1}}(E,$,h,d);return k.forEach((e=>e.opacity=+A(e))),k}const Y_=["x","y","opacity","align","baseline"],J_=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function Q_(e){Xr.call(this,null,e)}Q_.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:J_},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:Y_.length,default:Y_}]},i(Q_,Xr,{transform(e,t){const n=e.modified();if(!(n||t.changed(t.ADD_REM)||function(n){const i=e[n];return o(i)&&t.modified(i.fields)}("sort")))return;e.size&&2===e.size.length||s("Size parameter should be specified as a [width, height] array.");const i=e.as||Y_;return X_(t.materialize(t.SOURCE).source||[],e.size,e.sort,r(null==e.offset?1:e.offset),r(e.anchor||J_),e.avoidMarks||[],!1!==e.avoidBaseMark,e.lineAnchor||"end",e.markIndex||0,void 0===e.padding?0:e.padding,e.method||"naive").forEach((e=>{const t=e.datum;t[i[0]]=e.x,t[i[1]]=e.y,t[i[2]]=e.opacity,t[i[3]]=e.align,t[i[4]]=e.baseline})),t.reflow(n).modifies(i)}});const K_=Object.freeze(Object.defineProperty({__proto__:null,label:Q_},Symbol.toStringTag,{value:"Module"}));function Z_(e,t){var n,i,r,o,a,s,l=[],u=function(e){return e(o)};if(null==t)l.push(e);else for(n={},i=0,r=e.length;i<r;++i)o=e[i],(s=n[a=t.map(u)])||(n[a]=s=[],s.dims=a,l.push(s)),s.push(o);return l}function ek(e){Xr.call(this,null,e)}ek.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},i(ek,Xr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=Z_(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map($),o=r.length,a=e.as||[$(e.x),$(e.y)],s=[];i.forEach((t=>{Bo(t,e.x,e.y,e.bandwidth||.3).forEach((e=>{const n={};for(let i=0;i<o;++i)n[r[i]]=t.dims[i];n[a[0]]=e[0],n[a[1]]=e[1],s.push(yr(n))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=s}return n}});const tk={constant:Do,linear:Oo,log:zo,exp:No,pow:Ro,quad:To,poly:Po};function nk(e){Xr.call(this,null,e)}nk.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(tk)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]},i(nk,Xr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=Z_(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map($),o=e.method||"linear",a=null==e.order?3:e.order,l=((e,t)=>"poly"===e?t:"quad"===e?2:1)(o,a),u=e.as||[$(e.x),$(e.y)],c=tk[o],f=[];let d=e.extent;m(tk,o)||s("Invalid regression method: "+o),null!=d&&"log"===o&&d[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),i.forEach((n=>{if(n.length<=l)return void t.dataflow.warn("Skipping regression with more parameters than data points.");const i=c(n,e.x,e.y,a);if(e.params)return void f.push(yr({keys:n.dims,coef:i.coef,rSquared:i.rSquared}));const s=d||A(n,e.x),h=e=>{const t={};for(let i=0;i<r.length;++i)t[r[i]]=n.dims[i];t[u[0]]=e[0],t[u[1]]=e[1],f.push(yr(t))};"linear"===o||"constant"===o?s.forEach((e=>h([e,i.predict(e)]))):Uo(i.predict,s,25,200).forEach(h)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n}});const ik=Object.freeze(Object.defineProperty({__proto__:null,loess:ek,regression:nk},Symbol.toStringTag,{value:"Module"})),rk=134217729;function ok(e,t,n,i,r){let o,a,s,l,u=t[0],c=i[0],f=0,d=0;c>u==c>-u?(o=u,u=t[++f]):(o=c,c=i[++d]);let h=0;if(f<e&&d<n)for(c>u==c>-u?(a=u+o,s=o-(a-u),u=t[++f]):(a=c+o,s=o-(a-c),c=i[++d]),o=a,0!==s&&(r[h++]=s);f<e&&d<n;)c>u==c>-u?(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=t[++f]):(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=i[++d]),o=a,0!==s&&(r[h++]=s);for(;f<e;)a=o+u,l=a-o,s=o-(a-l)+(u-l),u=t[++f],o=a,0!==s&&(r[h++]=s);for(;d<n;)a=o+c,l=a-o,s=o-(a-l)+(c-l),c=i[++d],o=a,0!==s&&(r[h++]=s);return 0===o&&0!==h||(r[h++]=o),h}function ak(e){return new Float64Array(e)}const sk=ak(4),lk=ak(8),uk=ak(12),ck=ak(16),fk=ak(4);function dk(e,t,n,i,r,o){const a=(t-o)*(n-r),s=(e-r)*(i-o),l=a-s,u=Math.abs(a+s);return Math.abs(l)>=33306690738754716e-32*u?l:-function(e,t,n,i,r,o,a){let s,l,u,c,f,d,h,p,m,g,y,v,b,x,w,_,k,E;const $=e-r,A=n-r,D=t-o,S=i-o;x=$*S,d=rk*$,h=d-(d-$),p=$-h,d=rk*S,m=d-(d-S),g=S-m,w=p*g-(x-h*m-p*m-h*g),_=D*A,d=rk*D,h=d-(d-D),p=D-h,d=rk*A,m=d-(d-A),g=A-m,k=p*g-(_-h*m-p*m-h*g),y=w-k,f=w-y,sk[0]=w-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,sk[1]=b-(y+f)+(f-_),E=v+y,f=E-v,sk[2]=v-(E-f)+(y-f),sk[3]=E;let F=function(e,t){let n=t[0];for(let i=1;i<e;i++)n+=t[i];return n}(4,sk),C=22204460492503146e-32*a;if(F>=C||-F>=C)return F;if(f=e-$,s=e-($+f)+(f-r),f=n-A,u=n-(A+f)+(f-r),f=t-D,l=t-(D+f)+(f-o),f=i-S,c=i-(S+f)+(f-o),0===s&&0===l&&0===u&&0===c)return F;if(C=11093356479670487e-47*a+33306690738754706e-32*Math.abs(F),F+=$*c+S*s-(D*u+A*l),F>=C||-F>=C)return F;x=s*S,d=rk*s,h=d-(d-s),p=s-h,d=rk*S,m=d-(d-S),g=S-m,w=p*g-(x-h*m-p*m-h*g),_=l*A,d=rk*l,h=d-(d-l),p=l-h,d=rk*A,m=d-(d-A),g=A-m,k=p*g-(_-h*m-p*m-h*g),y=w-k,f=w-y,fk[0]=w-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,fk[1]=b-(y+f)+(f-_),E=v+y,f=E-v,fk[2]=v-(E-f)+(y-f),fk[3]=E;const M=ok(4,sk,4,fk,lk);x=$*c,d=rk*$,h=d-(d-$),p=$-h,d=rk*c,m=d-(d-c),g=c-m,w=p*g-(x-h*m-p*m-h*g),_=D*u,d=rk*D,h=d-(d-D),p=D-h,d=rk*u,m=d-(d-u),g=u-m,k=p*g-(_-h*m-p*m-h*g),y=w-k,f=w-y,fk[0]=w-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,fk[1]=b-(y+f)+(f-_),E=v+y,f=E-v,fk[2]=v-(E-f)+(y-f),fk[3]=E;const O=ok(M,lk,4,fk,uk);x=s*c,d=rk*s,h=d-(d-s),p=s-h,d=rk*c,m=d-(d-c),g=c-m,w=p*g-(x-h*m-p*m-h*g),_=l*u,d=rk*l,h=d-(d-l),p=l-h,d=rk*u,m=d-(d-u),g=u-m,k=p*g-(_-h*m-p*m-h*g),y=w-k,f=w-y,fk[0]=w-(y+f)+(f-k),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,fk[1]=b-(y+f)+(f-_),E=v+y,f=E-v,fk[2]=v-(E-f)+(y-f),fk[3]=E;const z=ok(O,uk,4,fk,ck);return ck[z-1]}(e,t,n,i,r,o,u)}const hk=Math.pow(2,-52),pk=new Uint32Array(512);class mk{static from(e,t=wk,n=_k){const i=e.length,r=new Float64Array(2*i);for(let o=0;o<i;o++){const i=e[o];r[2*o]=t(i),r[2*o+1]=n(i)}return new mk(r)}constructor(e){const t=e.length>>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:i,_hullHash:r}=this,o=e.length>>1;let a=1/0,s=1/0,l=-1/0,u=-1/0;for(let $=0;$<o;$++){const t=e[2*$],n=e[2*$+1];t<a&&(a=t),n<s&&(s=n),t>l&&(l=t),n>u&&(u=n),this._ids[$]=$}const c=(a+l)/2,f=(s+u)/2;let d,h,p,m=1/0;for(let $=0;$<o;$++){const t=gk(c,f,e[2*$],e[2*$+1]);t<m&&(d=$,m=t)}const g=e[2*d],y=e[2*d+1];m=1/0;for(let $=0;$<o;$++){if($===d)continue;const t=gk(g,y,e[2*$],e[2*$+1]);t<m&&t>0&&(h=$,m=t)}let v=e[2*h],b=e[2*h+1],x=1/0;for(let $=0;$<o;$++){if($===d||$===h)continue;const t=vk(g,y,v,b,e[2*$],e[2*$+1]);t<x&&(p=$,x=t)}let w=e[2*p],_=e[2*p+1];if(x===1/0){for(let i=0;i<o;i++)this._dists[i]=e[2*i]-e[0]||e[2*i+1]-e[1];bk(this._ids,this._dists,0,o-1);const t=new Uint32Array(o);let n=0;for(let e=0,i=-1/0;e<o;e++){const r=this._ids[e];this._dists[r]>i&&(t[n++]=r,i=this._dists[r])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(dk(g,y,v,b,w,_)<0){const e=h,t=v,n=b;h=p,v=w,b=_,p=e,w=t,_=n}const k=function(e,t,n,i,r,o){const a=n-e,s=i-t,l=r-e,u=o-t,c=a*a+s*s,f=l*l+u*u,d=.5/(a*u-s*l),h=e+(u*c-s*f)*d;return{x:h,y:t+(a*f-l*c)*d}}(g,y,v,b,w,_);this._cx=k.x,this._cy=k.y;for(let $=0;$<o;$++)this._dists[$]=gk(e[2*$],e[2*$+1],k.x,k.y);bk(this._ids,this._dists,0,o-1),this._hullStart=d;let E=3;n[d]=t[p]=h,n[h]=t[d]=p,n[p]=t[h]=d,i[d]=0,i[h]=1,i[p]=2,r.fill(-1),r[this._hashKey(g,y)]=d,r[this._hashKey(v,b)]=h,r[this._hashKey(w,_)]=p,this.trianglesLen=0,this._addTriangle(d,h,p,-1,-1,-1);for(let $,A,D=0;D<this._ids.length;D++){const o=this._ids[D],a=e[2*o],s=e[2*o+1];if(D>0&&Math.abs(a-$)<=hk&&Math.abs(s-A)<=hk)continue;if($=a,A=s,o===d||o===h||o===p)continue;let l=0;for(let e=0,t=this._hashKey(a,s);e<this._hashSize&&(l=r[(t+e)%this._hashSize],-1===l||l===n[l]);e++);l=t[l];let u,c=l;for(;u=n[c],dk(a,s,e[2*c],e[2*c+1],e[2*u],e[2*u+1])>=0;)if(c=u,c===l){c=-1;break}if(-1===c)continue;let f=this._addTriangle(c,o,n[c],-1,-1,i[c]);i[o]=this._legalize(f+2),i[c]=f,E++;let m=n[c];for(;u=n[m],dk(a,s,e[2*m],e[2*m+1],e[2*u],e[2*u+1])<0;)f=this._addTriangle(m,o,u,i[o],-1,i[m]),i[o]=this._legalize(f+2),n[m]=m,E--,m=u;if(c===l)for(;u=t[c],dk(a,s,e[2*u],e[2*u+1],e[2*c],e[2*c+1])<0;)f=this._addTriangle(u,o,c,-1,i[c],i[u]),this._legalize(f+2),i[u]=f,n[c]=c,E--,c=u;this._hullStart=t[o]=c,n[c]=t[m]=o,n[o]=m,r[this._hashKey(a,s)]=o,r[this._hashKey(e[2*c],e[2*c+1])]=c}this.hull=new Uint32Array(E);for(let $=0,A=this._hullStart;$<E;$++)this.hull[$]=A,A=n[A];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(function(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:i}=this;let r=0,o=0;for(;;){const a=n[e],s=e-e%3;if(o=s+(e+2)%3,-1===a){if(0===r)break;e=pk[--r];continue}const l=a-a%3,u=s+(e+1)%3,c=l+(a+2)%3,f=t[o],d=t[e],h=t[u],p=t[c];if(yk(i[2*f],i[2*f+1],i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1])){t[e]=p,t[a]=f;const i=n[c];if(-1===i){let t=this._hullStart;do{if(this._hullTri[t]===c){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,i),this._link(a,n[o]),this._link(o,c);const s=l+(a+1)%3;r<pk.length&&(pk[r++]=s)}else{if(0===r)break;e=pk[--r]}}return o}_link(e,t){this._halfedges[e]=t,-1!==t&&(this._halfedges[t]=e)}_addTriangle(e,t,n,i,r,o){const a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,i),this._link(a+1,r),this._link(a+2,o),this.trianglesLen+=3,a}}function gk(e,t,n,i){const r=e-n,o=t-i;return r*r+o*o}function yk(e,t,n,i,r,o,a,s){const l=e-a,u=t-s,c=n-a,f=i-s,d=r-a,h=o-s,p=c*c+f*f,m=d*d+h*h;return l*(f*m-p*h)-u*(c*m-p*d)+(l*l+u*u)*(c*h-f*d)<0}function vk(e,t,n,i,r,o){const a=n-e,s=i-t,l=r-e,u=o-t,c=a*a+s*s,f=l*l+u*u,d=.5/(a*u-s*l),h=(u*c-s*f)*d,p=(a*f-l*c)*d;return h*h+p*p}function bk(e,t,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const i=e[r],o=t[i];let a=r-1;for(;a>=n&&t[e[a]]>o;)e[a+1]=e[a--];e[a+1]=i}else{let r=n+1,o=i;xk(e,n+i>>1,r),t[e[n]]>t[e[i]]&&xk(e,n,i),t[e[r]]>t[e[i]]&&xk(e,r,i),t[e[n]]>t[e[r]]&&xk(e,n,r);const a=e[r],s=t[a];for(;;){do{r++}while(t[e[r]]<s);do{o--}while(t[e[o]]>s);if(o<r)break;xk(e,r,o)}e[n+1]=e[o],e[o]=a,i-r+1>=o-n?(bk(e,t,r,i),bk(e,t,n,o-1)):(bk(e,t,n,o-1),bk(e,t,r,i))}}function xk(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function wk(e){return e[0]}function _k(e){return e[1]}const kk=1e-6;class Ek{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){const i=(e=+e)+(n=+n),r=t=+t;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${i},${r}`:(Math.abs(this._x1-i)>kk||Math.abs(this._y1-r)>kk)&&(this._+="L"+i+","+r),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=i},${this._y1=r}`)}rect(e,t,n,i){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+i}h${-n}Z`}value(){return this._||null}}class $k{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}let Ak=class{constructor(e,[t,n,i,r]=[0,0,960,500]){if(!((i=+i)>=(t=+t)&&(r=+r)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(2*e.points.length),this.vectors=new Float64Array(2*e.points.length),this.xmax=i,this.xmin=t,this.ymax=r,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:i}=this;let r,o;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let p,m,g=0,y=0,v=n.length;g<v;g+=3,y+=2){const i=2*n[g],s=2*n[g+1],l=2*n[g+2],u=e[i],c=e[i+1],f=e[s],d=e[s+1],h=e[l],v=e[l+1],b=f-u,x=d-c,w=h-u,_=v-c,k=2*(b*_-x*w);if(Math.abs(k)<1e-9){if(void 0===r){r=o=0;for(const n of t)r+=e[2*n],o+=e[2*n+1];r/=t.length,o/=t.length}const n=1e9*Math.sign((r-u)*_-(o-c)*w);p=(u+h)/2-n*_,m=(c+v)/2+n*w}else{const e=1/k,t=b*b+x*x,n=w*w+_*_;p=u+(_*t-x*n)*e,m=c+(b*n-w*t)*e}a[y]=p,a[y+1]=m}let s,l,u,c=t[t.length-1],f=4*c,d=e[2*c],h=e[2*c+1];i.fill(0);for(let p=0;p<t.length;++p)c=t[p],s=f,l=d,u=h,f=4*c,d=e[2*c],h=e[2*c+1],i[s+2]=i[f]=u-h,i[s+3]=i[f+1]=d-l}render(e){const t=null==e?e=new Ek:void 0,{delaunay:{halfedges:n,inedges:i,hull:r},circumcenters:o,vectors:a}=this;if(r.length<=1)return null;for(let u=0,c=n.length;u<c;++u){const t=n[u];if(t<u)continue;const i=2*Math.floor(u/3),r=2*Math.floor(t/3),a=o[i],s=o[i+1],l=o[r],c=o[r+1];this._renderSegment(a,s,l,c,e)}let s,l=r[r.length-1];for(let u=0;u<r.length;++u){s=l,l=r[u];const t=2*Math.floor(i[l]/3),n=o[t],c=o[t+1],f=4*s,d=this._project(n,c,a[f+2],a[f+3]);d&&this._renderSegment(n,c,d[0],d[1],e)}return t&&t.value()}renderBounds(e){const t=null==e?e=new Ek:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){const n=null==t?t=new Ek:void 0,i=this._clip(e);if(null===i||!i.length)return;t.moveTo(i[0],i[1]);let r=i.length;for(;i[0]===i[r-2]&&i[1]===i[r-1]&&r>1;)r-=2;for(let o=2;o<r;o+=2)i[o]===i[o-2]&&i[o+1]===i[o-1]||t.lineTo(i[o],i[o+1]);return t.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){const e=this.cellPolygon(t);e&&(e.index=t,yield e)}}cellPolygon(e){const t=new $k;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,i,r){let o;const a=this._regioncode(e,t),s=this._regioncode(n,i);0===a&&0===s?(r.moveTo(e,t),r.lineTo(n,i)):(o=this._clipSegment(e,t,n,i,a,s))&&(r.moveTo(o[0],o[1]),r.lineTo(o[2],o[3]))}contains(e,t,n){return(t=+t)==t&&(n=+n)==n&&this.delaunay._step(e,t,n)===e}*neighbors(e){const t=this._clip(e);if(t)for(const n of this.delaunay.neighbors(e)){const e=this._clip(n);if(e)e:for(let i=0,r=t.length;i<r;i+=2)for(let o=0,a=e.length;o<a;o+=2)if(t[i]===e[o]&&t[i+1]===e[o+1]&&t[(i+2)%r]===e[(o+a-2)%a]&&t[(i+3)%r]===e[(o+a-1)%a]){yield n;break e}}}_cell(e){const{circumcenters:t,delaunay:{inedges:n,halfedges:i,triangles:r}}=this,o=n[e];if(-1===o)return null;const a=[];let s=o;do{const n=Math.floor(s/3);if(a.push(t[2*n],t[2*n+1]),s=s%3==2?s-2:s+1,r[s]!==e)break;s=i[s]}while(s!==o&&-1!==s);return a}_clip(e){if(0===e&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const t=this._cell(e);if(null===t)return null;const{vectors:n}=this,i=4*e;return this._simplify(n[i]||n[i+1]?this._clipInfinite(e,t,n[i],n[i+1],n[i+2],n[i+3]):this._clipFinite(e,t))}_clipFinite(e,t){const n=t.length;let i,r,o,a,s=null,l=t[n-2],u=t[n-1],c=this._regioncode(l,u),f=0;for(let d=0;d<n;d+=2)if(i=l,r=u,l=t[d],u=t[d+1],o=c,c=this._regioncode(l,u),0===o&&0===c)a=f,f=0,s?s.push(l,u):s=[l,u];else{let t,n,d,h,p;if(0===o){if(null===(t=this._clipSegment(i,r,l,u,o,c)))continue;[n,d,h,p]=t}else{if(null===(t=this._clipSegment(l,u,i,r,c,o)))continue;[h,p,n,d]=t,a=f,f=this._edgecode(n,d),a&&f&&this._edge(e,a,f,s,s.length),s?s.push(n,d):s=[n,d]}a=f,f=this._edgecode(h,p),a&&f&&this._edge(e,a,f,s,s.length),s?s.push(h,p):s=[h,p]}if(s)a=f,f=this._edgecode(s[0],s[1]),a&&f&&this._edge(e,a,f,s,s.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return s}_clipSegment(e,t,n,i,r,o){const a=r<o;for(a&&([e,t,n,i,r,o]=[n,i,e,t,o,r]);;){if(0===r&&0===o)return a?[n,i,e,t]:[e,t,n,i];if(r&o)return null;let s,l,u=r||o;8&u?(s=e+(n-e)*(this.ymax-t)/(i-t),l=this.ymax):4&u?(s=e+(n-e)*(this.ymin-t)/(i-t),l=this.ymin):2&u?(l=t+(i-t)*(this.xmax-e)/(n-e),s=this.xmax):(l=t+(i-t)*(this.xmin-e)/(n-e),s=this.xmin),r?(e=s,t=l,r=this._regioncode(e,t)):(n=s,i=l,o=this._regioncode(n,i))}}_clipInfinite(e,t,n,i,r,o){let a,s=Array.from(t);if((a=this._project(s[0],s[1],n,i))&&s.unshift(a[0],a[1]),(a=this._project(s[s.length-2],s[s.length-1],r,o))&&s.push(a[0],a[1]),s=this._clipFinite(e,s))for(let l,u=0,c=s.length,f=this._edgecode(s[c-2],s[c-1]);u<c;u+=2)l=f,f=this._edgecode(s[u],s[u+1]),l&&f&&(u=this._edge(e,l,f,s,u),c=s.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(e,t,n,i,r){for(;t!==n;){let n,o;switch(t){case 5:t=4;continue;case 4:t=6,n=this.xmax,o=this.ymin;break;case 6:t=2;continue;case 2:t=10,n=this.xmax,o=this.ymax;break;case 10:t=8;continue;case 8:t=9,n=this.xmin,o=this.ymax;break;case 9:t=1;continue;case 1:t=5,n=this.xmin,o=this.ymin}i[r]===n&&i[r+1]===o||!this.contains(e,n,o)||(i.splice(r,0,n,o),r+=2)}return r}_project(e,t,n,i){let r,o,a,s=1/0;if(i<0){if(t<=this.ymin)return null;(r=(this.ymin-t)/i)<s&&(a=this.ymin,o=e+(s=r)*n)}else if(i>0){if(t>=this.ymax)return null;(r=(this.ymax-t)/i)<s&&(a=this.ymax,o=e+(s=r)*n)}if(n>0){if(e>=this.xmax)return null;(r=(this.xmax-e)/n)<s&&(o=this.xmax,a=t+(s=r)*i)}else if(n<0){if(e<=this.xmin)return null;(r=(this.xmin-e)/n)<s&&(o=this.xmin,a=t+(s=r)*i)}return[o,a]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){const n=(t+2)%e.length,i=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[i]||e[t+1]===e[n+1]&&e[n+1]===e[i+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}};const Dk=2*Math.PI,Sk=Math.pow;function Fk(e){return e[0]}function Ck(e){return e[1]}function Mk(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class Ok{static from(e,t=Fk,n=Ck,i){return new Ok("length"in e?function(e,t,n,i){const r=e.length,o=new Float64Array(2*r);for(let a=0;a<r;++a){const r=e[a];o[2*a]=t.call(i,r,a,e),o[2*a+1]=n.call(i,r,a,e)}return o}(e,t,n,i):Float64Array.from(function*(e,t,n,i){let r=0;for(const o of e)yield t.call(i,o,r,e),yield n.call(i,o,r,e),++r}(e,t,n,i)))}constructor(e){this._delaunator=new mk(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&function(e){const{triangles:t,coords:n}=e;for(let i=0;i<t.length;i+=3){const e=2*t[i],r=2*t[i+1],o=2*t[i+2];if((n[o]-n[e])*(n[r+1]-n[e+1])-(n[r]-n[e])*(n[o+1]-n[e+1])>1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:t.length/2},((e,t)=>t)).sort(((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]));const e=this.collinear[0],n=this.collinear[this.collinear.length-1],i=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],r=1e-8*Math.hypot(i[3]-i[1],i[2]-i[0]);for(let o=0,a=t.length/2;o<a;++o){const e=Mk(t[2*o],t[2*o+1],r);t[2*o]=e[0],t[2*o+1]=e[1]}this._delaunator=new mk(t)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,r=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let s=0,l=n.length;s<l;++s){const e=r[s%3==2?s-2:s+1];-1!==n[s]&&-1!==o[e]||(o[e]=s)}for(let s=0,l=i.length;s<l;++s)a[i[s]]=s;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],o[i[0]]=1,2===i.length&&(o[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(e){return new Ak(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:i,halfedges:r,triangles:o,collinear:a}=this;if(a){const t=a.indexOf(e);return t>0&&(yield a[t-1]),void(t<a.length-1&&(yield a[t+1]))}const s=t[e];if(-1===s)return;let l=s,u=-1;do{if(yield u=o[l],l=l%3==2?l-2:l+1,o[l]!==e)return;if(l=r[l],-1===l){const t=n[(i[e]+1)%n.length];return void(t!==u&&(yield t))}}while(l!==s)}find(e,t,n=0){if((e=+e)!=e||(t=+t)!=t)return-1;const i=n;let r;for(;(r=this._step(n,e,t))>=0&&r!==n&&r!==i;)n=r;return r}_step(e,t,n){const{inedges:i,hull:r,_hullIndex:o,halfedges:a,triangles:s,points:l}=this;if(-1===i[e]||!l.length)return(e+1)%(l.length>>1);let u=e,c=Sk(t-l[2*e],2)+Sk(n-l[2*e+1],2);const f=i[e];let d=f;do{let i=s[d];const f=Sk(t-l[2*i],2)+Sk(n-l[2*i+1],2);if(f<c&&(c=f,u=i),d=d%3==2?d-2:d+1,s[d]!==e)break;if(d=a[d],-1===d){if(d=r[(o[e]+1)%r.length],d!==i&&Sk(t-l[2*d],2)+Sk(n-l[2*d+1],2)<c)return d;break}}while(d!==f);return u}render(e){const t=null==e?e=new Ek:void 0,{points:n,halfedges:i,triangles:r}=this;for(let o=0,a=i.length;o<a;++o){const t=i[o];if(t<o)continue;const a=2*r[o],s=2*r[t];e.moveTo(n[a],n[a+1]),e.lineTo(n[s],n[s+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){void 0!==t||e&&"function"==typeof e.moveTo||(t=e,e=null),t=null==t?2:+t;const n=null==e?e=new Ek:void 0,{points:i}=this;for(let r=0,o=i.length;r<o;r+=2){const n=i[r],o=i[r+1];e.moveTo(n+t,o),e.arc(n,o,t,0,Dk)}return n&&n.value()}renderHull(e){const t=null==e?e=new Ek:void 0,{hull:n,points:i}=this,r=2*n[0],o=n.length;e.moveTo(i[r],i[r+1]);for(let a=1;a<o;++a){const t=2*n[a];e.lineTo(i[t],i[t+1])}return e.closePath(),t&&t.value()}hullPolygon(){const e=new $k;return this.renderHull(e),e.value()}renderTriangle(e,t){const n=null==t?t=new Ek:void 0,{points:i,triangles:r}=this,o=2*r[e*=3],a=2*r[e+1],s=2*r[e+2];return t.moveTo(i[o],i[o+1]),t.lineTo(i[a],i[a+1]),t.lineTo(i[s],i[s+1]),t.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){const t=new $k;return this.renderTriangle(e,t),t.value()}}function zk(e){Xr.call(this,null,e)}zk.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const Nk=[-1e5,-1e5,1e5,1e5];function Rk(e){const t=e[0][0],n=e[0][1];let i=e.length-1;for(;e[i][0]===t&&e[i][1]===n;--i);return"M"+e.slice(0,i+1).join("L")+"Z"}i(zk,Xr,{transform(e,t){const n=e.as||"path",i=t.source;if(!i||!i.length)return t;let r=e.size;r=r?[0,0,r[0],r[1]]:(r=e.extent)?[r[0][0],r[0][1],r[1][0],r[1][1]]:Nk;const o=this.value=Ok.from(i,e.x,e.y).voronoi(r);for(let s=0,l=i.length;s<l;++s){const e=o.cellPolygon(s);i[s][n]=e&&(2!==(a=e).length||a[0][0]!==a[1][0]||a[0][1]!==a[1][1])?Rk(e):null}var a;return t.reflow(e.modified()).modifies(n)}});const Tk=Object.freeze(Object.defineProperty({__proto__:null,voronoi:zk},Symbol.toStringTag,{value:"Module"}));var Pk=Math.PI/180,Lk=2048;function Bk(){var e,t,n,i,r,o,a,s=[256,256],l=Uk,u=[],c=Math.random,f={};function d(e,t,n){for(var i,r,o,a,u,f=t.x,d=t.y,h=Math.hypot(s[0],s[1]),p=l(s),m=c()<.5?1:-1,g=-m;(i=p(g+=m))&&(r=~~i[0],o=~~i[1],!(Math.min(Math.abs(r),Math.abs(o))>=h));)if(t.x=f+r,t.y=d+o,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>s[0]||t.y+t.y1>s[1]||n&&Ik(t,e,s[0])||n&&(u=n,!((a=t).x+a.x1>u[0].x&&a.x+a.x0<u[1].x&&a.y+a.y1>u[0].y&&a.y+a.y0<u[1].y)))){for(var y,v=t.sprite,b=t.width>>5,x=s[0]>>5,w=t.x-(b<<4),_=127&w,k=32-_,E=t.y1-t.y0,$=(t.y+t.y0)*x+(w>>5),A=0;A<E;A++){y=0;for(var D=0;D<=b;D++)e[$+D]|=y<<k|(D<b?(y=v[A*b+D])>>>_:0);$+=x}return t.sprite=null,!0}return!1}return f.layout=function(){for(var l=function(e){e.width=e.height=1;var t=Math.sqrt(e.getContext("2d").getImageData(0,0,1,1).data.length>>2);e.width=2048/t,e.height=Lk/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(xs()),f=function(e){var t=[],n=-1;for(;++n<e;)t[n]=0;return t}((s[0]>>5)*s[1]),h=null,p=u.length,m=-1,g=[],y=u.map((s=>({text:e(s),font:t(s),style:i(s),weight:r(s),rotate:o(s),size:~~(n(s)+1e-14),padding:a(s),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:s}))).sort(((e,t)=>t.size-e.size));++m<p;){var v=y[m];v.x=s[0]*(c()+.5)>>1,v.y=s[1]*(c()+.5)>>1,jk(l,v,y,m),v.hasText&&d(f,v,h)&&(g.push(v),h?qk(h,v):h=[{x:v.x+v.x0,y:v.y+v.y0},{x:v.x+v.x1,y:v.y+v.y1}],v.x-=s[0]>>1,v.y-=s[1]>>1)}return g},f.words=function(e){return arguments.length?(u=e,f):u},f.size=function(e){return arguments.length?(s=[+e[0],+e[1]],f):s},f.font=function(e){return arguments.length?(t=Wk(e),f):t},f.fontStyle=function(e){return arguments.length?(i=Wk(e),f):i},f.fontWeight=function(e){return arguments.length?(r=Wk(e),f):r},f.rotate=function(e){return arguments.length?(o=Wk(e),f):o},f.text=function(t){return arguments.length?(e=Wk(t),f):e},f.spiral=function(e){return arguments.length?(l=Hk[e]||e,f):l},f.fontSize=function(e){return arguments.length?(n=Wk(e),f):n},f.padding=function(e){return arguments.length?(a=Wk(e),f):a},f.random=function(e){return arguments.length?(c=e,f):c},f}function jk(e,t,n,i){if(!t.sprite){var r=e.context,o=e.ratio;r.clearRect(0,0,2048/o,Lk/o);var a,s,l,u,c,f=0,d=0,h=0,p=n.length;for(--i;++i<p;){if(t=n[i],r.save(),r.font=t.style+" "+t.weight+" "+~~((t.size+1)/o)+"px "+t.font,a=r.measureText(t.text+"m").width*o,l=t.size<<1,t.rotate){var m=Math.sin(t.rotate*Pk),g=Math.cos(t.rotate*Pk),y=a*g,v=a*m,b=l*g,x=l*m;a=Math.max(Math.abs(y+x),Math.abs(y-x))+31>>5<<5,l=~~Math.max(Math.abs(v+b),Math.abs(v-b))}else a=a+31>>5<<5;if(l>h&&(h=l),f+a>=2048&&(f=0,d+=h,h=0),d+l>=Lk)break;r.translate((f+(a>>1))/o,(d+(l>>1))/o),t.rotate&&r.rotate(t.rotate*Pk),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=a,t.height=l,t.xoff=f,t.yoff=d,t.x1=a>>1,t.y1=l>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,f+=a}for(var w=r.getImageData(0,0,2048/o,Lk/o).data,_=[];--i>=0;)if((t=n[i]).hasText){for(s=(a=t.width)>>5,l=t.y1-t.y0,u=0;u<l*s;u++)_[u]=0;if(null==(f=t.xoff))return;d=t.yoff;var k=0,E=-1;for(c=0;c<l;c++){for(u=0;u<a;u++){var $=s*c+(u>>5),A=w[2048*(d+c)+(f+u)<<2]?1<<31-u%32:0;_[$]|=A,k|=A}k?E=c:(t.y0++,l--,c--,d++)}t.y1=t.y0+E,t.sprite=_.slice(0,(t.y1-t.y0)*s)}}}function Ik(e,t,n){n>>=5;for(var i,r=e.sprite,o=e.width>>5,a=e.x-(o<<4),s=127&a,l=32-s,u=e.y1-e.y0,c=(e.y+e.y0)*n+(a>>5),f=0;f<u;f++){i=0;for(var d=0;d<=o;d++)if((i<<l|(d<o?(i=r[f*o+d])>>>s:0))&t[c+d])return!0;c+=n}return!1}function qk(e,t){var n=e[0],i=e[1];t.x+t.x0<n.x&&(n.x=t.x+t.x0),t.y+t.y0<n.y&&(n.y=t.y+t.y0),t.x+t.x1>i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function Uk(e){var t=e[0]/e[1];return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}function Wk(e){return"function"==typeof e?e:function(){return e}}var Hk={archimedean:Uk,rectangular:function(e){var t=4*e[0]/e[1],n=0,i=0;return function(e){var r=e<0?-1:1;switch(Math.sqrt(1+4*r*e)-r&3){case 0:n+=t;break;case 1:i+=4;break;case 2:n-=t;break;default:i-=4}return[n,i]}}};const Gk=["x","y","font","fontSize","fontStyle","fontWeight","angle"],Vk=["text","font","rotate","fontSize","fontStyle","fontWeight"];function Xk(e){Xr.call(this,Bk(),e)}Xk.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:Gk}]},i(Xk,Xr,{transform(e,t){!e.size||e.size[0]&&e.size[1]||s("Wordcloud size dimensions must be non-zero.");const n=e.modified();if(!(n||t.changed(t.ADD_REM)||Vk.some((function(n){const i=e[n];return o(i)&&t.modified(i.fields)}))))return;const i=t.materialize(t.SOURCE).source,r=this.value,a=e.as||Gk;let l,u=e.fontSize||14;if(o(u)?l=e.fontSizeRange:u=g(u),l){const e=u,t=Dl("sqrt")().domain(A(i,e)).range(l);u=n=>t(e(n))}i.forEach((e=>{e[a[0]]=NaN,e[a[1]]=NaN,e[a[3]]=0}));const c=r.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(u).random(io).layout(),f=r.size(),d=f[0]>>1,h=f[1]>>1,p=c.length;for(let o,s,m=0;m<p;++m)o=c[m],s=o.datum,s[a[0]]=o.x+d,s[a[1]]=o.y+h,s[a[2]]=o.font,s[a[3]]=o.size,s[a[4]]=o.style,s[a[5]]=o.weight,s[a[6]]=o.rotate;return t.reflow(n).modifies(a)}});const Yk=Object.freeze(Object.defineProperty({__proto__:null,wordcloud:Xk},Symbol.toStringTag,{value:"Module"})),Jk=e=>new Uint8Array(e),Qk=e=>new Uint16Array(e),Kk=e=>new Uint32Array(e);function Zk(e,t,n){const i=(t<257?Jk:t<65537?Qk:Kk)(e);return n&&i.set(n),i}function eE(e,t,n){const i=1<<t;return{one:i,zero:~i,range:n.slice(),bisect:e.bisect,index:e.index,size:e.size,onAdd(e,t){const n=this,r=n.bisect(n.range,e.value),o=e.index,a=r[0],s=r[1],l=o.length;let u;for(u=0;u<a;++u)t[o[u]]|=i;for(u=s;u<l;++u)t[o[u]]|=i;return n}}}function tE(){let e=Kk(0),t=[],n=0;return{insert:function(i,r,o){if(!r.length)return[];const a=n,s=r.length,l=Kk(s);let u,c,f,d=Array(s);for(f=0;f<s;++f)d[f]=i(r[f]),l[f]=f;if(d=function(e,t){return e.sort.call(t,((t,n)=>{const i=e[t],r=e[n];return i<r?-1:i>r?1:0})),function(e,t){return Array.from(t,(t=>e[t]))}(e,t)}(d,l),a)u=t,c=e,t=Array(a+s),e=Kk(a+s),function(e,t,n,i,r,o,a,s,l){let u,c=0,f=0;for(u=0;c<i&&f<a;++u)t[c]<r[f]?(s[u]=t[c],l[u]=n[c++]):(s[u]=r[f],l[u]=o[f++]+e);for(;c<i;++c,++u)s[u]=t[c],l[u]=n[c];for(;f<a;++f,++u)s[u]=r[f],l[u]=o[f]+e}(o,u,c,a,d,l,s,t,e);else{if(o>0)for(f=0;f<s;++f)l[f]+=o;t=d,e=l}return n=a+s,{index:l,value:d}},remove:function(i,r){const o=n;let a,s,l;for(s=0;!r[e[s]]&&s<o;++s);for(l=s;s<o;++s)r[a=e[s]]||(e[l]=a,t[l]=t[s],++l);n=o-i},bisect:function(e,i){let r;return i?r=i.length:(i=t,r=n),[Xt(i,e[0],0,r),Ht(i,e[1],0,r)]},reindex:function(t){for(let i=0,r=n;i<r;++i)e[i]=t[e[i]]},index:()=>e,size:()=>n}}function nE(e){Xr.call(this,function(){let e=8,t=[],n=Kk(0),i=Zk(0,e),r=Zk(0,e);return{data:()=>t,seen:()=>{return e=n,i=t.length,n=e.length>=i?e:((r=r||new e.constructor(i)).set(e),r);var e,i,r},add(e){for(let n,i=0,r=t.length,o=e.length;i<o;++i)n=e[i],n._index=r++,t.push(n)},remove(e,n){const o=t.length,a=Array(o-e),s=t;let l,u,c;for(u=0;!n[u]&&u<o;++u)a[u]=t[u],s[u]=u;for(c=u;u<o;++u)l=t[u],n[u]?s[u]=-1:(s[u]=c,i[c]=i[u],r[c]=r[u],a[c]=l,l._index=c++),i[u]=0;return t=a,s},size:()=>t.length,curr:()=>i,prev:()=>r,reset:e=>r[e]=i[e],all:()=>e<257?255:e<65537?65535:4294967295,set(e,t){i[e]|=t},clear(e,t){i[e]&=~t},resize(t,n){(t>i.length||n>e)&&(e=Math.max(n,e),i=Zk(t,e,i),r=Zk(t,e))}}}(),e),this._indices=null,this._dims=null}function iE(e){Xr.call(this,null,e)}nE.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},i(nE,Xr,{transform(e,t){return this._dims?e.modified("fields")||e.fields.some((e=>t.modified(e.fields)))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){const n=e.fields,i=e.query,r=this._indices={},o=this._dims=[],a=i.length;let s,l,u=0;for(;u<a;++u)s=n[u].fname,l=r[s]||(r[s]=tE()),o.push(eE(l,u,i[u]));return this.eval(e,t)},reinit(e,t){const n=t.materialize().fork(),i=e.fields,r=e.query,o=this._indices,a=this._dims,s=this.value,l=s.curr(),u=s.prev(),c=s.all(),f=n.rem=n.add,d=n.mod,h=r.length,p={};let m,g,y,v,b,x,w,_,k;if(u.set(l),t.rem.length&&(b=this.remove(e,t,n)),t.add.length&&s.add(t.add),t.mod.length)for(x={},v=t.mod,w=0,_=v.length;w<_;++w)x[v[w]._index]=1;for(w=0;w<h;++w)k=i[w],(!a[w]||e.modified("fields",w)||t.modified(k.fields))&&(y=k.fname,(m=p[y])||(o[y]=g=tE(),p[y]=m=g.insert(k,t.source,0)),a[w]=eE(g,w,r[w]).onAdd(m,l));for(w=0,_=s.data().length;w<_;++w)b[w]||(u[w]!==l[w]?f.push(w):x[w]&&l[w]!==c&&d.push(w));return s.mask=(1<<h)-1,n},eval(e,t){const n=t.materialize().fork(),i=this._dims.length;let r=0;return t.rem.length&&(this.remove(e,t,n),r|=(1<<i)-1),e.modified("query")&&!e.modified("fields")&&(r|=this.update(e,t,n)),t.add.length&&(this.insert(e,t,n),r|=(1<<i)-1),t.mod.length&&(this.modify(t,n),r|=(1<<i)-1),this.value.mask=r,n},insert(e,t,n){const i=t.add,r=this.value,o=this._dims,a=this._indices,s=e.fields,l={},u=n.add,c=r.size()+i.length,f=o.length;let d,h,p,m=r.size();r.resize(c,f),r.add(i);const g=r.curr(),y=r.prev(),v=r.all();for(d=0;d<f;++d)h=s[d].fname,p=l[h]||(l[h]=a[h].insert(s[d],i,m)),o[d].onAdd(p,g);for(;m<c;++m)y[m]=v,g[m]!==v&&u.push(m)},modify(e,t){const n=t.mod,i=this.value,r=i.curr(),o=i.all(),a=e.mod;let s,l,u;for(s=0,l=a.length;s<l;++s)u=a[s]._index,r[u]!==o&&n.push(u)},remove(e,t,n){const i=this._indices,r=this.value,o=r.curr(),a=r.prev(),s=r.all(),l={},u=n.rem,c=t.rem;let f,d,h,p;for(f=0,d=c.length;f<d;++f)h=c[f]._index,l[h]=1,a[h]=p=o[h],o[h]=s,p!==s&&u.push(h);for(h in i)i[h].remove(d,l);return this.reindex(t,d,l),l},reindex(e,t,n){const i=this._indices,r=this.value;e.runAfter((()=>{const e=r.remove(t,n);for(const t in i)i[t].reindex(e)}))},update(e,t,n){const i=this._dims,r=e.query,o=t.stamp,a=i.length;let s,l,u=0;for(n.filters=0,l=0;l<a;++l)e.modified("query",l)&&(s=l,++u);if(1===u)u=i[s].one,this.incrementOne(i[s],r[s],n.add,n.rem);else for(l=0,u=0;l<a;++l)e.modified("query",l)&&(u|=i[l].one,this.incrementAll(i[l],r[l],o,n.add),n.rem=n.add);return u},incrementAll(e,t,n,i){const r=this.value,o=r.seen(),a=r.curr(),s=r.prev(),l=e.index(),u=e.bisect(e.range),c=e.bisect(t),f=c[0],d=c[1],h=u[0],p=u[1],m=e.one;let g,y,v;if(f<h)for(g=f,y=Math.min(h,d);g<y;++g)v=l[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;else if(f>h)for(g=h,y=Math.min(f,p);g<y;++g)v=l[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;if(d>p)for(g=Math.max(f,p),y=d;g<y;++g)v=l[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;else if(d<p)for(g=Math.max(h,d),y=p;g<y;++g)v=l[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;e.range=t.slice()},incrementOne(e,t,n,i){const r=this.value.curr(),o=e.index(),a=e.bisect(e.range),s=e.bisect(t),l=s[0],u=s[1],c=a[0],f=a[1],d=e.one;let h,p,m;if(l<c)for(h=l,p=Math.min(c,u);h<p;++h)m=o[h],r[m]^=d,n.push(m);else if(l>c)for(h=c,p=Math.min(l,f);h<p;++h)m=o[h],r[m]^=d,i.push(m);if(u>f)for(h=Math.max(l,f),p=u;h<p;++h)m=o[h],r[m]^=d,n.push(m);else if(u<f)for(h=Math.max(c,u),p=f;h<p;++h)m=o[h],r[m]^=d,i.push(m);e.range=t.slice()}}),iE.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},i(iE,Xr,{transform(e,t){const n=~(e.ignore||0),i=e.filter,r=i.mask;if(!(r&n))return t.StopPropagation;const o=t.fork(t.ALL),a=i.data(),s=i.curr(),l=i.prev(),u=e=>s[e]&n?null:a[e];return o.filter(o.MOD,u),r&r-1?(o.filter(o.ADD,(e=>{const t=s[e]&n;return!t&&t^l[e]&n?a[e]:null})),o.filter(o.REM,(e=>{const t=s[e]&n;return t&&!(0^l[e]&n)?a[e]:null}))):(o.filter(o.ADD,u),o.filter(o.REM,(e=>(s[e]&n)===r?a[e]:null))),o.filter(o.SOURCE,(e=>u(e._index)))}});const rE=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:nE,resolvefilter:iE},Symbol.toStringTag,{value:"Module"})),oE="Literal",aE="Property",sE="ArrayExpression",lE="BinaryExpression",uE="CallExpression",cE="ConditionalExpression",fE="LogicalExpression",dE="MemberExpression",hE="ObjectExpression",pE="UnaryExpression";function mE(e){this.type=e}var gE,yE,vE,bE,xE;mE.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case sE:return e.elements;case lE:case fE:return[e.left,e.right];case uE:return[e.callee].concat(e.arguments);case cE:return[e.test,e.consequent,e.alternate];case dE:return[e.object,e.property];case hE:return e.properties;case aE:return[e.key,e.value];case pE:return[e.argument];default:return[]}}(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};(gE={})[1]="Boolean",gE[2]="<end>",gE[3]="Identifier",gE[4]="Keyword",gE[5]="Null",gE[6]="Numeric",gE[7]="Punctuator",gE[8]="String",gE[9]="RegularExpression";var wE="Identifier",_E="Unexpected token %0",kE="Invalid regular expression",EE="Invalid regular expression: missing /",$E="Octal literals are not allowed in strict mode.",AE="ILLEGAL",DE="Disabled.",SE=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),FE=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function CE(e,t){if(!e)throw new Error("ASSERT: "+t)}function ME(e){return e>=48&&e<=57}function OE(e){return"0123456789abcdefABCDEF".includes(e)}function zE(e){return"01234567".includes(e)}function NE(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function RE(e){return 10===e||13===e||8232===e||8233===e}function TE(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&SE.test(String.fromCharCode(e))}function PE(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&FE.test(String.fromCharCode(e))}const LE={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function BE(){for(;vE<bE;){const e=yE.charCodeAt(vE);if(!NE(e)&&!RE(e))break;++vE}}function jE(e){var t,n,i,r=0;for(n="u"===e?4:2,t=0;t<n;++t)vE<bE&&OE(yE[vE])?(i=yE[vE++],r=16*r+"0123456789abcdef".indexOf(i.toLowerCase())):n$({},_E,AE);return String.fromCharCode(r)}function IE(){var e,t,n,i;for(t=0,"}"===(e=yE[vE])&&n$({},_E,AE);vE<bE&&OE(e=yE[vE++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&n$({},_E,AE),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function qE(){var e,t;for(e=yE.charCodeAt(vE++),t=String.fromCharCode(e),92===e&&(117!==yE.charCodeAt(vE)&&n$({},_E,AE),++vE,(e=jE("u"))&&"\\"!==e&&TE(e.charCodeAt(0))||n$({},_E,AE),t=e);vE<bE&&PE(e=yE.charCodeAt(vE));)++vE,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==yE.charCodeAt(vE)&&n$({},_E,AE),++vE,(e=jE("u"))&&"\\"!==e&&PE(e.charCodeAt(0))||n$({},_E,AE),t+=e);return t}function UE(){var e,t;return e=vE,t=92===yE.charCodeAt(vE)?qE():function(){var e,t;for(e=vE++;vE<bE;){if(92===(t=yE.charCodeAt(vE)))return vE=e,qE();if(!PE(t))break;++vE}return yE.slice(e,vE)}(),{type:1===t.length?3:LE.hasOwnProperty(t)?4:"null"===t?5:"true"===t||"false"===t?1:3,value:t,start:e,end:vE}}function WE(){var e,t,n,i,r=vE,o=yE.charCodeAt(vE),a=yE[vE];switch(o){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++vE,{type:7,value:String.fromCharCode(o),start:r,end:vE};default:if(61===(e=yE.charCodeAt(vE+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return vE+=2,{type:7,value:String.fromCharCode(o)+String.fromCharCode(e),start:r,end:vE};case 33:case 61:return vE+=2,61===yE.charCodeAt(vE)&&++vE,{type:7,value:yE.slice(r,vE),start:r,end:vE}}}return">>>="===(i=yE.substr(vE,4))?{type:7,value:i,start:r,end:vE+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:r,end:vE+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".includes(a)||"=>"===t?{type:7,value:t,start:r,end:vE+=2}:("//"===t&&n$({},_E,AE),"<>=!+-*%&|^/".includes(a)?{type:7,value:a,start:r,end:++vE}:void n$({},_E,AE))}function HE(){var e,t,n;if(CE(ME((n=yE[vE]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=vE,e="","."!==n){if(e=yE[vE++],n=yE[vE],"0"===e){if("x"===n||"X"===n)return++vE,function(e){let t="";for(;vE<bE&&OE(yE[vE]);)t+=yE[vE++];return 0===t.length&&n$({},_E,AE),TE(yE.charCodeAt(vE))&&n$({},_E,AE),{type:6,value:parseInt("0x"+t,16),start:e,end:vE}}(t);if(zE(n))return function(e){let t="0"+yE[vE++];for(;vE<bE&&zE(yE[vE]);)t+=yE[vE++];return(TE(yE.charCodeAt(vE))||ME(yE.charCodeAt(vE)))&&n$({},_E,AE),{type:6,value:parseInt(t,8),octal:!0,start:e,end:vE}}(t);n&&ME(n.charCodeAt(0))&&n$({},_E,AE)}for(;ME(yE.charCodeAt(vE));)e+=yE[vE++];n=yE[vE]}if("."===n){for(e+=yE[vE++];ME(yE.charCodeAt(vE));)e+=yE[vE++];n=yE[vE]}if("e"===n||"E"===n)if(e+=yE[vE++],"+"!==(n=yE[vE])&&"-"!==n||(e+=yE[vE++]),ME(yE.charCodeAt(vE)))for(;ME(yE.charCodeAt(vE));)e+=yE[vE++];else n$({},_E,AE);return TE(yE.charCodeAt(vE))&&n$({},_E,AE),{type:6,value:parseFloat(e),start:t,end:vE}}function GE(){var e,t,n,i;return xE=null,BE(),e=vE,t=function(){var e,t,n,i;for(CE("/"===(e=yE[vE]),"Regular expression literal must start with a slash"),t=yE[vE++],n=!1,i=!1;vE<bE;)if(t+=e=yE[vE++],"\\"===e)RE((e=yE[vE++]).charCodeAt(0))&&n$({},EE),t+=e;else if(RE(e.charCodeAt(0)))n$({},EE);else if(n)"]"===e&&(n=!1);else{if("/"===e){i=!0;break}"["===e&&(n=!0)}return i||n$({},EE),{value:t.substr(1,t.length-2),literal:t}}(),n=function(){var e,t,n;for(t="",n="";vE<bE&&PE((e=yE[vE]).charCodeAt(0));)++vE,"\\"===e&&vE<bE?n$({},_E,AE):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&n$({},kE,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.includes("u")&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((e,t)=>{if(parseInt(t,16)<=1114111)return"x";n$({},kE)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(i){n$({},kE)}try{return new RegExp(e,t)}catch(r){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:vE}}function VE(){if(BE(),vE>=bE)return{type:2,start:vE,end:vE};const e=yE.charCodeAt(vE);return TE(e)?UE():40===e||41===e||59===e?WE():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(CE("'"===(e=yE[vE])||'"'===e,"String literal must starts with a quote"),t=vE,++vE;vE<bE;){if((n=yE[vE++])===e){e="";break}if("\\"===n)if((n=yE[vE++])&&RE(n.charCodeAt(0)))"\r"===n&&"\n"===yE[vE]&&++vE;else switch(n){case"u":case"x":"{"===yE[vE]?(++vE,r+=IE()):r+=jE(n);break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:zE(n)?(0!==(i="01234567".indexOf(n))&&(o=!0),vE<bE&&zE(yE[vE])&&(o=!0,i=8*i+"01234567".indexOf(yE[vE++]),"0123".includes(n)&&vE<bE&&zE(yE[vE])&&(i=8*i+"01234567".indexOf(yE[vE++]))),r+=String.fromCharCode(i)):r+=n}else{if(RE(n.charCodeAt(0)))break;r+=n}}return""!==e&&n$({},_E,AE),{type:8,value:r,octal:o,start:t,end:vE}}():46===e?ME(yE.charCodeAt(vE+1))?HE():WE():ME(e)?HE():WE()}function XE(){const e=xE;return vE=e.end,xE=VE(),vE=e.end,e}function YE(){const e=vE;xE=VE(),vE=e}function JE(e,t,n){const i=new mE("||"===e||"&&"===e?"LogicalExpression":"BinaryExpression");return i.operator=e,i.left=t,i.right=n,i}function QE(e,t){const n=new mE("CallExpression");return n.callee=e,n.arguments=t,n}function KE(e){const t=new mE(wE);return t.name=e,t}function ZE(e){const t=new mE("Literal");return t.value=e.value,t.raw=yE.slice(e.start,e.end),e.regex&&("//"===t.raw&&(t.raw="/(?:)/"),t.regex=e.regex),t}function e$(e,t,n){const i=new mE("MemberExpression");return i.computed="["===e,i.object=t,i.property=n,i.computed||(n.member=!0),i}function t$(e,t,n){const i=new mE("Property");return i.key=t,i.value=n,i.kind=e,i}function n$(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,((e,t)=>(CE(t<i.length,"Message reference must be in range"),i[t])));throw(n=new Error(r)).index=vE,n.description=r,n}function i$(e){2===e.type&&n$(e,"Unexpected end of input"),6===e.type&&n$(e,"Unexpected number"),8===e.type&&n$(e,"Unexpected string"),3===e.type&&n$(e,"Unexpected identifier"),4===e.type&&n$(e,"Unexpected reserved word"),n$(e,_E,e.value)}function r$(e){const t=XE();7===t.type&&t.value===e||i$(t)}function o$(e){return 7===xE.type&&xE.value===e}function a$(e){return 4===xE.type&&xE.value===e}function s$(){const e=[];for(vE=xE.start,r$("[");!o$("]");)o$(",")?(XE(),e.push(null)):(e.push(b$()),o$("]")||r$(","));return XE(),function(e){const t=new mE("ArrayExpression");return t.elements=e,t}(e)}function l$(){vE=xE.start;const e=XE();return 8===e.type||6===e.type?(e.octal&&n$(e,$E),ZE(e)):KE(e.value)}function u$(){var e,t,n;return vE=xE.start,3===(e=xE).type?(n=l$(),r$(":"),t$("init",n,b$())):2!==e.type&&7!==e.type?(t=l$(),r$(":"),t$("init",t,b$())):void i$(e)}function c$(){var e,t,n=[],i={},r=String;for(vE=xE.start,r$("{");!o$("}");)t="$"+((e=u$()).key.type===wE?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(i,t)?n$({},"Duplicate data property in object literal not allowed in strict mode"):i[t]=!0,n.push(e),o$("}")||r$(",");return r$("}"),function(e){const t=new mE("ObjectExpression");return t.properties=e,t}(n)}const f$={if:1};function d$(){var e,t,n;if(o$("("))return function(){r$("(");const e=x$();return r$(")"),e}();if(o$("["))return s$();if(o$("{"))return c$();if(e=xE.type,vE=xE.start,3===e||f$[xE.value])n=KE(XE().value);else if(8===e||6===e)xE.octal&&n$(xE,$E),n=ZE(XE());else{if(4===e)throw new Error(DE);1===e?((t=XE()).value="true"===t.value,n=ZE(t)):5===e?((t=XE()).value=null,n=ZE(t)):o$("/")||o$("/=")?(n=ZE(GE()),YE()):i$(XE())}return n}function h$(){const e=[];if(r$("("),!o$(")"))for(;vE<bE&&(e.push(b$()),!o$(")"));)r$(",");return r$(")"),e}function p$(){return r$("."),function(){vE=xE.start;const e=XE();return function(e){return 3===e.type||4===e.type||1===e.type||5===e.type}(e)||i$(e),KE(e.value)}()}function m$(){r$("[");const e=x$();return r$("]"),e}function g$(){const e=function(){var e;for(e=d$();;)if(o$("."))e=e$(".",e,p$());else if(o$("("))e=QE(e,h$());else{if(!o$("["))break;e=e$("[",e,m$())}return e}();if(7===xE.type&&(o$("++")||o$("--")))throw new Error(DE);return e}function y$(){var e,t;if(7!==xE.type&&4!==xE.type)t=g$();else{if(o$("++")||o$("--"))throw new Error(DE);if(o$("+")||o$("-")||o$("~")||o$("!"))e=XE(),t=y$(),t=function(e,t){const n=new mE("UnaryExpression");return n.operator=e,n.argument=t,n.prefix=!0,n}(e.value,t);else{if(a$("delete")||a$("void")||a$("typeof"))throw new Error(DE);t=g$()}}return t}function v$(e){let t=0;if(7!==e.type&&4!==e.type)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function b$(){var e,t;return e=function(){var e,t,n,i,r,o,a,s,l,u;if(e=xE,l=y$(),0===(r=v$(i=xE)))return l;for(i.prec=r,XE(),t=[e,xE],o=[l,i,a=y$()];(r=v$(xE))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,l=o.pop(),t.pop(),n=JE(s,l,a),o.push(n);(i=XE()).prec=r,o.push(i),t.push(xE),n=y$(),o.push(n)}for(n=o[u=o.length-1],t.pop();u>1;)t.pop(),n=JE(o[u-1].value,o[u-2],n),u-=2;return n}(),o$("?")&&(XE(),t=b$(),r$(":"),e=function(e,t,n){const i=new mE("ConditionalExpression");return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,b$())),e}function x$(){const e=b$();if(o$(","))throw new Error(DE);return e}function w$(e){vE=0,bE=(yE=e).length,xE=null,YE();const t=x$();if(2!==xE.type)throw new Error("Unexpect token after expression.");return t}var _$={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function k$(e){function t(t,n,i){return r=>function(t,n,i,r){let o=e(n[0]);return i&&(o=i+"("+o+")",0===i.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+t+(r<0?"":0===r?"()":"("+n.slice(1).map(e).join(",")+")")}(t,r,n,i)}const n="new Date",i="String",r="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(t){t.length<3&&s("Missing arguments to clamp function."),t.length>3&&s("Too many arguments to clamp function.");const n=t.map(e);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:t("getDate",n,0),day:t("getDay",n,0),year:t("getFullYear",n,0),month:t("getMonth",n,0),hours:t("getHours",n,0),minutes:t("getMinutes",n,0),seconds:t("getSeconds",n,0),milliseconds:t("getMilliseconds",n,0),time:t("getTime",n,0),timezoneoffset:t("getTimezoneOffset",n,0),utcdate:t("getUTCDate",n,0),utcday:t("getUTCDay",n,0),utcyear:t("getUTCFullYear",n,0),utcmonth:t("getUTCMonth",n,0),utchours:t("getUTCHours",n,0),utcminutes:t("getUTCMinutes",n,0),utcseconds:t("getUTCSeconds",n,0),utcmilliseconds:t("getUTCMilliseconds",n,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase",i,0),lower:t("toLowerCase",i,0),substring:t("substring",i),split:t("split",i),trim:t("trim",i,0),regexp:r,test:t("test",r),if:function(t){t.length<3&&s("Missing arguments to if function."),t.length>3&&s("Too many arguments to if function.");const n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function E$(e){const t=(e=e||{}).allowed?ne(e.allowed):{},n=e.forbidden?ne(e.forbidden):{},i=e.constants||_$,r=(e.functions||k$)(h),a=e.globalvar,l=e.fieldvar,u=o(a)?a:e=>`${a}["${e}"]`;let c={},f={},d=0;function h(e){if(oe(e))return e;const t=p[e.type];return null==t&&s("Unsupported type: "+e.type),t(e)}const p={Literal:e=>e.raw,Identifier:e=>{const r=e.name;return d>0?r:m(n,r)?s("Illegal identifier: "+r):m(i,r)?i[r]:m(t,r)?r:(c[r]=1,u(r))},MemberExpression:e=>{const t=!e.computed,n=h(e.object);t&&(d+=1);const i=h(e.property);return n===l&&(f[function(e){const t=e&&e.length-1;return t&&('"'===e[0]&&'"'===e[t]||"'"===e[0]&&"'"===e[t])?e.slice(1,-1):e}(i)]=1),t&&(d-=1),n+(t?"."+i:"["+i+"]")},CallExpression:e=>{"Identifier"!==e.callee.type&&s("Illegal callee type: "+e.callee.type);const t=e.callee.name,n=e.arguments,i=m(r,t)&&r[t];return i||s("Unrecognized function: "+t),o(i)?i(n):i+"("+n.map(h).join(",")+")"},ArrayExpression:e=>"["+e.elements.map(h).join(",")+"]",BinaryExpression:e=>"("+h(e.left)+" "+e.operator+" "+h(e.right)+")",UnaryExpression:e=>"("+e.operator+h(e.argument)+")",ConditionalExpression:e=>"("+h(e.test)+"?"+h(e.consequent)+":"+h(e.alternate)+")",LogicalExpression:e=>"("+h(e.left)+e.operator+h(e.right)+")",ObjectExpression:e=>"{"+e.properties.map(h).join(",")+"}",Property:e=>{d+=1;const t=h(e.key);return d-=1,t+":"+h(e.value)}};function g(e){const t={code:h(e),globals:Object.keys(c),fields:Object.keys(f)};return c={},f={},t}return g.functions=r,g.constants=i,g}const $$=Symbol("vega_selection_getter");function A$(e){return e.getter&&e.getter[$$]||(e.getter=P(e.field),e.getter[$$]=!0),e.getter}const D$="intersect",S$="union",F$="or",C$="and",M$="_vgsid_",O$=P(M$),z$="index:unit";function N$(e,t){for(var n,i,r=t.fields,o=t.values,s=r.length,l=0;l<s;++l)if(n=A$(i=r[l])(e),me(n)&&(n=D(n)),me(o[l])&&(o[l]=D(o[l])),a(o[l])&&me(o[l][0])&&(o[l]=o[l].map(D)),"E"===i.type){if(a(o[l])?o[l].indexOf(n)<0:n!==o[l])return!1}else if("R"===i.type){if(!ge(n,o[l]))return!1}else if("R-RE"===i.type){if(!ge(n,o[l],!0,!1))return!1}else if("R-E"===i.type){if(!ge(n,o[l],!1,!1))return!1}else if("R-LE"===i.type&&!ge(n,o[l],!1,!0))return!1;return!0}const R$=T(O$),T$=R$.left,P$=R$.right;var L$={[`${M$}_union`]:function(...e){const t=new En;for(const n of e)for(const e of n)t.add(e);return t},[`${M$}_intersect`]:function(e,...t){e=new En(e),t=t.map(hi);e:for(const n of e)for(const i of t)if(!i.has(n)){e.delete(n);continue e}return e},E_union:function(e,t){if(!e.length)return t;for(var n=0,i=t.length;n<i;++n)e.indexOf(t[n])<0&&e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter((e=>t.indexOf(e)>=0)):t},R_union:function(e,t){var n=D(t[0]),i=D(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]<i&&(e[1]=i),e):[n,i]},R_intersect:function(e,t){var n=D(t[0]),i=D(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?i<e[0]||e[1]<n?[]:(e[0]<n&&(e[0]=n),e[1]>i&&(e[1]=i),e):[n,i]}};function B$(e,t,n,i){t[0].type!==oE&&s("First argument to selection functions must be a string literal.");const r=t[0].value,o="unit",a="@"+o,l=":"+r;(t.length>=2&&R(t).value)!==D$||m(i,a)||(i[a]=n.getData(r).indataRef(n,o)),m(i,l)||(i[l]=n.getData(r).tuplesRef())}function j$(e){const t=this.context.data[e];return t?t.values.value:[]}const I$=e=>function(t,n){const i=this.context.dataflow.locale();return null===t?"null":i[e](n)(t)},q$=I$("format"),U$=I$("timeFormat"),W$=I$("utcFormat"),H$=I$("timeParse"),G$=I$("utcParse"),V$=new Date(2e3,0,1);function X$(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(V$.setYear(2e3),V$.setMonth(e),V$.setDate(t),U$.call(this,V$,n)):""}function Y$(e,t,n,i){t[0].type!==oE&&s("First argument to data functions must be a string literal.");const r=t[0].value,o=":"+r;if(!m(o,i))try{i[o]=n.getData(r).tuplesRef()}catch(a){}}function J$(e,t,n,i){if(t[0].type===oE)Q$(n,i,t[0].value);else for(e in n.scales)Q$(n,i,e)}function Q$(e,t,n){const i="%"+n;if(!m(t,i))try{t[i]=e.scaleRef(n)}catch(r){}}function K$(e,t){if(o(e))return e;if(oe(e)){const i=t.scales[e];return i&&((n=i.value)&&!0===n[$l])?i.value:void 0}var n}function Z$(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=J$,n._range=J$,n._scale=J$;const i=t=>"_["+(t.type===oE?he("%"+t.value):he("%")+"+"+e(t))+"]";return{_bandwidth:e=>`this.__bandwidth(${i(e[0])})`,_range:e=>`${i(e[0])}.range()`,_scale:t=>`${i(t[0])}(${e(t[1])})`}}function eA(e,t){return function(n,i,r){if(n){const t=K$(n,(r||this).context);return t&&t.path[e](i)}return t(i)}}const tA=eA("area",(function(e){return jg=new ri,_g(e,Ig),2*jg})),nA=eA("bounds",(function(e){var t,n,i,r,o,a,s;if(Mg=Cg=-(Sg=Fg=1/0),Pg=[],_g(e,my),n=Pg.length){for(Pg.sort(Ey),t=1,o=[i=Pg[0]];t<n;++t)$y(i,(r=Pg[t])[0])||$y(i,r[1])?(ky(i[0],r[1])>ky(i[0],i[1])&&(i[1]=r[1]),ky(r[0],i[1])>ky(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(a=-1/0,t=0,i=o[n=o.length-1];t<=n;i=r,++t)r=o[t],(s=ky(i[1],r[0]))>a&&(a=s,Sg=r[0],Cg=i[1])}return Pg=Lg=null,Sg===1/0||Fg===1/0?[[NaN,NaN],[NaN,NaN]]:[[Sg,Fg],[Cg,Mg]]})),iA=eA("centroid",(function(e){Zg=ey=ty=ny=iy=ry=oy=ay=0,sy=new ri,ly=new ri,uy=new ri,_g(e,Ay);var t=+sy,n=+ly,i=+uy,r=sg(t,n,i);return r<Xm&&(t=ry,n=oy,i=ay,ey<Vm&&(t=ty,n=ny,i=iy),(r=sg(t,n,i))<Xm)?[NaN,NaN]:[ig(n,t)*Zm,mg(i/r)*Zm]}));function rA(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(i){e.warn(i)}return n[n.length-1]}function oA(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function aA(e){const t=vn(e);return.2126*oA(t.r)+.7152*oA(t.g)+.0722*oA(t.b)}function sA(e,t){return e===t||e!=e&&t!=t||(a(e)?!(!a(t)||e.length!==t.length)&&function(e,t){for(let n=0,i=e.length;n<i;++n)if(!sA(e[n],t[n]))return!1;return!0}(e,t):!(!re(e)||!re(t))&&lA(e,t))}function lA(e,t){for(const n in e)if(!sA(e[n],t[n]))return!1;return!0}function uA(e){return t=>lA(e,t)}const cA={};function fA(e){return a(e)||ArrayBuffer.isView(e)?e:null}function dA(e){return fA(e)||(oe(e)?e:null)}const hA=e=>e.data;function pA(e,t){const n=j$.call(t,e);return n.root&&n.root.lookup||{}}const mA=()=>"undefined"!=typeof window&&window||null;function gA(e,t,n){if(!e)return[];const[i,o]=e,a=(new hc).set(i[0],i[1],o[0],o[1]);return Qh(n||this.context.dataflow.scenegraph().root,a,function(e){let t=null;if(e){const n=r(e.marktype),i=r(e.markname);t=e=>(!n.length||n.some((t=>e.marktype===t)))&&(!i.length||i.some((t=>e.name===t)))}return t}(t))}const yA={random:()=>io(),cumulativeNormal:fo,cumulativeLogNormal:vo,cumulativeUniform:Eo,densityNormal:co,densityLogNormal:yo,densityUniform:ko,quantileNormal:ho,quantileLogNormal:bo,quantileUniform:$o,sampleNormal:uo,sampleLogNormal:go,sampleUniform:_o,isArray:a,isBoolean:ye,isDate:me,isDefined:e=>void 0!==e,isNumber:ie,isObject:re,isRegExp:ve,isString:oe,isTuple:pr,isValid:e=>null!=e&&e==e,toBoolean:be,toDate:e=>xe(e),toNumber:D,toString:we,indexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return dA(e).indexOf(...n)},join:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return fA(e).join(...n)},lastindexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return dA(e).lastIndexOf(...n)},replace:function(e,t,n){return o(n)&&s("Function argument passed to replace."),String(e).replace(t,n)},reverse:function(e){return fA(e).slice().reverse()},slice:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return dA(e).slice(...n)},flush:_e,lerp:ke,merge:function(){const e=[].slice.call(arguments);return e.unshift({}),w(...e)},pad:Ee,peek:R,pluck:function(e,t){const n=cA[t]||(cA[t]=P(t));return a(e)?e.map(n):n(e)},span:I,inrange:ge,truncate:$e,rgb:vn,lab:kt,hcl:Mt,hsl:on,luminance:aA,contrast:function(e,t){const n=aA(e),i=aA(t);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)},sequence:Yt,format:q$,utcFormat:W$,utcParse:G$,utcOffset:Ae,utcSequence:De,timeFormat:U$,timeParse:H$,timeOffset:Se,timeSequence:Fe,timeUnitSpecifier:Ce,monthFormat:function(e){return X$.call(this,e,1,"%B")},monthAbbrevFormat:function(e){return X$.call(this,e,1,"%b")},dayFormat:function(e){return X$.call(this,0,2+e,"%A")},dayAbbrevFormat:function(e){return X$.call(this,0,2+e,"%a")},quarter:Me,utcquarter:Oe,week:ze,utcweek:Ne,dayofyear:Re,utcdayofyear:Te,warn:function(){return rA(this.context.dataflow,"warn",arguments)},info:function(){return rA(this.context.dataflow,"info",arguments)},debug:function(){return rA(this.context.dataflow,"debug",arguments)},extent:e=>A(e),inScope:function(e){const t=this.context.group;let n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},intersect:gA,clampRange:Pe,pinchDistance:function(e){const t=e.touches,n=t[0].clientX-t[1].clientX,i=t[0].clientY-t[1].clientY;return Math.hypot(n,i)},pinchAngle:function(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){const e=mA();return e?e.screen:{}},containerSize:function(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){const e=mA();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return Ks(e||0,t||0,n||0)},setdata:function(e,t){const n=this.context.dataflow,i=this.context.data[e].input;return n.pulse(i,n.changeset().remove(l).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?Tu(n,t=t||$u(e)):e}},panLinear:Le,panLog:Be,panPow:je,panSymlog:Ie,zoomLinear:de,zoomLog:ue,zoomPow:ce,zoomSymlog:fe,encode:function(e,t,n){if(e){const n=this.context.dataflow,i=e.mark.source;n.pulse(i,n.changeset().encode(e,t))}return void 0!==n?n:e},modify:function(e,t,n,i,r,o){const s=this.context.dataflow,u=this.context.data[e],c=u.input,f=s.stamp();let d,h,p=u.changes;if(!1===s._trigger||!(c.value.length||t||i))return 0;if((!p||p.stamp<f)&&(u.changes=p=s.changeset(),p.stamp=f,s.runAfter((()=>{u.modified=!0,s.pulse(c,p).run()}),!0,1)),n&&(d=!0===n?l:a(n)||pr(n)?n:uA(n),p.remove(d)),t&&p.insert(t),i&&(d=uA(i),c.value.some(d)?p.remove(d):p.insert(i)),r)for(h in o)p.modify(r,h,o[h]);return 1},lassoAppend:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const o=(e=r(e))[e.length-1];return void 0===o||Math.hypot(o[0]-t,o[1]-n)>i?[...e,[t,n]]:e},lassoPath:function(e){return r(e).reduce(((t,n,i)=>{let[r,o]=n;return t+(0==i?`M ${r},${o} `:i===e.length-1?" Z":`L ${r},${o} `)}),"")},intersectLasso:function(e,t,n){const{x:i,y:r,mark:o}=n,a=(new hc).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[s,l]of t)s<a.x1&&(a.x1=s),s>a.x2&&(a.x2=s),l<a.y1&&(a.y1=l),l>a.y2&&(a.y2=l);return a.translate(i,r),gA([[a.x1,a.y1],[a.x2,a.y2]],e,o).filter((e=>function(e,t,n){let i=0;for(let r=0,o=n.length-1;r<n.length;o=r++){const[a,s]=n[o],[l,u]=n[r];u>t!=s>t&&e<(a-l)*(t-u)/(s-u)+l&&i++}return 1&i}(e.x,e.y,t)))}},vA=["view","item","group","xy","x","y"],bA="this.",xA={},wA={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${he("$"+e)}]`,functions:function(e){const t=k$(e);vA.forEach((e=>t[e]="event.vega."+e));for(const n in yA)t[n]=bA+n;return w(t,Z$(e,yA,xA)),t},constants:_$,visitors:xA},_A=E$(wA);function kA(e,t,n){return 1===arguments.length?yA[e]:(yA[e]=t,n&&(xA[e]=n),_A&&(_A.functions[e]=bA+e),this)}function EA(e,t){const n={};let i;try{i=w$(e=oe(e)?e:he(e)+"")}catch(o){s("Expression parse error: "+e)}i.visit((e=>{if(e.type!==uE)return;const i=e.callee.name,r=wA.visitors[i];r&&r(i,e.arguments,t,n)}));const r=_A(i);return r.globals.forEach((e=>{const i="$"+e;!m(n,i)&&t.getSignal(e)&&(n[i]=t.signalRef(e))})),{$expr:w({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}kA("bandwidth",(function(e,t){const n=K$(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}),J$),kA("copy",(function(e,t){const n=K$(e,(t||this).context);return n?n.copy():void 0}),J$),kA("domain",(function(e,t){const n=K$(e,(t||this).context);return n?n.domain():[]}),J$),kA("range",(function(e,t){const n=K$(e,(t||this).context);return n&&n.range?n.range():[]}),J$),kA("invert",(function(e,t,n){const i=K$(e,(n||this).context);return i?a(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0}),J$),kA("scale",(function(e,t,n){const i=K$(e,(n||this).context);return i?i(t):void 0}),J$),kA("gradient",(function(e,t,n,i,r){e=K$(e,(r||this).context);const o=yu(t,n);let a=e.domain(),s=a[0],l=R(a),c=u;return l-s?c=jl(e,s,l):e=(e.interpolator?Dl("sequential")().interpolator(e.interpolator()):Dl("linear")().interpolate(e.interpolate()).range(e.range())).domain([s=0,l=1]),e.ticks&&(a=e.ticks(+i||15),s!==a[0]&&a.unshift(s),l!==R(a)&&a.push(l)),a.forEach((t=>o.stop(c(t),e(t)))),o}),J$),kA("geoArea",tA,J$),kA("geoBounds",nA,J$),kA("geoCentroid",iA,J$),kA("geoShape",(function(e,t,n){const i=K$(e,(n||this).context);return function(e){return i?i.path.context(e)(t):""}}),J$),kA("geoScale",(function(e,t){const n=K$(e,(t||this).context);return n&&n.scale()}),J$),kA("indata",(function(e,t,n){const i=this.context.data[e]["index:"+t],r=i?i.value.get(n):void 0;return r?r.count:r}),(function(e,t,n,i){t[0].type!==oE&&s("First argument to indata must be a string literal."),t[1].type!==oE&&s("Second argument to indata must be a string literal.");const r=t[0].value,o=t[1].value,a="@"+o;m(a,i)||(i[a]=n.getData(r).indataRef(n,o))})),kA("data",j$,Y$),kA("treePath",(function(e,t,n){const i=pA(e,this),r=i[t],o=i[n];return r&&o?r.path(o).map(hA):void 0}),Y$),kA("treeAncestors",(function(e,t){const n=pA(e,this)[t];return n?n.ancestors().map(hA):void 0}),Y$),kA("vlSelectionTest",(function(e,t,n){for(var i,r,o,a,s,l=this.context.data[e],u=l?l.values.value:[],c=l?l[z$]&&l[z$].value:void 0,f=n===D$,d=u.length,h=0;h<d;++h)if(i=u[h],c&&f){if(-1===(o=(r=r||{})[a=i.unit]||0))continue;if(s=N$(t,i),r[a]=s?-1:++o,s&&1===c.size)return!0;if(!s&&o===c.get(a).count)return!1}else if(f^(s=N$(t,i)))return s;return d&&f}),B$),kA("vlSelectionIdTest",(function(e,t,n){const i=this.context.data[e],r=i?i.values.value:[],o=i?i[z$]&&i[z$].value:void 0,a=n===D$,s=O$(t),l=T$(r,s);if(l===r.length)return!1;if(O$(r[l])!==s)return!1;if(o&&a){if(1===o.size)return!0;if(P$(r,s)-l<o.size)return!1}return!0}),B$),kA("vlSelectionResolve",(function(e,t,n,i){for(var o,a,s,l,u,c,f,d,h,p,m,g,y=this.context.data[e],v=y?y.values.value:[],b={},x={},w={},_=v.length,k=0;k<_;++k)if(l=(o=v[k]).unit,a=o.fields,s=o.values,a&&s){for(m=0,g=a.length;m<g;++m)u=a[m],d=(f=b[u.field]||(b[u.field]={}))[l]||(f[l]=[]),w[u.field]=h=u.type.charAt(0),p=L$[`${h}_union`],f[l]=p(d,r(s[m]));n&&(d=x[l]||(x[l]=[])).push(r(s).reduce(((e,t,n)=>(e[a[n].field]=t,e)),{}))}else u=M$,c=O$(o),(d=(f=b[u]||(b[u]={}))[l]||(f[l]=[])).push(c),n&&(d=x[l]||(x[l]=[])).push({[M$]:c});if(t=t||S$,b[M$]?b[M$]=L$[`${M$}_${t}`](...Object.values(b[M$])):Object.keys(b).forEach((e=>{b[e]=Object.keys(b[e]).map((t=>b[e][t])).reduce(((n,i)=>void 0===n?i:L$[`${w[e]}_${t}`](n,i)))})),v=Object.keys(x),n&&v.length){b[i?"vlPoint":"vlMulti"]=t===S$?{[F$]:v.reduce(((e,t)=>(e.push(...x[t]),e)),[])}:{[C$]:v.map((e=>({[F$]:x[e]})))}}return b}),B$),kA("vlSelectionTuples",(function(e,t){return e.map((e=>w(t.fields?{values:t.fields.map((t=>A$(t)(e.datum)))}:{[M$]:O$(e.datum)},t)))}));const $A=ne(["rule"]),AA=ne(["group","image","rect"]);function DA(e){return(e+"").toLowerCase()}function SA(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}var FA={operator:(e,t)=>SA(e,["_"],t.code),parameter:(e,t)=>SA(e,["datum","_"],t.code),event:(e,t)=>SA(e,["event"],t.code),handler:(e,t)=>SA(e,["_","event"],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{const{marktype:n,channels:i}=t;let r="var o=item,datum=o.datum,m=0,$;";for(const o in i){const e="o["+he(o)+"]";r+=`$=${i[o].code};if(${e}!==$)${e}=$,m=1;`}return r+=function(e,t){let n="";return $A[t]||(e.x2&&(e.x?(AA[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(AA[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(i,n),r+="return m;",SA(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(he).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n;const i=Function("a","b","var u, v; return "+e.map(((e,i)=>{const r=t[i];let o,a;return e.path?(o=`a${e.path}`,a=`b${e.path}`):((n=n||{})["f"+i]=e,o=`this.f${i}(a)`,a=`this.f${i}(b)`),function(e,t,n,i){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n}\n : (u > v || v == null) && u != null ? ${i}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n : v !== v && u === u ? ${i} : `}(o,a,-r,r)})).join("")+"0;");return n?i.bind(n):i}}};function CA(e,t,n){if(!e||!re(e))return e;for(let i,r=0,o=MA.length;r<o;++r)if(i=MA[r],m(e,i.key))return i.parse(e,t,n);return e}var MA=[{key:"$ref",parse:function(e,t){return t.get(e.$ref)||s("Operator not defined: "+e.$ref)}},{key:"$key",parse:function(e,t){const n="k:"+e.$key+"_"+!!e.$flat;return t.fn[n]||(t.fn[n]=U(e.$key,e.$flat,t.expr.codegen))}},{key:"$expr",parse:function(e,t,n){e.$params&&t.parseParameters(e.$params,n);const i="e:"+e.$expr.code;return t.fn[i]||(t.fn[i]=k(t.parameterExpression(e.$expr),e.$fields))}},{key:"$field",parse:function(e,t){if(!e.$field)return null;const n="f:"+e.$field+"_"+e.$name;return t.fn[n]||(t.fn[n]=P(e.$field,e.$name,t.expr.codegen))}},{key:"$encode",parse:function(e,t){const n=e.$encode,i={};for(const r in n){const e=n[r];i[r]=k(t.encodeExpression(e.$expr),e.$fields),i[r].output=e.$output}return i}},{key:"$compare",parse:function(e,t){const n="c:"+e.$compare+"_"+e.$order,i=r(e.$compare).map((e=>e&&e.$tupleid?mr:e));return t.fn[n]||(t.fn[n]=j(i,e.$order,t.expr.codegen))}},{key:"$context",parse:function(e,t){return t}},{key:"$subflow",parse:function(e,t){const n=e.$subflow;return function(e,i,r){const o=t.fork().parse(n),a=o.get(n.operators[0].id),s=o.signals.parent;return s&&s.set(r),a.detachSubflow=()=>t.detach(o),a}}},{key:"$tupleid",parse:function(){return mr}}];const OA={skip:!0};function zA(e,t,n,i){return new NA(e,t,n,i)}function NA(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||FA,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function RA(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}function TA(e,t){e&&(null==t?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}NA.prototype=RA.prototype={fork(){const e=new RA(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter((t=>t!==e));const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,i=n.dataflow,r=e.value;if(n.set(e.id,t),"collect"===DA(e.type)&&r&&(r.$ingest?i.ingest(t,r.$ingest,r.$format):r.$request?i.preload(t,r.$request,r.$format):i.pulse(t,i.changeset().insert(r))),e.root&&(n.root=t),e.parent){let r=n.get(e.parent.$ref);r?(i.connect(r,[t]),t.targets().add(r)):(n.unresolved=n.unresolved||[]).push((()=>{r=n.get(e.parent.$ref),i.connect(r,[t]),t.targets().add(r)}))}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const o in e.data){const i=n.data[o]||(n.data[o]={});e.data[o].forEach((e=>i[e]=t))}},resolve(){return(this.unresolved||[]).forEach((e=>e())),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[DA(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,i,r){this.dataflow.on(t,n,i,r,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:function(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach((e=>t.parseOperator(e))),n.forEach((e=>t.parseOperatorParameters(e))),(e.streams||[]).forEach((e=>t.parseStream(e))),(e.updates||[]).forEach((e=>t.parseUpdate(e))),t.resolve()},parseOperator:function(e){const t=this;"operator"!==DA(e.type)&&e.type?t.transform(e,e.type):t.operator(e,e.update?t.operatorExpression(e.update):null)},parseOperatorParameters:function(e){const t=this;if(e.params){const n=t.get(e.id);n||s("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}},parseParameters:function(e,t){t=t||{};const n=this;for(const i in e){const r=e[i];t[i]=a(r)?r.map((e=>CA(e,n,t))):CA(r,n,t)}return t},parseStream:function(e){var t,n=this,i=null!=e.filter?n.eventExpression(e.filter):void 0,r=null!=e.stream?n.get(e.stream):void 0;e.source?r=n.events(e.source,e.type,i):e.merge&&(r=(t=e.merge.map((e=>n.get(e))))[0].merge.apply(t[0],t.slice(1))),e.between&&(t=e.between.map((e=>n.get(e))),r=r.between(t[0],t[1])),e.filter&&(r=r.filter(i)),null!=e.throttle&&(r=r.throttle(+e.throttle)),null!=e.debounce&&(r=r.debounce(+e.debounce)),null==r&&s("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),n.stream(e,r)},parseUpdate:function(e){var t,n=this,i=re(i=e.source)?i.$ref:i,r=n.get(i),o=e.update,a=void 0;r||s("Source not defined: "+e.source),t=e.target&&e.target.$expr?n.eventExpression(e.target.$expr):n.get(e.target),o&&o.$expr&&(o.$params&&(a=n.parseParameters(o.$params)),o=n.handlerExpression(o.$expr)),n.update(e,r,t,o,a)},getState:function(e){var t=this,n={};if(e.signals){var i=n.signals={};Object.keys(t.signals).forEach((n=>{const r=t.signals[n];e.signals(n,r)&&(i[n]=r.value)}))}if(e.data){var r=n.data={};Object.keys(t.data).forEach((n=>{const i=t.data[n];e.data(n,i)&&(r[n]=i.input.value)}))}return t.subcontext&&!1!==e.recurse&&(n.subcontext=t.subcontext.map((t=>t.getState(e)))),n},setState:function(e){var t=this,n=t.dataflow,i=e.data,r=e.signals;Object.keys(r||{}).forEach((e=>{n.update(t.signals[e],r[e],OA)})),Object.keys(i||{}).forEach((e=>{n.pulse(t.data[e].input,n.changeset().remove(l).insert(i[e]))})),(e.subcontext||[]).forEach(((e,n)=>{const i=t.subcontext[n];i&&i.setState(e)}))}};const PA="default";function LA(e,t){const n=e.globalCursor()?"undefined"!=typeof document&&document.body:e.container();if(n)return null==t?n.style.removeProperty("cursor"):n.style.cursor=t}function BA(e,t){var n=e._runtime.data;return m(n,t)||s("Unrecognized data set: "+t),n[t]}function jA(e,t){_r(t)||s("Second argument to changes must be a changeset.");const n=BA(this,e);return n.modified=!0,this.pulse(n.input,t)}function IA(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function qA(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function UA(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function WA(e,t,n){var i,r,o=e._renderer,a=o&&o.canvas();return a&&(r=UA(e),(i=Ed(t.changedTouches?t.changedTouches[0]:t,a))[0]-=r[0],i[1]-=r[1]),t.dataflow=e,t.item=n,t.vega=function(e,t,n){const i=t?"group"===t.mark.marktype?t:t.mark.group:null;function r(e){var n,r=i;if(e)for(n=t;n;n=n.mark.group)if(n.mark.name===e){r=n;break}return r&&r.mark&&r.mark.interactive?r:{}}function o(e){if(!e)return n;oe(e)&&(e=r(e));const t=n.slice();for(;e;)t[0]-=e.x||0,t[1]-=e.y||0,e=e.mark&&e.mark.group;return t}return{view:g(e),item:g(t||{}),group:r,xy:o,x:e=>o(e)[0],y:e=>o(e)[1]}}(e,n,i),t}const HA="view",GA={trap:!1};function VA(e,t,n,i){e._eventListeners.push({type:n,sources:r(t),handler:i})}function XA(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return!(!1===i||re(i)&&!i[n])||(e.warn(`Blocked ${t} ${n} event listener.`),!1)}function YA(e){return e.item}function JA(e){return e.item.mark.source}function QA(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function KA(e,t,n){const i=document.createElement(e);for(const r in t)i.setAttribute(r,t[r]);return null!=n&&(i.textContent=n),i}function ZA(e,t,n,i){const r=n.event||"input",o=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,o),VA(i,t,r,o),e.set=e=>{t.value=e,t.dispatchEvent(function(e){return"undefined"!=typeof Event?new Event(e):{type:e}}(r))}}function eD(e,t,n,i){const r=i.signal(n.signal),o=KA("div",{class:"vega-bind"}),a="radio"===n.input?o:o.appendChild(KA("label"));a.appendChild(KA("span",{class:"vega-bind-name"},n.name||n.signal)),t.appendChild(o);let s=tD;switch(n.input){case"checkbox":s=nD;break;case"select":s=iD;break;case"radio":s=rD;break;case"range":s=oD}s(e,a,n,r)}function tD(e,t,n,i){const r=KA("input");for(const o in n)"signal"!==o&&"element"!==o&&r.setAttribute("input"===o?"type":o,n[o]);r.setAttribute("name",n.signal),r.value=i,t.appendChild(r),r.addEventListener("input",(()=>e.update(r.value))),e.elements=[r],e.set=e=>r.value=e}function nD(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const o=KA("input",r);t.appendChild(o),o.addEventListener("change",(()=>e.update(o.checked))),e.elements=[o],e.set=e=>o.checked=!!e||null}function iD(e,t,n,i){const r=KA("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((e,t)=>{const n={value:e};aD(e,i)&&(n.selected=!0),r.appendChild(KA("option",n,(o[t]||e)+""))})),t.appendChild(r),r.addEventListener("change",(()=>{e.update(n.options[r.selectedIndex])})),e.elements=[r],e.set=e=>{for(let t=0,i=n.options.length;t<i;++t)if(aD(n.options[t],e))return void(r.selectedIndex=t)}}function rD(e,t,n,i){const r=KA("span",{class:"vega-bind-radio"}),o=n.labels||[];t.appendChild(r),e.elements=n.options.map(((t,a)=>{const s={type:"radio",name:n.signal,value:t};aD(t,i)&&(s.checked=!0);const l=KA("input",s);l.addEventListener("change",(()=>e.update(t)));const u=KA("label",{},(o[a]||t)+"");return u.prepend(l),r.appendChild(u),l})),e.set=t=>{const n=e.elements,i=n.length;for(let e=0;e<i;++e)aD(n[e].value,t)&&(n[e].checked=!0)}}function oD(e,t,n,i){i=void 0!==i?i:(+n.max+ +n.min)/2;const r=null!=n.max?n.max:Math.max(100,+i)||100,o=n.min||Math.min(0,r,+i)||0,a=n.step||pe(o,r,100),s=KA("input",{type:"range",name:n.signal,min:o,max:r,step:a});s.value=i;const l=KA("span",{},+i);t.appendChild(s),t.appendChild(l);const u=()=>{l.textContent=s.value,e.update(+s.value)};s.addEventListener("input",u),s.addEventListener("change",u),e.elements=[s],e.set=e=>{s.value=e,l.textContent=e}}function aD(e,t){return e===t||e+""==t+""}function sD(e,t,n,i,r,o){return(t=t||new i(e.loader())).initialize(n,IA(e),qA(e),UA(e),r,o).background(e.background())}function lD(e,t){return t?function(){try{t.apply(this,arguments)}catch(n){e.error(n)}}:null}function uD(e,t,n){if("string"==typeof t){if("undefined"==typeof document)return e.error("DOM document instance not found."),null;if(!(t=document.querySelector(t)))return e.error("Signal bind element not found: "+t),null}if(t&&n)try{t.textContent=""}catch(i){t=null,e.error(i)}return t}const cD=e=>+e||0;function fD(e){return re(e)?{top:cD(e.top),bottom:cD(e.bottom),left:cD(e.left),right:cD(e.right)}:(e=>({top:e,bottom:e,left:e,right:e}))(cD(e))}async function dD(e,t,n,i){const r=Jh(t),o=r&&r.headless;return o||s("Unrecognized renderer type: "+t),await e.runAsync(),sD(e,null,null,o,n,i).renderAsync(e._scenegraph.root)}var hD="width",pD="height",mD="padding",gD={skip:!0};function yD(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===mD?i.left+i.right:0)}function vD(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===mD?i.top+i.bottom:0)}function bD(e,t){return t.modified&&a(t.input.value)&&!e.startsWith("_:vega:_")}function xD(e,t){return!("parent"===e||t instanceof Yr.proxy)}function wD(e,t,n,i){const r=e.element();r&&r.setAttribute("title",function(e){return null==e?"":a(e)?_D(e):re(e)&&!me(e)?(t=e,Object.keys(t).map((e=>{const n=t[e];return e+": "+(a(n)?_D(n):kD(n))})).join("\n")):e+"";var t}(i))}function _D(e){return"["+e.map(kD).join(", ")+"]"}function kD(e){return a(e)?"[…]":re(e)&&!me(e)?"{…}":e}function ED(e,t){const n=this;if(t=t||{},Gr.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),null!=t.logLevel&&n.logLevel(t.logLevel),t.locale||e.locale){const i=w({},e.locale,t.locale);n.locale(qe(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||Xh.Canvas,n._scenegraph=new yd;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||wD,n._redraw=!0,n._handler=(new Xd).scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(e){const t=w({defaults:{}},e),n=(e,t)=>{t.forEach((t=>{a(e[t])&&(e[t]=ne(e[t]))}))};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const r=function(e,t,n){return zA(e,Yr,yA,n).parse(t)}(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map((e=>({state:null,param:w({},e)}))),r.root&&r.root.set(i),i.source=r.data.root.input,n.pulse(r.data.root.input,n.changeset().insert(i.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=yD(n,n._width),n._viewHeight=vD(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(e){var t=e._signals,n=t[hD],i=t[pD],r=t[mD];function o(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(t=>{e._width=t.size,e._viewWidth=yD(e,t.size),o()}),{size:n}),e._resizeHeight=e.add(null,(t=>{e._height=t.size,e._viewHeight=vD(e,t.size),o()}),{size:i});const a=e.add(null,o,{pad:r});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=i.rank+1,a.rank=r.rank+1}(n),function(e){e.add(null,(t=>(e._background=t.bg,e._resize=1,t.bg)),{bg:e._signals.background})}(n),function(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:PA,item:null}));e.on(e.events("view","pointermove"),t,((e,n)=>{const i=t.value,r=i?oe(i)?i:i.user:PA,o=n.item&&n.item.cursor||null;return i&&r===i.user&&o==i.item?i:{user:r,item:o}})),e.add(null,(function(t){let n=t.cursor,i=this.value;return oe(n)||(i=n.item,n=n.user),LA(e,n&&n!==PA?n:i||n),i}),{cursor:t})}(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function $D(e,t){return m(e._signals,t)?e._signals[t]:s("Unrecognized signal name: "+he(t))}function AD(e,t){const n=(e._targets||[]).filter((e=>e._update&&e._update.handler===t));return n.length?n[0]:null}function DD(e,t,n,i){let r=AD(n,i);return r||(r=lD(e,(()=>i(t,n.value))),r.handler=i,e.on(n,null,r)),e}function SD(e,t,n){const i=AD(t,n);return i&&t._targets.remove(i),e}i(ED,Gr,{async evaluate(e,t,n){if(await Gr.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,r=UA(i=this),o=IA(i),a=qA(i),i._renderer.background(i.background()),i._renderer.resize(o,a,r),i._handler.origin(r),i._resizeListeners.forEach((e=>{try{e(o,a)}catch(t){i.error(t)}}))),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(s){this.error(s)}var i,r,o,a;return n&&fr(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=null!=e?e+"":null;return t!==this._desc&&TA(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){const i=$D(this,e);return 1===arguments.length?i.value:this.update(i,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",fD(e)):fD(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(Jh(e)||s("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(Gr.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch($D(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(e,t,n,i,r,o){this.runAfter((a=>{let s=0;a._autosize=0,a.width()!==n&&(s=1,a.signal(hD,n,gD),a._resizeWidth.skip(!0)),a.height()!==i&&(s=1,a.signal(pD,i,gD),a._resizeHeight.skip(!0)),a._viewWidth!==e&&(a._resize=1,a._viewWidth=e),a._viewHeight!==t&&(a._resize=1,a._viewHeight=t),a._origin[0]===r[0]&&a._origin[1]===r[1]||(a._resize=1,a._origin=r),s&&a.run("enter"),o&&a.runAfter((e=>e.resize()))}),!1,1)},addEventListener(e,t,n){let i=t;return n&&!1===n.trap||(i=lD(this,t),i.raw=t),this._handler.on(e,i),this},removeEventListener(e,t){for(var n,i,r=this._handler.handlers(e),o=r.length;--o>=0;)if(i=r[o].type,n=r[o].handler,e===i&&(t===n||t===n.raw)){this._handler.off(i,n);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.includes(e)||t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return DD(this,e,$D(this,e),t)},removeSignalListener(e,t){return SD(this,$D(this,e),t)},addDataListener(e,t){return DD(this,e,BA(this,e).values,t)},removeDataListener(e,t){return SD(this,BA(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=LA(this,null);this._globalCursor=!!e,t&&LA(this,t)}return this}return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:function(e,t){this._timers.push(function(e,t,n){var i=new yn,r=t;return null==t?(i.restart(e,t,n),i):(i._restart=i.restart,i.restart=function(e,t,n){t=+t,n=null==n?gn():+n,i._restart((function o(a){a+=r,i._restart(o,r+=t,n),e(a)}),t,n)},i.restart(e,t,n),i)}((function(t){e({timestamp:Date.now(),elapsed:t})}),t))},events:function(e,t,n){var i,r=this,o=new Mr(n),a=function(n,i){r.runAsync(null,(()=>{e===HA&&function(e,t){var n=e._eventConfig.defaults,i=n.prevent,r=n.allow;return!1!==i&&!0!==r&&(!0===i||!1===r||(i?i[t]:r?!r[t]:e.preventDefault()))}(r,t)&&n.preventDefault(),o.receive(WA(r,n,i))}))};if("timer"===e)XA(r,"timer",t)&&r.timer(a,t);else if(e===HA)XA(r,"view",t)&&r.addEventListener(t,a,GA);else if("window"===e?XA(r,"window",t)&&"undefined"!=typeof window&&(i=[window]):"undefined"!=typeof document&&XA(r,"selector",t)&&(i=Array.from(document.querySelectorAll(e))),i){for(var s=0,l=i.length;s<l;++s)i[s].addEventListener(t,a);VA(r,i,t,a)}else r.warn("Can not resolve event source: "+e);return o},finalize:function(){var e,t,n,i,r,o=this._tooltip,a=this._timers,s=this._handler.handlers(),l=this._eventListeners;for(e=a.length;--e>=0;)a[e].stop();for(e=l.length;--e>=0;)for(t=(n=l[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);for(o&&o.call(this,this._handler,null,null,null),e=s.length;--e>=0;)r=s[e].type,i=s[e].handler,this._handler.off(r,i);return this},hover:function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","pointerover",YA),JA,QA(e)),this.on(this.events("view","pointerout",YA),JA,QA(t)),this},data:function(e,t){return arguments.length<2?BA(this,e).values.value:jA.call(this,e,kr().remove(l).insert(t))},change:jA,insert:function(e,t){return jA.call(this,e,kr().insert(t))},remove:function(e,t){return jA.call(this,e,kr().remove(t))},scale:function(e){var t=this._runtime.scales;return m(t,e)||s("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,o=Jh(i);e=n._el=e?uD(n,e,!0):null,function(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),TA(t,e.description()))}(n),o||n.error("Unrecognized renderer type: "+i);const a=o.handler||Xd,s=e?o.renderer:o.headless;return n._renderer=s?sD(n,n._renderer,e,s):null,n._handler=function(e,t,n,i){const r=new i(e.loader(),lD(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,UA(e),e);return t&&t.handlers().forEach((e=>{r.on(e.type,e.handler)})),r}(n,n._handler,e,a),n._redraw=!0,e&&"none"!==r&&(t=t?n._elBind=uD(n,t,!0):e.appendChild(KA("form",{class:"vega-bindings"})),n._bind.forEach((e=>{e.param.element&&"container"!==r&&(e.element=uD(n,e.param.element,!!e.param.input))})),n._bind.forEach((e=>{!function(e,t,n){if(!t)return;const i=n.param;let r=n.state;r||(r=n.state={elements:null,active:!1,set:null,update:t=>{t!=e.signal(i.signal)&&e.runAsync(null,(()=>{r.source=!0,e.signal(i.signal,t)}))}},i.debounce&&(r.update=y(i.debounce,r.update))),(null==i.input&&i.element?ZA:eD)(r,t,i,e),r.active||(e.on(e._signals[i.signal],null,(()=>{r.source?r.source=!1:r.set(e.signal(i.signal))})),r.active=!0)}(n,e.element||t,e)}))),n},toImageURL:async function(e,t){e!==Xh.Canvas&&e!==Xh.SVG&&e!==Xh.PNG&&s("Unrecognized image type: "+e);const n=await dD(this,e,t);return e===Xh.SVG?function(e,t){const n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},toCanvas:async function(e,t){return(await dD(this,Xh.Canvas,e,t)).canvas()},toSVG:async function(e){return(await dD(this,Xh.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:bD,signals:xD,recurse:!0})},setState:function(e){return this.runAsync(null,(t=>{t._trigger=!1,t._runtime.setState(e)}),(e=>{e._trigger=!0})),this},_watchPixelRatio:function(){if("canvas"===this.renderer()&&this._renderer._canvas){let e=null;const t=()=>{null!=e&&e();const n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener("change",t),e=()=>{n.removeEventListener("change",t)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};t()}}});const FD="[",CD="]",MD=/[[\]{}]/,OD={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let zD,ND;function RD(e,t,n){return zD=t||"view",ND=n||OD,PD(e.trim()).map(LD)}function TD(e,t,n,i,r){const o=e.length;let a,s=0;for(;t<o;++t){if(a=e[t],!s&&a===n)return t;r&&r.indexOf(a)>=0?--s:i&&i.indexOf(a)>=0&&++s}return t}function PD(e){const t=[],n=e.length;let i=0,r=0;for(;r<n;)r=TD(e,r,",","[{","]}"),t.push(e.substring(i,r).trim()),i=++r;if(0===t.length)throw"Empty event selector: "+e;return t}function LD(e){return"["===e[0]?function(e){const t=e.length;let n,i=1;if(i=TD(e,i,CD,FD,CD),i===t)throw"Empty between selector: "+e;if(n=PD(e.substring(1,i)),2!==n.length)throw"Between selector must have two elements: "+e;if(e=e.slice(i+1).trim(),">"!==e[0])throw"Expected '>' after between selector: "+e;n=n.map(LD);const r=LD(e.slice(1).trim());if(r.between)return{between:n,stream:r};r.between=n;return r}(e):function(e){const t={source:zD},n=[];let i,r,o=[0,0],a=0,s=0,l=e.length,u=0;if("}"===e[l-1]){if(u=e.lastIndexOf("{"),!(u>=0))throw"Unmatched right brace: "+e;try{o=function(e){const t=e.split(",");if(!e.length||t.length>2)throw e;return t.map((t=>{const n=+t;if(n!=n)throw e;return n}))}(e.substring(u+1,l-1))}catch(f){throw"Invalid throttle specification: "+e}l=(e=e.slice(0,u).trim()).length,u=0}if(!l)throw e;"@"===e[0]&&(a=++u);i=TD(e,u,":"),i<l&&(n.push(e.substring(s,i).trim()),s=u=++i);if(u=TD(e,u,FD),u===l)n.push(e.substring(s,l).trim());else if(n.push(e.substring(s,u).trim()),r=[],s=++u,s===l)throw"Unmatched left bracket: "+e;for(;u<l;){if(u=TD(e,u,CD),u===l)throw"Unmatched left bracket: "+e;if(r.push(e.substring(s,u).trim()),u<l-1&&e[++u]!==FD)throw"Expected left bracket: "+e;s=++u}if(!(l=n.length)||MD.test(n[l-1]))throw"Invalid event selector: "+e;l>1?(t.type=n[1],a?t.markname=n[0].slice(1):(c=n[0],ND[c]?t.marktype=n[0]:t.source=n[0])):t.type=n[0];var c;"!"===t.type.slice(-1)&&(t.consume=!0,t.type=t.type.slice(0,-1));null!=r&&(t.filter=r);o[0]&&(t.throttle=o[0]);o[1]&&(t.debounce=o[1]);return t}(e)}function BD(e){return re(e)?e:{type:e||"pad"}}const jD=e=>+e||0;function ID(e){return re(e)?e.signal?e:{top:jD(e.top),bottom:jD(e.bottom),left:jD(e.left),right:jD(e.right)}:{top:t=jD(e),bottom:t,left:t,right:t};var t}const qD=e=>re(e)&&!a(e)?w({},e):{value:e};function UD(e,t,n,i){if(null!=n){return re(n)&&!a(n)||a(n)&&n.length&&re(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1}return 0}function WD(e,t,n){for(const i in t)UD(e,i,t[i]);for(const i in n)UD(e,i,n[i],"update")}function HD(e,t,n){for(const i in t)n&&m(n,i)||(e[i]=w(e[i]||{},t[i]));return e}function GD(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const VD="mark",XD="frame",YD="scope",JD="legend-label",QD="title-text",KD="title-subtitle";function ZD(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const eS=e=>oe(e)?he(e):e.signal?`(${e.signal})`:rS(e);function tS(e){if(null!=e.gradient)return function(e){const t=[e.start,e.stop,e.count].map((e=>null==e?null:he(e)));for(;t.length&&null==R(t);)t.pop();return t.unshift(eS(e.gradient)),`gradient(${t.join(",")})`}(e);let t=e.signal?`(${e.signal})`:e.color?function(e){return e.c?nS("hcl",e.h,e.c,e.l):e.h||e.s?nS("hsl",e.h,e.s,e.l):e.l||e.a?nS("lab",e.l,e.a,e.b):e.r||e.g||e.b?nS("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?rS(e.field):void 0!==e.value?he(e.value):void 0;return null!=e.scale&&(t=function(e,t){const n=eS(e.scale);null!=e.range?t=`lerp(_range(${n}), ${+e.range})`:(void 0!==t&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(1==+e.band?"":"*"+iS(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0"));return t}(e,t)),void 0===t&&(t=null),null!=e.exponent&&(t=`pow(${t},${iS(e.exponent)})`),null!=e.mult&&(t+=`*${iS(e.mult)}`),null!=e.offset&&(t+=`+${iS(e.offset)}`),e.round&&(t=`round(${t})`),t}const nS=(e,t,n,i)=>`(${e}(${[t,n,i].map(tS).join(",")})+'')`;function iS(e){return re(e)?"("+tS(e)+")":e}function rS(e){return oS(re(e)?e:{datum:e})}function oS(e){let t,n,i;if(e.signal)t="datum",i=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(i=e.parent,t+=".datum"):i=e.group}else e.datum?(t="datum",i=e.datum):s("Invalid field reference: "+he(e));return e.signal||(i=oe(i)?We(i).map(he).join("]["):oS(i)),t+"["+i+"]"}function aS(e,t,n,i,o,a){const s={};(a=a||{}).encoders={$encode:s},e=function(e,t,n,i,o){const a={},s={};let l,u,c,f;for(u in u="lineBreak","text"!==t||null==o[u]||GD(u,e)||ZD(a,u,o[u]),("legend"==n||String(n).startsWith("axis"))&&(n=null),f=n===XD?o.group:n===VD?w({},o.mark,o[t]):null,f)c=GD(u,e)||("fill"===u||"stroke"===u)&&(GD("fill",e)||GD("stroke",e)),c||ZD(a,u,f[u]);for(u in r(i).forEach((t=>{const n=o.style&&o.style[t];for(const i in n)GD(i,e)||ZD(a,i,n[i])})),e=w({},e),a)f=a[u],f.signal?(l=l||{})[u]=f:s[u]=f;return e.enter=w(s,e.enter),l&&(e.update=w(l,e.update)),e}(e,t,n,i,o.config);for(const r in e)s[r]=sS(e[r],t,a,o);return a}function sS(e,t,n,i){const r={},o={};for(const l in e)null!=e[l]&&(r[l]=lS((s=e[l],a(s)?function(e){let t="";return e.forEach((e=>{const n=tS(e);t+=e.test?`(${e.test})?${n}:`:n})),":"===R(t)&&(t+="null"),t}(s):tS(s)),i,n,o));var s;return{$expr:{marktype:t,channels:r},$fields:Object.keys(o),$output:Object.keys(e)}}function lS(e,t,n,i){const r=EA(e,t);return r.$fields.forEach((e=>i[e]=1)),w(n,r.$params),r.$expr}const uS=["value","update","init","react","bind"];function cS(e,t){s(e+' for "outer" push: '+he(t))}function fS(e,t){const n=e.name;if("outer"===e.push)t.signals[n]||cS("No prior signal definition",n),uS.forEach((t=>{void 0!==e[t]&&cS("Invalid property ",t)}));else{const i=t.addSignal(n,e.value);!1===e.react&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function dS(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function hS(e,t,n,i){return new dS(e,t,n,i)}function pS(e,t){return hS("operator",e,t)}function mS(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function gS(e,t){return t?{$field:e,$name:t}:{$field:e}}const yS=gS("key");function vS(e,t){return{$compare:e,$order:t}}function bS(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const xS="scope",wS="view";function _S(e){return e&&e.signal}function kS(e){if(_S(e))return!0;if(re(e))for(const t in e)if(kS(e[t]))return!0;return!1}function ES(e,t){return null!=e?e:t}function $S(e){return e&&e.signal||e}const AS="timer";function DS(e,t){return(e.merge?SS:e.stream?FS:e.type?CS:s("Invalid stream specification: "+he(e)))(e,t)}function SS(e,t){const n=MS({merge:e.merge.map((e=>DS(e,t)))},e,t);return t.addStream(n).id}function FS(e,t){const n=MS({stream:DS(e.stream,t)},e,t);return t.addStream(n).id}function CS(e,t){let n;var i;e.type===AS?(n=t.event(AS,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===xS?wS:i||wS,e.type);const r=MS({stream:n},e,t);return 1===Object.keys(r).length?n:t.addStream(r).id}function MS(e,t,n){let i=t.between;return i&&(2!==i.length&&s('Stream "between" parameter must have 2 entries: '+he(t)),e.between=[DS(i[0],n),DS(i[1],n)]),i=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&i.push(function(e,t,n){const i="event.item";return i+(e&&"*"!==e?"&&"+i+".mark.marktype==='"+e+"'":"")+(n?"&&"+i+".mark.role==='"+n+"'":"")+(t?"&&"+i+".mark.name==='"+t+"'":"")}(t.marktype,t.markname,t.markrole)),t.source===xS&&i.push("inScope(event.item)"),i.length&&(e.filter=EA("("+i.join(")&&(")+")",n).$expr),null!=(i=t.throttle)&&(e.throttle=+i),null!=(i=t.debounce)&&(e.debounce=+i),t.consume&&(e.consume=!0),e}const OS={code:"_.$value",ast:{type:"Identifier",value:"value"}};function zS(e,t,n){const i=e.encode,o={target:n};let a=e.events,l=e.update,u=[];a||s("Signal update missing events specification."),oe(a)&&(a=RD(a,t.isSubscope()?xS:wS)),a=r(a).filter((e=>e.signal||e.scale?(u.push(e),0):1)),u.length>1&&(u=[NS(u)]),a.length&&u.push(a.length>1?{merge:a}:a[0]),null!=i&&(l&&s("Signal encode and update are mutually exclusive."),l="encode(item(),"+he(i)+")"),o.update=oe(l)?EA(l,t):null!=l.expr?EA(l.expr,t):null!=l.value?l.value:null!=l.signal?{$expr:OS,$params:{$value:t.signalRef(l.signal)}}:s("Invalid signal update specification."),e.force&&(o.options={force:!0}),u.forEach((e=>t.addUpdate(w(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):DS(e,t)}}(e,t),o))))}function NS(e){return{signal:"["+e.map((e=>e.scale?'scale("'+e.scale+'")':e.signal))+"]"}}const RS=e=>(t,n,i)=>hS(e,n,t||void 0,i),TS=RS("aggregate"),PS=RS("axisticks"),LS=RS("bound"),BS=RS("collect"),jS=RS("compare"),IS=RS("datajoin"),qS=RS("encode"),US=RS("expression"),WS=RS("facet"),HS=RS("field"),GS=RS("key"),VS=RS("legendentries"),XS=RS("load"),YS=RS("mark"),JS=RS("multiextent"),QS=RS("multivalues"),KS=RS("overlap"),ZS=RS("params"),eF=RS("prefacet"),tF=RS("projection"),nF=RS("proxy"),iF=RS("relay"),rF=RS("render"),oF=RS("scale"),aF=RS("sieve"),sF=RS("sortitems"),lF=RS("viewlayout"),uF=RS("values");let cF=0;const fF={min:"min",max:"max",count:"sum"};function dF(e,t){const n=t.getScale(e.name).params;let i;for(i in n.domain=gF(e.domain,e,t),null!=e.range&&(n.range=EF(e,t,n)),null!=e.interpolate&&function(e,t){t.interpolate=hF(e.type||e),null!=e.gamma&&(t.interpolateGamma=hF(e.gamma))}(e.interpolate,n),null!=e.nice&&(n.nice=function(e,t){return e.signal?t.signalRef(e.signal):re(e)?{interval:hF(e.interval),step:hF(e.step)}:hF(e)}(e.nice,t)),null!=e.bins&&(n.bins=function(e,t){return e.signal||a(e)?pF(e,t):t.objectProperty(e)}(e.bins,t)),e)m(n,i)||"name"===i||(n[i]=hF(e[i],t))}function hF(e,t){return re(e)?e.signal?t.signalRef(e.signal):s("Unsupported object: "+he(e)):e}function pF(e,t){return e.signal?t.signalRef(e.signal):e.map((e=>hF(e,t)))}function mF(e){s("Can not find data set: "+he(e))}function gF(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(a(e)?yF:e.fields?bF:vF)(e,t,n);null==t.domainMin&&null==t.domainMax||s("No scale domain defined for domainMin/domainMax to override.")}function yF(e,t,n){return e.map((e=>hF(e,n)))}function vF(e,t,n){const i=n.getData(e.data);return i||mF(e.data),Ml(t.type)?i.valuesRef(n,e.field,wF(e.sort,!1)):Rl(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function bF(e,t,n){const i=e.data,r=e.fields.reduce(((e,t)=>(t=oe(t)?{data:i,field:t}:a(t)||t.signal?function(e,t){const n="_:vega:_"+cF++,i=BS({});if(a(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+he(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,aF({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e)),[]);return(Ml(t.type)?xF:Rl(t.type)?_F:kF)(e,n,r)}function xF(e,t,n){const i=wF(e.sort,!0);let r,o;const a=n.map((e=>{const n=t.getData(e.data);return n||mF(e.data),n.countsRef(t,e.field,i)})),s={groupby:yS,pulse:a};i&&(r=i.op||"count",o=i.field?bS(r,i.field):"count",s.ops=[fF[r]],s.fields=[t.fieldRef(o)],s.as=[o]),r=t.add(TS(s));const l=t.add(BS({pulse:mS(r)}));return o=t.add(uF({field:yS,sort:t.sortRef(i),pulse:mS(l)})),mS(o)}function wF(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!fF[e.op]&&s("Multiple domain scales can not be sorted using "+e.op):s("No field provided for sort aggregate op: "+e.op):re(e)?e.field="key":e={field:"key"}),e}function _F(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||mF(e.data),n.domainRef(t,e.field)}));return mS(t.add(QS({values:i})))}function kF(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||mF(e.data),n.extentRef(t,e.field)}));return mS(t.add(JS({extents:i})))}function EF(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(oe(r)){if(i&&m(i,r))return EF(e=w({},e,{range:i[r]}),t,n);"width"===r?r=[0,{signal:"width"}]:"height"===r?r=Ml(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:s("Unrecognized scale range value: "+he(r))}else{if(r.scheme)return n.scheme=a(r.scheme)?pF(r.scheme,t):hF(r.scheme,t),r.extent&&(n.schemeExtent=pF(r.extent,t)),void(r.count&&(n.schemeCount=hF(r.count,t)));if(r.step)return void(n.rangeStep=hF(r.step,t));if(Ml(e.type)&&!a(r))return gF(r,e,t);a(r)||s("Unsupported range type: "+he(r))}return r.map((e=>(a(e)?pF:hF)(e,t)))}function $F(e,t,n){return a(e)?e.map((e=>$F(e,t,n))):re(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:s("Unsupported parameter object: "+he(e)):e}const AF="top",DF="left",SF="right",FF="bottom",CF="center",MF="index",OF="label",zF="perc",NF="value",RF="guide-label",TF="guide-title",PF="group-title",LF="group-subtitle",BF="symbol",jF="gradient",IF="discrete",qF="size",UF=[qF,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],WF={name:1,style:1,interactive:1},HF={value:0},GF={value:1},VF="group",XF="rect",YF="rule",JF="text";function QF(e){return e.type=VF,e.interactive=e.interactive||!1,e}function KF(e,t){const n=(n,i)=>ES(e[n],ES(t[n],i));return n.isVertical=n=>"vertical"===ES(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>ES(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>ES(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>ES(e.columns,ES(t.columns,+n.isVertical(!0))),n}function ZF(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function eC(e,t,n){return`item.anchor === 'start' ? ${e} : item.anchor === 'end' ? ${t} : ${n}`}const tC=eC(he(DF),he(SF),he(CF));function nC(e,t){return t?e?re(e)?Object.assign({},e,{offset:nC(e.offset,t)}):{value:e,offset:t}:t:e}function iC(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=HD(e.encode,t,WF)):e.interactive=!1,e}function rC(e,t,n,i){const r=KF(e,n),o=r.isVertical(),a=r.gradientThickness(),s=r.gradientLength();let l,u,c,f,d;o?(u=[0,1],c=[0,0],f=a,d=s):(u=[0,0],c=[1,0],f=s,d=a);const h={enter:l={opacity:HF,x:HF,y:HF,width:qD(f),height:qD(d)},update:w({},l,{opacity:GF,fill:{gradient:t,start:u,stop:c}}),exit:{opacity:HF}};return WD(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),iC({type:XF,role:"legend-gradient",encode:h},i)}function oC(e,t,n,i,r){const o=KF(e,n),a=o.isVertical(),s=o.gradientThickness(),l=o.gradientLength();let u,c,f,d,h="";a?(u="y",f="y2",c="x",d="width",h="1-"):(u="x",f="x2",c="y",d="height");const p={opacity:HF,fill:{scale:t,field:NF}};p[u]={signal:h+"datum."+zF,mult:l},p[c]=HF,p[f]={signal:h+"datum.perc2",mult:l},p[d]=qD(s);const m={enter:p,update:w({},p,{opacity:GF}),exit:{opacity:HF}};return WD(m,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),iC({type:XF,role:"legend-band",key:NF,from:r,encode:m},i)}const aC=`datum.${zF}<=0?"${DF}":datum.${zF}>=1?"${SF}":"${CF}"`,sC=`datum.${zF}<=0?"${FF}":datum.${zF}>=1?"${AF}":"middle"`;function lC(e,t,n,i){const r=KF(e,t),o=r.isVertical(),a=qD(r.gradientThickness()),s=r.gradientLength();let l,u,c,f,d=r("labelOverlap"),h="";const p={enter:l={opacity:HF},update:u={opacity:GF,text:{field:OF}},exit:{opacity:HF}};return WD(p,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:ES(e.labelLimit,t.gradientLabelLimit)}),o?(l.align={value:"left"},l.baseline=u.baseline={signal:sC},c="y",f="x",h="1-"):(l.align=u.align={signal:aC},l.baseline={value:"top"},c="x",f="y"),l[c]=u[c]={signal:h+"datum."+zF,mult:s},l[f]=u[f]=a,a.offset=ES(e.labelOffset,t.gradientLabelOffset)||0,d=d?{separation:r("labelSeparation"),method:d,order:"datum."+MF}:void 0,iC({type:JF,role:JD,style:RF,key:NF,from:i,encode:p,overlap:d},n)}function uC(e,t,n,i,r){const o=KF(e,t),a=n.entries,s=!(!a||!a.interactive),l=a?a.name:void 0,u=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},d=`(${r}) ? datum.offset : datum.${qF}`,h=u?qD(u):{field:qF},p=`datum.${MF}`,m=`max(1, ${r})`;let g,y,v,b,x;h.mult=.5,g={enter:y={opacity:HF,x:{signal:d,mult:.5,offset:c},y:h},update:v={opacity:GF,x:y.x,y:y.y},exit:{opacity:HF}};let w=null,_=null;e.fill||(w=t.symbolBaseFillColor,_=t.symbolBaseStrokeColor),WD(g,{fill:o("symbolFillColor",w),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",_),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),UF.forEach((t=>{e[t]&&(v[t]=y[t]={scale:e[t],field:NF})}));const k=iC({type:"symbol",role:"legend-symbol",key:NF,from:f,clip:!!u||void 0,encode:g},n.symbols),E=qD(c);E.offset=o("labelOffset"),g={enter:y={opacity:HF,x:{signal:d,offset:E},y:h},update:v={opacity:GF,text:{field:OF},x:y.x,y:y.y},exit:{opacity:HF}},WD(g,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const $=iC({type:JF,role:JD,style:RF,key:NF,from:f,encode:g},n.labels);return g={enter:{noBound:{value:!u},width:HF,height:u?qD(u):HF,opacity:HF},exit:{opacity:HF},update:v={opacity:GF,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(b=`ceil(item.mark.items.length / ${m})`,v.row.signal=`${p}%${b}`,v.column.signal=`floor(${p} / ${b})`,x={field:["row",p]}):(v.row.signal=`floor(${p} / ${m})`,v.column.signal=`${p} % ${m}`,x={field:p}),v.column.signal=`(${r})?${v.column.signal}:${p}`,QF({role:YD,from:i={facet:{data:i,name:"value",groupby:MF}},encode:HD(g,a,WF),marks:[k,$],name:l,interactive:s,sort:x})}const cC='item.orient === "left"',fC='item.orient === "right"',dC=`(${cC} || ${fC})`,hC=`datum.vgrad && ${dC}`,pC=eC('"top"','"bottom"','"middle"'),mC=`datum.vgrad && ${fC} ? (${eC('"right"','"left"','"center"')}) : (${dC} && !(datum.vgrad && ${cC})) ? "left" : ${tC}`,gC=`item._anchor || (${dC} ? "middle" : "start")`,yC=`${hC} ? (${cC} ? -90 : 90) : 0`,vC=`${dC} ? (datum.vgrad ? (${fC} ? "bottom" : "top") : ${pC}) : "top"`;function bC(e,t){let n;return re(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+xC(e.path)+")":e.sphere&&(n="geoShape("+xC(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function xC(e){return re(e)&&e.signal?e.signal:he(e)}function wC(e){const t=e.role||"";return t.startsWith("axis")||t.startsWith("legend")||t.startsWith("title")?t:e.type===VF?YD:t||VD}function _C(e){return{marktype:e.type,name:e.name||void 0,role:e.role||wC(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function kC(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function EC(e,t){const n=Jr(e.type);n||s("Unrecognized transform type: "+he(e.type));const i=hS(n.type.toLowerCase(),null,$C(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function $C(e,t,n){const i={},r=e.params.length;for(let o=0;o<r;++o){const r=e.params[o];i[r.name]=AC(r,t,n)}return i}function AC(e,t,n){const i=e.type,r=t[e.name];return"index"===i?function(e,t,n){oe(t.from)||s('Lookup "from" parameter must be a string literal.');return n.getData(t.from).lookupRef(n,t.key)}(0,t,n):void 0!==r?"param"===i?function(e,t,n){const i=t[e.name];return e.array?(a(i)||s("Expected an array of sub-parameters. Instead: "+he(i)),i.map((t=>SC(e,t,n)))):SC(e,i,n)}(e,t,n):"projection"===i?n.projectionRef(t[e.name]):e.array&&!_S(r)?r.map((t=>DC(e,t,n))):DC(e,r,n):void(e.required&&s("Missing required "+he(t.type)+" parameter: "+he(e.name)))}function DC(e,t,n){const i=e.type;if(_S(t))return OC(i)?s("Expression references can not be signals."):zC(i)?n.fieldRef(t):NC(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||zC(i);return r&&FC(t)?n.exprRef(t.expr,t.as):r&&CC(t)?gS(t.field,t.as):OC(i)?EA(t,n):MC(i)?mS(n.getData(t).values):zC(i)?gS(t):NC(i)?n.compareRef(t):t}}function SC(e,t,n){const i=e.params.length;let r;for(let a=0;a<i;++a){r=e.params[a];for(const e in r.key)if(r.key[e]!==t[e]){r=null;break}if(r)break}r||s("Unsupported parameter: "+he(t));const o=w($C(r,t,n),r.key);return mS(n.add(ZS(o)))}const FC=e=>e&&e.expr,CC=e=>e&&e.field,MC=e=>"data"===e,OC=e=>"expr"===e,zC=e=>"field"===e,NC=e=>"compare"===e;function RC(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:mS(t.getData(e.data).output)}function TC(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}function PC(e){return oe(e)?e:null}function LC(e,t,n){const i=bS(n.op,n.field);let r;if(t.ops){for(let o=0,a=t.as.length;o<a;++o)if(t.as[o]===i)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((r=n.op.signal)?e.signalRef(r):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(i))}function BC(e,t,n,i,r,o,a){const s=t[n]||(t[n]={}),l=function(e){return re(e)?("descending"===e.order?"-":"+")+bS(e.op,e.field):""}(o);let u,c,f=PC(r);if(null!=f&&(e=t.scope,f+=l?"|"+l:"",u=s[f]),!u){const n=o?{field:yS,pulse:t.countsRef(e,r,o)}:{field:e.fieldRef(r),pulse:mS(t.output)};l&&(n.sort=e.sortRef(o)),c=e.add(hS(i,void 0,n)),a&&(t.index[r]=c),u=mS(c),null!=f&&(s[f]=u)}return u}function jC(e,t,n){const i=e.remove,r=e.insert,o=e.toggle,a=e.modify,s=e.values,l=t.add(pS()),u=EA("if("+e.trigger+',modify("'+n+'",'+[r,i,o,a,s].map((e=>null==e?"null":e)).join(",")+"),0)",t);l.update=u.$expr,l.params=u.$params}function IC(e,t){const n=wC(e),i=e.type===VF,o=e.from&&e.from.facet,a=e.overlap;let l,u,c,f,d,h,p,m=e.layout||n===YD||n===XD;const g=n===VD||m||o,y=function(e,t,n){let i,o,a,l,u;return e?(i=e.facet)&&(t||s("Only group marks can be faceted."),null!=i.field?l=u=RC(i,n):(e.data?u=mS(n.getData(e.data).aggregate):(a=EC(w({type:"aggregate",groupby:r(i.groupby)},i.aggregate),n),a.params.key=n.keyRef(i.groupby),a.params.pulse=RC(i,n),l=u=mS(n.add(a))),o=n.keyRef(i.groupby,!0))):l=mS(n.add(BS(null,[{}]))),l||(l=RC(e,n)),{key:o,pulse:l,parent:u}}(e.from,i,t);u=t.add(IS({key:y.key||(e.key?gS(e.key):void 0),pulse:y.pulse,clean:!i}));const v=mS(u);u=c=t.add(BS({pulse:v})),u=t.add(YS({markdef:_C(e),interactive:kC(e.interactive,t),clip:bC(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:mS(u)}));const b=mS(u);u=f=t.add(qS(aS(e.encode,e.type,n,e.style,t,{mod:!1,pulse:b}))),u.params.parent=t.encode(),e.transform&&e.transform.forEach((e=>{const n=EC(e,t),i=n.metadata;(i.generates||i.changes)&&s("Mark transforms should not generate new data."),i.nomod||(f.params.mod=!0),n.params.pulse=mS(u),t.add(u=n)})),e.sort&&(u=t.add(sF({sort:t.compareRef(e.sort),pulse:mS(u)})));const x=mS(u);(o||m)&&(m=t.add(lF({layout:t.objectProperty(e.layout),legends:t.legends,mark:b,pulse:x})),h=mS(m));const _=t.add(LS({mark:b,pulse:h||x}));p=mS(_),i&&(g&&(l=t.operators,l.pop(),m&&l.pop()),t.pushState(x,h||p,v),o?function(e,t,n){const i=e.from.facet,r=i.name,o=RC(i,t);let a;i.name||s("Facet must have a name: "+he(i)),i.data||s("Facet must reference a data set: "+he(i)),i.field?a=t.add(eF({field:t.fieldRef(i.field),pulse:o})):i.groupby?a=t.add(WS({key:t.keyRef(i.groupby),group:mS(t.proxy(n.parent)),pulse:o})):s("Facet must specify groupby or field: "+he(i));const l=t.fork(),u=l.add(BS()),c=l.add(aF({pulse:mS(u)}));l.addData(r,new TC(l,u,u,c)),l.addSignal("parent",null),a.params.subflow={$subflow:l.parse(e).toRuntime()}}(e,t,y):g?function(e,t,n){const i=t.add(eF({pulse:n.pulse})),r=t.fork();r.add(aF()),r.addSignal("parent",null),i.params.subflow={$subflow:r.parse(e).toRuntime()}}(e,t,y):t.parse(e),t.popState(),g&&(m&&l.push(m),l.push(_))),a&&(p=function(e,t,n){const i=e.method,r=e.bound,o=e.separation,a={separation:_S(o)?n.signalRef(o.signal):o,method:_S(i)?n.signalRef(i.signal):i,pulse:t};e.order&&(a.sort=n.compareRef({field:e.order}));if(r){const e=r.tolerance;a.boundTolerance=_S(e)?n.signalRef(e.signal):+e,a.boundScale=n.scaleRef(r.scale),a.boundOrient=r.orient}return mS(n.add(KS(a)))}(a,p,t));const k=t.add(rF({pulse:p})),E=t.add(aF({pulse:mS(k)},void 0,t.parent()));null!=e.name&&(d=e.name,t.addData(d,new TC(t,c,k,E)),e.on&&e.on.forEach((e=>{(e.insert||e.remove||e.toggle)&&s("Marks only support modify triggers."),jC(e,t,d)})))}function qC(e,t){const n=t.config.legend,i=e.encode||{},r=KF(e,n),o=i.legend||{},a=o.name||void 0,l=o.interactive,u=o.style,c={};let f,d,h,p=0;UF.forEach((t=>e[t]?(c[t]=e[t],p=p||e[t]):0)),p||s("Missing valid scale for legend.");const m=function(e,t){let n=e.type||BF;e.type||1!==function(e){return UF.reduce(((t,n)=>t+(e[n]?1:0)),0)}(e)||!e.fill&&!e.stroke||(n=Cl(t)?jF:Ol(t)?IF:BF);return n!==jF?n:Ol(t)?IF:jF}(e,t.scaleType(p)),g={title:null!=e.title,scales:c,type:m,vgrad:"symbol"!==m&&r.isVertical()},y=mS(t.add(BS(null,[g]))),v=mS(t.add(VS(d={type:m,scale:t.scaleRef(p),count:t.objectProperty(r("tickCount")),limit:t.property(r("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return m===jF?(h=[rC(e,p,n,i.gradient),lC(e,n,i.labels,v)],d.count=d.count||t.signalRef(`max(2,2*floor((${$S(r.gradientLength())})/100))`)):m===IF?h=[oC(e,p,n,i.gradient,v),lC(e,n,i.labels,v)]:(f=function(e,t){const n=KF(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,n),h=[uC(e,n,i,v,$S(f.columns))],d.size=function(e,t,n){const i=$S(WC("size",e,n)),r=$S(WC("strokeWidth",e,n)),o=$S(function(e,t,n){return ZF("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i[e]}("fontSize",t,n)}(n[1].encode,t,RF));return EA(`max(ceil(sqrt(${i})+${r}),${o})`,t)}(e,t,h[0].marks)),h=[QF({role:"legend-entry",from:y,encode:{enter:{x:{value:0},y:{value:0}}},marks:h,layout:f,interactive:l})],g.title&&h.push(function(e,t,n,i){const r=KF(e,t),o={enter:{opacity:HF},update:{opacity:GF,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:HF}};return WD(o,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:gC},angle:{signal:yC},align:{signal:mC},baseline:{signal:vC},text:e.title,fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),baseline:r("titleBaseline")}),iC({type:JF,role:"legend-title",style:TF,from:i,encode:o},n)}(e,n,i.title,y)),IC(QF({role:"legend",from:y,encode:HD(UC(r,e,n),o,WF),marks:h,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:a,interactive:l,style:u}),t)}function UC(e,t,n){const i={enter:{},update:{}};return WD(i,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),i}function WC(e,t,n){return t[e]?`scale("${t[e]}",datum)`:ZF(e,n[0].encode)}TC.fromEntries=function(e,t){const n=t.length,i=t[n-1],r=t[n-2];let o=t[0],a=null,s=1;for(o&&"load"===o.type&&(o=t[1]),e.add(t[0]);s<n;++s)t[s].params.pulse=mS(t[s-1]),e.add(t[s]),"aggregate"===t[s].type&&(a=t[s]);return new TC(e,o,r,i,a)},TC.prototype={countsRef(e,t,n){const i=this,r=i.counts||(i.counts={}),o=PC(t);let a,s,l;return null!=o&&(e=i.scope,a=r[o]),a?n&&n.field&&LC(e,a.agg.params,n):(l={groupby:e.fieldRef(t,"key"),pulse:mS(i.output)},n&&n.field&&LC(e,l,n),s=e.add(TS(l)),a=e.add(BS({pulse:mS(s)})),a={agg:s,ref:mS(a)},null!=o&&(r[o]=a)),a.ref},tuplesRef(){return mS(this.values)},extentRef(e,t){return BC(e,this,"extent","extent",t,!1)},domainRef(e,t){return BC(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return BC(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return BC(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return BC(e,this,"indata","tupleindex",t,!0,!0)}};const HC=`item.orient==="${DF}"?-90:item.orient==="${SF}"?90:0`;function GC(e,t){const n=KF(e=oe(e)?{text:e}:e,t.config.title),i=e.encode||{},r=i.group||{},o=r.name||void 0,a=r.interactive,s=r.style,l=[],u=mS(t.add(BS(null,[{}])));return l.push(function(e,t,n,i){const r={value:0},o=e.text,a={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return WD(a,{text:o,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),iC({type:JF,role:QD,style:PF,from:i,encode:a},n)}(e,n,function(e){const t=e.encode;return t&&t.title||w({name:e.name,interactive:e.interactive,style:e.style},t)}(e),u)),e.subtitle&&l.push(function(e,t,n,i){const r={value:0},o=e.subtitle,a={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return WD(a,{text:o,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),iC({type:JF,role:KD,style:LF,from:i,encode:a},n)}(e,n,i.subtitle,u)),IC(QF({role:"title",from:u,encode:VC(n,r),marks:l,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:o,interactive:a,style:s}),t)}function VC(e,t){const n={enter:{},update:{}};return WD(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:tC},angle:{signal:HC},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),HD(n,t,WF)}function XC(e,t){const n=[];e.transform&&e.transform.forEach((e=>{n.push(EC(e,t))})),e.on&&e.on.forEach((n=>{jC(n,t,e.name)})),t.addDataPipeline(e.name,function(e,t,n){const i=[];let o,a,s,l,u,c=null,f=!1,d=!1;e.values?_S(e.values)||kS(e.format)?(i.push(JC(t,e)),i.push(c=YC())):i.push(c=YC({$ingest:e.values,$format:e.format})):e.url?kS(e.url)||kS(e.format)?(i.push(JC(t,e)),i.push(c=YC())):i.push(c=YC({$request:e.url,$format:e.format})):e.source&&(c=o=r(e.source).map((e=>mS(t.getData(e).output))),i.push(null));for(a=0,s=n.length;a<s;++a)l=n[a],u=l.metadata,c||u.source||i.push(c=YC()),i.push(l),u.generates&&(d=!0),u.modifies&&!d&&(f=!0),u.source?c=l:u.changes&&(c=null);o&&(s=o.length-1,i[0]=iF({derive:f,pulse:s?o:o[0]}),(f||s)&&i.splice(1,0,YC()));c||i.push(YC());return i.push(aF({})),i}(e,t,n))}function YC(e){const t=BS({},e);return t.metadata={source:!0},t}function JC(e,t){return XS({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}const QC=e=>e===FF||e===AF,KC=(e,t,n)=>_S(e)?rM(e.signal,t,n):e===DF||e===AF?t:n,ZC=(e,t,n)=>_S(e)?nM(e.signal,t,n):QC(e)?t:n,eM=(e,t,n)=>_S(e)?iM(e.signal,t,n):QC(e)?n:t,tM=(e,t,n)=>_S(e)?oM(e.signal,t,n):e===AF?{value:t}:{value:n},nM=(e,t,n)=>sM(`${e} === '${AF}' || ${e} === '${FF}'`,t,n),iM=(e,t,n)=>sM(`${e} !== '${AF}' && ${e} !== '${FF}'`,t,n),rM=(e,t,n)=>uM(`${e} === '${DF}' || ${e} === '${AF}'`,t,n),oM=(e,t,n)=>uM(`${e} === '${AF}'`,t,n),aM=(e,t,n)=>uM(`${e} === '${SF}'`,t,n),sM=(e,t,n)=>(t=null!=t?qD(t):t,n=null!=n?qD(n):n,lM(t)&&lM(n)?{signal:`${e} ? (${t=t?t.signal||he(t.value):null}) : (${n=n?n.signal||he(n.value):null})`}:[w({test:e},t)].concat(n||[])),lM=e=>null==e||1===Object.keys(e).length,uM=(e,t,n)=>({signal:`${e} ? (${cM(t)}) : (${cM(n)})`}),cM=e=>_S(e)?e.signal:null==e?null:he(e),fM=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function dM(e,t,n,i){let r;if(t&&m(t,e))return t[e];if(m(n,e))return n[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return i[TF][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return i[RF][r]}return null}function hM(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function pM(e,t){return{scale:e.scale,range:t}}function mM(e,t,n,i,r){const o=KF(e,t),a=e.orient,s=e.gridScale,l=KC(a,1,-1),u=function(e,t){if(1===t);else if(re(e)){let n=e=w({},e);for(;null!=n.mult;){if(!re(n.mult))return n.mult=_S(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n=n.mult=w({},n.mult)}n.mult=t}else e=_S(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);return e}(e.offset,l);let c,f,d;const h={enter:c={opacity:HF},update:d={opacity:GF},exit:f={opacity:HF}};WD(h,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const p={scale:e.scale,field:NF,band:r.band,extra:r.extra,offset:r.offset,round:o("tickRound")},m=ZC(a,{signal:"height"},{signal:"width"}),g=s?{scale:s,range:0,mult:l,offset:u}:{value:0,offset:u},y=s?{scale:s,range:1,mult:l,offset:u}:w(m,{mult:l,offset:u});return c.x=d.x=ZC(a,p,g),c.y=d.y=eM(a,p,g),c.x2=d.x2=eM(a,y),c.y2=d.y2=ZC(a,y),f.x=ZC(a,p),f.y=eM(a,p),iC({type:YF,role:"axis-grid",key:NF,from:i,encode:h},n)}function gM(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function yM(e,t,n,i,r,o){const a=KF(e,t),s=e.orient,l=e.scale,u=KC(s,-1,1),c=$S(a("labelFlush")),f=$S(a("labelFlushOffset")),d=a("labelAlign"),h=a("labelBaseline");let p,m=0===c||!!c;const g=qD(r);g.mult=u,g.offset=qD(a("labelPadding")||0),g.offset.mult=u;const y={scale:l,field:NF,band:.5,offset:nC(o.offset,a("labelOffset"))},v=ZC(s,m?gM(l,c,'"left"','"right"','"center"'):{value:"center"},((e,t,n)=>_S(e)?aM(e.signal,t,n):e===SF?{value:t}:{value:n})(s,"left","right")),b=ZC(s,tM(s,"bottom","top"),m?gM(l,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=gM(l,c,`-(${f})`,f,0);m=m&&f;const w={opacity:HF,x:ZC(s,y,g),y:eM(s,y,g)},_={enter:w,update:p={opacity:GF,text:{field:OF},x:w.x,y:w.y,align:v,baseline:b},exit:{opacity:HF,x:w.x,y:w.y}};WD(_,{dx:!d&&m?ZC(s,x):null,dy:!h&&m?eM(s,x):null}),WD(_,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:d,baseline:h});const k=a("labelBound");let E=a("labelOverlap");return E=E||k?{separation:a("labelSeparation"),method:E,order:"datum.index",bound:k?{scale:l,orient:s,tolerance:k}:null}:void 0,p.align!==v&&(p.align=fM(p.align,v)),p.baseline!==b&&(p.baseline=fM(p.baseline,b)),iC({type:JF,role:"axis-label",style:RF,key:NF,from:i,encode:_,overlap:E},n)}function vM(e,t,n,i){const r=KF(e,t),o=e.orient,a=KC(o,-1,1);let s,l;const u={enter:s={opacity:HF,anchor:qD(r("titleAnchor",null)),align:{signal:tC}},update:l=w({},s,{opacity:GF,text:qD(e.title)}),exit:{opacity:HF}},c={signal:`lerp(range("${e.scale}"), ${eC(0,1,.5)})`};return l.x=ZC(o,c),l.y=eM(o,c),s.angle=ZC(o,HF,((e,t)=>0===t?0:_S(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t})(a,90)),s.baseline=ZC(o,tM(o,FF,AF),{value:FF}),l.angle=s.angle,l.baseline=s.baseline,WD(u,{fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),angle:r("titleAngle"),baseline:r("titleBaseline")}),function(e,t,n,i){const r=(e,t)=>null!=e?(n.update[t]=fM(qD(e),n.update[t]),!1):!GD(t,i),o=r(e("titleX"),"x"),a=r(e("titleY"),"y");n.enter.auto=a===o?qD(a):ZC(t,qD(a),qD(o))}(r,o,u,n),u.update.align=fM(u.update.align,s.align),u.update.angle=fM(u.update.angle,s.angle),u.update.baseline=fM(u.update.baseline,s.baseline),iC({type:JF,role:"axis-title",style:TF,from:i,encode:u},n)}function bM(e,t){const n=function(e,t){var n,i,r,o,a,s,l,u,c=t.config,f=c.style,d=c.axis,h="band"===t.scaleType(e.scale)&&c.axisBand,p=e.orient;if(_S(p)){const e=hM([c.axisX,c.axisY]),t=hM([c.axisTop,c.axisBottom,c.axisLeft,c.axisRight]);for(r of(n={},e))n[r]=ZC(p,dM(r,c.axisX,d,f),dM(r,c.axisY,d,f));for(r of(i={},t))i[r]=(o=p.signal,a=dM(r,c.axisTop,d,f),s=dM(r,c.axisBottom,d,f),l=dM(r,c.axisLeft,d,f),u=dM(r,c.axisRight,d,f),{signal:(null!=l?`${o} === '${DF}' ? (${cM(l)}) : `:"")+(null!=s?`${o} === '${FF}' ? (${cM(s)}) : `:"")+(null!=u?`${o} === '${SF}' ? (${cM(u)}) : `:"")+(null!=a?`${o} === '${AF}' ? (${cM(a)}) : `:"")+"(null)"})}else n=p===AF||p===FF?c.axisX:c.axisY,i=c["axis"+p[0].toUpperCase()+p.slice(1)];return n||i||h?w({},d,n,i,h):d}(e,t),i=e.encode||{},r=i.axis||{},o=r.name||void 0,a=r.interactive,s=r.style,l=KF(e,n),u=function(e){const t=e("tickBand");let n,i,r=e("tickOffset");return t?t.signal?(n={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},re(r)||(r={signal:`(${t.signal}) === 'extent' ? 0 : ${r}`})):"extent"===t?(n=1,i=!0,r=0):(n=.5,i=!1):(n=e("bandPosition"),i=e("tickExtra")),{extra:i,band:n,offset:r}}(l),c={scale:e.scale,ticks:!!l("ticks"),labels:!!l("labels"),grid:!!l("grid"),domain:!!l("domain"),title:null!=e.title},f=mS(t.add(BS({},[c]))),d=mS(t.add(PS({scale:t.scaleRef(e.scale),extra:t.property(u.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),h=[];let p;return c.grid&&h.push(mM(e,n,i.grid,d,u)),c.ticks&&(p=l("tickSize"),h.push(function(e,t,n,i,r,o){const a=KF(e,t),s=e.orient,l=KC(s,-1,1);let u,c,f;const d={enter:u={opacity:HF},update:f={opacity:GF},exit:c={opacity:HF}};WD(d,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const h=qD(r);h.mult=l;const p={scale:e.scale,field:NF,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=u.y=ZC(s,HF,p),f.y2=u.y2=ZC(s,h),c.x=ZC(s,p),f.x=u.x=eM(s,HF,p),f.x2=u.x2=eM(s,h),c.y=eM(s,p),iC({type:YF,role:"axis-tick",key:NF,from:i,encode:d},n)}(e,n,i.ticks,d,p,u))),c.labels&&(p=c.ticks?p:0,h.push(yM(e,n,i.labels,d,p,u))),c.domain&&h.push(function(e,t,n,i){const r=KF(e,t),o=e.orient;let a,s;const l={enter:a={opacity:HF},update:s={opacity:GF},exit:{opacity:HF}};WD(l,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const u=pM(e,0),c=pM(e,1);return a.x=s.x=ZC(o,u,HF),a.x2=s.x2=ZC(o,c),a.y=s.y=eM(o,u,HF),a.y2=s.y2=eM(o,c),iC({type:YF,role:"axis-domain",from:i,encode:l},n)}(e,n,i.domain,f)),c.title&&h.push(vM(e,n,i.title,f)),IC(QF({role:"axis",from:f,encode:HD(xM(l,e),r,WF),marks:h,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:o,interactive:a,style:s}),t)}function xM(e,t){const n={enter:{},update:{}};return WD(n,{orient:e("orient"),offset:e("offset")||0,position:ES(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function wM(e,t,n){const i=r(e.signals),o=r(e.scales);return n||i.forEach((e=>fS(e,t))),r(e.projections).forEach((e=>function(e,t){const n=t.config.projection||{},i={};for(const r in e)"name"!==r&&(i[r]=$F(e[r],r,t));for(const r in n)null==i[r]&&(i[r]=$F(n[r],r,t));t.addProjection(e.name,i)}(e,t))),o.forEach((e=>function(e,t){const n=e.type||"linear";Sl(n)||s("Unrecognized scale type: "+he(n)),t.addScale(e.name,{type:n,domain:void 0})}(e,t))),r(e.data).forEach((e=>XC(e,t))),o.forEach((e=>dF(e,t))),(n||i).forEach((e=>function(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?s("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=EA(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach((e=>zS(e,t,n.id)))}(e,t))),r(e.axes).forEach((e=>bM(e,t))),r(e.marks).forEach((e=>IC(e,t))),r(e.legends).forEach((e=>qC(e,t))),e.title&&GC(e.title,t),t.parseLambdas(),t}function _M(e,t){const n=t.config,i=mS(t.root=t.add(pS())),o=function(e,t){const n=n=>ES(e[n],t[n]),i=[kM("background",n("background")),kM("autosize",BD(n("autosize"))),kM("padding",ID(n("padding"))),kM("width",n("width")||0),kM("height",n("height")||0)],o=i.reduce(((e,t)=>(e[t.name]=t,e)),{}),a={};return r(e.signals).forEach((e=>{m(o,e.name)?e=w(o[e.name],e):i.push(e),a[e.name]=e})),r(t.signals).forEach((e=>{m(a,e.name)||m(o,e.name)||i.push(e)})),i}(e,n);o.forEach((e=>fS(e,t))),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;const a=t.add(BS()),s=t.add(qS(aS((e=>HD({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e))(e.encode),VF,XD,e.style,t,{pulse:mS(a)}))),l=t.add(lF({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:mS(s)}));t.operators.pop(),t.pushState(mS(s),mS(l),null),wM(e,t,o),t.operators.push(l);let u=t.add(LS({mark:i,pulse:mS(l)}));return u=t.add(rF({pulse:mS(u)})),u=t.add(aF({pulse:mS(u)})),t.addData("root",new TC(t,a,a,u)),t}function kM(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function EM(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function $M(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}function AM(e){return(a(e)?DM:SM)(e)}function DM(e){const t=e.length;let n="[";for(let i=0;i<t;++i){const t=e[i];n+=(i>0?",":"")+(re(t)?t.signal||AM(t):he(t))}return n+"]"}function SM(e){let t,n,i="{",r=0;for(t in e)n=e[t],i+=(++r>1?",":"")+he(t)+":"+(re(n)?n.signal||AM(n):he(n));return i+"}"}EM.prototype=$M.prototype={parse(e){return wM(e,this)},fork(){return new $M(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach((t=>{t.$ref=e.id})),e.refs=null),e},proxy(e){const t=e instanceof dS?mS(e):e;return this.add(nF({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){let i,r;e&&(i=e.data||(e.data={}),r=i[t]||(i[t]=[]),r.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const i in t.index)n(t.index[i],e,"index:"+i)}return this},pushState(e,t,n){this._encode.push(mS(this.add(aF({pulse:e})))),this._parent.push(t),this._lookup.push(n?mS(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return R(this._parent)},encode(){return R(this._encode)},lookup(){return R(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(oe(e))return gS(e,t);e.signal||s("Unsupported field reference: "+he(e));const n=e.signal;let i=this.field[n];if(!i){const e={name:this.signalRef(n)};t&&(e.as=t),this.field[n]=i=mS(this.add(HS(e)))}return i},compareRef(e){let t=!1;const n=e=>_S(e)?(t=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(t=!0,this.exprRef(e.expr)):e,i=r(e.field).map(n),o=r(e.order).map(n);return t?mS(this.add(jS({fields:i,orders:o}))):vS(i,o)},keyRef(e,t){let n=!1;const i=this.signals;return e=r(e).map((e=>_S(e)?(n=!0,mS(i[e.signal])):e)),n?mS(this.add(GS({fields:e,flat:t}))):function(e,t){const n={$key:e};return t&&(n.$flat=!0),n}(e,t)},sortRef(e){if(!e)return e;const t=bS(e.op,e.field),n=e.order||"ascending";return n.signal?mS(this.add(jS({fields:t,orders:this.signalRef(n.signal)}))):vS(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},hasOwnSignal(e){return m(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&s("Duplicate signal name: "+he(e));const n=t instanceof dS?t:this.add(pS(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||s("Unrecognized signal name: "+he(e)),this.signals[e]},signalRef(e){return this.signals[e]?mS(this.signals[e]):(m(this.lambdas,e)||(this.lambdas[e]=this.add(pS(null))),mS(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;t<n;++t){const n=e[t],i=EA(n,this),r=this.lambdas[n];r.params=i.$params,r.update=i.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return e&&re(e)?this.signalRef(e.signal||AM(e)):e},exprRef(e,t){const n={expr:EA(e,this)};return t&&(n.expr.$name=t),mS(this.add(US(n)))},addBinding(e,t){this.bindings||s("Nested signals do not support binding: "+he(e)),this.bindings.push(w({signal:e},t))},addScaleProj(e,t){m(this.scales,e)&&s("Duplicate scale or projection name: "+he(e)),this.scales[e]=this.add(t)},addScale(e,t){this.addScaleProj(e,oF(t))},addProjection(e,t){this.addScaleProj(e,tF(t))},getScale(e){return this.scales[e]||s("Unrecognized scale name: "+he(e)),this.scales[e]},scaleRef(e){return mS(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,t){return m(this.data,e)&&s("Duplicate data set name: "+he(e)),this.data[e]=t},getData(e){return this.data[e]||s("Undefined data set name: "+he(e)),this.data[e]},addDataPipeline(e,t){return m(this.data,e)&&s("Duplicate data set name: "+he(e)),this.addData(e,TC.fromEntries(this,t))}};w(Yr,ys,mm,Gm,Px,hw,K_,C_,ik,Tk,Yk,rE);const FM=Object.freeze(Object.defineProperty({__proto__:null,Bounds:hc,CanvasHandler:Xd,CanvasRenderer:th,DATE:He,DAY:Ge,DAYOFYEAR:Ve,Dataflow:Gr,Debug:Xe,Error:d,EventStream:Mr,Gradient:yu,GroupItem:mc,HOURS:Ye,Handler:$d,HybridHandler:Wh,HybridRenderer:Uh,Info:Je,Item:pc,MILLISECONDS:Qe,MINUTES:Ke,MONTH:Ze,Marks:ud,MultiPulse:Ir,None:et,Operator:Sr,Parameters:$r,Pulse:Pr,QUARTER:tt,RenderType:Xh,Renderer:Dd,ResourceLoader:gc,SECONDS:nt,SVGHandler:ih,SVGRenderer:Sh,SVGStringRenderer:Ih,Scenegraph:yd,TIME_UNITS:S,Transform:Xr,View:ED,WEEK:it,Warn:rt,YEAR:ot,accessor:k,accessorFields:_,accessorName:$,array:r,ascending:E,bandwidthNRD:to,bin:no,bootstrapCI:ro,boundClip:np,boundContext:Pc,boundItem:cd,boundMark:dd,boundStroke:bc,changeset:kr,clampRange:Pe,codegenExpression:E$,compare:j,constant:g,cumulativeLogNormal:vo,cumulativeNormal:fo,cumulativeUniform:Eo,dayofyear:Re,debounce:y,defaultLocale:h,definition:Jr,densityLogNormal:yo,densityNormal:co,densityUniform:ko,domChild:wd,domClear:_d,domCreate:bd,domFind:xd,dotbin:oo,error:s,expressionFunction:kA,extend:w,extent:A,extentIndex:L,falsy:se,fastmap:q,field:P,flush:_e,font:nd,fontFamily:td,fontSize:Jf,format:at,formatLocale:st,formats:lt,hasOwnProperty:m,id:x,identity:u,inferType:ut,inferTypes:ct,ingest:yr,inherits:i,inrange:ge,interpolate:Il,interpolateColors:Ll,interpolateRange:Pl,intersect:Qh,intersectBoxLine:Xc,intersectPath:Wc,intersectPoint:Hc,intersectRule:Vc,isArray:a,isBoolean:ye,isDate:me,isFunction:o,isIterable:ft,isNumber:ie,isObject:re,isRegExp:ve,isString:oe,isTuple:pr,key:U,lerp:ke,lineHeight:Qf,loader:p,locale:qe,logger:f,lruCache:ae,markup:xh,merge:B,mergeConfig:Ue,multiLineOffset:Zf,one:le,pad:Ee,panLinear:Le,panLog:Be,panPow:je,panSymlog:Ie,parse:function(e,t,n){return re(e)||s("Input Vega specification must be an object."),_M(e,new EM(t=Ue(function(){const e="sans-serif",t="#4c78a8",n="#000",i="#888",r="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:n,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:n,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:r},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:i,grid:!1,gridWidth:1,gridColor:r,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:i,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:r,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:i,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}(),t,e.config),n)).toRuntime()},parseExpression:w$,parseSelector:RD,path:ni,pathCurves:bu,pathEqual:rp,pathParse:$u,pathRectangle:Yu,pathRender:Tu,pathSymbols:ju,pathTrail:Ju,peek:R,point:Ed,projection:ox,quantileLogNormal:bo,quantileNormal:ho,quantileUniform:$o,quantiles:Zr,quantizeInterpolator:Bl,quarter:Me,quartiles:eo,get random(){return io},randomInteger:function(e,t){let n,i,r;null==t&&(t=e,e=0);const o={min(e){return arguments.length?(n=e||0,r=i-n,o):n},max(e){return arguments.length?(i=e||0,r=i-n,o):i},sample:()=>n+Math.floor(r*io()),pdf:e=>e===Math.floor(e)&&e>=n&&e<i?1/r:0,cdf(e){const t=Math.floor(e);return t<n?0:t>=i?1:(t-n+1)/r},icdf:e=>e>=0&&e<=1?n-1+Math.floor(e*r):NaN};return o.min(e).max(t)},randomKDE:mo,randomLCG:function(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}},randomLogNormal:xo,randomMixture:wo,randomNormal:po,randomUniform:Ao,read:v,regressionConstant:Do,regressionExp:No,regressionLinear:Oo,regressionLoess:Bo,regressionLog:zo,regressionPoly:Po,regressionPow:Ro,regressionQuad:To,renderModule:Jh,repeat:dt,resetDefaultLocale:ht,resetSVGClipId:fc,resetSVGDefIds:function(){fc(),du=0},responseType:b,runtimeContext:zA,sampleCurve:Uo,sampleLogNormal:go,sampleNormal:uo,sampleUniform:_o,scale:Dl,sceneEqual:ip,sceneFromJSON:md,scenePickVisit:af,sceneToJSON:pd,sceneVisit:of,sceneZOrder:rf,scheme:Hl,serializeXML:wh,setHybridRendererOptions:function(e){qh.svgMarkTypes=e.svgMarkTypes??["text"],qh.svgOnTop=e.svgOnTop??!0,qh.debug=e.debug??!1},setRandom:function(e){io=e},span:I,splitAccessPath:We,stringValue:he,textMetrics:Wf,timeBin:M,timeFloor:N,timeFormatLocale:pt,timeInterval:C,timeOffset:Se,timeSequence:Fe,timeUnitSpecifier:Ce,timeUnits:O,toBoolean:be,toDate:xe,toNumber:D,toSet:ne,toString:we,transform:Qr,transforms:Yr,truncate:$e,truthy:l,tupleid:mr,typeParsers:mt,utcFloor:z,utcInterval:F,utcOffset:Ae,utcSequence:De,utcdayofyear:Te,utcquarter:Oe,utcweek:Ne,version:"5.30.0",visitArray:c,week:ze,writeConfig:gt,zero:W,zoomLinear:de,zoomLog:ue,zoomPow:ce,zoomSymlog:fe},Symbol.toStringTag,{value:"Module"}));var CM={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},MM={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<<t,">>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},OM={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const zM=Array.prototype.slice,NM=(e,t,n)=>{const i=n?n(t[0]):t[0];return i[e].apply(i,zM.call(t,1))};var RM={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:(e,t,n,i,r,o,a)=>new Date(e,t||0,null!=n?n:1,i||0,r||0,o||0,a||0),date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return NM("join",arguments)},indexof:function(){return NM("indexOf",arguments)},lastindexof:function(){return NM("lastIndexOf",arguments)},slice:function(){return NM("slice",arguments)},reverse:e=>e.slice().reverse(),parseFloat:parseFloat,parseInt:parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return NM("substring",arguments,String)},split:function(){return NM("split",arguments,String)},replace:function(){return NM("replace",arguments,String)},trim:e=>String(e).trim(),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const TM=["view","item","group","xy","x","y"],PM=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&PM.add(setImmediate);const LM={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:"datum"===n?e.datum:"event"===n?e.event:"item"===n?e.item:CM[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,i=e(t.object);n&&(e.memberDepth+=1);const r=e(t.property);if(n&&(e.memberDepth-=1),!PM.has(i[r]))return i[r];console.error(`Prevented interpretation of member "${r}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const n=t.arguments;let i=t.callee.name;return i.startsWith("_")&&(i=i.slice(1)),"if"===i?e(n[0])?e(n[1]):e(n[2]):(e.fn[i]||RM[i]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>MM[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>OM[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>"&&"===t.operator?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce(((t,n)=>{e.memberDepth+=1;const i=e(n.key);return e.memberDepth-=1,PM.has(e(n.value))?console.error(`Prevented interpretation of property "${i}" which could lead to insecure code execution`):t[i]=e(n.value),t}),{})};function BM(e,t,n,i,r,o){const a=e=>LM[e.type](a,e);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=i,a.event=r,a.item=o,TM.forEach((e=>a.fn[e]=function(){return r.vega[e](...arguments)})),a(e)}var jM={operator(e,t){const n=t.ast,i=e.functions;return e=>BM(n,i,e)},parameter(e,t){const n=t.ast,i=e.functions;return(e,t)=>BM(n,i,t,e)},event(e,t){const n=t.ast,i=e.functions;return e=>BM(n,i,void 0,void 0,e)},handler(e,t){const n=t.ast,i=e.functions;return(e,t)=>{const r=t.item&&t.item.datum;return BM(n,i,e,r,t)}},encode(e,t){const{marktype:n,channels:i}=t,r=e.functions,o="group"===n||"image"===n||"rect"===n;return(e,t)=>{const a=e.datum;let s,l=0;for(const n in i)s=BM(i[n].ast,r,t,a,void 0,e),e[n]!==s&&(e[n]=s,l=1);return"rule"!==n&&function(e,t,n){let i;t.x2&&(t.x?(n&&e.x>e.x2&&(i=e.x,e.x=e.x2,e.x2=i),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(i=e.y,e.y=e.y2,e.y2=i),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}(e,i,o),l}}};const IM="5.21.0";function qM(e){return RO(e,"or")}function UM(e){return RO(e,"and")}function WM(e){return RO(e,"not")}function HM(e,t){if(WM(e))HM(e.not,t);else if(UM(e))for(const n of e.and)HM(n,t);else if(qM(e))for(const n of e.or)HM(n,t);else t(e)}function GM(e,t){return WM(e)?{not:GM(e.not,t)}:UM(e)?{and:e.and.map((e=>GM(e,t)))}:qM(e)?{or:e.or.map((e=>GM(e,t)))}:t(e)}const VM=structuredClone;function XM(e){throw new Error(e)}function YM(e,t){const n={};for(const i of t)m(e,i)&&(n[i]=e[i]);return n}function JM(e,t){const n={...e};for(const i of t)delete n[i];return n}function QM(e){if(ie(e))return e;const t=oe(e)?e:NO(e);if(t.length<250)return t;let n=0;for(let i=0;i<t.length;i++){n=(n<<5)-n+t.charCodeAt(i),n|=0}return n}function KM(e){return!1===e||null===e}function ZM(e,t){return e.includes(t)}function eO(e,t){let n=0;for(const[i,r]of e.entries())if(t(r,i,n++))return!0;return!1}function tO(e,t){let n=0;for(const[i,r]of e.entries())if(!t(r,i,n++))return!1;return!0}function nO(e,...t){for(const n of t)iO(e,n??{});return e}function iO(e,t){for(const n of cO(t))gt(e,n,t[n],!0)}function rO(e,t){const n=[],i={};let r;for(const o of e)r=t(o),r in i||(i[r]=1,n.push(o));return n}function oO(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function aO(e,t){for(const n of e)if(t.has(n))return!0;return!1}function sO(e){const t=new Set;for(const n of e){const e=We(n).map(((e,t)=>0===t?e:`[${e}]`)),i=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const n of i)t.add(n)}return t}function lO(e,t){return void 0===e||void 0===t||aO(sO(e),sO(t))}function uO(e){return 0===cO(e).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>NO(e))).join(",")})`};const cO=Object.keys,fO=Object.values,dO=Object.entries;function hO(e){return!0===e||!1===e}function pO(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function mO(e,t){return WM(e)?`!(${mO(e.not,t)})`:UM(e)?`(${e.and.map((e=>mO(e,t))).join(") && (")})`:qM(e)?`(${e.or.map((e=>mO(e,t))).join(") || (")})`:t(e)}function gO(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&gO(e[n],t)&&delete e[n],uO(e)}function yO(e){return e.charAt(0).toUpperCase()+e.substr(1)}function vO(e,t="datum"){const n=We(e),i=[];for(let r=1;r<=n.length;r++){const e=`[${n.slice(0,r).map(he).join("][")}]`;i.push(`${t}${e}`)}return i.join(" && ")}function bO(e,t="datum"){return`${t}[${he(We(e).join("."))}]`}function xO(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function wO(e){return`${We(e).map(xO).join("\\.")}`}function _O(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function kO(e){return`${We(e).join(".")}`}function EO(e){return e?We(e).length:0}function $O(...e){return e.find((e=>void 0!==e))}let AO=42;function DO(e){const t=++AO;return e?String(e)+t:t}function SO(e){return FO(e)?e:`__${e}`}function FO(e){return e.startsWith("__")}function CO(e){if(void 0!==e)return(e%360+360)%360}function MO(e){return!!ie(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const OO=Object.getPrototypeOf(structuredClone({}));function zO(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor.name!==t.constructor.name)return!1;let n,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(!zO(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!zO(n[1],t.get(n[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==OO.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==OO.toString)return e.toString()===t.toString();const r=Object.keys(e);if(n=r.length,n!==Object.keys(t).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(i=n;0!=i--;){const n=r[i];if(!zO(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function NO(e){const t=[];return function e(n){if(n&&n.toJSON&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===n)return;if("number"==typeof n)return isFinite(n)?""+n:"null";if("object"!=typeof n)return JSON.stringify(n);let i,r;if(Array.isArray(n)){for(r="[",i=0;i<n.length;i++)i&&(r+=","),r+=e(n[i])||"null";return r+"]"}if(null===n)return"null";if(t.includes(n))throw new TypeError("Converting circular structure to JSON");const o=t.push(n)-1,a=Object.keys(n).sort();for(r="",i=0;i<a.length;i++){const t=a[i],o=e(n[t]);o&&(r&&(r+=","),r+=JSON.stringify(t)+":"+o)}return t.splice(o,1),`{${r}}`}(e)}function RO(e,t){return re(e)&&m(e,t)&&void 0!==e[t]}const TO="row",PO="column",LO="facet",BO="x",jO="y",IO="x2",qO="y2",UO="xOffset",WO="yOffset",HO="radius",GO="radius2",VO="theta",XO="theta2",YO="latitude",JO="longitude",QO="latitude2",KO="longitude2",ZO="color",ez="fill",tz="stroke",nz="shape",iz="size",rz="angle",oz="opacity",az="fillOpacity",sz="strokeOpacity",lz="strokeWidth",uz="strokeDash",cz="text",fz="order",dz="detail",hz="key",pz="tooltip",mz="href",gz="url",yz="description",vz={theta:1,theta2:1,radius:1,radius2:1};function bz(e){return m(vz,e)}const xz={longitude:1,longitude2:1,latitude:1,latitude2:1};function wz(e){switch(e){case YO:return"y";case QO:return"y2";case JO:return"x";case KO:return"x2"}}function _z(e){return m(xz,e)}const kz=cO(xz),Ez={x:1,y:1,x2:1,y2:1,...vz,...xz,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1};function $z(e){return e===ZO||e===ez||e===tz}const Az={row:1,column:1,facet:1},Dz=cO(Az),Sz={...Ez,...Az},Fz=cO(Sz),{order:Cz,detail:Mz,tooltip:Oz,...zz}=Sz,{row:Nz,column:Rz,facet:Tz,...Pz}=zz;function Lz(e){return m(Sz,e)}const Bz=[IO,qO,QO,KO,XO,GO];function jz(e){return Iz(e)!==e}function Iz(e){switch(e){case IO:return BO;case qO:return jO;case QO:return YO;case KO:return JO;case XO:return VO;case GO:return HO}return e}function qz(e){if(bz(e))switch(e){case VO:return"startAngle";case XO:return"endAngle";case HO:return"outerRadius";case GO:return"innerRadius"}return e}function Uz(e){switch(e){case BO:return IO;case jO:return qO;case YO:return QO;case JO:return KO;case VO:return XO;case HO:return GO}}function Wz(e){switch(e){case BO:case IO:return"width";case jO:case qO:return"height"}}function Hz(e){switch(e){case BO:return"xOffset";case jO:return"yOffset";case IO:return"x2Offset";case qO:return"y2Offset";case VO:return"thetaOffset";case HO:return"radiusOffset";case XO:return"theta2Offset";case GO:return"radius2Offset"}}function Gz(e){switch(e){case BO:return"xOffset";case jO:return"yOffset"}}function Vz(e){switch(e){case"xOffset":return"x";case"yOffset":return"y"}}const Xz=cO(Ez),{x:Yz,y:Jz,x2:Qz,y2:Kz,xOffset:Zz,yOffset:eN,latitude:tN,longitude:nN,latitude2:iN,longitude2:rN,theta:oN,theta2:aN,radius:sN,radius2:lN,...uN}=Ez,cN=cO(uN),fN={x:1,y:1},dN=cO(fN);function hN(e){return m(fN,e)}const pN={theta:1,radius:1},mN=cO(pN);function gN(e){return"width"===e?BO:jO}const yN={xOffset:1,yOffset:1};function vN(e){return m(yN,e)}const{text:bN,tooltip:xN,href:wN,url:_N,description:kN,detail:EN,key:$N,order:AN,...DN}=uN,SN=cO(DN);const FN={...fN,...pN,...yN,...DN},CN=cO(FN);function MN(e){return m(FN,e)}function ON(e,t){return function(e){switch(e){case ZO:case ez:case tz:case yz:case dz:case hz:case pz:case mz:case fz:case oz:case az:case sz:case lz:case LO:case TO:case PO:return zN;case BO:case jO:case UO:case WO:case YO:case JO:return RN;case IO:case qO:case QO:case KO:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case iz:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case uz:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case nz:return{point:"always",geoshape:"always"};case cz:return{text:"always"};case rz:return{point:"always",square:"always",text:"always"};case gz:return{image:"always"};case VO:case HO:return{text:"always",arc:"always"};case XO:case GO:return{arc:"always"}}}(e)[t]}const zN={arc:"always",area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},{geoshape:NN,...RN}=zN;function TN(e){switch(e){case BO:case jO:case VO:case HO:case UO:case WO:case iz:case rz:case lz:case oz:case az:case sz:case IO:case qO:case XO:case GO:return;case LO:case TO:case PO:case nz:case uz:case cz:case pz:case mz:case gz:case yz:return"discrete";case ZO:case ez:case tz:return"flexible";case YO:case JO:case QO:case KO:case dz:case hz:case fz:return}}const PN={argmax:1,argmin:1,average:1,count:1,distinct:1,exponential:1,exponentialb:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},LN={count:1,min:1,max:1};function BN(e){return RO(e,"argmin")}function jN(e){return RO(e,"argmax")}function IN(e){return oe(e)&&m(PN,e)}const qN=new Set(["count","valid","missing","distinct"]);function UN(e){return oe(e)&&qN.has(e)}const WN=new Set(["count","sum","distinct","valid","missing"]),HN=new Set(["mean","average","median","q1","q3","min","max"]);function GN(e){return ye(e)&&(e=uB(e,void 0)),"bin"+cO(e).map((t=>JN(e[t])?pO(`_${t}_${dO(e[t])}`):pO(`_${t}_${e[t]}`))).join("")}function VN(e){return!0===e||YN(e)&&!e.binned}function XN(e){return"binned"===e||YN(e)&&!0===e.binned}function YN(e){return re(e)}function JN(e){return RO(e,"param")}function QN(e){switch(e){case TO:case PO:case iz:case ZO:case ez:case tz:case lz:case oz:case az:case sz:case nz:return 6;case uz:return 4;default:return 10}}function KN(e){return RO(e,"expr")}function ZN(e,{level:t}={level:0}){const n=cO(e||{}),i={};for(const r of n)i[r]=0===t?uR(e[r]):ZN(e[r],{level:t-1});return i}function eR(e){const{anchor:t,frame:n,offset:i,orient:r,angle:o,limit:a,color:s,subtitleColor:l,subtitleFont:u,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:p,...m}=e,g={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},y={...l?{subtitleColor:l}:{},...u?{subtitleFont:u}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}};return{titleMarkConfig:{...m,...s?{fill:s}:{}},subtitleMarkConfig:YM(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:y}}function tR(e){return oe(e)||a(e)&&oe(e[0])}function nR(e){return RO(e,"signal")}function iR(e){return RO(e,"step")}function rR(e){return!a(e)&&(RO(e,"field")&&RO(e,"data"))}const oR=cO({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),aR={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},sR=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function lR(e){const t=a(e.condition)?e.condition.map(cR):cR(e.condition);return{...uR(e),condition:t}}function uR(e){if(KN(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function cR(e){if(KN(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function fR(e){if(KN(e)){const{expr:t,...n}=e;return{signal:t,...n}}return nR(e)?e:void 0!==e?{value:e}:void 0}function dR(e){return nR(e)?e.signal:he(e.value)}function hR(e){return nR(e)?e.signal:null==e?null:he(e)}function pR(e,t,n){for(const i of n){const n=yR(i,t.markDef,t.config);void 0!==n&&(e[i]=fR(n))}return e}function mR(e){return[].concat(e.type,e.style??[])}function gR(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:o}=i;return r&&RO(t,r)?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?yR(e,t,n,i):void 0}function yR(e,t,n,{vgChannel:i}={}){const r=vR(e,t,n.style);return $O(i?r:void 0,r,i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function vR(e,t,n){return bR(e,mR(t),n)}function bR(e,t,n){let i;t=r(t);for(const r of t){const t=n[r];RO(t,e)&&(i=t[e])}return i}function xR(e,t){return r(e).reduce(((e,n)=>(e.field.push(YL(n,t)),e.order.push(n.sort??"ascending"),e)),{field:[],order:[]})}function wR(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(zO(t,e))return;n.push(e)})),n}function _R(e,t){return zO(e,t)||!t?e:e?[...r(e),...r(t)].join(", "):t}function kR(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((tR(n)||nR(n))&&(tR(i)||nR(i)))return{explicit:e.explicit,value:_R(n,i)};if(tR(n)||nR(n))return{explicit:e.explicit,value:n};if(tR(i)||nR(i))return{explicit:e.explicit,value:i};if(!(tR(n)||nR(n)||tR(i)||nR(i)))return{explicit:e.explicit,value:wR(n,i)};throw new Error("It should never reach here")}function ER(e){return`Invalid specification ${NO(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const $R='Autosize "fit" only works for single views and layered views.';function AR(e){return`${"width"==e?"Width":"Height"} "container" only works for single views and layered views.`}function DR(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function SR(e){return e?`Dropping "fit-${e}" because spec has discrete ${Wz(e)}.`:'Dropping "fit" because spec has discrete size.'}function FR(e){return`Unknown field for ${e}. Cannot calculate view size.`}function CR(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function MR(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function OR(e){return`Selection not supported for ${e} yet.`}const zR="The same selection must be used to override scale domains in a layered view.";function NR(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function RR(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function TR(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function PR(e){return`${e}Offset dropped because ${e} is continuous`}function LR(e){return`Invalid field type "${e}".`}function BR(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function jR(e,t){return`Dropping ${NO(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function IR(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function qR(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function UR(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function WR(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function HR(e){return`Using unaggregated domain with raw field has no effect (${NO(e)}).`}function GR(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function VR(e){return`Unaggregated domain is currently unsupported for log scale (${NO(e)}).`}function XR(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function YR(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const JR="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function QR(e,t){return`Invalid ${e}: ${NO(t)}.`}function KR(e){return`1D error band does not support ${e}.`}function ZR(e){return`Channel ${e} is required for "binned" bin.`}const eT=f(rt);let tT=eT;function nT(...e){tT.warn(...e)}function iT(e){if(e&&re(e))for(const t of fT)if(RO(e,t))return!0;return!1}const rT=["january","february","march","april","may","june","july","august","september","october","november","december"],oT=rT.map((e=>e.substr(0,3))),aT=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],sT=aT.map((e=>e.substr(0,3)));function lT(e,t){const n=[];if(t&&void 0!==e.day&&cO(e).length>1&&(nT(function(e){return`Dropping day from datetime ${NO(e)} as day cannot be combined with other units.`}(e)),delete(e=VM(e)).day),void 0!==e.year?n.push(e.year):n.push(2012),void 0!==e.month){const i=t?function(e){if(MO(e)&&(e=+e),ie(e))return e-1;{const t=e.toLowerCase(),n=rT.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=oT.indexOf(i);if(-1!==r)return r;throw new Error(QR("month",e))}}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){const i=t?function(e){if(MO(e)&&(e=+e),ie(e))return e>4&&nT(QR("quarter",e)),e-1;throw new Error(QR("quarter",e))}(e.quarter):e.quarter;n.push(ie(i)?3*i:`${i}*3`)}else n.push(0);if(void 0!==e.date)n.push(e.date);else if(void 0!==e.day){const i=t?function(e){if(MO(e)&&(e=+e),ie(e))return e%7;{const t=e.toLowerCase(),n=aT.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=sT.indexOf(i);if(-1!==r)return r;throw new Error(QR("day",e))}}(e.day):e.day;n.push(ie(i)?i+1:`${i}+1`)}else n.push(1);for(const i of["hours","minutes","seconds","milliseconds"]){const t=e[i];n.push(void 0===t?0:t)}return n}function uT(e){const t=lT(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const cT={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},fT=cO(cT);function dT(e){return re(e)?e.binned:hT(e)}function hT(e){return e&&e.startsWith("binned")}function pT(e){return e.startsWith("utc")}const mT={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function gT(e){return fT.filter((t=>vT(e,t)))}function yT(e){const t=gT(e);return t[t.length-1]}function vT(e,t){const n=e.indexOf(t);return!(n<0)&&(!(n>0&&"seconds"===t&&"i"===e.charAt(n-1))&&(!(e.length>n+3&&"day"===t&&"o"===e.charAt(n+3))&&!(n>0&&"year"===t&&"f"===e.charAt(n-1))))}function bT(e,t,{end:n}={end:!1}){const i=vO(t),r=pT(e)?"utc":"";let o;const a={};for(const l of fT)vT(e,l)&&(a[l]="quarter"===(s=l)?`(${r}quarter(${i})-1)`:`${r}${s}(${i})`,o=l);var s;return n&&(a[o]+="+1"),function(e){const t=lT(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}function xT(e){if(!e)return;return`timeUnitSpecifier(${NO(gT(e))}, ${NO(mT)})`}function wT(e){if(!e)return;let t;return oe(e)?t=hT(e)?{unit:e.substring(6),binned:!0}:{unit:e}:re(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),pT(t.unit)&&(t.utc=!0,t.unit=t.unit.substring(3)),t}function _T(e,t=e=>e){const n=wT(e),i=yT(n.unit);if(i&&"day"!==i){const e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:r,part:o}=ET(i,n.step);return`${t(uT({...e,[o]:+e[o]+r}))} - ${t(uT(e))}`}}const kT={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function ET(e,t=1){if(function(e){return m(kT,e)}(e))return{part:e,step:t};switch(e){case"day":case"dayofyear":return{part:"date",step:t};case"quarter":return{part:"month",step:3*t};case"week":return{part:"date",step:7*t}}}function $T(e){return!!(null==e?void 0:e.field)&&void 0!==e.equal}function AT(e){return!!(null==e?void 0:e.field)&&void 0!==e.lt}function DT(e){return!!(null==e?void 0:e.field)&&void 0!==e.lte}function ST(e){return!!(null==e?void 0:e.field)&&void 0!==e.gt}function FT(e){return!!(null==e?void 0:e.field)&&void 0!==e.gte}function CT(e){if(null==e?void 0:e.field){if(a(e.range)&&2===e.range.length)return!0;if(nR(e.range))return!0}return!1}function MT(e){return!!(null==e?void 0:e.field)&&(a(e.oneOf)||a(e.in))}function OT(e){return MT(e)||$T(e)||CT(e)||AT(e)||ST(e)||DT(e)||FT(e)}function zT(e,t){return dB(e,{timeUnit:t,wrapTime:!0})}function NT(e,t=!0){const{field:n}=e,i=wT(e.timeUnit),{unit:r,binned:o}=i||{},a=YL(e,{expr:"datum"}),s=r?`time(${o?a:bT(r,n)})`:a;if($T(e))return`${s}===${zT(e.equal,r)}`;if(AT(e)){return`${s}<${zT(e.lt,r)}`}if(ST(e)){return`${s}>${zT(e.gt,r)}`}if(DT(e)){return`${s}<=${zT(e.lte,r)}`}if(FT(e)){return`${s}>=${zT(e.gte,r)}`}if(MT(e))return`indexof([${(l=e.oneOf,u=r,l.map((e=>zT(e,u)))).join(",")}], ${s}) !== -1`;if(function(e){return!!(null==e?void 0:e.field)&&void 0!==e.valid}(e))return RT(s,e.valid);if(CT(e)){const{range:n}=ZN(e),i=nR(n)?{signal:`${n.signal}[0]`}:n[0],o=nR(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==o&&t)return"inrange("+s+", ["+zT(i,r)+", "+zT(o,r)+"])";const a=[];return null!==i&&a.push(`${s} >= ${zT(i,r)}`),null!==o&&a.push(`${s} <= ${zT(o,r)}`),a.length>0?a.join(" && "):"true"}var l,u;throw new Error(`Invalid field predicate: ${NO(e)}`)}function RT(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function TT(e){return OT(e)&&e.timeUnit?{...e,timeUnit:wT(e.timeUnit)}:e}function PT(e){return"ordinal"===e||"nominal"===e}const LT="quantitative",BT="ordinal",jT="temporal",IT="nominal",qT="geojson";const UT="linear",WT="log",HT="pow",GT="sqrt",VT="time",XT="utc",YT="point",JT="band",QT={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function KT(e,t){const n=QT[e],i=QT[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const ZT={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function eP(e){return ZT[e]}const tP=new Set(["linear","log","pow","sqrt","symlog"]),nP=new Set([...tP,"time","utc"]);function iP(e){return tP.has(e)}const rP=new Set(["quantile","quantize","threshold"]),oP=new Set([...nP,...rP,"sequential","identity"]),aP=new Set(["ordinal","bin-ordinal","point","band"]);function sP(e){return aP.has(e)}function lP(e){return oP.has(e)}function uP(e){return nP.has(e)}function cP(e){return rP.has(e)}function fP(e){return RO(e,"param")}const{type:dP,domain:hP,range:pP,rangeMax:mP,rangeMin:gP,scheme:yP,...vP}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},bP=cO(vP);function xP(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return uP(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return uP(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return"band"===e;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return uP(e);case"nice":return uP(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return lP(e)&&!ZM(["log","time","utc","threshold","quantile"],e)}}function wP(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return $z(e)?void 0:`Cannot use the scale property "${t}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}const _P={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},kP=_P.arc,EP=_P.area,$P=_P.bar,AP=_P.image,DP=_P.line,SP=_P.point,FP=_P.rect,CP=_P.rule,MP=_P.text,OP=_P.tick,zP=_P.trail,NP=_P.circle,RP=_P.square,TP=_P.geoshape;function PP(e){return["line","area","trail"].includes(e)}function LP(e){return["rect","bar","image","arc","tick"].includes(e)}const BP=new Set(cO(_P));function jP(e){return RO(e,"type")}const IP=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],qP=cO({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),UP=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],WP={area:["line","point"],bar:UP,rect:UP,line:["point"],tick:["bandSize","thickness",...UP]},HP=cO({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function GP(e){return RO(e,"band")}const VP={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},XP={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},YP={...XP,binSpacing:1},JP={...XP,thickness:1};function QP(e,{isPath:t}){return void 0===e||"break-paths-show-path-domains"===e?t?"break-paths-show-domains":"filter":null===e?"show":e}function KP({markDef:e,config:t,scaleChannel:n,scaleType:i,isCountAggregate:r}){var o,a;if(!i||!lP(i)||r)return"always-valid";const s=QP(gR("invalid",e,t),{isPath:PP(e.type)});return void 0!==(null==(a=null==(o=t.scale)?void 0:o.invalid)?void 0:a[n])?"show":s}function ZP({scaleName:e,scale:t,mode:n}){const i=`domain('${e}')`;if(!t||!e)return;const r=`${i}[0]`,o=`peek(${i})`,a=t.domainHasZero();if("definitely"===a)return{scale:e,value:0};if("maybe"===a){return{signal:`scale('${e}', inrange(0, ${i}) ? 0 : ${"zeroOrMin"===n?r:o})`}}return{signal:`scale('${e}', ${"zeroOrMin"===n?r:o})`}}function eL({scaleChannel:e,channelDef:t,scale:n,scaleName:i,markDef:r,config:o}){var a;const s=null==n?void 0:n.get("type"),l=rB(t),u=KP({scaleChannel:e,markDef:r,config:o,scaleType:s,isCountAggregate:UN(null==l?void 0:l.aggregate)});if(l&&"show"===u){const t=(null==(a=o.scale.invalid)?void 0:a[e])??"zero-or-min";return{test:RT(YL(l,{expr:"datum"}),!1),...tL(t,n,i)}}}function tL(e,t,n){if(re(i=e)&&"value"in i){const{value:t}=e;return nR(t)?{signal:t.signal}:{value:t}}var i;return ZP({scale:t,scaleName:n,mode:"zeroOrMin"})}function nL(e){const{channel:t,channelDef:n,markDef:i,scale:r,scaleName:o,config:a}=e,s=Iz(t),l=oL(e),u=eL({scaleChannel:s,channelDef:n,scale:r,scaleName:o,markDef:i,config:a});return void 0!==u?[u,l]:l}function iL(e,t,n,i){const r={};if(t&&(r.scale=t),PL(e)){const{datum:t}=e;iT(t)?r.signal=uT(t):nR(t)?r.signal=t.signal:KN(t)?r.signal=t.expr:r.value=t}else r.field=YL(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function rL({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,endSuffix:o="end",bandPosition:a=.5}){const s=!nR(a)&&0<a&&a<1?"datum":void 0,l=YL(t,{expr:s,suffix:r}),u=void 0!==n?YL(n,{expr:s}):YL(t,{suffix:o,expr:s}),c={};if(0===a||1===a){c.scale=e;const t=0===a?l:u;c.field=t}else{const t=nR(a)?`(1-${a.signal}) * ${l} + ${a.signal} * ${u}`:`${1-a} * ${l} + ${a} * ${u}`;c.signal=`scale("${e}", ${t})`}return i&&(c.offset=i),c}function oL({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:a,scale:s,stack:l,offset:u,defaultRef:c,bandPosition:f}){if(t){if(IL(t)){const o=null==s?void 0:s.get("type");if(qL(t)){f??(f=SL({fieldDef:t,fieldDef2:n,markDef:i,config:r}));const{bin:s,timeUnit:c,type:d}=t;if(VN(s)||f&&c&&d===jT)return(null==l?void 0:l.impute)?iL(t,a,{binSuffix:"mid"},{offset:u}):f&&!sP(o)?rL({scaleName:a,fieldOrDatumDef:t,bandPosition:f,offset:u}):iL(t,a,pB(t,e)?{binSuffix:"range"}:{},{offset:u});if(XN(s)){if(RL(n))return rL({scaleName:a,fieldOrDatumDef:t,fieldOrDatumDef2:n,bandPosition:f,offset:u});nT(ZR(e===BO?IO:qO))}}return iL(t,a,sP(o)?{binSuffix:"range"}:{},{offset:u,band:"band"===o?f??t.bandPosition??.5:void 0})}if(UL(t)){const n=u?{offset:u}:{};return{...aL(e,t.value),...n}}}return o(c)&&(c=c()),c?{...c,...u?{offset:u}:{}}:c}function aL(e,t){return ZM(["x","x2"],e)&&"width"===t?{field:{group:"width"}}:ZM(["y","y2"],e)&&"height"===t?{field:{group:"height"}}:fR(t)}function sL(e){return e&&"number"!==e&&"time"!==e}function lL(e,t,n){return`${e}(${t}${n?`, ${NO(n)}`:""})`}function uL({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o}){var a,s;if(sL(n))return fL({fieldOrDatumDef:e,format:t,formatType:n,expr:i,config:o});const l=cL(e,i,r),u=TL(e);if(void 0===t&&void 0===n&&o.customFormatTypes){if("quantitative"===u){if(r&&o.normalizedNumberFormatType)return fL({fieldOrDatumDef:e,format:o.normalizedNumberFormat,formatType:o.normalizedNumberFormatType,expr:i,config:o});if(o.numberFormatType)return fL({fieldOrDatumDef:e,format:o.numberFormat,formatType:o.numberFormatType,expr:i,config:o})}if("temporal"===u&&o.timeFormatType&&RL(e)&&void 0===e.timeUnit)return fL({fieldOrDatumDef:e,format:o.timeFormat,formatType:o.timeFormatType,expr:i,config:o})}if(fB(e)){const n=function({field:e,timeUnit:t,format:n,formatType:i,rawTimeFormat:r,isUTCScale:o}){return!t||n?!t&&i?`${i}(${e}, '${n}')`:`${o?"utc":"time"}Format(${e}, '${n=oe(n)?n:r}')`:function(e,t,n){if(!e)return;const i=xT(e);return`${n||pT(e)?"utc":"time"}Format(${t}, ${i})`}(t,e,o)}({field:l,timeUnit:RL(e)?null==(a=wT(e.timeUnit))?void 0:a.unit:void 0,format:t,formatType:o.timeFormatType,rawTimeFormat:o.timeFormat,isUTCScale:WL(e)&&(null==(s=e.scale)?void 0:s.type)===XT});return n?{signal:n}:void 0}if(t=pL({type:u,specifiedFormat:t,config:o,normalizeStack:r}),RL(e)&&VN(e.bin)){return{signal:yL(l,YL(e,{expr:i,binSuffix:"end"}),t,n,o)}}return t||"quantitative"===TL(e)?{signal:`${mL(l,t)}`}:{signal:`isValid(${l}) ? ${l} : ""+${l}`}}function cL(e,t,n){return RL(e)?n?`${YL(e,{expr:t,suffix:"end"})}-${YL(e,{expr:t,suffix:"start"})}`:YL(e,{expr:t}):function(e){const{datum:t}=e;return iT(t)?uT(t):`${NO(t)}`}(e)}function fL({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o,field:a}){if(a??(a=cL(e,i,r)),"datum.value"!==a&&RL(e)&&VN(e.bin)){return{signal:yL(a,YL(e,{expr:i,binSuffix:"end"}),t,n,o)}}return{signal:lL(n,a,t)}}function dL(e,t,n,i,r,o){var a;if(!oe(i)||!sL(i)){if(void 0===n&&void 0===i&&r.customFormatTypes&&"quantitative"===TL(e)){if(r.normalizedNumberFormatType&&HL(e)&&"normalize"===e.stack)return;if(r.numberFormatType)return}if(HL(e)&&"normalize"===e.stack&&r.normalizedNumberFormat)return pL({type:"quantitative",config:r,normalizeStack:!0});if(fB(e)){const t=RL(e)?null==(a=wT(e.timeUnit))?void 0:a.unit:void 0;if(void 0===t&&r.customFormatTypes&&r.timeFormatType)return;return function({specifiedFormat:e,timeUnit:t,config:n,omitTimeFormatConfig:i}){if(e)return e;if(t)return{signal:xT(t)};return i?void 0:n.timeFormat}({specifiedFormat:n,timeUnit:t,config:r,omitTimeFormatConfig:o})}return pL({type:t,specifiedFormat:n,config:r})}}function hL(e,t,n){var i;return e&&(nR(e)||"number"===e||"time"===e)?e:fB(t)&&"time"!==n&&"utc"!==n?RL(t)&&(null==(i=wT(null==t?void 0:t.timeUnit))?void 0:i.utc)?"utc":"time":void 0}function pL({type:e,specifiedFormat:t,config:n,normalizeStack:i}){return oe(t)?t:e===LT?i?n.normalizedNumberFormat:n.numberFormat:void 0}function mL(e,t){return`format(${e}, "${t||""}")`}function gL(e,t,n,i){return sL(n)?lL(n,e,t):mL(e,(oe(t)?t:void 0)??i.numberFormat)}function yL(e,t,n,i,r){if(void 0===n&&void 0===i&&r.customFormatTypes&&r.numberFormatType)return yL(e,t,r.numberFormat,r.numberFormatType,r);const o=gL(e,n,i,r),a=gL(t,n,i,r);return`${RT(e,!1)} ? "null" : ${o} + " – " + ${a}`}const vL="min",bL={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function xL(e){return m(bL,e)}function wL(e){return e&&("count"===e.op||RO(e,"field"))}function _L(e){return e&&a(e)}function kL(e){return RO(e,"row")||RO(e,"column")}function EL(e){return RO(e,"header")}function $L(e){return RO(e,"facet")}function AL(e){const{field:t,timeUnit:n,bin:i,aggregate:r}=e;return{...n?{timeUnit:n}:{},...i?{bin:i}:{},...r?{aggregate:r}:{},field:t}}function DL(e){return RO(e,"sort")}function SL({fieldDef:e,fieldDef2:t,markDef:n,config:i}){if(IL(e)&&void 0!==e.bandPosition)return e.bandPosition;if(RL(e)){const{timeUnit:r,bin:o}=e;if(r&&!t)return yR("timeUnitBandPosition",n,i);if(VN(o))return.5}}function FL({channel:e,fieldDef:t,fieldDef2:n,markDef:i,config:r,scaleType:o,useVlSizeChannel:a}){var s,l,u;const c=Wz(e),f=gR(a?"size":c,i,r,{vgChannel:c});if(void 0!==f)return f;if(RL(t)){const{timeUnit:e,bin:a}=t;if(e&&!n)return{band:yR("timeUnitBandSize",i,r)};if(VN(a)&&!sP(o))return{band:1}}return LP(i.type)?o?sP(o)?(null==(s=r[i.type])?void 0:s.discreteBandSize)||{band:1}:null==(l=r[i.type])?void 0:l.continuousBandSize:null==(u=r[i.type])?void 0:u.discreteBandSize:void 0}function CL(e,t,n,i){return!!(VN(e.bin)||e.timeUnit&&qL(e)&&"temporal"===e.type)&&void 0!==SL({fieldDef:e,fieldDef2:t,markDef:n,config:i})}function ML(e){return RO(e,"sort")&&!RO(e,"field")}function OL(e){return RO(e,"condition")}function zL(e){const t=null==e?void 0:e.condition;return!!t&&!a(t)&&RL(t)}function NL(e){const t=null==e?void 0:e.condition;return!!t&&!a(t)&&IL(t)}function RL(e){return RO(e,"field")||"count"===(null==e?void 0:e.aggregate)}function TL(e){return null==e?void 0:e.type}function PL(e){return RO(e,"datum")}function LL(e){return qL(e)&&!JL(e)||jL(e)}function BL(e){return qL(e)&&"quantitative"===e.type&&!e.bin||jL(e)}function jL(e){return PL(e)&&ie(e.datum)}function IL(e){return RL(e)||PL(e)}function qL(e){return e&&(RO(e,"field")||"count"===e.aggregate)&&RO(e,"type")}function UL(e){return RO(e,"value")}function WL(e){return RO(e,"scale")||RO(e,"sort")}function HL(e){return RO(e,"axis")||RO(e,"stack")||RO(e,"impute")}function GL(e){return RO(e,"legend")}function VL(e){return RO(e,"format")||RO(e,"formatType")}function XL(e){return JM(e,["legend","axis","header","scale"])}function YL(e,t={}){let n=e.field;const i=t.prefix;let r=t.suffix,o="";if(function(e){return"count"===e.aggregate}(e))n=SO("count");else{let i;if(!t.nofn)if(function(e){return RO(e,"op")}(e))i=e.op;else{const{bin:a,aggregate:s,timeUnit:l}=e;VN(a)?(i=GN(a),r=(t.binSuffix??"")+(t.suffix??"")):s?jN(s)?(o=`["${n}"]`,n=`argmax_${s.argmax}`):BN(s)?(o=`["${n}"]`,n=`argmin_${s.argmin}`):i=String(s):l&&!dT(l)&&(i=function(e){const{utc:t,...n}=wT(e);return n.unit?(t?"utc":"")+cO(n).map((e=>pO(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+cO(n).map((e=>pO(`_${e}_${n[e]}`))).join("")}(l),r=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(t.suffix??""))}i&&(n=n?`${i}_${n}`:i)}return r&&(n=`${n}_${r}`),i&&(n=`${i}_${n}`),t.forAs?kO(n):t.expr?bO(n,t.expr)+o:wO(n)+o}function JL(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return RL(e)&&!!e.bin;case"temporal":return!1}throw new Error(LR(e.type))}const QL=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(jN(t))return`${r} for argmax(${t.argmax})`;if(BN(t))return`${r} for argmin(${t.argmin})`;const o=i&&!dT(i)?wT(i):void 0,a=t||(null==o?void 0:o.unit)||(null==o?void 0:o.maxbins)&&"timeunit"||VN(n)&&"bin";return a?`${a.toUpperCase()}(${r})`:r}(e);default:return function(e,t){var n;const{field:i,bin:r,timeUnit:o,aggregate:a}=e;if("count"===a)return t.countTitle;if(VN(r))return`${i} (binned)`;if(o&&!dT(o)){const e=null==(n=wT(o))?void 0:n.unit;if(e)return`${i} (${gT(e).join("-")})`}else if(a)return jN(a)?`${i} for max ${a.argmax}`:BN(a)?`${i} for min ${a.argmin}`:`${yO(a)} of ${i}`;return i}(e,t)}};let KL=QL;function ZL(e){KL=e}function eB(e,t,{allowDisabling:n,includeDefault:i=!0}){var r;const o=null==(r=tB(e))?void 0:r.title;if(!RL(e))return o??e.title;const a=e,s=i?nB(a,t):void 0;return n?$O(o,a.title,s):o??a.title??s}function tB(e){return HL(e)&&e.axis?e.axis:GL(e)&&e.legend?e.legend:EL(e)&&e.header?e.header:void 0}function nB(e,t){return KL(e,t)}function iB(e){if(VL(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=tB(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function rB(e){return RL(e)?e:zL(e)?e.condition:void 0}function oB(e){return IL(e)?e:NL(e)?e.condition:void 0}function aB(e,t,n,i={}){if(oe(e)||ie(e)||ye(e)){return nT(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${NO(n)}}.`}(t,oe(e)?"string":ie(e)?"number":"boolean",e)),{value:e}}return IL(e)?sB(e,t,n,i):NL(e)?{...e,condition:sB(e.condition,t,n,i)}:e}function sB(e,t,n,i){if(VL(e)){const{format:r,formatType:o,...a}=e;if(sL(o)&&!n.customFormatTypes)return nT(TR(t)),sB(a,t,n,i)}else{const r=HL(e)?"axis":GL(e)?"legend":EL(e)?"header":null;if(r&&e[r]){const{format:o,formatType:a,...s}=e[r];if(sL(a)&&!n.customFormatTypes)return nT(TR(t)),sB({...e,[r]:s},t,n,i)}}return RL(e)?lB(e,t,i):function(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=ie(n)?"quantitative":oe(n)?"nominal":iT(n)?"temporal":void 0,{...e,type:t}}(e)}function lB(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:o,field:s}=e,l={...e};if(n||!i||IN(i)||jN(i)||BN(i)||(nT(function(e){return`Invalid aggregation operator "${e}".`}(i)),delete l.aggregate),r&&(l.timeUnit=wT(r)),s&&(l.field=`${s}`),VN(o)&&(l.bin=uB(o,t)),XN(o)&&!hN(t)&&nT(function(e){return`Channel ${e} should not be used with "binned" bin.`}(t)),qL(l)){const{type:e}=l,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case LT:return"quantitative";case"t":case jT:return"temporal";case"o":case BT:return"ordinal";case"n":case IT:return"nominal";case qT:return"geojson"}}(e);e!==t&&(l.type=t),"quantitative"!==e&&UN(i)&&(nT(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,i)),l.type="quantitative")}else if(!jz(t)){const e=function(e,t){var n;switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(DL(e)&&a(e.sort))return"ordinal";const{aggregate:i,bin:r,timeUnit:o}=e;if(o)return"temporal";if(r||i&&!jN(i)&&!BN(i))return"quantitative";if(WL(e)&&(null==(n=e.scale)?void 0:n.type))switch(QT[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(l,t);l.type=e}if(qL(l)){const{compatible:e,warning:n}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case TO:case PO:case LO:return JL(e)?cB:{compatible:!1,warning:qR(t)};case BO:case jO:case UO:case WO:case ZO:case ez:case tz:case cz:case dz:case hz:case pz:case mz:case gz:case rz:case VO:case HO:case yz:return cB;case JO:case KO:case YO:case QO:return n!==LT?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:cB;case oz:case az:case sz:case lz:case iz:case XO:case GO:case IO:case qO:return"nominal"!==n||e.sort?cB:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case nz:case uz:return JL(e)||WL(i=e)&&cP(null==(r=i.scale)?void 0:r.type)?cB:{compatible:!1,warning:UR(t)};case fz:return"nominal"!==e.type||"sort"in e?cB:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}var i,r}(l,t)||{};!1===e&&nT(n)}if(DL(l)&&oe(l.sort)){const{sort:e}=l;if(xL(e))return{...l,sort:{encoding:e}};const t=e.substring(1);if("-"===e.charAt(0)&&xL(t))return{...l,sort:{encoding:t,order:"descending"}}}if(EL(l)){const{header:e}=l;if(e){const{orient:t,...n}=e;if(t)return{...l,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return l}function uB(e,t){return ye(e)?{maxbins:QN(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:QN(t)}}const cB={compatible:!0};function fB(e){const{formatType:t}=iB(e);return"time"===t||!t&&((n=e)&&("temporal"===n.type||RL(n)&&!!n.timeUnit));var n}function dB(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){var o;const a=t&&(null==(o=wT(t))?void 0:o.unit);let s,l=a||"temporal"===n;return KN(e)?s=e.expr:nR(e)?s=e.signal:iT(e)?(l=!0,s=uT(e)):(oe(e)||ie(e))&&l&&(s=`datetime(${NO(e)})`,function(e){return m(cT,e)}(a)&&(ie(e)&&e<1e4||oe(e)&&isNaN(Date.parse(e)))&&(s=uT({[a]:e}))),s?i&&l?`time(${s})`:s:r?void 0:NO(e)}function hB(e,t){const{type:n}=e;return t.map((t=>{const i=dB(t,{timeUnit:RL(e)&&!dT(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function pB(e,t){return VN(e.bin)?MN(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const mB={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function gB(e){return null==e?void 0:e.condition}const yB=["domain","grid","labels","ticks","title"],vB={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},bB={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},xB={...bB,style:1,labelExpr:1,encoding:1};function wB(e){return m(xB,e)}const _B=cO({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function kB(e){return RO(e,"mark")}class EB{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!kB(e)&&(jP(t=e.mark)?t.type:t)===this.name;var t}}function $B(e,t){const n=e&&e[t];return!!n&&(a(n)?eO(n,(e=>!!e.field)):RL(n)||zL(n))}function AB(e,t){const n=e&&e[t];return!!n&&(a(n)?eO(n,(e=>!!e.field)):RL(n)||PL(n)||NL(n))}function DB(e,t){if(hN(t)){const n=e[t];if((RL(n)||PL(n))&&(PT(n.type)||RL(n)&&n.timeUnit)){return AB(e,Gz(t))}}return!1}function SB(e){return eO(Fz,(t=>{if($B(e,t)){const n=e[t];if(a(n))return eO(n,(e=>!!e.aggregate));{const e=rB(n);return e&&!!e.aggregate}}return!1}))}function FB(e,t){const n=[],i=[],r=[],o=[],a={};return OB(e,((s,l)=>{if(RL(s)){const{field:u,aggregate:c,bin:f,timeUnit:d,...h}=s;if(c||d||f){const e=tB(s),p=null==e?void 0:e.title;let g=YL(s,{forAs:!0});const y={...p?[]:{title:eB(s,t,{allowDisabling:!0})},...h,field:g};if(c){let e;if(jN(c)?(e="argmax",g=YL({op:"argmax",field:c.argmax},{forAs:!0}),y.field=`${g}.${u}`):BN(c)?(e="argmin",g=YL({op:"argmin",field:c.argmin},{forAs:!0}),y.field=`${g}.${u}`):"boxplot"!==c&&"errorbar"!==c&&"errorband"!==c&&(e=c),e){const t={op:e,as:g};u&&(t.field=u),o.push(t)}}else if(n.push(g),qL(s)&&VN(f)){if(i.push({bin:f,field:u,as:g}),n.push(YL(s,{binSuffix:"end"})),pB(s,l)&&n.push(YL(s,{binSuffix:"range"})),hN(l)){const e={field:`${g}_end`};a[`${l}2`]=e}y.bin="binned",jz(l)||(y.type=LT)}else if(d&&!dT(d)){r.push({timeUnit:d,field:u,as:g});const e=qL(s)&&s.type!==jT&&"time";e&&(l===cz||l===pz?y.formatType=e:!function(e){return m(uN,e)}(l)?hN(l)&&(y.axis={formatType:e,...y.axis}):y.legend={formatType:e,...y.legend})}a[l]=y}else n.push(u),a[l]=e[l]}else a[l]=e[l]})),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:a}}function CB(e,t,n){const i=ON(t,n);if(!i)return!1;if("binned"===i){const n=e[t===IO?BO:jO];return!!(RL(n)&&RL(e[t])&&XN(n.bin))}return!0}function MB(e,t){const n={};for(const i of cO(e)){const r=aB(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function OB(e,t,n){if(e)for(const i of cO(e)){const r=e[i];if(a(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function zB(e,t){return cO(t).reduce(((n,i)=>{switch(i){case BO:case jO:case mz:case yz:case gz:case IO:case qO:case UO:case WO:case VO:case XO:case HO:case GO:case YO:case JO:case QO:case KO:case cz:case nz:case rz:case pz:return n;case fz:if("line"===e||"trail"===e)return n;case dz:case hz:{const e=t[i];if(a(e)||RL(e))for(const t of r(e))t.aggregate||n.push(YL(t,{}));return n}case iz:if("trail"===e)return n;case ZO:case ez:case tz:case oz:case az:case sz:case uz:case lz:{const e=rB(t[i]);return e&&!e.aggregate&&n.push(YL(e,{})),n}}}),[])}function NB(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};return{tooltip:[...e.map((({fieldPrefix:e,titlePrefix:n})=>{const r=i?` of ${RB(t)}`:"";return{field:e+t.field,type:t.type,title:nR(n)?{signal:`${n}"${escape(r)}"`}:n+r}})),...rO(function(e){const t=[];for(const n of cO(e))if($B(e,n)){const i=e[n],o=r(i);for(const e of o)RL(e)?t.push(e):zL(e)&&t.push(e.condition)}return t}(n).map(XL),QM)]}}function RB(e){const{title:t,field:n}=e;return $O(t,n)}function TB(e,t,n,i,r){const{scale:o,axis:a}=n;return({partName:s,mark:l,positionPrefix:u,endPositionPrefix:c,extraEncoding:f={}})=>{const d=RB(n);return PB(e,s,r,{mark:l,encoding:{[t]:{field:`${u}_${n.field}`,type:n.type,...void 0!==d?{title:d}:{},...void 0!==o?{scale:o}:{},...void 0!==a?{axis:a}:{}},...oe(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...i,...f}})}}function PB(e,t,n,i){const{clip:r,color:o,opacity:a}=e,s=e.type;return e[t]||void 0===e[t]&&n[t]?[{...i,mark:{...n[t],...r?{clip:r}:{},...o?{color:o}:{},...a?{opacity:a}:{},...jP(i.mark)?i.mark:{type:i.mark},style:`${s}-${String(t)}`,...ye(e[t])?{}:e[t]}}]:[]}function LB(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],a=i[`${r}2`],s=i[`${r}Error`],l=i[`${r}Error2`];return{continuousAxisChannelDef:BB(o,n),continuousAxisChannelDef2:BB(a,n),continuousAxisChannelDefError:BB(s,n),continuousAxisChannelDefError2:BB(l,n),continuousAxis:r}}function BB(e,t){if(null==e?void 0:e.aggregate){const{aggregate:n,...i}=e;return n!==t&&nT(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function jB(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(jP(n)&&n.orient)return n.orient;if(LL(r)){if(LL(o)){const e=RL(r)&&r.aggregate,n=RL(o)&&o.aggregate;if(e||n!==t){if(n||e!==t){if(e===t&&n===t)throw new Error("Both x and y cannot have aggregate");return fB(o)&&!fB(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(LL(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const IB="boxplot",qB=new EB(IB,WB);function UB(e){return ie(e)?"tukey":e}function WB(e,{config:t}){e={...e,encoding:MB(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:o,...s}=e,l=jP(n)?n:{type:n};r&&nT(OR("boxplot"));const u=l.extent??t.boxplot.extent,c=gR("size",l,t),f=l.invalid,d=UB(u),{bins:h,timeUnits:p,transform:m,continuousAxisChannelDef:g,continuousAxis:y,groupby:v,aggregate:b,encodingWithoutContinuousAxis:x,ticksOrient:w,boxOrient:_,customTooltipWithoutAggregatedField:k}=function(e,t,n){const i=jB(e,IB),{continuousAxisChannelDef:r,continuousAxis:o}=LB(e,i,IB),s=r.field,l=kO(s),u=UB(t),c=[...HB(s),{op:"median",field:s,as:`mid_box_${l}`},{op:"min",field:s,as:("min-max"===u?"lower_whisker_":"min_")+l},{op:"max",field:s,as:("min-max"===u?"upper_whisker_":"max_")+l}],f="min-max"===u||"tukey"===u?[]:[{calculate:`datum["upper_box_${l}"] - datum["lower_box_${l}"]`,as:`iqr_${l}`},{calculate:`min(datum["upper_box_${l}"] + datum["iqr_${l}"] * ${t}, datum["max_${l}"])`,as:`upper_whisker_${l}`},{calculate:`max(datum["lower_box_${l}"] - datum["iqr_${l}"] * ${t}, datum["min_${l}"])`,as:`lower_whisker_${l}`}],{[o]:d,...h}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:m}=function(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let i,r;if(a(t)){for(const e of t)e.aggregate?(i||(i=[]),i.push(e)):(r||(r=[]),r.push(e));i&&(n.tooltip=i)}else t.aggregate?n.tooltip=t:r=t;return a(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(h),{bins:g,timeUnits:y,aggregate:v,groupby:b,encoding:x}=FB(m,n),w="vertical"===i?"horizontal":"vertical",_=i,k=[...g,...y,{aggregate:[...v,...c],groupby:b},...f];return{bins:g,timeUnits:y,transform:k,groupby:b,aggregate:v,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:x,ticksOrient:w,boxOrient:_,customTooltipWithoutAggregatedField:p}}(e,u,t),E=kO(g.field),{color:$,size:A,...D}=x,S=e=>TB(l,y,g,e,t.boxplot),F=S(D),C=S(x),M=(re(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||"#4c78a8",O=S({...D,...A?{size:A}:{},color:{condition:{test:`datum['lower_box_${g.field}'] >= datum['upper_box_${g.field}']`,...$||{value:M}}}}),z=NB([{fieldPrefix:"min-max"===d?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===d?"lower_whisker_":"min_",titlePrefix:"Min"}],g,x),N={type:"tick",color:"black",opacity:1,orient:w,invalid:f,aria:!1},R="min-max"===d?z:NB([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],g,x),T=[...F({partName:"rule",mark:{type:"rule",invalid:f,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:R}),...F({partName:"rule",mark:{type:"rule",invalid:f,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:R}),...F({partName:"ticks",mark:N,positionPrefix:"lower_whisker",extraEncoding:R}),...F({partName:"ticks",mark:N,positionPrefix:"upper_whisker",extraEncoding:R})],P=[..."tukey"!==d?T:[],...C({partName:"box",mark:{type:"bar",...c?{size:c}:{},orient:_,invalid:f,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:z}),...O({partName:"median",mark:{type:"tick",invalid:f,...re(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...c?{size:c}:{},orient:w,aria:!1},positionPrefix:"mid_box",extraEncoding:z})];if("min-max"===d)return{...s,transform:(s.transform??[]).concat(m),layer:P};const L=`datum["lower_box_${g.field}"]`,B=`datum["upper_box_${g.field}"]`,j=`(${B} - ${L})`,I=`${L} - ${u} * ${j}`,q=`${B} + ${u} * ${j}`,U=`datum["${g.field}"]`,W={joinaggregate:HB(g.field),groupby:v},H={transform:[{filter:`(${I} <= ${U}) && (${U} <= ${q})`},{aggregate:[{op:"min",field:g.field,as:`lower_whisker_${E}`},{op:"max",field:g.field,as:`upper_whisker_${E}`},{op:"min",field:`lower_box_${g.field}`,as:`lower_box_${E}`},{op:"max",field:`upper_box_${g.field}`,as:`upper_box_${E}`},...b],groupby:v}],layer:T},{tooltip:G,...V}=D,{scale:X,axis:Y}=g,J=RB(g),Q=JM(Y,["title"]),K=PB(l,"outliers",t.boxplot,{transform:[{filter:`(${U} < ${I}) || (${U} > ${q})`}],mark:"point",encoding:{[y]:{field:g.field,type:g.type,...void 0!==J?{title:J}:{},...void 0!==X?{scale:X}:{},...uO(Q)?{}:{axis:Q}},...V,...$?{color:$}:{},...k?{tooltip:k}:{}}})[0];let Z;const ee=[...h,...p,W];return K?Z={transform:ee,layer:[K,H]}:(Z=H,Z.transform.unshift(...ee)),{...s,layer:[Z,{transform:m,layer:P}]}}function HB(e){const t=kO(e);return[{op:"q1",field:e,as:`lower_box_${t}`},{op:"q3",field:e,as:`upper_box_${t}`}]}const GB="errorbar",VB=new EB(GB,XB);function XB(e,{config:t}){e={...e,encoding:MB(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:s,outerSpec:l,tooltipEncoding:u}=JB(e,GB,t);delete o.size;const c=TB(s,r,i,o,t.errorbar),f=s.thickness,d=s.size,h={type:"tick",orient:a,aria:!1,...void 0!==f?{thickness:f}:{},...void 0!==d?{size:d}:{}},p=[...c({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:u}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:u}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u})];return{...l,transform:n,...p.length>1?{layer:p}:{...p[0]}}}function YB(e,t){const{encoding:n}=e;if(function(e){return(IL(e.x)||IL(e.y))&&!IL(e.x2)&&!IL(e.y2)&&!IL(e.xError)&&!IL(e.xError2)&&!IL(e.yError)&&!IL(e.yError2)}(n))return{orient:jB(e,t),inputType:"raw"};const i=function(e){return IL(e.x2)||IL(e.y2)}(n),r=function(e){return IL(e.xError)||IL(e.xError2)||IL(e.yError)||IL(e.yError2)}(n),o=n.x,a=n.y;if(i){if(r)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const e=n.x2,i=n.y2;if(IL(e)&&IL(i))throw new Error(`${t} cannot have both x2 and y2`);if(IL(e)){if(LL(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(IL(i)){if(LL(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}{const e=n.xError,i=n.xError2,r=n.yError,s=n.yError2;if(IL(i)&&!IL(e))throw new Error(`${t} cannot have xError2 without xError`);if(IL(s)&&!IL(r))throw new Error(`${t} cannot have yError2 without yError`);if(IL(e)&&IL(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(IL(e)){if(LL(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(IL(r)){if(LL(a))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function JB(e,t,n){const{mark:i,encoding:r,params:o,projection:a,...s}=e,l=jP(i)?i:{type:i};o&&nT(OR(t));const{orient:u,inputType:c}=YB(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:m}=LB(e,u,t),{errorBarSpecificAggregate:g,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,o,a,s){let l=[],u=[];const c=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":s.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&nT(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,a)),"stderr"===n||"stdev"===n)l=[{op:n,field:c,as:`extent_${c}`},{op:t,field:c,as:`center_${c}`}],u=[{calculate:`datum["center_${c}"] + datum["extent_${c}"]`,as:`upper_${c}`},{calculate:`datum["center_${c}"] - datum["extent_${c}"]`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:yO(t)},{fieldPrefix:"upper_",titlePrefix:QB(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:QB(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),l=[{op:t,field:c,as:`lower_${c}`},{op:i,field:c,as:`upper_${c}`},{op:e,field:c,as:`center_${c}`}],f=[{fieldPrefix:"upper_",titlePrefix:eB({field:c,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:eB({field:c,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:eB({field:c,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&nT((h=e.center,`${(p=e.extent)?"extent ":""}${p&&h?"and ":""}${h?"center ":""}${p&&h?"are ":"is "}not needed when data are aggregated.`)),"aggregated-upper-lower"===o?(f=[],u=[{calculate:`datum["${n.field}"]`,as:`upper_${c}`},{calculate:`datum["${c}"]`,as:`lower_${c}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:c}],u=[{calculate:`datum["${c}"] + datum["${i.field}"]`,as:`upper_${c}`}],r?u.push({calculate:`datum["${c}"] + datum["${r.field}"]`,as:`lower_${c}`}):u.push({calculate:`datum["${c}"] - datum["${i.field}"]`,as:`lower_${c}`}));for(const e of u)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:_O(_O(e.calculate,'datum["',""),'"]',"")})}var h,p;return{postAggregateCalculates:u,errorBarSpecificAggregate:l,tooltipSummary:f,tooltipTitleWithFieldName:d}}(l,f,d,h,p,c,t,n),{[m]:x,["x"===m?"x2":"y2"]:w,["x"===m?"xError":"yError"]:_,["x"===m?"xError2":"yError2"]:k,...E}=r,{bins:$,timeUnits:A,aggregate:D,groupby:S,encoding:F}=FB(E,n),C=[...D,...g],M="raw"!==c?[]:S,O=NB(v,f,F,b);return{transform:[...s.transform??[],...$,...A,...0===C.length?[]:[{aggregate:C,groupby:M}],...y],groupby:M,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:F,ticksOrient:"vertical"===u?"horizontal":"vertical",markDef:l,outerSpec:s,tooltipEncoding:O}}function QB(e,t,n){return`${yO(e)} ${n} ${t}`}const KB="errorband",ZB=new EB(KB,ej);function ej(e,{config:t}){e={...e,encoding:MB(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:s,tooltipEncoding:l}=JB(e,KB,t),u=a,c=TB(u,r,i,o,t.errorband),f=void 0!==e.encoding.x&&void 0!==e.encoding.y;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const p={...u.interpolate?{interpolate:u.interpolate}:{},...u.tension&&u.interpolate?{tension:u.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},h={...h,...p,aria:!1}):u.interpolate?nT(KR("interpolate")):u.tension&&nT(KR("tension")),{...s,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:l})]}}const tj={};function nj(e,t,n){const i=new EB(e,t);tj[e]={normalizer:i,parts:n}}nj(IB,WB,["box","median","outliers","rule","ticks"]),nj(GB,XB,["ticks","rule"]),nj(KB,ej,["band","borders"]);const ij=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],rj={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},oj={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},aj=cO(rj),sj=cO(oj),lj=cO({header:1,headerRow:1,headerColumn:1,headerFacet:1}),uj=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],cj="_vgsid_",fj={point:{on:"click",fields:[cj],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function dj(e){return"legend"===e||!!(null==e?void 0:e.legend)}function hj(e){return dj(e)&&re(e)}function pj(e){return!!(null==e?void 0:e.select)}function mj(e){const t=[];for(const n of e||[]){if(pj(n))continue;const{expr:e,bind:i,...r}=n;if(i&&e){const n={...r,bind:i,init:e};t.push(n)}else{const n={...r,...e?{update:e}:{},...i?{bind:i}:{}};t.push(n)}}return t}function gj(e){return RO(e,"concat")}function yj(e){return RO(e,"vconcat")}function vj(e){return RO(e,"hconcat")}function bj({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function xj(e){return RO(e,"step")}function wj(e){return RO(e,"view")||RO(e,"width")||RO(e,"height")}const _j=cO({align:1,bounds:1,center:1,columns:1,spacing:1});function kj(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function Ej(e,t){const n=$j(e,t);return xj(n)?n.step:Aj}function $j(e,t){return $O(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const Aj=20,Dj={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:Aj},mark:{color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},arc:{},area:{},bar:YP,circle:{},geoshape:{},image:{},line:{},point:{},rect:XP,rule:{color:"black"},square:{},text:{color:"black"},tick:JP,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:fj,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},Sj=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],Fj={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},Cj={blue:Sj[0],orange:Sj[1],red:Sj[2],teal:Sj[3],green:Sj[4],yellow:Sj[5],purple:Sj[6],pink:Sj[7],brown:Sj[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function Mj(e){const t=cO(e||{}),n={};for(const i of t){const t=e[i];n[i]=gB(t)?lR(t):uR(t)}return n}const Oj=[...HP,..._B,...lj,"background","padding","legend","lineBreak","scale","style","title","view"];function zj(e={}){const{color:t,font:n,fontSize:i,selection:r,...o}=e,a=Ue({},VM(Dj),n?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(n):{},t?function(e={}){return{signals:[{name:"color",value:re(e)?{...Cj,...e}:Cj}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(t):{},i?function(e){return{signals:[{name:"fontSize",value:re(e)?{...Fj,...e}:Fj}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(i):{},o||{});r&&gt(a,"selection",r,!0);const s=JM(a,Oj);for(const l of["background","lineBreak","padding"])a[l]&&(s[l]=uR(a[l]));for(const l of HP)a[l]&&(s[l]=ZN(a[l]));for(const l of _B)a[l]&&(s[l]=Mj(a[l]));for(const l of lj)a[l]&&(s[l]=ZN(a[l]));if(a.legend&&(s.legend=ZN(a.legend)),a.scale){const{invalid:e,...t}=a.scale,n=ZN(e,{level:1});s.scale={...ZN(t),...cO(n).length>0?{invalid:n}:{}}}return a.style&&(s.style=function(e){const t=cO(e),n={};for(const i of t)n[i]=Mj(e[i]);return n}(a.style)),a.title&&(s.title=ZN(a.title)),a.view&&(s.view=ZN(a.view)),s}const Nj=new Set(["view",...BP]),Rj=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],Tj={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...WP};function Pj(e){e=VM(e);for(const t of Rj)delete e[t];if(e.axis)for(const t in e.axis)gB(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of ij)delete e.legend[t];if(e.mark){for(const t of qP)delete e.mark[t];e.mark.tooltip&&re(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(mj(e.params)),delete e.params);for(const t of Nj){for(const i of qP)delete e[t][i];const n=Tj[t];if(n)for(const i of n)delete e[t][i];Lj(e,t)}for(const t of cO(tj))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=eR(e.title);uO(t)||(e.style["group-title"]={...e.style["group-title"],...t});uO(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n});uO(i)?delete e.title:e.title=i}(e);for(const t in e)re(e[t])&&uO(e[t])&&delete e[t];return uO(e)?void 0:e}function Lj(e,t,n,i){"view"===t&&(n="cell");const r={...e[t],...e.style[n??t]};uO(r)||(e.style[n??t]=r),delete e[t]}function Bj(e){return RO(e,"layer")}class jj{map(e,t){return $L(e)?this.mapFacet(e,t):function(e){return RO(e,"repeat")}(e)?this.mapRepeat(e,t):vj(e)?this.mapHConcat(e,t):yj(e)?this.mapVConcat(e,t):gj(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(Bj(e))return this.mapLayer(e,t);if(kB(e))return this.mapUnit(e,t);throw new Error(ER(e))}mapLayer(e,t){return{...e,layer:e.layer.map((e=>this.mapLayerOrUnit(e,t)))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map((e=>this.map(e,t)))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map((e=>this.map(e,t)))}}mapConcat(e,t){const{concat:n,...i}=e;return{...i,concat:n.map((e=>this.map(e,t)))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}}const Ij={zero:1,center:1,normalize:1};const qj=new Set([kP,$P,EP,CP,SP,NP,RP,DP,MP,OP]),Uj=new Set([$P,EP,kP]);function Wj(e){return RL(e)&&"quantitative"===TL(e)&&!e.bin}function Hj(e,t,{orient:n,type:i}){const r="x"===t?"y":"radius",o="x"===t&&["bar","area"].includes(i),a=e[t],s=e[r];if(RL(a)&&RL(s))if(Wj(a)&&Wj(s)){if(a.stack)return t;if(s.stack)return r;const e=RL(a)&&!!a.aggregate;if(e!==(RL(s)&&!!s.aggregate))return e?t:r;if(o){if("vertical"===n)return r;if("horizontal"===n)return t}}else{if(Wj(a))return t;if(Wj(s))return r}else{if(Wj(a)){if(o&&"vertical"===n)return;return t}if(Wj(s)){if(o&&"horizontal"===n)return;return r}}}function Gj(e,t){var n,i;const o=jP(e)?e:{type:e},a=o.type;if(!qj.has(a))return null;const s=Hj(t,"x",o)||Hj(t,"theta",o);if(!s)return null;const l=t[s],u=RL(l)?YL(l,{}):void 0,c=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(s),f=[],d=new Set;if(t[c]){const e=t[c],n=RL(e)?YL(e,{}):void 0;n&&n!==u&&(f.push(c),d.add(n))}const h="x"===c?"xOffset":"yOffset",p=t[h],g=RL(p)?YL(p,{}):void 0;g&&g!==u&&(f.push(h),d.add(g));const y=cN.reduce(((e,n)=>{if("tooltip"!==n&&$B(t,n)){const i=t[n];for(const t of r(i)){const i=rB(t);if(i.aggregate)continue;const r=YL(i,{});r&&d.has(r)||e.push({channel:n,fieldDef:i})}}return e}),[]);let v;return void 0!==l.stack?v=ye(l.stack)?l.stack?"zero":null:l.stack:Uj.has(a)&&(v="zero"),v&&m(Ij,v)?SB(t)&&0===y.length?null:((null==(n=null==l?void 0:l.scale)?void 0:n.type)&&(null==(i=null==l?void 0:l.scale)?void 0:i.type)!==UT&&(null==l?void 0:l.stack)&&nT(`Stack is applied to a non-linear scale (${l.scale.type}).`),IL(t[Uz(s)])?(void 0!==l.stack&&nT(`Cannot stack "${b=s}" if there is already "${b}2".`),null):(RL(l)&&l.aggregate&&!WN.has(l.aggregate)&&nT(`Stacking is applied even though the aggregate function is non-summative ("${l.aggregate}").`),{groupbyChannels:f,groupbyFields:d,fieldChannel:s,impute:null!==l.impute&&PP(a),stackBy:y,offset:v})):null;var b}function Vj(e,t,n){const i=ZN(e),r=gR("orient",i,n);if(i.orient=function(e,t,n){switch(e){case SP:case NP:case RP:case MP:case FP:case AP:return}const{x:i,y:r,x2:o,y2:a}=t;switch(e){case $P:if(RL(i)&&(XN(i.bin)||RL(r)&&r.aggregate&&!i.aggregate))return"vertical";if(RL(r)&&(XN(r.bin)||RL(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o)return(RL(i)&&i.type===LT&&!VN(i.bin)||jL(i))&&RL(r)&&XN(r.bin)?"horizontal":"vertical";if(!a)return(RL(r)&&r.type===LT&&!VN(r.bin)||jL(r))&&RL(i)&&XN(i.bin)?"vertical":"horizontal"}case CP:if(o&&(!RL(i)||!XN(i.bin))&&a&&(!RL(r)||!XN(r.bin)))return;case EP:if(a)return RL(r)&&XN(r.bin)?"horizontal":"vertical";if(o)return RL(i)&&XN(i.bin)?"vertical":"horizontal";if(e===CP){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case DP:case OP:{const t=BL(i),o=BL(r);if(n)return n;if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o)return"vertical";{const e=qL(i)&&i.type===jT,t=qL(r)&&r.type===jT;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&nT(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=gR("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:VP[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}const o=gR("opacity",i,n),a=gR("fillOpacity",i,n);void 0===o&&void 0===a&&(i.opacity=function(e,t){if(ZM([SP,OP,NP,RP],e)&&!SB(t))return.7;return}(i.type,t));return void 0===gR("cursor",i,n)&&(i.cursor=function(e,t,n){if(t.href||e.href||gR("href",e,n))return"pointer";return e.cursor}(i,t,n)),i}function Xj(e){const{point:t,line:n,...i}=e;return cO(i).length>1?i:i.type}function Yj(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:JM(e[t],["point","line"])});return e}function Jj(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?re(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?re(t.point)?t.point:{}:void 0}function Qj(e,t={}){return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class Kj{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(kB(e)){const{mark:n,encoding:i}=e,r=jP(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!Jj(r,t[r.type],i);case"area":return!!Jj(r,t[r.type],i)||!!Qj(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:o,mark:a,name:s,encoding:l,...u}=e,c=MB(l,i),f=jP(a)?a:{type:a},d=Jj(f,i[f.type],c),h="area"===f.type&&Qj(f,i[f.type]),p=[{name:s,...r?{params:r}:{},mark:Xj({..."area"===f.type&&void 0===f.opacity&&void 0===f.fillOpacity?{opacity:.7}:{},...f}),encoding:JM(c,["shape"])}],m=Gj(Vj(f,c,i),c);let g=c;if(m){const{fieldChannel:e,offset:t}=m;g={...c,[e]:{...c[e],...t?{stack:t}:{}}}}return g=JM(g,["y2","x2"]),h&&p.push({...o?{projection:o}:{},mark:{type:"line",...YM(f,["clip","interpolate","tension","tooltip"]),...h},encoding:g}),d&&p.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...YM(f,["clip","tooltip"]),...d},encoding:g}),n({...u,layer:p},{...t,config:Yj(i)})}}function Zj(e,t){return t?kL(e)?oI(e,t):nI(e,t):e}function eI(e,t){return t?oI(e,t):e}function tI(e,t,n){const i=t[e];return!oe(r=i)&&RO(r,"repeat")?i.repeat in n?{...t,[e]:n[i.repeat]}:void nT(function(e){return`Unknown repeated value "${e}".`}(i.repeat)):t;var r}function nI(e,t){if(void 0!==(e=tI("field",e,t))){if(null===e)return null;if(DL(e)&&wL(e.sort)){const n=tI("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function iI(e,t){if(RL(e))return nI(e,t);{const n=tI("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function rI(e,t){if(!IL(e)){if(NL(e)){const n=iI(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=iI(e,t);if(n)return n;if(OL(e))return{condition:e.condition}}}function oI(e,t){const n={};for(const i in e)if(RO(e,i)){const r=e[i];if(a(r))n[i]=r.map((e=>rI(e,t))).filter((e=>e));else{const e=rI(r,t);void 0!==e&&(n[i]=e)}}return n}class aI{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(kB(e)){const{encoding:t,mark:n}=e;if("line"===n||jP(n)&&"line"===n.type)for(const e of Bz){const n=t[Iz(e)];if(t[e]&&(RL(n)&&!XN(n.bin)||PL(n)))return!0}}return!1}run(e,t,n){const{encoding:i,mark:r}=e;var o,a;return nT((o=!!i.x2,a=!!i.y2,`Line mark is for continuous lines and thus cannot be used with ${o&&a?"x2 and y2":o?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),n({...e,mark:re(r)?{...r,type:"rule"}:"rule"},t)}}function sI({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...cO(e),...cO(t)]);for(const o of r){const r=t[o],s=e[o];if(IL(r)){const e={...s,...r};i[o]=e}else NL(r)?i[o]={...r,condition:{...s,...r.condition}}:r||null===r?i[o]=r:(n||UL(s)||nR(s)||IL(s)||a(s))&&(i[o]=s)}}else i=t;return!i||uO(i)?void 0:i}function lI(e){const{parentProjection:t,projection:n}=e;return t&&n&&nT(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${NO(t)} is overridden by a child projection ${NO(n)}.`}({parentProjection:t,projection:n})),n??t}function uI(e){return RO(e,"filter")}function cI(e){return RO(e,"lookup")}function fI(e){return RO(e,"pivot")}function dI(e){return RO(e,"density")}function hI(e){return RO(e,"quantile")}function pI(e){return RO(e,"regression")}function mI(e){return RO(e,"loess")}function gI(e){return RO(e,"sample")}function yI(e){return RO(e,"window")}function vI(e){return RO(e,"joinaggregate")}function bI(e){return RO(e,"flatten")}function xI(e){return RO(e,"calculate")}function wI(e){return RO(e,"bin")}function _I(e){return RO(e,"impute")}function kI(e){return RO(e,"timeUnit")}function EI(e){return RO(e,"aggregate")}function $I(e){return RO(e,"stack")}function AI(e){return RO(e,"fold")}function DI(e){return RO(e,"extent")&&!RO(e,"density")&&!RO(e,"regression")}function SI(e,t){const{transform:n,...i}=e;if(n){return{...i,transform:n.map((e=>{if(uI(e))return{filter:MI(e,t)};if(wI(e)&&YN(e.bin))return{...e,bin:CI(e.bin)};if(cI(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}))}}return e}function FI(e,t){var n,i;const r=VM(e);if(RL(r)&&YN(r.bin)&&(r.bin=CI(r.bin)),WL(r)&&(null==(i=null==(n=r.scale)?void 0:n.domain)?void 0:i.selection)){const{selection:e,...t}=r.scale.domain;r.scale.domain={...t,...e?{param:e}:{}}}if(OL(r))if(a(r.condition))r.condition=r.condition.map((e=>{const{selection:n,param:i,test:r,...o}=e;return i?e:{...o,test:MI(e,t)}}));else{const{selection:e,param:n,test:i,...o}=FI(r.condition,t);r.condition=n?r.condition:{...o,test:MI(r.condition,t)}}return r}function CI(e){const t=e.extent;if(null==t?void 0:t.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function MI(e,t){const n=e=>GM(e,(e=>{var n;const i={param:e,empty:t.emptySelections[e]??!0};return(n=t.selectionPredicates)[e]??(n[e]=[]),t.selectionPredicates[e].push(i),i}));return e.selection?n(e.selection):GM(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class OI extends jj{map(e,t){const n=t.selections??[];if(e.params&&!kB(e)){const t=[];for(const i of e.params)pj(i)?n.push(i):t.push(i);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,t){const n=t.selections;if(!n||!n.length)return e;const i=(t.path??[]).concat(e.name),r=[];for(const o of n)if(o.views&&o.views.length)for(const t of o.views)(oe(t)&&(t===e.name||i.includes(t))||a(t)&&t.map((e=>i.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&r.push(o);else r.push(o);return r.length&&(e.params=r),e}}for(const bJ of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const e=OI.prototype[bJ];OI.prototype[bJ]=function(t,n){return e.call(this,t,zI(t,n))}}function zI(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function NI(e,t){void 0===t&&(t=zj(e.config));const n=function(e,t={}){const n={config:t};return PI.map(RI.map(TI.map(e,n),n),n)}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=kB(e)||Bj(e),a={};o?"container"==i&&"container"==r?(a.type="fit",a.contains="padding"):"container"==i?(a.type="fit-x",a.contains="padding"):"container"==r&&(a.type="fit-y",a.contains="padding"):("container"==i&&(nT(AR("width")),i=void 0),"container"==r&&(nT(AR("height")),r=void 0));const s={type:"pad",...a,...n?LI(n.autosize):{},...LI(e.autosize)};"fit"!==s.type||o||(nT($R),s.type="pad");"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&nT(DR("width"));"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&nT(DR("height"));if(zO(s,{type:"pad"}))return;return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const RI=new class extends jj{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[qB,VB,ZB,new Kj,new aI]}map(e,t){if(kB(e)){const n=$B(e.encoding,TO),i=$B(e.encoding,PO),r=$B(e.encoding,LO);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=eI(e.encoding,t.repeater),o={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{},...r?{encoding:r}:{}};if(n||i)return this.mapUnitWithParentEncodingOrProjection(o,t);const a=this.mapLayerOrUnit.bind(this);for(const s of this.nonFacetUnitNormalizers)if(s.hasMatchingType(o,t.config))return s.run(o,t,a);return o}mapRepeat(e,t){return function(e){return!a(e.repeat)&&RO(e.repeat,"layer")}(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){const{repeat:n,spec:i,...r}=e,{row:o,column:a,layer:s}=n,{repeater:l={},repeaterPrefix:u=""}=t;return o||a?this.mapRepeat({...e,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:s},spec:i}},t):{...r,layer:s.map((e=>{const n={...l,layer:e},r=`${(i.name?`${i.name}_`:"")+u}child__layer_${pO(e)}`,o=this.mapLayerOrUnit(i,{...t,repeater:n,repeaterPrefix:r});return o.name=r,o}))}}mapNonLayerRepeat(e,t){const{repeat:n,spec:i,data:r,...o}=e;!a(n)&&e.columns&&(e=JM(e,["columns"]),nT(NR("repeat")));const s=[],{repeater:l={},repeaterPrefix:u=""}=t,c=!a(n)&&n.row||[l?l.row:null],f=!a(n)&&n.column||[l?l.column:null],d=a(n)&&n||[l?l.repeat:null];for(const p of d)for(const e of c)for(const r of f){const o={repeat:p,row:e,column:r,layer:l.layer},c=(i.name?`${i.name}_`:"")+u+"child__"+(a(n)?`${pO(p)}`:(n.row?`row_${pO(e)}`:"")+(n.column?`column_${pO(r)}`:"")),f=this.map(i,{...t,repeater:o,repeaterPrefix:c});f.name=c,s.push(JM(f,["data"]))}const h=a(n)?e.columns:n.column?n.column.length:1;return{data:i.data??r,align:"all",...o,columns:h,concat:s}}mapFacet(e,t){const{facet:n}=e;return kL(n)&&e.columns&&(e=JM(e,["columns"]),nT(NR("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=lI({parentProjection:o,projection:i}),l=sI({parentEncoding:r,encoding:eI(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...l?{encoding:l}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:l,height:u,view:c,params:f,encoding:d,...h}=e,{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),g=eI(o,t.repeater);return this.mapFacet({...h,...m,facet:p,spec:{...s?{width:s}:{},...u?{height:u}:{},...c?{view:c}:{},...l?{projection:l}:{},mark:a,encoding:g,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&nT(`Facet encoding dropped as ${(o=[...n?[TO]:[],...i?[PO]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const n of[TO,PO]){const i=e[n];if(i){const{align:e,center:r,spacing:o,columns:s,...l}=i;t[n]=l;for(const t of["align","center","spacing"])void 0!==i[t]&&(a[t]??(a[t]={}),a[t][n]=i[t])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:o,...a}=r;return{facetMapping:Zj(a,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...i?{spacing:i}:{},...o?{columns:o}:{}}}}var o}mapLayer(e,{parentEncoding:t,parentProjection:n,...i}){const{encoding:r,projection:o,...a}=e,s={...i,parentEncoding:sI({parentEncoding:t,encoding:r,layer:!0}),parentProjection:lI({parentProjection:n,projection:o})};return super.mapLayer({...a,...e.name?{name:[s.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{}},s)}},TI=new class extends jj{map(e,t){return t.emptySelections??(t.emptySelections={}),t.selectionPredicates??(t.selectionPredicates={}),e=SI(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=SI(e,t)).encoding){const n={};for(const[i,r]of dO(e.encoding))n[i]=FI(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:dO(n).map((([e,n])=>{const{init:i,bind:r,empty:o,...a}=n;"single"===a.type?(a.type="point",a.toggle=!1):"multi"===a.type&&(a.type="point"),t.emptySelections[e]="none"!==o;for(const s of fO(t.selectionPredicates[e]??{}))s.empty="none"!==o;return{name:e,value:i,select:a,bind:r}}))}:e}},PI=new OI;function LI(e){return oe(e)?{type:e}:e??{}}const BI=["background","padding"];function jI(e,t){const n={};for(const i of BI)e&&void 0!==e[i]&&(n[i]=uR(e[i]));return t&&(n.params=e.params),n}class II{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new II(VM(this.explicit),VM(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return $O(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,{value:t,explicit:n}){void 0!==t&&this.set(e,t,n)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,{explicit:t,implicit:n}){void 0!==t[e]?this.set(e,t[e],!0):void 0!==n[e]&&this.set(e,n[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of cO(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function qI(e){return{explicit:!0,value:e}}function UI(e){return{explicit:!1,value:e}}function WI(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:HI(t,n,i,r)}}function HI(e,t,n,i){return e.explicit&&t.explicit&&nT(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${NO(n)} and ${NO(i)}). Using ${NO(n)}.`}(n,i,e.value,t.value)),e}function GI(e,t,n,i,r=HI){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:zO(e.value,t.value)?e:r(e,t,n,i)}class VI extends II{constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}function XI(e){return RO(e,"url")}function YI(e){return RO(e,"values")}function JI(e){return RO(e,"name")&&!XI(e)&&!YI(e)&&!QI(e)}function QI(e){return e&&(KI(e)||ZI(e)||eq(e))}function KI(e){return RO(e,"sequence")}function ZI(e){return RO(e,"sphere")}function eq(e){return RO(e,"graticule")}var tq,nq;function iq({invalid:e,isPath:t}){switch(QP(e,{isPath:t})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}function rq(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=wO(r.field),r}function oq(e,t=!0,n=u){if(a(e)){const i=e.map((e=>oq(e,t,n)));return t?`[${i.join(", ")}]`:i}return iT(e)?n(t?uT(e):function(e){const t=lT(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(NO(e)):e}function aq(e,t){for(const n of fO(e.component.selection??{})){const i=n.name;let r=`${i}${AU}, ${"global"===n.resolve?"true":`{unit: ${CU(e)}}`}`;for(const o of FU)o.defined(n)&&(o.signals&&(t=o.signals(e,n,t)),o.modifyExpr&&(r=o.modifyExpr(e,n,r)));t.push({name:i+DU,on:[{events:{signal:n.name+AU},update:`modify(${he(n.name+$U)}, ${r})`}]})}return uq(t)}function sq(e,t){if(e.component.selection&&cO(e.component.selection).length){const n=he(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:RD("pointermove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return uq(t)}function lq(e,t){for(const n of fO(e.component.selection??{}))for(const i of FU)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function uq(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}(nq=tq||(tq={}))[nq.Raw=0]="Raw",nq[nq.Main=1]="Main",nq[nq.Row=2]="Row",nq[nq.Column=3]="Column",nq[nq.Lookup=4]="Lookup",nq[nq.PreFilterInvalid=5]="PreFilterInvalid",nq[nq.PostFilterInvalid=6]="PostFilterInvalid";class cq{constructor(e,t){this.debugName=t,this._children=[],this._parent=null,e&&(this.parent=e)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){this._children.includes(e)?nT("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const i of this._children)i.parent=e;this._children=[],e.removeChild(this);const n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}}class fq extends cq{clone(){const e=new this.constructor;return e.debugName=`clone_${this.debugName}`,e._source=this._source,e._name=`clone_${this._name}`,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${DO()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}function dq(e){return void 0!==e.as}function hq(e){return`${e}_end`}class pq extends cq{clone(){return new pq(null,VM(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{const{field:r,timeUnit:o}=n;if(o){let a;if(dT(o)){if(dG(t)){const{mark:e,markDef:i,config:s}=t,l=SL({fieldDef:n,markDef:i,config:s});(LP(e)||l)&&(a={timeUnit:wT(o),field:r})}}else a={as:YL(n,{forAs:!0}),field:r,timeUnit:o};if(dG(t)){const{mark:e,markDef:r,config:o}=t,s=SL({fieldDef:n,markDef:r,config:o});LP(e)&&hN(i)&&.5!==s&&(a.rectBandPosition=s)}a&&(e[QM(a)]=a)}return e}),{});return uO(n)?null:new pq(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:wT(n)};return new pq(e,{[QM(r)]:r})}merge(e){this.timeUnits={...this.timeUnits};for(const t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of dO(this.timeUnits)){const r=dq(i)?i.as:`${i.field}_end`;e.has(r)||(t[n]=i)}this.timeUnits=t}producedFields(){return new Set(fO(this.timeUnits).map((e=>dq(e)?e.as:hq(e.field))))}dependentFields(){return new Set(fO(this.timeUnits).map((e=>e.field)))}hash(){return`TimeUnit ${QM(this.timeUnits)}`}assemble(){const e=[];for(const t of fO(this.timeUnits)){const{rectBandPosition:n}=t,i=wT(t.timeUnit);if(dq(t)){const{field:r,as:o}=t,{unit:a,utc:s,...l}=i,u=[o,`${o}_end`];e.push({field:wO(r),type:"timeunit",...a?{units:gT(a)}:{},...s?{timezone:"utc"}:{},...l,as:u}),e.push(...vq(u,n,i))}else if(t){const{field:r}=t,o=r.replaceAll("\\.","."),a=yq({timeUnit:i,field:o}),s=hq(o);e.push({type:"formula",expr:a,as:s}),e.push(...vq([o,s],n,i))}}return e}}const mq="offsetted_rect_start",gq="offsetted_rect_end";function yq({timeUnit:e,field:t,reverse:n}){const{unit:i,utc:r}=e,o=yT(i),{part:a,step:s}=ET(o,e.step);return`${r?"utcOffset":"timeOffset"}('${a}', datum['${t}'], ${n?-s:s})`}function vq([e,t],n,i){if(void 0!==n&&.5!==n){const r=`datum['${e}']`,o=`datum['${t}']`;return[{type:"formula",expr:bq([yq({timeUnit:i,field:e,reverse:!0}),r],n+.5),as:`${e}_${mq}`},{type:"formula",expr:bq([r,o],n+.5),as:`${e}_${gq}`}]}return[]}function bq([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const xq="_tuple_fields";class wq{constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const _q={defined:()=>!0,parse:(e,t,n)=>{const i=t.name,o=t.project??(t.project=new wq),a={},s={},l=new Set,u=(e,t)=>{const n="visual"===t?e.channel:e.field;let r=pO(`${i}_${n}`);for(let o=1;l.has(r);o++)r=pO(`${i}_${n}_${o}`);return l.add(r),{[t]:r}},c=t.type,f=e.config.selection[c],d=void 0!==n.value?r(n.value):null;let{fields:h,encodings:p}=re(n.select)?n.select:{};if(!h&&!p&&d)for(const r of d)if(re(r))for(const e of cO(r))m(Pz,e)?(p||(p=[])).push(e):"interval"===c?(nT('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),p=f.encodings):(h??(h=[])).push(e);h||p||(p=f.encodings,"fields"in f&&(h=f.fields));for(const r of p??[]){const t=e.fieldDef(r);if(t){let n=t.field;if(t.aggregate){nT(MR(r,t.aggregate));continue}if(!n){nT(CR(r));continue}if(t.timeUnit&&!dT(t.timeUnit)){n=e.vgField(r);const i={timeUnit:t.timeUnit,as:n,field:t.field};s[QM(i)]=i}if(!a[n]){const i={field:n,channel:r,type:"interval"===c&&MN(r)&&lP(e.getScaleComponent(r).get("type"))?"R":t.bin?"R-RE":"E",index:o.items.length};i.signals={...u(i,"data"),...u(i,"visual")},o.items.push(a[n]=i),o.hasField[n]=a[n],o.hasSelectionId=o.hasSelectionId||n===cj,_z(r)?(i.geoChannel=r,i.channel=wz(r),o.hasChannel[i.channel]=a[n]):o.hasChannel[r]=a[n]}}else nT(CR(r))}for(const r of h??[]){if(o.hasField[r])continue;const e={type:"E",field:r,index:o.items.length};e.signals={...u(e,"data")},o.items.push(e),o.hasField[r]=e,o.hasSelectionId=o.hasSelectionId||r===cj}d&&(t.init=d.map((e=>o.items.map((t=>re(e)?void 0!==e[t.geoChannel||t.channel]?e[t.geoChannel||t.channel]:e[t.field]:e))))),uO(s)||(o.timeUnit=new pq(null,s))},signals:(e,t,n)=>{const i=t.name+xq;return n.filter((e=>e.name===i)).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(rq)})}},kq={defined:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!MN(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;"sequential"==a&&nT("Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc"),o&&lP(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):nT("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter((e=>0===n.filter((t=>t.name===e.signals.data)).length));if(!e.parent||$q(e)||0===i.length)return n;const r=n.find((e=>e.name===t.name));let o=r.update;if(o.includes(SU))r.update=`{${i.map((e=>`${he(wO(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of i){const t=`${he(wO(e.field))}: ${e.signals.data}`;o.includes(t)||(o=`${o.substring(0,o.length-1)}, ${t}}`)}r.update=o}return n.concat(i.map((e=>({name:e.signals.data}))))},signals:(e,t,n)=>{if(e.parent&&!$q(e))for(const i of t.scales){const e=n.find((e=>e.name===i.signals.data));e.push="outer",delete e.value,delete e.update}return n}};function Eq(e,t){return`domain(${he(e.scaleName(t))})`}function $q(e){return e.parent&&mG(e.parent)&&!e.parent.parent}const Aq="_brush",Dq="_scale_trigger",Sq="geo_interval_init_tick",Fq="_init",Cq={defined:e=>"interval"===e.type,parse:(e,t,n)=>{var i;if(e.hasProjection){const e={...re(n.select)?n.select:{}};e.fields=[cj],e.encodings||(e.encodings=n.value?cO(n.value):[JO,YO]),n.select={type:"interval",...e}}if(t.translate&&!kq.defined(t)){const e=`!event.item || event.item.mark.name !== ${he(t.name+Aq)}`;for(const n of t.events){if(!n.between){nT(`${n} is not an ordered event stream for interval selections.`);continue}const t=r((i=n.between[0]).filter??(i.filter=[]));t.includes(e)||t.push(e)}}},signals:(e,t,n)=>{const i=t.name,r=i+AU,o=fO(t.project.hasChannel).filter((e=>e.channel===BO||e.channel===jO)),a=t.init?t.init[0]:null;if(n.push(...o.reduce(((n,i)=>n.concat(function(e,t,n,i){const r=!e.hasProjection,o=n.channel,a=n.signals.visual,s=he(r?e.scaleName(o):e.projectionName()),l=e=>`scale(${s}, ${e})`,u=e.getSizeSignalRef(o===BO?"width":"height").signal,c=`${o}(unit)`,f=t.events.reduce(((e,t)=>[...e,{events:t.between[0],update:`[${c}, ${c}]`},{events:t,update:`[${a}[0], clamp(${c}, 0, ${u})]`}]),[]);if(r){const r=n.signals.data,u=kq.defined(t),c=e.getScaleComponent(o),d=c?c.get("type"):void 0,h=i?{init:oq(i,!0,l)}:{value:[]};return f.push({events:{signal:t.name+Dq},update:lP(d)?`[${l(`${r}[0]`)}, ${l(`${r}[1]`)}]`:"[0, 0]"}),u?[{name:r,on:[]}]:[{name:a,...h,on:f},{name:r,...i?{init:oq(i)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${s}, ${a})`}]}]}{const e=o===BO?0:1,n=t.name+Fq;return[{name:a,...i?{init:`[${n}[0][${e}], ${n}[1][${e}]]`}:{value:[]},on:f}]}}(e,t,i,a&&a[i.index]))),[])),e.hasProjection){const s=he(e.projectionName()),l=e.projectionName()+"_center",{x:u,y:c}=t.project.hasChannel,f=u&&u.signals.visual,d=c&&c.signals.visual,h=u?a&&a[u.index]:`${l}[0]`,p=c?a&&a[c.index]:`${l}[1]`,m=t=>e.getSizeSignalRef(t).signal,g=`[[${f?f+"[0]":"0"}, ${d?d+"[0]":"0"}],[${f?f+"[1]":m("width")}, ${d?d+"[1]":m("height")}]]`;if(a&&(n.unshift({name:i+Fq,init:`[scale(${s}, [${u?h[0]:h}, ${c?p[0]:p}]), scale(${s}, [${u?h[1]:h}, ${c?p[1]:p}])]`}),!u||!c)){n.find((e=>e.name===l))||n.unshift({name:l,update:`invert(${s}, [${m("width")}/2, ${m("height")}/2])`})}const y=`vlSelectionTuples(${`intersect(${g}, {markname: ${he(e.getName("marks"))}}, unit.mark)`}, ${`{unit: ${CU(e)}}`})`,v=o.map((e=>e.signals.visual));return n.concat({name:r,on:[{events:[...v.length?[{signal:v.join(" || ")}]:[],...a?[{signal:Sq}]:[]],update:y}]})}{if(!kq.defined(t)){const t=i+Dq,r=o.map((t=>{const n=t.channel,{data:i,visual:r}=t.signals,o=he(e.scaleName(n)),a=lP(e.getScaleComponent(n).get("type"))?"+":"";return`(!isArray(${i}) || (${a}invert(${o}, ${r})[0] === ${a}${i}[0] && ${a}invert(${o}, ${r})[1] === ${a}${i}[1]))`}));r.length&&n.push({name:t,value:{},on:[{events:o.map((t=>({scale:e.scaleName(t.channel)}))),update:r.join(" && ")+` ? ${t} : {}`}]})}const s=o.map((e=>e.signals.data)),l=`unit: ${CU(e)}, fields: ${i+xq}, values`;return n.concat({name:r,...a?{init:`{${l}: ${oq(a)}}`}:{},...s.length?{on:[{events:[{signal:s.join(" || ")}],update:`${s.join(" && ")} ? {${l}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(dG(e)&&e.hasProjection&&t.init){n.filter((e=>e.name===Sq)).length||n.unshift({name:Sq,value:null,on:[{events:"timer{1}",update:`${Sq} === null ? {} : ${Sq}`}]})}return n},marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,a=null==r?void 0:r.signals.visual,s=null==o?void 0:o.signals.visual,l=`data(${he(t.name+$U)})`;if(kq.defined(t)||!r&&!o)return n;const u={x:void 0!==r?{signal:`${a}[0]`}:{value:0},y:void 0!==o?{signal:`${s}[0]`}:{value:0},x2:void 0!==r?{signal:`${a}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${s}[1]`}:{field:{group:"height"}}};if("global"===t.resolve)for(const g of cO(u))u[g]=[{test:`${l}.length && ${l}[0].unit === ${CU(e)}`,...u[g]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,p=cO(h).reduce(((e,t)=>(e[t]=[{test:[void 0!==r&&`${a}[0] !== ${a}[1]`,void 0!==o&&`${s}[0] !== ${s}[1]`].filter((e=>e)).join(" && "),value:h[t]},{value:null}],e)),{}),m=d??(t.translate?"move":null);return[{name:`${i+Aq}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:u}},...n,{name:i+Aq,type:"rect",clip:!0,encode:{enter:{...m?{cursor:{value:m}}:{},fill:{value:"transparent"}},update:{...u,...p}}}]}};const Mq={defined:e=>"point"===e.type,signals:(e,t,n)=>{const i=t.name,r=i+xq,o=t.project,a="(item().isVoronoi ? datum.datum : datum)",s=fO(e.component.selection??{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+Aq):e),[]).map((e=>`indexof(item().mark.name, '${e}') < 0`)).join(" && "),l="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(s?` && ${s}`:"");let u=`unit: ${CU(e)}, `;if(t.project.hasSelectionId)u+=`${cj}: ${a}[${he(cj)}]`;else{u+=`fields: ${r}, values: [${o.items.map((t=>{const n=e.fieldDef(t.channel);return(null==n?void 0:n.bin)?`[${a}[${he(e.vgField(t.channel,{}))}], ${a}[${he(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${a}[${he(t.field)}]`})).join(", ")}]`}const c=t.events;return n.concat([{name:i+AU,on:c?[{events:c,update:`${l} ? {${u}} : null`,force:!0}]:[]}])}};function Oq({model:e,channelDef:t,vgChannel:n,invalidValueRef:i,mainRefFn:o}){const a=OL(t)&&t.condition;let s=[];if(a){s=r(a).map((t=>{const n=o(t);if(function(e){return RO(e,"param")}(t)){const{param:i,empty:r}=t;return{test:PU(e,{param:i,empty:r}),...n}}return{test:BU(e,t.test),...n}}))}void 0!==i&&s.push(i);const l=o(t);return void 0!==l&&s.push(l),s.length>1||1===s.length&&Boolean(s[0].test)?{[n]:s}:1===s.length?{[n]:s[0]}:{}}function zq(e,t="text"){const n=e.encoding[t];return Oq({model:e,channelDef:n,vgChannel:t,mainRefFn:t=>Nq(t,e.config),invalidValueRef:void 0})}function Nq(e,t,n="datum"){if(e){if(UL(e))return fR(e.value);if(IL(e)){const{format:i,formatType:r}=iB(e);return uL({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function Rq(e,t={}){const{encoding:n,markDef:i,config:r,stack:o}=e,s=n.tooltip;if(a(s))return{tooltip:Pq({tooltip:s},o,r,t)};{const a=t.reactiveGeom?"datum.datum":"datum";return Oq({model:e,channelDef:s,vgChannel:"tooltip",mainRefFn:e=>{const s=Nq(e,r,a);if(s)return s;if(null===e)return;let l=gR("tooltip",i,r);return!0===l&&(l={content:"encoding"}),oe(l)?{value:l}:re(l)?nR(l)?l:"encoding"===l.content?Pq(n,o,r,t):{signal:a}:void 0},invalidValueRef:void 0})}}function Tq(e,t,n,{reactiveGeom:i}={}){const o={...n,...n.tooltipFormat},a=new Set,s=i?"datum.datum":"datum",l=[];function u(n,i){const u=Iz(i),c=qL(n)?n:{...n,type:e[u].type},f=c.title||nB(c,o),d=r(f).join(", ").replaceAll(/"/g,'\\"');let h;if(hN(i)){const t="x"===i?"x2":"y2",n=rB(e[t]);if(XN(c.bin)&&n){const e=YL(c,{expr:s}),i=YL(n,{expr:s}),{format:r,formatType:l}=iB(c);h=yL(e,i,r,l,o),a.add(t)}}if((hN(i)||i===VO||i===HO)&&t&&t.fieldChannel===i&&"normalize"===t.offset){const{format:e,formatType:t}=iB(c);h=uL({fieldOrDatumDef:c,format:e,formatType:t,expr:s,config:o,normalizeStack:!0}).signal}h??(h=Nq(c,o,s).signal),l.push({channel:i,key:d,value:h})}OB(e,((e,t)=>{RL(e)?u(e,t):zL(e)&&u(e.condition,t)}));const c={};for(const{channel:r,key:f,value:d}of l)a.has(r)||c[f]||(c[f]=d);return c}function Pq(e,t,n,{reactiveGeom:i}={}){const r=Tq(e,t,n,{reactiveGeom:i}),o=dO(r).map((([e,t])=>`"${e}": ${t}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function Lq(e){const{markDef:t,config:n}=e,i=gR("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...Bq(e),...jq(e)}}function Bq(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=gR("ariaRoleDescription",n,i);return null!=r?{ariaRoleDescription:{value:r}}:m(aR,t)?{}:{ariaRoleDescription:{value:t}}}function jq(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return Oq({model:e,channelDef:o,vgChannel:"description",mainRefFn:t=>Nq(t,e.config),invalidValueRef:void 0});const a=gR("description",n,i);if(null!=a)return{description:fR(a)};if(!1===i.aria)return{};const s=Tq(t,r,i);return uO(s)?void 0:{description:{signal:dO(s).map((([e,t],n)=>`"${n>0?"; ":""}${e}: " + (${t})`)).join(" + ")}}}function Iq(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:l}=n;const u=r[e];void 0===s&&(l??(l=gR(e,i,o,{vgChannel:a,ignoreVgConfig:!OL(u)})),void 0!==l&&(s=fR(l)));const c={markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},f=eL({...c,scaleChannel:e,channelDef:u});return Oq({model:t,channelDef:u,vgChannel:a??e,invalidValueRef:f,mainRefFn:t=>oL({...c,channel:e,channelDef:t,stack:null,defaultRef:s})})}function qq(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:o}=n,a=t.filled??gR("filled",n,r),s=ZM(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,l=gR(!0===a?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===a&&"color"]??s,u=gR(!1===a?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===a&&"color"],c=a?"fill":"stroke",f={...l?{fill:fR(l)}:{},...u?{stroke:fR(u)}:{}};return n.color&&(a?n.fill:n.stroke)&&nT(BR("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...Iq("color",e,{vgChannel:c,defaultValue:a?l:u}),...Iq("fill",e,{defaultValue:i.fill?l:void 0}),...Iq("stroke",e,{defaultValue:i.stroke?u:void 0})}}function Uq(e){const{encoding:t,mark:n}=e,i=t.order;return!PP(n)&&UL(i)?Oq({model:e,channelDef:i,vgChannel:"zindex",mainRefFn:e=>fR(e.value),invalidValueRef:void 0}):{}}function Wq({channel:e,markDef:t,encoding:n={},model:i,bandPosition:r}){const o=`${e}Offset`,a=t[o],s=n[o];if(("xOffset"===o||"yOffset"===o)&&s){return{offsetType:"encoding",offset:oL({channel:o,channelDef:s,markDef:t,config:null==i?void 0:i.config,scaleName:i.scaleName(o),scale:i.getScaleComponent(o),stack:null,defaultRef:fR(a),bandPosition:r})}}const l=t[o];return l?{offsetType:"visual",offset:l}:{}}function Hq(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:a,stack:s}=t,l=r[e],u=r[Uz(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=Wq({channel:e,markDef:o,encoding:r,model:t,bandPosition:.5}),p=Gq({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),m=!l&&hN(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o,markDef:a}=e;if(IL(n)&&r&&t===r.fieldChannel){if(RL(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return rL({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return iL(n,i,{suffix:"end"},{offset:o})}return nL(e)}({channel:e,channelDef:l,channel2Def:u,markDef:o,config:a,scaleName:c,scale:f,stack:s,offset:d,defaultRef:p,bandPosition:"encoding"===h?0:void 0});return m?{[i||e]:m}:void 0}function Gq({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:a}=e;return()=>{const s=Iz(n),l=qz(n),u=gR(n,o,a,{vgChannel:l});if(void 0!==u)return aL(n,u);switch(t){case"zeroOrMin":return Vq({scaleName:i,scale:r,mode:"zeroOrMin",mainChannel:s,config:a});case"zeroOrMax":return Vq({scaleName:i,scale:r,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:s,config:a});case"mid":return{...e[Wz(n)],mult:.5}}}}function Vq({mainChannel:e,config:t,...n}){const i=ZP(n),{mode:r}=n;if(i)return i;switch(e){case"radius":{if("zeroOrMin"===r)return{value:0};const{widthSignal:e,heightSignal:t}=r.zeroOrMax;return{signal:`min(${e},${t})/2`}}case"theta":return"zeroOrMin"===r?{value:0}:{signal:"2*PI"};case"x":return"zeroOrMin"===r?{value:0}:{field:{group:"width"}};case"y":return"zeroOrMin"===r?{field:{group:"height"}}:{value:0}}}const Xq={left:"x",center:"xc",right:"x2"},Yq={top:"y",middle:"yc",bottom:"y2"};function Jq(e,t,n,i="middle"){if("radius"===e||"theta"===e)return qz(e);const r="x"===e?"align":"baseline",o=gR(r,t,n);let a;return nR(o)?(nT(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?Xq[a||("top"===i?"left":"center")]:Yq[a||i]}function Qq(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?Kq(e,t,{defaultPos:n,defaultPos2:i}):Hq(e,t,{defaultPos:n})}function Kq(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,a=Uz(e),s=Wz(e),l=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,l=Iz(n),u=Wz(n),c=qz(n),f=i[l],d=e.scaleName(l),h=e.getScaleComponent(l),{offset:p}=Wq(n in i||n in o?{channel:n,markDef:o,encoding:i,model:e}:{channel:l,markDef:o,encoding:i,model:e});if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=Wz(n),i=e.markDef[t];return null!=i?{[t]:{value:i}}:{[c]:{field:e.getName(n)}}}const m=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:a,stack:s,offset:l,defaultRef:u}){if(IL(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0))return iL(t,o,{suffix:"start"},{offset:l});return nL({channel:e,channelDef:n,scaleName:o,scale:a,stack:s,markDef:i,config:r,offset:l,defaultRef:u})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:s,scaleName:d,scale:h,stack:a,offset:p,defaultRef:void 0});if(void 0!==m)return{[c]:m};return Zq(n,o)||Zq(n,{[n]:vR(n,o,s.style),[u]:vR(u,o,s.style)})||Zq(n,s[r])||Zq(n,s.mark)||{[c]:Gq({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}(t,i,a);return{...Hq(e,t,{defaultPos:n,vgChannel:l[s]?Jq(e,r,o):qz(e)}),...l}}function Zq(e,t){const n=Wz(e),i=qz(e);if(void 0!==t[i])return{[i]:aL(e,t[i])};if(void 0!==t[e])return{[i]:aL(e,t[e])};if(t[n]){const i=t[n];if(!GP(i))return{[n]:aL(e,i)};nT(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function eU(e,t){const{config:n,encoding:i,markDef:r}=e,o=r.type,s=Uz(t),l=Wz(t),u=i[t],c=i[s],f=e.getScaleComponent(t),d=f?f.get("type"):void 0,h=r.orient,p=i[l]??i.size??gR("size",r,n,{vgChannel:l}),m=Hz(t),g="bar"===o&&("x"===t?"vertical"===h:"horizontal"===h)||"tick"===o&&("y"===t?"vertical"===h:"horizontal"===h);return!RL(u)||!(VN(u.bin)||XN(u.bin)||u.timeUnit&&!c)||p&&!GP(p)||i[m]||sP(d)?(IL(u)&&sP(d)||g)&&!c?function(e,t,n){var i,r;const{markDef:o,encoding:s,config:l,stack:u}=n,c=o.orient,f=n.scaleName(t),d=n.getScaleComponent(t),h=Wz(t),p=Uz(t),m=Hz(t),g=n.scaleName(m),y=n.getScaleComponent(Gz(t)),v="tick"===o.type||"horizontal"===c&&"y"===t||"vertical"===c&&"x"===t;let b;(s.size||o.size)&&(v?b=Iq("size",n,{vgChannel:h,defaultRef:fR(o.size)}):nT(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(o.type)));const x=!!b,w=FL({channel:t,fieldDef:e,markDef:o,config:l,scaleType:null==(i=d||y)?void 0:i.get("type"),useVlSizeChannel:v});b=b||{[h]:tU(h,g||f,y||d,l,w,!!e,o.type)};const _="band"===(null==(r=d||y)?void 0:r.get("type"))&&GP(w)&&!x?"top":"middle",k=Jq(t,o,l,_),E="xc"===k||"yc"===k,{offset:$,offsetType:A}=Wq({channel:t,markDef:o,encoding:s,model:n,bandPosition:E?.5:0}),D=nL({channel:t,channelDef:e,markDef:o,config:l,scaleName:f,scale:d,stack:u,offset:$,defaultRef:Gq({model:n,defaultPos:"mid",channel:t,scaleName:f,scale:d}),bandPosition:E?"encoding"===A?0:.5:nR(w)?{signal:`(1-${w})/2`}:GP(w)?(1-w.band)/2:0});if(h)return{[k]:D,...b};{const e=qz(p),t=b[h],n=$?{...t,offset:$}:t;return{[k]:D,[e]:a(D)?[D[0],{...D[1],offset:n}]:{...D,offset:n}}}}(u,t,e):Kq(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:e,fieldDef2:t,channel:n,model:i}){var r;const{config:o,markDef:a,encoding:s}=i,l=i.getScaleComponent(n),u=i.scaleName(n),c=l?l.get("type"):void 0,f=l.get("reverse"),d=FL({channel:n,fieldDef:e,markDef:a,config:o,scaleType:c}),h=null==(r=i.component.axes[n])?void 0:r[0],p=(null==h?void 0:h.get("translate"))??.5,m=hN(n)?gR("binSpacing",a,o)??0:0,g=Uz(n),y=qz(n),v=qz(g),b=yR("minBandSize",a,o),{offset:x}=Wq({channel:n,markDef:a,encoding:s,model:i,bandPosition:0}),{offset:w}=Wq({channel:g,markDef:a,encoding:s,model:i,bandPosition:0}),_=function({scaleName:e,fieldDef:t}){const n=YL(t,{expr:"datum"});return`abs(scale("${e}", ${YL(t,{expr:"datum",suffix:"end"})}) - scale("${e}", ${n}))`}({fieldDef:e,scaleName:u}),k=nU(n,m,f,p,x,b,_),E=nU(g,m,f,p,w??x,b,_),$=nR(d)?{signal:`(1-${d.signal})/2`}:GP(d)?(1-d.band)/2:.5,A=SL({fieldDef:e,fieldDef2:t,markDef:a,config:o});if(VN(e.bin)||e.timeUnit){const t=e.timeUnit&&.5!==A;return{[v]:iU({fieldDef:e,scaleName:u,bandPosition:$,offset:E,useRectOffsetField:t}),[y]:iU({fieldDef:e,scaleName:u,bandPosition:nR($)?{signal:`1-${$.signal}`}:1-$,offset:k,useRectOffsetField:t})}}if(XN(e.bin)){const n=iL(e,u,{},{offset:E});if(RL(t))return{[v]:n,[y]:iL(t,u,{},{offset:k})};if(YN(e.bin)&&e.bin.step)return{[v]:n,[y]:{signal:`scale("${u}", ${YL(e,{expr:"datum"})} + ${e.bin.step})`,offset:k}}}return void nT(ZR(g))}({fieldDef:u,fieldDef2:c,channel:t,model:e})}function tU(e,t,n,i,r,o,a){if(GP(r)){if(!n)return{mult:r.band,field:{group:e}};{const e=n.get("type");if("band"===e){let e=`bandwidth('${t}')`;1!==r.band&&(e=`${r.band} * ${e}`);const n=yR("minBandSize",{type:a},i);return{signal:n?`max(${hR(n)}, ${e})`:e}}1!==r.band&&(nT(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),r=void 0)}}else{if(nR(r))return r;if(r)return{value:r}}if(n){const e=n.get("range");if(iR(e)&&ie(e.step))return{value:e.step-2}}if(!o){const{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:r,tickBandPaddingInner:o}=i.scale,s=$O(t,"tick"===a?o:"bar"===a?n:r);if(nR(s))return{signal:`(1 - (${s.signal})) * ${e}`};if(ie(s))return{signal:`${1-s} * ${e}`}}return{value:Ej(i.view,e)-2}}function nU(e,t,n,i,r,o,a){if(bz(e))return 0;const s="x"===e||"y2"===e,l=s?-t/2:t/2;if(nR(n)||nR(r)||nR(i)||o){const e=hR(n),t=hR(r),u=hR(i),c=hR(o),f=o?`(${a} < ${c} ? ${s?"":"-"}0.5 * (${c} - (${a})) : ${l})`:l;return{signal:(u?`${u} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${f})`:f)}}return r=r||0,i+(n?-r-l:+r+l)}function iU({fieldDef:e,scaleName:t,bandPosition:n,offset:i,useRectOffsetField:r}){return rL({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i,...r?{startSuffix:mq,endSuffix:gq}:{}})}const rU=new Set(["aria","width","height"]);function oU(e,t){const{fill:n,stroke:i}="include"===t.color?qq(e):{};return{...sU(e.markDef,t),...aU("fill",n),...aU("stroke",i),...Iq("opacity",e),...Iq("fillOpacity",e),...Iq("strokeOpacity",e),...Iq("strokeWidth",e),...Iq("strokeDash",e),...Uq(e),...Rq(e),...zq(e,"href"),...Lq(e)}}function aU(e,t){return t?{[e]:t}:{}}function sU(e,t){return oR.reduce(((n,i)=>(!rU.has(i)&&RO(e,i)&&"ignore"!==t[i]&&(n[i]=fR(e[i])),n)),{})}function lU(e){const{config:t,markDef:n}=e,i=new Set;if(e.forEachFieldDef(((r,o)=>{var a;let s;if(!MN(o)||!(s=e.getScaleType(o)))return;const l=UN(r.aggregate),u=KP({scaleChannel:o,markDef:n,config:t,scaleType:s,isCountAggregate:l});if("break-paths-filter-domains"===(c=u)||"break-paths-show-domains"===c){const t=e.vgField(o,{expr:"datum",binSuffix:(null==(a=e.stack)?void 0:a.impute)?"mid":void 0});t&&i.add(t)}var c})),i.size>0){return{defined:{signal:[...i].map((e=>RT(e,!0))).join(" && ")}}}}function uU(e,t){if(void 0!==t)return{[e]:fR(t)}}const cU="voronoi",fU={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(cU)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(PP(o))return nT(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName(cU),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...Rq(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let s=0,l=!1;return n.forEach(((t,n)=>{const i=t.name??"";i===e.component.mark[0].name?s=n:i.includes(cU)&&(l=!0)})),l||n.splice(s+1,0,a),n}},dU={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!dj(e.bind),parse:(e,t,n)=>OU(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,a=t.init&&t.init[0],s=fU.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach(((e,r)=>{const l=pO(`${i}_${e.field}`);n.filter((e=>e.name===l)).length||n.unshift({name:l,...a?{init:oq(a[r])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${he(e.field)}] : null`}]:[],bind:o[e.field]??o[e.channel]??o})})),n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+AU)),a=i+xq,s=r.items.map((e=>pO(`${i}_${e.field}`))),l=s.map((e=>`${e} !== null`)).join(" && ");return s.length&&(o.update=`${l} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},hU="_toggle",pU={defined:e=>"point"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+hU,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+AU,i=t.name+hU;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${CU(e)}}, `)+`${i} ? ${n} : null`}},mU={defined:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t)=>{t.clear&&(t.clear=oe(t.clear)?RD(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(dU.defined(t))for(const i of t.project.items){const e=n.findIndex((e=>e.name===pO(`${t.name}_${i.field}`)));-1!==e&&n[e].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(e,i){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:i})}if("interval"===t.type)for(const r of t.project.items){const e=n.findIndex((e=>e.name===r.signals.visual));if(i(e,"[0, 0]"),-1===e){i(n.findIndex((e=>e.name===r.signals.data)),"null")}}else{let e=n.findIndex((e=>e.name===t.name+AU));i(e,"null"),pU.defined(t)&&(e=n.findIndex((e=>e.name===t.name+hU)),i(e,"false"))}return n}},gU={defined:e=>{const t="global"===e.resolve&&e.bind&&dj(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==cj;return t&&!n&&nT("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n)=>{const i=VM(n);if(i.select=oe(i.select)?{type:i.select,toggle:t.toggle}:{...i.select,toggle:t.toggle},OU(t,i),re(n.select)&&(n.select.on||n.select.clear)){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=r(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}const o=hj(t.bind)?t.bind.legend:"click",a=oe(o)?RD(o,"view"):r(o);t.bind={legend:{merge:a}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=hj(t.bind)&&t.bind.legend,o=e=>t=>{const n=VM(t);return n.markname=e,n};for(const a of t.project.items){if(!a.hasLegend)continue;const e=`${pO(a.field)}_legend`,s=`${i}_${e}`;if(0===n.filter((e=>e.name===s)).length){const i=r.merge.map(o(`${e}_symbols`)).concat(r.merge.map(o(`${e}_labels`))).concat(r.merge.map(o(`${e}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:i,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+AU)),a=i+xq,s=r.items.filter((e=>e.hasLegend)).map((e=>pO(`${i}_${pO(e.field)}_legend`))),l=`${s.map((e=>`${e} !== null`)).join(" && ")} ? {fields: ${a}, values: [${s.join(", ")}]} : null`;t.events&&s.length>0?o.on.push({events:s.map((e=>({signal:e}))),update:l}):s.length>0&&(o.update=l,delete o.value,delete o.on);const u=n.find((e=>e.name===i+hU)),c=hj(t.bind)&&t.bind.legend;return u&&(t.events?u.on.push({...u.on[0],events:c}):u.on[0].events=c),n}};const yU="_translate_anchor",vU="_translate_delta",bU={defined:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=kq.defined(t),o=i+yU,{x:a,y:s}=t.project.hasChannel;let l=RD(t.translate,"scope");return r||(l=l.map((e=>(e.between[0].markname=i+Aq,e)))),n.push({name:o,value:{},on:[{events:l.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==a?`, extent_x: ${r?Eq(e,BO):`slice(${a.signals.visual})`}`:"")+(void 0!==s?`, extent_y: ${r?Eq(e,jO):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:i+vU,value:{},on:[{events:l,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&xU(e,t,a,"width",n),void 0!==s&&xU(e,t,s,"height",n),n}};function xU(e,t,n,i,r){const o=t.name,a=o+yU,s=o+vU,l=n.channel,u=kq.defined(t),c=r.find((e=>e.name===n.signals[u?"data":"visual"])),f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(l),h=d&&d.get("type"),p=d&&d.get("reverse"),m=`${a}.extent_${l}`,g=`${u&&d?"log"===h?"panLog":"symlog"===h?"panSymlog":"pow"===h?"panPow":"panLinear":"panLinear"}(${m}, ${`${u?l===BO?p?"":"-":p?"-":"":""}${s}.${l} / ${u?`${f}`:`span(${m})`}`}${u?"pow"===h?`, ${d.get("exponent")??1}`:"symlog"===h?`, ${d.get("constant")??1}`:"":""})`;c.on.push({events:{signal:s},update:u?g:`clampRange(${g}, 0, ${f})`})}const wU="_zoom_anchor",_U="_zoom_delta",kU={defined:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=kq.defined(t),o=i+_U,{x:a,y:s}=t.project.hasChannel,l=he(e.scaleName(BO)),u=he(e.scaleName(jO));let c=RD(t.zoom,"scope");return r||(c=c.map((e=>(e.markname=i+Aq,e)))),n.push({name:i+wU,on:[{events:c,update:r?"{"+[l?`x: invert(${l}, x(unit))`:"",u?`y: invert(${u}, y(unit))`:""].filter((e=>e)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==a&&EU(e,t,a,"width",n),void 0!==s&&EU(e,t,s,"height",n),n}};function EU(e,t,n,i,r){const o=t.name,a=n.channel,s=kq.defined(t),l=r.find((e=>e.name===n.signals[s?"data":"visual"])),u=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(a),f=c&&c.get("type"),d=s?Eq(e,a):l.name,h=o+_U,p=`${s&&c?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${`${o}${wU}.${a}`}, ${h}${s?"pow"===f?`, ${c.get("exponent")??1}`:"symlog"===f?`, ${c.get("constant")??1}`:"":""})`;l.on.push({events:{signal:h},update:s?p:`clampRange(${p}, 0, ${u})`})}const $U="_store",AU="_tuple",DU="_modify",SU="vlSelectionResolve",FU=[Mq,Cq,_q,pU,dU,kq,gU,mU,bU,kU,fU];function CU(e,{escape:t}={escape:!0}){let n=t?he(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!hG(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of Dz)e[t]&&(n+=` + '__facet_${t}_' + (facet[${he(i.vgField(t))}])`)}return n}function MU(e){return fO(e.component.selection??{}).reduce(((e,t)=>e||t.project.hasSelectionId),!1)}function OU(e,t){!oe(t.select)&&t.select.on||delete e.events,!oe(t.select)&&t.select.clear||delete e.clear,!oe(t.select)&&t.select.toggle||delete e.toggle}function zU(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...zU(e.object)),t.push(...zU(e.property))),t)}function NU(e){return"MemberExpression"===e.object.type?NU(e.object):"datum"===e.object.name}function RU(e){const t=w$(e),n=new Set;return t.visit((e=>{"MemberExpression"===e.type&&NU(e)&&n.add(zU(e).slice(1).join("."))})),n}class TU extends cq{clone(){return new TU(null,this.model,VM(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=BU(this.model,this.filter,this),this._dependentFields=RU(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function PU(e,t,n,i="datum"){const r=oe(t)?t:t.param,o=pO(r),a=he(o+$U);let s;try{s=e.getSelectionComponent(o,r)}catch(c){return`!!${o}`}if(s.project.timeUnit){const t=n??e.component.data.raw,i=s.project.timeUnit.clone();t.parent?i.insertAsParentOf(t):t.parent=i}const l=`${s.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${a}, ${i}${"global"===s.resolve?")":`, ${he(s.resolve)})`}`,u=`length(data(${a}))`;return!1===t.empty?`${u} && ${l}`:`!${u} || ${l}`}function LU(e,t,n){const i=pO(t),r=n.encoding;let o,a=n.field;try{o=e.getSelectionComponent(i,t)}catch(s){return i}if(r||a){if(r&&!a){const e=o.project.items.filter((e=>e.channel===r));!e.length||e.length>1?(a=o.project.items[0].field,nT((e.length?"Multiple ":"No ")+`matching ${he(r)} encoding found for selection ${he(n.param)}. Using "field": ${he(a)}.`)):a=e[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&nT(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${he(a)}.`);return`${o.name}[${he(wO(a))}]`}function BU(e,t,n){return mO(t,(t=>oe(t)?t:function(e){return RO(e,"param")}(t)?PU(e,t,n):NT(t)))}function jU(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update[n]=i}function IU(e,t,n,i={header:!1}){var o,s;const{disable:l,orient:u,scale:c,labelExpr:f,title:d,zindex:h,...p}=e.combine();if(!l){for(const e in p){const n=e,i=vB[n],o=p[n];if(i&&i!==t&&"both"!==i)delete p[n];else if(gB(o)){const{condition:e,...t}=o,i=r(e),a=mB[n];if(a){const{vgProp:e,part:r}=a;jU(p,r,e,[...i.map((e=>{const{test:t,...n}=e;return{test:BU(null,t),...n}})),t]),delete p[n]}else if(null===a){const e={signal:i.map((e=>{const{test:t,...n}=e;return`${BU(null,t)} ? ${dR(n)} : `})).join("")+dR(t)};p[n]=e}}else if(nR(o)){const e=mB[n];if(e){const{vgProp:t,part:i}=e;jU(p,i,t,o),delete p[n]}}ZM(["labelAlign","labelBaseline"],n)&&null===p[n]&&delete p[n]}if("grid"===t){if(!p.grid)return;if(p.encode){const{grid:e}=p.encode;p.encode={...e?{grid:e}:{}},uO(p.encode)&&delete p.encode}return{scale:c,orient:u,...p,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:$O(h,0)}}{if(!i.header&&e.mainExtracted)return;if(void 0!==f){let e=f;(null==(s=null==(o=p.encode)?void 0:o.labels)?void 0:s.update)&&nR(p.encode.labels.update.text)&&(e=_O(f,"datum.label",p.encode.labels.update.text.signal)),jU(p,"labels","text",{signal:e})}if(null===p.labelAlign&&delete p.labelAlign,p.encode){for(const t of yB)e.hasAxisPart(t)||delete p.encode[t];uO(p.encode)&&delete p.encode}const t=function(e,t){if(e)return a(e)&&!tR(e)?e.map((e=>nB(e,t))).join(", "):e}(d,n);return{scale:c,orient:u,grid:!1,...t?{title:t}:{},...p,...!1===n.aria?{aria:!1}:{},zindex:$O(h,0)}}}}function qU(e){const{axes:t}=e.component,n=[];for(const i of dN)if(t[i])for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const t="x"===i?"height":"width",r=e.getSizeSignalRef(t).signal;t!==r&&n.push({name:t,update:r})}return n}function UU(e,t,n,i){return Object.assign.apply(null,[{},...e.map((e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",r=t["x"===n?"axisBottom":"axisLeft"]||{},o=t["x"===n?"axisTop":"axisRight"]||{},a=new Set([...cO(r),...cO(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${hR(r[t])} : ${hR(o[t])}`};return s}return t[e]}))])}function WU(e,t){var n;const i=[{}];for(const o of e){let e=null==(n=t[o])?void 0:n.style;if(e){e=r(e);for(const n of e)i.push(t.style[n])}}return Object.assign.apply(null,i)}function HU(e,t,n,i={}){var r;const o=bR(e,n,t);if(void 0!==o)return{configFrom:"style",configValue:o};for(const a of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==(null==(r=i[a])?void 0:r[e]))return{configFrom:a,configValue:i[a][e]};return{}}const GU={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??function(e,t){return!sP(e)&&RL(t)&&!VN(null==t?void 0:t.bin)&&!XN(null==t?void 0:t.bin)}(n,e),gridScale:({model:e,channel:t})=>function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n);return}(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||YU(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||XU(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??function(e,t){if("x"===t&&ZM(["quantitative","temporal"],e))return!0;return}(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??function(e,t,n,i){if(n&&!re(i)||"nominal"!==e&&"ordinal"!==e)return"log"!==t&&"symlog"!==t||"greedy";return}(t.type,n,RL(t)&&!!t.timeUnit,RL(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{const o="x"===e?"width":"y"===e?"height":void 0,a=o?t.getSizeSignalRef(o):void 0;return n.tickCount??function({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){var r;if(!i&&!sP(t)&&"log"!==t){if(RL(e)){if(VN(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&ZM(["month","hours","day","quarter"],null==(r=wT(e.timeUnit))?void 0:r.unit))return}return{signal:`ceil(${n.signal}/40)`}}return}({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},tickMinStep:function({format:e,fieldOrDatumDef:t}){if("d"===e)return 1;if(RL(t)){const{timeUnit:e}=t;if(e){const t=_T(e);if(t)return{signal:t}}}return},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=JU(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",a=t.fieldDef(o);return wR(r?[AL(r)]:[],RL(a)?[AL(a)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;if(a(n))return hB(t,n);if(nR(n))return n;return}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??function(e,t){if("rect"===e&&JL(t))return 1;return 0}(n,t)};function VU(e){return`(((${e.signal} % 360) + 360) % 360)`}function XU(e,t,n,i){if(void 0!==e){if("x"===n){if(nR(e)){const n=VU(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${nR(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45<e&&e<135||225<e&&e<315)return"middle";if(nR(t)){const n=e<=45||315<=e?"===":"!==";return{signal:`${t.signal} ${n} "top" ? "bottom" : "top"`}}return(e<=45||315<=e)==("top"===t)?"bottom":"top"}if(nR(e)){const n=VU(e);return{signal:`${n} <= 45 || 315 <= ${n} || (135 <= ${n} && ${n} <= 225) ? ${i?'"middle"':"null"} : (45 <= ${n} && ${n} <= 135) === ${nR(t)?`(${t.signal} === "left")`:"left"===t} ? "top" : "bottom"`}}if(e<=45||315<=e||135<=e&&e<=225)return i?"middle":null;if(nR(t)){const n=45<=e&&e<=135?"===":"!==";return{signal:`${t.signal} ${n} "left" ? "top" : "bottom"`}}return(45<=e&&e<=135)==("left"===t)?"top":"bottom"}}function YU(e,t,n){if(void 0===e)return;const i="x"===n,r=i?0:90,o=i?"bottom":"left";if(nR(e)){const n=VU(e);return{signal:`(${r?`(${n} + 90)`:n} % 180 === 0) ? ${i?null:'"center"'} :(${r} < ${n} && ${n} < ${180+r}) === ${nR(t)?`(${t.signal} === "${o}")`:t===o} ? "left" : "right"`}}if((e+r)%180==0)return i?null:"center";if(nR(t)){const n=r<e&&e<180+r?"===":"!==";return{signal:`${`${t.signal} ${n} "${o}"`} ? "left" : "right"`}}return(r<e&&e<180+r)==(t===o)?"left":"right"}function JU(e,t){const n="x"===t?"x2":"y2",i=e.fieldDef(t),r=e.fieldDef(n),o=i?i.title:void 0,a=r?r.title:void 0;return o&&a?_R(o,a):o||(a||(void 0!==o?o:void 0!==a?a:void 0))}class QU extends cq{clone(){return new QU(null,VM(this.transform))}constructor(e,t){super(e),this.transform=t,this._dependentFields=RU(this.transform.calculate)}static parseAllForSortIndex(e,t){return t.forEachFieldDef(((t,n)=>{if(WL(t)&&_L(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>`${NT({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+o.length;e=new QU(e,{calculate:a,as:KU(t,n,{forAs:!0})})}})),e}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${QM(this.transform)}`}}function KU(e,t,n){return YL(e,{prefix:t,suffix:"sort_index",...n})}function ZU(e,t){return ZM(["top","bottom"],t)?"column":ZM(["left","right"],t)||"row"===e?"row":"column"}function eW(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return $O((t||{})[e],r[e],n.header[e])}function tW(e,t,n,i){const r={};for(const o of e){const e=eW(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const nW=["row","column"],iW=["header","footer"];function rW(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:s}=tW(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),l=ZU(t,s),u=CO(a);return{name:`${t}-title`,type:"group",role:`${l}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...aW(u,l),...oW(l,u,o),...hW(i,r,t,aj,rj)}}}function oW(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=YU(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function aW(e,t){const n=XU(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function sW(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of iW)if(n[r])for(const o of n[r]){const a=cW(e,t,r,n,o);null!=a&&i.push(a)}return i}function lW(e,t){const{sort:n}=e;return wL(n)?{field:YL(n,{expr:"datum"}),order:n.order??"ascending"}:a(n)?{field:KU(e,t,{expr:"datum"}),order:"ascending"}:{field:YL(e,{expr:"datum"}),order:n??"ascending"}}function uW(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:l}=tW(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),u=uL({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=ZU(t,s);return{text:{signal:l?_O(_O(l,"datum.label",u),"datum.value",YL(e,{expr:"parent"})):u},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...aW(o,c),...oW(c,o,a),...hW(n,e,t,sj,oj)}}function cW(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:a}=i,s=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:e}=tW(["labelOrient"],a.header,s,t);("row"===t&&!ZM(["top","bottom"],e)||"column"===t&&!ZM(["left","right"],e))&&(o=uW(a,t,s))}const l=hG(e)&&!kL(e.facet),u=r.axes,c=(null==u?void 0:u.length)>0;if(o||c){const s="row"===t?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:lW(a,t)}:{},...c&&l?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...c?{axes:u}:{}}}}return null}const fW={column:{start:0,end:1},row:{start:1,end:0}};function dW(e,t){return fW[t][e]}function hW(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=eW(a,null==t?void 0:t.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function pW(e){return[...mW(e,"width"),...mW(e,"height"),...mW(e,"childWidth"),...mW(e,"childHeight")]}function mW(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const r=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),o=t.get("range");if(sP(i)&&iR(o)){const i=e.scaleName(n);if(hG(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[gW(i,o)]}return[gW(i,o),{name:r,update:yW(i,t,`domain('${i}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=r.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=`isFinite(${n}) ? ${n} : ${kj(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function gW(e,t){const n=`${e}_step`;return nR(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function yW(e,t,n){const i=t.get("type"),r=t.get("padding"),o=$O(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${hR(a)}, ${hR(o)}) * ${e}_step`}function vW(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function bW(e,t){return cO(e).reduce(((n,i)=>({...n,...Oq({model:t,channelDef:e[i],vgChannel:i,mainRefFn:e=>fR(e.value),invalidValueRef:void 0})})),{})}function xW(e,t){if(hG(t))return"theta"===e?"independent":"shared";if(mG(t))return"shared";if(pG(t))return hN(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function wW(e,t){const n=e.scale[t],i=hN(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&nT(function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}(t)),"independent"):e[i][t]||"shared"}const _W=cO({aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1});class kW extends II{}const EW={symbols:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:o}){if("symbol"!==o)return;const{markDef:s,encoding:l,config:u,mark:c}=n,f=s.filled&&"trail"!==c;let d={...pR({},n,IP),...qq(n,{filled:f})};const h=r.get("symbolOpacity")??u.legend.symbolOpacity,p=r.get("symbolFillColor")??u.legend.symbolFillColor,m=r.get("symbolStrokeColor")??u.legend.symbolStrokeColor,g=void 0===h?$W(l.opacity)??s.opacity:void 0;if(d.fill)if("fill"===i||f&&i===ZO)delete d.fill;else if(RO(d.fill,"field"))p?delete d.fill:(d.fill=fR(u.legend.symbolBaseFillColor??"black"),d.fillOpacity=fR(g??1));else if(a(d.fill)){const e=AW(l.fill??l.color)??s.fill??(f&&s.color);e&&(d.fill=fR(e))}if(d.stroke)if("stroke"===i||!f&&i===ZO)delete d.stroke;else if(RO(d.stroke,"field")||m)delete d.stroke;else if(a(d.stroke)){const e=$O(AW(l.stroke||l.color),s.stroke,f?s.color:void 0);e&&(d.stroke={value:e})}if(i!==oz){const e=RL(t)&&SW(n,r,t);e?d.opacity=[{test:e,...fR(g??1)},fR(u.legend.unselectedOpacity)]:g&&(d.opacity=fR(g))}return d={...d,...e},uO(d)?void 0:d},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){if("gradient"!==n)return;const{config:r,markDef:o,encoding:a}=t;let s={};const l=void 0===(i.get("gradientOpacity")??r.legend.gradientOpacity)?$W(a.opacity)||o.opacity:void 0;l&&(s.opacity=fR(l));return s={...s,...e},uO(s)?void 0:s},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},a=n.config,s=RL(t)?SW(n,r,t):void 0,l=s?[{test:s,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:u,formatType:c}=o;let f;sL(c)?f=fL({fieldOrDatumDef:t,field:"datum.value",format:u,formatType:c,config:a}):void 0===u&&void 0===c&&a.customFormatTypes&&("quantitative"===t.type&&a.numberFormatType?f=fL({fieldOrDatumDef:t,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===t.type&&a.timeFormatType&&RL(t)&&void 0===t.timeUnit&&(f=fL({fieldOrDatumDef:t,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...l?{opacity:l}:{},...f?{text:f}:{},...e};return uO(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return(null==n?void 0:n.length)?{...e,fill:{value:"transparent"}}:e}};function $W(e){return DW(e,((e,t)=>Math.max(e,t.value)))}function AW(e){return DW(e,((e,t)=>$O(e,t.value)))}function DW(e,t){return function(e){const t=null==e?void 0:e.condition;return!!t&&(a(t)||UL(t))}(e)?r(e.condition).reduce(t,e.value):UL(e)?e.value:void 0}function SW(e,t,n){const i=t.get("selections");if(!(null==i?void 0:i.length))return;const r=he(n.field);return i.map((e=>`(!length(data(${he(pO(e)+$U)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`)).join(" || ")}const FW={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return dL(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return hL(i,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??function({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:s,gradientVerticalMinLength:l}=e;if(uP(r))return"horizontal"===n?"top"===i||"bottom"===i?MW(t,"width",a,o):a:MW(t,"height",l,s);return}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??function(e){if(ZM(["quantile","threshold","log","symlog"],e))return"greedy";return}(n),symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>e.symbolType??function(e,t,n,i){if("shape"!==t){const e=AW(n)??i;if(e)return e}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(t.type,n,i.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>eB(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if($z(n)&&uP(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:t})=>function(e,t){const n=e.values;if(a(n))return hB(t,n);if(nR(n))return n;return}(t,e)};function CW(e){const{legend:t}=e;return $O(t.type,function({channel:e,timeUnit:t,scaleType:n}){if($z(e)){if(ZM(["quarter","month","day"],t))return"symbol";if(uP(n))return"gradient"}return"symbol"}(e))}function MW(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function OW(e){const t=dG(e)?function(e){const{encoding:t}=e,n={};for(const i of[ZO,...uj]){const r=oB(t[i]);r&&e.getScaleComponent(i)&&(i===nz&&RL(r)&&r.type===qT||(n[i]=NW(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){OW(i);for(const r of cO(i.component.legends))n.legend[r]=wW(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=RW(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of cO(t))for(const t of e.children)t.component.legends[i]&&"shared"===n.legend[i]&&delete t.component.legends[i];return t}(e);return e.component.legends=t,t}function zW(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!(null==n?void 0:n.values);case"title":if("title"===t&&e===(null==i?void 0:i.title))return!0}return e===(n||{})[t]}function NW(e,t){var n;let i=e.legend(t);const{markDef:r,encoding:o,config:a}=e,s=a.legend,l=new kW({},function(e,t){const n=e.scaleName(t);if("trail"===e.mark){if("color"===t)return{stroke:n};if("size"===t)return{strokeWidth:n}}return"color"===t?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}(e,t));!function(e,t,n){var i;const r=null==(i=e.fieldDef(t))?void 0:i.field;for(const o of fO(e.component.selection??{})){const e=o.project.hasField[r]??o.project.hasChannel[t];if(e&&gU.defined(o)){const t=n.get("selections")??[];t.push(o.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,l);const u=void 0!==i?!i:s.disable;if(l.set("disable",u,void 0!==i),u)return l;i=i||{};const c=e.getScaleComponent(t).get("type"),f=oB(o[t]),d=RL(f)?null==(n=wT(f.timeUnit))?void 0:n.unit:void 0,h=i.orient||a.legend.orient||"right",p=CW({legend:i,channel:t,timeUnit:d,scaleType:c}),m=function({legendConfig:e,legendType:t,orient:n,legend:i}){return i.direction??e[t?"gradientDirection":"symbolDirection"]??function(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===t?"horizontal":void 0}}(n,t)}({legend:i,legendType:p,orient:h,legendConfig:s}),g={legend:i,channel:t,model:e,markDef:r,encoding:o,fieldOrDatumDef:f,legendConfig:s,config:a,scaleType:c,orient:h,legendType:p,direction:m};for(const w of _W){if("gradient"===p&&w.startsWith("symbol")||"symbol"===p&&w.startsWith("gradient"))continue;const n=w in FW?FW[w](g):i[w];if(void 0!==n){const r=zW(n,w,i,e.fieldDef(t));(r||void 0===a.legend[w])&&l.set(w,n,r)}}const y=(null==i?void 0:i.encoding)??{},v=l.get("selections"),b={},x={fieldOrDatumDef:f,model:e,channel:t,legendCmpt:l,legendType:p};for(const w of["labels","legend","title","symbols","gradient","entries"]){const t=bW(y[w]??{},e),n=w in EW?EW[w](t,x):t;void 0===n||uO(n)||(b[w]={...(null==v?void 0:v.length)&&RL(f)?{name:`${pO(f.field)}_legend_${w}`}:{},...(null==v?void 0:v.length)?{interactive:!!v}:{},update:n})}return uO(b)||l.set("encode",b,!!(null==i?void 0:i.encoding)),l}function RW(e,t){var n,i,r,o;if(!e)return t.clone();const a=e.getWithExplicit("orient"),s=t.getWithExplicit("orient");if(a.explicit&&s.explicit&&a.value!==s.value)return;let l=!1;for(const u of _W){const n=GI(e.getWithExplicit(u),t.getWithExplicit(u),u,"legend",((e,t)=>{switch(u){case"symbolType":return TW(e,t);case"title":return kR(e,t);case"type":return l=!0,UI("symbol")}return HI(e,t,u,"legend")}));e.setWithExplicit(u,n)}return l&&((null==(i=null==(n=e.implicit)?void 0:n.encode)?void 0:i.gradient)&&gO(e.implicit,["encode","gradient"]),(null==(o=null==(r=e.explicit)?void 0:r.encode)?void 0:o.gradient)&&gO(e.explicit,["encode","gradient"])),e}function TW(e,t){return"circle"===t.value?t:e}function PW(e){const t=e.component.legends,n={};for(const i of cO(t)){const r=NO(e.getScaleComponent(i).get("domains"));if(n[r])for(const e of n[r]){RW(e,t[i])||n[r].push(t[i])}else n[r]=[t[i].clone()]}return fO(n).flat().map((t=>function(e,t){var n,i,r;const{disable:o,labelExpr:a,selections:s,...l}=e.combine();if(o)return;!1===t.aria&&null==l.aria&&(l.aria=!1);if(null==(n=l.encode)?void 0:n.symbols){const e=l.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||l.stroke||(e.stroke={value:"transparent"});for(const t of uj)l[t]&&delete e[t]}l.title||delete l.title;if(void 0!==a){let e=a;(null==(r=null==(i=l.encode)?void 0:i.labels)?void 0:r.update)&&nR(l.encode.labels.update.text)&&(e=_O(a,"datum.label",l.encode.labels.update.text.signal)),function(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update[n]=i}(l,"labels","text",{signal:e})}return l}(t,e.config))).filter((e=>void 0!==e))}function LW(e){return mG(e)||pG(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),BW(e))}(e):BW(e)}function BW(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map((e=>e.signal)).join(", ")}]`},o=t.data.reduce(((t,n)=>{const i=nR(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return ZM(t,i)||t.push(i),t}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const jW=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class IW extends II{constructor(e,t,n,i){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function qW(e){e.component.projection=dG(e)?function(e){if(e.hasProjection){const t=ZN(e.specifiedProjection),n=!(t&&(null!=t.scale||null!=t.translate)),i=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=n?function(e){const t=[],{encoding:n}=e;for(const i of[[JO,YO],[KO,QO]])(oB(n[i[0]])||oB(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField(nz)&&e.typedFieldDef(nz).type===qT&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(tq.Main));return t}(e):void 0,o=new IW(e.projectionName(!0),{...ZN(e.config.projection),...t},i,r);return o.get("type")||o.set("type","equalEarth",!1),o}return}(e):function(e){if(0===e.children.length)return;let t;for(const i of e.children)qW(i);const n=tO(e.children,(e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=tO(jW,(n=>!m(e.explicit,n)&&!m(t.explicit,n)||!!(m(e.explicit,n)&&m(t.explicit,n)&&zO(e.get(n),t.get(n)))));if(zO(e.size,t.size)){if(n)return e;if(zO(e.explicit,{}))return t;if(zO(t.explicit,{}))return e}return null}(t,n);return e&&(t=e),!!e}return t=n,!0}return!0}));if(t&&n){const n=e.projectionName(!0),i=new IW(n,t.specifiedProjection,t.size,VM(t.data));for(const t of e.children){const e=t.component.projection;e&&(e.isFit&&i.data.push(...t.component.projection.data),t.renameProjection(e.get("name"),n),e.merged=!0)}return i}return}(e)}function UW(e,t,n,i){if(pB(t,n)){const r=dG(e)?e.axis(n)??e.legend(n)??{}:{},o=YL(t,{expr:"datum"}),a=YL(t,{expr:"datum",binSuffix:"end"});return{formulaAs:YL(t,{binSuffix:"range",forAs:!0}),formula:yL(o,a,r.format,r.formatType,i)}}return{}}function WW(e,t){return`${GN(e)}_${t}`}function HW(e,t,n){const i=WW(uB(n,void 0)??{},t);return e.getName(`${i}_bins`)}function GW(e,t,n){let i,r;i=function(e){return"as"in e}(e)?oe(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[YL(e,{forAs:!0}),YL(e,{binSuffix:"end",forAs:!0})];const o={...uB(t,void 0)},a=WW(o,e.field),{signal:s,extentSignal:l}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,a);if(JN(o.extent)){const e=o.extent;r=LU(n,e.param,e),delete o.extent}return{key:a,binComponent:{bin:o,field:e.field,as:[i],...s?{signal:s}:{},...l?{extentSignal:l}:{},...r?{span:r}:{}}}}class VW extends cq{clone(){return new VW(null,VM(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(qL(n)&&VN(n.bin)){const{key:r,binComponent:o}=GW(n,n.bin,t);e[r]={...o,...e[r],...UW(t,n,i,t.config)}}return e}),{});return uO(n)?null:new VW(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=GW(t,t.bin,n);return new VW(e,{[i]:r})}merge(e,t){for(const n of cO(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=rO([...this.bins[n].as,...e.bins[n].as],QM)):this.bins[n]=e.bins[n];for(const n of e.children)e.removeChild(n),n.parent=this;e.remove()}producedFields(){return new Set(fO(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(fO(this.bins).map((e=>e.field)))}hash(){return`Bin ${QM(this.bins)}`}assemble(){return fO(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:wO(e.field),as:n,signal:e.signal,...JN(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:wO(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const s of i)for(let e=0;e<2;e++)t.push({type:"formula",expr:YL({field:n[e]},{expr:"datum"}),as:s[e]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}function XW(e,t,n,i){var r;const o=dG(i)?i.encoding[Uz(t)]:void 0;if(qL(n)&&dG(i)&&CL(n,o,i.markDef,i.config)){e.add(YL(n,{})),e.add(YL(n,{suffix:"end"}));const{mark:r,markDef:o,config:a}=i,s=SL({fieldDef:n,markDef:o,config:a});LP(r)&&.5!==s&&hN(t)&&(e.add(YL(n,{suffix:mq})),e.add(YL(n,{suffix:gq}))),n.bin&&pB(n,t)&&e.add(YL(n,{binSuffix:"range"}))}else if(_z(t)){const n=wz(t);e.add(i.getName(n))}else e.add(YL(n));var a;return WL(n)&&(a=null==(r=n.scale)?void 0:r.range,re(a)&&"field"in a)&&e.add(n.scale.range.field),e}class YW extends cq{clone(){return new YW(null,new Set(this.dimensions),VM(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef((e=>{e.aggregate&&(n=!0)}));const i={},r=new Set;return n?(t.forEachFieldDef(((e,n)=>{const{aggregate:o,field:a}=e;if(o)if("count"===o)i["*"]??(i["*"]={}),i["*"].count=new Set([YL(e,{forAs:!0})]);else{if(BN(o)||jN(o)){const e=BN(o)?"argmin":"argmax",t=o[e];i[t]??(i[t]={}),i[t][e]=new Set([YL({op:e,field:t},{forAs:!0})])}else i[a]??(i[a]={}),i[a][o]=new Set([YL(e,{forAs:!0})]);MN(n)&&"unaggregated"===t.scaleDomain(n)&&(i[a]??(i[a]={}),i[a].min=new Set([YL({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([YL({field:a,aggregate:"max"},{forAs:!0})]))}else XW(r,n,e,t)})),r.size+cO(i).length===0?null:new YW(e,r,i)):null}static makeFromTransform(e,t){var n;const i=new Set,r={};for(const o of t.aggregate){const{op:e,field:t,as:i}=o;e&&("count"===e?(r["*"]??(r["*"]={}),r["*"].count=new Set([i||YL(o,{forAs:!0})])):(r[t]??(r[t]={}),(n=r[t])[e]??(n[e]=new Set),r[t][e].add(i||YL(o,{forAs:!0}))))}for(const o of t.groupby??[])i.add(o);return i.size+cO(r).length===0?null:new YW(e,i,r)}merge(e){return oO(this.dimensions,e.dimensions)?(function(e,t){for(const n of cO(t)){const i=t[n];for(const t of cO(i))n in e?e[n][t]=new Set([...e[n][t]??[],...i[t]]):e[n]={[t]:i[t]}}}(this.measures,e.measures),!0):(function(...e){tT.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...cO(this.measures)])}producedFields(){const e=new Set;for(const t of cO(this.measures))for(const n of cO(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return`Aggregate ${QM({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of cO(this.measures))for(const r of cO(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:wO(i));return{type:"aggregate",groupby:[...this.dimensions].map(wO),ops:e,fields:t,as:n}}}class JW extends cq{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const r of Dz){const e=t.facet[r];if(e){const{bin:n,sort:i}=e;this[r]={name:t.getName(`${r}_domain`),fields:[YL(e),...VN(n)?[YL(e,{binSuffix:"end"})]:[]],...wL(i)?{sortField:i}:a(i)?{sortIndexField:KU(e,r)}:{}}}}this.childModel=t.child}hash(){let e="Facet";for(const t of Dz)this[t]&&(e+=` ${t.charAt(0)}:${QM(this[t])}`);return e}get fields(){var e;const t=[];for(const n of Dz)(null==(e=this[n])?void 0:e.fields)&&t.push(...this[n].fields);return t}dependentFields(){const e=new Set(this.fields);for(const t of Dz)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const e={};for(const t of dN){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(sP(i)&&iR(r)){const n=UH(WH(this.childModel,t));n?e[t]=n:nT(FR(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x",facet:void 0}[e],r=[],o=[],a=[];i&&n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),o.push("max")):(r.push(n[i]),o.push("distinct")),a.push(`distinct_${n[i]}`));const{sortField:s,sortIndexField:l}=this[e];if(s){const{op:e=vL,field:t}=s;r.push(t),o.push(e),a.push(YL(s,{forAs:!0}))}else l&&(r.push(l),o.push("max"),a.push(l));return{name:this[e].name,source:t??this.data,transform:[{type:"aggregate",groupby:this[e].fields,...r.length?{fields:r,ops:o,as:a}:{}}]}}assembleFacetHeaderData(e){var t;const{columns:n}=this.model.layout,{layoutHeaders:i}=this.model.component,r=[],o={};for(const l of nW){for(const e of iW){const n=(i[l]&&i[l][e])??[];for(const e of n)if((null==(t=e.axes)?void 0:t.length)>0){o[l]=!0;break}}if(o[l]){const e=`length(data("${this.facet.name}"))`,t="row"===l?n?{signal:`ceil(${e} / ${n})`}:1:n?{signal:`min(${e}, ${n})`}:{signal:e};r.push({name:`${this.facet.name}_${l}`,transform:[{type:"sequence",start:0,stop:t}]})}}const{row:a,column:s}=o;return(a||s)&&r.unshift(this.assembleRowColumnHeaderData("facet",null,e)),r}assemble(){const e=[];let t=null;const n=this.getChildIndependentFieldsWithStep(),{column:i,row:r,facet:o}=this;if(i&&r&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;const i=[].concat(n.x??[],n.y??[]),r=i.map((()=>"distinct"));e.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:i,ops:r}]})}for(const a of[PO,TO])this[a]&&e.push(this.assembleRowColumnHeaderData(a,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function QW(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function KW(e){const t={};return HM(e.filter,(e=>{if(OT(e)){let n=null;$T(e)?n=uR(e.equal):DT(e)?n=uR(e.lte):AT(e)?n=uR(e.lt):ST(e)?n=uR(e.gt):FT(e)?n=uR(e.gte):CT(e)?n=e.range[0]:MT(e)&&(n=(e.oneOf??e.in)[0]),n&&(iT(n)?t[e.field]="date":ie(n)?t[e.field]="number":oe(n)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}})),t}function ZW(e){const t={};function n(e){var n;fB(e)?t[e.field]="date":"quantitative"===e.type&&(n=e.aggregate,oe(n)&&ZM(["min","max"],n))?t[e.field]="number":EO(e.field)>1?e.field in t||(t[e.field]="flatten"):WL(e)&&wL(e.sort)&&EO(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((dG(e)||hG(e))&&e.forEachFieldDef(((t,i)=>{if(qL(t))n(t);else{const r=Iz(i),o=e.fieldDef(r);n({...t,type:o.type})}})),dG(e)){const{mark:n,markDef:i,encoding:r}=e;if(PP(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];RL(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}class eH extends cq{clone(){return new eH(null,VM(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${QM(this._parse)}`}static makeExplicit(e,t,n){var i;let r={};const o=t.data;return!QI(o)&&(null==(i=null==o?void 0:o.format)?void 0:i.parse)&&(r=o.format.parse),this.makeWithAncestors(e,r,{},n)}static makeWithAncestors(e,t,n,i){for(const a of cO(n)){const e=i.getWithExplicit(a);void 0!==e.value&&(e.explicit||e.value===n[a]||"derived"===e.value||"flatten"===n[a]?delete n[a]:nT(RR(a,n[a],e.value)))}for(const a of cO(t)){const e=i.get(a);void 0!==e&&(e===t[a]?delete t[a]:nT(RR(a,t[a],e)))}const r=new II(t,n);i.copyAll(r);const o={};for(const a of cO(r.combine())){const e=r.get(a);null!==e&&(o[a]=e)}return 0===cO(o).length||i.parseNothing?null:new eH(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of cO(this._parse)){const n=this._parse[t];1===EO(t)&&(e[t]=n)}return e}producedFields(){return new Set(cO(this._parse))}dependentFields(){return new Set(cO(this._parse))}assembleTransforms(e=!1){return cO(this._parse).filter((t=>!e||EO(t)>1)).map((e=>{const t=function(e,t){const n=vO(e);if("number"===t)return`toNumber(${n})`;if("boolean"===t)return`toBoolean(${n})`;if("string"===t)return`toString(${n})`;if("date"===t)return`toDate(${n})`;if("flatten"===t)return n;if(t.startsWith("date:"))return`timeParse(${n},'${QW(t.slice(5,t.length))}')`;if(t.startsWith("utc:"))return`utcParse(${n},'${QW(t.slice(4,t.length))}')`;return nT(`Unrecognized parse "${t}".`),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:kO(e)}})).filter((e=>null!==e))}}class tH extends cq{clone(){return new tH(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([cj])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:cj}}}class nH extends cq{clone(){return new nH(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${QM(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class iH extends cq{clone(){return new iH(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${QM(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class rH extends cq{constructor(e){let t;if(super(null),e??(e={name:"source"}),QI(e)||(t=e.format?{...JM(e.format,["parse"])}:{}),YI(e))this._data={values:e.values};else if(XI(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];ZM(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else ZI(e)?this._data={values:[{type:"Sphere"}]}:(JI(e)||QI(e))&&(this._data={});this._generator=QI(e),e.name&&(this._name=e.name),t&&!uO(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}var oH,aH=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n};function sH(e){return e instanceof rH||e instanceof nH||e instanceof iH}class lH{constructor(){oH.set(this,void 0),aH(this,oH,!1,"f")}setModified(){aH(this,oH,!0,"f")}get modifiedFlag(){return function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}(this,oH,"f")}}oH=new WeakMap;class uH extends lH{getNodeDepths(e,t,n){n.set(e,t);for(const i of e.children)this.getNodeDepths(i,t+1,n);return n}optimize(e){const t=[...this.getNodeDepths(e,0,new Map).entries()].sort(((e,t)=>t[1]-e[1]));for(const n of t)this.run(n[0]);return this.modifiedFlag}}class cH extends lH{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class fH extends cH{mergeNodes(e,t){const n=t.shift();for(const i of t)e.removeChild(i),i.parent=n,i.remove()}run(e){const t=e.children.map((e=>e.hash())),n={};for(let i=0;i<t.length;i++)void 0===n[t[i]]?n[t[i]]=[e.children[i]]:n[t[i]].push(e.children[i]);for(const i of cO(n))n[i].length>1&&(this.setModified(),this.mergeNodes(e,n[i]))}}class dH extends cH{constructor(e){super(),this.requiresSelectionId=e&&MU(e)}run(e){e instanceof tH&&(this.requiresSelectionId&&(sH(e.parent)||e.parent instanceof YW||e.parent instanceof eH)||(this.setModified(),e.remove()))}}class hH extends lH{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof pq&&(n=e.producedFields(),aO(n,t)&&(this.setModified(),e.removeFormulas(t),0===e.producedFields.length&&e.remove()));for(const i of e.children)this.run(i,new Set([...t,...n]))}}class pH extends cH{constructor(){super()}run(e){e instanceof fq&&!e.isRequired()&&(this.setModified(),e.remove())}}class mH extends uH{run(e){if(!(sH(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof eH)if(e instanceof eH)this.setModified(),e.merge(t);else{if(lO(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class gH extends uH{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof eH));if(e.numChildren()>1&&n.length>=1){const i={},r=new Set;for(const e of n){const t=e.parse;for(const e of cO(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!uO(i)){this.setModified();const n=new eH(e,i);for(const r of t){if(r instanceof eH)for(const e of cO(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof eH&&0===cO(r.parse).length&&r.remove()}}}}}class yH extends uH{run(e){e instanceof fq||e.numChildren()>0||e instanceof JW||e instanceof rH||(this.setModified(),e.remove())}}class vH extends uH{run(e){const t=e.children.filter((e=>e instanceof pq)),n=t.pop();for(const i of t)this.setModified(),n.merge(i)}}class bH extends uH{run(e){const t=e.children.filter((e=>e instanceof YW)),n={};for(const i of t){const e=QM(i.groupBy);e in n||(n[e]=[]),n[e].push(i)}for(const i of cO(n)){const t=n[i];if(t.length>1){const n=t.pop();for(const i of t)n.merge(i)&&(e.removeChild(i),i.parent=n,i.remove(),this.setModified())}}}}class xH extends uH{constructor(e){super(),this.model=e}run(e){const t=!(sH(e)||e instanceof TU||e instanceof eH||e instanceof tH),n=[],i=[];for(const r of e.children)r instanceof VW&&(t&&!lO(e.producedFields(),r.dependentFields())?n.push(r):i.push(r));if(n.length>0){const t=n.pop();for(const e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof VW?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(i.length>1){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}}class wH extends uH{run(e){const t=[...e.children];if(!eO(t,(e=>e instanceof fq))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof fq){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof fq))break;t=e}n.push(...t.children),i?(e.removeChild(r),r.parent=i.parent,i.parent.removeChild(i),i.parent=t,this.setModified()):i=t}else n.push(r);if(n.length){this.setModified();for(const e of n)e.parent.removeChild(e),e.parent=i}}}class _H extends cq{clone(){return new _H(null,VM(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=rO(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??YL(e)}hash(){return`JoinAggregateTransform ${QM(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const r of this.transform.joinaggregate)t.push(r.op),n.push(this.getDefaultName(r)),e.push(void 0===r.field?null:r.field);const i=this.transform.groupby;return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class kH extends cq{clone(){return new kH(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t,n){const{config:i,markDef:r}=t,{marks:o,scales:a}=n;if("include-invalid-values"===o&&"include-invalid-values"===a)return null;const s=t.reduceFieldDef(((e,n,o)=>{const a=MN(o)&&t.getScaleComponent(o);if(a){const t=a.get("type"),{aggregate:s}=n,l=KP({scaleChannel:o,markDef:r,config:i,scaleType:t,isCountAggregate:UN(s)});"show"!==l&&"always-valid"!==l&&(e[n.field]=n)}return e}),{});return cO(s).length?new kH(e,s):null}dependentFields(){return new Set(cO(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${QM(this.filter)}`}assemble(){const e=cO(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=YL(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (${EH(i)}))`):"quantitative"===n.type&&e.push(EH(i))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}function EH(e){return`isValid(${e}) && isFinite(+${e})`}class $H extends cq{clone(){return new $H(null,VM(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(e,t){const{stack:n,groupby:i,as:r,offset:o="zero"}=t,s=[],l=[];if(void 0!==t.sort)for(const a of t.sort)s.push(a.field),l.push($O(a.order,"ascending"));const u={field:s,order:l};let c;return c=function(e){return a(e)&&e.every((e=>oe(e)))&&e.length>1}(r)?r:oe(r)?[r,`${r}_end`]:[`${t.stack}_start`,`${t.stack}_end`],new $H(e,{dimensionFieldDefs:[],stackField:n,groupby:i,offset:o,sort:u,facetby:[],as:c})}static makeFromEncoding(e,t){const n=t.stack,{encoding:i}=t;if(!n)return null;const{groupbyChannels:r,fieldChannel:o,offset:s,impute:l}=n,u=r.map((e=>rB(i[e]))).filter((e=>!!e)),c=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=YL(t.fieldDef);return n&&e.push(n),e}),[])}(t),f=t.encoding.order;let d;if(a(f)||RL(f))d=xR(f);else{const e=ML(f)?f.sort:"y"===o?"descending":"ascending";d=c.reduce(((t,n)=>(t.field.includes(n)||(t.field.push(n),t.order.push(e)),t)),{field:[],order:[]})}return new $H(e,{dimensionFieldDefs:u,stackField:t.vgField(o),facetby:[],stackby:c,sort:d,offset:s,impute:l,as:[t.vgField(o,{suffix:"start",forAs:!0}),t.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){const e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${QM(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[YL(e,{binSuffix:"mid"})]:[YL(e,{}),YL(e,{binSuffix:"end"})]:[YL(e)])).flat():n??[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:r,sort:o,offset:a,impute:s,as:l}=this._stack;if(s)for(const u of n){const{bandPosition:n=.5,bin:o}=u;if(o){const t=YL(u,{expr:"datum"}),i=YL(u,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${EH(t)} ? ${n}*${t}+${1-n}*${i} : ${t}`,as:YL(u,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:YL(u,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:l,offset:a}),e}}class AH extends cq{clone(){return new AH(null,VM(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=rO(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach((t=>e.add(t.field))),this.transform.window.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??YL(e)}hash(){return`WindowTransform ${QM(this.transform)}`}assemble(){const e=[],t=[],n=[],i=[];for(const c of this.transform.window)t.push(c.op),n.push(this.getDefaultName(c)),i.push(void 0===c.param?null:c.param),e.push(void 0===c.field?null:c.field);const r=this.transform.frame,o=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every((e=>IN(e))))return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==o?{groupby:o}:{}};const a=[],s=[];if(void 0!==this.transform.sort)for(const c of this.transform.sort)a.push(c.field),s.push(c.order??"ascending");const l={field:a,order:s},u=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:l,...void 0!==u?{ignorePeers:u}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function DH(e){if(e instanceof JW)if(1!==e.numChildren()||e.children[0]instanceof fq){const n=e.model.component.data.main;SH(n);const i=(t=e,function e(n){if(!(n instanceof JW)){const i=n.clone();if(i instanceof fq){const e=FH+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof YW||i instanceof $H||i instanceof AH||i instanceof _H)&&i.addDimensions(t.fields);for(const t of n.children.flatMap(e))t.parent=i;return[i]}return n.children.flatMap(e)}),r=e.children.map(i).flat();for(const e of r)e.parent=n}else{const t=e.children[0];(t instanceof YW||t instanceof $H||t instanceof AH||t instanceof _H)&&t.addDimensions(e.fields),t.swapWithParent(),DH(e)}else e.children.map(DH);var t}function SH(e){if(e instanceof fq&&e.type===tq.Main&&1===e.numChildren()){const t=e.children[0];t instanceof JW||(t.swapWithParent(),SH(e))}}const FH="scale_";function CH(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!CH(t.children))return!1}return!0}function MH(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function OH(e,t,n){let i=e.sources,r=!1;return r=MH(new pH,i)||r,r=MH(new dH(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=MH(new yH,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=MH(new mH,i)||r,r=MH(new xH(t),i)||r,r=MH(new hH,i)||r,r=MH(new gH,i)||r,r=MH(new bH,i)||r,r=MH(new vH,i)||r,r=MH(new fH,i)||r,r=MH(new wH,i)||r),e.sources=i,r}class zH{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new zH((()=>e(t)))}}function NH(e){dG(e)?function(e){const t=e.component.scales;for(const n of cO(t)){const i=RH(e,n);if(t[n].setWithExplicit("domains",i),BH(e,n),e.component.data.isFaceted){let t=e;for(;!hG(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)rR(e)&&(e.data=FH+e.data.replace(FH,""))}}}(e):function(e){for(const n of e.children)NH(n);const t=e.component.scales;for(const n of cO(t)){let i,r=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):GI(i,e.getWithExplicit("domains"),"domains","scale",IH);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&nT(zR),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function RH(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=jH(t,n);if(!e)return void nT(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=jH(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:r}),"x"===t&&oB(i.x2)?oB(i.x)?GI(PH(n,r,e,"x"),PH(n,r,e,"x2"),"domain","scale",IH):PH(n,r,e,"x2"):"y"===t&&oB(i.y2)?oB(i.y)?GI(PH(n,r,e,"y"),PH(n,r,e,"y2"),"domain","scale",IH):PH(n,r,e,"y2"):PH(n,r,e,t)}function TH(e,t,n){var i;const r=null==(i=wT(n))?void 0:i.unit;return"temporal"===t||r?function(e,t,n){return e.map((e=>({signal:`{data: ${dB(e,{timeUnit:n,type:t})}}`})))}(e,t,r):[e]}function PH(e,t,n,i){const{encoding:r,markDef:o,mark:a,config:s,stack:l}=n,u=oB(r[i]),{type:c}=u,f=u.timeUnit,d=function(e){const{marks:t,scales:n}=iq(e);return t===n?tq.Main:"include-invalid-values"===n?tq.PreFilterInvalid:tq.PostFilterInvalid}({invalid:yR("invalid",o,s),isPath:PP(a)});if(function(e){return RO(e,"unionWith")}(t)){const r=PH(e,void 0,n,i);return qI([...TH(t.unionWith,c,f),...r.value])}if(nR(t))return qI([t]);if(t&&"unaggregated"!==t&&!fP(t))return qI(TH(t,c,f));if(l&&i===l.fieldChannel){if("normalize"===l.offset)return UI([[0,1]]);const e=n.requestDataName(d);return UI([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const h=MN(i)&&RL(u)?function(e,t,n){if(!sP(n))return;const i=e.fieldDef(t),r=i.sort;if(_L(r))return{op:"min",field:KU(i,t),order:"ascending"};const{stack:o}=e,a=o?new Set([...o.groupbyFields,...o.stackBy.map((e=>e.fieldDef.field))]):void 0;if(wL(r)){return LH(r,o&&!a.has(r.field))}if(function(e){return RO(e,"encoding")}(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:l}=i,u=o&&!a.has(l);if(BN(s)||jN(s))return LH({field:YL(i),order:n},u);if(IN(s)||!s)return LH({op:s,field:l,order:n},u)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(ZM(["ascending",void 0],r))return!0}return}(n,i,e):void 0;if(PL(u)){return UI(TH([u.datum],c,f))}const p=u;if("unaggregated"===t){const{field:e}=u;return UI([{data:n.requestDataName(d),field:YL({field:e,aggregate:"min"})},{data:n.requestDataName(d),field:YL({field:e,aggregate:"max"})}])}if(VN(p.bin)){if(sP(e))return UI("bin-ordinal"===e?[]:[{data:hO(h)?n.requestDataName(d):n.requestDataName(tq.Raw),field:n.vgField(i,pB(p,i)?{binSuffix:"range"}:{}),sort:!0!==h&&re(h)?h:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=p;if(VN(e)){const t=HW(n,p.field,e);return UI([new zH((()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return UI([{data:n.requestDataName(d),field:n.vgField(i,{})}])}}if(p.timeUnit&&ZM(["time","utc"],e)){const e=r[Uz(i)];if(CL(p,e,o,s)){const t=n.requestDataName(d),r=SL({fieldDef:p,fieldDef2:e,markDef:o,config:s}),l=LP(a)&&.5!==r&&hN(i);return UI([{data:t,field:n.vgField(i,l?{suffix:mq}:{})},{data:t,field:n.vgField(i,{suffix:l?gq:"end"})}])}}return UI(h?[{data:hO(h)?n.requestDataName(d):n.requestDataName(tq.Raw),field:n.vgField(i),sort:h}]:[{data:n.requestDataName(d),field:n.vgField(i)}])}function LH(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":vL),...i?{field:wO(i)}:{},...r?{order:r}:{}}}function BH(e,t){var n;const i=e.component.scales[t],r=e.specifiedScales[t].domain,o=null==(n=e.fieldDef(t))?void 0:n.bin,a=fP(r)?r:void 0,s=YN(o)&&JN(o.extent)?o.extent:void 0;(a||s)&&i.set("selectionExtent",a??s,!0)}function jH(e,t){const{aggregate:n,type:i}=e;return n?oe(n)&&!HN.has(n)?{valid:!1,reason:GR(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:VR(e)}:{valid:!0}:{valid:!1,reason:HR(e)}}function IH(e,t,n,i){return e.explicit&&t.explicit&&nT(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${NO(n)} and ${NO(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function qH(e){const t=rO(e.map((e=>{if(rR(e)){const{sort:t,...n}=e;return n}return e})),QM),n=rO(e.map((e=>{if(rR(e)){const t=e.sort;return void 0===t||hO(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),QM);if(0===t.length)return;if(1===t.length){const t=e[0];if(rR(t)&&n.length>0){let e=n[0];if(n.length>1){nT(JR);const t=n.filter((e=>re(e)&&"op"in e&&"min"!==e.op));e=!n.every((e=>re(e)&&"op"in e))||1!==t.length||t[0]}else if(re(e)&&"field"in e){const n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return{...t,sort:e}}return t}const i=rO(n.map((e=>hO(e)||!("op"in e)||oe(e.op)&&m(LN,e.op)?e:(nT(function(e){return`Dropping sort property ${NO(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),QM);let r;1===i.length?r=i[0]:i.length>1&&(nT(JR),r=!0);const o=rO(e.map((e=>rR(e)?e.data:null)),(e=>e));if(1===o.length&&null!==o[0]){return{data:o[0],fields:t.map((e=>e.field)),...r?{sort:r}:{}}}return{fields:t,...r?{sort:r}:{}}}function UH(e){if(rR(e)&&oe(e.field))return e.field;if(function(e){return!a(e)&&RO(e,"fields")&&!RO(e,"data")}(e)){let t;for(const n of e.fields)if(rR(n)&&oe(n.field))if(t){if(t!==n.field)return nT("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),t}else t=n.field;return nT("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),t}if(function(e){return!a(e)&&RO(e,"fields")&&RO(e,"data")}(e)){nT("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const t=e.fields[0];return oe(t)?t:void 0}}function WH(e,t){return qH(e.component.scales[t].get("domains").map((t=>(rR(t)&&(t.data=e.lookupDataSource(t.data)),t))))}function HH(e){return mG(e)||pG(e)?e.children.reduce(((e,t)=>e.concat(HH(t))),GH(e)):GH(e)}function GH(e){return cO(e.component.scales).reduce(((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:o,type:s,selectionExtent:l,domains:u,range:c,reverse:f,...d}=r,h=function(e,t,n,i){if(hN(n)){if(iR(e))return{step:{signal:`${t}_step`}}}else if(re(e)&&rR(e))return{...e,data:i.lookupDataSource(e.data)};return e}(r.range,o,n,e),p=WH(e,n),m=l?function(e,t,n,i){const r=LU(e,t.param,t);return{signal:lP(n.get("type"))&&a(i)&&i[0]>i[1]?`isValid(${r}) && reverse(${r})`:r}}(e,l,i,p):null;return t.push({name:o,type:s,...p?{domain:p}:{},...m?{domainRaw:m}:{},range:h,...void 0!==f?{reverse:f}:{},...d}),t}),[])}class VH extends II{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainHasZero(){const e=this.get("type");if(ZM([WT,VT,XT],e))return"definitely-not";const t=this.get("zero");if(!0===t||void 0===t&&ZM([UT,GT,HT],e))return"definitely";const n=this.get("domains");if(n.length>0){let e=!1,t=!1,i=!1;for(const r of n){if(a(r)){const n=r[0],i=r[r.length-1];if(ie(n)&&ie(i)){if(n<=0&&i>=0){e=!0;continue}t=!0;continue}}i=!0}if(e)return"definitely";if(t&&!i)return"definitely-not"}return"maybe"}}const XH=["range","scheme"];function YH(e,t){const n=e.fieldDef(t);if(null==n?void 0:n.bin){const{bin:i,field:r}=n,o=Wz(t),a=e.getName(o);if(re(i)&&i.binned&&void 0!==i.step)return new zH((()=>{const n=e.scaleName(t),r=`(domain("${n}")[1] - domain("${n}")[0]) / ${i.step}`;return`${e.getSignalName(a)} / (${r})`}));if(VN(i)){const t=HW(e,r,i);return new zH((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(a)} / (${i})`}))}}}function JH(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const f of XH)if(void 0!==n[f]){const i=xP(r,f),o=wP(e,f);if(i)if(o)nT(o);else switch(f){case"range":{const i=n.range;if(a(i)){if(hN(e))return qI(i.map((e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return zH.fromName(i,n)}return e})))}else if(re(i))return qI({data:t.requestDataName(tq.Main),field:i.field,sort:{op:"min",field:t.vgField(e)}});return qI(i)}case"scheme":return qI(QH(n[f]))}else nT(XR(r,f,e))}const o=e===BO||"xOffset"===e?"width":"height",s=i[o];if(xj(s))if(hN(e))if(sP(r)){const n=ZH(s,t,e);if(n)return qI({step:n})}else nT(YR(o));else if(vN(e)){const n=e===UO?"x":"y";if("band"===t.getScaleComponent(n).get("type")){const e=eG(s,r);if(e)return qI(e)}}const{rangeMin:l,rangeMax:u}=n,c=function(e,t){const{size:n,config:i,mark:r,encoding:o}=t,{type:s}=oB(o[e]),l=t.getScaleComponent(e),u=l.get("type"),{domain:c,domainMid:f}=t.specifiedScales[e];switch(e){case BO:case jO:if(ZM(["point","band"],u)){const r=tG(e,n,i.view);if(xj(r)){return{step:ZH(r,t,e)}}}return KH(e,t,u);case UO:case WO:return function(e,t,n){const i=e===UO?"x":"y",r=t.getScaleComponent(i);if(!r)return KH(i,t,n,{center:!0});const o=r.get("type"),a=t.scaleName(i),{markDef:s,config:l}=t;if("band"===o){const e=tG(i,t.size,t.config.view);if(xj(e)){const t=eG(e,n);if(t)return t}return[0,{signal:`bandwidth('${a}')`}]}{const n=t.encoding[i];if(RL(n)&&n.timeUnit){const e=_T(n.timeUnit,(e=>`scale('${a}', ${e})`)),i=t.config.scale.bandWithNestedOffsetPaddingInner,r=SL({fieldDef:n,markDef:s,config:l})-.5,o=0!==r?` + ${r}`:"";if(i){return[{signal:`${nR(i)?`${i.signal}/2`+o:`${i/2+r}`} * (${e})`},{signal:`${nR(i)?`(1 - ${i.signal}/2)`+o:`${1-i/2+r}`} * (${e})`}]}return[0,{signal:e}]}return XM(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,t,u);case iz:{const o=function(e,t){switch(e){case"bar":case"tick":return t.scale.minBandSize;case"line":case"trail":case"rule":return t.scale.minStrokeWidth;case"text":return t.scale.minFontSize;case"point":case"square":case"circle":return t.scale.minSize}throw new Error(IR("size",e))}(r,i),s=function(e,t,n,i){const r={x:YH(n,"x"),y:YH(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=iG(t,r,i.view);return ie(e)?e-1:new zH((()=>`${e.signal} - 1`))}case"line":case"trail":case"rule":return i.scale.maxStrokeWidth;case"text":return i.scale.maxFontSize;case"point":case"square":case"circle":{if(i.scale.maxSize)return i.scale.maxSize;const e=iG(t,r,i.view);return ie(e)?Math.pow(nG*e,2):new zH((()=>`pow(${nG} * ${e.signal}, 2)`))}}throw new Error(IR("size",e))}(r,n,t,i);return cP(u)?function(e,t,n){const i=()=>{const i=hR(t),r=hR(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return nR(t)?new zH(i):{signal:i()}}(o,s,function(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return void 0!==n&&a(n)?n.length+1:(nT(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(u,i,c,e)):[o,s]}case VO:return[0,2*Math.PI];case rz:return[0,360];case HO:return[0,new zH((()=>`min(${t.getSignalName(hG(t.parent)?"child_width":"width")},${t.getSignalName(hG(t.parent)?"child_height":"height")})/2`))];case lz:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case uz:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case nz:return"symbol";case ZO:case ez:case tz:return"ordinal"===u?"nominal"===s?"category":"ordinal":void 0!==f?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case oz:case az:case sz:return[i.scale.minOpacity,i.scale.maxOpacity]}}(e,t);return(void 0!==l||void 0!==u)&&xP(r,"rangeMin")&&a(c)&&2===c.length?qI([l??c[0],u??c[1]]):UI(c)}function QH(e){return function(e){return!oe(e)&&RO(e,"name")}(e)?{scheme:e.name,...JM(e,["name"])}:{scheme:e}}function KH(e,t,n,{center:i}={}){const r=Wz(e),o=t.getName(r),a=t.getSignalName.bind(t);return e===jO&&lP(n)?i?[zH.fromName((e=>`${a(e)}/2`),o),zH.fromName((e=>`-${a(e)}/2`),o)]:[zH.fromName(a,o),0]:i?[zH.fromName((e=>`-${a(e)}/2`),o),zH.fromName((e=>`${a(e)}/2`),o)]:[0,zH.fromName(a,o)]}function ZH(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),o=Gz(n),a=i[o];if("offset"===bj({step:e,offsetIsDiscrete:IL(a)&&PT(a.type)})&&AB(i,o)){const n=t.getScaleComponent(o);let i=`domain('${t.scaleName(o)}').length`;if("band"===n.get("type")){i=`bandspace(${i}, ${n.get("paddingInner")??n.get("padding")??0}, ${n.get("paddingOuter")??n.get("padding")??0})`}const a=r.get("paddingInner")??r.get("padding");return{signal:`${e.step} * ${i} / (1-${s=a,nR(s)?s.signal:he(s)})`}}return e.step;var s}function eG(e,t){if("offset"===bj({step:e,offsetIsDiscrete:sP(t)}))return{step:e.step}}function tG(e,t,n){const i=e===BO?"width":"height",r=t[i];return r||$j(n,i)}const nG=.95;function iG(e,t,n){const i=xj(e.width)?e.width.step:Ej(n,"width"),r=xj(e.height)?e.height.step:Ej(n,"height");return t.x||t.y?new zH((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function rG(e,t){dG(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of cO(n)){const l=a[s],u=n[s],c=e.getScaleComponent(s),f=oB(r[s]),d=l[t],h=c.get("type"),p=c.get("padding"),m=c.get("paddingInner"),g=xP(h,t),y=wP(s,t);if(void 0!==d&&(g?y&&nT(y):nT(XR(h,t,s))),g&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":iT(l[t])||"temporal"===n||e?u.set(t,{signal:dB(l[t],{type:n,timeUnit:e})},!0):u.set(t,l[t],!0);break;default:u.copyKeyFromObject(t,l)}}else{const n=RO(oG,t)?oG[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:h,scalePadding:p,scalePaddingInner:m,domain:l.domain,domainMin:l.domainMin,domainMax:l.domainMax,markDef:o,config:i,hasNestedOffsetScale:DB(r,s),hasSecondaryRangeChannel:!!r[Uz(s)]}):i.scale[t];void 0!==n&&u.set(t,n,!1)}}}(e,t):sG(e,t)}const oG={bins:({model:e,fieldOrDatumDef:t})=>RL(t)?function(e,t){const n=t.bin;if(VN(n)){const i=HW(e,t.field,n);return new zH((()=>e.getSignalName(i)))}if(XN(n)&&YN(n)&&void 0!==n.step)return{step:n.step};return}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(ZM([ZO,ez,tz],e)&&"nominal"!==t)return"hcl";return}(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:i,domainMax:r,fieldOrDatumDef:o})=>function(e,t,n,i,r,o){var s;if((null==(s=rB(o))?void 0:s.bin)||a(n)||null!=r||null!=i||ZM([VT,XT],e))return;return!!hN(t)||void 0}(e,t,n,i,r,o),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>function(e,t,n,i,r,o){if(hN(e)){if(uP(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!RL(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===YT)return n.pointPadding}return}(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0!==e)return;if(hN(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,tickBandPaddingInner:a,bandWithNestedOffsetPaddingInner:s}=r;return o?s:$O(e,"bar"===n?t:"tick"===n?a:i)}if(vN(t)&&i===JT)return r.offsetBandPaddingInner;return}(e,t,n.type,i,r.scale,o),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0!==e)return;if(hN(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(o)return t;if(n===JT)return $O(e,nR(i)?{signal:`${i.signal}/2`}:i/2)}else if(vN(t)){if(n===YT)return.5;if(n===JT)return r.offsetBandPaddingOuter}return}(e,t,n,i,r.scale,o),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){if("x"===n&&void 0!==i.xReverse)return lP(e)&&"descending"===t?nR(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse;if(lP(e)&&"descending"===t)return!0;return}(t,RL(e)?e.sort:void 0,n,i.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:i,scaleType:r,config:o,hasSecondaryRangeChannel:s})=>function(e,t,n,i,r,o,s){if(n&&"unaggregated"!==n&&lP(r)){if(a(n)){const e=n[0],t=n[n.length-1];if(ie(e)&&e<=0&&ie(t)&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!cP(r))return!0;if((!RL(t)||!t.bin)&&ZM([...dN,...mN],e)){const{orient:t,type:n}=i;return(!ZM(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!ZM(["bar","area"],n)||s)||(null==o?void 0:o.zero))}return!1}(e,t,n,i,r,o.scale,s)};function aG(e){dG(e)?function(e){const t=e.component.scales;for(const n of CN){const i=t[n];if(!i)continue;const r=JH(n,e);i.setWithExplicit("range",r)}}(e):sG(e,"range")}function sG(e,t){const n=e.component.scales;for(const i of e.children)"range"===t?aG(i):rG(i,t);for(const i of cO(n)){let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=GI(r,e.getWithExplicit(t),t,"scale",WI(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0)))}}n[i].setWithExplicit(t,r)}}function lG(e,t,n,i,r=!1){const o=function(e,t,n,i){var r;switch(t.type){case"nominal":case"ordinal":if($z(e)||"discrete"===TN(e))return"shape"===e&&"ordinal"===t.type&&nT(WR(e,"ordinal")),"ordinal";if(hN(e)||vN(e)){if(ZM(["rect","bar","image","rule","tick"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in pN)return"band";return GP(n[Wz(e)])||HL(t)&&(null==(r=t.axis)?void 0:r.tickBand)?"band":"point";case"temporal":return $z(e)?"time":"discrete"===TN(e)?(nT(WR(e,"temporal")),"ordinal"):RL(t)&&t.timeUnit&&wT(t.timeUnit).utc?"utc":"time";case"quantitative":return $z(e)?RL(t)&&VN(t.bin)?"bin-ordinal":"linear":"discrete"===TN(e)?(nT(WR(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(LR(t.type))}(t,n,i,r),{type:a}=e;return MN(t)?void 0!==a?function(e,t,n=!1){if(!MN(e))return!1;switch(e){case BO:case jO:case UO:case WO:case VO:case HO:return!!uP(t)||"band"===t||"point"===t&&!n;case iz:case lz:case oz:case az:case sz:case rz:return uP(t)||cP(t)||ZM(["band","point","ordinal"],t);case ZO:case ez:case tz:return"band"!==t;case uz:case nz:return"ordinal"===t||cP(t)}}(t,a)?RL(n)&&(s=a,l=n.type,!(ZM([BT,IT],l)?void 0===s||sP(s):l===jT?ZM([VT,XT,void 0],s):l!==LT||iP(s)||cP(s)||void 0===s))?(nT(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(a,o)),o):a:(nT(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,a,o)),o):o:null;var s,l}function uG(e){dG(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of CN){const a=oB(t[o]);if(a&&n===TP&&o===nz&&a.type===qT)continue;let s=a&&a.scale;if(a&&null!==s&&!1!==s){s??(s={});const n=lG(s,o,a,i,DB(t,o));r[o]=new VH(e.scaleName(`${o}`,!0),{value:n,explicit:s.type===n})}}return r}(e):e.component.scales=function(e){var t;const n=e.component.scales={},i={},r=e.component.resolve;for(const o of e.children){uG(o);for(const n of cO(o.component.scales))if((t=r.scale)[n]??(t[n]=xW(n,e)),"shared"===r.scale[n]){const e=i[n],t=o.component.scales[n].getWithExplicit("type");e?KT(e.value,t.value)?i[n]=GI(e,t,"type","scale",cG):(r.scale[n]="independent",delete i[n]):i[n]=t}}for(const o of cO(i)){const t=e.scaleName(o,!0),r=i[o];n[o]=new VH(t,r);for(const n of e.children){const e=n.component.scales[o];e&&(n.renameScale(e.get("name"),t),e.merged=!0)}}return n}(e)}const cG=WI(((e,t)=>eP(e)-eP(t)));class fG{constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return void 0!==this.nameMap[e]}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}}function dG(e){return"unit"===(null==e?void 0:e.type)}function hG(e){return"facet"===(null==e?void 0:e.type)}function pG(e){return"concat"===(null==e?void 0:e.type)}function mG(e){return"layer"===(null==e?void 0:e.type)}class gG{constructor(e,t,n,i,r,o,a){this.type=t,this.parent=n,this.config=r,this.correctDataNames=e=>{var t,n,i;return(null==(t=e.from)?void 0:t.data)&&(e.from.data=this.lookupDataSource(e.from.data)),(null==(i=null==(n=e.from)?void 0:n.facet)?void 0:i.data)&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e},this.parent=n,this.config=r,this.view=ZN(a),this.name=e.name??i,this.title=tR(e.title)?{text:e.title}:e.title?ZN(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new fG,this.projectionNameMap=n?n.projectionNameMap:new fG,this.signalNameMap=n?n.signalNameMap:new fG,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map((e=>uI(e)?{filter:GM(e.filter,TT)}:e)),this.layout="layer"===t||"unit"===t?{}:function(e,t,n){const i=n[t],r={},{spacing:o,columns:a}=i;void 0!==o&&(r.spacing=o),void 0!==a&&($L(e)&&!kL(e.facet)||gj(e))&&(r.columns=a),yj(e)&&(r.columns=1);for(const s of _j)if(void 0!==e[s])if("spacing"===s){const t=e[s];r[s]=ie(t)?t:{row:t.row??o,column:t.column??o}}else r[s]=e[s];return r}(e,t,r),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:$L(e)||(null==n?void 0:n.component.data.isFaceted)&&void 0===e.data},layoutSize:new II,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?VM(o):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(e,{ignoreRange:t}={}){uG(e),NH(e);for(const n of bP)rG(e,n);t||aG(e)}(this)}parseProjection(){qW(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){OW(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const r of cO(n)){const e=n[r];void 0!==e&&(i[r]=fR(e))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=fR(this.description)),"unit"!==this.type&&"layer"!==this.type)?uO(t)?void 0:t:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...t}}assembleLayout(){if(!this.layout)return;const{spacing:e,...t}=this.layout,{component:n,config:i}=this,r=function(e,t){const n={};for(const i of Dz){const r=e[i];if(null==r?void 0:r.facetFieldDef){const{titleAnchor:e,titleOrient:o}=tW(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=ZU(i,o),s=dW(e,a);void 0!==s&&(n[a]=s)}}return uO(n)?void 0:n}(n.layoutHeaders,i);return{padding:e,...this.assembleDefaultLayout(),...t,...r?{titleBand:r}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of Dz)e[n].title&&t.push(rW(this,n));for(const n of nW)t=t.concat(sW(this,n));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>IU(e,"grid",t))),...i.map((e=>IU(e,"grid",t))),...n.map((e=>IU(e,"main",t))),...i.map((e=>IU(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return PW(this)}assembleProjections(){return LW(this)}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...eR(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return ZM(["unit","layer"],this.type)?ZM(["middle",void 0],n.anchor)&&(n.frame??(n.frame="group")):n.anchor??(n.anchor="start"),uO(n)?void 0:n}assembleGroup(e=[]){const t={};(e=e.concat(this.assembleSignals())).length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||hG(this.parent)?HH(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}getName(e){return pO((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(tq[e].toLowerCase())}requestDataName(e){const t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(hG(this.parent)){const t=gN(vW(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(sP(e)&&iR(i)){const e=n.get("name"),i=UH(WH(this,t));if(i){return{signal:yW(e,n,YL({aggregate:"distinct",field:i},{expr:"datum"}))}}return nT(FR(t)),null}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){const t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){return t?this.getName(e):Lz(e)&&MN(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getScaleType(e){const t=this.getScaleComponent(e);return t?t.get("type"):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(`Cannot find a selection named "${t}".`);return n}hasAxisOrientSignalRef(){var e,t;return(null==(e=this.component.axes.x)?void 0:e.some((e=>e.hasOrientSignalRef())))||(null==(t=this.component.axes.y)?void 0:t.some((e=>e.hasOrientSignalRef())))}}class yG extends gG{vgField(e,t={}){const n=this.fieldDef(e);if(n)return YL(n,t)}reduceFieldDef(e,t){return function(e,t,n,i){return e?cO(e).reduce(((n,r)=>{const o=e[r];return a(o)?o.reduce(((e,n)=>t.call(i,e,n,r)),n):t.call(i,n,o,r)}),n):n}(this.getMapping(),((t,n,i)=>{const r=rB(n);return r?e(t,r,i):t}),t)}forEachFieldDef(e,t){OB(this.getMapping(),((t,n)=>{const i=rB(t);i&&e(i,n)}),t)}}class vG extends cq{clone(){return new vG(null,VM(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=VM(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"value",n[1]??"density"];const i=this.transform.resolve??"shared";this.transform.resolve=i}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${QM(this.transform)}`}assemble(){const{density:e,...t}=this.transform,n={type:"kde",field:e,...t};return n.resolve=this.transform.resolve,n}}class bG extends cq{clone(){return new bG(null,VM(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=VM(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${QM(this.transform)}`}assemble(){const{extent:e,param:t}=this.transform;return{type:"extent",field:e,signal:t}}}class xG extends cq{clone(){return new xG(this.parent,VM(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=VM(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map(((e,t)=>i[t]??e))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${QM(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class wG extends cq{clone(){return new wG(null,VM(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=VM(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"key",n[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${QM(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class _G extends cq{clone(){return new _G(null,VM(this.fields),this.geojson,this.signal)}static parseAll(e,t){if(t.component.projection&&!t.component.projection.isFit)return e;let n=0;for(const i of[[JO,YO],[KO,QO]]){const r=i.map((e=>{const n=oB(t.encoding[e]);return RL(n)?n.field:PL(n)?{expr:`${n.datum}`}:UL(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new _G(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(nz)){const i=t.typedFieldDef(nz);i.type===qT&&(e=new _G(e,null,i.field,t.getName("geojson_"+n++)))}return e}constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}dependentFields(){const e=(this.fields??[]).filter(oe);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${QM(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class kG extends cq{clone(){return new kG(null,this.projection,VM(this.fields),VM(this.as))}constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[JO,YO],[KO,QO]]){const i=n.map((e=>{const n=oB(t.encoding[e]);return RL(n)?n.field:PL(n)?{expr:`${n.datum}`}:UL(n)?{expr:`${n.value}`}:void 0})),r=n[0]===KO?"2":"";(i[0]||i[1])&&(e=new kG(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(oe))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${QM(this.fields)} ${QM(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class EG extends cq{clone(){return new EG(null,VM(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e;return{signal:`sequence(${[t,n,...i?[i]:[]].join(",")})`}}static makeFromTransform(e,t){return new EG(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(RL(i)&&RL(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const a=i.impute?r:r.impute?i:void 0,{method:s,value:l,frame:u,keyvals:c}=o.impute,f=zB(t.mark,n);return new EG(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==l?{value:l}:{},...u?{frame:u}:{},...void 0!==c?{keyvals:c}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${QM(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:a=[null,null]}=this.transform,s={type:"impute",field:e,key:t,...n?{keyvals:(l=n,RO(l,"stop")?this.processSequence(n):n)}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:o};var l;if(i&&"value"!==i){return[s,{type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:a,ignorePeers:!1,...r?{groupby:r}:{}},{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}return[s]}}class $G extends cq{clone(){return new $G(null,VM(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=VM(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${QM(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class AG extends cq{clone(){return new AG(null,VM(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(e,t,n,i){const r=t.component.data.sources,{from:o}=n;let a=null;if(function(e){return RO(e,"data")}(o)){let e=jG(o.data,r);e||(e=new rH(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new fq(e,n,tq.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return RO(e,"param")}(o)){const e=o.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(pO(e),e)}catch(s){throw new Error(`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`)}if(a=i.materialized,!a)throw new Error(function(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}(e))}return new AG(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?r(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${QM({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:r(this.transform.as)}:{}};else{let t=this.transform.as;oe(t)||(nT('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),t="_lookup"),e={as:[t]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}}class DG extends cq{clone(){return new DG(null,VM(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=VM(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"prob",n[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${QM(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class SG extends cq{clone(){return new SG(null,VM(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=VM(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${QM(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class FG extends cq{clone(){return new FG(null,VM(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=rO((this.transform.groupby??[]).concat(e),(e=>e))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${QM(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return{type:"pivot",field:e,value:t,...void 0!==i?{limit:i}:{},...void 0!==r?{op:r}:{},...void 0!==n?{groupby:n}:{}}}}class CG extends cq{clone(){return new CG(null,VM(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${QM(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function MG(e){let t=0;return function n(i,r){if(i instanceof rH&&!i.isGenerator&&!XI(i.data)){e.push(r);r={name:null,source:r.name,transform:[]}}if(i instanceof eH&&(i.parent instanceof rH&&!r.source?(r.format={...r.format,parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof JW)return r.name||(r.name="data_"+t++),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,void e.push(...i.assemble());if((i instanceof nH||i instanceof iH||i instanceof kH||i instanceof TU||i instanceof QU||i instanceof kG||i instanceof YW||i instanceof AG||i instanceof AH||i instanceof _H||i instanceof wG||i instanceof xG||i instanceof vG||i instanceof $G||i instanceof DG||i instanceof SG||i instanceof tH||i instanceof CG||i instanceof FG||i instanceof bG)&&r.transform.push(i.assemble()),(i instanceof VW||i instanceof pq||i instanceof EG||i instanceof $H||i instanceof _G)&&r.transform.push(...i.assemble()),i instanceof fq)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof fq)i.setSource(r.name);else if(r.name||(r.name="data_"+t++),i.setSource(r.name),1===i.numChildren()){e.push(r);r={name:null,source:r.name,transform:[]}}switch(i.numChildren()){case 0:i instanceof fq&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name="data_"+t++);let o=r.name;!r.source||r.transform.length>0?e.push(r):o=r.source;for(const e of i.children){n(e,{name:null,source:o,transform:[]})}break}}}}function OG(e,t){var n;const{facet:i,config:r,child:o,component:s}=e;if(e.channelHasField(t)){const l=i[t],u=eW("title",null,r,t);let c=eB(l,r,{allowDisabling:!0,includeDefault:void 0===u||!!u});o.component.layoutHeaders[t].title&&(c=a(c)?c.join(", "):c,c+=` / ${o.component.layoutHeaders[t].title}`,o.component.layoutHeaders[t].title=null);const f=eW("labelOrient",l.header,r,t),d=null!==l.header&&$O(null==(n=l.header)?void 0:n.labels,r.header.labels,!0),h=ZM(["bottom","right"],f)?"footer":"header";s.layoutHeaders[t]={title:null!==l.header?c:null,facetFieldDef:l,[h]:"facet"===t?[]:[zG(e,t,d)]}}}function zG(e,t,n){const i="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function NG(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=wW(o,t),"shared"===o.axis[t]){const o="x"===t?"column":"row",a=r[o];for(const r of n.component.axes[t]){const t="top"===(i=r.get("orient"))||"left"===i||nR(i)?"header":"footer";a[t]??(a[t]=[zG(e,o,!1)]);const n=IU(r,"main",e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}var i}function RG(e){for(const t of e.children)t.parseLayoutSize()}function TG(e,t){const n=vW(t),i=gN(n),r=e.component.resolve,o=e.component.layoutSize;let a;for(const s of e.children){const t=s.component.layoutSize.getWithExplicit(n),o=r.scale[i]??xW(i,e);if("independent"===o&&"step"===t.value){a=void 0;break}if(a){if("independent"===o&&a.value!==t.value){a=void 0;break}a=GI(a,t,n,"")}else a=t}if(a){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,a)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function PG(e,t){const n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const e=r.get("type"),n=r.get("range");if(sP(e)){const e=$j(i.view,t);return iR(n)||xj(e)?"step":e}return kj(i.view,t)}if(e.hasProjection||"arc"===e.mark)return kj(i.view,t);{const e=$j(i.view,t);return xj(e)?e.step:e}}function LG(e,t,n){return YL(t,{suffix:`by_${YL(e)}`,...n})}class BG extends yG{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=cV(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!kL(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=cO(e),n={};for(const i of t){if(![TO,PO].includes(i)){nT(IR(i,"facet"));break}const t=e[i];if(void 0===t.field){nT(jR(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=lB(e,t);return n.header?n.header=ZN(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return RO(this.facet,e)}fieldDef(e){return this.facet[e]}parseData(){this.component.data=IG(this),this.child.parseData()}parseLayoutSize(){RG(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of Dz)OG(e,t);NG(e,"x"),NG(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){const e={};for(const t of Dz)for(const n of iW){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:o}=i;if(o){const n=eW("titleOrient",o.header,this.config,t);if(["right","bottom"].includes(n)){const i=ZU(t,n);e.titleAnchor??(e.titleAnchor={}),e.titleAnchor[i]="end"}}if(null==r?void 0:r[0]){const r="row"===t?"height":"width",o="header"===n?"headerBand":"footerBand";"facet"===t||this.child.component.layoutSize.get(r)||(e[o]??(e[o]={}),e[o][t]=.5),i.title&&(e.offset??(e.offset={}),e.offset["row"===t?"rowTitle":"columnTitle"]=10)}}return e}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let i="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(i="none"),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof BG)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof BG?{...this.channelHasField("column")?{encode:{update:{columns:{field:YL(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof BG){if(this.child.channelHasField("column")){const i=YL(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of dN){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(sP(o)&&iR(a)){const r=UH(WH(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):nT(FR(i))}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:t}=this.component.data.facetRoot,{row:n,column:i}=this.facet,{fields:r,ops:o,as:s}=this.getCardinalityAggregateForChild(),l=[];for(const c of Dz){const e=this.facet[c];if(e){l.push(YL(e));const{bin:t,sort:u}=e;if(VN(t)&&l.push(YL(e,{binSuffix:"end"})),wL(u)){const{field:t,op:a=vL}=u,l=LG(e,u);n&&i?(r.push(l),o.push("max"),s.push(l)):(r.push(t),o.push(a),s.push(l))}else if(a(u)){const t=KU(e,c);r.push(t),o.push("max"),s.push(t)}}}const u=!!n&&!!i;return{name:e,data:t,groupby:l,...u||r.length>0?{aggregate:{...u?{cross:u}:{},...r.length?{fields:r,ops:o,as:s}:{}}}:{}}}facetSortFields(e){const{facet:t}=this,n=t[e];return n?wL(n.sort)?[LG(n,n.sort,{expr:"datum"})]:a(n.sort)?[KU(n,e,{expr:"datum"})]:[YL(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(wL(e)?e.order:!a(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){var e;const{facet:t,config:n}=this;if(t.facet)return uW(t.facet,"facet",n);const i={row:["top","bottom"],column:["left","right"]};for(const r of nW)if(t[r]){const o=eW("labelOrient",null==(e=t[r])?void 0:e.header,n,r);if(i[r].includes(o))return uW(t[r],r,n)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=MG(t);for(const i of e.children)n(i,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...r?{style:r}:{},from:{facet:this.assembleFacet()},sort:{field:Dz.map((e=>this.facetSortFields(e))).flat(),order:Dz.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(sq(this,[]))}]}getMapping(){return this.facet}}function jG(e,t){var n,i,r,o;for(const a of t){const t=a.data;if(e.name&&a.hasName()&&e.name!==a.dataName)continue;const s=null==(n=e.format)?void 0:n.mesh,l=null==(i=t.format)?void 0:i.feature;if(s&&l)continue;const u=null==(r=e.format)?void 0:r.feature;if((u||l)&&u!==l)continue;const c=null==(o=t.format)?void 0:o.mesh;if(!s&&!c||s===c)if(YI(e)&&YI(t)){if(zO(e.values,t.values))return a}else if(XI(e)&&XI(t)){if(e.url===t.url)return a}else if(JI(e)&&e.name===a.dataName)return a}return null}function IG(e){var t;let n=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new rH({values:[]});return t.push(e),e}const n=jG(e.data,t);if(n)return QI(e.data)||(n.data.format=nO({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new rH(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}(e,e.component.data.sources);const{outputNodes:i,outputNodeRefCounts:r}=e.component.data,o=e.data,a=!(o&&(QI(o)||XI(o)||YI(o)))&&e.parent?e.parent.component.data.ancestorParse.clone():new VI;QI(o)?(KI(o)?n=new iH(n,o.sequence):eq(o)&&(n=new nH(n,o.graticule)),a.parseNothing=!0):null===(null==(t=null==o?void 0:o.format)?void 0:t.parse)&&(a.parseNothing=!0),n=eH.makeExplicit(n,e,a)??n,n=new tH(n);const s=e.parent&&mG(e.parent);(dG(e)||hG(e))&&s&&(n=VW.makeFromEncoding(n,e)??n),e.transforms.length>0&&(n=function(e,t,n){let i=0;for(const r of t.transforms){let o,a;if(xI(r))a=e=new QU(e,r),o="derived";else if(uI(r)){const i=KW(r);a=e=eH.makeWithAncestors(e,{},i,n)??e,e=new TU(e,t,r.filter)}else if(wI(r))a=e=VW.makeFromTransform(e,r,t),o="number";else if(kI(r))o="date",void 0===n.getWithExplicit(r.field).value&&(e=new eH(e,{[r.field]:o}),n.set(r.field,o,!1)),a=e=pq.makeFromTransform(e,r);else if(EI(r))a=e=YW.makeFromTransform(e,r),o="number",MU(t)&&(e=new tH(e));else if(cI(r))a=e=AG.make(e,t,r,i++),o="derived";else if(yI(r))a=e=new AH(e,r),o="number";else if(vI(r))a=e=new _H(e,r),o="number";else if($I(r))a=e=$H.makeFromTransform(e,r),o="derived";else if(AI(r))a=e=new wG(e,r),o="derived";else if(DI(r))a=e=new bG(e,r),o="derived";else if(bI(r))a=e=new xG(e,r),o="derived";else if(fI(r))a=e=new FG(e,r),o="derived";else if(gI(r))e=new CG(e,r);else if(_I(r))a=e=EG.makeFromTransform(e,r),o="derived";else if(dI(r))a=e=new vG(e,r),o="derived";else if(hI(r))a=e=new DG(e,r),o="derived";else if(pI(r))a=e=new SG(e,r),o="derived";else{if(!mI(r)){nT(`Ignoring an invalid transform: ${NO(r)}.`);continue}a=e=new $G(e,r),o="derived"}if(a&&void 0!==o)for(const e of a.producedFields()??[])n.set(e,o,!1)}return e}(n,e,a));const l=function(e){const t={};if(dG(e)&&e.component.selection)for(const n of cO(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&EO(e.field)>1&&(t[e.field]="flatten")}return t}(e),u=ZW(e);n=eH.makeWithAncestors(n,{},{...l,...u},a)??n,dG(e)&&(n=_G.parseAll(n,e),n=kG.parseAll(n,e)),(dG(e)||hG(e))&&(s||(n=VW.makeFromEncoding(n,e)??n),n=pq.makeFromEncoding(n,e)??n,n=QU.parseAllForSortIndex(n,e));const c=n=qG(tq.Raw,e,n);if(dG(e)){const t=YW.makeFromEncoding(n,e);t&&(n=t,MU(e)&&(n=new tH(n))),n=EG.makeFromEncoding(n,e)??n,n=$H.makeFromEncoding(n,e)??n}let f,d;if(dG(e)){const{markDef:t,mark:i,config:r}=e,o=gR("invalid",t,r),{marks:a,scales:s}=d=iq({invalid:o,isPath:PP(i)});a!==s&&"include-invalid-values"===s&&(f=n=qG(tq.PreFilterInvalid,e,n)),"exclude-invalid-values"===a&&(n=kH.make(n,e,d)??n)}const h=n=qG(tq.Main,e,n);let p;if(dG(e)&&d){const{marks:t,scales:i}=d;"include-invalid-values"===t&&"exclude-invalid-values"===i&&(n=kH.make(n,e,d)??n,p=n=qG(tq.PostFilterInvalid,e,n))}dG(e)&&function(e,t){for(const[n,i]of dO(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new fq(new TU(t,e,{param:n}),r,tq.Lookup,e.component.data.outputNodeRefCounts)}}(e,h);let m=null;if(hG(e)){const t=e.getName("facet");n=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(wL(r.sort)){const{field:n,op:i=vL}=r.sort;e=t=new _H(e,{joinaggregate:[{op:i,field:n,as:LG(r,r.sort,{forAs:!0})}],groupby:[YL(r)]})}return t}return null}(n,e.facet)??n,m=new JW(n,e,t,h.getSource()),i[t]=m}return{...e.component.data,outputNodes:i,outputNodeRefCounts:r,raw:c,main:h,facetRoot:m,ancestorParse:a,preFilterInvalid:f,postFilterInvalid:p}}function qG(e,t,n){const{outputNodes:i,outputNodeRefCounts:r}=t.component.data,o=t.getDataName(e),a=new fq(n,o,e,r);return i[o]=a,a}class UG extends gG{constructor(e,t,n,i){var r,o,a,s;super(e,"concat",t,n,i,e.resolve),"shared"!==(null==(o=null==(r=e.resolve)?void 0:r.axis)?void 0:o.x)&&"shared"!==(null==(s=null==(a=e.resolve)?void 0:a.axis)?void 0:s.y)||nT("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(e).map(((e,t)=>cV(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=IG(this);for(const e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of cO(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return yj(e)?e.vconcat:vj(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){RG(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";TG(e,t),TG(e,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.forEach((e=>e.assembleSignals())),[]}assembleLayoutSignals(){const e=pW(this);for(const t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleMarks(){return this.children.map((e=>{const t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!1);return{type:"group",name:e.getName("group"),...t?{title:t}:{},...n?{style:n}:{},...i?{encode:{update:i}}:{},...e.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){const e=this.layout.columns;return{...null!=e?{columns:e}:{},bounds:"full",align:"each"}}}const WG={disable:1,gridScale:1,scale:1,...bB,labelExpr:1,encode:1},HG=cO(WG);class GG extends II{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new GG(VM(this.explicit),VM(this.implicit),this.mainExtracted)}hasAxisPart(e){return"axis"===e||("grid"===e||"title"===e?!!this.get(e):!(!1===(t=this.get(e))||null===t));var t}hasOrientSignalRef(){return nR(this.explicit.orient)}}const VG={bottom:"top",top:"bottom",left:"right",right:"left"};function XG(e,t){if(!e)return t.map((e=>e.clone()));{if(e.length!==t.length)return;const n=e.length;for(let i=0;i<n;i++){const n=e[i],r=t[i];if(!!n!=!!r)return;if(n&&r){const t=n.getWithExplicit("orient"),o=r.getWithExplicit("orient");if(t.explicit&&o.explicit&&t.value!==o.value)return;e[i]=YG(n,r)}}}return e}function YG(e,t){for(const n of HG){const i=GI(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",((e,t)=>{switch(n){case"title":return kR(e,t);case"gridScale":return{explicit:e.explicit,value:$O(e.value,t.value)}}return HI(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function JG(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(nR(n.labelAngle)?n.labelAngle:CO(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===JU(i,r))return!0}return e===n[t]}const QG=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function KG(e,t){var n,i;let r=t.axis(e);const o=new GG,a=oB(t.encoding[e]),{mark:s,config:l}=t,u=(null==r?void 0:r.orient)||(null==(n=l["x"===e?"axisX":"axisY"])?void 0:n.orient)||(null==(i=l.axis)?void 0:i.orient)||function(e){return"x"===e?"bottom":"left"}(e),c=t.getScaleComponent(e).get("type"),f=function(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:iP(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=nR(n)?"axisOrient":`axis${yO(n)}`,s=[...r,...r.map((e=>o+e.substr(4)))],l=["axis",a,o];return{vlOnlyAxisConfig:UU(s,i,e,n),vgAxisConfig:UU(l,i,e,n),axisConfigStyle:WU([...l,...s],i)}}(e,c,u,t.config),d=void 0!==r?!r:HU("disable",l.style,null==r?void 0:r.style,f).configValue;if(o.set("disable",d,void 0!==r),d)return o;r=r||{};const h=function(e,t,n,i,r){const o=null==t?void 0:t.labelAngle;if(void 0!==o)return nR(o)?o:CO(o);{const{configValue:o}=HU("labelAngle",i,null==t?void 0:t.style,r);return void 0!==o?CO(o):n!==BO||!ZM([IT,BT],e.type)||RL(e)&&e.timeUnit?void 0:270}}(a,r,e,l.style,f),p=hL(r.formatType,a,c),m=dL(a,a.type,r.format,r.formatType,l,!0),g={fieldOrDatumDef:a,axis:r,channel:e,model:t,scaleType:c,orient:u,labelAngle:h,format:m,formatType:p,mark:s,config:l};for(const b of HG){const n=b in GU?GU[b](g):wB(b)?r[b]:void 0,i=void 0!==n,a=JG(n,b,r,t,e);if(i&&a)o.set(b,n,a);else{const{configValue:e,configFrom:t}=wB(b)&&"values"!==b?HU(b,l.style,r.style,f):{},s=void 0!==e;i&&!s?o.set(b,n,a):("vgAxisConfig"!==t||QG.has(b)&&s||gB(e)||nR(e))&&o.set(b,e,!1)}}const y=r.encoding??{},v=yB.reduce(((n,i)=>{if(!o.hasAxisPart(i))return n;const r=bW(y[i]??{},t),a="labels"===i?function(e,t,n){const{encoding:i,config:r}=e,o=oB(i[t])??oB(i[Uz(t)]),a=e.axis(t)||{},{format:s,formatType:l}=a;if(sL(l))return{text:fL({fieldOrDatumDef:o,field:"datum.value",format:s,formatType:l,config:r}),...n};if(void 0===s&&void 0===l&&r.customFormatTypes){if("quantitative"===TL(o)){if(HL(o)&&"normalize"===o.stack&&r.normalizedNumberFormatType)return{text:fL({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:fL({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===TL(o)&&r.timeFormatType&&RL(o)&&!o.timeUnit)return{text:fL({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(t,e,r):r;return void 0===a||uO(a)||(n[i]={update:a}),n}),{});return uO(v)||o.set("encode",v,!!r.encoding||void 0!==r.labelAngle),o}function ZG(e,t){const{config:n}=e;return{...oU(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Hq("x",e,{defaultPos:"mid"}),...Hq("y",e,{defaultPos:"mid"}),...Iq("size",e),...Iq("angle",e),...eV(e,n,t)}}function eV(e,t,n){return n?{shape:{value:n}}:Iq("shape",e)}function tV(e,t,n){if(void 0===gR("align",e,n))return"center"}function nV(e,t,n){if(void 0===gR("baseline",e,n))return"middle"}const iV={arc:{vgMark:"arc",encodeEntry:e=>({...oU(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Hq("x",e,{defaultPos:"mid"}),...Hq("y",e,{defaultPos:"mid"}),...eU(e,"radius"),...eU(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...oU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...Qq("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...Qq("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...lU(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...oU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...eU(e,"x"),...eU(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>ZG(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...oU(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&RL(n)&&n.type===qT?{field:YL(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...oU(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...eU(e,"x"),...eU(e,"y"),...zq(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...oU(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Hq("x",e,{defaultPos:"mid"}),...Hq("y",e,{defaultPos:"mid"}),...Iq("size",e,{vgChannel:"strokeWidth"}),...lU(e)})},point:{vgMark:"symbol",encodeEntry:e=>ZG(e)},rect:{vgMark:"rect",encodeEntry:e=>({...oU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...eU(e,"x"),...eU(e,"y")})},rule:{vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?{...oU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Qq("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...Qq("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...Iq("size",e,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:e=>ZG(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...oU(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...Hq("x",e,{defaultPos:"mid"}),...Hq("y",e,{defaultPos:"mid"}),...zq(e),...Iq("size",e,{vgChannel:"fontSize"}),...Iq("angle",e),...uU("align",tV(e.markDef,n,t)),...uU("baseline",nV(e.markDef,n,t)),...Hq("radius",e,{defaultPos:null}),...Hq("theta",e,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"x":"y",o="horizontal"===i?"y":"x",a="horizontal"===i?"height":"width";return{...oU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...eU(e,r),...Hq(o,e,{defaultPos:"mid",vgChannel:"y"===o?"yc":"xc"}),[a]:fR(gR("thickness",n,t))}}},trail:{vgMark:"trail",encodeEntry:e=>({...oU(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Hq("x",e,{defaultPos:"mid"}),...Hq("y",e,{defaultPos:"mid"}),...Iq("size",e),...lU(e)})}};function rV(e){if(ZM([DP,EP,zP],e.mark)){const t=zB(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:oV+e.requestDataName(tq.Main),data:e.requestDataName(tq.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:sV(e,{fromPrefix:oV})}]}(e,t)}else if(e.mark===$P){const t=sR.some((t=>gR(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){var t;const[n]=sV(e,{fromPrefix:aV}),i=e.scaleName(e.stack.fieldChannel),r=(t={})=>e.vgField(e.stack.fieldChannel,t),o=(e,t)=>`${e}(${[r({prefix:"min",suffix:"start",expr:t}),r({prefix:"max",suffix:"start",expr:t}),r({prefix:"min",suffix:"end",expr:t}),r({prefix:"max",suffix:"end",expr:t})].map((e=>`scale('${i}',${e})`)).join(",")})`;let a,s;"x"===e.stack.fieldChannel?(a={...YM(n.encode.update,["y","yc","y2","height",...sR]),x:{signal:o("min","datum")},x2:{signal:o("max","datum")},clip:{value:!0}},s={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update={...JM(n.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(a={...YM(n.encode.update,["x","xc","x2","width"]),y:{signal:o("min","datum")},y2:{signal:o("max","datum")},clip:{value:!0}},s={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update={...JM(n.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const u of sR){const t=yR(u,e.markDef,e.config);n.encode.update[u]?(a[u]=n.encode.update[u],delete n.encode.update[u]):t&&(a[u]=fR(t)),t&&(n.encode.update[u]={value:0})}const l=[];if((null==(t=e.stack.groupbyChannels)?void 0:t.length)>0)for(const u of e.stack.groupbyChannels){const t=e.fieldDef(u),n=YL(t);n&&l.push(n),((null==t?void 0:t.bin)||(null==t?void 0:t.timeUnit))&&l.push(YL(t,{binSuffix:"end"}))}a=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((t,i)=>{if(n.encode.update[i])return{...t,[i]:n.encode.update[i]};{const n=yR(i,e.markDef,e.config);return void 0!==n?{...t,[i]:fR(n)}:t}}),a),a.stroke&&(a.strokeForeground={value:!0},a.strokeOffset={value:0});return[{type:"group",from:{facet:{data:e.requestDataName(tq.Main),name:aV+e.requestDataName(tq.Main),groupby:l,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:a},marks:[{type:"group",encode:{update:s},marks:[n]}]}]}(e)}return sV(e)}const oV="faceted_path_";const aV="stack_group_";function sV(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:o}=e,s=$O(i.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!(!(null==t?void 0:t.get("selectionExtent"))&&!(null==n?void 0:n.get("selectionExtent")))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),l=mR(i),u=r.key,c=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:o}=e,s=t.order;if(!(!a(s)&&UL(s)&&KM(s.value)||!s&&KM(gR("order",r,o)))){if((a(s)||RL(s))&&!n)return xR(s,{expr:"datum"});if(PP(i)){const e="horizontal"===r.orient?"y":"x";if(RL(t[e]))return{field:e}}}}(e),f=function(e){if(!e.component.selection)return null;const t=cO(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=cO(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}(e),d=gR("aria",i,o),h=iV[n].postEncodingTransform?iV[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:iV[n].vgMark,...s?{clip:s}:{},...l?{style:l}:{},...u?{key:u.field}:{},...c?{sort:c}:{},...f||{},...!1===d?{aria:d}:{},from:{data:t.fromPrefix+e.requestDataName(tq.Main)},encode:{update:iV[n].encodeEntry(e)},...h?{transform:h}:{}}]}class lV extends yG{constructor(e,t,n,i={},o){super(e,"unit",t,n,o,void 0,wj(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[];const s=jP(e.mark)?{...e.mark}:{type:e.mark},l=s.type;void 0===s.filled&&(s.filled=function(e,t,{graticule:n}){if(n)return!1;const i=yR("filled",e,t),r=e.type;return $O(i,r!==SP&&r!==DP&&r!==CP)}(s,o,{graticule:e.data&&eq(e.data)}));const u=this.encoding=function(e,t,n,i){const o={};for(const r of cO(e))Lz(r)||nT(`${s=r}-encoding is dropped as ${s} is not a valid encoding channel.`);var s,l;for(let u of Xz){if(!e[u])continue;const s=e[u];if(vN(u)){const e=Vz(u),t=o[e];if(RL(t)&&("quantitative"===(l=t.type)||"temporal"===l)&&RL(s)&&!t.timeUnit){nT(PR(e));continue}}if("angle"!==u||"arc"!==t||e.theta||(nT("Arc marks uses theta channel rather than angle, replacing angle with theta."),u=VO),CB(e,u,t)){if(u===iz&&"line"===t){const t=rB(e[u]);if(null==t?void 0:t.aggregate){nT("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(u===ZO&&(n?"fill"in e:"stroke"in e))nT(BR("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(u===dz||u===fz&&!a(s)&&!UL(s)||u===pz&&a(s)){if(s){if(u===fz){const t=e[u];if(ML(t)){o[u]=t;continue}}o[u]=r(s).reduce(((e,t)=>(RL(t)?e.push(lB(t,u)):nT(jR(t,u)),e)),[])}}else{if(u===pz&&null===s)o[u]=null;else if(!(RL(s)||PL(s)||UL(s)||OL(s)||nR(s))){nT(jR(s,u));continue}o[u]=aB(s,u,i)}}else nT(IR(u,t))}return o}(e.encoding||{},l,s.filled,o);this.markDef=Vj(s,u,o),this.size=function({encoding:e,size:t}){for(const n of dN){const i=Wz(n);xj(t[i])&&LL(e[n])&&(delete t[i],nT(YR(i)))}return t}({encoding:u,size:wj(e)?{...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:i}),this.stack=Gj(this.markDef,u),this.specifiedScales=this.initScales(l,u),this.specifiedAxes=this.initAxes(u),this.specifiedLegends=this.initLegends(u),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter((e=>pj(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===TP,n=e&&kz.some((t=>IL(e[t])));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return CN.reduce(((e,n)=>{const i=oB(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e}),{})}initScale(e){const{domain:t,range:n}=e,i=ZN(e);return a(t)&&(i.domain=t.map(uR)),a(n)&&(i.range=n.map(uR)),i}initAxes(e){return dN.reduce(((t,n)=>{const i=e[n];if(IL(i)||n===BO&&IL(e.x2)||n===jO&&IL(e.y2)){const e=IL(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=cO(e),n={};for(const i of t){const t=e[i];n[i]=gB(t)?lR(t):uR(t)}return n}initLegends(e){return SN.reduce(((t,n)=>{const i=oB(e[n]);if(i&&function(e){switch(e){case ZO:case ez:case tz:case iz:case nz:case oz:case lz:case uz:return!0;case az:case sz:case rz:return!1}}(n)){const e=i.legend;t[n]=e?ZN(e):e}return t}),{})}parseData(){this.component.data=IG(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of dN){const r=Wz(i);if(t[r]){const e=t[r];n.layoutSize.set(r,xj(e)?"step":e,!0)}else{const t=PG(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){const n={},i=e.config.selection;if(!t||!t.length)return n;for(const o of t){const t=pO(o.name),a=o.select,s=oe(a)?a:a.type,l=re(a)?VM(a):{type:s},u=i[s];for(const e in u)"fields"!==e&&"encodings"!==e&&("mark"===e&&(l.mark={...u.mark,...l.mark}),void 0!==l[e]&&!0!==l[e]||(l[e]=VM(u[e]??l[e])));const c=n[t]={...l,name:t,type:s,init:o.value,bind:o.bind,events:oe(l.on)?RD(l.on,"scope"):r(VM(l.on))},f=VM(o);for(const n of FU)n.defined(c)&&n.parse&&n.parse(e,c,f)}return n}(this,this.selection)}parseMarkGroup(){this.component.mark=rV(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,dN.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[KG(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;for(const i of fO(e.component.selection??{})){const r=i.name,o=he(r+$U);if(0===t.filter((e=>e.name===r)).length){const e="global"===i.resolve?"union":i.resolve,n="point"===i.type?", true, true)":")";t.push({name:i.name,update:`${SU}(${o}, ${he(e)}${n}`})}n=!0;for(const n of FU)n.defined(i)&&n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))}n&&0===t.filter((e=>"unit"===e.name)).length&&t.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]});return uq(t)}(this,e)}assembleSignals(){return[...qU(this),...aq(this,[])]}assembleSelectionData(e){return function(e,t){const n=[...t],i=CU(e,{escape:!1});for(const r of fO(e.component.selection??{})){const e={name:r.name+$U};if(r.project.hasSelectionId&&(e.transform=[{type:"collect",sort:{field:cj}}]),r.init){const t=r.project.items.map(rq);e.values=r.project.hasSelectionId?r.init.map((e=>({unit:i,[cj]:oq(e,!1)[0]}))):r.init.map((e=>({unit:i,fields:t,values:oq(e,!1)})))}n.filter((e=>e.name===r.name+$U)).length||n.push(e)}return n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return pW(this)}assembleMarks(){let e=this.component.mark??[];return this.parent&&mG(this.parent)||(e=lq(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){const{style:e}=this.view||{};return void 0!==e?e:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return $B(this.encoding,e)}fieldDef(e){return rB(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return qL(t)?t:null}}class uV extends gG{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view);const o={...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}};this.children=e.layer.map(((e,t)=>{if(Bj(e))return new uV(e,this,this.getName(`layer_${t}`),o,r);if(kB(e))return new lV(e,this,this.getName(`layer_${t}`),o,r);throw new Error(ER(e))}))}parseData(){this.component.data=IG(this);for(const e of this.children)e.parseData()}parseLayoutSize(){var e;RG(e=this),TG(e,"width"),TG(e,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of cO(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const r of e.children){r.parseAxesAndHeaders();for(const i of cO(r.component.axes))n.axis[i]=wW(e.component.resolve,i),"shared"===n.axis[i]&&(t[i]=XG(t[i],r.component.axes[i]),t[i]||(n.axis[i]="independent",delete t[i]))}for(const r of dN){for(const o of e.children)if(o.component.axes[r]){if("independent"===n.axis[r]){t[r]=(t[r]??[]).concat(o.component.axes[r]);for(const e of o.component.axes[r]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!nR(t)){if(i[t]>0&&!n){const n=VG[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}}delete o.component.axes[r]}if("independent"===n.axis[r]&&t[r]&&t[r].length>1)for(const[e,n]of(t[r]||[]).entries())e>0&&n.get("grid")&&!n.explicit.grid&&(n.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleSignals())),qU(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),pW(this))}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleGroupStyle(){const e=new Set;for(const n of this.children)for(const t of r(n.assembleGroupStyle()))e.add(t);const t=Array.from(e);return t.length>1?t:1===t.length?t[0]:void 0}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(const t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return function(e,t){for(const n of e.children)dG(n)&&(t=lq(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),PW(this))}}function cV(e,t,n,i,r){if($L(e))return new BG(e,t,n,r);if(Bj(e))return new uV(e,t,n,i,r);if(kB(e))return new lV(e,t,n,i,r);if(function(e){return yj(e)||vj(e)||gj(e)}(e))return new UG(e,t,n,r);throw new Error(ER(e))}const fV=IM,dV=Object.freeze(Object.defineProperty({__proto__:null,accessPathDepth:EO,accessPathWithDatum:vO,compile:function(e,t={}){var n;t.logger&&(n=t.logger,tT=n),t.fieldTitle&&ZL(t.fieldTitle);try{const n=zj(Ue(t.config,e.config)),i=NI(e,n),r=cV(i,null,"",void 0,n);r.parse(),function(e,t){CH(e.sources);let n=0,i=0;for(let r=0;r<5&&OH(e,t,!0);r++)n++;e.sources.map(DH);for(let r=0;r<5&&OH(e,t,!1);r++)i++;CH(e.sources),5===Math.max(n,i)&&nT("Maximum optimization runs(5) reached.")}(r.component.data,r);const o=function(e,t,n={},i){const r=e.config?Pj(e.config):void 0,o=[].concat(e.assembleSelectionData([]),function(e,t){const n=[],i=MG(n);let r=0;for(const a of e.sources){a.hasName()||(a.dataName="source_"+r++);const e=a.assemble();i(a,e)}for(const a of n)0===a.transform.length&&delete a.transform;let o=0;for(const[a,s]of n.entries())0!==(s.transform??[]).length||s.source||n.splice(o++,0,n.splice(a,1)[0]);for(const a of n)for(const t of a.transform??[])"lookup"===t.type&&(t.from=e.outputNodes[t.from].getSource());for(const a of n)a.name in t&&(a.values=t[a.name]);return n}(e.component.data,n)),a=e.assembleProjections(),s=e.assembleTitle(),l=e.assembleGroupStyle(),u=e.assembleGroupEncodeEntry(!0);let c=e.assembleLayoutSignals();c=c.filter((e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:f,...d}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...d,...s?{title:s}:{},...l?{style:l}:{},...u?{encode:{update:u}}:{},data:o,...a.length>0?{projections:a}:{},...e.assembleGroup([...c,...e.assembleSelectionTopLevelSignals([]),...mj(f)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}(r,function(e,t,n,i){const r=i.component.layoutSize.get("width"),o=i.component.layoutSize.get("height");void 0===t?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):oe(t)&&(t={type:t});if(r&&o&&(a=t.type,["fit","fit-x","fit-y"].includes(a)))if("step"===r&&"step"===o)nT(SR()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";nT(SR(gN(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${gN(e)}`:"fit"}(n)}var a;return{...1===cO(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t},...jI(n,!1),...jI(e,!0)}}(e,i.autosize,n,r),e.datasets,e.usermeta);return{spec:o,normalized:i}}finally{t.logger&&(tT=eT),t.fieldTitle&&ZL(QL)}},contains:ZM,deepEqual:zO,deleteNestedProperty:gO,duplicate:VM,entries:dO,every:tO,fieldIntersection:lO,flatAccessWithDatum:bO,getFirstDefined:$O,hasIntersection:aO,hasProperty:RO,hash:QM,internalField:SO,isBoolean:hO,isEmpty:uO,isEqual:function(e,t){const n=cO(e),i=cO(t);if(n.length!==i.length)return!1;for(const r of n)if(e[r]!==t[r])return!1;return!0},isInternalField:FO,isNullOrFalse:KM,isNumeric:MO,keys:cO,logicalExpr:mO,mergeDeep:nO,never:XM,normalize:NI,normalizeAngle:CO,omit:JM,pick:YM,prefixGenerator:sO,removePathFromField:kO,replaceAll:_O,replacePathInField:wO,resetIdCounter:function(){AO=42},setEqual:oO,some:eO,stringify:NO,titleCase:yO,unique:rO,uniqueId:DO,vals:fO,varName:pO,version:fV},Symbol.toStringTag,{value:"Module"}));function hV(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var pV="2.14.0";const mV="#fff",gV="#888",yV={background:"#333",view:{stroke:gV},title:{color:mV,subtitleColor:mV},style:{"guide-label":{fill:mV},"guide-title":{fill:mV}},axis:{domainColor:mV,gridColor:gV,tickColor:mV}},vV="#4572a7",bV={background:"#fff",arc:{fill:vV},area:{fill:vV},line:{stroke:vV,strokeWidth:2},path:{stroke:vV},rect:{fill:vV},shape:{stroke:vV},symbol:{fill:vV,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},xV="#30a2da",wV="#cbcbcb",_V="#f0f0f0",kV="#333",EV={arc:{fill:xV},area:{fill:xV},axis:{domainColor:wV,grid:!0,gridColor:wV,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:wV,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:_V,group:{fill:_V},legend:{labelColor:kV,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:kV,titleFontSize:14,titlePadding:10},line:{stroke:xV,strokeWidth:2},path:{stroke:xV,strokeWidth:.5},rect:{fill:xV},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:xV},bar:{binSpacing:2,fill:xV,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},$V="#000",AV={group:{fill:"#e5e5e5"},arc:{fill:$V},area:{fill:$V},line:{stroke:$V},path:{stroke:$V},rect:{fill:$V},shape:{stroke:$V},symbol:{fill:$V,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},DV="Benton Gothic, sans-serif",SV="#82c6df",FV="Benton Gothic Bold, sans-serif",CV="normal",MV={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]},OV={background:"#ffffff",title:{anchor:"start",color:"#000000",font:FV,fontSize:22,fontWeight:"normal"},arc:{fill:SV},area:{fill:SV},line:{stroke:SV,strokeWidth:2},path:{stroke:SV},rect:{fill:SV},shape:{stroke:SV},symbol:{fill:SV,size:30},axis:{labelFont:DV,labelFontSize:11.5,labelFontWeight:"normal",titleFont:FV,titleFontSize:13,titleFontWeight:CV},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:DV,labelFontSize:11.5,symbolType:"square",titleFont:FV,titleFontSize:13,titleFontWeight:CV},range:{category:MV["category-6"],diverging:MV["fireandice-6"],heatmap:MV["fire-7"],ordinal:MV["fire-7"],ramp:MV["fire-7"]}},zV="#ab5787",NV="#979797",RV={background:"#f9f9f9",arc:{fill:zV},area:{fill:zV},line:{stroke:zV},path:{stroke:zV},rect:{fill:zV},shape:{stroke:zV},symbol:{fill:zV,size:30},axis:{domainColor:NV,domainWidth:.5,gridWidth:.2,labelColor:NV,tickColor:NV,tickWidth:.2,titleColor:NV},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},TV="#3e5c69",PV={background:"#fff",arc:{fill:TV},area:{fill:TV},line:{stroke:TV},path:{stroke:TV},rect:{fill:TV},shape:{stroke:TV},symbol:{fill:TV},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},LV="#1696d2",BV="#000000",jV="Lato",IV="Lato",qV={"main-colors":["#1696d2","#d2d2d2","#000000","#fdbf11","#ec008b","#55b748","#5c5859","#db2b27"],"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"shades-gray":["#F5F5F5","#ECECEC","#E3E3E3","#DCDBDB","#D2D2D2","#9D9D9D","#696969","#353535"],"shades-yellow":["#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215"],"shades-magenta":["#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123"],"shades-green":["#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19"],"shades-black":["#D5D5D4","#ADABAC","#848081","#5C5859","#332D2F","#262223","#1A1717","#0E0C0D"],"shades-red":["#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A"],"one-group":["#1696d2","#000000"],"two-groups-cat-1":["#1696d2","#000000"],"two-groups-cat-2":["#1696d2","#fdbf11"],"two-groups-cat-3":["#1696d2","#db2b27"],"two-groups-seq":["#a2d4ec","#1696d2"],"three-groups-cat":["#1696d2","#fdbf11","#000000"],"three-groups-seq":["#a2d4ec","#1696d2","#0a4c6a"],"four-groups-cat-1":["#000000","#d2d2d2","#fdbf11","#1696d2"],"four-groups-cat-2":["#1696d2","#ec0008b","#fdbf11","#5c5859"],"four-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a"],"five-groups-cat-1":["#1696d2","#fdbf11","#d2d2d2","#ec008b","#000000"],"five-groups-cat-2":["#1696d2","#0a4c6a","#d2d2d2","#fdbf11","#332d2f"],"five-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a","#000000"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-cat-2":["#1696d2","#d2d2d2","#ec008b","#fdbf11","#332d2f","#0a4c6a"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},UV={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:jV},axisX:{domain:!0,domainColor:BV,domainWidth:1,grid:!1,labelFontSize:12,labelFont:IV,labelAngle:0,tickColor:BV,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:jV},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:IV,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:jV,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:IV,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:jV,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:qV["six-groups-cat-1"],diverging:qV["diverging-colors"],heatmap:qV["diverging-colors"],ordinal:qV["six-groups-seq"],ramp:qV["shades-blue"]},area:{fill:LV},rect:{fill:LV},line:{color:LV,stroke:LV,strokeWidth:5},trail:{color:LV,stroke:LV,strokeWidth:0,size:1},path:{stroke:LV,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:LV,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:LV,stroke:null}},arc:{fill:LV},shape:{stroke:LV},symbol:{fill:LV,size:30}},WV="#3366CC",HV="#ccc",GV="Arial, sans-serif",VV={arc:{fill:WV},area:{fill:WV},path:{stroke:WV},rect:{fill:WV},shape:{stroke:WV},symbol:{stroke:WV},circle:{fill:WV},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:GV,fontSize:12},"guide-title":{font:GV,fontSize:12},"group-title":{font:GV,fontSize:12}},title:{font:GV,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:HV,tickColor:HV,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},XV=e=>e*(1/3+1),YV=XV(9),JV=XV(10),QV=XV(12),KV="Segoe UI",ZV="wf_standard-font, helvetica, arial, sans-serif",eX="#252423",tX="#605E5C",nX="transparent",iX="#118DFF",rX="#DEEFFF",oX=[rX,iX],aX={view:{stroke:nX},background:nX,font:KV,header:{titleFont:ZV,titleFontSize:QV,titleColor:eX,labelFont:KV,labelFontSize:JV,labelColor:tX},axis:{ticks:!1,grid:!1,domain:!1,labelColor:tX,labelFontSize:YV,titleFont:ZV,titleColor:eX,titleFontSize:QV,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:iX},line:{stroke:iX,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:KV,fontSize:YV,fill:tX},arc:{fill:iX},area:{fill:iX,line:!0,opacity:.6},path:{stroke:iX},rect:{fill:iX},point:{fill:iX,filled:!0,size:75},shape:{stroke:iX},symbol:{fill:iX,strokeWidth:1.5,size:50},legend:{titleFont:KV,titleFontWeight:"bold",titleColor:tX,labelFont:KV,labelFontSize:JV,labelColor:tX,symbolType:"circle",symbolSize:75},range:{category:[iX,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:oX,heatmap:oX,ordinal:[rX,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",iX]}},sX='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',lX=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],uX=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function cX({type:e,background:t}){const n="dark"===e?"#161616":"#ffffff",i="dark"===e?"#f4f4f4":"#161616",r="dark"===e?"#d4bbff":"#6929c4";return{background:t,arc:{fill:r},area:{fill:r},path:{stroke:r},rect:{fill:r},shape:{stroke:r},symbol:{stroke:r},circle:{fill:r},view:{fill:n,stroke:n},group:{fill:n},title:{color:i,anchor:"start",dy:-15,fontSize:16,font:sX,fontWeight:600},axis:{labelColor:i,labelFontSize:12,grid:!0,gridColor:"#525252",titleColor:i,labelAngle:0},style:{"guide-label":{font:sX,fill:i,fontWeight:400},"guide-title":{font:sX,fill:i,fontWeight:400}},range:{category:"dark"===e?lX:uX,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const fX=cX({type:"light",background:"#ffffff"}),dX=cX({type:"light",background:"#f4f4f4"}),hX=cX({type:"dark",background:"#262626"}),pX=cX({type:"dark",background:"#161616"}),mX=pV,gX=Object.freeze(Object.defineProperty({__proto__:null,carbong10:dX,carbong100:pX,carbong90:hX,carbonwhite:fX,dark:yV,excel:bV,fivethirtyeight:EV,ggplot2:AV,googlecharts:VV,latimes:OV,powerbi:aX,quartz:RV,urbaninstitute:UV,version:mX,vox:PV},Symbol.toStringTag,{value:"Module"}));function yX(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,i){if("object"!=typeof i||null===i)return i;const r=t.indexOf(this)+1;return t.length=r,t.length>e?"[Object]":t.indexOf(i)>=0?"[Circular]":(t.push(i),i)}}(t))}var vX="#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n";const bX="vg-tooltip-element",xX={offsetX:10,offsetY:10,id:bX,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;")},maxDepth:2,formatTooltip:function(e,t,n){if(a(e))return`[${e.map((e=>t(oe(e)?e:yX(e,n)))).join(", ")}]`;if(re(e)){let i="";const{title:r,image:o,...a}=e;r&&(i+=`<h2>${t(r)}</h2>`),o&&(i+=`<img src="${t(o)}">`);const s=Object.keys(a);if(s.length>0){i+="<table>";for(const e of s){let r=a[e];void 0!==r&&(re(r)&&(r=yX(r,n)),i+=`<tr><td class="key">${t(e)}</td><td class="value">${t(r)}</td></tr>`)}i+="</table>"}return i||"{}"}return t(e)}};class wX{constructor(e){this.options={...xX,...e};const t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return vX.toString().replace(bX,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,i){if(this.el=document.getElementById(this.options.id),!this.el){this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip");(document.fullscreenElement??document.body).appendChild(this.el)}if(null==i||""===i)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(i,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:r,y:o}=function(e,t,n,i){let r=e.clientX+n;r+t.width>window.innerWidth&&(r=+e.clientX-n-t.width);let o=e.clientY+i;return o+t.height>window.innerHeight&&(o=+e.clientY-i-t.height),{x:r,y:o}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.style.top=`${o}px`,this.el.style.left=`${r}px`}}var _X,kX,EX={};function $X(e){return($X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function AX(e){var t=function(e,t){if("object"!==$X(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==$X(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===$X(t)?t:String(t)}function DX(e,t,n){return(t=AX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SX(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var FX=CX;function CX(e){var t=this;if(t instanceof CX||(t=new CX),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var n=0,i=arguments.length;n<i;n++)t.push(arguments[n]);return t}function MX(e,t,n){var i=t===e.head?new NX(n,null,t,e):new NX(n,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}function OX(e,t){e.tail=new NX(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function zX(e,t){e.head=new NX(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function NX(e,t,n,i){if(!(this instanceof NX))return new NX(e,t,n,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}CX.Node=NX,CX.create=CX,CX.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},CX.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},CX.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},CX.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)OX(this,arguments[e]);return this.length},CX.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)zX(this,arguments[e]);return this.length},CX.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},CX.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},CX.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,i=0;null!==n;i++)e.call(t,n.value,i,this),n=n.next},CX.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,i=this.length-1;null!==n;i--)e.call(t,n.value,i,this),n=n.prev},CX.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&t<e;t++)n=n.next;if(t===e&&null!==n)return n.value},CX.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&t<e;t++)n=n.prev;if(t===e&&null!==n)return n.value},CX.prototype.map=function(e,t){t=t||this;for(var n=new CX,i=this.head;null!==i;)n.push(e.call(t,i.value,this)),i=i.next;return n},CX.prototype.mapReverse=function(e,t){t=t||this;for(var n=new CX,i=this.tail;null!==i;)n.push(e.call(t,i.value,this)),i=i.prev;return n},CX.prototype.reduce=function(e,t){var n,i=this.head;if(arguments.length>1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,n=this.head.value}for(var r=0;null!==i;r++)n=e(n,i.value,r),i=i.next;return n},CX.prototype.reduceReverse=function(e,t){var n,i=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,n=this.tail.value}for(var r=this.length-1;null!==i;r--)n=e(n,i.value,r),i=i.prev;return n},CX.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},CX.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},CX.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new CX;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,r=this.head;null!==r&&i<e;i++)r=r.next;for(;null!==r&&i<t;i++,r=r.next)n.push(r.value);return n},CX.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new CX;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,r=this.tail;null!==r&&i>t;i--)r=r.prev;for(;null!==r&&i>e;i--,r=r.prev)n.push(r.value);return n},CX.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,r=this.head;null!==r&&i<e;i++)r=r.next;var o=[];for(i=0;r&&i<t;i++)o.push(r.value),r=this.removeNode(r);null===r&&(r=this.tail),r!==this.head&&r!==this.tail&&(r=r.prev);for(i=0;i<n.length;i++)r=MX(this,r,n[i]);return o},CX.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){var i=n.prev;n.prev=n.next,n.next=i}return this.head=t,this.tail=e,this};try{(kX?_X:(kX=1,_X=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}))(CX)}catch(vJ){}const RX=FX,TX=Symbol("max"),PX=Symbol("length"),LX=Symbol("lengthCalculator"),BX=Symbol("allowStale"),jX=Symbol("maxAge"),IX=Symbol("dispose"),qX=Symbol("noDisposeOnSet"),UX=Symbol("lruList"),WX=Symbol("cache"),HX=Symbol("updateAgeOnGet"),GX=()=>1;const VX=(e,t,n)=>{const i=e[WX].get(t);if(i){const t=i.value;if(XX(e,t)){if(JX(e,i),!e[BX])return}else n&&(e[HX]&&(i.value.now=Date.now()),e[UX].unshiftNode(i));return t.value}},XX=(e,t)=>{if(!t||!t.maxAge&&!e[jX])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[jX]&&n>e[jX]},YX=e=>{if(e[PX]>e[TX])for(let t=e[UX].tail;e[PX]>e[TX]&&null!==t;){const n=t.prev;JX(e,t),t=n}},JX=(e,t)=>{if(t){const n=t.value;e[IX]&&e[IX](n.key,n.value),e[PX]-=n.length,e[WX].delete(n.key),e[UX].removeNode(t)}};class QX{constructor(e,t,n,i,r){this.key=e,this.value=t,this.length=n,this.now=i,this.maxAge=r||0}}const KX=(e,t,n,i)=>{let r=n.value;XX(e,r)&&(JX(e,n),e[BX]||(r=void 0)),r&&t.call(i,r.value,r.key,e)};var ZX=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[TX]=e.max||1/0;const t=e.length||GX;if(this[LX]="function"!=typeof t?GX:t,this[BX]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[jX]=e.maxAge||0,this[IX]=e.dispose,this[qX]=e.noDisposeOnSet||!1,this[HX]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[TX]=e||1/0,YX(this)}get max(){return this[TX]}set allowStale(e){this[BX]=!!e}get allowStale(){return this[BX]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[jX]=e,YX(this)}get maxAge(){return this[jX]}set lengthCalculator(e){"function"!=typeof e&&(e=GX),e!==this[LX]&&(this[LX]=e,this[PX]=0,this[UX].forEach((e=>{e.length=this[LX](e.value,e.key),this[PX]+=e.length}))),YX(this)}get lengthCalculator(){return this[LX]}get length(){return this[PX]}get itemCount(){return this[UX].length}rforEach(e,t){t=t||this;for(let n=this[UX].tail;null!==n;){const i=n.prev;KX(this,e,n,t),n=i}}forEach(e,t){t=t||this;for(let n=this[UX].head;null!==n;){const i=n.next;KX(this,e,n,t),n=i}}keys(){return this[UX].toArray().map((e=>e.key))}values(){return this[UX].toArray().map((e=>e.value))}reset(){this[IX]&&this[UX]&&this[UX].length&&this[UX].forEach((e=>this[IX](e.key,e.value))),this[WX]=new Map,this[UX]=new RX,this[PX]=0}dump(){return this[UX].map((e=>!XX(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[UX]}set(e,t,n){if((n=n||this[jX])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const i=n?Date.now():0,r=this[LX](t,e);if(this[WX].has(e)){if(r>this[TX])return JX(this,this[WX].get(e)),!1;const o=this[WX].get(e).value;return this[IX]&&(this[qX]||this[IX](e,o.value)),o.now=i,o.maxAge=n,o.value=t,this[PX]+=r-o.length,o.length=r,this.get(e),YX(this),!0}const o=new QX(e,t,r,i,n);return o.length>this[TX]?(this[IX]&&this[IX](e,t),!1):(this[PX]+=o.length,this[UX].unshift(o),this[WX].set(e,this[UX].head),YX(this),!0)}has(e){if(!this[WX].has(e))return!1;const t=this[WX].get(e).value;return!XX(this,t)}get(e){return VX(this,e,!0)}peek(e){return VX(this,e,!1)}pop(){const e=this[UX].tail;return e?(JX(this,e),e.value):null}del(e){JX(this,this[WX].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const i=e[n],r=i.e||0;if(0===r)this.set(i.k,i.v);else{const e=r-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[WX].forEach(((e,t)=>VX(this,t,!1)))}};const eY=Object.freeze({loose:!0}),tY=Object.freeze({});var nY=e=>e?"object"!=typeof e?eY:e:tY,iY={exports:{}};var rY={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};var oY="object"==typeof process&&EX&&EX.NODE_DEBUG&&/\bsemver\b/i.test(EX.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:r}=rY,o=oY,a=(t=e.exports={}).re=[],s=t.safeRe=[],l=t.src=[],u=t.t={};let c=0;const f="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",r],[f,i]],h=(e,t,n)=>{const i=(e=>{for(const[t,n]of d)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),r=c++;o(e,r,t),u[e]=r,l[r]=t,a[r]=new RegExp(t,n?"g":void 0),s[r]=new RegExp(i,n?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),h("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${l[u.NUMERICIDENTIFIER]}|${l[u.NONNUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NUMERICIDENTIFIERLOOSE]}|${l[u.NONNUMERICIDENTIFIER]})`),h("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${f}+`),h("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`),h("FULL",`^${l[u.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`),h("LOOSE",`^${l[u.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`),h("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`),h("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),h("COERCERTL",l[u.COERCE],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(iY,iY.exports);var aY=iY.exports;const sY=/^[0-9]+$/,lY=(e,t)=>{const n=sY.test(e),i=sY.test(t);return n&&i&&(e=+e,t=+t),e===t?0:n&&!i?-1:i&&!n?1:e<t?-1:1};var uY={compareIdentifiers:lY,rcompareIdentifiers:(e,t)=>lY(t,e)};const cY=oY,{MAX_LENGTH:fY,MAX_SAFE_INTEGER:dY}=rY,{safeRe:hY,t:pY}=aY,mY=nY,{compareIdentifiers:gY}=uY;var yY=class e{constructor(t,n){if(n=mY(n),t instanceof e){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>fY)throw new TypeError(`version is longer than ${fY} characters`);cY("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const i=t.trim().match(n.loose?hY[pY.LOOSE]:hY[pY.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>dY||this.major<0)throw new TypeError("Invalid major version");if(this.minor>dY||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>dY||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<dY)return t}return e})):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(cY("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if("string"==typeof t&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),gY(this.major,t.major)||gY(this.minor,t.minor)||gY(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const e=this.prerelease[n],i=t.prerelease[n];if(cY("prerelease compare",n,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return gY(e,i)}while(++n)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let n=0;do{const e=this.build[n],i=t.build[n];if(cY("prerelease compare",n,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return-1;if(e!==i)return gY(e,i)}while(++n)}inc(e,t,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(0===this.prerelease.length)this.prerelease=[e];else{let i=this.prerelease.length;for(;--i>=0;)"number"==typeof this.prerelease[i]&&(this.prerelease[i]++,i=-2);if(-1===i){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let i=[t,e];!1===n&&(i=[t]),0===gY(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const vY=yY;var bY=(e,t,n)=>new vY(e,n).compare(new vY(t,n));const xY=bY;const wY=bY;const _Y=bY;const kY=bY;const EY=bY;const $Y=bY;const AY=(e,t,n)=>0===xY(e,t,n),DY=(e,t,n)=>0!==wY(e,t,n),SY=(e,t,n)=>_Y(e,t,n)>0,FY=(e,t,n)=>kY(e,t,n)>=0,CY=(e,t,n)=>EY(e,t,n)<0,MY=(e,t,n)=>$Y(e,t,n)<=0;var OY,zY,NY,RY,TY=(e,t,n,i)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return AY(e,n,i);case"!=":return DY(e,n,i);case">":return SY(e,n,i);case">=":return FY(e,n,i);case"<":return CY(e,n,i);case"<=":return MY(e,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};function PY(){if(RY)return NY;RY=1;class e{constructor(t,r){if(r=n(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof i)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!h(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const t of this.set)if(1===t.length&&p(t[0])){this.set=[t];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const n=((this.options.includePrerelease&&f)|(this.options.loose&&d))+":"+e,o=t.get(n);if(o)return o;const p=this.options.loose,m=p?a[s.HYPHENRANGELOOSE]:a[s.HYPHENRANGE];e=e.replace(m,A(this.options.includePrerelease)),r("hyphen replace",e),e=e.replace(a[s.COMPARATORTRIM],l),r("comparator trim",e),e=e.replace(a[s.TILDETRIM],u),r("tilde trim",e),e=e.replace(a[s.CARETTRIM],c),r("caret trim",e);let y=e.split(" ").map((e=>g(e,this.options))).join(" ").split(/\s+/).map((e=>$(e,this.options)));p&&(y=y.filter((e=>(r("loose invalid filter",e,this.options),!!e.match(a[s.COMPARATORLOOSE]))))),r("range list",y);const v=new Map,b=y.map((e=>new i(e,this.options)));for(const t of b){if(h(t))return[t];v.set(t.value,t)}v.size>1&&v.has("")&&v.delete("");const x=[...v.values()];return t.set(n,x),x}intersects(t,n){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some((e=>m(e,n)&&t.set.some((t=>m(t,n)&&e.every((e=>t.every((t=>e.intersects(t,n)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new o(e,this.options)}catch(vJ){return!1}for(let t=0;t<this.set.length;t++)if(D(this.set[t],e,this.options))return!0;return!1}}NY=e;const t=new ZX({max:1e3}),n=nY,i=function(){if(zY)return OY;zY=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(i,r){if(r=n(r),i instanceof t){if(i.loose===!!r.loose)return i;i=i.value}i=i.trim().split(/\s+/).join(" "),a("comparator",i,r),this.options=r,this.loose=!!r.loose,this.parse(i),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){const n=this.options.loose?i[r.COMPARATORLOOSE]:i[r.COMPARATOR],o=t.match(n);if(!o)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==o[1]?o[1]:"","="===this.operator&&(this.operator=""),o[2]?this.semver=new s(o[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new s(t,this.options)}catch(vJ){return!1}return o(t,this.operator,this.semver,this.options)}intersects(e,i){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new l(e.value,i).test(this.value):""===e.operator?""===e.value||new l(this.value,i).test(e.semver):!((i=n(i)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!i.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(o(this.semver,"<",e.semver,i)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(o(this.semver,">",e.semver,i)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}OY=t;const n=nY,{safeRe:i,t:r}=aY,o=TY,a=oY,s=yY,l=PY();return OY}(),r=oY,o=yY,{safeRe:a,t:s,comparatorTrimReplace:l,tildeTrimReplace:u,caretTrimReplace:c}=aY,{FLAG_INCLUDE_PRERELEASE:f,FLAG_LOOSE:d}=rY,h=e=>"<0.0.0-0"===e.value,p=e=>""===e.value,m=(e,t)=>{let n=!0;const i=e.slice();let r=i.pop();for(;n&&i.length;)n=i.every((e=>r.intersects(e,t))),r=i.pop();return n},g=(e,t)=>(r("comp",e,t),e=x(e,t),r("caret",e),e=v(e,t),r("tildes",e),e=_(e,t),r("xrange",e),e=E(e,t),r("stars",e),e),y=e=>!e||"x"===e.toLowerCase()||"*"===e,v=(e,t)=>e.trim().split(/\s+/).map((e=>b(e,t))).join(" "),b=(e,t)=>{const n=t.loose?a[s.TILDELOOSE]:a[s.TILDE];return e.replace(n,((t,n,i,o,a)=>{let s;return r("tilde",e,t,n,i,o,a),y(n)?s="":y(i)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(o)?s=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(r("replaceTilde pr",a),s=`>=${n}.${i}.${o}-${a} <${n}.${+i+1}.0-0`):s=`>=${n}.${i}.${o} <${n}.${+i+1}.0-0`,r("tilde return",s),s}))},x=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{r("caret",e,t);const n=t.loose?a[s.CARETLOOSE]:a[s.CARET],i=t.includePrerelease?"-0":"";return e.replace(n,((t,n,o,a,s)=>{let l;return r("caret",e,t,n,o,a,s),y(n)?l="":y(o)?l=`>=${n}.0.0${i} <${+n+1}.0.0-0`:y(a)?l="0"===n?`>=${n}.${o}.0${i} <${n}.${+o+1}.0-0`:`>=${n}.${o}.0${i} <${+n+1}.0.0-0`:s?(r("replaceCaret pr",s),l="0"===n?"0"===o?`>=${n}.${o}.${a}-${s} <${n}.${o}.${+a+1}-0`:`>=${n}.${o}.${a}-${s} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${a}-${s} <${+n+1}.0.0-0`):(r("no pr"),l="0"===n?"0"===o?`>=${n}.${o}.${a}${i} <${n}.${o}.${+a+1}-0`:`>=${n}.${o}.${a}${i} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${a} <${+n+1}.0.0-0`),r("caret return",l),l}))},_=(e,t)=>(r("replaceXRanges",e,t),e.split(/\s+/).map((e=>k(e,t))).join(" ")),k=(e,t)=>{e=e.trim();const n=t.loose?a[s.XRANGELOOSE]:a[s.XRANGE];return e.replace(n,((n,i,o,a,s,l)=>{r("xRange",e,n,i,o,a,s,l);const u=y(o),c=u||y(a),f=c||y(s),d=f;return"="===i&&d&&(i=""),l=t.includePrerelease?"-0":"",u?n=">"===i||"<"===i?"<0.0.0-0":"*":i&&d?(c&&(a=0),s=0,">"===i?(i=">=",c?(o=+o+1,a=0,s=0):(a=+a+1,s=0)):"<="===i&&(i="<",c?o=+o+1:a=+a+1),"<"===i&&(l="-0"),n=`${i+o}.${a}.${s}${l}`):c?n=`>=${o}.0.0${l} <${+o+1}.0.0-0`:f&&(n=`>=${o}.${a}.0${l} <${o}.${+a+1}.0-0`),r("xRange return",n),n}))},E=(e,t)=>(r("replaceStars",e,t),e.trim().replace(a[s.STAR],"")),$=(e,t)=>(r("replaceGTE0",e,t),e.trim().replace(a[t.includePrerelease?s.GTE0PRE:s.GTE0],"")),A=e=>(t,n,i,r,o,a,s,l,u,c,f,d,h)=>`${n=y(i)?"":y(r)?`>=${i}.0.0${e?"-0":""}`:y(o)?`>=${i}.${r}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=y(u)?"":y(c)?`<${+u+1}.0.0-0`:y(f)?`<${u}.${+c+1}.0-0`:d?`<=${u}.${c}.${f}-${d}`:e?`<${u}.${c}.${+f+1}-0`:`<=${l}`}`.trim(),D=(e,t,n)=>{for(let i=0;i<e.length;i++)if(!e[i].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(r(e[n].semver),e[n].semver!==i.ANY&&e[n].semver.prerelease.length>0){const i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0};return NY}const LY=PY();var BY=SX(((e,t,n)=>{try{t=new LY(t,n)}catch(vJ){return!1}return t.test(e)}));var jY='.vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box;\n}\n.vega-embed.has-actions {\n padding-right: 38px;\n}\n.vega-embed details:not([open]) > :not(summary) {\n display: none !important;\n}\n.vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n cursor: pointer;\n line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n display: none;\n}\n.vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n width: 14px;\n height: 14px;\n}\n.vega-embed details[open] summary {\n opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus-within summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left;\n}\n.vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none;\n}\n.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {\n background-color: #f7f7f9;\n color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute;\n}\n.vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid rgba(0, 0, 0, 0);\n border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid rgba(0, 0, 0, 0);\n border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n height: 100%;\n}\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px;\n}\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n';function IY(e,...t){for(const n of t)qY(e,n);return e}function qY(e,t){for(const n of Object.keys(t))gt(e,n,t[n],!0)}function UY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function WY(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?UY(Object(n),!0).forEach((function(t){DX(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UY(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const HY=FM;let GY=dV;const VY="undefined"!=typeof window?window:void 0;void 0===GY&&(null==(e=null==VY?void 0:VY.vl)?void 0:e.compile)&&(GY=VY.vl);const XY={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},YY={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},JY={vega:"Vega","vega-lite":"Vega-Lite"},QY={vega:HY.version,"vega-lite":GY?GY.version:"not available"},KY={vega:e=>e,"vega-lite":(e,t)=>GY.compile(e,{config:t}).spec},ZY='\n<svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">\n <circle r="2" cy="8" cx="2"></circle>\n <circle r="2" cy="8" cx="8"></circle>\n <circle r="2" cy="8" cx="14"></circle>\n</svg>',eJ="chart-wrapper";function tJ(e,t,n,i){const r=`<html><head>${t}</head><body><pre><code class="json">`,o=`</code></pre>${n}</body></html>`,a=window.open("");a.document.write(r+e+o),a.document.title=`${JY[i]} JSON Source`}function nJ(e){return(t=e)&&"load"in t?e:HY.loader(e);var t}async function iJ(e,t,n={}){let i,r;oe(t)?(r=nJ(n.loader),i=JSON.parse(await r.load(t))):i=t;const o=function(e){var t;const n=(null==(t=e.usermeta)?void 0:t.embedOptions)??{};return oe(n.defaultStyle)&&(n.defaultStyle=!1),n}(i),a=o.loader;r&&!a||(r=nJ(n.loader??a));const s=await rJ(o,r),l=await rJ(n,r),u=WY(WY({},IY(l,s)),{},{config:Ue(l.config??{},s.config??{})});return await async function(e,t,n={},i){const r=n.theme?Ue(gX[n.theme],n.config??{}):n.config,o=ye(n.actions)?n.actions:IY({},XY,n.actions??{}),a=WY(WY({},YY),n.i18n),s=n.renderer??"canvas",l=n.logLevel??HY.Warn,u=n.downloadFileName??"visualization",c="string"==typeof e?document.querySelector(e):e;if(!c)throw new Error(`${e} does not exist`);if(!1!==n.defaultStyle){const e="vega-embed-style",{root:t,rootContainer:i}=function(e){const t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}(c);if(!t.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerHTML=void 0===n.defaultStyle||!0===n.defaultStyle?jY.toString():n.defaultStyle,i.appendChild(t)}}const f=function(e,t){if(e.$schema){const n=hV(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${JY[n.library]}, but mode argument sets ${JY[t]??t}.`);const i=n.library;return BY(QY[i],`^${n.version.slice(1)}`)||console.warn(`The input spec uses ${JY[i]} ${n.version}, but the current version of ${JY[i]} is v${QY[i]}.`),i}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":t??"vega"}(t,n.mode);let d=KY[f](t,r);if("vega-lite"===f&&d.$schema){const e=hV(d.$schema);BY(QY.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${QY.vega}.`)}c.classList.add("vega-embed"),o&&c.classList.add("has-actions");c.innerHTML="";let h=c;if(o){const e=document.createElement("div");e.classList.add(eJ),c.appendChild(e),h=e}const p=n.patch;p&&(d=p instanceof Function?p(d):Qi(d,p,!0,!1).newDocument);n.formatLocale&&HY.formatLocale(n.formatLocale);n.timeFormatLocale&&HY.timeFormatLocale(n.timeFormatLocale);if(n.expressionFunctions)for(const w in n.expressionFunctions){const e=n.expressionFunctions[w];"fn"in e?HY.expressionFunction(w,e.fn,e.visitor):e instanceof Function&&HY.expressionFunction(w,e)}const{ast:m}=n,g=HY.parse(d,"vega-lite"===f?{}:r,{ast:m}),y=new(n.viewClass||HY.View)(g,WY({loader:i,logLevel:l,renderer:s},m?{expr:HY.expressionInterpreter??n.expr??jM}:{}));if(y.addSignalListener("autosize",((e,t)=>{const{type:n}=t;"fit-x"==n?(h.classList.add("fit-x"),h.classList.remove("fit-y")):"fit-y"==n?(h.classList.remove("fit-x"),h.classList.add("fit-y")):"fit"==n?h.classList.add("fit-x","fit-y"):h.classList.remove("fit-x","fit-y")})),!1!==n.tooltip){const e="function"==typeof n.tooltip?n.tooltip:new wX(!0===n.tooltip?{}:n.tooltip).call;y.tooltip(e)}let v,{hover:b}=n;void 0===b&&(b="vega"===f);if(b){const{hoverSet:e,updateSet:t}="boolean"==typeof b?{}:b;y.hover(e,t)}n&&(null!=n.width&&y.width(n.width),null!=n.height&&y.height(n.height),null!=n.padding&&y.padding(n.padding));if(await y.initialize(h,n.bind).runAsync(),!1!==o){let e=c;if(!1!==n.defaultStyle||n.forceActionsMenu){const t=document.createElement("details");t.title=a.CLICK_TO_VIEW_ACTIONS,c.append(t),e=t;const n=document.createElement("summary");n.innerHTML=ZY,t.append(n),v=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",v)}const i=document.createElement("div");if(e.append(i),i.classList.add("vega-actions"),!0===o||!1!==o.export)for(const t of["svg","png"])if(!0===o||!0===o.export||o.export[t]){const e=a[`${t.toUpperCase()}_ACTION`],r=document.createElement("a"),o=re(n.scaleFactor)?n.scaleFactor[t]:n.scaleFactor;r.text=e,r.href="#",r.target="_blank",r.download=`${u}.${t}`,r.addEventListener("mousedown",(async function(e){e.preventDefault();const n=await y.toImageURL(t,o);this.href=n})),i.append(r)}if(!0===o||!1!==o.source){const e=document.createElement("a");e.text=a.SOURCE_ACTION,e.href="#",e.addEventListener("click",(function(e){tJ(ur(t),n.sourceHeader??"",n.sourceFooter??"",f),e.preventDefault()})),i.append(e)}if("vega-lite"===f&&(!0===o||!1!==o.compiled)){const e=document.createElement("a");e.text=a.COMPILED_ACTION,e.href="#",e.addEventListener("click",(function(e){tJ(ur(d),n.sourceHeader??"",n.sourceFooter??"","vega"),e.preventDefault()})),i.append(e)}if(!0===o||!1!==o.editor){const e=n.editorUrl??"https://vega.github.io/editor/",o=document.createElement("a");o.text=a.EDITOR_ACTION,o.href="#",o.addEventListener("click",(function(n){!function(e,t,n){const i=e.open(t),{origin:r}=new URL(t);let o=40;e.addEventListener("message",(function t(n){n.source===i&&(o=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){o<=0||(i.postMessage(n,r),setTimeout(e,250),o-=1)}),250)}(window,e,{config:r,mode:f,renderer:s,spec:ur(t)}),n.preventDefault()})),i.append(o)}}function x(){v&&document.removeEventListener("click",v),y.finalize()}return{view:y,spec:t,vgSpec:d,finalize:x,embedOptions:n}}(e,i,u,r)}async function rJ(e,t){const n=oe(e.config)?JSON.parse(await t.load(e.config)):e.config??{},i=oe(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return WY(WY(WY({},e),i?{patch:i}:{}),n?{config:n}:{})}function oJ(e,t){Object.keys(t).forEach((n=>{!function(e,t,n){var i;n&&((i=n)&&"[object Function]"==={}.toString.call(i)?n(e.data(t)):e.change(t,HY.changeset().remove((()=>!0)).insert(n)))}(e,n,t[n])}))}function aJ(e){const t=new Set;return e.forEach((e=>{Object.keys(e).forEach((e=>{t.add(e)}))})),t}const sJ=()=>{};function lJ(e,t){const n=Object.keys(t);return n.forEach((n=>{try{e.addSignalListener(n,t[n])}catch(i){console.warn("Cannot add invalid signal listener.",i)}})),n.length>0}function uJ(e,t){const n=Object.keys(t);return n.forEach((n=>{try{e.removeSignalListener(n,t[n])}catch(i){console.warn("Cannot remove invalid signal listener.",i)}})),n.length>0}function cJ(e){const{spec:t,width:n,height:i}=e;return void 0!==n&&void 0!==i?{...t,width:n,height:i}:void 0!==n?{...t,width:n}:void 0!==i?{...t,height:i}:t}function fJ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class dJ extends yt.PureComponent{constructor(){super(...arguments),fJ(this,"containerRef",yt.createRef()),fJ(this,"resultPromise",void 0),fJ(this,"handleError",(e=>{const{onError:t=sJ}=this.props;t(e,this.containerRef.current),console.warn(e)})),fJ(this,"modifyView",(e=>{this.resultPromise&&this.resultPromise.then((t=>(t&&e(t.view),!0))).catch(this.handleError)}))}componentDidMount(){this.createView()}componentDidUpdate(e){const t=aJ([this.props,e]);if(t.delete("className"),t.delete("signalListeners"),t.delete("spec"),t.delete("style"),t.delete("width"),t.delete("height"),Array.from(t).some((t=>this.props[t]!==e[t])))this.clearView(),this.createView();else{const t=function(e,t){if(e===t)return!1;const n={width:!1,height:!1,isExpensive:!1},i=aJ([e,t]);return!i.has("width")||"width"in e&&"width"in t&&e.width===t.width||("width"in e&&"number"==typeof e.width?n.width=e.width:n.isExpensive=!0),!i.has("height")||"height"in e&&"height"in t&&e.height===t.height||("height"in e&&"number"==typeof e.height?n.height=e.height:n.isExpensive=!0),i.delete("width"),i.delete("height"),[...i].some((n=>!(n in e)||!(n in t)||!ii(e[n],t[n])))&&(n.isExpensive=!0),!(!1===n.width&&!1===n.height&&!n.isExpensive)&&n}(cJ(this.props),cJ(e)),{signalListeners:n}=this.props,{signalListeners:i}=e;if(t)if(t.isExpensive)this.clearView(),this.createView();else{const e=!zi(n,i);this.modifyView((r=>{!1!==t.width&&r.width(t.width),!1!==t.height&&r.height(t.height),e&&(i&&uJ(r,i),n&&lJ(r,n)),r.run()}))}else zi(n,i)||this.modifyView((e=>{i&&uJ(e,i),n&&lJ(e,n),e.run()}))}}componentWillUnmount(){this.clearView()}createView(){const{spec:e,onNewView:t,signalListeners:n={},width:i,height:r,...o}=this.props;if(this.containerRef.current){const e=cJ(this.props);this.resultPromise=iJ(this.containerRef.current,e,o).then((e=>{if(e){const{view:t}=e;lJ(t,n)&&t.run()}return e})).catch(this.handleError),t&&this.modifyView(t)}}clearView(){return this.resultPromise&&this.resultPromise.then((e=>{e&&e.finalize()})).catch(this.handleError),this.resultPromise=void 0,this}render(){const{className:e,style:t}=this.props;return yt.createElement("div",{ref:this.containerRef,className:e,style:t})}}function hJ(){return hJ=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},hJ.apply(this,arguments)}function pJ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}fJ(dJ,"propTypes",{className:vt.string,onError:vt.func});class mJ extends yt.PureComponent{constructor(){super(...arguments),pJ(this,"vegaEmbed",yt.createRef()),pJ(this,"handleNewView",(e=>{this.update();const{onNewView:t=sJ}=this.props;t(e)}))}componentDidMount(){this.update()}componentDidUpdate(e){zi(this.props.data,e.data)||this.update()}update(){const{data:e}=this.props;this.vegaEmbed.current&&e&&Object.keys(e).length>0&&this.vegaEmbed.current.modifyView((t=>{oJ(t,e),t.resize().run()}))}render(){const{data:e,...t}=this.props;return yt.createElement(dJ,hJ({ref:this.vegaEmbed},t,{onNewView:this.handleNewView}))}}function gJ(){return gJ=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},gJ.apply(this,arguments)}function yJ(e){return yt.createElement(mJ,gJ({},e,{mode:"vega-lite"}))}pJ(mJ,"defaultProps",{data:{}});export{_P as M,SN as N,mJ as V,yJ as a,ZM as c,IN as i};