@marimo-team/frontend 0.12.9-dev2 → 0.12.9-dev24

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 (136) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-istJv_UB.js → ConnectedDataExplorerComponent-1WOR4L4q.js} +1 -1
  2. package/dist/assets/VegaLite-CVyDrbx6.js +11 -0
  3. package/dist/assets/_baseEach-B-1fmTcv.js +1 -0
  4. package/dist/assets/_baseMap-D1Qznpme.js +1 -0
  5. package/dist/assets/_baseUniq-Br5wKJvi.js +1 -0
  6. package/dist/assets/{any-language-editor-D3JbnhQs.js → any-language-editor-Ckz6Tt_H.js} +1 -1
  7. package/dist/assets/{arc-B5qYPUYs.js → arc-cUKDg37C.js} +1 -1
  8. package/dist/assets/architectureDiagram-IEHRJDOE-Cy4PwpJi.js +1 -0
  9. package/dist/assets/blockDiagram-JOT3LUYC-DqAX_ZTr.js +1 -0
  10. package/dist/assets/c4Diagram-VJAJSXHY-BiTnYfWI.js +1 -0
  11. package/dist/assets/channel-BjA6dlI2.js +1 -0
  12. package/dist/assets/chart-spec-NBjq86uR.js +1 -0
  13. package/dist/assets/{chunk-4BMEZGHF-SIOl3E5i.js → chunk-4BMEZGHF-SgreK5wm.js} +1 -1
  14. package/dist/assets/{chunk-A2AXSNBT-BWn-UB6A.js → chunk-A2AXSNBT-BCdJQ7v1.js} +1 -1
  15. package/dist/assets/{chunk-AEK57VVT-nnTw4HJP.js → chunk-AEK57VVT-IZckWVS4.js} +1 -1
  16. package/dist/assets/{chunk-D6G4REZN-C9kmIC2s.js → chunk-D6G4REZN-BViJk0j3.js} +1 -1
  17. package/dist/assets/{chunk-RZ5BOZE2-CWqsRpa0.js → chunk-RZ5BOZE2-DUEyb94H.js} +1 -1
  18. package/dist/assets/{chunk-XZIHB7SX-DoqEZmhe.js → chunk-XZIHB7SX-CcE3MNM7.js} +1 -1
  19. package/dist/assets/circle-play-Cs_xPlKO.js +7 -0
  20. package/dist/assets/classDiagram-GIVACNV2-E01SG9OW.js +1 -0
  21. package/dist/assets/classDiagram-v2-COTLJTTW-E01SG9OW.js +1 -0
  22. package/dist/assets/clone-Erh-lipZ.js +1 -0
  23. package/dist/assets/compile-DCx3dGoa.js +1 -0
  24. package/dist/assets/dagre-OKDRZEBW-LAkxQF3O.js +1 -0
  25. package/dist/assets/data-editor-BBJPZKfI.js +1 -0
  26. package/dist/assets/diagram-SSKATNLV-BljgJR7o.js +1 -0
  27. package/dist/assets/diagram-VNBRO52H-C49oChbq.js +1 -0
  28. package/dist/assets/edit-page-2Kt3vfqC.js +8 -0
  29. package/dist/assets/erDiagram-Q7BY3M3F-CaIKNkin.js +1 -0
  30. package/dist/assets/flowDiagram-4HSFHLVR-D5rTlj9W.js +1 -0
  31. package/dist/assets/ganttDiagram-APWFNJXF-zR1_vMpJ.js +1 -0
  32. package/dist/assets/gitGraphDiagram-7IBYFJ6S-BAGJuGGB.js +1 -0
  33. package/dist/assets/{graph-09HW66IM.js → graph-Br4o8jnj.js} +1 -1
  34. package/dist/assets/home-page-BqQ5fDgb.js +7 -0
  35. package/dist/assets/{index-JYQIs3XR.js → index-BcuYf2h_.js} +1 -1
  36. package/dist/assets/index-BvUCu8er.css +1 -0
  37. package/dist/assets/{index-DhV4WwhG.js → index-C52zwCtA.js} +1 -1
  38. package/dist/assets/{index-Bt9Dr2Me.js → index-C5ehTg0q.js} +1 -1
  39. package/dist/assets/index-CGSGM4Ci.js +1 -0
  40. package/dist/assets/index-CcdKRCtM.js +1 -0
  41. package/dist/assets/index-CsGTvBMV.js +80 -0
  42. package/dist/assets/{index-BYdDs8x9.js → index-D4cBysw6.js} +1 -1
  43. package/dist/assets/{index-D1sfa0iq.js → index-DCVBcN2Y.js} +1 -1
  44. package/dist/assets/index-DV8eX7G3.js +1 -0
  45. package/dist/assets/{index-Cw7P1ss8.js → index-Db2RdCTW.js} +1 -1
  46. package/dist/assets/{index-DFC-GZya.js → index-DicQt-se.js} +1 -1
  47. package/dist/assets/{index-CyyigBS9.js → index-_0Ju963j.js} +1 -1
  48. package/dist/assets/{index-EefxvYsv.js → index-kxFn8LYh.js} +1 -1
  49. package/dist/assets/{index-Dg2u2pdm.js → index-lLgURsSx.js} +1 -1
  50. package/dist/assets/{index-BHyReRUl.js → index-trC1CIeV.js} +1 -1
  51. package/dist/assets/index-yV-MGwPb.js +1 -0
  52. package/dist/assets/{index-BPYwrcms.js → index-yuN8txY8.js} +1 -1
  53. package/dist/assets/infoDiagram-PH2N3AL5-CKtVGW_B.js +1 -0
  54. package/dist/assets/journeyDiagram-U35MCT3I-BOc4NkrP.js +1 -0
  55. package/dist/assets/kanban-definition-NDS4AKOZ-Df_4qNc4.js +1 -0
  56. package/dist/assets/{layout-2mc1h6iv.js → layout-_qWD0ITP.js} +1 -1
  57. package/dist/assets/linear-B8qjAYfM.js +1 -0
  58. package/dist/assets/{mermaid-Ix95NAzI.js → mermaid-uuycWAqj.js} +2 -2
  59. package/dist/assets/min-lRkZowff.js +1 -0
  60. package/dist/assets/mindmap-definition-ALO5MXBD-916aPFYT.js +1 -0
  61. package/dist/assets/pieDiagram-IB7DONF6-Cv7WX76E.js +1 -0
  62. package/dist/assets/quadrantDiagram-7GDLP6J5-CDymbRyt.js +1 -0
  63. package/dist/assets/{radar-MK3ICKWK-C8eh3l4l.js → radar-MK3ICKWK-CV-pAvE_.js} +1 -1
  64. package/dist/assets/{react-plotly-B-G-2H-u.js → react-plotly-D1ih8LFH.js} +1 -1
  65. package/dist/assets/requirementDiagram-KVF5MWMF-DXl7cwkl.js +1 -0
  66. package/dist/assets/run-page-yniJR1DB.js +1 -0
  67. package/dist/assets/sankeyDiagram-QLVOVGJD-Dedc_7tx.js +1 -0
  68. package/dist/assets/sequenceDiagram-X6HHIX6F-C9YM6hdZ.js +1 -0
  69. package/dist/assets/slides-component-DThWEbQn.js +1 -0
  70. package/dist/assets/{sortBy-DXHjUsXo.js → sortBy-CEpekLd4.js} +1 -1
  71. package/dist/assets/stateDiagram-DGXRK772-Bnv-RquH.js +1 -0
  72. package/dist/assets/stateDiagram-v2-YXO3MK2T-ByP-r4Vl.js +1 -0
  73. package/dist/assets/step-5BjdtTEt.js +1 -0
  74. package/dist/assets/{terminal-OZpu1kLk.js → terminal--RkJJp4_.js} +1 -1
  75. package/dist/assets/time-DWYZmva_.js +1 -0
  76. package/dist/assets/timeline-definition-BDJGKUSR-D6-K4xl7.js +1 -0
  77. package/dist/assets/timer-DFzT7np-.js +1 -0
  78. package/dist/assets/tracing-KBC5Rih3.js +8 -0
  79. package/dist/assets/transform-DjHZbYKP.js +1 -0
  80. package/dist/assets/tree-BJBMG0ej.js +8 -0
  81. package/dist/assets/{useMarimoWebSocket-BX_wqRHE.js → useMarimoWebSocket-nmAkqHTN.js} +4 -4
  82. package/dist/assets/vega-component-DeZm0f2_.js +1 -0
  83. package/dist/assets/xychartDiagram-VJFVF3MP-CUX71FkW.js +1 -0
  84. package/dist/assets/zoom-COrs4lFh.js +1 -0
  85. package/dist/index.html +2 -2
  86. package/package.json +1 -1
  87. package/dist/assets/VegaLite-Bif5GsmA.js +0 -11
  88. package/dist/assets/_baseEach-CK-6xWq3.js +0 -1
  89. package/dist/assets/_baseMap-FtNH_qsX.js +0 -1
  90. package/dist/assets/_baseUniq-BE8Jj2c-.js +0 -1
  91. package/dist/assets/architectureDiagram-IEHRJDOE-kJDHme_f.js +0 -1
  92. package/dist/assets/blockDiagram-JOT3LUYC-CiF-8Jvd.js +0 -1
  93. package/dist/assets/c4Diagram-VJAJSXHY-Dtm89Kd9.js +0 -1
  94. package/dist/assets/channel-B1yplJGU.js +0 -1
  95. package/dist/assets/classDiagram-GIVACNV2-CYxdhreX.js +0 -1
  96. package/dist/assets/classDiagram-v2-COTLJTTW-CYxdhreX.js +0 -1
  97. package/dist/assets/clone-V_fgfffn.js +0 -1
  98. package/dist/assets/compile-B3BKXRp8.js +0 -1
  99. package/dist/assets/dagre-OKDRZEBW-Cj_CLpiE.js +0 -1
  100. package/dist/assets/data-editor-N8x2VMuB.js +0 -1
  101. package/dist/assets/diagram-SSKATNLV-CdD3Q-9b.js +0 -1
  102. package/dist/assets/diagram-VNBRO52H-CJYPImT8.js +0 -1
  103. package/dist/assets/edit-page-HX1_5YHk.js +0 -8
  104. package/dist/assets/erDiagram-Q7BY3M3F-BKkG760f.js +0 -1
  105. package/dist/assets/flowDiagram-4HSFHLVR-CZVmlMUx.js +0 -1
  106. package/dist/assets/ganttDiagram-APWFNJXF-BIylO8if.js +0 -1
  107. package/dist/assets/gitGraphDiagram-7IBYFJ6S-DpKV1P_B.js +0 -1
  108. package/dist/assets/home-page-DzUani_D.js +0 -7
  109. package/dist/assets/index-C9FDJL8i.css +0 -1
  110. package/dist/assets/index-CGFEuydC.js +0 -80
  111. package/dist/assets/index-CL-t3Tji.js +0 -1
  112. package/dist/assets/index-CwGsMMGq.js +0 -1
  113. package/dist/assets/index-DcJ-bhO5.js +0 -1
  114. package/dist/assets/index-DsyWbcNu.js +0 -1
  115. package/dist/assets/infoDiagram-PH2N3AL5-BncHcRnE.js +0 -1
  116. package/dist/assets/journeyDiagram-U35MCT3I--liro2NZ.js +0 -1
  117. package/dist/assets/kanban-definition-NDS4AKOZ-9VwEA4DC.js +0 -1
  118. package/dist/assets/linear-Dww2dxfj.js +0 -1
  119. package/dist/assets/min-DZjVr_dc.js +0 -1
  120. package/dist/assets/mindmap-definition-ALO5MXBD-BKKH2D_V.js +0 -1
  121. package/dist/assets/pieDiagram-IB7DONF6-Dfyd04pQ.js +0 -1
  122. package/dist/assets/quadrantDiagram-7GDLP6J5-BdYpCVYQ.js +0 -1
  123. package/dist/assets/requirementDiagram-KVF5MWMF-RVmzHCpk.js +0 -1
  124. package/dist/assets/run-page-fnwo0Pap.js +0 -1
  125. package/dist/assets/sankeyDiagram-QLVOVGJD-CpG1o61A.js +0 -1
  126. package/dist/assets/sequenceDiagram-X6HHIX6F-BPC_RCpT.js +0 -1
  127. package/dist/assets/slides-component-B_RQHaVA.js +0 -1
  128. package/dist/assets/stateDiagram-DGXRK772-BQy52Fpn.js +0 -1
  129. package/dist/assets/stateDiagram-v2-YXO3MK2T-COEJEylu.js +0 -1
  130. package/dist/assets/step-xJWGRC3d.js +0 -1
  131. package/dist/assets/time-Cy6KrIdJ.js +0 -1
  132. package/dist/assets/timeline-definition-BDJGKUSR-BqYGFq_H.js +0 -1
  133. package/dist/assets/transform-CdY8z5kT.js +0 -1
  134. package/dist/assets/tree-D9cxvmYe.js +0 -8
  135. package/dist/assets/vega-component-NPMGqqjW.js +0 -1
  136. package/dist/assets/xychartDiagram-VJFVF3MP-DSKQBuGh.js +0 -1
@@ -1 +0,0 @@
1
- import{ci as e,gd as t,ge as n,ct as i,gf as r,gg as a,cu as o,cx as s,cw as u,cs as l,gh as c,gi as f,gj as d,gk as h,gl as p,gm as m,gn as g,go as y,gp as v,gq as b,gr as x,gs as w,gt as _,gu as A,gv as k,gw as D,gx as F,gy as C,gz as E,gA as $,gB as S,gC as M,gD as B,gE as z,gF as O,gG as N,gH as R,gI as T,gJ as P,gK as j,aD as L,gL as q,gM as U,gN as I,gO as W,gP as H,gQ as G,gR as V,gS as Y,gT as X,cp as J,cj as Q,co as K,gU as Z,aE as ee,aO as te,aP as ne,gV as ie,aR as re,aS as ae,aT as oe,gW as se,gX as ue,gY as le,gZ as ce,g_ as fe,g$ as de,h0 as he,h1 as pe,aM as me,h2 as ge,h3 as ye,h4 as ve,h5 as be,h6 as xe,h7 as we,h8 as _e,h9 as Ae,ha as ke,hb as De,hc as Fe,hd as Ce,he as Ee,hf as $e,hg as Se,hh as Me,hi as Be,hj as ze,hk as Oe,hl as Ne,hm as Re,hn as Te,ho as Pe,hp as je,hq as Le,hr as qe,hs as Ue,cv as Ie,ht as We,hu as He,hv as Ge,hw as Ve,hx as Ye,hy as Xe,hz as Je,hA as Qe,hB as Ke,hC as Ze,hD as et,hE as tt,hF as nt,hG as it,hH as rt,hI as at,hJ as ot,aq as st,hK as ut,hL as lt,hM as ct,hN as ft,hO as dt,hP as ht,hQ as pt}from"./index-CGFEuydC.js";import{m as mt,a as gt,d as yt,r as vt,l as bt,i as xt,h as wt,n as _t,c as At,u as kt,b as Dt,t as Ft,e as Ct}from"./time-Cy6KrIdJ.js";import{n as Et,b as $t,i as St,d as Mt,e as Bt,f as zt,o as Ot,g as Nt,h as Rt,j as Tt,t as Pt,a as jt,k as Lt,m as qt,l as Ut,p as It,q as Wt}from"./linear-Dww2dxfj.js";import{r as Ht}from"./range-CtcPcB_L.js";import{R as Gt,r as Vt,o as Yt,q as Xt,$ as Jt,a0 as Qt,C as Kt,v as Zt,a1 as en,u as tn,a2 as nn,a3 as rn,y as an,z as on,a4 as sn,a5 as un,A as ln,Z as cn,Y as fn,V as dn,_ as hn,w as pn,b as mn,K as gn,a6 as yn,a7 as vn,n as bn,l as xn,d as wn,t as _n,p as An,D as kn,E as Dn,F as Fn,G as Cn,I as En,H as $n,J as Sn,M as Mn,N as Bn,L as zn,Q as On,P as Nn,O as Rn,S as Tn,T as Pn,U as jn,k as Ln,a8 as qn,a9 as Un,W as In,X as Wn}from"./step-xJWGRC3d.js";import{i as Hn,a as Gn}from"./init-DLRA0X12.js";import{I as Vn,o as Yn,i as Xn}from"./ordinal-DDUp3AbE.js";import{c as Jn}from"./colors-bszWmPJw.js";import{d as Qn}from"./arc-B5qYPUYs.js";class Kn{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],a=e+r,o=Math.abs(e)<Math.abs(r)?e-(a-r):r-(a-e);o&&(t[n++]=o),e=a}return t[n]=e,this._n=n+1,this}valueOf(){const e=this._partials;let t,n,i,r=this._n,a=0;if(r>0){for(a=e[--r];r>0&&(t=a,n=e[--r],a=t+n,i=n-(a-t),!i););r>0&&(i<0&&e[r-1]<0||i>0&&e[r-1]>0)&&(n=2*i,t=a+n,n==t-a&&(a=t))}return a}}function Zn(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:e>t?1:0)}function ei(t,n,i=0,r=1/0,a){if(n=Math.floor(n),i=Math.floor(Math.max(0,i)),r=Math.floor(Math.min(t.length-1,r)),!(i<=n&&n<=r))return t;for(a=void 0===a?Zn:function(t=e){if(t===e)return Zn;if("function"!=typeof t)throw new TypeError("compare is not a function");return(e,n)=>{const i=t(e,n);return i||0===i?i:(0===t(n,n))-(0===t(e,e))}}(a);r>i;){if(r-i>600){const e=r-i+1,o=n-i+1,s=Math.log(e),u=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*u*(e-u)/e)*(o-e/2<0?-1:1);ei(t,n,Math.max(i,Math.floor(n-o*u/e+l)),Math.min(r,Math.floor(n+(e-o)*u/e+l)),a)}const e=t[n];let o=i,s=r;for(ti(t,i,n),a(t[r],e)>0&&ti(t,i,r);o<s;){for(ti(t,o,s),++o,--s;a(t[o],e)<0;)++o;for(;a(t[s],e)>0;)--s}0===a(t[i],e)?ti(t,i,s):(++s,ti(t,s,r)),s<=n&&(i=s+1),n<=s&&(r=s-1)}return t}function ti(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function ni(e,t,n){if((i=(e=Float64Array.from(Et(e,n))).length)&&!isNaN(t=+t)){if(t<=0||i<2)return mt(e);if(t>=1)return gt(e);var i,r=(i-1)*t,a=Math.floor(r),o=gt(ei(e,a).subarray(0,a+1));return o+(mt(e.subarray(a+1))-o)*(r-a)}}function ii(e,t,n=$t){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,a=Math.floor(r),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(r-a)}}function ri(e,t){return ni(e,.5,t)}function ai(e){return Array.from(function*(e){for(const t of e)yield*t}(e))}function oi(e,t){let n=0;for(let i of e)(i=+i)&&(n+=i);return n}function si(e){return e instanceof Vn?e:new Vn(e)}var ui=-.14861,li=1.78277,ci=-.29227,fi=-.90649,di=1.97294,hi=di*fi,pi=di*li,mi=li*ci-fi*ui;function gi(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof yi)return new yi(e.h,e.s,e.l,e.opacity);e instanceof Gt||(e=Vt(e));var t=e.r/255,n=e.g/255,i=e.b/255,r=(mi*i+hi*t-pi*n)/(mi+hi-pi),a=i-r,o=(di*(n-r)-ci*a)/fi,s=Math.sqrt(o*o+a*a)/(di*r*(1-r)),u=s?Math.atan2(o,a)*yt-120:NaN;return new yi(u<0?u+360:u,s,r,e.opacity)}(e):new yi(e,t,n,null==i?1:i)}function yi(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}Yt(yi,gi,Xt(Kt,{brighter(e){return e=null==e?Qt:Math.pow(Qt,e),new yi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Jt:Math.pow(Jt,e),new yi(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*vt,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),i=Math.cos(e),r=Math.sin(e);return new Gt(255*(t+n*(ui*i+li*r)),255*(t+n*(ci*i+fi*r)),255*(t+n*(di*i)),this.opacity)}}));function vi(e){return((e=Math.exp(e))+1/e)/2}const bi=function e(t,n,i){function r(e,r){var a,o,s=e[0],u=e[1],l=e[2],c=r[0],f=r[1],d=r[2],h=c-s,p=f-u,m=h*h+p*p;if(m<1e-12)o=Math.log(d/l)/t,a=function(e){return[s+e*h,u+e*p,l*Math.exp(t*e*o)]};else{var g=Math.sqrt(m),y=(d*d-l*l+i*m)/(2*l*n*g),v=(d*d-l*l-i*m)/(2*d*n*g),b=Math.log(Math.sqrt(y*y+1)-y),x=Math.log(Math.sqrt(v*v+1)-v);o=(x-b)/t,a=function(e){var i,r=e*o,a=vi(b),c=l/(n*g)*(a*(i=t*r+b,((i=Math.exp(2*i))-1)/(i+1))-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[s+c*h,u+c*p,l*a/vi(t*r+b)]}}return a.duration=1e3*o*t/Math.SQRT2,a}return r.rho=function(t){var n=Math.max(.001,+t),i=n*n;return e(n,i,i*i)},r}(Math.SQRT2,2,4);function xi(e){return function(t,n){var i=e((t=en(t)).h,(n=en(n)).h),r=tn(t.s,n.s),a=tn(t.l,n.l),o=tn(t.opacity,n.opacity);return function(e){return t.h=i(e),t.s=r(e),t.l=a(e),t.opacity=o(e),t+""}}}const wi=xi(Zt);var _i=xi(tn);function Ai(e){return function t(n){function i(t,i){var r=e((t=gi(t)).h,(i=gi(i)).h),a=tn(t.s,i.s),o=tn(t.l,i.l),s=tn(t.opacity,i.opacity);return function(e){return t.h=r(e),t.s=a(e),t.l=o(Math.pow(e,n)),t.opacity=s(e),t+""}}return n=+n,i.gamma=t,i}(1)}const ki=Ai(Zt);var Di=Ai(tn);function Fi(e,t){void 0===t&&(t=e,e=St);for(var n=0,i=t.length-1,r=t[0],a=new Array(i<0?0:i);n<i;)a[n]=e(r,r=t[++n]);return function(e){var t=Math.max(0,Math.min(i-1,Math.floor(e*=i)));return a[t](e-t)}}const Ci=Object.freeze(Object.defineProperty({__proto__:null,interpolate:St,interpolateArray:Mt,interpolateBasis:nn,interpolateBasisClosed:rn,interpolateCubehelix:ki,interpolateCubehelixLong:Di,interpolateDate:Bt,interpolateDiscrete:function(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}},interpolateHcl:xt,interpolateHclLong:wt,interpolateHsl:wi,interpolateHslLong:_i,interpolateHue:function(e,t){var n=Zt(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}},interpolateLab:function(e,t){var n=tn((e=bt(e)).l,(t=bt(t)).l),i=tn(e.a,t.a),r=tn(e.b,t.b),a=tn(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=i(t),e.b=r(t),e.opacity=a(t),e+""}},interpolateNumber:an,interpolateNumberArray:zt,interpolateObject:Ot,interpolateRgb:on,interpolateRgbBasis:sn,interpolateRgbBasisClosed:un,interpolateRound:Nt,interpolateString:ln,interpolateTransformCss:cn,interpolateTransformSvg:fn,interpolateZoom:bi,piecewise:Fi,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"}));function Ei(e){return kr(e,"or")}function $i(e){return kr(e,"and")}function Si(e){return kr(e,"not")}function Mi(e,t){if(Si(e))Mi(e.not,t);else if($i(e))for(const n of e.and)Mi(n,t);else if(Ei(e))for(const n of e.or)Mi(n,t);else t(e)}function Bi(e,t){return Si(e)?{not:Bi(e.not,t)}:$i(e)?{and:e.and.map((e=>Bi(e,t)))}:Ei(e)?{or:e.or.map((e=>Bi(e,t)))}:t(e)}const zi=structuredClone;function Oi(e){throw new Error(e)}function Ni(e,n){const i={};for(const r of n)t(e,r)&&(i[r]=e[r]);return i}function Ri(e,t){const n={...e};for(const i of t)delete n[i];return n}function Ti(e){if(n(e))return e;const t=i(e)?e:Ar(e);if(t.length<250)return t;let r=0;for(let n=0;n<t.length;n++){r=(r<<5)-r+t.charCodeAt(n),r|=0}return r}function Pi(e){return!1===e||null===e}function ji(e,t){return e.includes(t)}function Li(e,t){let n=0;for(const[i,r]of e.entries())if(t(r,i,n++))return!0;return!1}function qi(e,t){let n=0;for(const[i,r]of e.entries())if(!t(r,i,n++))return!1;return!0}function Ui(e,...t){for(const n of t)Ii(e,n??{});return e}function Ii(e,t){for(const n of Qi(t))s(e,n,t[n],!0)}function Wi(e,t){const n=[],i={};let r;for(const a of e)r=t(a),r in i||(i[r]=1,n.push(a));return n}function Hi(e,t){const n=Qi(e),i=Qi(t);if(n.length!==i.length)return!1;for(const r of n)if(e[r]!==t[r])return!1;return!0}function Gi(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Vi(e,t){for(const n of e)if(t.has(n))return!0;return!1}function Yi(e){const t=new Set;for(const n of e){const e=r(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 Xi(e,t){return void 0===e||void 0===t||Vi(Yi(e),Yi(t))}function Ji(e){return 0===Qi(e).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>Ar(e))).join(",")})`};const Qi=Object.keys,Ki=Object.values,Zi=Object.entries;function er(e){return!0===e||!1===e}function tr(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function nr(e,t){return Si(e)?`!(${nr(e.not,t)})`:$i(e)?`(${e.and.map((e=>nr(e,t))).join(") && (")})`:Ei(e)?`(${e.or.map((e=>nr(e,t))).join(") || (")})`:t(e)}function ir(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&ir(e[n],t)&&delete e[n],Ji(e)}function rr(e){return e.charAt(0).toUpperCase()+e.substr(1)}function ar(e,t="datum"){const n=r(e),i=[];for(let r=1;r<=n.length;r++){const e=`[${n.slice(0,r).map(a).join("][")}]`;i.push(`${t}${e}`)}return i.join(" && ")}function or(e,t="datum"){return`${t}[${a(r(e).join("."))}]`}function sr(e){return`datum['${e.replaceAll("'","\\'")}']`}function ur(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function lr(e){return`${r(e).map(ur).join("\\.")}`}function cr(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function fr(e){return`${r(e).join(".")}`}function dr(e){return e?r(e).length:0}function hr(...e){return e.find((e=>void 0!==e))}let pr=42;function mr(e){const t=++pr;return e?String(e)+t:t}function gr(){pr=42}function yr(e){return vr(e)?e:`__${e}`}function vr(e){return e.startsWith("__")}function br(e){if(void 0!==e)return(e%360+360)%360}function xr(e){return!!n(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const wr=Object.getPrototypeOf(structuredClone({}));function _r(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(!_r(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(!_r(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!==wr.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==wr.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(!_r(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ar(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 a=t.push(n)-1,o=Object.keys(n).sort();for(r="",i=0;i<o.length;i++){const t=o[i],a=e(n[t]);a&&(r&&(r+=","),r+=JSON.stringify(t)+":"+a)}return t.splice(a,1),`{${r}}`}(e)}function kr(e,n){return o(e)&&t(e,n)&&void 0!==e[n]}const Dr="row",Fr="column",Cr="facet",Er="x",$r="y",Sr="x2",Mr="y2",Br="xOffset",zr="yOffset",Or="radius",Nr="radius2",Rr="theta",Tr="theta2",Pr="latitude",jr="longitude",Lr="latitude2",qr="longitude2",Ur="time",Ir="color",Wr="fill",Hr="stroke",Gr="shape",Vr="size",Yr="angle",Xr="opacity",Jr="fillOpacity",Qr="strokeOpacity",Kr="strokeWidth",Zr="strokeDash",ea="text",ta="order",na="detail",ia="key",ra="tooltip",aa="href",oa="url",sa="description",ua={theta:1,theta2:1,radius:1,radius2:1};function la(e){return t(ua,e)}const ca={longitude:1,longitude2:1,latitude:1,latitude2:1};function fa(e){switch(e){case Pr:return"y";case Lr:return"y2";case jr:return"x";case qr:return"x2"}}function da(e){return t(ca,e)}const ha=Qi(ca),pa={x:1,y:1,x2:1,y2:1,...ua,...ca,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,time: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 ma(e){return e===Ir||e===Wr||e===Hr}const ga={row:1,column:1,facet:1},ya=Qi(ga),va={...pa,...ga},ba=Qi(va),{order:xa,detail:wa,tooltip:_a,...Aa}=va,{row:ka,column:Da,facet:Fa,...Ca}=Aa;function Ea(e){return t(va,e)}const $a=[Sr,Mr,Lr,qr,Tr,Nr];function Sa(e){return Ma(e)!==e}function Ma(e){switch(e){case Sr:return Er;case Mr:return $r;case Lr:return Pr;case qr:return jr;case Tr:return Rr;case Nr:return Or}return e}function Ba(e){if(la(e))switch(e){case Rr:return"startAngle";case Tr:return"endAngle";case Or:return"outerRadius";case Nr:return"innerRadius"}return e}function za(e){switch(e){case Er:return Sr;case $r:return Mr;case Pr:return Lr;case jr:return qr;case Rr:return Tr;case Or:return Nr}}function Oa(e){switch(e){case Er:case Sr:return"width";case $r:case Mr:return"height"}}function Na(e){switch(e){case Er:return"xOffset";case $r:return"yOffset";case Sr:return"x2Offset";case Mr:return"y2Offset";case Rr:return"thetaOffset";case Or:return"radiusOffset";case Tr:return"theta2Offset";case Nr:return"radius2Offset"}}function Ra(e){switch(e){case Er:return"xOffset";case $r:return"yOffset"}}function Ta(e){switch(e){case"xOffset":return"x";case"yOffset":return"y"}}const Pa=Qi(pa),{x:ja,y:La,x2:qa,y2:Ua,xOffset:Ia,yOffset:Wa,latitude:Ha,longitude:Ga,latitude2:Va,longitude2:Ya,theta:Xa,theta2:Ja,radius:Qa,radius2:Ka,...Za}=pa,eo=Qi(Za),to={x:1,y:1},no=Qi(to);function io(e){return t(to,e)}const ro={theta:1,radius:1},ao=Qi(ro);function oo(e){return"width"===e?Er:$r}const so={xOffset:1,yOffset:1};function uo(e){return t(so,e)}const lo={time:1};function co(e){return e in lo}const{text:fo,tooltip:ho,href:po,url:mo,description:go,detail:yo,key:vo,order:bo,...xo}=Za,wo=Qi(xo);const _o={...to,...ro,...so,...xo},Ao=Qi(_o);function ko(e){return t(_o,e)}function Do(e,t){return function(e){switch(e){case Ir:case Wr:case Hr:case sa:case na:case ia:case ra:case aa:case ta:case Xr:case Jr:case Qr:case Kr:case Cr:case Dr:case Fr:return Fo;case Er:case $r:case Br:case zr:case Pr:case jr:case Ur:return Eo;case Sr:case Mr:case Lr:case qr:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case Vr:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Zr:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case Gr:return{point:"always",geoshape:"always"};case ea:return{text:"always"};case Yr:return{point:"always",square:"always",text:"always"};case oa:return{image:"always"};case Rr:case Or:return{text:"always",arc:"always"};case Tr:case Nr:return{arc:"always"}}}(e)[t]}const Fo={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:Co,...Eo}=Fo;function $o(e){switch(e){case Er:case $r:case Rr:case Or:case Br:case zr:case Vr:case Yr:case Kr:case Xr:case Jr:case Qr:case Ur:case Sr:case Mr:case Tr:case Nr:return;case Cr:case Dr:case Fr:case Gr:case Zr:case ea:case ra:case aa:case oa:case sa:return"discrete";case Ir:case Wr:case Hr:return"flexible";case Pr:case jr:case Lr:case qr:case na:case ia:case ta:return}}const So={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},Mo={count:1,min:1,max:1};function Bo(e){return kr(e,"argmin")}function zo(e){return kr(e,"argmax")}function Oo(e){return i(e)&&t(So,e)}const No=new Set(["count","valid","missing","distinct"]);function Ro(e){return i(e)&&No.has(e)}const To=new Set(["count","sum","distinct","valid","missing"]),Po=new Set(["mean","average","median","q1","q3","min","max"]);function jo(e){return u(e)&&(e=kP(e,void 0)),"bin"+Qi(e).map((t=>Io(e[t])?tr(`_${t}_${Zi(e[t])}`):tr(`_${t}_${e[t]}`))).join("")}function Lo(e){return!0===e||Uo(e)&&!e.binned}function qo(e){return"binned"===e||Uo(e)&&!0===e.binned}function Uo(e){return o(e)}function Io(e){return kr(e,"param")}function Wo(e){switch(e){case Dr:case Fr:case Vr:case Ir:case Wr:case Hr:case Kr:case Xr:case Jr:case Qr:case Gr:return 6;case Zr:return 4;default:return 10}}function Ho(e){return kr(e,"expr")}function Go(e,{level:t}={level:0}){const n=Qi(e||{}),i={};for(const r of n)i[r]=0===t?ns(e[r]):Go(e[r],{level:t-1});return i}function Vo(e){const{anchor:t,frame:n,offset:i,orient:r,angle:a,limit:o,color:s,subtitleColor:u,subtitleFont:l,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!==a?{angle:a}:{},...void 0!==o?{limit:o}:{}},y={...u?{subtitleColor:u}:{},...l?{subtitleFont:l}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}};return{titleMarkConfig:{...m,...s?{fill:s}:{}},subtitleMarkConfig:Ni(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:y}}function Yo(e){return i(e)||l(e)&&i(e[0])}function Xo(e){return kr(e,"signal")}function Jo(e){return kr(e,"step")}function Qo(e){return!l(e)&&(kr(e,"field")&&kr(e,"data"))}const Ko=Qi({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}),Zo={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},es=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function ts(e){const t=l(e.condition)?e.condition.map(is):is(e.condition);return{...ns(e),condition:t}}function ns(e){if(Ho(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function is(e){if(Ho(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function rs(e){if(Ho(e)){const{expr:t,...n}=e;return{signal:t,...n}}return Xo(e)?e:void 0!==e?{value:e}:void 0}function as(e){return Xo(e)?e.signal:a(e.value)}function os(e){return Xo(e)?e.signal:null==e?null:a(e)}function ss(e,t,n){for(const i of n){const n=cs(i,t.markDef,t.config);void 0!==n&&(e[i]=rs(n))}return e}function us(e){return[].concat(e.type,e.style??[])}function ls(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:a}=i;return r&&kr(t,r)?t[r]:void 0!==t[e]?t[e]:!a||r&&r!==e?cs(e,t,n,i):void 0}function cs(e,t,n,{vgChannel:i}={}){const r=fs(e,t,n.style);return hr(i?r:void 0,r,i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function fs(e,t,n){return ds(e,us(t),n)}function ds(e,t,n){let i;t=c(t);for(const r of t){const t=n[r];kr(t,e)&&(i=t[e])}return i}function hs(e,t){return c(e).reduce(((e,n)=>(e.field.push(cP(n,t)),e.order.push(n.sort??"ascending"),e)),{field:[],order:[]})}function ps(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(_r(t,e))return;n.push(e)})),n}function ms(e,t){return _r(e,t)||!t?e:e?[...c(e),...c(t)].join(", "):t}function gs(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((Yo(n)||Xo(n))&&(Yo(i)||Xo(i)))return{explicit:e.explicit,value:ms(n,i)};if(Yo(n)||Xo(n))return{explicit:e.explicit,value:n};if(Yo(i)||Xo(i))return{explicit:e.explicit,value:i};if(!(Yo(n)||Xo(n)||Yo(i)||Xo(i)))return{explicit:e.explicit,value:ps(n,i)};throw new Error("It should never reach here")}function ys(e){const t=e||y,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 vs(e,t){try{await t(e)}catch(n){e.error(n)}}const bs=Symbol("vega_id");let xs=1;function ws(e){return!(!e||!_s(e))}function _s(e){return e[bs]}function As(e,t){return e[bs]=t,e}function ks(e){const t=e===Object(e)?e:{data:e};return _s(t)?t:As(t,xs++)}function Ds(e){return Fs(e,ks({}))}function Fs(e,t){for(const n in e)t[n]=e[n];return t}function Cs(e,t){return As(t,_s(e))}function Es(e,t){return e?t?(n,i)=>e(n,i)||_s(t(n))-_s(t(i)):(t,n)=>e(t,n)||_s(t)-_s(n):null}function $s(e){return e&&e.constructor===Ss}function Ss(){const e=[],t=[],n=[],i=[],r=[];let a=null,o=!1;return{constructor:Ss,insert(t){const n=c(t),i=n.length;for(let r=0;r<i;++r)e.push(n[r]);return this},remove(e){const n=m(e)?i:t,r=c(e),a=r.length;for(let t=0;t<a;++t)n.push(r[t]);return this},modify(e,t,i){const a={field:t,value:g(i)};return m(e)?(a.filter=e,r.push(a)):(a.tuple=e,n.push(a)),this},encode(e,t){return m(e)?r.push({filter:e,field:t}):n.push({tuple:e,field:t}),this},clean(e){return a=e,this},reflow(){return o=!0,this},pulse(s,u){const l={},c={};let f,d,h,p,m,g;for(f=0,d=u.length;f<d;++f)l[_s(u[f])]=1;for(f=0,d=t.length;f<d;++f)m=t[f],l[_s(m)]=-1;for(f=0,d=i.length;f<d;++f)p=i[f],u.forEach((e=>{p(e)&&(l[_s(e)]=-1)}));for(f=0,d=e.length;f<d;++f)m=e[f],g=_s(m),l[g]?l[g]=1:s.add.push(ks(e[f]));for(f=0,d=u.length;f<d;++f)m=u[f],l[_s(m)]<0&&s.rem.push(m);function y(e,t,n){n?e[t]=n(e):s.encode=t,o||(c[_s(e)]=e)}for(f=0,d=n.length;f<d;++f)h=n[f],m=h.tuple,p=h.field,g=l[_s(m)],g>0&&(y(m,p,h.value),s.modifies(p));for(f=0,d=r.length;f<d;++f)h=r[f],p=h.filter,u.forEach((e=>{p(e)&&l[_s(e)]>0&&y(e,h.field,h.value)})),s.modifies(h.field);if(o)s.mod=t.length||i.length?u.filter((e=>l[_s(e)]>0)):u.slice();else for(g in c)s.mod.push(c[g]);return(a||null==a&&(t.length||i.length))&&s.clean(!0),s}}}const Ms="_:mod:_";function Bs(){Object.defineProperty(this,Ms,{writable:!0,value:{}})}Bs.prototype={set(e,t,n,i){const r=this,a=r[e],o=r[Ms];return null!=t&&t>=0?(a[t]!==n||i)&&(a[t]=n,o[t+":"+e]=-1,o[e]=-1):(a!==n||i)&&(r[e]=n,o[e]=l(n)?1+n.length:-1),r},modified(e,t){const n=this[Ms];if(!arguments.length){for(const e in n)if(n[e])return!0;return!1}if(l(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[Ms]={},this}};let zs=0;const Os=new Bs;function Ns(e,t,n,i){this.id=++zs,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 Rs(e){return function(t){const n=this.flags;return 0===arguments.length?!!(n&e):(this.flags=t?n|e:n&~e,this)}}Ns.prototype={targets(){return this._targets||(this._targets=ys(b))},set(e){return this.value!==e?(this.value=e,1):0},skip:Rs(1),modified:Rs(2),parameters(e,t,n){t=!1!==t;const i=this._argval=this._argval||new Bs,r=this._argops=this._argops||[],a=[];let o,s,u,f;const d=(e,n,o)=>{o instanceof Ns?(o!==this&&(t&&o.targets().add(this),a.push(o)),r.push({op:o,name:e,index:n})):i.set(e,n,o)};for(o in e)if(s=e[o],"pulse"===o)c(s).forEach((e=>{e instanceof Ns?e!==this&&(e.targets().add(this),a.push(e)):v("Pulse parameters must be operator instances.")})),this.source=s;else if(l(s))for(i.set(o,-1,Array(u=s.length)),f=0;f<u;++f)d(o,f,s[f]);else d(o,-1,s);return this.marshall().clear(),n&&(r.initonly=!0),a},marshall(e){const t=this._argval||Os,n=this._argops;let i,r,a,o;if(n){const s=n.length;for(r=0;r<s;++r)i=n[r],a=i.op,o=a.modified()&&a.stamp===e,t.set(i.name,i.index,a.value,o);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 Ts=0;function Ps(e,t,n){this.id=++Ts,this.value=null,n&&(this.receive=n),e&&(this._filter=e),t&&(this._apply=t)}function js(e,t,n){return new Ps(e,t,n)}Ps.prototype={_filter:x,_apply:y,targets(){return this._targets||(this._targets=ys(b))},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=js(e);return this.targets().add(t),t},apply(e){const t=js(null,e);return this.targets().add(t),t},merge(){const e=js();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=js();return this.targets().add(js(null,null,F(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(js(null,null,(()=>n=!0))),t.targets().add(js(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=x,this._targets=null}};const Ls={skip:!0};function qs(e,t,n,i,r,a){const o=D({},a,Ls);let s,u;m(n)||(n=g(n)),void 0===i?s=t=>e.touch(n(t)):m(i)?(u=new Ns(null,i,r,!1),s=t=>{u.evaluate(t);const i=n(t),r=u.value;$s(r)?e.pulse(i,r,a):e.update(i,r,o)}):s=t=>e.update(n(t),i,o),t.apply(s)}function Us(e,t,n,i,r,a){if(void 0===i)t.targets().add(n);else{const o=a||{},s=new Ns(null,function(e,t){return t=m(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);s.modified(o.force),s.rank=t.rank,t.targets().add(s),n&&(s.skip(!0),s.value=n.value,s.targets().add(n),e.connect(n,[s]))}}const Is={};function Ws(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 Hs(e,t){const n=[];return w(e,t,(e=>n.push(e))),n}function Gs(e,t){const n={};return e.visit(t,(e=>{n[_s(e)]=1})),e=>n[_s(e)]?null:e}function Vs(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}function Ys(e,t,n,i){const r=this;let a=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=i||null,this.pulses=n;for(const o of n)if(o.stamp===t){if(o.fields){const e=r.fields||(r.fields={});for(const t in o.fields)e[t]=1}o.changed(r.ADD)&&(a|=r.ADD),o.changed(r.REM)&&(a|=r.REM),o.changed(r.MOD)&&(a|=r.MOD)}this.changes=a}function Xs(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}Ws.prototype={StopPropagation:Is,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 Ws(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 Ws(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,Gs(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return l(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?l(e)?e.some((e=>n[e])):n[e]:!!n)},filter(e,t){const n=this;return 1&e&&(n.addF=Vs(n.addF,t)),2&e&&(n.remF=Vs(n.remF,t)),4&e&&(n.modF=Vs(n.modF,t)),16&e&&(n.srcF=Vs(n.srcF,t)),n},materialize(e){const t=this;return 1&(e=e||7)&&t.addF&&(t.add=Hs(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=Hs(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=Hs(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 w(n.source,n.srcF,i),n;1&e&&w(n.add,n.addF,i),2&e&&w(n.rem,n.remF,i),4&e&&w(n.mod,n.modF,i);const r=n.source;if(8&e&&r){const e=n.add.length+n.mod.length;e===r.length||w(r,e?Gs(n,5):n.srcF,i)}return n}},_(Ys,Ws,{fork(e){const t=new Ws(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?l(e)?e.some((e=>n[e])):n[e]:0},filter(){v("MultiPulse does not support filtering.")},materialize(){v("MultiPulse does not support materialization.")},visit(e,t){const n=this,i=n.pulses,r=i.length;let a=0;if(e&n.SOURCE)for(;a<r;++a)i[a].visit(e,t);else for(;a<r;++a)i[a].stamp===n.stamp&&i[a].visit(e,t);return n}});const Js={skip:!1,force:!1};function Qs(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),Ks(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,a=e[t];let o,s=1+(t<<1);for(;s<r;)o=s+1,o<r&&n(e[s],e[o])>=0&&(s=o),e[t]=e[s],s=1+((t=s)<<1);e[t]=a,Ks(e,i,t,n)}(t,0,e)):i=n,i}}}function Ks(e,t,n,i){let r,a;const o=e[n];for(;n>t&&(a=n-1>>1,r=e[a],i(o,r)<0);)e[n]=r,n=a;return e[n]=o}function Zs(){this.logger(f()),this.logLevel(d),this._clock=0,this._rank=0,this._locale=h();try{this._loader=p()}catch(e){}this._touched=ys(b),this._input={},this._pulse=null,this._heap=Qs(((e,t)=>e.qrank-t.qrank)),this._postrun=[]}function eu(e){return function(){return this._log[e].apply(this,arguments)}}function tu(e,t){Ns.call(this,e,null,t)}Zs.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:eu("error"),warn:eu("warn"),info:eu("info"),debug:eu("debug"),logLevel:eu("level"),cleanThreshold:1e4,add:function(e,t,n,i){let r,a=1;return e instanceof Ns?r=e:e&&e.prototype instanceof Ns?r=new e:m(e)?r=new Ns(null,e):(a=0,r=new Ns(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&&v("Cycle detected in dataflow graph.")},pulse:function(e,t,n){this.touch(e,n||Js);const i=new Ws(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||Js;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},update:function(e,t,n){const i=n||Js;return(e.set(t)||i.force)&&this.touch(e,i),this},changeset:Ss,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 k(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 a=await i.request(t,n);return i.pulse(e,i.changeset().remove(x).insert(a.data||[])),r.done(),a},request:async function(e,t){const n=this;let i,r=0;try{i=await n.loader().load(e,{context:"dataflow",response:A(t&&t.type)});try{i=n.parse(i,t)}catch(a){r=-2,n.warn("Data ingestion failed",e,a)}}catch(a){r=-1,n.warn("Loading failed",e,a)}return{data:i,status:r}},events:function(e,t,n,i){const r=this,a=js(n,i),o=function(e){e.dataflow=r;try{a.receive(e)}catch(t){r.error(t)}finally{r.run()}};let s;s="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):c(e);const u=s.length;for(let l=0;l<u;++l)s[l].addEventListener(t,o);return a},on:function(e,t,n,i,r){return(e instanceof Ns?Us:qs)(this,e,t,n,i,r),this},evaluate:async function(e,t,n){const i=this,r=[];if(i._pulse)return Xs(i);if(i._pending&&await i._pending,t&&await vs(i,t),!i._touched.length)return i.debug("Dataflow invoked, but nothing to do."),i;const a=++i._clock;i._pulse=new Ws(i,a,e),i._touched.forEach((e=>i._enqueue(e,!0))),i._touched=ys(b);let o,s,u,l=0;try{for(;i._heap.size()>0;)o=i._heap.pop(),o.rank===o.qrank?(s=o.run(i._getPulse(o,e)),s.then?s=await s:s.async&&(r.push(s.async),s=Is),s!==Is&&o._targets&&o._targets.forEach((e=>i._enqueue(e))),++l):i._enqueue(o,!0)}catch(c){i._heap.clear(),u=c}if(i._input={},i._pulse=null,i.debug(`Pulse ${a}: ${l} operators`),u&&(i._postrun=[],i.error(u)),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 vs(i,e[t].callback)}return n&&await vs(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?Xs(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&&l(n)?new Ys(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!==Is&&(e.source=t.source);return e}(this._pulse,n&&n.pulse)}},_(tu,Ns,{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 nu={};function iu(e){const t=ru(e);return t&&t.Definition||null}function ru(e){return e=e&&e.toLowerCase(),t(nu,e)?nu[e]:null}function*au(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 ou(t,n,i){const r=Float64Array.from(au(t,i));return r.sort(e),n.map((e=>ii(r,e)))}function su(e,t){return ou(e,[.25,.5,.75],t)}function uu(e,t){const n=e.length,i=function(e,t){const n=function(e,t){let n,i=0,r=0,a=0;if(void 0===t)for(let o of e)null!=o&&(o=+o)>=o&&(n=o-r,r+=n/++i,a+=n*(o-r));else{let o=-1;for(let s of e)null!=(s=t(s,++o,e))&&(s=+s)>=s&&(n=s-r,r+=n/++i,a+=n*(s-r))}if(i>1)return a/(i-1)}(e,t);return n?Math.sqrt(n):n}(e,t),r=su(e,t),a=(r[2]-r[0])/1.34;return 1.06*(Math.min(i,a)||i||Math.abs(r[0])||1)*Math.pow(n,-.2)}function lu(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let a,o,s,u,l,c,f=e.extent[0],d=e.extent[1];const h=e.span||d-f||Math.abs(f)||1;if(e.step)a=e.step;else if(e.steps){for(u=h/t,l=0,c=e.steps.length;l<c&&e.steps[l]<u;++l);a=e.steps[Math.max(0,l-1)]}else{for(o=Math.ceil(Math.log(t)/i),s=e.minstep||0,a=Math.max(s,Math.pow(n,Math.round(Math.log(h)/i)-o));Math.ceil(h/a)>t;)a*=n;for(l=0,c=r.length;l<c;++l)u=a/r[l],u>=s&&h/u<=t&&(a=u)}u=Math.log(a);const p=u>=0?0:1+~~(-u/i),m=Math.pow(n,-p-1);return(e.nice||void 0===e.nice)&&(u=Math.floor(f/a+m)*a,f=f<u?u-a:u,d=Math.ceil(d/a)*a),{start:f,stop:d===f?f+a:d,step:a}}var cu=Math.random;function fu(t,n,i,r){if(!t.length)return[void 0,void 0];const a=Float64Array.from(au(t,r)),o=a.length,s=n;let u,l,c,f;for(c=0,f=Array(s);c<s;++c){for(u=0,l=0;l<o;++l)u+=a[~~(cu()*o)];f[c]=u/o}return f.sort(e),[ni(f,i/2),ni(f,1-i/2)]}function du(e,t,n,i){i=i||(e=>e);const r=e.length,a=new Float64Array(r);let o,s=0,u=1,l=i(e[0]),c=l,f=l+t;for(;u<r;++u){if(o=i(e[u]),o>=f){for(c=(l+c)/2;s<u;++s)a[s]=c;f=o+t,l=o}c=o}for(c=(l+c)/2;s<u;++s)a[s]=c;return n?function(e,t){const n=e.length;let i,r,a=0,o=1;for(;e[a]===e[o];)++o;for(;o<n;){for(i=o+1;e[o]===e[i];)++i;if(e[o]-e[o-1]<t){for(r=o+(a+i-o-o>>1);r<o;)e[r++]=e[o];for(;r>o;)e[r--]=e[a]}a=o,o=i}return e}(a,t+t/4):a}const hu=Math.sqrt(2*Math.PI),pu=Math.SQRT2;let mu=NaN;function gu(e,t){e=e||0,t=null==t?1:t;let n,i,r=0,a=0;if(mu==mu)r=mu,mu=NaN;else{do{r=2*cu()-1,a=2*cu()-1,n=r*r+a*a}while(0===n||n>1);i=Math.sqrt(-2*Math.log(n)/n),r*=i,mu=a*i}return e+r*t}function yu(e,t,n){const i=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*i*i)/(n*hu)}function vu(e,t,n){const i=(e-(t=t||0))/(n=null==n?1:n),r=Math.abs(i);let a;if(r>37)a=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,a=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,a/=t):(t=r+.65,t=r+4/t,t=r+3/t,t=r+2/t,t=r+1/t,a=e/t/2.506628274631)}return i>0?1-a:a}function bu(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*pu*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 xu(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:()=>gu(n,i),pdf:e=>yu(e,n,i),cdf:e=>vu(e,n,i),icdf:e=>bu(e,n,i)};return r.mean(e).stdev(t)}function wu(e,t){const n=xu();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=uu(e)),r):t},sample:()=>e[~~(cu()*i)]+t*n.sample(),pdf(r){let a=0,o=0;for(;o<i;++o)a+=n.pdf((r-e[o])/t);return a/t/i},cdf(r){let a=0,o=0;for(;o<i;++o)a+=n.cdf((r-e[o])/t);return a/i},icdf(){throw Error("KDE icdf not supported.")}};return r.data(e)}function _u(e,t){return e=e||0,t=null==t?1:t,Math.exp(e+gu()*t)}function Au(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*hu*e)}function ku(e,t,n){return vu(Math.log(e),t,n)}function Du(e,t,n){return Math.exp(bu(e,t,n))}function Fu(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:()=>_u(n,i),pdf:e=>Au(e,n,i),cdf:e=>ku(e,n,i),icdf:e=>Du(e,n,i)};return r.mean(e).stdev(t)}function Cu(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=cu();let r=e[i-1],a=n[0],o=0;for(;o<i-1;a+=n[++o])if(t<a){r=e[o];break}return r.sample()},pdf(t){let r=0,a=0;for(;a<i;++a)r+=n[a]*e[a].pdf(t);return r},cdf(t){let r=0,a=0;for(;a<i;++a)r+=n[a]*e[a].cdf(t);return r},icdf(){throw Error("Mixture icdf not supported.")}};return r.distributions(e).weights(t)}function Eu(e,t){return null==t&&(t=null==e?1:e,e=0),e+(t-e)*cu()}function $u(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=t&&e<=n?1/(n-t):0}function Su(e,t,n){return null==n&&(n=null==t?1:t,t=0),e<t?0:e>n?1:(e-t)/(n-t)}function Mu(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function Bu(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:()=>Eu(n,i),pdf:e=>$u(e,n,i),cdf:e=>Su(e,n,i),icdf:e=>Mu(e,n,i)};return null==t&&(t=null==e?1:e,e=0),r.min(e).max(t)}function zu(e,t,n){let i=0,r=0;for(const a of e){const e=n(a);null==t(a)||null==e||isNaN(e)||(i+=(e-i)/++r)}return{coef:[i],predict:()=>i,rSquared:0}}function Ou(e,t,n,i){const r=i-e*e,a=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-a*e,a]}function Nu(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,a=new Float64Array(r),o=new Float64Array(r);let s,u,l,c=0,f=0,d=0;for(l of e)a[c]=s=+t(l),o[c]=u=+n(l),++c,f+=(s-f)/c,d+=(u-d)/c;for(c=0;c<r;++c)a[c]-=f,o[c]-=d;return[a,o,f,d]}function Ru(e,t,n,i){let r,a,o=-1;for(const s of e)r=t(s),a=n(s),null!=r&&(r=+r)>=r&&null!=a&&(a=+a)>=a&&i(r,a,++o)}function Tu(e,t,n,i,r){let a=0,o=0;return Ru(e,t,n,((e,t)=>{const n=t-r(e),s=t-i;a+=n*n,o+=s*s})),1-a/o}function Pu(e,t,n){let i=0,r=0,a=0,o=0,s=0;Ru(e,t,n,((e,t)=>{++s,i+=(e-i)/s,r+=(t-r)/s,a+=(e*t-a)/s,o+=(e*e-o)/s}));const u=Ou(i,r,a,o),l=e=>u[0]+u[1]*e;return{coef:u,predict:l,rSquared:Tu(e,t,n,r,l)}}function ju(e,t,n){let i=0,r=0,a=0,o=0,s=0;Ru(e,t,n,((e,t)=>{++s,e=Math.log(e),i+=(e-i)/s,r+=(t-r)/s,a+=(e*t-a)/s,o+=(e*e-o)/s}));const u=Ou(i,r,a,o),l=e=>u[0]+u[1]*Math.log(e);return{coef:u,predict:l,rSquared:Tu(e,t,n,r,l)}}function Lu(e,t,n){const[i,r,a,o]=Nu(e,t,n);let s,u,l,c=0,f=0,d=0,h=0,p=0;Ru(e,t,n,((e,t)=>{s=i[p++],u=Math.log(t),l=s*t,c+=(t*u-c)/p,f+=(l-f)/p,d+=(l*u-d)/p,h+=(s*l-h)/p}));const[m,g]=Ou(f/o,c/o,d/o,h/o),y=e=>Math.exp(m+g*(e-a));return{coef:[Math.exp(m-g*a),g],predict:y,rSquared:Tu(e,t,n,o,y)}}function qu(e,t,n){let i=0,r=0,a=0,o=0,s=0,u=0;Ru(e,t,n,((e,t)=>{const n=Math.log(e),l=Math.log(t);++u,i+=(n-i)/u,r+=(l-r)/u,a+=(n*l-a)/u,o+=(n*n-o)/u,s+=(t-s)/u}));const l=Ou(i,r,a,o),c=e=>l[0]*Math.pow(e,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Tu(e,t,n,s,c)}}function Uu(e,t,n){const[i,r,a,o]=Nu(e,t,n),s=i.length;let u,l,c,f,d=0,h=0,p=0,m=0,g=0;for(u=0;u<s;)l=i[u],c=r[u++],f=l*l,d+=(f-d)/u,h+=(f*l-h)/u,p+=(f*f-p)/u,m+=(l*c-m)/u,g+=(f*c-g)/u;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-=a)*e+x*e+w+o;return{coef:[w-x*a+b*a*a+o,x-2*b*a,b],predict:_,rSquared:Tu(e,t,n,o,_)}}function Iu(e,t,n,i){if(0===i)return zu(e,t,n);if(1===i)return Pu(e,t,n);if(2===i)return Uu(e,t,n);const[r,a,o,s]=Nu(e,t,n),u=r.length,l=[],c=[],f=i+1;let d,h,p,m,g;for(d=0;d<f;++d){for(p=0,m=0;p<u;++p)m+=Math.pow(r[p],d)*a[p];for(l.push(m),g=new Float64Array(f),h=0;h<f;++h){for(p=0,m=0;p<u;++p)m+=Math.pow(r[p],d+h);g[h]=m}c.push(g)}c.push(l);const y=function(e){const t=e.length-1,n=[];let i,r,a,o,s;for(i=0;i<t;++i){for(o=i,r=i+1;r<t;++r)Math.abs(e[i][r])>Math.abs(e[i][o])&&(o=r);for(a=i;a<t+1;++a)s=e[a][i],e[a][i]=e[a][o],e[a][o]=s;for(r=i+1;r<t;++r)for(a=t;a>=i;a--)e[a][r]-=e[a][i]*e[i][r]/e[i][i]}for(r=t-1;r>=0;--r){for(s=0,a=r+1;a<t;++a)s+=e[a][r]*n[a];n[r]=(e[t][r]-s)/e[r][r]}return n}(c),v=e=>{e-=o;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:Wu(f,y,-o,s),predict:v,rSquared:Tu(e,t,n,s,v)}}function Wu(e,t,n,i){const r=Array(e);let a,o,s,u;for(a=0;a<e;++a)r[a]=0;for(a=e-1;a>=0;--a)for(s=t[a],u=1,r[a]+=s,o=1;o<=a;++o)u*=(a+1-o)/o,r[a-o]+=s*Math.pow(n,o)*u;return r[0]+=i,r}function Hu(e,t,n,i){const[r,a,o,s]=Nu(e,t,n,!0),u=r.length,l=Math.max(2,~~(i*u)),c=new Float64Array(u),f=new Float64Array(u),d=new Float64Array(u).fill(1);for(let h=-1;++h<=2;){const e=[0,l-1];for(let n=0;n<u;++n){const t=r[n],i=e[0],o=e[1],s=t-r[i]>r[o]-t?i:o;let u=0,l=0,h=0,p=0,m=0;const g=1/Math.abs(r[s]-t||1);for(let e=i;e<=o;++e){const n=r[e],i=a[e],o=Gu(Math.abs(t-n)*g)*d[e],s=n*o;u+=o,l+=s,h+=i*o,p+=i*s,m+=n*s}const[y,v]=Ou(l/u,h/u,p/u,m/u);c[n]=y+v*t,f[n]=Math.abs(a[n]-c[n]),Vu(r,n+1,e)}if(2===h)break;const t=ri(f);if(Math.abs(t)<1e-12)break;for(let n,i,r=0;r<u;++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,a=[];let o,s=0,u=0,l=[];for(;s<r;++s)o=e[s]+n,l[0]===o?l[1]+=(t[s]-l[1])/++u:(u=0,l[1]+=i,l=[o,t[s]],a.push(l));return l[1]+=i,a}(r,c,o,s)}function Gu(e){return(e=1-e*e*e)*e*e}function Vu(e,t,n){const i=e[t];let r=n[0],a=n[1]+1;if(!(a>=e.length))for(;t>r&&e[a]-i<=i-e[r];)n[0]=++r,n[1]=a,++a}const Yu=.5*Math.PI/180;function Xu(e,t,n,i){n=n||25,i=Math.max(n,i||200);const r=t=>[t,e(t)],a=t[0],o=t[1],s=o-a,u=s/i,l=[r(a)],c=[];if(n===i){for(let e=1;e<i;++e)l.push(r(a+e/n*s));return l.push(r(o)),l}c.push(r(o));for(let m=n;--m>0;)c.push(r(a+m/n*s));let f=l[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 a=0;a<r;++a){const e=t[a][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]>=u&&Ju(f,e,d,h,p)>Yu?c.push(e):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l}function Ju(e,t,n,i,r){const a=Math.atan2(r*(n[1]-e[1]),i*(n[0]-e[0])),o=Math.atan2(r*(t[1]-e[1]),i*(t[0]-e[0]));return Math.abs(a-o)}function Qu(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 Ku(e,t,n){return n||e+(t?"_"+t:"")}const Zu=()=>{},el={init:Zu,add:Zu,rem:Zu,idx:0},tl={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}},nl=Object.keys(tl).filter((e=>"__count__"!==e));function il(e,t,n){return tl[e](n,t)}function rl(e,t){return e.idx-t.idx}function al(){this.valid=0,this.missing=0,this._ops.forEach((e=>null==e.aggregate_param?e.init(this):e.init(this,e.aggregate_param)))}function ol(e,t){null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach((n=>n.add(this,e,t)))):++this.missing}function sl(e,t){null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach((n=>n.rem(this,e,t)))):--this.missing}function ul(e){return this._out.forEach((t=>e[t.out]=t.value(this))),e}function ll(e,t){const n=t||y,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]=tl[e]())}))};return e.forEach(n),Object.values(t).sort(rl)}(e),r=e.slice().sort(rl);function a(e){this._ops=i,this._out=r,this.cell=e,this.init()}return a.prototype.init=al,a.prototype.add=ol,a.prototype.rem=sl,a.prototype.set=ul,a.prototype.get=n,a.fields=e.map((e=>e.out)),a}function cl(e){this._key=e?q(e):_s,this.reset()}[...nl,"__count__"].forEach((e=>{tl[e]=function(e,t){return(n,i)=>D({name:e,aggregate_param:i,out:n||e},el,t)}(e,tl[e])}));const fl=cl.prototype;function dl(e){tu.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}fl.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},fl.add=function(e){this._add.push(e)},fl.rem=function(e){this._rem.push(e)},fl.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,a=Array(i-r),o={};let s,u,l;for(s=0;s<r;++s)o[n(t[s])]=1;for(s=0,u=0;s<i;++s)o[n(l=e[s])]?o[n(l)]=0:a[u++]=l;return this._rem=[],this._add=a},fl.distinct=function(e){const n=this.values(),i={};let r,a=n.length,o=0;for(;--a>=0;)r=e(n[a])+"",t(i,r)||(i[r]=1,++o);return o},fl.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=Y(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},fl.argmin=function(e){return this.extent(e)[0]||{}},fl.argmax=function(e){return this.extent(e)[1]||{}},fl.min=function(e){const t=this.extent(e)[0];return null!=t?e(t):void 0},fl.max=function(e){const t=this.extent(e)[1];return null!=t?e(t):void 0},fl.quartile=function(e){return this._get===e&&this._q||(this._q=su(this.values(),e),this._get=e),this._q},fl.q1=function(e){return this.quartile(e)[0]},fl.q2=function(e){return this.quartile(e)[1]},fl.q3=function(e){return this.quartile(e)[2]},fl.ci=function(e){return this._get===e&&this._ci||(this._ci=fu(this.values(),1e3,.05,e),this._get=e),this._ci},fl.ci0=function(e){return this.ci(e)[0]},fl.ci1=function(e){return this.ci(e)[1]},dl.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:nl},{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"}]},_(dl,tu,{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 a(e){let t,a,o,s;for(t in e)for(o=e[t].tuple,a=0;a<r;++a)i[a][s=o[n[a]]]=s}a(e._prev),a(t),function a(o,s,u){const l=n[u],c=i[u++];for(const n in c){const i=o?o+"|"+n:n;s[l]=c[n],u<r?a(i,s,u):t[i]||e.cell(i,s)}}("",{},0)},init(e){const t=this._inputs=[],n=this._outputs=[],i={};function r(e){const n=c(E(e)),r=n.length;let a,o=0;for(;o<r;++o)i[a=n[o]]||(i[a]=1,t.push(a))}this._dims=c(e.groupby),this._dnames=this._dims.map((e=>{const t=C(e);return r(e),n.push(t),t})),this.cellkey=e.key?e.key:Qu(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const a=e.fields||[null],o=e.ops||["count"],s=e.aggregate_params||[null],u=e.as||[],l=a.length,f={};let d,h,p,m,g,y,b;for(l!==o.length&&v("Unmatched number of fields and aggregate ops."),b=0;b<l;++b)d=a[b],h=o[b],p=s[b]||null,null==d&&"count"!==h&&v("Null aggregate field specified."),g=C(d),y=Ku(h,g,u[b]),n.push(y),"count"!==h?(m=f[g],m||(r(d),m=f[g]=[],m.field=d,this._measures.push(m)),"count"!==h&&(this._countOnly=!1),m.push(il(h,p,y))):this._counts.push(y);return this._measures=this._measures.map((e=>ll(e,e.field))),Object.create(null)},cellkey:Qu(),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 cl),n},newtuple(e,t){const n=this._dnames,i=this._dims,r=i.length,a={};for(let o=0;o<r;++o)a[n[o]]=i[o](e);return t?Cs(t.tuple,a):ks(a)},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,a=i.length;r<a;++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,a=i.length;r<a;++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,a=e.add,o=e.rem,s=e.mod;let u,l,c,f;if(i)for(l in i)u=i[l],r&&!u.num||o.push(u.tuple);for(c=0,f=this._alen;c<f;++c)a.push(this.celltuple(t[c])),t[c]=null;for(c=0,f=this._mlen;c<f;++c)u=n[c],(0===u.num&&r?o:s).push(this.celltuple(u)),n[c]=null;return this._alen=this._mlen=0,this._prev=null,e}});function hl(e){tu.call(this,null,e)}function pl(e,t,n){const i=e;let r=t||[],a=n||[],o={},s=0;return{add:e=>a.push(e),remove:e=>o[i(e)]=++s,size:()=>r.length,data:(e,t)=>(s&&(r=r.filter((e=>!o[i(e)])),o={},s=0),t&&e&&r.sort(e),a.length&&(r=e?U(e,r,a.sort(e)):r.concat(a),a=[]),r)}}function ml(e){tu.call(this,[],e)}function gl(e){Ns.call(this,null,yl,e)}function yl(e){return this.value&&!e.modified()?this.value:H(e.fields,e.orders)}function vl(e){tu.call(this,null,e)}function bl(e){tu.call(this,null,e)}hl.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"]}]},_(hl,tu,{transform(e,t){const n=!1!==e.interval,i=this._bins(e),r=i.start,a=i.step,o=e.as||["bin0","bin1"],s=o[0],u=o[1];let l;return l=e.modified()?(t=t.reflow(!0)).SOURCE:t.modified(E(e.field))?t.ADD_MOD:t.ADD,t.visit(l,n?e=>{const t=i(e);e[s]=t,e[u]=null==t?null:r+a*(1+(t-r)/a)}:e=>e[s]=i(e)),t.modifies(n?o:s)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=lu(e),i=n.step;let r,a,o=n.start,s=o+Math.ceil((n.stop-o)/i)*i;null!=(r=e.anchor)&&(a=r-(o+i*Math.floor((r-o)/i)),o+=a,s+=a);const u=function(e){let n=S(t(e));return null==n?null:n<o?-1/0:n>s?1/0:(n=Math.max(o,Math.min(n,s-i)),o+i*Math.floor(1e-14+(n-o)/i))};return u.start=o,u.stop=n.stop,u.step=i,this.value=$(u,E(t),e.name||"bin_"+C(t))}}),ml.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},_(ml,tu,{transform(e,t){const n=t.fork(t.ALL),i=pl(_s,this.value,n.materialize(n.ADD).add),r=e.sort,a=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return n.visit(n.REM,i.remove),this.modified(a),this.value=n.source=i.data(Es(r),a),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),_(gl,Ns),vl.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"]}]},_(vl,tu,{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,a)||[],u=0,l=r.length;u<l;++u)o.test(i=r[u])||t(i)},i=this._parameterCheck(e,t),r=this._counts,a=this._match,o=this._stop,s=e.field,u=e.as||["text","count"],l=n((e=>r[e]=1+(r[e]||0))),c=n((e=>r[e]-=1));return i?t.visit(t.SOURCE,l):(t.visit(t.ADD,l),t.visit(t.REM,c)),this._finish(t,u)},_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],a=t[1],o=e.fork(e.NO_SOURCE|e.NO_FIELDS);let s,u,l;for(s in n)u=i[s],l=n[s]||0,!u&&l?(i[s]=u=ks({}),u[r]=s,u[a]=l,o.add.push(u)):0===l?(u&&o.rem.push(u),n[s]=null,i[s]=null):u[a]!==l&&(u[a]=l,o.mod.push(u));return o.modifies(t)}}),bl.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},_(bl,tu,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.as||["a","b"],r=i[0],a=i[1],o=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let s=this.value;return o?(s&&(n.rem=s),s=t.materialize(t.SOURCE).source,n.add=this.value=function(e,t,n,i){for(var r,a,o=[],s={},u=e.length,l=0;l<u;++l)for(s[t]=a=e[l],r=0;r<u;++r)s[n]=e[r],i(s)&&(o.push(ks(s)),(s={})[t]=a);return o}(s,r,a,e.filter||x)):n.mod=s,n.source=this.value,n.modifies(i)}});const xl={kde:wu,mixture:Cu,normal:xu,lognormal:Fu,uniform:Bu},wl="function";function _l(e,n){const i=e[wl];t(xl,i)||v("Unknown distribution function: "+i);const r=xl[i]();for(const t in e)"field"===t?r.data((e.from||n()).map(e[t])):"distributions"===t?r[t](e[t].map((e=>_l(e,n)))):typeof r[t]===wl&&r[t](e[t]);return r}function Al(e){tu.call(this,null,e)}const kl=[{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}]}],Dl={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:kl},{name:"weights",type:"number",array:!0}]};function Fl(e,t){return e?e.map(((e,n)=>t[n]||C(e))):null}function Cl(e,t,n){const i=[],r=e=>e(u);let a,o,s,u,l,c;if(null==t)i.push(e.map(n));else for(a={},o=0,s=e.length;o<s;++o)u=e[o],l=t.map(r),c=a[l],c||(a[l]=c=[],c.dims=l,i.push(c)),c.push(n(u));return i}Al.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:kl.concat(Dl)},{name:"as",type:"string",array:!0,default:["value","density"]}]},_(Al,tu,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=_l(e.distribution,function(e){return()=>e.materialize(e.SOURCE).source}(t)),r=e.steps||e.minsteps||25,a=e.steps||e.maxsteps||200;let o=e.method||"pdf";"pdf"!==o&&"cdf"!==o&&v("Invalid density method: "+o),e.extent||i.data||v("Missing density extent parameter."),o=i[o];const s=e.as||["value","density"],u=Xu(o,e.extent||M(i.data()),r,a).map((e=>{const t={};return t[s[0]]=e[0],t[s[1]]=e[1],ks(t)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=u}return n}});function El(e){tu.call(this,null,e)}El.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 $l(e){Ns.call(this,null,Sl,e),this.modified(!0)}function Sl(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:$((n=>t(n,e)),E(t),C(t))}function Ml(e){tu.call(this,[void 0,void 0],e)}function Bl(e,t){Ns.call(this,e),this.parent=t,this.count=0}function zl(e){tu.call(this,{},e),this._keys=W();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 Ol(e){Ns.call(this,null,Nl,e)}function Nl(e){return this.value&&!e.modified()?this.value:l(e.name)?c(e.name).map((e=>q(e))):q(e.name,e.as)}function Rl(e){tu.call(this,W(),e)}function Tl(e){tu.call(this,[],e)}function Pl(e){tu.call(this,[],e)}function jl(e){tu.call(this,null,e)}function Ll(e){tu.call(this,[],e)}_(El,tu,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,i=Cl(t.source,e.groupby,y),r=e.smooth||!1,a=e.field,o=e.step||((e,t)=>I(M(e,t))/30)(n,a),s=Es(((e,t)=>a(e)-a(t))),u=e.as||"bin",l=i.length;let c,f=1/0,d=-1/0,h=0;for(;h<l;++h){const e=i[h].sort(s);c=-1;for(const t of du(e,o,r,a))t<f&&(f=t),t>d&&(d=t),e[++c][u]=t}return this.value={start:f,stop:d,step:o},t.reflow(!0).modifies(u)}}),_($l,Ns),Ml.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},_(Ml,tu,{transform(e,t){const n=this.value,i=e.field,r=t.changed()||t.modified(i.fields)||e.modified("field");let a=n[0],o=n[1];if((r||null==a)&&(a=1/0,o=-1/0),t.visit(r?t.SOURCE:t.ADD,(e=>{const t=S(i(e));null!=t&&(t<a&&(a=t),t>o&&(o=t))})),!Number.isFinite(a)||!Number.isFinite(o)){let e=C(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${a}, ${o}]`),a=o=void 0}this.value=[a,o]}}),_(Bl,Ns,{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}}),_(zl,tu,{activate(e){this._targets[this._targets.active++]=e},subflow(e,n,i,r){const a=this.value;let o,s,u=t(a,e)&&a[e];return u?u.value.stamp<i.stamp&&(u.init(i),this.activate(u)):(s=r||(s=this._group[e])&&s.tuple,o=i.dataflow,u=new Bl(i.fork(i.NO_SOURCE),this),o.add(u).connect(n(o,e,s)),a[e]=u,this.activate(u)),u},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,a=this._keys,o=e.modified("key"),s=e=>this.subflow(e,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,(e=>{const t=_s(e),n=a.get(t);void 0!==n&&(a.delete(t),s(n).rem(e))})),t.visit(t.ADD,(e=>{const t=i(e);a.set(_s(e),t),s(t).add(e)})),o||t.modified(i.fields)?t.visit(t.MOD,(e=>{const t=_s(e),n=a.get(t),r=i(e);n===r?s(r).mod(e):(a.set(t,r),s(n).rem(e),s(r).add(e))})):t.changed(t.MOD)&&t.visit(t.MOD,(e=>{s(a.get(_s(e))).mod(e)})),o&&t.visit(t.REFLOW,(e=>{const t=_s(e),n=a.get(t),r=i(e);n!==r&&(a.set(t,r),s(n).rem(e),s(r).add(e))})),t.clean()?n.runAfter((()=>{this.clean(),a.clean()})):a.empty>n.cleanThreshold&&n.runAfter(a.clean),t}}),_(Ol,Ns),Rl.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},_(Rl,tu,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),a=r.add,o=r.rem,s=r.mod,u=e.expr;let l=!0;function c(t){const n=_s(t),r=u(t,e),c=i.get(n);r&&c?(i.delete(n),a.push(t)):r||c?l&&r&&!c&&s.push(t):(i.set(n,1),o.push(t))}return t.visit(t.REM,(e=>{const t=_s(e);i.has(t)?i.delete(t):o.push(e)})),t.visit(t.ADD,(t=>{u(t,e)?a.push(t):i.set(_s(t),1)})),t.visit(t.MOD,c),e.modified()&&(l=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}}),Tl.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}]},_(Tl,tu,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=Fl(i,e.as||[]),a=e.index||null,o=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 u,l,c,f=0;for(;f<s;++f){for(l=Ds(e),u=0;u<o;++u)l[r[u]]=null==(c=t[u][f])?null:c;a&&(l[a]=f),n.add.push(l)}})),this.value=n.source=n.add,a&&n.modifies(a),n.modifies(r)}}),Pl.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"]}]},_(Pl,tu,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=i.map(C),a=e.as||["key","value"],o=a[0],s=a[1],u=i.length;return n.rem=this.value,t.visit(t.SOURCE,(e=>{for(let t,a=0;a<u;++a)t=Ds(e),t[o]=r[a],t[s]=i[a](e),n.add.push(t)})),this.value=n.source=n.add,n.modifies(a)}}),jl.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},_(jl,tu,{transform(e,t){const n=e.expr,i=e.as,r=e.modified(),a=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(a,(t=>t[i]=n(t,e)))}}),_(Ll,tu,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r,a,o,s=this.value,u=e.size-s.length;if(u>0){for(r=[];--u>=0;)r.push(o=ks(i(e))),s.push(o);n.add=n.add.length?n.materialize(n.ADD).add.concat(r):r}else a=s.slice(0,-u),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(a):a,s=s.slice(-u);return n.source=this.value=s,n}});const ql={value:"value",median:ri,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 a of e)null!=(a=t(a,++r,e))&&(a=+a)>=a&&(++n,i+=a)}if(n)return i/n},min:mt,max:gt},Ul=[];function Il(e){tu.call(this,[],e)}function Wl(e){dl.call(this,e)}function Hl(e){tu.call(this,null,e)}function Gl(e){Ns.call(this,null,Vl,e)}function Vl(e){return this.value&&!e.modified()?this.value:G(e.fields,e.flat)}function Yl(e){tu.call(this,[],e),this._pending=null}function Xl(e,t,n){n.forEach(ks);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 Jl(e){tu.call(this,{},e)}function Ql(e){Ns.call(this,null,Kl,e)}function Kl(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let i,r,a=1/0,o=-1/0;for(i=0;i<n;++i)r=t[i],r[0]<a&&(a=r[0]),r[1]>o&&(o=r[1]);return[a,o]}function Zl(e){Ns.call(this,null,ec,e)}function ec(e){return this.value&&!e.modified()?this.value:e.values.reduce(((e,t)=>e.concat(t)),[])}function tc(e){tu.call(this,null,e)}function nc(e){dl.call(this,e)}function ic(e){zl.call(this,e)}function rc(e){tu.call(this,null,e)}function ac(e){tu.call(this,null,e)}function oc(e){tu.call(this,null,e)}Il.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}]},_(Il,tu,{transform(e,t){var n,i,r,a,o,s,u,l,c,f,d=t.fork(t.ALL),h=function(e){var t,n=e.method||ql.value;if(null!=ql[n])return n===ql.value?(t=void 0!==e.value?e.value:0,()=>t):ql[n];v("Unrecognized imputation method: "+n)}(e),p=function(e){const t=e.field;return e=>e?t(e):NaN}(e),m=C(e.field),g=C(e.key),y=(e.groupby||[]).map(C),b=function(e,t,n,i){var r,a,o,s,u,l,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)l=n(f=e[s]),u=m[l]||(m[l]=p.push(l)),(o=g[a=(r=t?t.map(d):Ul)+""])||(o=g[a]=[],h.push(o),o.values=r),o[u-1]=f;return h.domain=p,h}(t.source,e.groupby,e.key,e.keyvals),x=[],w=this.value,_=b.domain.length;for(o=0,l=b.length;o<l;++o)for(r=(n=b[o]).values,i=NaN,u=0;u<_;++u)if(null==n[u]){for(a=b.domain[u],f={_impute:!0},s=0,c=r.length;s<c;++s)f[y[s]]=r[s];f[g]=a,f[m]=Number.isNaN(i)?i=h(n,p):i,x.push(ks(f))}return x.length&&(d.add=d.materialize(d.ADD).add.concat(x)),w.length&&(d.rem=d.materialize(d.REM).rem.concat(w)),this.value=x,d}}),Wl.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:nl},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},_(Wl,dl,{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=>{D(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}}),Hl.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"]}]},_(Hl,tu,{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=Cl(i,e.groupby,e.field),a=(e.groupby||[]).map(C),o=e.bandwidth,s=e.cumulative?"cdf":"pdf",u=e.as||["value","density"],l=[];let c=e.extent,f=e.steps||e.minsteps||25,d=e.steps||e.maxsteps||200;"pdf"!==s&&"cdf"!==s&&v("Invalid density method: "+s),"shared"===e.resolve&&(c||(c=M(i,e.field)),f=d=e.steps||d),r.forEach((t=>{const n=wu(t,o)[s],i=e.counts?t.length:1;Xu(n,c||M(t),f,d).forEach((e=>{const n={};for(let i=0;i<a.length;++i)n[a[i]]=t.dims[i];n[u[0]]=e[0],n[u[1]]=e[1]*i,l.push(ks(n))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}}),_(Gl,Ns),_(Yl,tu,{transform(e,t){const n=t.dataflow;if(this._pending)return Xl(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 Xl(this,t,n.parse(e.values,e.format));if(e.async){return{async:n.request(e.url,e.format).then((e=>(this._pending=c(e.data),e=>e.touch(this))))}}return n.request(e.url,e.format).then((e=>Xl(this,t,c(e.data))))}}),Jl.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}]},_(Jl,tu,{transform(e,t){const n=e.fields,i=e.index,r=e.values,a=null==e.default?null:e.default,o=e.modified(),s=n.length;let u,l,c,f=o?t.SOURCE:t.ADD,d=t,h=e.as;return r?(l=r.length,s>1&&!h&&v('Multi-field lookup requires explicit "as" parameter.'),h&&h.length!==s*l&&v('The "as" parameter has too few output field names.'),h=h||r.map(C),u=function(e){for(var t,o,u=0,c=0;u<s;++u)if(null==(o=i.get(n[u](e))))for(t=0;t<l;++t,++c)e[h[c]]=a;else for(t=0;t<l;++t,++c)e[h[c]]=r[t](o)}):(h||v("Missing output field names."),u=function(e){for(var t,r=0;r<s;++r)t=i.get(n[r](e)),e[h[r]]=null==t?a:t}),o?d=t.reflow(!0):(c=n.some((e=>t.modified(e.fields))),f|=c?t.MOD:0),t.visit(f,u),d.modifies(h)}}),_(Ql,Ns),_(Zl,Ns),_(tc,tu,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),nc.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:nl,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},_(nc,dl,{_transform:dl.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",a=E(n).concat(E(i)),o=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(B),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:o.map((()=>r)),fields:o.map((e=>function(e,t,n,i){return $((i=>t(i)===e?n(i):NaN),i,e+"")}(e,n,i,a))),as:o.map((e=>e+"")),modified:e.modified.bind(e)}}(e,t),t)}}),_(ic,zl,{transform(e,t){const n=e.subflow,i=e.field,r=e=>this.subflow(_s(e),n,t,e);return(e.modified("field")||i&&t.modified(E(i)))&&v("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(ks(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}}),rc.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},_(rc,tu,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=Fl(e.fields,e.as||[]),a=i?(e,t)=>function(e,t,n,i){for(let r=0,a=n.length;r<a;++r)t[i[r]]=n[r](e);return t}(e,t,i,r):Fs;let o;return this.value?o=this.value:(t=t.addAll(),o=this.value={}),t.visit(t.REM,(e=>{const t=_s(e);n.rem.push(o[t]),o[t]=null})),t.visit(t.ADD,(e=>{const t=a(e,ks({}));o[_s(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{n.mod.push(a(e,o[_s(e)]))})),n}}),_(ac,tu,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),oc.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 sc(e){tu.call(this,null,e)}function uc(e){tu.call(this,[],e),this.count=0}function lc(e){tu.call(this,null,e)}function cc(e){tu.call(this,null,e),this.modified(!0)}function fc(e){tu.call(this,null,e)}_(oc,tu,{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=Cl(t.materialize(t.SOURCE).source,e.groupby,e.field),a=(e.groupby||[]).map(C),o=[],s=e.step||.01,u=e.probs||Ht(s/2,1-1e-14,s),l=u.length;return r.forEach((e=>{const t=ou(e,u);for(let n=0;n<l;++n){const r={};for(let t=0;t<a.length;++t)r[a[t]]=e.dims[t];r[i[0]]=u[n],r[i[1]]=t[n],o.push(ks(r))}})),this.value&&(n.rem=this.value),this.value=n.add=n.source=o,n}}),_(sc,tu,{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=_s(e);n.rem.push(i[t]),i[t]=null})),t.visit(t.ADD,(e=>{const t=Ds(e);i[_s(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{const t=i[_s(e)];for(const i in e)t[i]=e[i],n.modifies(i);n.mod.push(t)}))),n}}),uc.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},_(uc,tu,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,a=this.value.reduce(((e,t)=>(e[_s(t)]=1,e)),{});let o=this.value,s=this.count,u=0;function l(e){let t,i;o.length<r?o.push(e):(i=~~((s+1)*cu()),i<o.length&&i>=u&&(t=o[i],a[_s(t)]&&n.rem.push(t),o[i]=e)),++s}if(t.rem.length&&(t.visit(t.REM,(e=>{const t=_s(e);a[t]&&(a[t]=-1,n.rem.push(e)),--s})),o=o.filter((e=>-1!==a[_s(e)]))),(t.rem.length||i)&&o.length<r&&t.source&&(u=s=o.length,t.visit(t.SOURCE,(e=>{a[_s(e)]||l(e)})),u=-1),i&&o.length>r){const e=o.length-r;for(let t=0;t<e;++t)a[_s(o[t])]=-1,n.rem.push(o[t]);o=o.slice(e)}return t.mod.length&&t.visit(t.MOD,(e=>{a[_s(e)]&&n.mod.push(e)})),t.add.length&&t.visit(t.ADD,l),(t.add.length||u<0)&&(n.add=o.filter((e=>!a[_s(e)]))),this.count=s,this.value=n.source=o,n}}),lc.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"}]},_(lc,tu,{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=Ht(e.start,e.stop,e.step||1).map((e=>{const t={};return t[i]=e,ks(t)})),n.add=t.add.concat(this.value),n}}),_(cc,tu,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});const dc=["unit0","unit1"];function hc(e){tu.call(this,W(),e)}function pc(e){tu.call(this,null,e)}fc.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:X,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:dc}]},_(fc,tu,{transform(e,t){const n=e.field,i=!1!==e.interval,r="utc"===e.timezone,a=this._floor(e,t),o=(r?P:j)(a.unit).offset,s=e.as||dc,u=s[0],l=s[1],c=a.step;let f=a.start||1/0,d=a.stop||-1/0,h=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(E(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[u]=null,i&&(e[l]=null)):(e[u]=r=s=a(t),i&&(e[l]=s=o(r,c)),r<f&&(f=r),s>d&&(d=s))})),a.start=f,a.stop=d,t.modifies(i?s:u)},_floor(e,t){const n="utc"===e.timezone,{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:z({extent:e.extent||M(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),a=O(i),o=this.value||{},s=(n?N:R)(a,r);return s.unit=T(a),s.units=a,s.step=r,s.start=o.start,s.stop=o.stop,this.value=s}}),_(hc,tu,{transform(e,t){const n=t.dataflow,i=e.field,r=this.value,a=e=>r.set(i(e),e);let o=!0;return e.modified("field")||t.modified(i.fields)?(r.clear(),t.visit(t.SOURCE,a)):t.changed()?(t.visit(t.REM,(e=>r.delete(i(e)))),t.visit(t.ADD,a)):o=!1,this.modified(o),r.empty>n.cleanThreshold&&n.runAfter(r.clean),t.fork()}}),_(pc,tu,{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(Es(e.sort)):t.source).map(e.field))}});const mc={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=mc.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||v("ntile num must be greater than zero.");const n=mc.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||v("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 gc=Object.keys(mc);function yc(e){const n=c(e.ops),i=c(e.fields),r=c(e.params),a=c(e.aggregate_params),o=c(e.as),s=this.outputs=[],u=this.windows=[],l={},f={},d=[],h=[];let p=!0;function m(e){c(E(e)).forEach((e=>l[e]=1))}m(e.sort),n.forEach(((e,n)=>{const l=i[n],c=r[n],g=a[n]||null,y=C(l),b=Ku(e,y,o[n]);if(m(l),s.push(b),t(mc,e))u.push(function(e,t,n,i){const r=mc[e](t,n);return{init:r.init||V,update:function(e,t){t[i]=r.next(e)}}}(e,l,c,b));else{if(null==l&&"count"!==e&&v("Null aggregate field specified."),"count"===e)return void d.push(b);p=!1;let t=f[y];t||(t=f[y]=[],t.field=l,h.push(t)),t.push(il(e,g,b))}})),(d.length||h.length)&&(this.cell=function(e,t,n){e=e.map((e=>ll(e,e.field)));const i={num:0,agg:null,store:!1,count:t};if(!n)for(var r=e.length,a=i.agg=Array(r),o=0;o<r;++o)a[o]=new e[o](i);if(i.store)var s=i.data=new cl;return i.add=function(e){if(i.num+=1,!n){s&&s.add(e);for(let t=0;t<r;++t)a[t].add(a[t].get(e),e)}},i.rem=function(e){if(i.num-=1,!n){s&&s.rem(e);for(let t=0;t<r;++t)a[t].rem(a[t].get(e),e)}},i.set=function(e){let r,o;for(s&&s.values(),r=0,o=t.length;r<o;++r)e[t[r]]=i.num;if(!n)for(r=0,o=a.length;r<o;++r)a[r].set(e)},i.init=function(){i.num=0,s&&s.reset();for(let e=0;e<r;++e)a[e].init()},i}(h,d,p)),this.inputs=Object.keys(l)}const vc=yc.prototype;function bc(e){tu.call(this,{},e),this._mlen=0,this._mods=[]}function xc(e,t,n,i){const r=i.sort,a=r&&!i.ignorePeers,o=i.frame||[null,0],s=e.data(n),u=s.length,l=a?L(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<u;++f)wc(c,o,f,u),a&&_c(c,l),t.update(c,s[f])}function wc(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 _c(e,t){const n=e.i0,i=e.i1-1,r=e.compare,a=e.data,o=a.length-1;n>0&&!r(a[n],a[n-1])&&(e.i0=t.left(a,a[n])),i<o&&!r(a[i],a[i+1])&&(e.i1=t.right(a,a[i]))}vc.init=function(){this.windows.forEach((e=>e.init())),this.cell&&this.cell.init()},vc.update=function(e,t){const n=this.cell,i=this.windows,r=e.data,a=i&&i.length;let o;if(n){for(o=e.p0;o<e.i0;++o)n.rem(r[o]);for(o=e.p1;o<e.i1;++o)n.add(r[o]);n.set(t)}for(o=0;o<a;++o)i[o].update(e,t)},bc.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:gc.concat(nl)},{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}]},_(bc,tu,{transform(e,t){this.stamp=t.stamp;const n=e.modified(),i=Es(e.sort),r=Qu(e.groupby),a=e=>this.group(r(e));let o=this.state;o&&!n||(o=this.state=new yc(e)),n||t.modified(o.inputs)?(this.value={},t.visit(t.SOURCE,(e=>a(e).add(e)))):(t.visit(t.REM,(e=>a(e).remove(e))),t.visit(t.ADD,(e=>a(e).add(e))));for(let s=0,u=this._mlen;s<u;++s)xc(this._mods[s],o,i,e);return this._mlen=0,this._mods=[],t.reflow(n).modifies(o.outputs)},group(e){let t=this.value[e];return t||(t=this.value[e]=pl(_s),t.stamp=-1),t.stamp<this.stamp&&(t.stamp=this.stamp,this._mods[this._mlen++]=t),t}});const Ac=Object.freeze(Object.defineProperty({__proto__:null,aggregate:dl,bin:hl,collect:ml,compare:gl,countpattern:vl,cross:bl,density:Al,dotbin:El,expression:$l,extent:Ml,facet:zl,field:Ol,filter:Rl,flatten:Tl,fold:Pl,formula:jl,generate:Ll,impute:Il,joinaggregate:Wl,kde:Hl,key:Gl,load:Yl,lookup:Jl,multiextent:Ql,multivalues:Zl,params:tc,pivot:nc,prefacet:ic,project:rc,proxy:ac,quantile:oc,relay:sc,sample:uc,sequence:lc,sieve:cc,subflow:Bl,timeunit:fc,tupleindex:hc,values:pc,window:bc},Symbol.toStringTag,{value:"Module"}));function kc(e,t,n){var i=null,r=mn(!0),a=null,o=gn,s=null,u=pn(l);function l(l){var c,f,d,h,p,m=(l=bn(l)).length,g=!1,y=new Array(m),v=new Array(m);for(null==a&&(s=o(p=u())),c=0;c<=m;++c){if(!(c<m&&r(h=l[c],c,l))===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,l),v[c]=+t(h,c,l),s.point(i?+i(h,c,l):y[c],n?+n(h,c,l):v[c]))}if(p)return s=null,p+""||null}function c(){return xn().defined(r).curve(o).context(a)}return e="function"==typeof e?e:void 0===e?yn:mn(+e),t="function"==typeof t?t:mn(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?vn:mn(+n),l.x=function(t){return arguments.length?(e="function"==typeof t?t:mn(+t),i=null,l):e},l.x0=function(t){return arguments.length?(e="function"==typeof t?t:mn(+t),l):e},l.x1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:mn(+e),l):i},l.y=function(e){return arguments.length?(t="function"==typeof e?e:mn(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t="function"==typeof e?e:mn(+e),l):t},l.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:mn(+e),l):n},l.lineX0=l.lineY0=function(){return c().x(e).y(t)},l.lineY1=function(){return c().x(e).y(n)},l.lineX1=function(){return c().x(i).y(t)},l.defined=function(e){return arguments.length?(r="function"==typeof e?e:mn(!!e),l):r},l.curve=function(e){return arguments.length?(o=e,null!=a&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(null==e?a=s=null:s=o(a=e),l):a},l}const Dc={draw(e,t){const n=wn(t/An);e.moveTo(n,0),e.arc(0,0,n,0,_n)}};function Fc(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 Cc(e){return Math.log(e)}function Ec(e){return Math.exp(e)}function $c(e){return-Math.log(-e)}function Sc(e){return-Math.exp(-e)}function Mc(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Bc(e){return(t,n)=>-e(-t,n)}function zc(e){const t=e(Cc,Ec),n=t.domain;let i,r,a=10;function o(){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)}(a),r=function(e){return 10===e?Mc:e===Math.E?Math.exp:t=>Math.pow(e,t)}(a),n()[0]<0?(i=Bc(i),r=Bc(r),e($c,Sc)):e(Cc,Ec),t}return t.base=function(e){return arguments.length?(a=+e,o()):a},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{const t=n();let o=t[0],s=t[t.length-1];const u=s<o;u&&([o,s]=[s,o]);let l,c,f=i(o),d=i(s);const h=null==e?10:+e;let p=[];if(!(a%1)&&d-f<h){if(f=Math.floor(f),d=Math.ceil(d),o>0){for(;f<=d;++f)for(l=1;l<a;++l)if(c=f<0?l/r(-f):l*r(f),!(c<o)){if(c>s)break;p.push(c)}}else for(;f<=d;++f)for(l=a-1;l>=1;--l)if(c=f>0?l/r(-f):l*r(f),!(c<o)){if(c>s)break;p.push(c)}2*p.length<h&&(p=J(o,s,h))}else p=J(f,d,Math.min(d-f,h)).map(r);return u?p.reverse():p},t.tickFormat=(e,n)=>{if(null==e&&(e=10),null==n&&(n=10===a?"s":","),"function"!=typeof n&&(a%1||null!=(n=Q(n)).precision||(n.trim=!0),n=K(n)),e===1/0)return n;const o=Math.max(1,a*e/t.ticks().length);return e=>{let t=e/r(Math.round(i(e)));return t*a<a-.5&&(t*=a),t<=o?n(e):""}},t.nice=()=>n(_t(n(),{floor:e=>r(Math.floor(i(e))),ceil:e=>r(Math.ceil(i(e)))})),t}function Oc(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Nc(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Rc(e){var t=1,n=e(Oc(t),Nc(t));return n.constant=function(n){return arguments.length?e(Oc(t=+n),Nc(t)):t},Tt(n)}function Tc(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Pc(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function jc(e){return e<0?-e*e:e*e}function Lc(e){var t=e(Lt,Lt),n=1;return t.exponent=function(t){return arguments.length?1===(n=+t)?e(Lt,Lt):.5===n?e(Pc,jc):e(Tc(n),Tc(1/n)):n},Tt(t)}function qc(){var e=Lc(Pt());return e.copy=function(){return jt(e,qc()).exponent(e.exponent())},Hn.apply(e,arguments),e}function Uc(){var e,t,n,i,r,a=0,o=1,s=Lt,u=!1;function l(t){return null==t||isNaN(t=+t)?r:s(0===n?.5:(t=(i(t)-e)*n,u?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),l):[s(0),s(1)]}}return l.domain=function(r){return arguments.length?([a,o]=r,e=i(a=+a),t=i(o=+o),n=e===t?0:1/(t-e),l):[a,o]},l.clamp=function(e){return arguments.length?(u=!!e,l):u},l.interpolator=function(e){return arguments.length?(s=e,l):s},l.range=c(St),l.rangeRound=c(Nt),l.unknown=function(e){return arguments.length?(r=e,l):r},function(r){return i=r,e=r(a),t=r(o),n=e===t?0:1/(t-e),l}}function Ic(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Wc(){var e=Tt(Uc()(Lt));return e.copy=function(){return Ic(e,Wc())},Gn.apply(e,arguments)}function Hc(){var e=Lc(Uc());return e.copy=function(){return Ic(e,Hc()).exponent(e.exponent())},Gn.apply(e,arguments)}function Gc(){var e,t,n,i,r,a,o,s=0,u=.5,l=1,c=1,f=Lt,d=!1;function h(e){return isNaN(e=+e)?o:(e=.5+((e=+a(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=Fi(e,[n,i,r]),h):[f(0),f(.5),f(1)]}}return h.domain=function(o){return arguments.length?([s,u,l]=o,e=a(s=+s),t=a(u=+u),n=a(l=+l),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,h):[s,u,l]},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(St),h.rangeRound=p(Nt),h.unknown=function(e){return arguments.length?(o=e,h):o},function(o){return a=o,e=o(s),t=o(u),n=o(l),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,h}}function Vc(){var e=Lc(Gc());return e.copy=function(){return Ic(e,Vc()).exponent(e.exponent())},Gn.apply(e,arguments)}const Yc=Jn("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),Xc=Jn("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Jc=Jn("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Qc=Jn("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),Kc=Jn("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Zc=Jn("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),ef=Jn("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),tf=Jn("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),nf=Jn("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),rf=Jn("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function af(e,t,n){const i=e-t+2*n;return e?i>0?i:1:0}const of="linear",sf="log",uf="pow",lf="sqrt",cf="symlog",ff="time",df="utc",hf="sequential",pf="diverging",mf="quantile",gf="quantize",yf="threshold",vf="ordinal",bf="point",xf="band",wf="bin-ordinal",_f="continuous",Af="discrete",kf="discretizing",Df="interpolating",Ff="temporal";function Cf(){const e=Yn().unknown(void 0),t=e.domain,n=e.range;let i,r,a=[0,1],o=!1,s=0,u=0,l=.5;function c(){const e=t().length,c=a[1]<a[0],f=a[1-c],d=af(e,s,u);let h=a[c-0];i=(f-h)/(d||1),o&&(i=Math.floor(i)),h+=(f-h-i*(e-s))*l,r=i*(1-s),o&&(h=Math.round(h),r=Math.round(r));const p=Ht(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?(a=[+e[0],+e[1]],c()):a.slice()},e.rangeRound=function(e){return a=[+e[0],+e[1]],o=!0,c()},e.bandwidth=function(){return r},e.step=function(){return i},e.round=function(e){return arguments.length?(o=!!e,c()):o},e.padding=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),s=u,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?(u=Math.max(0,Math.min(1,e)),c()):u},e.align=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),c()):l},e.invertRange=function(e){if(null==e[0]||null==e[1])return;const i=a[1]<a[0],o=i?n().reverse():n(),s=o.length-1;let u,l,c,f=+e[0],d=+e[1];return f!=f||d!=d||(d<f&&(c=f,f=d,d=c),d<o[0]||f>a[1-i])?void 0:(u=Math.max(0,qt(o,f)-1),l=f===d?u:qt(o,d)-1,f-o[u]>r+1e-10&&++u,i&&(c=u,u=s-l,l=s-c),u>l?void 0:t().slice(u,l+1))},e.invert=function(t){const n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return Cf().domain(t()).range(a).round(o).paddingInner(s).paddingOuter(u).align(l)},c()}function Ef(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return Ef(t())},e}var $f=Array.prototype.map;const Sf=Array.prototype.slice;const Mf=new Map,Bf=Symbol("vega_scale");function zf(e){return e[Bf]=!0,e}function Of(e){return e&&!0===e[Bf]}function Nf(e,t,n){return arguments.length>1?(Mf.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,a,o,s=t[0],u=t[1],l=-1;for(u<s&&(r=s,s=u,u=r),a=0,o=n.length;a<o;++a)n[a]>=s&&n[a]<=u&&(l<0&&(l=a),i=a);if(!(l<0))return s=e.invertExtent(n[l]),u=e.invertExtent(n[i]),[void 0===s[0]?s[1]:s[0],void 0===u[1]?u[0]:u[1]]}}(n):void 0),n.type=e,zf(n)};return i.metadata=se(c(n)),i}(e,t,n)),this):Rf(e)?Mf.get(e):void 0}function Rf(e){return Mf.has(e)}function Tf(e,t){const n=Mf.get(e);return n&&n.metadata[t]}function Pf(e){return Tf(e,_f)}function jf(e){return Tf(e,Af)}function Lf(e){return Tf(e,kf)}function qf(e){return Tf(e,sf)}function Uf(e){return Tf(e,Df)}function If(e){return Tf(e,mf)}Nf("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,Rt),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,Rt):[0,1],Tt(i)})),Nf(of,Ut,_f),Nf(sf,(function e(){const t=zc(Pt()).domain([1,10]);return t.copy=()=>jt(t,e()).base(t.base()),Hn.apply(t,arguments),t}),[_f,sf]),Nf(uf,qc,_f),Nf(lf,(function(){return qc.apply(null,arguments).exponent(.5)}),_f),Nf(cf,(function e(){var t=Rc(Pt());return t.copy=function(){return jt(t,e()).constant(t.constant())},Hn.apply(t,arguments)}),_f),Nf(ff,Ft,[_f,Ff]),Nf(df,(function(){return Hn.apply(At(Dt,kt,oe,ae,re,ie,ne,te,ee,Z).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[_f,Ff]),Nf(hf,Wc,[_f,Df]),Nf(`${hf}-${of}`,Wc,[_f,Df]),Nf(`${hf}-${sf}`,(function e(){var t=zc(Uc()).domain([1,10]);return t.copy=function(){return Ic(t,e()).base(t.base())},Gn.apply(t,arguments)}),[_f,Df,sf]),Nf(`${hf}-${uf}`,Hc,[_f,Df]),Nf(`${hf}-${lf}`,(function(){return Hc.apply(null,arguments).exponent(.5)}),[_f,Df]),Nf(`${hf}-${cf}`,(function e(){var t=Rc(Uc());return t.copy=function(){return Ic(t,e()).constant(t.constant())},Gn.apply(t,arguments)}),[_f,Df]),Nf(`${pf}-${of}`,(function e(){var t=Tt(Gc()(Lt));return t.copy=function(){return Ic(t,e())},Gn.apply(t,arguments)}),[_f,Df]),Nf(`${pf}-${sf}`,(function e(){var t=zc(Gc()).domain([.1,1,10]);return t.copy=function(){return Ic(t,e()).base(t.base())},Gn.apply(t,arguments)}),[_f,Df,sf]),Nf(`${pf}-${uf}`,Vc,[_f,Df]),Nf(`${pf}-${lf}`,(function(){return Vc.apply(null,arguments).exponent(.5)}),[_f,Df]),Nf(`${pf}-${cf}`,(function e(){var t=Rc(Gc());return t.copy=function(){return Ic(t,e()).constant(t.constant())},Gn.apply(t,arguments)}),[_f,Df]),Nf(mf,(function t(){var n,i=[],r=[],a=[];function o(){var e=0,t=Math.max(1,r.length);for(a=new Array(t-1);++e<t;)a[e-1]=ii(i,e/t);return s}function s(e){return null==e||isNaN(e=+e)?n:r[qt(a,e)]}return s.invertExtent=function(e){var t=r.indexOf(e);return t<0?[NaN,NaN]:[t>0?a[t-1]:i[0],t<a.length?a[t]:i[i.length-1]]},s.domain=function(t){if(!arguments.length)return i.slice();i=[];for(let e of t)null==e||isNaN(e=+e)||i.push(e);return i.sort(e),o()},s.range=function(e){return arguments.length?(r=Array.from(e),o()):r.slice()},s.unknown=function(e){return arguments.length?(n=e,s):n},s.quantiles=function(){return a.slice()},s.copy=function(){return t().domain(i).range(r).unknown(n)},Hn.apply(s,arguments)}),[kf,mf]),Nf(gf,(function e(){var t,n=0,i=1,r=1,a=[.5],o=[0,1];function s(e){return null!=e&&e<=e?o[qt(a,e,0,r)]:t}function u(){var e=-1;for(a=new Array(r);++e<r;)a[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,u()):[n,i]},s.range=function(e){return arguments.length?(r=(o=Array.from(e)).length-1,u()):o.slice()},s.invertExtent=function(e){var t=o.indexOf(e);return t<0?[NaN,NaN]:t<1?[n,a[0]]:t>=r?[a[r-1],i]:[a[t-1],a[t]]},s.unknown=function(e){return arguments.length?(t=e,s):s},s.thresholds=function(){return a.slice()},s.copy=function(){return e().domain([n,i]).range(o).unknown(t)},Hn.apply(Tt(s),arguments)}),kf),Nf(yf,(function e(){var t,n=[.5],i=[0,1],r=1;function a(e){return null!=e&&e<=e?i[qt(n,e,0,r)]:t}return a.domain=function(e){return arguments.length?(n=Array.from(e),r=Math.min(n.length,i.length-1),a):n.slice()},a.range=function(e){return arguments.length?(i=Array.from(e),r=Math.min(n.length,i.length-1),a):i.slice()},a.invertExtent=function(e){var t=i.indexOf(e);return[n[t-1],n[t]]},a.unknown=function(e){return arguments.length?(t=e,a):t},a.copy=function(){return e().domain(n).range(i).unknown(t)},Hn.apply(a,arguments)}),kf),Nf(wf,(function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[(qt(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return $f.call(e,S)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=Sf.call(e),i):n.slice()},i.tickFormat=function(e,n){return It(t[0],T(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i}),[Af,kf]),Nf(vf,Yn,Af),Nf(xf,Cf,Af),Nf(bf,(function(){return Ef(Cf().paddingInner(1))}),Af);const Wf=["clamp","base","constant","exponent"];function Hf(e,t){const n=t[0],i=T(t)-n;return function(t){return e(n+t*i)}}function Gf(e,t,n){return Fi(Xf(t||"rgb",n),e)}function Vf(e,t){const n=new Array(t),i=t+1;for(let r=0;r<t;)n[r]=e(++r/i);return n}function Yf(e,t,n){const i=n-t;let r,a,o;return i&&Number.isFinite(i)?(r=(a=e.type).indexOf("-"),a=r<0?a:a.slice(r+1),o=Nf(a)().domain([t,n]).range([0,1]),Wf.forEach((t=>e[t]?o[t](e[t]()):0)),o):g(.5)}function Xf(e,t){const n=Ci[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 Jf(e){if(l(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 Qf(e,t){for(const n in e)Zf(n,t(e[n]))}const Kf={};function Zf(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(Kf[e]=t,this):Kf[e]}Qf({accent:Xc,category10:Yc,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:Jc,observable10:Qc,paired:Kc,pastel1:Zc,pastel2:ef,set1:tf,set2:nf,set3:rf,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},Jf),Qf({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=>Gf(Jf(e))));const ed="symbol",td=e=>l(e)?e.map((e=>String(e))):String(e),nd=(e,t)=>e[1]-t[1],id=(e,t)=>t[1]-e[1];function rd(e,t,r){let a;return n(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=r&&(t=Math.min(t,Math.floor(I(e.domain())/r||1)+1))),o(t)&&(a=t.step,t=t.interval),i(t)&&(t=e.type===ff?j(t):e.type==df?P(t):v("Only time and utc scales accept interval strings."),a&&(t=t.every(a))),t}function ad(e,t,n){let i=e.range(),r=i[0],a=T(i),o=nd;if(r>a&&(i=a,a=r,r=i,o=id),r=Math.floor(r),a=Math.ceil(a),t=t.map((t=>[t,e(t)])).filter((e=>r<=e[1]&&e[1]<=a)).sort(o).map((e=>e[0])),n>0&&t.length>1){const e=[t[0],T(t)];for(;t.length>n&&t.length>=3;)t=t.filter(((e,t)=>!(t%2)));t.length<3&&(t=e)}return t}function od(e,t){return e.bins?ad(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function sd(e,t,n,i,r,a){const o=t.type;let s=td;if(o===ff||r===ff)s=e.timeFormat(i);else if(o===df||r===df)s=e.utcFormat(i);else if(qf(o)){const r=e.formatFloat(i);if(a||t.bins)s=r;else{const e=ud(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 ud(e,t,n){const i=od(e,t),r=e.base(),a=Math.log(r),o=Math.max(1,r*t/i.length),s=e=>{let t=e/Math.pow(r,Math.round(Math.log(e)/a));return t*r<r-.5&&(t*=r),t<=o};return n?i.filter(s):s}const ld={[mf]:"quantiles",[gf]:"thresholds",[yf]:"domain"},cd={[mf]:"quantiles",[gf]:"domain"};function fd(e,t){return e.bins?function(e){const t=e.slice(0,-1);return t.max=T(e),t}(e.bins):e.type===sf?ud(e,t,!0):ld[e.type]?function(e){const t=[-1/0].concat(e);return t.max=1/0,t}(e[ld[e.type]]()):od(e,t)}function dd(e,t,n,i,r,a,o){const s=cd[t.type]&&a!==ff&&a!==df?function(e,t,n){const i=t[cd[t.type]](),r=i.length;let a,o=r>1?i[1]-i[0]:i[0];for(a=1;a<r;++a)o=Math.min(o,i[a]-i[a-1]);return e.formatSpan(0,o,30,n)}(e,t,r):sd(e,t,n,r,a,o);return i===ed&&(e=>ld[e.type]||e.bins)(t)?hd(s):"discrete"===i?md(s):gd(s)}const hd=e=>(t,n,i)=>{const r=pd(i[n+1],pd(i.max,1/0)),a=yd(t,e),o=yd(r,e);return a&&o?a+" – "+o:o?"< "+o:"≥ "+a},pd=(e,t)=>null!=e?e:t,md=e=>(t,n)=>n?e(t):null,gd=e=>t=>e(t),yd=(e,t)=>Number.isFinite(e)?t(e):null;function vd(e,t,n,r){const a=r||t.type;return i(n)&&Tf(a,Ff)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||a!==ff?n||a!==df?dd(e,t,5,null,n,r,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}function bd(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=vd(e,t,n.format,n.formatType);if(Lf(t.type)){const e=fd(t).slice(1).map(r),n=e.length;return`${n} boundar${1===n?"y":"ies"}: ${e.join(", ")}`}if(jf(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(T(e))}`}}let xd=0;const wd="p_";function _d(e){return e&&e.gradient}function Ad(e,t,n){const i=e.gradient;let r=e.id,a="radial"===i?wd:"";return r||(r=e.id="gradient_"+xd++,"radial"===i?(e.x1=kd(e.x1,.5),e.y1=kd(e.y1,.5),e.r1=kd(e.r1,0),e.x2=kd(e.x2,.5),e.y2=kd(e.y2,.5),e.r2=kd(e.r2,.5),a=wd):(e.x1=kd(e.x1,0),e.y1=kd(e.y1,0),e.x2=kd(e.x2,1),e.y2=kd(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+a+r+")"}function kd(e,t){return null!=e?e:t}function Dd(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 Fd={basis:{curve:Ln},"basis-closed":{curve:jn},"basis-open":{curve:Pn},bundle:{curve:Tn,tension:"beta",value:.85},cardinal:{curve:Rn,tension:"tension",value:0},"cardinal-open":{curve:Nn,tension:"tension",value:0},"cardinal-closed":{curve:On,tension:"tension",value:0},"catmull-rom":{curve:zn,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Bn,tension:"alpha",value:.5},"catmull-rom-open":{curve:Mn,tension:"alpha",value:.5},linear:{curve:gn},"linear-closed":{curve:Sn},monotone:{horizontal:$n,vertical:En},natural:{curve:Cn},step:{curve:Fn},"step-after":{curve:Dn},"step-before":{curve:kn}};function Cd(e,n,i){var r=t(Fd,e)&&Fd[e],a=null;return r&&(a=r.curve||r[n||"vertical"],r.tension&&null!=i&&(a=a[r.tension](i))),a}const Ed={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},$d=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Sd=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,Md=/^((\s+,?\s*)|(,\s*))/,Bd=/^[01]/;function zd(e){const t=[];return(e.match($d)||[]).forEach((e=>{let n=e[0];const i=n.toLowerCase(),r=Ed[i],a=function(e,t,n){const i=[];for(let r=0;t&&r<n.length;)for(let a=0;a<t;++a){const t="a"!==e||3!==a&&4!==a?Sd:Bd,o=n.slice(r).match(t);if(null===o)throw Error("Invalid SVG path, incorrect parameter type");r+=o[0].length,i.push(+o[0]);const s=n.slice(r).match(Md);null!==s&&(r+=s[0].length)}return i}(i,r,e.slice(1).trim()),o=a.length;if(o<r||o&&o%r!=0)throw Error("Invalid SVG path, incorrect parameter count");if(t.push([n,...a.slice(0,r)]),o!==r){"m"===i&&(n="M"===n?"L":"l");for(let e=r;e<o;e+=r)t.push([n,...a.slice(e,e+r)])}})),t}const Od=Math.PI/180,Nd=Math.PI/2,Rd=2*Math.PI,Td=Math.sqrt(3)/2;var Pd={},jd={},Ld=[].join;function qd(e){const t=Ld.call(e);if(jd[t])return jd[t];var n=e[0],i=e[1],r=e[2],a=e[3],o=e[4],s=e[5],u=e[6],l=e[7];const c=l*o,f=-u*s,d=u*o,h=l*s,p=Math.cos(r),m=Math.sin(r),g=Math.cos(a),y=Math.sin(a),v=.5*(a-r),b=Math.sin(.5*v),x=8/3*b*b/Math.sin(v),w=n+p-x*m,_=i+m+x*p,A=n+g,k=i+y,D=A+x*y,F=k-x*g;return jd[t]=[c*w+f*_,d*w+h*_,c*D+f*F,d*D+h*F,c*A+f*k,d*A+h*k]}const Ud=["l",0,0,0,0,0,0,0];function Id(e,t,n){const i=Ud[0]=e[0];if("a"===i||"A"===i)Ud[1]=t*e[1],Ud[2]=n*e[2],Ud[3]=e[3],Ud[4]=e[4],Ud[5]=e[5],Ud[6]=t*e[6],Ud[7]=n*e[7];else if("h"===i||"H"===i)Ud[1]=t*e[1];else if("v"===i||"V"===i)Ud[1]=n*e[1];else for(var r=1,a=e.length;r<a;++r)Ud[r]=(r%2==1?t:n)*e[r];return Ud}function Wd(e,t,n,i,r,a){var o,s,u,l,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==a&&(a=r),e.beginPath&&e.beginPath();for(var v=0,b=t.length;v<b;++v){switch(o=t[v],1===r&&1===a||(o=Id(o,r,a)),o[0]){case"l":d+=o[1],h+=o[2],e.lineTo(d+n,h+i);break;case"L":d=o[1],h=o[2],e.lineTo(d+n,h+i);break;case"h":d+=o[1],e.lineTo(d+n,h+i);break;case"H":d=o[1],e.lineTo(d+n,h+i);break;case"v":h+=o[1],e.lineTo(d+n,h+i);break;case"V":h=o[1],e.lineTo(d+n,h+i);break;case"m":g=d+=o[1],y=h+=o[2],e.moveTo(d+n,h+i);break;case"M":g=d=o[1],y=h=o[2],e.moveTo(d+n,h+i);break;case"c":s=d+o[5],u=h+o[6],p=d+o[3],m=h+o[4],e.bezierCurveTo(d+o[1]+n,h+o[2]+i,p+n,m+i,s+n,u+i),d=s,h=u;break;case"C":d=o[5],h=o[6],p=o[3],m=o[4],e.bezierCurveTo(o[1]+n,o[2]+i,p+n,m+i,d+n,h+i);break;case"s":s=d+o[3],u=h+o[4],p=2*d-p,m=2*h-m,e.bezierCurveTo(p+n,m+i,d+o[1]+n,h+o[2]+i,s+n,u+i),p=d+o[1],m=h+o[2],d=s,h=u;break;case"S":s=o[3],u=o[4],p=2*d-p,m=2*h-m,e.bezierCurveTo(p+n,m+i,o[1]+n,o[2]+i,s+n,u+i),d=s,h=u,p=o[1],m=o[2];break;case"q":s=d+o[3],u=h+o[4],p=d+o[1],m=h+o[2],e.quadraticCurveTo(p+n,m+i,s+n,u+i),d=s,h=u;break;case"Q":s=o[3],u=o[4],e.quadraticCurveTo(o[1]+n,o[2]+i,s+n,u+i),d=s,h=u,p=o[1],m=o[2];break;case"t":s=d+o[1],u=h+o[2],null===f[0].match(/[QqTt]/)?(p=d,m=h):"t"===f[0]?(p=2*d-l,m=2*h-c):"q"===f[0]&&(p=2*d-p,m=2*h-m),l=p,c=m,e.quadraticCurveTo(p+n,m+i,s+n,u+i),h=u,p=(d=s)+o[1],m=h+o[2];break;case"T":s=o[1],u=o[2],p=2*d-p,m=2*h-m,e.quadraticCurveTo(p+n,m+i,s+n,u+i),d=s,h=u;break;case"a":Hd(e,d+n,h+i,[o[1],o[2],o[3],o[4],o[5],o[6]+d+n,o[7]+h+i]),d+=o[6],h+=o[7];break;case"A":Hd(e,d+n,h+i,[o[1],o[2],o[3],o[4],o[5],o[6]+n,o[7]+i]),d=o[6],h=o[7];break;case"z":case"Z":d=g,h=y,e.closePath()}f=o}}function Hd(e,t,n,i){const r=function(e,t,n,i,r,a,o,s,u){const l=Ld.call(arguments);if(Pd[l])return Pd[l];const c=o*Od,f=Math.sin(c),d=Math.cos(c),h=d*(s-e)*.5+f*(u-t)*.5,p=d*(u-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*u,w=v*s+b*u,_=g*e+y*t,A=v*e+b*t;let k=1/((_-x)*(_-x)+(A-w)*(A-w))-.25;k<0&&(k=0);let D=Math.sqrt(k);a==r&&(D=-D);const F=.5*(x+_)-D*(A-w),C=.5*(w+A)+D*(_-x),E=Math.atan2(w-C,x-F);let $=Math.atan2(A-C,_-F)-E;$<0&&1===a?$+=Rd:$>0&&0===a&&($-=Rd);const S=Math.ceil(Math.abs($/(Nd+.001))),M=[];for(let B=0;B<S;++B){const e=E+B*$/S,t=E+(B+1)*$/S;M[B]=[F,C,e,t,n,i,f,d]}return Pd[l]=M}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],t,n);for(let a=0;a<r.length;++a){const t=qd(r[a]);e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5])}}const Gd=.5773502691896257,Vd={circle:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,Rd)}},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,a=n/8;e.moveTo(-i,n),e.lineTo(i,n),e.lineTo(i,-a),e.lineTo(r,-a),e.lineTo(0,-n),e.lineTo(-r,-a),e.lineTo(-i,-a),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,i=Td*n,r=i-n*Gd,a=n/4;e.moveTo(0,-i-r),e.lineTo(-a,i-r),e.lineTo(a,i-r),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,i=Td*n,r=i-n*Gd;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=Td*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=Td*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=Td*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=Td*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 Yd(e){return t(Vd,e)?Vd[e]:function(e){if(!t(Xd,e)){const t=zd(e);Xd[e]={draw:function(e,n){Wd(e,t,0,0,Math.sqrt(n)/2)}}}return Xd[e]}(e)}var Xd={};const Jd=.448084975506;function Qd(e){return e.x}function Kd(e){return e.y}function Zd(e){return e.width}function eh(e){return e.height}function th(e){return"function"==typeof e?e:()=>+e}function nh(e,t,n){return Math.max(t,Math.min(e,n))}function ih(){var e=Qd,t=Kd,n=Zd,i=eh,r=th(0),a=r,o=r,s=r,u=null;function l(l,c,f){var d,h=null!=c?c:+e.call(this,l),p=null!=f?f:+t.call(this,l),m=+n.call(this,l),g=+i.call(this,l),y=Math.min(m,g)/2,v=nh(+r.call(this,l),0,y),b=nh(+a.call(this,l),0,y),x=nh(+o.call(this,l),0,y),w=nh(+s.call(this,l),0,y);if(u||(u=d=qn()),v<=0&&b<=0&&x<=0&&w<=0)u.rect(h,p,m,g);else{var _=h+m,A=p+g;u.moveTo(h+v,p),u.lineTo(_-b,p),u.bezierCurveTo(_-Jd*b,p,_,p+Jd*b,_,p+b),u.lineTo(_,A-w),u.bezierCurveTo(_,A-Jd*w,_-Jd*w,A,_-w,A),u.lineTo(h+x,A),u.bezierCurveTo(h+Jd*x,A,h,A-Jd*x,h,A-x),u.lineTo(h,p+v),u.bezierCurveTo(h,p+Jd*v,h+Jd*v,p,h+v,p),u.closePath()}if(d)return u=null,d+""||null}return l.x=function(t){return arguments.length?(e=th(t),l):e},l.y=function(e){return arguments.length?(t=th(e),l):t},l.width=function(e){return arguments.length?(n=th(e),l):n},l.height=function(e){return arguments.length?(i=th(e),l):i},l.cornerRadius=function(e,t,n,i){return arguments.length?(r=th(e),a=null!=t?th(t):r,s=null!=n?th(n):r,o=null!=i?th(i):a,l):r},l.context=function(e){return arguments.length?(u=null==e?null:e,l):u},l}function rh(){var e,t,n,i,r,a,o,s,u=null;function l(e,t,n){const i=n/2;if(r){var l=o-t,c=e-a;if(l||c){var f=Math.hypot(l,c),d=(l/=f)*s,h=(c/=f)*s,p=Math.atan2(c,l);u.moveTo(a-d,o-h),u.lineTo(e-l*i,t-c*i),u.arc(e,t,i,p-Math.PI,p),u.lineTo(a+d,o+h),u.arc(a,o,s,p,p+Math.PI)}else u.arc(e,t,i,0,Rd);u.closePath()}else r=1;a=e,o=t,s=i}function c(a){var o,s,c,f=a.length,d=!1;for(null==u&&(u=c=qn()),o=0;o<=f;++o)!(o<f&&i(s=a[o],o,a))===d&&(d=!d)&&(r=0),d&&l(+e(s,o,a),+t(s,o,a),+n(s,o,a));if(c)return u=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?(u=null==e?null:e,c):u},c}function ah(e,t){return null!=e?e:t}const oh=e=>e.x||0,sh=e=>e.y||0,uh=e=>!(!1===e.defined),lh=Qn().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)),ch=kc().x(oh).y1(sh).y0((e=>(e.y||0)+(e.height||0))).defined(uh),fh=kc().y(sh).x1(oh).x0((e=>(e.x||0)+(e.width||0))).defined(uh),dh=xn().x(oh).y(sh).defined(uh),hh=ih().x(oh).y(sh).width((e=>e.width||0)).height((e=>e.height||0)).cornerRadius((e=>ah(e.cornerRadiusTopLeft,e.cornerRadius)||0),(e=>ah(e.cornerRadiusTopRight,e.cornerRadius)||0),(e=>ah(e.cornerRadiusBottomRight,e.cornerRadius)||0),(e=>ah(e.cornerRadiusBottomLeft,e.cornerRadius)||0)),ph=function(e,t){let n=null,i=pn(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:mn(e||Dc),t="function"==typeof t?t:mn(void 0===t?64:+t),r.type=function(t){return arguments.length?(e="function"==typeof t?t:mn(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:mn(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type((e=>Yd(e.shape||"circle"))).size((e=>ah(e.size,64))),mh=rh().x(oh).y(sh).defined(uh).size((e=>e.size||1));function gh(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function yh(e,t,n,i){return hh.context(e)(t,n,i)}var vh=1;function bh(){vh=1}function xh(e,t,n){var i=t.clip,r=e._defs,a=t.clip_id||(t.clip_id="clip"+vh++),o=r.clipping[a]||(r.clipping[a]={id:a});return m(i)?o.path=i(null):gh(n)?o.path=yh(null,n,0,0):(o.width=n.width||0,o.height=n.height||0),"url(#"+a+")"}function wh(e){this.clear(),e&&this.union(e)}function _h(e){this.mark=e,this.bounds=this.bounds||new wh}function Ah(e){_h.call(this,e),this.items=this.items||[]}wh.prototype={clone(){return new wh(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:a,y2:o}=this,s=Math.cos(e),u=Math.sin(e),l=t-t*s+n*u,c=n-t*u-n*s;return[s*i-u*r+l,u*i+s*r+c,s*i-u*o+l,u*i+s*o+c,s*a-u*r+l,u*a+s*r+c,s*a-u*o+l,u*a+s*o+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}},_(Ah,_h);class kh{constructor(e){this._pending=0,this._loader=e||p()}pending(){return this._pending}sanitizeURL(e){const t=this;return Dh(t),t._loader.sanitize(e,{context:"href"}).then((e=>(Fh(t),e))).catch((()=>(Fh(t),null)))}loadImage(e){const n=this,i="undefined"!=typeof Image?Image:null;return Dh(n),n._loader.sanitize(e,{context:"image"}).then((e=>{const r=e.href;if(!r||!i)throw{url:r};const a=new i,o=t(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=o&&(a.crossOrigin=o),a.onload=()=>Fh(n),a.onerror=()=>Fh(n),a.src=r,a})).catch((e=>(Fh(n),{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 Dh(e){e._pending+=1}function Fh(e){e._pending-=1}function Ch(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 Eh=Rd-1e-8;let $h,Sh,Mh,Bh,zh,Oh,Nh,Rh;const Th=(e,t)=>$h.add(e,t),Ph=(e,t)=>Th(Sh=e,Mh=t),jh=e=>Th(e,$h.y1),Lh=e=>Th($h.x1,e),qh=(e,t)=>zh*e+Nh*t,Uh=(e,t)=>Oh*e+Rh*t,Ih=(e,t)=>Th(qh(e,t),Uh(e,t)),Wh=(e,t)=>Ph(qh(e,t),Uh(e,t));function Hh(e,t){return $h=e,t?(Bh=t*Od,zh=Rh=Math.cos(Bh),Oh=Math.sin(Bh),Nh=-Oh):(zh=Rh=1,Bh=Oh=Nh=0),Gh}const Gh={beginPath(){},closePath(){},moveTo:Wh,lineTo:Wh,rect(e,t,n,i){Bh?(Ih(e+n,t),Ih(e+n,t+i),Ih(e,t+i),Wh(e,t)):(Th(e+n,t+i),Ph(e,t))},quadraticCurveTo(e,t,n,i){const r=qh(e,t),a=Uh(e,t),o=qh(n,i),s=Uh(n,i);Vh(Sh,r,o,jh),Vh(Mh,a,s,Lh),Ph(o,s)},bezierCurveTo(e,t,n,i,r,a){const o=qh(e,t),s=Uh(e,t),u=qh(n,i),l=Uh(n,i),c=qh(r,a),f=Uh(r,a);Yh(Sh,o,u,c,jh),Yh(Mh,s,l,f,Lh),Ph(c,f)},arc(e,t,n,i,r,a){if(i+=Bh,r+=Bh,Sh=n*Math.cos(r)+e,Mh=n*Math.sin(r)+t,Math.abs(r-i)>Eh)Th(e-n,t-n),Th(e+n,t+n);else{const o=i=>Th(n*Math.cos(i)+e,n*Math.sin(i)+t);let s,u;if(o(i),o(r),r!==i)if((i%=Rd)<0&&(i+=Rd),(r%=Rd)<0&&(r+=Rd),r<i&&(a=!a,s=i,i=r,r=s),a)for(r-=Rd,s=i-i%Nd,u=0;u<4&&s>r;++u,s-=Nd)o(s);else for(s=i-i%Nd+Nd,u=0;u<4&&s<r;++u,s+=Nd)o(s)}}};function Vh(e,t,n,i){const r=(e-t)/(e+n-2*t);0<r&&r<1&&i(e+(t-e)*r)}function Yh(e,t,n,i,r){const a=i-e+3*t-3*n,o=e+n-2*t,s=e-t;let u,l=0,c=0;Math.abs(a)>1e-14?(u=o*o+s*a,u>=0&&(u=Math.sqrt(u),l=(-o+u)/a,c=(-o-u)/a)):l=.5*s/o,0<l&&l<1&&r(Xh(l,e,t,n,i)),0<c&&c<1&&r(Xh(c,e,t,n,i))}function Xh(e,t,n,i,r){const a=1-e,o=a*a,s=e*e;return o*a*t+3*o*e*n+3*a*s*i+s*e*r}var Jh=(Jh=Fc(1,1))?Jh.getContext("2d"):null;const Qh=new wh;function Kh(e){return function(t,n){if(!Jh)return!0;e(Jh,t),Qh.clear().union(t.bounds).intersect(n).round();const{x1:i,y1:r,x2:a,y2:o}=Qh;for(let e=r;e<=o;++e)for(let t=i;t<=a;++t)if(Jh.isPointInPath(t,e))return!0;return!1}}function Zh(e,t){return t.contains(e.x||0,e.y||0)}function ep(e,t){const n=e.x||0,i=e.y||0,r=e.width||0,a=e.height||0;return t.intersects(Qh.set(n,i,n+r,i+a))}function tp(e,t){const n=e.x||0,i=e.y||0;return np(t,n,i,null!=e.x2?e.x2:n,null!=e.y2?e.y2:i)}function np(e,t,n,i,r){const{x1:a,y1:o,x2:s,y2:u}=e,l=i-t,c=r-n;let f,d,h,p,m=0,g=1;for(p=0;p<4;++p){if(0===p&&(f=-l,d=-(a-t)),1===p&&(f=l,d=s-t),2===p&&(f=-c,d=-(o-n)),3===p&&(f=c,d=u-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 ip(e,t){e.globalCompositeOperation=t.blend||"source-over"}function rp(e,t){return null==e?t:e}function ap(e,t){const n=t.length;for(let i=0;i<n;++i)e.addColorStop(t[i].offset,t[i].color);return e}function op(e,t,n){return _d(n)?function(e,t,n){const i=n.width(),r=n.height();let a;if("radial"===t.gradient)a=e.createRadialGradient(n.x1+rp(t.x1,.5)*i,n.y1+rp(t.y1,.5)*r,Math.max(i,r)*rp(t.r1,0),n.x1+rp(t.x2,.5)*i,n.y1+rp(t.y2,.5)*r,Math.max(i,r)*rp(t.r2,.5));else{const o=rp(t.x1,0),s=rp(t.y1,0),u=rp(t.x2,1),l=rp(t.y2,0);if(o!==u&&s!==l&&i!==r){const n=Fc(Math.ceil(i),Math.ceil(r)),a=n.getContext("2d");return a.scale(i,r),a.fillStyle=ap(a.createLinearGradient(o,s,u,l),t.stops),a.fillRect(0,0,i,r),e.createPattern(n,"no-repeat")}a=e.createLinearGradient(n.x1+o*i,n.y1+s*r,n.x1+u*i,n.y1+l*r)}return ap(a,t.stops)}(e,n,t.bounds):n}function sp(e,t,n){return(n*=null==t.fillOpacity?1:t.fillOpacity)>0&&(e.globalAlpha=n,e.fillStyle=op(e,t,t.fill),!0)}var up=[];function lp(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=op(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||up),e.lineDashOffset=t.strokeDashOffset||0),!0))}function cp(e,t){return e.zindex-t.zindex||e.index-t.index}function fp(e){if(!e.zdirty)return e.zitems;var t,n,i,r=e.items,a=[];for(n=0,i=r.length;n<i;++n)(t=r[n]).index=n,t.zindex&&a.push(t);return e.zdirty=!1,e.zitems=a.sort(cp)}function dp(e,t){var n,i,r=e.items;if(!r||!r.length)return;const a=fp(e);if(a&&a.length){for(n=0,i=r.length;n<i;++n)r[n].zindex||t(r[n]);r=a}for(n=0,i=r.length;n<i;++n)t(r[n])}function hp(e,t){var n,i,r=e.items;if(!r||!r.length)return null;const a=fp(e);for(a&&a.length&&(r=a),i=r.length;--i>=0;)if(n=t(r[i]))return n;if(r===a)for(i=(r=e.items).length;--i>=0;)if(!r[i].zindex&&(n=t(r[i])))return n;return null}function pp(e){return function(t,n,i){dp(n,(n=>{i&&!i.intersects(n.bounds)||mp(e,t,n,n)}))}}function mp(e,t,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(e(t,i)||(ip(t,n),n.fill&&sp(t,n,r)&&t.fill(),n.stroke&&lp(t,n,r)&&t.stroke()))}function gp(e){return e=e||x,function(t,n,i,r,a,o){return i*=t.pixelRatio,r*=t.pixelRatio,hp(n,(n=>{const s=n.bounds;if((!s||s.contains(a,o))&&s)return e(t,n,i,r,a,o)?n:void 0}))}}function yp(e,t){return function(n,i,r,a){var o,s,u=Array.isArray(i)?i[0]:i,l=null==t?u.fill:t,c=u.stroke&&n.isPointInStroke;return c&&(o=u.strokeWidth,s=u.strokeCap,n.lineWidth=null!=o?o:1,n.lineCap=null!=s?s:"butt"),!e(n,i)&&(l&&n.isPointInPath(r,a)||c&&n.isPointInStroke(r,a))}}function vp(e){return gp(yp(e))}function bp(e,t){return"translate("+e+","+t+")"}function xp(e){return"rotate("+e+")"}function wp(e){return bp(e.x||0,e.y||0)}function _p(e,t,n){function i(e,n){var i=n.x||0,r=n.y||0,a=n.angle||0;e.translate(i,r),a&&e.rotate(a*=Od),e.beginPath(),t(e,n),a&&e.rotate(-a),e.translate(-i,-r)}return{type:e,tag:"path",nested:!1,attr:function(e,n){e("transform",function(e){return bp(e.x||0,e.y||0)+(e.angle?" "+xp(e.angle):"")}(n)),e("d",t(null,n))},bound:function(e,n){return t(Hh(e,n.angle),n),Ch(e,n).translate(n.x||0,n.y||0)},draw:pp(i),pick:vp(i),isect:n||Kh(i)}}var Ap=_p("arc",(function(e,t){return lh.context(e)(t)}));function kp(e,t,n){function i(e,n){e.beginPath(),t(e,n)}const r=yp(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(Hh(e),i),Ch(e,i[0]))},draw:(a=i,function(e,t,n){!t.items.length||n&&!n.intersects(t.bounds)||mp(a,e,t.items[0],t.items)}),pick:function(e,t,n,i,a,o){var s=t.items,u=t.bounds;return!s||!s.length||u&&!u.contains(a,o)?null:(n*=e.pixelRatio,i*=e.pixelRatio,r(e,s,n,i)?s[0]:null)},isect:Zh,tip:n};var a}var Dp=kp("area",(function(e,t){const n=t[0],i=n.interpolate||"linear";return("horizontal"===n.orient?fh:ch).curve(Cd(i,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,i,r="horizontal"===e[0].orient?t[1]:t[0],a="horizontal"===e[0].orient?"y":"x",o=e.length,s=1/0;--o>=0;)!1!==e[o].defined&&(i=Math.abs(e[o][a]-r))<s&&(s=i,n=e[o]);return n}));function Fp(e,t){e.beginPath(),gh(t)?yh(e,t,0,0):e.rect(0,0,t.width||0,t.height||0),e.clip()}function Cp(e){const t=rp(e.strokeWidth,1);return null!=e.strokeOffset?e.strokeOffset:e.stroke&&t>.5&&t<1.5?.5-Math.abs(t-1):0}function Ep(e,t){const n=Cp(t);e("d",yh(null,t,n,n))}function $p(e,t,n,i){const r=Cp(t);e.beginPath(),yh(e,t,(n||0)+r,(i||0)+r)}const Sp=yp($p),Mp=yp($p,!1),Bp=yp($p,!0);var zp={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",wp(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),Ch(e,t),e.translate(t.x||0,t.y||0)},draw:function(e,t,n,i){dp(t,(t=>{const r=t.x||0,a=t.y||0,o=t.strokeForeground,s=null==t.opacity?1:t.opacity;(t.stroke||t.fill)&&s&&($p(e,t,r,a),ip(e,t),t.fill&&sp(e,t,s)&&e.fill(),t.stroke&&!o&&lp(e,t,s)&&e.stroke()),e.save(),e.translate(r,a),t.clip&&Fp(e,t),n&&n.translate(-r,-a),dp(t,(t=>{("group"===t.marktype||null==i||i.includes(t.marktype))&&this.draw(e,t,n,i)})),n&&n.translate(r,a),e.restore(),o&&t.stroke&&s&&($p(e,t,r,a),ip(e,t),lp(e,t,s)&&e.stroke())}))},pick:function(e,t,n,i,r,a){if(t.bounds&&!t.bounds.contains(r,a)||!t.items)return null;const o=n*e.pixelRatio,s=i*e.pixelRatio;return hp(t,(u=>{let l,c,f;const d=u.bounds;if(d&&!d.contains(r,a))return;c=u.x||0,f=u.y||0;const h=c+(u.width||0),p=f+(u.height||0),m=u.clip;if(m&&(r<c||r>h||a<f||a>p))return;if(e.save(),e.translate(c,f),c=r-c,f=a-f,m&&gh(u)&&!Bp(e,u,o,s))return e.restore(),null;const g=u.strokeForeground,y=!1!==t.interactive;return y&&g&&u.stroke&&Mp(e,u,o,s)?(e.restore(),u):(l=hp(u,(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)),!l&&y&&(u.fill||!g&&u.stroke)&&Sp(e,u,o,s)&&(l=u),e.restore(),l||null)}))},isect:ep,content:function(e,t,n){e("clip-path",t.clip?xh(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),Ep(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?Ep(e,t):e("d","")}},Op={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function Np(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 Rp(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 Tp(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 Pp(e,t){return"center"===e?t/2:"right"===e?t:0}function jp(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var Lp={type:"image",tag:"image",nested:!1,attr:function(e,t,n){const i=Np(t,n),r=Rp(t,i),a=Tp(t,i),o=(t.x||0)-Pp(t.align,r),s=(t.y||0)-jp(t.baseline,a);e("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",Op["xmlns:xlink"],"xlink:href"),e("transform",bp(o,s)),e("width",r),e("height",a),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){const n=t.image,i=Rp(t,n),r=Tp(t,n),a=(t.x||0)-Pp(t.align,i),o=(t.y||0)-jp(t.baseline,r);return e.set(a,o,a+i,o+r)},draw:function(e,t,n){dp(t,(t=>{if(n&&!n.intersects(t.bounds))return;const i=Np(t,this);let r=Rp(t,i),a=Tp(t,i);if(0===r||0===a)return;let o,s,u,l,c=(t.x||0)-Pp(t.align,r),f=(t.y||0)-jp(t.baseline,a);!1!==t.aspect&&(s=i.width/i.height,u=t.width/t.height,s==s&&u==u&&s!==u&&(u<s?(l=r/s,f+=(a-l)/2,a=l):(l=a*s,c+=(r-l)/2,r=l))),(i.complete||i.toDataURL)&&(ip(e,t),e.globalAlpha=null!=(o=t.opacity)?o:1,e.imageSmoothingEnabled=!1!==t.smooth,e.drawImage(i,c,f,r,a))}))},pick:gp(),isect:x,get:Np,xOffset:Pp,yOffset:jp},qp=kp("line",(function(e,t){const n=t[0],i=n.interpolate||"linear";return dh.curve(Cd(i,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,i,r=Math.pow(e[0].strokeWidth||1,2),a=e.length;--a>=0;)if(!1!==e[a].defined&&(n=e[a].x-t[0])*n+(i=e[a].y-t[1])*i<r)return e[a];return null}));function Up(e,t){var n=t.path;if(null==n)return!0;var i=t.x||0,r=t.y||0,a=t.scaleX||1,o=t.scaleY||1,s=(t.angle||0)*Od,u=t.pathCache;u&&u.path===n||((t.pathCache=u=zd(n)).path=n),s&&e.rotate&&e.translate?(e.translate(i,r),e.rotate(s),Wd(e,u,0,0,a,o),e.rotate(-s),e.translate(-i,-r)):Wd(e,u,i,r,a,o)}var Ip={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 bp(e.x||0,e.y||0)+(e.angle?" "+xp(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 Up(Hh(e,t.angle),t)?e.set(0,0,0,0):Ch(e,t,!0)},draw:pp(Up),pick:vp(Up),isect:Kh(Up)};function Wp(e,t){e.beginPath(),yh(e,t)}var Hp={type:"rect",tag:"path",nested:!1,attr:function(e,t){e("d",yh(null,t))},bound:function(e,t){var n,i;return Ch(e.set(n=t.x||0,i=t.y||0,n+t.width||0,i+t.height||0),t)},draw:pp(Wp),pick:vp(Wp),isect:ep};function Gp(e,t,n){var i,r,a,o;return!(!t.stroke||!lp(e,t,n))&&(i=t.x||0,r=t.y||0,a=null!=t.x2?t.x2:i,o=null!=t.y2?t.y2:r,e.beginPath(),e.moveTo(i,r),e.lineTo(a,o),!0)}var Vp={type:"rule",tag:"line",nested:!1,attr:function(e,t){e("transform",wp(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 Ch(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){dp(t,(t=>{if(!n||n.intersects(t.bounds)){var i=null==t.opacity?1:t.opacity;i&&Gp(e,t,i)&&(ip(e,t),e.stroke())}}))},pick:gp((function(e,t,n,i){return!!e.isPointInStroke&&(Gp(e,t,1)&&e.isPointInStroke(n,i))})),isect:tp},Yp=_p("shape",(function(e,t){return(t.mark.shape||t.shape).context(e)(t)})),Xp=_p("symbol",(function(e,t){return ph.context(e)(t)}),Zh);const Jp=ue();var Qp={height:im,measureWidth:tm,estimateWidth:Zp,width:Zp,canvas:Kp};function Kp(e){Qp.width=e&&Jh?tm:Zp}function Zp(e,t){return em(sm(e,t),im(e))}function em(e,t){return~~(.8*e.length*t)}function tm(e,t){return im(e)<=0||!(t=sm(e,t))?0:nm(t,lm(e))}function nm(e,t){const n=`(${t}) ${e}`;let i=Jp.get(n);return void 0===i&&(Jh.font=t,i=Jh.measureText(e).width,Jp.set(n,i)),i}function im(e){return null!=e.fontSize?+e.fontSize||0:11}function rm(e){return null!=e.lineHeight?e.lineHeight:im(e)+2}function am(e){return t=e.lineBreak&&e.text&&!l(e.text)?e.text.split(e.lineBreak):e.text,l(t)?t.length>1?t:t[0]:t;var t}function om(e){const t=am(e);return(l(t)?t.length-1:0)*rm(e)}function sm(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(Qp.width===tm){const t=lm(e);return e=>nm(e,t)}if(Qp.width===Zp){const t=im(e);return e=>em(e,t)}return t=>Qp.width(e,t)}(e);if(i(t)<n)return t;var r,a=e.ellipsis||"…",o="rtl"===e.dir,s=0,u=t.length;if(n-=i(a),o){for(;s<u;)r=s+u>>>1,i(t.slice(r))>n?s=r+1:u=r;return a+t.slice(s)}for(;s<u;)r=1+(s+u>>>1),i(t.slice(0,r))<n?s=r:u=r-1;return t.slice(0,s)+a}(e,n):n}function um(e,t){var n=e.font;return(t&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function lm(e,t){return(e.fontStyle?e.fontStyle+" ":"")+(e.fontVariant?e.fontVariant+" ":"")+(e.fontWeight?e.fontWeight+" ":"")+im(e)+"px "+um(e,t)}function cm(e){var t=e.baseline,n=im(e);return Math.round("top"===t?.79*n:"middle"===t?.3*n:"bottom"===t?-.21*n:"line-top"===t?.29*n+.5*rm(e):"line-bottom"===t?.29*n-.5*rm(e):0)}Kp(!0);const fm={left:"start",center:"middle",right:"end"},dm=new wh;function hm(e){var t,n=e.x||0,i=e.y||0,r=e.radius||0;return r&&(t=(e.theta||0)-Nd,n+=r*Math.cos(t),i+=r*Math.sin(t)),dm.x1=n,dm.y1=i,dm}function pm(e,t,n){var i,r=Qp.height(t),a=t.align,o=hm(t),s=o.x1,u=o.y1,c=t.dx||0,f=(t.dy||0)+cm(t)-Math.round(.8*r),d=am(t);if(l(d)?(r+=rm(t)*(d.length-1),i=d.reduce(((e,n)=>Math.max(e,Qp.width(t,n))),0)):i=Qp.width(t,d),"center"===a?c-=i/2:"right"===a&&(c-=i),e.set(c+=s,f+=u,c+i,f+r),t.angle&&!n)e.rotate(t.angle*Od,s,u);else if(2===n)return e.rotatedPoints(t.angle*Od,s,u);return e}var mm={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,i=t.dx||0,r=(t.dy||0)+cm(t),a=hm(t),o=a.x1,s=a.y1,u=t.angle||0;e("text-anchor",fm[t.align]||"start"),u?(n=bp(o,s)+" "+xp(u),(i||r)&&(n+=" "+bp(i,r))):n=bp(o+i,s+r),e("transform",n)},bound:pm,draw:function(e,t,n){dp(t,(t=>{var i,r,a,o,s,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=lm(t),e.textAlign=t.align||"left",r=(i=hm(t)).x1,a=i.y1,t.angle&&(e.save(),e.translate(r,a),e.rotate(t.angle*Od),r=a=0),r+=t.dx||0,a+=(t.dy||0)+cm(t),u=am(t),ip(e,t),l(u))for(s=rm(t),o=0;o<u.length;++o)c=sm(t,u[o]),t.fill&&sp(e,t,f)&&e.fillText(c,r,a),t.stroke&&lp(e,t,f)&&e.strokeText(c,r,a),a+=s;else c=sm(t,u),t.fill&&sp(e,t,f)&&e.fillText(c,r,a),t.stroke&&lp(e,t,f)&&e.strokeText(c,r,a);t.angle&&e.restore()}}))},pick:gp((function(e,t,n,i,r,a){if(t.fontSize<=0)return!1;if(!t.angle)return!0;var o=hm(t),s=o.x1,u=o.y1,l=pm(dm,t,1),c=-t.angle*Od,f=Math.cos(c),d=Math.sin(c),h=f*r-d*a+(s-f*s+d*u),p=d*r+f*a+(u-d*s-f*u);return l.contains(h,p)})),isect:function(e,t){const n=pm(dm,e,2);return np(t,n[0],n[1],n[2],n[3])||np(t,n[0],n[1],n[4],n[5])||np(t,n[4],n[5],n[6],n[7])||np(t,n[2],n[3],n[6],n[7])}},gm={arc:Ap,area:Dp,group:zp,image:Lp,line:qp,path:Ip,rect:Hp,rule:Vp,shape:Yp,symbol:Xp,text:mm,trail:kp("trail",(function(e,t){return mh.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 ym(e,t,n){var i=gm[e.mark.marktype],r=t||i.bound;return i.nested&&(e=e.mark),r(e.bounds||(e.bounds=new wh),e,n)}var vm={mark:null};function bm(e,t,n){var i,r,a,o,s=gm[e.marktype],u=s.bound,l=e.items,c=l&&l.length;if(s.nested)return c?a=l[0]:(vm.mark=e,a=vm),o=ym(a,u,n),t=t&&t.union(o)||o;if(t=t||e.bounds&&e.bounds.clear()||new wh,c)for(i=0,r=l.length;i<r;++i)t.union(ym(l[i],u,n));return e.bounds=t}const xm=["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 wm(e,t){return JSON.stringify(e,xm,t)}function _m(e){return Am("string"==typeof e?JSON.parse(e):e)}function Am(e){var t,n,i,r=e.marktype,a=e.items;if(a)for(n=0,i=a.length;n<i;++n)t=r?"mark":"group",a[n][t]=e,a[n].zindex&&(a[n][t].zdirty=!0),"group"===(r||t)&&Am(a[n]);return r&&bm(e),e}class km{constructor(e){arguments.length?this.root=_m(e):(this.root=Dm({marktype:"group",name:"root",role:"frame"}),this.root.items=[new Ah(this.root)])}toJSON(e){return wm(this.root,e||0)}mark(e,t,n){const i=Dm(e,t=t||this.root.items[0]);return t.items[n]=i,i.zindex&&(i.group.zdirty=!0),i}}function Dm(e,t){const n={bounds:new wh,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 Fm(e,t,n){return!e&&"undefined"!=typeof document&&document.createElement&&(e=document),e?n?e.createElementNS(n,t):e.createElement(t):null}function Cm(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 Em(e,t,n,i){var r,a=e.childNodes[t];return a&&a.tagName.toLowerCase()===n.toLowerCase()||(r=a||null,a=Fm(e.ownerDocument,n,i),e.insertBefore(a,r)),a}function $m(e,t){for(var n=e.childNodes,i=n.length;i>t;)e.removeChild(n[--i]);return e}function Sm(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function Mm(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}class Bm{constructor(e,t){this._active=null,this._handlers={},this._loader=e||p(),this._tooltip=t||zm}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=Fm(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,a,o=e&&e.mark;if(o&&(r=gm[o.marktype]).tip){for((a=Mm(t,n))[0]-=i[0],a[1]-=i[1];e=e.mark.group;)a[0]-=e.x||0,a[1]-=e.y||0;e=r.tip(o.items,a)}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,a=r.width(),o=r.height();let s=r.x1+i[0]+n.left,u=r.y1+i[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,u+=e.y||0;return{x:s,y:u,width:a,height:o,left:s,top:u,right:s+a,bottom:u+o}}}function zm(e,t,n,i){e.element().setAttribute("title",i||"")}class Om{constructor(e){this._el=null,this._bgcolor=null,this._loader=new kh(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 Nm="dragenter",Rm="dragleave",Tm="dragover",Pm="pointerdown",jm="pointermove",Lm="pointerout",qm="pointerover",Um="mousedown",Im="mousemove",Wm="mouseout",Hm="mouseover",Gm="click",Vm="mousewheel",Ym="touchstart",Xm="touchmove",Jm="touchend",Qm=["keydown","keypress","keyup",Nm,Rm,Tm,Pm,"pointerup",jm,Lm,qm,Um,"mouseup",Im,Wm,Hm,Gm,"dblclick","wheel",Vm,Ym,Xm,Jm],Km=jm,Zm=Wm,eg=Gm;class tg extends Bm{constructor(e,t){super(e,t),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=Qm,this.pointermove=ag([jm,Im],[qm,Hm],[Lm,Wm]),this.dragover=ag([Tm],[Nm],[Rm]),this.pointerout=og([Lm,Wm]),this.dragleave=og([Rm])}initialize(e,t,n){return this._canvas=e&&Cm(e,"canvas"),[Gm,Um,Pm,jm,Lm,Rm].forEach((e=>ig(this,e))),super.initialize(e,t,n)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(e){this.fire(Vm,e)}pointerdown(e){this._down=this._active,this.fire(Pm,e)}mousedown(e){this._down=this._active,this.fire(Um,e)}click(e){this._down===this._active&&(this.fire(Gm,e),this._down=null)}touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(Ym,e,!0)}touchmove(e){this.fire(Xm,e,!0)}touchend(e){this.fire(Jm,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===eg&&i&&i.href?this.handleHref(t,i,i.href):e!==Km&&e!==Zm||this.handleTooltip(t,i,e!==Zm),r)for(let a=0,o=r.length;a<o;++a)r[a].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&&(ig(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=Mm(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 a=this.context();return gm[e.marktype].pick.call(this,a,e,t,n,i,r)}}const ng=e=>e===Ym||e===Xm||e===Jm?[Ym,Xm,Jm]:[e];function ig(e,t){ng(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 rg(e,t,n){t.forEach((t=>e.fire(t,n)))}function ag(e,t,n){return function(i){const r=this._active,a=this.pickEvent(i);a===r||(r&&r.exit||rg(this,n,i),this._active=a,rg(this,t,i)),rg(this,e,i)}}function og(e){return function(t){rg(this,e,t),this._active=null}}function sg(e,t,n,i,r,a){const o="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,s=e.getContext("2d"),u=o?"undefined"!=typeof window&&window.devicePixelRatio||1:r;e.width=t*u,e.height=n*u;for(const l in a)s[l]=a[l];return o&&1!==u&&(e.style.width=t+"px",e.style.height=n+"px"),s.pixelRatio=u,s.setTransform(u,0,0,u,u*i[0],u*i[1]),e}class ug extends Om{constructor(e){super(e),this._options={},this._redraw=!1,this._dirty=new wh,this._tempb=new wh}initialize(e,t,n,i,r,a){return this._options=a||{},this._canvas=this._options.externalContext?null:Fc(1,1,this._options.type),e&&this._canvas&&($m(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)sg(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const e=this._options.externalContext;e||v("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,a=this._height,o=this._dirty,s=lg(i,r,a);n.save();const u=this._redraw||o.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(o),i);return this.clear(-i[0],-i[1],r,a),this.draw(n,e,u,t),n.restore(),o.clear(),this}draw(e,t,n,i){if("group"!==t.marktype&&null!=i&&!i.includes(t.marktype))return;const r=gm[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),m(n)?(e.beginPath(),n(e),e.clip()):Fp(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,a=this.context();"pdf"===r.type||r.externalContext||a.clearRect(e,t,n,i),null!=this._bgcolor&&(a.fillStyle=this._bgcolor,a.fillRect(e,t,n,i))}}const lg=(e,t,n)=>(new wh).set(0,0,t,n).translate(-e[0],-e[1]);class cg extends Bm{constructor(e,t){super(e,t);const n=this;n._hrefHandler=fg(n,((e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=fg(n,((e,t)=>{n.handleTooltip(e,t,e.type!==Zm)}))}initialize(e,t,n){let i=this._svg;return i&&(i.removeEventListener(eg,this._hrefHandler),i.removeEventListener(Km,this._tooltipHandler),i.removeEventListener(Zm,this._tooltipHandler)),this._svg=i=e&&Cm(e,"svg"),i&&(i.addEventListener(eg,this._hrefHandler),i.addEventListener(Km,this._tooltipHandler),i.addEventListener(Zm,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:fg(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 fg=(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)},dg="aria-hidden",hg="aria-label",pg="role",mg="aria-roledescription",gg="graphics-object",yg="graphics-symbol",vg=(e,t,n)=>({[pg]:e,[mg]:t,[hg]:n||void 0}),bg=se(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),xg={axis:{desc:"axis",caption:function(e){const t=e.datum,n=e.orient,i=t.title?Dg(e):null,r=e.context,a=r.scales[t.scale].value,o=r.dataflow.locale(),s=a.type;return("left"===n||"right"===n?"Y":"X")+"-axis"+(i?` titled '${i}'`:"")+` for a ${jf(s)?"discrete":s} scale with ${bd(o,a,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,n=t.title?Dg(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,a=Object.keys(r),o=e.context,s=o.scales[r[a[0]]].value,u=o.dataflow.locale();return l=i,(l.length?l[0].toUpperCase()+l.slice(1):l)+(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 "+T(e)}(a)} with ${bd(u,s,e)}`;var l}},"title-text":{desc:"title",caption:e=>`Title text '${kg(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${kg(e)}'`}},wg={ariaRole:pg,ariaRoleDescription:mg,description:hg};function _g(e,t){const n=!1===t.aria;if(e(dg,n||void 0),n||null==t.description)for(const i in wg)e(wg[i],void 0);else{const n=t.mark.marktype;e(hg,t.description),e(pg,t.ariaRole||("group"===n?gg:yg)),e(mg,t.ariaRoleDescription||`${n} mark`)}}function Ag(e){return!1===e.aria?{[dg]:!0}:bg[e.role]?null:xg[e.role]?function(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return vg(t.role||yg,t.desc,n.description||i(n))}catch(n){return null}}(e,xg[e.role]):function(e){const t=e.marktype,n="group"===t||"text"===t||e.items.some((e=>null!=e.description&&!1!==e.aria));return vg(n?gg:yg,`${t} mark container`,e.description)}(e)}function kg(e){return c(e.text).join(" ")}function Dg(e){try{return c(T(e.items).items[0].text).join(" ")}catch(t){return null}}const Fg=e=>(e+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function Cg(){let e="",t="",n="";const i=[],r=()=>t=n="",a=(e,n)=>{var i;return null!=n&&(t+=` ${e}="${i=n,Fg(i).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;")}"`),o},o={open(s){(a=>{t&&(e+=`${t}>${n}`,r()),i.push(a)})(s),t="<"+s;for(var u=arguments.length,l=new Array(u>1?u-1:0),c=1;c<u;c++)l[c-1]=arguments[c];for(const e of l)for(const t in e)a(t,e[t]);return o},close(){const a=i.pop();return e+=t?t+(n?`>${n}</${a}>`:"/>"):`</${a}>`,r(),o},attr:a,text:e=>(n+=Fg(e),o),toString:()=>e};return o}const Eg=e=>$g(Cg(),e)+"";function $g(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):$g(e,t)}return e.close()}const Sg={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"},Mg={blend:"mix-blend-mode"},Bg={fill:"none","stroke-miterlimit":10},zg="http://www.w3.org/2000/xmlns/",Og=Op.xmlns;class Ng extends Om{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=Em(e,0,"svg",Og),this._svg.setAttributeNS(zg,"xmlns",Og),this._svg.setAttributeNS(zg,"xmlns:xlink",Op["xmlns:xlink"]),this._svg.setAttribute("version",Op.version),this._svg.setAttribute("class","marks"),$m(e,1),this._root=Em(this._svg,0,"g",Og),Hg(this._root,Bg),$m(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&&(Hg(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=Em(e,0,"rect",Og),Hg(n,{width:this._width,height:this._height,fill:t}));const i=Eg(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),$m(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,a,o,s,u;for(o=0,s=e.length;o<s;++o)n=e[o],i=n.mark,i.marktype!==r&&(r=i.marktype,a=gm[r]),i.zdirty&&i.dirty!==t&&(this._dirtyAll=!1,Rg(n,t),i.items.forEach((e=>{e.dirty=t}))),i.zdirty||(n.exit?(a.nested&&i.items.length?(u=i.items[0],u._svg&&this._update(a,u._svg,u)):n._svg&&(u=n._svg.parentNode,u&&u.removeChild(n._svg)),n._svg=null):(n=a.nested?i.items[0]:n,n._update!==t&&(n._svg&&n._svg.ownerSVGElement?this._update(a,n._svg,n):(this._dirtyAll=!1,Rg(n,t)),n._update=t)));return!this._dirtyAll}mark(e,t,n,i){if(!this.isDirty(t))return t._svg;const r=this._svg,a=t.marktype,o=gm[a],s=!1===t.interactive?"none":null,u="g"===o.tag,l=jg(t,e,n,"g",r);if("group"!==a&&null!=i&&!i.includes(a))return $m(l,0),t._svg;l.setAttribute("class",Sm(t));const c=Ag(t);for(const p in c)Gg(l,p,c[p]);u||Gg(l,"pointer-events",s),Gg(l,"clip-path",t.clip?xh(this,t,t.group):null);let f=null,d=0;const h=e=>{const t=this.isDirty(e),n=jg(e,l,f,o.tag,r);t&&(this._update(o,n,e),u&&function(e,t,n,i){t=t.lastChild.previousSibling;let r,a=0;dp(n,(n=>{r=e.mark(t,n,r,i),++a})),$m(t,1+a)}(this,n,e,i)),f=n,++d};return o.nested?t.items.length&&h(t.items[0]):dp(t,h),$m(l,d),l}_update(e,t,n){Lg=t,qg=t.__values__,_g(Ig,n),e.attr(Ig,n,this);const i=Ug[e.type];i&&i.call(this,e,t,n),Lg&&this.style(Lg,n)}style(e,t){if(null!=t){for(const n in Sg){let i="font"===n?um(t):t[n];if(i===qg[n])continue;const r=Sg[n];null==i?e.removeAttribute(r):(_d(i)&&(i=Ad(i,this._defs.gradient,Vg())),e.setAttribute(r,i+"")),qg[n]=i}for(const n in Mg)Wg(e,Mg[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=Em(e,1,"defs",Og)),i=Tg(n,t.gradient[r],i);for(const r in t.clipping)n||(t.el=n=Em(e,1,"defs",Og)),i=Pg(n,t.clipping[r],i);n&&(0===i?(e.removeChild(n),t.el=null):$m(n,i))}_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}}function Rg(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 Tg(e,t,n){let i,r,a;if("radial"===t.gradient){let i=Em(e,n++,"pattern",Og);Hg(i,{id:wd+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),i=Em(i,0,"rect",Og),Hg(i,{width:1,height:1,fill:`url(${Vg()}#${t.id})`}),Hg(e=Em(e,n++,"radialGradient",Og),{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else Hg(e=Em(e,n++,"linearGradient",Og),{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)a=Em(e,i,"stop",Og),a.setAttribute("offset",t.stops[i].offset),a.setAttribute("stop-color",t.stops[i].color);return $m(e,i),n}function Pg(e,t,n){let i;return(e=Em(e,n,"clipPath",Og)).setAttribute("id",t.id),t.path?(i=Em(e,0,"path",Og),i.setAttribute("d",t.path)):(i=Em(e,0,"rect",Og),Hg(i,{x:0,y:0,width:t.width,height:t.height})),$m(e,1),n+1}function jg(e,t,n,i,r){let a,o=e._svg;if(!o&&(a=t.ownerDocument,o=Fm(a,i,Og),e._svg=o,e.mark&&(o.__data__=e,o.__values__={fill:"default"},"g"===i))){const t=Fm(a,"path",Og);o.appendChild(t),t.__data__=e;const n=Fm(a,"g",Og);o.appendChild(n),n.__data__=e;const i=Fm(a,"path",Og);o.appendChild(i),i.__data__=e,i.__values__={fill:"default"}}return(o.ownerSVGElement!==r||function(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}(o,n))&&t.insertBefore(o,n?n.nextSibling:t.firstChild),o}let Lg=null,qg=null;const Ug={group(e,t,n){const i=Lg=t.childNodes[2];qg=i.__values__,e.foreground(Ig,n,this),qg=t.__values__,Lg=t.childNodes[1],e.content(Ig,n,this);const r=Lg=t.childNodes[0];e.background(Ig,n,this);const a=!1===n.mark.interactive?"none":null;if(a!==qg.events&&(Gg(i,"pointer-events",a),Gg(r,"pointer-events",a),qg.events=a),n.strokeForeground&&n.stroke){const e=n.fill;Gg(i,"display",null),this.style(r,n),Gg(r,"stroke",null),e&&(n.fill=null),qg=i.__values__,this.style(i,n),e&&(n.fill=e),Lg=null}else Gg(i,"display","none")},image(e,t,n){!1===n.smooth?(Wg(t,"image-rendering","optimizeSpeed"),Wg(t,"image-rendering","pixelated")):Wg(t,"image-rendering",null)},text(e,t,n){const i=am(n);let r,a,o,s;l(i)?(a=i.map((e=>sm(n,e))),r=a.join("\n"),r!==qg.text&&($m(t,0),o=t.ownerDocument,s=rm(n),a.forEach(((e,i)=>{const r=Fm(o,"tspan",Og);r.__data__=n,r.textContent=e,i&&(r.setAttribute("x",0),r.setAttribute("dy",s)),t.appendChild(r)})),qg.text=r)):(a=sm(n,i),a!==qg.text&&(t.textContent=a,qg.text=a)),Gg(t,"font-family",um(n)),Gg(t,"font-size",im(n)+"px"),Gg(t,"font-style",n.fontStyle),Gg(t,"font-variant",n.fontVariant),Gg(t,"font-weight",n.fontWeight)}};function Ig(e,t,n){t!==qg[e]&&(n?function(e,t,n,i){null!=n?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}(Lg,e,t,n):Gg(Lg,e,t),qg[e]=t)}function Wg(e,t,n){n!==qg[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),qg[t]=n)}function Hg(e,t){for(const n in t)Gg(e,n,t[n])}function Gg(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}function Vg(){let e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}class Yg extends Om{constructor(e){super(e),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(e){const t=Cg();t.open("svg",D({},Op,{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",Bg,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this}mark(e,t){const n=gm[t.marktype],i=n.tag,r=[_g,n.attr];e.open("g",{class:Sm(t),"clip-path":t.clip?xh(this,t,t.group):null},Ag(t),{"pointer-events":"g"!==i&&!1===t.interactive?"none":null});const a=a=>{const o=this.href(a);if(o&&e.open("a",o),e.open(i,this.attr(t,a,r,"g"!==i?i:null)),"text"===i){const t=am(a);if(l(t)){const n={x:0,dy:rm(a)};for(let i=0;i<t.length;++i)e.open("tspan",i?n:null).text(sm(a,t[i])).close()}else e.text(sm(a,t))}else if("g"===i){const i=a.strokeForeground,r=a.fill,o=a.stroke;i&&o&&(a.stroke=null),e.open("path",this.attr(t,a,n.background,"bgrect")).close(),e.open("g",this.attr(t,a,n.content)),dp(a,(t=>this.mark(e,t))),e.close(),i&&o?(r&&(a.fill=null),a.stroke=o,e.open("path",this.attr(t,a,n.foreground,"bgrect")).close(),r&&(a.fill=r)):e.open("path",this.attr(t,a,n.foreground,"bgfore")).close()}e.close(),o&&e.close()};return n.nested?t.items&&t.items.length&&a(t.items[0]):dp(t,a),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={},a=(e,t,n,i)=>{r[i||e]=t};return Array.isArray(n)?n.forEach((e=>e(a,t,this))):n(a,t,this),i&&function(e,t,n,i,r){let a;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&&(a=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]);"text"===i&&(e["font-family"]=um(t),e["font-size"]=im(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const o in Sg){let n=t[o];const i=Sg[o];("transparent"!==n||"fill"!==i&&"stroke"!==i)&&null!=n&&(_d(n)&&(n=Ad(n,r.gradient,"")),e[i]=n)}for(const o in Mg){const e=t[o];null!=e&&(a=a||[],a.push(`${Mg[o]}: ${e};`))}a&&(e.style=a.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:wd+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 Xg={svgMarkTypes:["text"],svgOnTop:!0,debug:!1};class Jg extends Om{constructor(e){super(e),this._svgRenderer=new Ng(e),this._canvasRenderer=new ug(e)}initialize(e,t,n,i,r){this._root_el=Em(e,0,"div");const a=Em(this._root_el,0,"div"),o=Em(this._root_el,1,"div");return this._root_el.style.position="relative",Xg.debug||(a.style.height="100%",o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.height="100%",o.style.width="100%"),this._svgEl=Xg.svgOnTop?o:a,this._canvasEl=Xg.svgOnTop?a:o,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 Xg.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=>!Xg.svgMarkTypes.includes(e)));this._svgRenderer.render(e,Xg.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 Xg.svgOnTop?this._canvasRenderer.background(e):this._svgRenderer.background(e),this}}class Qg extends tg{constructor(e,t){super(e,t)}initialize(e,t,n){const i=Em(Em(e,0,"div"),Xg.svgOnTop?0:1,"div");return super.initialize(i,t,n)}}const Kg="canvas",Zg="hybrid",ey="none",ty={Canvas:Kg,PNG:"png",SVG:"svg",Hybrid:Zg,None:ey},ny={};function iy(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(ny[e]=t,this):ny[e]}function ry(e,t,n){const i=[],r=(new wh).union(t),a=e.marktype;return a?ay(e,r,n,i):"group"===a?oy(e,r,n,i):v("Intersect scene must be mark node or group item.")}function ay(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,a=e.marktype,o=r.length;let s=0;if("group"===a)for(;s<o;++s)oy(r[s],t,n,i);else for(const e=gm[a].isect;s<o;++s){const n=r[s];sy(n,t,e)&&i.push(n)}}return i}function oy(e,t,n,i){n&&n(e.mark)&&sy(e,t,gm.group.isect)&&i.push(e);const r=e.items,a=r&&r.length;if(a){const o=e.x||0,s=e.y||0;t.translate(-o,-s);for(let e=0;e<a;++e)ay(r[e],t,n,i);t.translate(o,s)}return i}function sy(e,t,n){const i=e.bounds;return t.encloses(i)||t.intersects(i)&&n(e,t)}ny[Kg]=ny.png={renderer:ug,headless:ug,handler:tg},ny.svg={renderer:Ng,headless:Yg,handler:cg},ny[Zg]={renderer:Jg,headless:Jg,handler:Qg},ny[ey]={};const uy=new wh;function ly(e){const t=e.clip;if(m(t))t(Hh(uy.clear()));else{if(!t)return;uy.set(0,0,e.group.width,e.group.height)}e.bounds.intersect(uy)}function cy(e,t,i){return e===t||("path"===i?fy(e,t):e instanceof Date&&t instanceof Date?+e==+t:n(e)&&n(t)?Math.abs(e-t)<=1e-9:e&&t&&(o(e)||o(t))?function(e,t){var n,i,r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(r.sort(),a.sort(),i=r.length-1;i>=0;i--)if(r[i]!=a[i])return!1;for(i=r.length-1;i>=0;i--)if(!cy(e[n=r[i]],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function fy(e,t){return cy(zd(e),zd(t))}const dy="top",hy="left",py="right",my="bottom",gy="start",yy="middle",vy="end",by="group",xy="axis",wy="title",_y="frame",Ay="scope",ky="legend",Dy="row-header",Fy="row-footer",Cy="row-title",Ey="column-header",$y="column-footer",Sy="column-title",My="padding",By="fit",zy="fit-x",Oy="fit-y",Ny="none",Ry="all",Ty="each",Py="flush",jy="column",Ly="row";function qy(e){tu.call(this,null,e)}function Uy(e,t,n){return t(e.bounds.clear(),e,n)}_(qy,tu,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,a=gm[r],o=a.bound;let s,u=i.bounds;if(a.nested)i.items.length&&n.dirty(i.items[0]),u=Uy(i,o),i.items.forEach((e=>{e.bounds.clear().union(u)}));else if(r===by||e.modified())switch(t.visit(t.MOD,(e=>n.dirty(e))),u.clear(),i.items.forEach((e=>u.union(Uy(e,o)))),i.role){case xy:case ky:case wy:t.reflow()}else s=t.changed(t.REM),t.visit(t.ADD,(e=>{u.union(Uy(e,o))})),t.visit(t.MOD,(e=>{s=s||u.alignsWith(e.bounds),n.dirty(e),u.union(Uy(e,o))})),s&&(u.clear(),i.items.forEach((e=>u.union(e.bounds))));return ly(i),t.modifies("bounds")}});const Iy=":vega_identifier:";function Wy(e){tu.call(this,0,e)}function Hy(e){tu.call(this,null,e)}function Gy(e){tu.call(this,null,e)}Wy.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},_(Wy,tu,{transform(e,t){const n=(r=t.dataflow)._signals[Iy]||(r._signals[Iy]=r.add(0)),i=e.as;var r;let a=n.value;return t.visit(t.ADD,(e=>e[i]=e[i]||++a)),n.set(this.value=a),t}}),_(Hy,tu,{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===by?Ah:_h;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 Vy={parity:e=>e.filter(((e,t)=>t%2?e.opacity=0:1)),greedy:(e,t)=>{let n;return e.filter(((e,i)=>i&&Yy(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1)))}},Yy=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),Xy=(e,t)=>{for(var n,i=1,r=e.length,a=e[0].bounds;i<r;a=n,++i)if(Yy(a,n=e[i].bounds,t))return!0},Jy=e=>{const t=e.bounds;return t.width()>1&&t.height()>1},Qy=e=>(e.forEach((e=>e.opacity=1)),e),Ky=(e,t)=>e.reflow(t.modified()).modifies("opacity");function Zy(e){tu.call(this,null,e)}_(Gy,tu,{transform(e,t){const n=Vy[e.method]||Vy.parity,i=e.separation||0;let r,a,o=t.materialize(t.SOURCE).source;if(!o||!o.length)return;if(!e.method)return e.modified("method")&&(Qy(o),t=Ky(t,e)),t;if(o=o.filter(Jy),!o.length)return;if(e.sort&&(o=o.slice().sort(e.sort)),r=Qy(o),t=Ky(t,e),r.length>=3&&Xy(r,i)){do{r=n(r,i)}while(r.length>=3&&Xy(r,i));r.length<3&&!T(o).opacity&&(r.length>1&&(T(r).opacity=0),T(o).opacity=1)}var s,u,l,c,f;e.boundScale&&e.boundTolerance>=0&&(s=e.boundScale,u=e.boundOrient,l=+e.boundTolerance,c=s.range(),f=new wh,u===dy||u===my?f.set(c[0],-1/0,c[1],1/0):f.set(-1/0,c[0],1/0,c[1]),f.expand(l||1),a=e=>f.encloses(e.bounds),o.forEach((e=>{a(e)||(e.opacity=0)})));const d=r[0].mark.bounds.clear();return o.forEach((e=>{e.opacity&&d.union(e.bounds)})),t}}),_(Zy,tu,{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 ev=new wh;function tv(e,t,n){return e[t]===n?0:(e[t]=n,1)}function nv(e){var t=e.items[0].orient;return t===hy||t===py}function iv(e,t,n,i){var r,a,o=t.items[0],s=o.datum,u=null!=o.translate?o.translate:.5,l=o.orient,c=function(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}(s),f=o.range,d=o.offset,h=o.position,p=o.minExtent,m=o.maxExtent,g=s.title&&o.items[c[2]].items[0],y=o.titlePadding,v=o.bounds,b=g&&om(g),x=0,w=0;switch(ev.clear().union(v),v.clear(),(r=c[0])>-1&&v.union(o.items[r].bounds),(r=c[1])>-1&&v.union(o.items[r].bounds),l){case dy:x=h||0,w=-d,a=Math.max(p,Math.min(m,-v.y1)),v.add(0,-a).add(f,0),g&&rv(e,g,a,y,b,0,-1,v);break;case hy:x=-d,w=h||0,a=Math.max(p,Math.min(m,-v.x1)),v.add(-a,0).add(0,f),g&&rv(e,g,a,y,b,1,-1,v);break;case py:x=n+d,w=h||0,a=Math.max(p,Math.min(m,v.x2)),v.add(0,0).add(a,f),g&&rv(e,g,a,y,b,1,1,v);break;case my:x=h||0,w=i+d,a=Math.max(p,Math.min(m,v.y2)),v.add(0,0).add(f,a),g&&rv(e,g,a,y,0,0,1,v);break;default:x=o.x,w=o.y}return Ch(v.translate(x,w),o),tv(o,"x",x+u)|tv(o,"y",w+u)&&(o.bounds=ev,e.dirty(o),o.bounds=v,e.dirty(o)),o.mark.bounds.clear().union(v)}function rv(e,t,n,i,r,a,o,s){const u=t.bounds;if(t.auto){const s=o*(n+r+i);let l=0,c=0;e.dirty(t),a?l=(t.x||0)-(t.x=s):c=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(u.translate(-l,-c)),e.dirty(t)}s.union(u)}const av=(e,t)=>Math.floor(Math.min(e,t)),ov=(e,t)=>Math.ceil(Math.max(e,t));function sv(e){return(new wh).set(0,0,e.width||0,e.height||0)}function uv(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function lv(e,t,n){const i=o(e)?e[t]:e;return null!=i?i:void 0!==n?n:0}function cv(e){return e<0?Math.ceil(-e):0}function fv(e,t,n){var i,r,a,o,s,u,l,c,f,d,h,p=!n.nodirty,m=n.bounds===Py?sv:uv,g=ev.set(0,0,0,0),y=lv(n.align,jy),v=lv(n.align,Ly),b=lv(n.padding,jy),x=lv(n.padding,Ly),w=n.columns||t.length,_=w<=0?1:Math.ceil(t.length/w),A=t.length,k=Array(A),D=Array(w),F=0,C=Array(A),E=Array(_),$=0,S=Array(A),M=Array(A),B=Array(A);for(r=0;r<w;++r)D[r]=0;for(r=0;r<_;++r)E[r]=0;for(r=0;r<A;++r)u=t[r],s=B[r]=m(u),u.x=u.x||0,S[r]=0,u.y=u.y||0,M[r]=0,a=r%w,o=~~(r/w),F=Math.max(F,l=Math.ceil(s.x2)),$=Math.max($,c=Math.ceil(s.y2)),D[a]=Math.max(D[a],l),E[o]=Math.max(E[o],c),k[r]=b+cv(s.x1),C[r]=x+cv(s.y1),p&&e.dirty(t[r]);for(r=0;r<A;++r)r%w==0&&(k[r]=0),r<w&&(C[r]=0);if(y===Ty)for(a=1;a<w;++a){for(h=0,r=a;r<A;r+=w)h<k[r]&&(h=k[r]);for(r=a;r<A;r+=w)k[r]=h+D[a-1]}else if(y===Ry){for(h=0,r=0;r<A;++r)r%w&&h<k[r]&&(h=k[r]);for(r=0;r<A;++r)r%w&&(k[r]=h+F)}else for(y=!1,a=1;a<w;++a)for(r=a;r<A;r+=w)k[r]+=D[a-1];if(v===Ty)for(o=1;o<_;++o){for(h=0,i=(r=o*w)+w;r<i;++r)h<C[r]&&(h=C[r]);for(r=o*w;r<i;++r)C[r]=h+E[o-1]}else if(v===Ry){for(h=0,r=w;r<A;++r)h<C[r]&&(h=C[r]);for(r=w;r<A;++r)C[r]=h+$}else for(v=!1,o=1;o<_;++o)for(i=(r=o*w)+w;r<i;++r)C[r]+=E[o-1];for(f=0,r=0;r<A;++r)f=k[r]+(r%w?f:0),S[r]+=f-t[r].x;for(a=0;a<w;++a)for(d=0,r=a;r<A;r+=w)d+=C[r],M[r]+=d-t[r].y;if(y&&lv(n.center,jy)&&_>1)for(r=0;r<A;++r)(f=(s=y===Ry?F:D[r%w])-B[r].x2-t[r].x-S[r])>0&&(S[r]+=f/2);if(v&&lv(n.center,Ly)&&1!==w)for(r=0;r<A;++r)(d=(s=v===Ry?$:E[~~(r/w)])-B[r].y2-t[r].y-M[r])>0&&(M[r]+=d/2);for(r=0;r<A;++r)g.union(B[r].translate(S[r],M[r]));switch(f=lv(n.anchor,"x"),d=lv(n.anchor,"y"),lv(n.anchor,jy)){case vy:f-=g.width();break;case yy:f-=g.width()/2}switch(lv(n.anchor,Ly)){case vy:d-=g.height();break;case yy:d-=g.height()/2}for(f=Math.round(f),d=Math.round(d),g.clear(),r=0;r<A;++r)t[r].mark.bounds.clear();for(r=0;r<A;++r)(u=t[r]).x+=S[r]+=f,u.y+=M[r]+=d,g.union(u.mark.bounds.union(u.bounds.translate(S[r],M[r]))),p&&e.dirty(u);return g}function dv(e,t,n){var i,r,a,o,s,u,l,c=function(e){var t,n,i=e.items,r=i.length,a=0;const o={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;a<r;++a)if(n=(t=i[a]).items,t.marktype===by)switch(t.role){case xy:case ky:case wy:break;case Dy:o.rowheaders.push(...n);break;case Fy:o.rowfooters.push(...n);break;case Ey:o.colheaders.push(...n);break;case $y:o.colfooters.push(...n);break;case Cy:o.rowtitle=n[0];break;case Sy:o.coltitle=n[0];break;default:o.marks.push(...n)}return o}(t),f=c.marks,d=n.bounds===Py?hv:pv,h=n.offset,p=n.columns||f.length,m=p<=0?1:Math.ceil(f.length/p),g=m*p;const y=fv(e,f,n);y.empty()&&y.set(0,0,0,0),c.rowheaders&&(u=lv(n.headerBand,Ly,null),i=mv(e,c.rowheaders,f,p,m,-lv(h,"rowHeader"),av,0,d,"x1",0,p,1,u)),c.colheaders&&(u=lv(n.headerBand,jy,null),r=mv(e,c.colheaders,f,p,p,-lv(h,"columnHeader"),av,1,d,"y1",0,1,p,u)),c.rowfooters&&(u=lv(n.footerBand,Ly,null),a=mv(e,c.rowfooters,f,p,m,lv(h,"rowFooter"),ov,0,d,"x2",p-1,p,1,u)),c.colfooters&&(u=lv(n.footerBand,jy,null),o=mv(e,c.colfooters,f,p,p,lv(h,"columnFooter"),ov,1,d,"y2",g-p,1,p,u)),c.rowtitle&&(s=lv(n.titleAnchor,Ly),l=lv(h,"rowTitle"),l=s===vy?a+l:i-l,u=lv(n.titleBand,Ly,.5),gv(e,c.rowtitle,l,0,y,u)),c.coltitle&&(s=lv(n.titleAnchor,jy),l=lv(h,"columnTitle"),l=s===vy?o+l:r-l,u=lv(n.titleBand,jy,.5),gv(e,c.coltitle,l,1,y,u))}function hv(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 pv(e,t){return e.bounds[t]}function mv(e,t,n,i,r,a,o,s,u,l,c,f,d,h){var p,m,g,y,v,b,x,w,_,A=n.length,k=0,D=0;if(!A)return k;for(p=c;p<A;p+=f)n[p]&&(k=o(k,u(n[p],l)));if(!t.length)return k;for(t.length>r&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),k+=a,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()),_=k):(w=k,_=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),D=o(D,v[l])}return D}function gv(e,t,n,i,r,a){if(t){e.dirty(t);var o=n,s=n;i?o=Math.round(r.x1+a*r.width()):s=Math.round(r.y1+a*r.height()),t.bounds.translate(o-(t.x||0),s-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=o,t.y=s,e.dirty(t)}}function yv(e,t,n,i,r,a,o){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),u=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)),l=s("anchor",gy),c=l===vy?1:l===yy?.5:0,f={align:Ty,bounds:s("bounds",Py),columns:"vertical"===s("direction")?1:e.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(t){case hy:f.anchor={x:Math.floor(i.x1)-u,column:vy,y:c*(o||i.height()+2*i.y1),row:l};break;case py:f.anchor={x:Math.ceil(i.x2)+u,y:c*(o||i.height()+2*i.y1),row:l};break;case dy:f.anchor={y:Math.floor(r.y1)-u,row:vy,x:c*(a||r.width()+2*r.x1),column:l};break;case my:f.anchor={y:Math.ceil(r.y2)+u,x:c*(a||r.width()+2*r.x1),column:l};break;case"top-left":f.anchor={x:u,y:u};break;case"top-right":f.anchor={x:a-u,y:u,column:vy};break;case"bottom-left":f.anchor={x:u,y:o-u,row:vy};break;case"bottom-right":f.anchor={x:a-u,y:o-u,column:vy,row:vy}}return f}function vv(e,t){var n,i,r=t.items[0],a=r.datum,o=r.orient,s=r.bounds,u=r.x,l=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,a=i-n.y;if(t.datum.title){var o=t.items[1].items[0],s=o.anchor,u=t.titlePadding||0,l=i-o.x,c=i-o.y;switch(o.orient){case hy:r+=Math.ceil(o.bounds.width())+u;break;case py:case my:break;default:a+=o.bounds.height()+u}switch((r||a)&&xv(e,n,r,a),o.orient){case hy:c+=bv(t,n,o,s,1,1);break;case py:l+=bv(t,n,o,vy,0,0)+u,c+=bv(t,n,o,s,1,1);break;case my:l+=bv(t,n,o,s,0,0),c+=bv(t,n,o,vy,-1,0,1)+u;break;default:l+=bv(t,n,o,s,0,0)}(l||c)&&xv(e,o,l,c),(l=Math.round(o.bounds.x1-i))<0&&(xv(e,n,-l,0),xv(e,o,-l,0))}else(r||a)&&xv(e,n,r,a)}(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"===a.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),o!==Ny&&(r.x=u=0,r.y=l=0),r.width=n,r.height=i,Ch(s.set(u,l,u+n,l+i),r),r.mark.bounds.clear().union(s),r}function bv(e,t,n,i,r,a,o){const s="symbol"!==e.datum.type,u=n.datum.vgrad,l=(!s||!a&&u||o?t:t.items[0]).bounds[r?"y2":"x2"]-e.padding,c=u&&a?l:0,f=u&&a?0:l,d=r<=0?0:om(n);return Math.round(i===gy?c:i===vy?f-d:.5*(l-d))}function xv(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 wv(e){tu.call(this,null,e)}_(wv,tu,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach((t=>{e.layout&&dv(n,t,e.layout),function(e,t,n){var i,r,a,o,s,u=t.items,l=Math.max(0,t.width||0),c=Math.max(0,t.height||0),f=(new wh).set(0,0,l,c),d=f.clone(),h=f.clone(),p=[];for(o=0,s=u.length;o<s;++o)switch((r=u[o]).role){case xy:(nv(r)?d:h).union(iv(e,r,l,c));break;case wy:i=r;break;case ky:p.push(vv(e,r));break;case _y:case Ay:case Dy:case Fy:case Cy:case Ey:case $y:case Sy:d.union(r.bounds),h.union(r.bounds);break;default:f.union(r.bounds)}if(p.length){const t={};p.forEach((e=>{(a=e.orient||py)!==Ny&&(t[a]||(t[a]=[])).push(e)}));for(const i in t){const r=t[i];fv(e,r,yv(r,i,n.legends,d,h,l,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!==By&&n.autosize.type!==zy&&n.autosize.type!==Oy)f.union(i);else switch(t.orient){case hy:case py:f.add(i.x1,0).add(i.x2,0);break;case dy:case my:f.add(0,i.y1).add(0,i.y2)}}))}f.union(d).union(h),i&&f.union(function(e,t,n,i,r){var a,o=t.items[0],s=o.frame,u=o.orient,l=o.anchor,c=o.offset,f=o.padding,d=o.items[0].items[0],h=o.items[1]&&o.items[1].items[0],p=u===hy||u===py?i:n,m=0,g=0,y=0,v=0,b=0;if(s!==by?u===hy?(m=r.y2,p=r.y1):u===py?(m=r.y1,p=r.y2):(m=r.x1,p=r.x2):u===hy&&(m=i,p=0),a=l===gy?m:l===vy?p:(m+p)/2,h&&h.text){switch(u){case dy:case my:b=d.bounds.height()+f;break;case hy:v=d.bounds.width()+f;break;case py:v=-d.bounds.width()-f}ev.clear().union(h.bounds),ev.translate(v-(h.x||0),b-(h.y||0)),tv(h,"x",v)|tv(h,"y",b)&&(e.dirty(h),h.bounds.clear().union(ev),h.mark.bounds.clear().union(ev),e.dirty(h)),ev.clear().union(h.bounds)}else ev.clear();switch(ev.union(d.bounds),u){case dy:g=a,y=r.y1-ev.height()-c;break;case hy:g=r.x1-ev.width()-c,y=a;break;case py:g=r.x2+ev.width()+c,y=a;break;case my:g=a,y=r.y2+c;break;default:g=o.x,y=o.y}return tv(o,"x",g)|tv(o,"y",y)&&(ev.translate(g,y),e.dirty(o),o.bounds.clear().union(ev),t.bounds.clear().union(ev),e.dirty(o)),o.bounds}(e,i,l,c,f));t.clip&&f.set(0,0,t.width||0,t.height||0);!function(e,t,n,i){const r=i.autosize||{},a=r.type;if(e._autosize<1||!a)return;let o=e._width,s=e._height,u=Math.max(0,t.width||0),l=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-u)),h=Math.max(0,Math.ceil(n.y2-c));if(r.contains===My){const t=e.padding();o-=t.left+t.right,s-=t.top+t.bottom}a===Ny?(l=0,f=0,u=o,c=s):a===By?(u=Math.max(0,o-l-d),c=Math.max(0,s-f-h)):a===zy?(u=Math.max(0,o-l-d),s=c+f+h):a===Oy?(o=u+l+d,c=Math.max(0,s-f-h)):"pad"===a&&(o=u+l+d,s=c+f+h);e._resizeView(o,s,u,c,[l,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 _v=Object.freeze(Object.defineProperty({__proto__:null,bound:qy,identifier:Wy,mark:Hy,overlap:Gy,render:Zy,viewlayout:wv},Symbol.toStringTag,{value:"Module"}));function Av(e){tu.call(this,null,e)}function kv(e){tu.call(this,null,e)}function Dv(){return ks({})}function Fv(e){tu.call(this,null,e)}function Cv(e){tu.call(this,[],e)}_(Av,tu,{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,a=e.scale,o=rd(a,null==e.count?e.values?e.values.length:10:e.count,e.minstep),s=e.format||sd(n,a,o,e.formatSpecifier,e.formatType,!!e.values),u=e.values?ad(a,e.values,o):od(a,o);return r&&(i.rem=r),r=u.map(((e,t)=>ks({index:t/(u.length-1||1),value:e,label:s(e)}))),e.extra&&r.length&&r.push(ks({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}}),_(kv,tu,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||Dv,a=e.key||_s,o=this.value;return l(i.encode)&&(i.encode=null),o&&(e.modified("key")||t.modified(a))&&v("DataJoin does not support modified key function or fields."),o||(t=t.addAll(),this.value=o=function(e){const t=W().test((e=>e.exit));return t.lookup=n=>t.get(e(n)),t}(a)),t.visit(t.ADD,(e=>{const t=a(e);let n=o.get(t);n?n.exit?(o.empty--,i.add.push(n)):i.mod.push(n):(n=r(e),o.set(t,n),i.add.push(n)),n.datum=e,n.exit=!1})),t.visit(t.MOD,(e=>{const t=a(e),n=o.get(t);n&&(n.datum=e,i.mod.push(n))})),t.visit(t.REM,(e=>{const t=a(e),n=o.get(t);e!==n.datum||n.exit||(i.rem.push(n),n.exit=!0,++o.empty)})),t.changed(t.ADD_MOD)&&i.modifies("datum"),(t.clean()||e.clean&&o.empty>n.cleanThreshold)&&n.runAfter(o.clean),i}}),_(Fv,tu,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,a=t.encode;if(l(a)){if(!n.changed()&&!a.every((e=>r[e])))return t.StopPropagation;a=a[0],n.encode=null}var o="enter"===a,s=r.update||le,u=r.enter||le,c=r.exit||le,f=(a&&!o?r[a]:s)||le;if(t.changed(t.ADD)&&(t.visit(t.ADD,(t=>{u(t,e),s(t,e)})),n.modifies(u.output),n.modifies(s.output),f!==le&&f!==s&&(t.visit(t.ADD,(t=>{f(t,e)})),n.modifies(f.output))),t.changed(t.REM)&&c!==le&&(t.visit(t.REM,(t=>{c(t,e)})),n.modifies(c.output)),o||f!==le){const r=t.MOD|(e.modified()?t.REFLOW:0);o?(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}}),_(Cv,tu,{transform(e,t){if(null!=this.value&&!e.modified())return t.StopPropagation;var n,i,r,a,o,s=t.dataflow.locale(),u=t.fork(t.NO_SOURCE|t.NO_FIELDS),l=this.value,c=e.type||ed,f=e.scale,d=+e.limit,h=rd(f,null==e.count?5:e.count,e.minstep),p=!!e.values||c===ed,y=e.format||dd(s,f,h,c,e.formatSpecifier,e.formatType,p),v=e.values||fd(f,h);return l&&(u.rem=l),c===ed?(d&&v.length>d?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=v.slice(0,d-1),o=!0):l=v,m(r=e.size)?(e.values||0!==f(l[0])||(l=l.slice(1)),a=l.reduce(((t,n)=>Math.max(t,r(n,e))),0)):r=g(a=r||8),l=l.map(((t,n)=>ks({index:n,label:y(t,n,l),value:t,offset:a,size:r(t,e)}))),o&&(o=v[l.length],l.push(ks({index:l.length,label:`…${v.length-l.length} entries`,value:o,offset:a,size:r(o,e)})))):"gradient"===c?(n=f.domain(),i=Yf(f,n[0],T(n)),v.length<3&&!e.values&&n[0]!==T(n)&&(v=[n[0],T(n)]),l=v.map(((e,t)=>ks({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=+T(t),a=r-i;if(e.type===yf){const e=n?a/n:.1;i-=e,r+=e,a=r-i}return e=>(e-i)/a}(f),l=v.map(((e,t)=>ks({index:t,label:y(e,t,v),value:e,perc:t?i(e):0,perc2:t===r?1:i(v[t+1])})))),u.source=l,u.add=l,this.value=l,u}});const Ev=e=>e.source.x,$v=e=>e.source.y,Sv=e=>e.target.x,Mv=e=>e.target.y;function Bv(e){tu.call(this,{},e)}Bv.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"}]},_(Bv,tu,{transform(e,t){var n=e.sourceX||Ev,i=e.sourceY||$v,r=e.targetX||Sv,a=e.targetY||Mv,o=e.as||"path",s=e.orient||"vertical",u=e.shape||"line",l=Rv.get(u+"-"+s)||Rv.get(u);return l||v("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(e=>{e[o]=l(n(e),i(e),r(e),a(e))})),t.reflow(e.modified()).modifies(o)}});const zv=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,Ov=(e,t,n,i)=>{var r=n-e,a=i-t,o=Math.hypot(r,a)/2;return"M"+e+","+t+"A"+o+","+o+" "+180*Math.atan2(a,r)/Math.PI+" 0 1 "+n+","+i},Nv=(e,t,n,i)=>{const r=n-e,a=i-t,o=.2*(r+a),s=.2*(a-r);return"M"+e+","+t+"C"+(e+o)+","+(t+s)+" "+(n+s)+","+(i-o)+" "+n+","+i},Rv=W({line:zv,"line-radial":(e,t,n,i)=>zv(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),arc:Ov,"arc-radial":(e,t,n,i)=>Ov(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),curve:Nv,"curve-radial":(e,t,n,i)=>Nv(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),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n);return"M"+t*r+","+t*a+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*o+","+t*s+"L"+i*o+","+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),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n),u=(t+i)/2;return"M"+t*r+","+t*a+"C"+u*r+","+u*a+" "+u*o+","+u*s+" "+i*o+","+i*s}});function Tv(e){tu.call(this,null,e)}Tv.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"]}]},_(Tv,tu,{transform(e,t){var n,i,r,a=e.as||["startAngle","endAngle"],o=a[0],s=a[1],u=e.field||ce,l=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,d=f.map(u),h=d.length,p=l,m=(c-l)/oi(d),g=Ht(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]])[o]=p,i[s]=p+=r*m;return this.value=d,t.reflow(e.modified()).modifies(a)}});function Pv(e){return Pf(e)&&e!==hf}const jv=se(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function Lv(e){tu.call(this,null,e),this.modified(!0)}function qv(e,t,n){qf(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: "+a(t)));return t}function Uv(e,t,n){return m(e)&&(t||n)?Hf(e,Iv(t||[0,1],n)):e}function Iv(e,t){return t?e.slice().reverse():e}function Wv(e){tu.call(this,null,e)}_(Lv,tu,{transform(e,t){var n=t.dataflow,r=this.value,a=function(e){var t,n=e.type,r="";if(n===hf)return hf+"-"+of;(function(e){const t=e.type;return Pf(t)&&t!==ff&&t!==df&&(e.scheme||e.range&&e.range.length&&e.range.every(i))})(e)&&(r=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?hf+"-":3===t?pf+"-":"");return(r+n||of).toLowerCase()}(e);for(a in r&&a===r.type||(this.value=r=Nf(a)()),e)if(!jv[a]){if("padding"===a&&Pv(r.type))continue;m(r[a])?r[a](e[a]):n.warn("Unsupported scale property: "+a)}return function(e,t,n){var i=e.type,r=t.round||!1,a=t.range;if(null!=t.rangeStep)a=function(e,t,n){e!==xf&&e!==bf&&v("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,r=e===bf?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*af(n,r,i)]}(i,t,n);else if(t.scheme&&(a=function(e,t,n){var i,r=t.schemeExtent;l(t.scheme)?i=Gf(t.scheme,t.interpolate,t.interpolateGamma):(i=Zf(t.scheme.toLowerCase()))||v(`Unrecognized scheme name: ${t.scheme}`);return n=e===yf?n+1:e===wf?n-1:e===mf||e===gf?+t.schemeCount||5:n,Uf(e)?Uv(i,r,t.reverse):m(i)?Vf(Uv(i,r),n):e===vf?i:i.slice(0,n)}(i,t,n),m(a))){if(e.interpolator)return e.interpolator(a);v(`Scale type ${i} does not support interpolating color schemes.`)}if(a&&Uf(i))return e.interpolator(Gf(Iv(a,t.reverse),t.interpolate,t.interpolateGamma));a&&t.interpolate&&e.interpolate?e.interpolate(Xf(t.interpolate,t.interpolateGamma)):m(e.round)?e.round(r):m(e.rangeRound)&&e.interpolate(r?Nt:St);a&&e.range(Iv(a,t.reverse))}(r,e,function(e,t,n){let i=t.bins;if(i&&!l(i)){const t=e.domain(),n=t[0],r=T(t),a=i.step;let o=null==i.start?n:i.start,s=null==i.stop?r:i.stop;a||v("Scale bins parameter missing step property."),o<n&&(o=a*Math.ceil(n/a)),s>r&&(s=a*Math.floor(r/a)),i=Ht(o,s+a/2,a)}i?e.bins=i:e.bins&&delete e.bins;e.type===wf&&(i?t.domain||t.domainRaw||(e.domain(i),n=i.length):e.bins=e.domain());return n}(r,e,function(e,t,n){const i=function(e,t,n){return t?(e.domain(qv(e.type,t,n)),t.length):-1}(e,t.domainRaw,n);if(i>-1)return i;var r,a,o=t.domain,s=e.type,u=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===of||t===uf||t===lf)}(e);if(!o)return 0;if((u||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(r=(o=o.slice()).length-1||1,u&&(o[0]>0&&(o[0]=0),o[r]<0&&(o[r]=0)),null!=t.domainMin&&(o[0]=t.domainMin),null!=t.domainMax&&(o[r]=t.domainMax),null!=t.domainMid)){const e=(a=t.domainMid)>o[r]?r+1:a<o[0]?0:r;e!==r&&n.warn("Scale domainMid exceeds domain min or max.",a),o.splice(e,0,a)}Pv(s)&&t.padding&&o[0]!==T(o)&&(o=function(e,t,n,i,r,a){var o=Math.abs(T(n)-n[0]),s=o/(o-2*i),u=e===sf?fe(t,null,s):e===lf?de(t,null,s,.5):e===uf?de(t,null,s,r||1):e===cf?he(t,null,s,a||1):pe(t,null,s);return t=t.slice(),t[0]=u[0],t[t.length-1]=u[1],t}(s,o,t.range,t.padding,t.exponent,t.constant));e.domain(qv(s,o,n)),s===vf&&e.unknown(t.domainImplicit?Xn:void 0);t.nice&&e.nice&&e.nice(!0!==t.nice&&rd(e,t.nice)||null);return o.length}(r,e,n))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),_(Wv,tu,{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(Es(e.sort)),this.modified(n),t}});const Hv="zero",Gv="center",Vv="normalize",Yv=["y0","y1"];function Xv(e){tu.call(this,null,e)}function Jv(e,t,n,i,r){for(var a,o=(t-e.sum)/2,s=e.length,u=0;u<s;++u)(a=e[u])[i]=o,a[r]=o+=Math.abs(n(a))}function Qv(e,t,n,i,r){for(var a,o=1/e.sum,s=0,u=e.length,l=0,c=0;l<u;++l)(a=e[l])[i]=s,a[r]=s=o*(c+=Math.abs(n(a)))}function Kv(e,t,n,i,r){for(var a,o,s=0,u=0,l=e.length,c=0;c<l;++c)(a=+n(o=e[c]))<0?(o[i]=u,o[r]=u+=a):(o[i]=s,o[r]=s+=a)}Xv.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:Hv,values:[Hv,Gv,Vv]},{name:"as",type:"string",array:!0,length:2,default:Yv}]},_(Xv,tu,{transform(e,t){var n,i,r,a,o=e.as||Yv,s=o[0],u=o[1],l=Es(e.sort),c=e.field||ce,f=e.offset===Gv?Jv:e.offset===Vv?Qv:Kv;for(n=function(e,t,n,i){var r,a,o,s,u,l,c,f,d,h=[],p=e=>e(u);if(null==t)h.push(e.slice());else for(r={},a=0,o=e.length;a<o;++a)u=e[a],(c=r[l=t.map(p)])||(r[l]=c=[],h.push(c)),c.push(u);for(l=0,d=0,s=h.length;l<s;++l){for(a=0,f=0,o=(c=h[l]).length;a<o;++a)f+=Math.abs(i(c[a]));c.sum=f,f>d&&(d=f),n&&c.sort(n)}return h.max=d,h}(t.source,e.groupby,l,c),i=0,r=n.length,a=n.max;i<r;++i)f(n[i],a,c,s,u);return t.reflow(e.modified()).modifies(o)}});const Zv=Object.freeze(Object.defineProperty({__proto__:null,axisticks:Av,datajoin:kv,encode:Fv,legendentries:Cv,linkpath:Bv,pie:Tv,scale:Lv,sortitems:Wv,stack:Xv},Symbol.toStringTag,{value:"Module"}));var eb=1e-6,tb=1e-12,nb=Math.PI,ib=nb/2,rb=nb/4,ab=2*nb,ob=180/nb,sb=nb/180,ub=Math.abs,lb=Math.atan,cb=Math.atan2,fb=Math.cos,db=Math.ceil,hb=Math.exp,pb=Math.hypot,mb=Math.log,gb=Math.pow,yb=Math.sin,vb=Math.sign||function(e){return e>0?1:e<0?-1:0},bb=Math.sqrt,xb=Math.tan;function wb(e){return e>1?0:e<-1?nb:Math.acos(e)}function _b(e){return e>1?ib:e<-1?-ib:Math.asin(e)}function Ab(){}function kb(e,t){e&&Fb.hasOwnProperty(e.type)&&Fb[e.type](e,t)}var Db={Feature:function(e,t){kb(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++i<r;)kb(n[i].geometry,t)}},Fb={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){Cb(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)Cb(n[i],t,0)},Polygon:function(e,t){Eb(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)Eb(n[i],t)},GeometryCollection:function(e,t){for(var n=e.geometries,i=-1,r=n.length;++i<r;)kb(n[i],t)}};function Cb(e,t,n){var i,r=-1,a=e.length-n;for(t.lineStart();++r<a;)i=e[r],t.point(i[0],i[1],i[2]);t.lineEnd()}function Eb(e,t){var n=-1,i=e.length;for(t.polygonStart();++n<i;)Cb(e[n],t,1);t.polygonEnd()}function $b(e,t){e&&Db.hasOwnProperty(e.type)?Db[e.type](e,t):kb(e,t)}var Sb,Mb,Bb,zb,Ob,Nb,Rb,Tb,Pb,jb,Lb,qb,Ub,Ib,Wb,Hb,Gb=new Kn,Vb=new Kn,Yb={point:Ab,lineStart:Ab,lineEnd:Ab,polygonStart:function(){Gb=new Kn,Yb.lineStart=Xb,Yb.lineEnd=Jb},polygonEnd:function(){var e=+Gb;Vb.add(e<0?ab+e:e),this.lineStart=this.lineEnd=this.point=Ab},sphere:function(){Vb.add(ab)}};function Xb(){Yb.point=Qb}function Jb(){Kb(Sb,Mb)}function Qb(e,t){Yb.point=Kb,Sb=e,Mb=t,Bb=e*=sb,zb=fb(t=(t*=sb)/2+rb),Ob=yb(t)}function Kb(e,t){var n=(e*=sb)-Bb,i=n>=0?1:-1,r=i*n,a=fb(t=(t*=sb)/2+rb),o=yb(t),s=Ob*o,u=zb*a+s*fb(r),l=s*i*yb(r);Gb.add(cb(l,u)),Bb=e,zb=a,Ob=o}function Zb(e){return[cb(e[1],e[0]),_b(e[2])]}function ex(e){var t=e[0],n=e[1],i=fb(n);return[i*fb(t),i*yb(t),yb(n)]}function tx(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function nx(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 ix(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function rx(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function ax(e){var t=bb(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var ox,sx,ux,lx,cx,fx,dx,hx,px,mx,gx,yx,vx,bx,xx,wx,_x={point:Ax,lineStart:Dx,lineEnd:Fx,polygonStart:function(){_x.point=Cx,_x.lineStart=Ex,_x.lineEnd=$x,Ib=new Kn,Yb.polygonStart()},polygonEnd:function(){Yb.polygonEnd(),_x.point=Ax,_x.lineStart=Dx,_x.lineEnd=Fx,Gb<0?(Nb=-(Tb=180),Rb=-(Pb=90)):Ib>eb?Pb=90:Ib<-1e-6&&(Rb=-90),Hb[0]=Nb,Hb[1]=Tb},sphere:function(){Nb=-(Tb=180),Rb=-(Pb=90)}};function Ax(e,t){Wb.push(Hb=[Nb=e,Tb=e]),t<Rb&&(Rb=t),t>Pb&&(Pb=t)}function kx(e,t){var n=ex([e*sb,t*sb]);if(Ub){var i=nx(Ub,n),r=nx([i[1],-i[0],0],i);ax(r),r=Zb(r);var a,o=e-jb,s=o>0?1:-1,u=r[0]*ob*s,l=ub(o)>180;l^(s*jb<u&&u<s*e)?(a=r[1]*ob)>Pb&&(Pb=a):l^(s*jb<(u=(u+360)%360-180)&&u<s*e)?(a=-r[1]*ob)<Rb&&(Rb=a):(t<Rb&&(Rb=t),t>Pb&&(Pb=t)),l?e<jb?Sx(Nb,e)>Sx(Nb,Tb)&&(Tb=e):Sx(e,Tb)>Sx(Nb,Tb)&&(Nb=e):Tb>=Nb?(e<Nb&&(Nb=e),e>Tb&&(Tb=e)):e>jb?Sx(Nb,e)>Sx(Nb,Tb)&&(Tb=e):Sx(e,Tb)>Sx(Nb,Tb)&&(Nb=e)}else Wb.push(Hb=[Nb=e,Tb=e]);t<Rb&&(Rb=t),t>Pb&&(Pb=t),Ub=n,jb=e}function Dx(){_x.point=kx}function Fx(){Hb[0]=Nb,Hb[1]=Tb,_x.point=Ax,Ub=null}function Cx(e,t){if(Ub){var n=e-jb;Ib.add(ub(n)>180?n+(n>0?360:-360):n)}else Lb=e,qb=t;Yb.point(e,t),kx(e,t)}function Ex(){Yb.lineStart()}function $x(){Cx(Lb,qb),Yb.lineEnd(),ub(Ib)>eb&&(Nb=-(Tb=180)),Hb[0]=Nb,Hb[1]=Tb,Ub=null}function Sx(e,t){return(t-=e)<0?t+360:t}function Mx(e,t){return e[0]-t[0]}function Bx(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var zx={sphere:Ab,point:Ox,lineStart:Rx,lineEnd:jx,polygonStart:function(){zx.lineStart=Lx,zx.lineEnd=qx},polygonEnd:function(){zx.lineStart=Rx,zx.lineEnd=jx}};function Ox(e,t){e*=sb;var n=fb(t*=sb);Nx(n*fb(e),n*yb(e),yb(t))}function Nx(e,t,n){++ox,ux+=(e-ux)/ox,lx+=(t-lx)/ox,cx+=(n-cx)/ox}function Rx(){zx.point=Tx}function Tx(e,t){e*=sb;var n=fb(t*=sb);bx=n*fb(e),xx=n*yb(e),wx=yb(t),zx.point=Px,Nx(bx,xx,wx)}function Px(e,t){e*=sb;var n=fb(t*=sb),i=n*fb(e),r=n*yb(e),a=yb(t),o=cb(bb((o=xx*a-wx*r)*o+(o=wx*i-bx*a)*o+(o=bx*r-xx*i)*o),bx*i+xx*r+wx*a);sx+=o,fx+=o*(bx+(bx=i)),dx+=o*(xx+(xx=r)),hx+=o*(wx+(wx=a)),Nx(bx,xx,wx)}function jx(){zx.point=Ox}function Lx(){zx.point=Ux}function qx(){Ix(yx,vx),zx.point=Ox}function Ux(e,t){yx=e,vx=t,e*=sb,t*=sb,zx.point=Ix;var n=fb(t);bx=n*fb(e),xx=n*yb(e),wx=yb(t),Nx(bx,xx,wx)}function Ix(e,t){e*=sb;var n=fb(t*=sb),i=n*fb(e),r=n*yb(e),a=yb(t),o=xx*a-wx*r,s=wx*i-bx*a,u=bx*r-xx*i,l=pb(o,s,u),c=_b(l),f=l&&-c/l;px.add(f*o),mx.add(f*s),gx.add(f*u),sx+=c,fx+=c*(bx+(bx=i)),dx+=c*(xx+(xx=r)),hx+=c*(wx+(wx=a)),Nx(bx,xx,wx)}function Wx(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 Hx(e,t){return ub(e)>nb&&(e-=Math.round(e/ab)*ab),[e,t]}function Gx(e,t,n){return(e%=ab)?t||n?Wx(Yx(e),Xx(t,n)):Yx(e):t||n?Xx(t,n):Hx}function Vx(e){return function(t,n){return ub(t+=e)>nb&&(t-=Math.round(t/ab)*ab),[t,n]}}function Yx(e){var t=Vx(e);return t.invert=Vx(-e),t}function Xx(e,t){var n=fb(e),i=yb(e),r=fb(t),a=yb(t);function o(e,t){var o=fb(t),s=fb(e)*o,u=yb(e)*o,l=yb(t),c=l*n+s*i;return[cb(u*r-c*a,s*n-l*i),_b(c*r+u*a)]}return o.invert=function(e,t){var o=fb(t),s=fb(e)*o,u=yb(e)*o,l=yb(t),c=l*r-u*a;return[cb(u*r+l*a,s*n+c*i),_b(c*n-s*i)]},o}function Jx(e,t){(t=ex(t))[0]-=e,ax(t);var n=wb(-t[1]);return((-t[2]<0?-n:n)+ab-eb)%ab}function Qx(){var e,t=[];return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){t.push(e=[])},lineEnd:Ab,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Kx(e,t){return ub(e[0]-t[0])<eb&&ub(e[1]-t[1])<eb}function Zx(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 ew(e,t,n,i,r){var a,o,s=[],u=[];if(e.forEach((function(e){if(!((t=e.length-1)<=0)){var t,n,i=e[0],o=e[t];if(Kx(i,o)){if(!i[2]&&!o[2]){for(r.lineStart(),a=0;a<t;++a)r.point((i=e[a])[0],i[1]);return void r.lineEnd()}o[0]+=2e-6}s.push(n=new Zx(i,e,null,!0)),u.push(n.o=new Zx(i,null,n,!1)),s.push(n=new Zx(o,e,null,!1)),u.push(n.o=new Zx(o,null,n,!0))}})),s.length){for(u.sort(t),tw(s),tw(u),a=0,o=u.length;a<o;++a)u[a].e=n=!n;for(var l,c,f=s[0];;){for(var d=f,h=!0;d.v;)if((d=d.n)===f)return;l=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,o=l.length;a<o;++a)r.point((c=l[a])[0],c[1]);else i(d.x,d.n.x,1,r);d=d.n}else{if(h)for(l=d.p.z,a=l.length-1;a>=0;--a)r.point((c=l[a])[0],c[1]);else i(d.x,d.p.x,-1,r);d=d.p}l=(d=d.o).z,h=!h}while(!d.v);r.lineEnd()}}}function tw(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 nw(e){return ub(e[0])<=nb?e[0]:vb(e[0])*((ub(e[0])+nb)%ab-nb)}function iw(e,t,n,i){return function(r){var a,o,s,u=t(r),l=Qx(),c=t(l),f=!1,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=y,d.lineStart=v,d.lineEnd=b,o=[],a=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,o=ai(o);var e=function(e,t){var n=nw(t),i=t[1],r=yb(i),a=[yb(n),-fb(n),0],o=0,s=0,u=new Kn;1===r?i=ib+eb:-1===r&&(i=-ib-eb);for(var l=0,c=e.length;l<c;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],p=nw(h),m=h[1]/2+rb,g=yb(m),y=fb(m),v=0;v<d;++v,p=x,g=_,y=A,h=b){var b=f[v],x=nw(b),w=b[1]/2+rb,_=yb(w),A=fb(w),k=x-p,D=k>=0?1:-1,F=D*k,C=F>nb,E=g*_;if(u.add(cb(E*D*yb(F),y*A+E*fb(F))),o+=C?k+D*ab:k,C^p>=n^x>=n){var $=nx(ex(h),ex(b));ax($);var S=nx(a,$);ax(S);var M=(C^k>=0?-1:1)*_b(S[2]);(i>M||i===M&&($[0]||$[1]))&&(s+=C^k>=0?1:-1)}}return(o<-1e-6||o<eb&&u<-1e-12)^1&s}(a,i);o.length?(f||(r.polygonStart(),f=!0),ew(o,aw,e,n,r)):e&&(f||(r.polygonStart(),f=!0),r.lineStart(),n(null,null,1,r),r.lineEnd()),f&&(r.polygonEnd(),f=!1),o=a=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){u.point(e,t)}function m(){d.point=p,u.lineStart()}function g(){d.point=h,u.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,u=c.clean(),d=l.result(),h=d.length;if(s.pop(),a.push(s),s=null,h)if(1&u){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&u&&d.push(d.pop().concat(d.shift())),o.push(d.filter(rw))}return d}}function rw(e){return e.length>1}function aw(e,t){return((e=e.x)[0]<0?e[1]-ib-eb:ib-e[1])-((t=t.x)[0]<0?t[1]-ib-eb:ib-t[1])}Hx.invert=Hx;const ow=iw((function(){return!0}),(function(e){var t,n=NaN,i=NaN,r=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(a,o){var s=a>0?nb:-nb,u=ub(a-n);ub(u-nb)<eb?(e.point(n,i=(i+o)/2>0?ib:-ib),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),e.point(a,i),t=0):r!==s&&u>=nb&&(ub(n-r)<eb&&(n-=r*eb),ub(a-s)<eb&&(a-=s*eb),i=function(e,t,n,i){var r,a,o=yb(e-n);return ub(o)>eb?lb((yb(t)*(a=fb(i))*yb(n)-yb(i)*(r=fb(t))*yb(e))/(r*a*o)):(t+i)/2}(n,i,a,o),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),t=0),e.point(n=a,i=o),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*ib,i.point(-nb,r),i.point(0,r),i.point(nb,r),i.point(nb,0),i.point(nb,-r),i.point(0,-r),i.point(-nb,-r),i.point(-nb,0),i.point(-nb,r);else if(ub(e[0]-t[0])>eb){var a=e[0]<t[0]?nb:-nb;r=n*a/2,i.point(-a,r),i.point(0,r),i.point(a,r)}else i.point(t[0],t[1])}),[-nb,-ib]);function sw(e){var t=fb(e),n=2*sb,i=t>0,r=ub(t)>eb;function a(e,n){return fb(e)*fb(n)>t}function o(e,n,i){var r=[1,0,0],a=nx(ex(e),ex(n)),o=tx(a,a),s=a[0],u=o-s*s;if(!u)return!i&&e;var l=t*o/u,c=-t*s/u,f=nx(r,a),d=rx(r,l);ix(d,rx(a,c));var h=f,p=tx(d,h),m=tx(h,h),g=p*p-m*(tx(d,d)-1);if(!(g<0)){var y=bb(g),v=rx(h,(-p-y)/m);if(ix(v,d),v=Zb(v),!i)return v;var b,x=e[0],w=n[0],_=e[1],A=n[1];w<x&&(b=x,x=w,w=b);var k=w-x,D=ub(k-nb)<eb;if(!D&&A<_&&(b=_,_=A,A=b),D||k<eb?D?_+A>0^v[1]<(ub(v[0]-x)<eb?_:A):_<=v[1]&&v[1]<=A:k>nb^(x<=v[0]&&v[0]<=w)){var F=rx(h,(-p+y)/m);return ix(F,d),[v,Zb(F)]}}}function s(t,n){var r=i?e:nb-e,a=0;return t<-r?a|=1:t>r&&(a|=2),n<-r?a|=4:n>r&&(a|=8),a}return iw(a,(function(e){var t,n,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(f,d){var h,p=[f,d],m=a(f,d),g=i?m?0:s(f,d):m?s(f+(f<0?nb:-nb),d):0;if(!t&&(l=u=m)&&e.lineStart(),m!==u&&(!(h=o(t,p))||Kx(t,h)||Kx(p,h))&&(p[2]=1),m!==u)c=0,m?(e.lineStart(),h=o(p,t),e.point(h[0],h[1])):(h=o(t,p),e.point(h[0],h[1],2),e.lineEnd()),t=h;else if(r&&t&&i^m){var y;g&n||!(y=o(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&&Kx(t,p)||e.point(p[0],p[1]),t=p,u=m,n=g},lineEnd:function(){u&&e.lineEnd(),t=null},clean:function(){return c|(l&&u)<<1}}}),(function(t,i,r,a){!function(e,t,n,i,r,a){if(n){var o=fb(t),s=yb(t),u=i*n;null==r?(r=t+i*ab,a=t-u/2):(r=Jx(o,r),a=Jx(o,a),(i>0?r<a:r>a)&&(r+=i*ab));for(var l,c=r;i>0?c>a:c<a;c-=u)l=Zb([o,-s*fb(c),-s*yb(c)]),e.point(l[0],l[1])}}(a,e,n,r,t,i)}),i?[0,-e]:[-nb,e-nb])}var uw=1e9,lw=-1e9;function cw(e,t,n,i){function r(r,a){return e<=r&&r<=n&&t<=a&&a<=i}function a(r,a,s,l){var c=0,f=0;if(null==r||(c=o(r,s))!==(f=o(a,s))||u(r,a)<0^s>0)do{l.point(0===c||3===c?e:n,c>1?i:t)}while((c=(c+s+4)%4)!==f);else l.point(a[0],a[1])}function o(i,r){return ub(i[0]-e)<eb?r>0?0:3:ub(i[0]-n)<eb?r>0?2:1:ub(i[1]-t)<eb?r>0?1:0:r>0?3:2}function s(e,t){return u(e.x,t.x)}function u(e,t){var n=o(e,1),i=o(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(o){var u,l,c,f,d,h,p,m,g,y,v,b=o,x=Qx(),w={point:_,lineStart:function(){w.point=A,l&&l.push(c=[]);y=!0,g=!1,p=m=NaN},lineEnd:function(){u&&(A(f,d),h&&g&&x.rejoin(),u.push(x.result()));w.point=_,g&&b.lineEnd()},polygonStart:function(){b=x,u=[],l=[],v=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,r=l.length;n<r;++n)for(var a,o,s=l[n],u=1,c=s.length,f=s[0],d=f[0],h=f[1];u<c;++u)a=d,o=h,d=(f=s[u])[0],h=f[1],o<=i?h>i&&(d-a)*(i-o)>(h-o)*(e-a)&&++t:h<=i&&(d-a)*(i-o)<(h-o)*(e-a)&&--t;return t}(),n=v&&t,r=(u=ai(u)).length;(n||r)&&(o.polygonStart(),n&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),r&&ew(u,s,t,a,o),o.polygonEnd());b=o,u=l=c=null}};function _(e,t){r(e,t)&&b.point(e,t)}function A(a,o){var s=r(a,o);if(l&&c.push([a,o]),y)f=a,d=o,h=s,y=!1,s&&(b.lineStart(),b.point(a,o));else if(s&&g)b.point(a,o);else{var u=[p=Math.max(lw,Math.min(uw,p)),m=Math.max(lw,Math.min(uw,m))],x=[a=Math.max(lw,Math.min(uw,a)),o=Math.max(lw,Math.min(uw,o))];!function(e,t,n,i,r,a){var o,s=e[0],u=e[1],l=0,c=1,f=t[0]-s,d=t[1]-u;if(o=n-s,f||!(o>0)){if(o/=f,f<0){if(o<l)return;o<c&&(c=o)}else if(f>0){if(o>c)return;o>l&&(l=o)}if(o=r-s,f||!(o<0)){if(o/=f,f<0){if(o>c)return;o>l&&(l=o)}else if(f>0){if(o<l)return;o<c&&(c=o)}if(o=i-u,d||!(o>0)){if(o/=d,d<0){if(o<l)return;o<c&&(c=o)}else if(d>0){if(o>c)return;o>l&&(l=o)}if(o=a-u,d||!(o<0)){if(o/=d,d<0){if(o>c)return;o>l&&(l=o)}else if(d>0){if(o<l)return;o<c&&(c=o)}return l>0&&(e[0]=s+l*f,e[1]=u+l*d),c<1&&(t[0]=s+c*f,t[1]=u+c*d),!0}}}}}(u,x,e,t,n,i)?s&&(b.lineStart(),b.point(a,o),v=!1):(g||(b.lineStart(),b.point(u[0],u[1])),b.point(x[0],x[1]),s||b.lineEnd(),v=!1)}p=a,m=o,g=s}return w}}function fw(e,t,n){var i=Ht(e,t-eb,n).concat(t);return function(e){return i.map((function(t){return[e,t]}))}}function dw(e,t,n){var i=Ht(e,t-eb,n).concat(t);return function(e){return i.map((function(t){return[t,e]}))}}const hw=e=>e;var pw,mw,gw,yw,vw=new Kn,bw=new Kn,xw={point:Ab,lineStart:Ab,lineEnd:Ab,polygonStart:function(){xw.lineStart=ww,xw.lineEnd=kw},polygonEnd:function(){xw.lineStart=xw.lineEnd=xw.point=Ab,vw.add(ub(bw)),bw=new Kn},result:function(){var e=vw/2;return vw=new Kn,e}};function ww(){xw.point=_w}function _w(e,t){xw.point=Aw,pw=gw=e,mw=yw=t}function Aw(e,t){bw.add(yw*e-gw*t),gw=e,yw=t}function kw(){Aw(pw,mw)}var Dw=1/0,Fw=Dw,Cw=-Dw,Ew=Cw,$w={point:function(e,t){e<Dw&&(Dw=e);e>Cw&&(Cw=e);t<Fw&&(Fw=t);t>Ew&&(Ew=t)},lineStart:Ab,lineEnd:Ab,polygonStart:Ab,polygonEnd:Ab,result:function(){var e=[[Dw,Fw],[Cw,Ew]];return Cw=Ew=-(Fw=Dw=1/0),e}};var Sw,Mw,Bw,zw,Ow=0,Nw=0,Rw=0,Tw=0,Pw=0,jw=0,Lw=0,qw=0,Uw=0,Iw={point:Ww,lineStart:Hw,lineEnd:Yw,polygonStart:function(){Iw.lineStart=Xw,Iw.lineEnd=Jw},polygonEnd:function(){Iw.point=Ww,Iw.lineStart=Hw,Iw.lineEnd=Yw},result:function(){var e=Uw?[Lw/Uw,qw/Uw]:jw?[Tw/jw,Pw/jw]:Rw?[Ow/Rw,Nw/Rw]:[NaN,NaN];return Ow=Nw=Rw=Tw=Pw=jw=Lw=qw=Uw=0,e}};function Ww(e,t){Ow+=e,Nw+=t,++Rw}function Hw(){Iw.point=Gw}function Gw(e,t){Iw.point=Vw,Ww(Bw=e,zw=t)}function Vw(e,t){var n=e-Bw,i=t-zw,r=bb(n*n+i*i);Tw+=r*(Bw+e)/2,Pw+=r*(zw+t)/2,jw+=r,Ww(Bw=e,zw=t)}function Yw(){Iw.point=Ww}function Xw(){Iw.point=Qw}function Jw(){Kw(Sw,Mw)}function Qw(e,t){Iw.point=Kw,Ww(Sw=Bw=e,Mw=zw=t)}function Kw(e,t){var n=e-Bw,i=t-zw,r=bb(n*n+i*i);Tw+=r*(Bw+e)/2,Pw+=r*(zw+t)/2,jw+=r,Lw+=(r=zw*e-Bw*t)*(Bw+e),qw+=r*(zw+t),Uw+=3*r,Ww(Bw=e,zw=t)}function Zw(e){this._context=e}Zw.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,ab)}},result:Ab};var e_,t_,n_,i_,r_,a_=new Kn,o_={point:Ab,lineStart:function(){o_.point=s_},lineEnd:function(){e_&&u_(t_,n_),o_.point=Ab},polygonStart:function(){e_=!0},polygonEnd:function(){e_=null},result:function(){var e=+a_;return a_=new Kn,e}};function s_(e,t){o_.point=u_,t_=i_=e,n_=r_=t}function u_(e,t){i_-=e,r_-=t,a_.add(bb(i_*i_+r_*r_)),i_=e,r_=t}let l_,c_,f_,d_;class h_{constructor(e){this._append=null==e?p_:function(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return p_;if(t!==l_){const e=10**t;l_=t,c_=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 c_}(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!==f_||this._append!==c_){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`,f_=e,c_=this._append,d_=this._,this._=t}this._+=d_}}result(){const e=this._;return this._="",e.length?e:null}}function p_(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function m_(e,t){let n,i,r=3,a=4.5;function o(e){return e&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),$b(e,n(i))),i.result()}return o.area=function(e){return $b(e,n(xw)),xw.result()},o.measure=function(e){return $b(e,n(o_)),o_.result()},o.bounds=function(e){return $b(e,n($w)),$w.result()},o.centroid=function(e){return $b(e,n(Iw)),Iw.result()},o.projection=function(t){return arguments.length?(n=null==t?(e=null,hw):(e=t).stream,o):e},o.context=function(e){return arguments.length?(i=null==e?(t=null,new h_(r)):new Zw(t=e),"function"!=typeof a&&i.pointRadius(a),o):t},o.pointRadius=function(e){return arguments.length?(a="function"==typeof e?e:(i.pointRadius(+e),+e),o):a},o.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 h_(r)),o},o.projection(e).digits(r).context(t)}function g_(e){return function(t){var n=new y_;for(var i in e)n[i]=e[i];return n.stream=t,n}}function y_(){}function v_(e,t,n){var i=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=i&&e.clipExtent(null),$b(n,e.stream($w)),t($w.result()),null!=i&&e.clipExtent(i),e}function b_(e,t,n){return v_(e,(function(n){var i=t[1][0]-t[0][0],r=t[1][1]-t[0][1],a=Math.min(i/(n[1][0]-n[0][0]),r/(n[1][1]-n[0][1])),o=+t[0][0]+(i-a*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(r-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([o,s])}),n)}function x_(e,t,n){return b_(e,[[0,0],t],n)}function w_(e,t,n){return v_(e,(function(n){var i=+t,r=i/(n[1][0]-n[0][0]),a=(i-r*(n[1][0]+n[0][0]))/2,o=-r*n[0][1];e.scale(150*r).translate([a,o])}),n)}function __(e,t,n){return v_(e,(function(n){var i=+t,r=i/(n[1][1]-n[0][1]),a=-r*n[0][0],o=(i-r*(n[1][1]+n[0][1]))/2;e.scale(150*r).translate([a,o])}),n)}y_.prototype={constructor:y_,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 A_=fb(30*sb);function k_(e,t){return+t?function(e,t){function n(i,r,a,o,s,u,l,c,f,d,h,p,m,g){var y=l-i,v=c-r,b=y*y+v*v;if(b>4*t&&m--){var x=o+d,w=s+h,_=u+p,A=bb(x*x+w*w+_*_),k=_b(_/=A),D=ub(ub(_)-1)<eb||ub(a-f)<eb?(a+f)/2:cb(w,x),F=e(D,k),C=F[0],E=F[1],$=C-i,S=E-r,M=v*$-y*S;(M*M/b>t||ub((y*$+v*S)/b-.5)>.3||o*d+s*h+u*p<A_)&&(n(i,r,a,o,s,u,C,E,D,x/=A,w/=A,_,m,g),g.point(C,E),n(C,E,D,x,w,_,l,c,f,d,h,p,m,g))}}return function(t){var i,r,a,o,s,u,l,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 a=ex([i,r]),o=e(i,r);n(c,f,l,d,h,p,c=o[0],f=o[1],l=i,d=a[0],h=a[1],p=a[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,a=f,o=d,s=h,u=p,m.point=v}function _(){n(c,f,l,d,h,p,r,a,i,o,s,u,16,t),m.lineEnd=b,b()}return m}}(e,t):function(e){return g_({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}(e)}var D_=g_({point:function(e,t){this.stream.point(e*sb,t*sb)}});function F_(e,t,n,i,r,a){if(!a)return function(e,t,n,i,r){function a(a,o){return[t+e*(a*=i),n-e*(o*=r)]}return a.invert=function(a,o){return[(a-t)/e*i,(n-o)/e*r]},a}(e,t,n,i,r);var o=fb(a),s=yb(a),u=o*e,l=s*e,c=o/e,f=s/e,d=(s*n-o*t)/e,h=(s*t+o*n)/e;function p(e,a){return[u*(e*=i)-l*(a*=r)+t,n-l*e-u*a]}return p.invert=function(e,t){return[i*(c*e-f*t+d),r*(h-f*e-c*t)]},p}function C_(e){return E_((function(){return e}))()}function E_(e){var t,n,i,r,a,o,s,u,l,c,f=150,d=480,h=250,p=0,m=0,g=0,y=0,v=0,b=0,x=1,w=1,_=null,A=ow,k=null,D=hw,F=.5;function C(e){return u(e[0]*sb,e[1]*sb)}function E(e){return(e=u.invert(e[0],e[1]))&&[e[0]*ob,e[1]*ob]}function $(){var e=F_(f,0,0,x,w,b).apply(null,t(p,m)),i=F_(f,d-e[0],h-e[1],x,w,b);return n=Gx(g,y,v),s=Wx(t,i),u=Wx(n,s),o=k_(s,F),S()}function S(){return l=c=null,C}return C.stream=function(e){return l&&c===e?l:l=D_(function(e){return g_({point:function(t,n){var i=e(t,n);return this.stream.point(i[0],i[1])}})}(n)(A(o(D(c=e)))))},C.preclip=function(e){return arguments.length?(A=e,_=void 0,S()):A},C.postclip=function(e){return arguments.length?(D=e,k=i=r=a=null,S()):D},C.clipAngle=function(e){return arguments.length?(A=+e?sw(_=e*sb):(_=null,ow),S()):_*ob},C.clipExtent=function(e){return arguments.length?(D=null==e?(k=i=r=a=null,hw):cw(k=+e[0][0],i=+e[0][1],r=+e[1][0],a=+e[1][1]),S()):null==k?null:[[k,i],[r,a]]},C.scale=function(e){return arguments.length?(f=+e,$()):f},C.translate=function(e){return arguments.length?(d=+e[0],h=+e[1],$()):[d,h]},C.center=function(e){return arguments.length?(p=e[0]%360*sb,m=e[1]%360*sb,$()):[p*ob,m*ob]},C.rotate=function(e){return arguments.length?(g=e[0]%360*sb,y=e[1]%360*sb,v=e.length>2?e[2]%360*sb:0,$()):[g*ob,y*ob,v*ob]},C.angle=function(e){return arguments.length?(b=e%360*sb,$()):b*ob},C.reflectX=function(e){return arguments.length?(x=e?-1:1,$()):x<0},C.reflectY=function(e){return arguments.length?(w=e?-1:1,$()):w<0},C.precision=function(e){return arguments.length?(o=k_(s,F=e*e),S()):bb(F)},C.fitExtent=function(e,t){return b_(C,e,t)},C.fitSize=function(e,t){return x_(C,e,t)},C.fitWidth=function(e,t){return w_(C,e,t)},C.fitHeight=function(e,t){return __(C,e,t)},function(){return t=e.apply(this,arguments),C.invert=t.invert&&E,$()}}function $_(e){var t=0,n=nb/3,i=E_(e),r=i(t,n);return r.parallels=function(e){return arguments.length?i(t=e[0]*sb,n=e[1]*sb):[t*ob,n*ob]},r}function S_(e,t){var n=yb(e),i=(n+yb(t))/2;if(ub(i)<eb)return function(e){var t=fb(e);function n(e,n){return[e*t,yb(n)/t]}return n.invert=function(e,n){return[e/t,_b(n*t)]},n}(e);var r=1+n*(2*i-n),a=bb(r)/i;function o(e,t){var n=bb(r-2*i*yb(t))/i;return[n*yb(e*=i),a-n*fb(e)]}return o.invert=function(e,t){var n=a-t,o=cb(e,ub(n))*vb(n);return n*i<0&&(o-=nb*vb(e)*vb(n)),[o/i,_b((r-(e*e+n*n)*i*i)/(2*i))]},o}function M_(){return $_(S_).scale(155.424).center([0,33.6442])}function B_(){return M_().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function z_(e){return function(t,n){var i=fb(t),r=fb(n),a=e(i*r);return a===1/0?[2,0]:[a*r*yb(t),a*yb(n)]}}function O_(e){return function(t,n){var i=bb(t*t+n*n),r=e(i),a=yb(r),o=fb(r);return[cb(t*a,i*o),_b(i&&n*a/i)]}}var N_=z_((function(e){return bb(2/(1+e))}));N_.invert=O_((function(e){return 2*_b(e/2)}));var R_=z_((function(e){return(e=wb(e))&&e/yb(e)}));function T_(e,t){return[e,mb(xb((ib+t)/2))]}function P_(e){var t,n,i,r=C_(e),a=r.center,o=r.scale,s=r.translate,u=r.clipExtent,l=null;function c(){var a=nb*o(),s=r(function(e){function t(t){return(t=e(t[0]*sb,t[1]*sb))[0]*=ob,t[1]*=ob,t}return e=Gx(e[0]*sb,e[1]*sb,e.length>2?e[2]*sb:0),t.invert=function(t){return(t=e.invert(t[0]*sb,t[1]*sb))[0]*=ob,t[1]*=ob,t},t}(r.rotate()).invert([0,0]));return u(null==l?[[s[0]-a,s[1]-a],[s[0]+a,s[1]+a]]:e===T_?[[Math.max(s[0]-a,l),t],[Math.min(s[0]+a,n),i]]:[[l,Math.max(s[1]-a,t)],[n,Math.min(s[1]+a,i)]])}return r.scale=function(e){return arguments.length?(o(e),c()):o()},r.translate=function(e){return arguments.length?(s(e),c()):s()},r.center=function(e){return arguments.length?(a(e),c()):a()},r.clipExtent=function(e){return arguments.length?(null==e?l=t=n=i=null:(l=+e[0][0],t=+e[0][1],n=+e[1][0],i=+e[1][1]),c()):null==l?null:[[l,t],[n,i]]},c()}function j_(e){return xb((ib+e)/2)}function L_(e,t){var n=fb(e),i=e===t?yb(e):mb(n/fb(t))/mb(j_(t)/j_(e)),r=n*gb(j_(e),i)/i;if(!i)return T_;function a(e,t){r>0?t<-ib+eb&&(t=-ib+eb):t>ib-eb&&(t=ib-eb);var n=r/gb(j_(t),i);return[n*yb(i*e),r-n*fb(i*e)]}return a.invert=function(e,t){var n=r-t,a=vb(i)*bb(e*e+n*n),o=cb(e,ub(n))*vb(n);return n*i<0&&(o-=nb*vb(e)*vb(n)),[o/i,2*lb(gb(r/a,1/i))-ib]},a}function q_(e,t){return[e,t]}function U_(e,t){var n=fb(e),i=e===t?yb(e):(n-fb(t))/(t-e),r=n/i+e;if(ub(i)<eb)return q_;function a(e,t){var n=r-t,a=i*e;return[n*yb(a),r-n*fb(a)]}return a.invert=function(e,t){var n=r-t,a=cb(e,ub(n))*vb(n);return n*i<0&&(a-=nb*vb(e)*vb(n)),[a/i,r-vb(i)*bb(e*e+n*n)]},a}R_.invert=O_((function(e){return e})),T_.invert=function(e,t){return[e,2*lb(hb(t))-ib]},q_.invert=q_;var I_=1.340264,W_=-.081106,H_=893e-6,G_=.003796,V_=bb(3)/2;function Y_(e,t){var n=_b(V_*yb(t)),i=n*n,r=i*i*i;return[e*fb(n)/(V_*(I_+3*W_*i+r*(7*H_+9*G_*i))),n*(I_+W_*i+r*(H_+G_*i))]}function X_(e,t){var n=fb(t),i=fb(e)*n;return[n*yb(e)/i,yb(t)/i]}function J_(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 Q_(e,t){return[fb(t)*yb(e),yb(t)]}function K_(e,t){var n=fb(t),i=1+fb(e)*n;return[n*yb(e)/i,yb(t)/i]}function Z_(e,t){return[mb(xb((ib+t)/2)),-e]}Y_.invert=function(e,t){for(var n,i=t,r=i*i,a=r*r*r,o=0;o<12&&(a=(r=(i-=n=(i*(I_+W_*r+a*(H_+G_*r))-t)/(I_+3*W_*r+a*(7*H_+9*G_*r)))*i)*r*r,!(ub(n)<tb));++o);return[V_*e*(I_+3*W_*r+a*(7*H_+9*G_*r))/fb(i),_b(yb(i)/V_)]},X_.invert=O_(lb),J_.invert=function(e,t){var n,i=t,r=25;do{var a=i*i,o=a*a;i-=n=(i*(1.007226+a*(.015085+o*(.028874*a-.044475-.005916*o)))-t)/(1.007226+a*(.045255+o*(.259866*a-.311325-.005916*11*o)))}while(ub(n)>eb&&--r>0);return[e/(.8707+(a=i*i)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),i]},Q_.invert=O_(_b),K_.invert=O_((function(e){return 2*lb(e)})),Z_.invert=function(e,t){return[-t,2*lb(hb(e))-ib]};var eA,tA=Math.abs,nA=Math.cos,iA=Math.sin,rA=Math.PI,aA=rA/2,oA=(eA=2)>0?Math.sqrt(eA):0;function sA(e){return e>1?aA:e<-1?-aA:Math.asin(e)}function uA(e,t){var n,i=e*iA(t),r=30;do{t-=n=(t+iA(t)-i)/(1+nA(t))}while(tA(n)>1e-6&&--r>0);return t/2}var lA=function(e,t,n){function i(i,r){return[e*i*nA(r=uA(n,r)),t*iA(r)]}return i.invert=function(i,r){return r=sA(r/t),[i/(e*nA(r)),sA((2*r+iA(2*r))/n)]},i}(oA/aA,oA,rA);const cA=m_(),fA=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function dA(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(pA[e]=function(e,t){return function n(){const i=t();return i.type=e,i.path=m_().projection(i),i.copy=i.copy||function(){const e=n();return fA.forEach((t=>{i[t]&&e[t](i[t]())})),e.path.pointRadius(i.path.pointRadius()),e},zf(i)}}(e,t),this):pA[e]||null}function hA(e){return e&&e.path||cA}const pA={albers:B_,albersusa:function(){var e,t,n,i,r,a,o=B_(),s=M_().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=M_().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(e,t){a=[e,t]}};function c(e){var t=e[0],o=e[1];return a=null,n.point(t,o),a||(i.point(t,o),a)||(r.point(t,o),a)}function f(){return e=t=null,c}return c.invert=function(e){var t=o.scale(),n=o.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?u:o).invert(e)},c.stream=function(n){return e&&t===n?e:(i=[o.stream(t=n),s.stream(n),u.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?(o.precision(e),s.precision(e),u.precision(e),f()):o.precision()},c.scale=function(e){return arguments.length?(o.scale(e),s.scale(.35*e),u.scale(e),c.translate(o.translate())):o.scale()},c.translate=function(e){if(!arguments.length)return o.translate();var t=o.scale(),a=+e[0],c=+e[1];return n=o.translate(e).clipExtent([[a-.455*t,c-.238*t],[a+.455*t,c+.238*t]]).stream(l),i=s.translate([a-.307*t,c+.201*t]).clipExtent([[a-.425*t+eb,c+.12*t+eb],[a-.214*t-eb,c+.234*t-eb]]).stream(l),r=u.translate([a-.205*t,c+.212*t]).clipExtent([[a-.214*t+eb,c+.166*t+eb],[a-.115*t-eb,c+.234*t-eb]]).stream(l),f()},c.fitExtent=function(e,t){return b_(c,e,t)},c.fitSize=function(e,t){return x_(c,e,t)},c.fitWidth=function(e,t){return w_(c,e,t)},c.fitHeight=function(e,t){return __(c,e,t)},c.scale(1070)},azimuthalequalarea:function(){return C_(N_).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return C_(R_).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return $_(L_).scale(109.5).parallels([30,30])},conicequalarea:M_,conicequidistant:function(){return $_(U_).scale(131.154).center([0,13.9389])},equalEarth:function(){return C_(Y_).scale(177.158)},equirectangular:function(){return C_(q_).scale(152.63)},gnomonic:function(){return C_(X_).scale(144.049).clipAngle(60)},identity:function(){var e,t,n,i,r,a,o,s=1,u=0,l=0,c=1,f=1,d=0,h=null,p=1,m=1,g=g_({point:function(e,t){var n=b([e,t]);this.stream.point(n[0],n[1])}}),y=hw;function v(){return p=s*c,m=s*f,a=o=null,b}function b(n){var i=n[0]*p,r=n[1]*m;if(d){var a=r*e-i*t;i=i*e+r*t,r=a}return[i+u,r+l]}return b.invert=function(n){var i=n[0]-u,r=n[1]-l;if(d){var a=r*e+i*t;i=i*e-r*t,r=a}return[i/p,r/m]},b.stream=function(e){return a&&o===e?a:a=g(y(o=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,hw):cw(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?(u=+e[0],l=+e[1],v()):[u,l]},b.angle=function(n){return arguments.length?(t=yb(d=n%360*sb),e=fb(d),v()):d*ob},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 b_(b,e,t)},b.fitSize=function(e,t){return x_(b,e,t)},b.fitWidth=function(e,t){return w_(b,e,t)},b.fitHeight=function(e,t){return __(b,e,t)},b},mercator:function(){return P_(T_).scale(961/ab)},mollweide:function(){return C_(lA).scale(169.529)},naturalEarth1:function(){return C_(J_).scale(175.295)},orthographic:function(){return C_(Q_).scale(249.5).clipAngle(90.000001)},stereographic:function(){return C_(K_).scale(250).clipAngle(142)},transversemercator:function(){var e=P_(Z_),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 KV in pA)dA(KV,pA[KV]);function mA(){}const gA=[[],[[[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 yA(){var e=1,t=1,n=o;function i(e,t){return t.map((t=>r(e,t)))}function r(i,r){var o=[],s=[];return function(n,i,r){var o,s,u,l,c,f,d=[],h=[];o=s=-1,l=n[0]>=i,gA[l<<1].forEach(p);for(;++o<e-1;)u=l,l=n[o+1]>=i,gA[u|l<<1].forEach(p);gA[l|0].forEach(p);for(;++s<t-1;){for(o=-1,l=n[s*e+e]>=i,c=n[s*e]>=i,gA[l<<1|c<<2].forEach(p);++o<e-1;)u=l,l=n[s*e+e+o+1]>=i,f=c,c=n[s*e+o+1]>=i,gA[u|l<<1|c<<2|f<<3].forEach(p);gA[l|c<<3].forEach(p)}o=-1,c=n[s*e]>=i,gA[c<<2].forEach(p);for(;++o<e-1;)f=c,c=n[s*e+o+1]>=i,gA[c<<2|f<<3].forEach(p);function p(e){var t,n,i=[e[0][0]+o,e[0][1]+s],u=[e[1][0]+o,e[1][1]+s],l=a(i),c=a(u);(t=h[l])?(n=d[c])?(delete h[t.end],delete d[n.start],t===n?(t.ring.push(u),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(u),h[t.end=c]=t):(t=d[c])?(n=h[l])?(delete d[t.start],delete h[n.end],t===n?(t.ring.push(u),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=l]=t):d[l]=h[c]={start:l,end:c,ring:[i,u]}}gA[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?o.push([e]):s.push(e)})),s.forEach((e=>{for(var t,n=0,i=o.length;n<i;++n)if(-1!==vA((t=o[n])[0],e))return void t.push(e)})),{type:"MultiPolygon",value:r,coordinates:o}}function a(t){return 2*t[0]+t[1]*(e+1)*4}function o(n,i,r){n.forEach((n=>{var a,o=n[0],s=n[1],u=0|o,l=0|s,c=i[l*e+u];o>0&&o<e&&u===o&&(a=i[l*e+u-1],n[0]=o+(r-a)/(c-a)-.5),s>0&&s<t&&l===s&&(a=i[(l-1)*e+u],n[1]=s+(r-a)/(c-a)-.5)}))}return i.contour=r,i.size=function(n){if(!arguments.length)return[e,t];var r=Math.floor(n[0]),a=Math.floor(n[1]);return r>=0&&a>=0||v("invalid size"),e=r,t=a,i},i.smooth=function(e){return arguments.length?(n=e?o:mA,i):n===o},i}function vA(e,t){for(var n,i=-1,r=t.length;++i<r;)if(n=bA(e,t[i]))return n;return 0}function bA(e,t){for(var n=t[0],i=t[1],r=-1,a=0,o=e.length,s=o-1;a<o;s=a++){var u=e[a],l=u[0],c=u[1],f=e[s],d=f[0],h=f[1];if(xA(u,f,t))return 0;c>i!=h>i&&n<(d-l)*(i-c)/(h-c)+l&&(r=-r)}return r}function xA(e,t,n){var i,r,a,o;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])],a=n[i],o=t[i],r<=a&&a<=o||o<=a&&a<=r)}function wA(e,t,n){return function(i){var r=M(i),a=n?Math.min(r[0],0):r[0],o=r[1],s=o-a,u=t?me(a,o,e):s/(e+1);return Ht(a+u,o,u)}}function _A(e){tu.call(this,null,e)}function AA(e,t,n,i,r){const a=e.x1||0,o=e.y1||0,s=t*n<0;function u(e){e.forEach(l)}function l(e){s&&e.reverse(),e.forEach(c)}function c(e){e[0]=(e[0]-a)*t+i,e[1]=(e[1]-o)*n+r}return function(e){return e.coordinates.forEach(u),e}}function kA(e,t,n){const i=e>=0?e:uu(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function DA(e){return m(e)?e:g(+e)}function FA(){var e=e=>e[0],t=e=>e[1],n=ce,i=[-1,-1],r=960,a=500,o=2;function s(s,u){const l=kA(i[0],s,e)>>o,c=kA(i[1],s,t)>>o,f=l?l+2:0,d=c?c+2:0,h=2*f+(r>>o),p=2*d+(a>>o),m=new Float32Array(h*p),g=new Float32Array(h*p);let y=m;s.forEach((i=>{const r=f+(+e(i)>>o),a=d+(+t(i)>>o);r>=0&&r<h&&a>=0&&a<p&&(m[r+a*h]+=+n(i))})),l>0&&c>0?(CA(h,p,m,g,l),EA(h,p,g,m,c),CA(h,p,m,g,l),EA(h,p,g,m,c),CA(h,p,m,g,l),EA(h,p,g,m,c)):l>0?(CA(h,p,m,g,l),CA(h,p,g,m,l),CA(h,p,m,g,l),y=g):c>0&&(EA(h,p,m,g,c),EA(h,p,g,m,c),EA(h,p,m,g,c),y=g);const v=u?Math.pow(2,-2*o):1/oi(y);for(let e=0,t=h*p;e<t;++e)y[e]*=v;return{values:y,scale:1<<o,width:h,height:p,x1:f,y1:d,x2:f+(r>>o),y2:d+(a>>o)}}return s.x=function(t){return arguments.length?(e=DA(t),s):e},s.y=function(e){return arguments.length?(t=DA(e),s):t},s.weight=function(e){return arguments.length?(n=DA(e),s):n},s.size=function(e){if(!arguments.length)return[r,a];var t=+e[0],n=+e[1];return t>=0&&n>=0||v("invalid size"),r=t,a=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||v("invalid cell size"),o=Math.floor(Math.log(e)/Math.LN2),s):1<<o},s.bandwidth=function(e){return arguments.length?(1===(e=c(e)).length&&(e=[+e[0],+e[0]]),2!==e.length&&v("invalid bandwidth"),i=e,s):i},s}function CA(e,t,n,i,r){const a=1+(r<<1);for(let o=0;o<t;++o)for(let t=0,s=0;t<e+r;++t)t<e&&(s+=n[t+o*e]),t>=r&&(t>=a&&(s-=n[t-a+o*e]),i[t-r+o*e]=s/Math.min(t+1,e-1+a-t,a))}function EA(e,t,n,i,r){const a=1+(r<<1);for(let o=0;o<e;++o)for(let s=0,u=0;s<t+r;++s)s<t&&(u+=n[o+s*e]),s>=r&&(s>=a&&(u-=n[o+(s-a)*e]),i[o+(s-r)*e]=u/Math.min(s+1,t-1+a-s,a))}function $A(e){tu.call(this,null,e)}_A.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"}]},_(_A,tu,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,a=e.field||y,o=yA().smooth(!1!==e.smooth),s=e.thresholds||function(e,t,n){const i=wA(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?i:i(e.map((e=>gt(t(e).values))))}(r,a,e),u=null===e.as?null:e.as||"contour",c=[];return r.forEach((t=>{const i=a(t),r=o.size([i.width,i.height])(i.values,l(s)?s:s(i.values));!function(e,t,i,r){let a=r.scale||t.scale,o=r.translate||t.translate;m(a)&&(a=a(i,r));m(o)&&(o=o(i,r));if((1===a||null==a)&&!o)return;const s=(n(a)?a:a[0])||1,u=(n(a)?a:a[1])||1,l=o&&o[0]||0,c=o&&o[1]||0;e.forEach(AA(t,s,u,l,c))}(r,i,t,e),r.forEach((e=>{c.push(Fs(t,ks(null!=u?{[u]:e}:e)))}))})),this.value&&(i.rem=this.value),this.value=i.source=i.add=c,i}}),$A.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 SA=["x","y","weight","size","cellSize","bandwidth"];function MA(e,t){return SA.forEach((n=>null!=t[n]?e[n](t[n]):0)),e}function BA(e){tu.call(this,null,e)}_($A,tu,{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,a,o,s,u=[],l=e=>e(a);if(null==t)u.push(e);else for(n={},i=0,r=e.length;i<r;++i)a=e[i],(s=n[o=t.map(l)])||(n[o]=s=[],s.dims=o,u.push(s)),s.push(a);return u}(t.materialize(t.SOURCE).source,e.groupby),a=(e.groupby||[]).map(C),o=MA(FA(),e),s=e.as||"grid";return n=r.map((t=>ks(function(e,t){for(let n=0;n<a.length;++n)e[a[n]]=t[n];return e}({[s]:o(t,e.counts)},t.dims)))),this.value&&(i.rem=this.value),this.value=i.source=i.add=n,i}}),BA.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}]},_(BA,tu,{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),a=yA().smooth(!1!==e.smooth),o=e.values,s=e.thresholds||wA(e.count||10,e.nice,!!o),u=e.size;return o||(o=t.materialize(t.SOURCE).source,i=AA(n=MA(FA(),e)(o,!0),n.scale||1,n.scale||1,0,0),u=[n.width,n.height],o=n.values),s=l(s)?s:s(o),o=a.size(u)(o,s),i&&o.forEach(i),this.value&&(r.rem=this.value),this.value=r.source=r.add=(o||[]).map(ks),r}});const zA="Feature",OA="FeatureCollection";function NA(e){tu.call(this,null,e)}function RA(e){tu.call(this,null,e)}function TA(e){tu.call(this,null,e)}function PA(e){tu.call(this,null,e)}function jA(e){tu.call(this,[],e),this.generator=function(){var e,t,n,i,r,a,o,s,u,l,c,f,d=10,h=d,p=90,m=360,g=2.5;function y(){return{type:"MultiLineString",coordinates:v()}}function v(){return Ht(db(i/p)*p,n,p).map(c).concat(Ht(db(s/m)*m,o,m).map(f)).concat(Ht(db(t/d)*d,e,d).filter((function(e){return ub(e%p)>eb})).map(u)).concat(Ht(db(a/h)*h,r,h).filter((function(e){return ub(e%m)>eb})).map(l))}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(o).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],o=+e[1][1],i>n&&(e=i,i=n,n=e),s>o&&(e=s,s=o,o=e),y.precision(g)):[[i,s],[n,o]]},y.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],a=+n[0][1],r=+n[1][1],t>e&&(n=t,t=e,e=n),a>r&&(n=a,a=r,r=n),y.precision(g)):[[t,a],[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,u=fw(a,r,90),l=dw(t,e,g),c=fw(s,o,90),f=dw(i,n,g),y):g},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function LA(e){tu.call(this,null,e)}function qA(e){if(!m(e))return!1;const t=se(E(e));return t.$x||t.$y||t.$value||t.$max}function UA(e){tu.call(this,null,e),this.modified(!0)}function IA(e,t,n){m(e[t])&&e[t](n)}NA.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},_(NA,tu,{transform(e,t){var n,i=this._features,r=this._points,a=e.fields,o=a&&a[0],s=a&&a[1],u=e.geojson||!a&&y,l=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(E(u))||o&&t.modified(E(o))||s&&t.modified(E(s)),this.value&&!n||(l=t.SOURCE,this._features=i=[],this._points=r=[]),u&&t.visit(l,(e=>i.push(u(e)))),o&&s&&(t.visit(l,(e=>{var t=o(e),n=s(e);null!=t&&null!=n&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])})),i=i.concat({type:zA,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:OA,features:i}}}),RA.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"}]},_(RA,tu,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||y,a=e.as||"path",o=n.SOURCE;!i||e.modified()?(this.value=i=hA(e.projection),n.materialize().reflow()):o=r===y||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(o,(e=>e[a]=i(r(e)))),i.pointRadius(s),n.modifies(a)}}),TA.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"]}]},_(TA,tu,{transform(e,t){var n,i=e.projection,r=e.fields[0],a=e.fields[1],o=e.as||["x","y"],s=o[0],u=o[1];function l(e){const t=i([r(e),a(e)]);t?(e[s]=t[0],e[u]=t[1]):(e[s]=void 0,e[u]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(n=t.modified(r.fields)||t.modified(a.fields),t.visit(n?t.ADD_MOD:t.ADD,l)),t.modifies(o)}}),PA.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"}]},_(PA,tu,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.as||"shape",a=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(),a=e.pointRadius(n)(t(i));return e.pointRadius(r),a};return i.context=t=>(e.context(t),i),i}(hA(e.projection),e.field||q("datum"),e.pointRadius),n.materialize().reflow(),a=n.SOURCE),n.visit(a,(e=>e[r]=i)),n.modifies(r)}}),jA.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}]},_(jA,tu,{transform(e,t){var n,i=this.value,r=this.generator;if(!i.length||e.modified())for(const a in e)m(r[a])&&r[a](e[a]);return n=r(),i.length?t.mod.push(Cs(i[0],n)):t.add.push(ks(n)),i[0]=n,t}}),LA.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"}]},_(LA,tu,{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||y,a=function(e,t){let n;m(e)?(n=n=>e(n,t),n.dep=qA(e)):e?n=g(e):(n=e=>e.$value/e.$max||0,n.dep=!0);return n}(e.opacity,e),o=function(e,t){let n;m(e)?(n=n=>Un(e(n,t)),n.dep=qA(e)):n=g(Un(e||"#888"));return n}(e.color,e),s=e.as||"image",u={$x:0,$y:0,$value:0,$max:i?gt(n.map((e=>gt(r(e).values)))):0};return n.forEach((e=>{const t=r(e),n=D({},e,u);i||(n.$max=gt(t.values||[])),e[s]=function(e,t,n,i){const r=e.width,a=e.height,o=e.x1||0,s=e.y1||0,u=e.x2||r,l=e.y2||a,c=e.values,f=c?e=>c[e]:V,d=Fc(u-o,l-s),h=d.getContext("2d"),p=h.getImageData(0,0,u-o,l-s),m=p.data;for(let g=s,y=0;g<l;++g){t.$y=g-s;for(let e=o,a=g*r;e<u;++e,y+=4){t.$x=e-o,t.$value=f(e+a);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,o.dep?o:g(o(n)),a.dep?a:g(a(n)))})),t.reflow(!0).modifies(s)}}),_(UA,tu,{transform(e,t){let n=this.value;return!n||e.modified("type")?(this.value=n=function(e){const t=dA((e||"mercator").toLowerCase());t||v("Unrecognized projection type: "+e);return t()}(e.type),fA.forEach((t=>{null!=e[t]&&IA(n,t,e[t])}))):fA.forEach((t=>{e.modified(t)&&IA(n,t,e[t])})),null!=e.pointRadius&&n.path.pointRadius(e.pointRadius),e.fit&&function(e,t){const n=function(e){return e=c(e),1===e.length?e[0]:{type:OA,features:e.reduce(((e,t)=>e.concat(function(e){return e.type===OA?e.features:c(e).filter((e=>null!=e)).map((e=>e.type===zA?e:{type:zA,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 WA=Object.freeze(Object.defineProperty({__proto__:null,contour:BA,geojson:NA,geopath:RA,geopoint:TA,geoshape:PA,graticule:jA,heatmap:LA,isocontour:_A,kde2d:$A,projection:UA},Symbol.toStringTag,{value:"Module"}));function HA(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,a,o,s,u,l,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((l=t>=(a=(m+y)/2))?m=a:y=a,(c=n>=(o=(g+v)/2))?g=o:v=o,r=h,!(h=h[f=c<<1|l]))return r[f]=p,e;if(s=+e._x.call(null,h.data),u=+e._y.call(null,h.data),t===s&&n===u)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),(l=t>=(a=(m+y)/2))?m=a:y=a,(c=n>=(o=(g+v)/2))?g=o:v=o}while((f=c<<1|l)==(d=(u>=o)<<1|s>=a));return r[d]=h,r[f]=p,e}function GA(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function VA(e){return e[0]}function YA(e){return e[1]}function XA(e,t,n){var i=new JA(null==t?VA:t,null==n?YA:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function JA(e,t,n,i,r,a){this._x=e,this._y=t,this._x0=n,this._y0=i,this._x1=r,this._y1=a,this._root=void 0}function QA(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var KA=XA.prototype=JA.prototype;function ZA(e){return function(){return e}}function ek(e){return 1e-6*(e()-.5)}function tk(e){return e.x+e.vx}function nk(e){return e.y+e.vy}function ik(e){return e.index}function rk(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}KA.copy=function(){var e,t,n=new JA(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=QA(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]=QA(t));return n},KA.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return HA(this.cover(t,n),t,n,e)},KA.addAll=function(e){var t,n,i,r,a=e.length,o=new Array(a),s=new Array(a),u=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;n<a;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(r=+this._y.call(null,t))||(o[n]=i,s[n]=r,i<u&&(u=i),i>c&&(c=i),r<l&&(l=r),r>f&&(f=r));if(u>c||l>f)return this;for(this.cover(u,l).cover(c,f),n=0;n<a;++n)HA(this,o[n],s[n],e[n]);return this},KA.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,i=this._y0,r=this._x1,a=this._y1;if(isNaN(n))r=(n=Math.floor(e))+1,a=(i=Math.floor(t))+1;else{for(var o,s,u=r-n||1,l=this._root;n>e||e>=r||i>t||t>=a;)switch(s=(t<i)<<1|e<n,(o=new Array(4))[s]=l,l=o,u*=2,s){case 0:r=n+u,a=i+u;break;case 1:n=r-u,a=i+u;break;case 2:r=n+u,i=a-u;break;case 3:n=r-u,i=a-u}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=i,this._x1=r,this._y1=a,this},KA.data=function(){var e=[];return this.visit((function(t){if(!t.length)do{e.push(t.data)}while(t=t.next)})),e},KA.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]]},KA.find=function(e,t,n){var i,r,a,o,s,u,l,c=this._x0,f=this._y0,d=this._x1,h=this._y1,p=[],m=this._root;for(m&&p.push(new GA(m,c,f,d,h)),null==n?n=1/0:(c=e-n,f=t-n,d=e+n,h=t+n,n*=n);u=p.pop();)if(!(!(m=u.node)||(r=u.x0)>d||(a=u.y0)>h||(o=u.x1)<c||(s=u.y1)<f))if(m.length){var g=(r+o)/2,y=(a+s)/2;p.push(new GA(m[3],g,y,o,s),new GA(m[2],r,y,g,s),new GA(m[1],g,a,o,y),new GA(m[0],r,a,g,y)),(l=(t>=y)<<1|e>=g)&&(u=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=u)}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},KA.remove=function(e){if(isNaN(a=+this._x.call(null,e))||isNaN(o=+this._y.call(null,e)))return this;var t,n,i,r,a,o,s,u,l,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((l=a>=(s=(p+g)/2))?p=s:g=s,(c=o>=(u=(m+y)/2))?m=u:y=u,t=h,!(h=h[f=c<<1|l]))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)},KA.removeAll=function(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this},KA.root=function(){return this._root},KA.size=function(){var e=0;return this.visit((function(t){if(!t.length)do{++e}while(t=t.next)})),e},KA.visit=function(e){var t,n,i,r,a,o,s=[],u=this._root;for(u&&s.push(new GA(u,this._x0,this._y0,this._x1,this._y1));t=s.pop();)if(!e(u=t.node,i=t.x0,r=t.y0,a=t.x1,o=t.y1)&&u.length){var l=(i+a)/2,c=(r+o)/2;(n=u[3])&&s.push(new GA(n,l,c,a,o)),(n=u[2])&&s.push(new GA(n,i,c,l,o)),(n=u[1])&&s.push(new GA(n,l,r,a,c)),(n=u[0])&&s.push(new GA(n,i,r,l,c))}return this},KA.visitAfter=function(e){var t,n=[],i=[];for(this._root&&n.push(new GA(this._root,this._x0,this._y0,this._x1,this._y1));t=n.pop();){var r=t.node;if(r.length){var a,o=t.x0,s=t.y0,u=t.x1,l=t.y1,c=(o+u)/2,f=(s+l)/2;(a=r[0])&&n.push(new GA(a,o,s,c,f)),(a=r[1])&&n.push(new GA(a,c,s,u,f)),(a=r[2])&&n.push(new GA(a,o,f,c,l)),(a=r[3])&&n.push(new GA(a,c,f,u,l))}i.push(t)}for(;t=i.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},KA.x=function(e){return arguments.length?(this._x=e,this):this._x},KA.y=function(e){return arguments.length?(this._y=e,this):this._y};const ak=4294967296;function ok(e){return e.x}function sk(e){return e.y}var uk=Math.PI*(3-Math.sqrt(5));function lk(e){var t,n=1,i=.001,r=1-Math.pow(i,1/300),a=0,o=.6,s=new Map,u=In(f),l=Wn("tick","end"),c=function(){let e=1;return()=>(e=(1664525*e+1013904223)%ak)/ak}();function f(){d(),l.call("tick",t),n<i&&(u.stop(),l.call("end",t))}function d(i){var u,l,c=e.length;void 0===i&&(i=1);for(var f=0;f<i;++f)for(n+=(a-n)*r,s.forEach((function(e){e(n)})),u=0;u<c;++u)null==(l=e[u]).fx?l.x+=l.vx*=o:(l.x=l.fx,l.vx=0),null==l.fy?l.y+=l.vy*=o:(l.y=l.fy,l.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),a=n*uk;t.x=r*Math.cos(a),t.y=r*Math.sin(a)}(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 u.restart(f),t},stop:function(){return u.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?(a=+e,t):a},velocityDecay:function(e){return arguments.length?(o=1-e,t):1-o},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,a,o,s,u,l=0,c=e.length;for(null==i?i=1/0:i*=i,l=0;l<c;++l)(o=(r=t-(s=e[l]).x)*r+(a=n-s.y)*a)<i&&(u=s,i=o);return u},on:function(e,n){return arguments.length>1?(l.on(e,n),t):l.on(e)}}}const ck={center:function(e,t){var n,i=1;function r(){var r,a,o=n.length,s=0,u=0;for(r=0;r<o;++r)s+=(a=n[r]).x,u+=a.y;for(s=(s/o-e)*i,u=(u/o-t)*i,r=0;r<o;++r)(a=n[r]).x-=s,a.y-=u}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,a=1;function o(){for(var e,o,u,l,c,f,d,h=t.length,p=0;p<a;++p)for(o=XA(t,tk,nk).visitAfter(s),e=0;e<h;++e)u=t[e],f=n[u.index],d=f*f,l=u.x+u.vx,c=u.y+u.vy,o.visit(m);function m(e,t,n,a,o){var s=e.data,h=e.r,p=f+h;if(!s)return t>l+p||a<l-p||n>c+p||o<c-p;if(s.index>u.index){var m=l-s.x-s.vx,g=c-s.y-s.vy,y=m*m+g*g;y<p*p&&(0===m&&(y+=(m=ek(i))*m),0===g&&(y+=(g=ek(i))*g),y=(p-(y=Math.sqrt(y)))/y*r,u.vx+=(m*=y)*(p=(h*=h)/(d+h)),u.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 u(){if(t){var i,r,a=t.length;for(n=new Array(a),i=0;i<a;++i)r=t[i],n[r.index]=+e(r,i,t)}}return"function"!=typeof e&&(e=ZA(null==e?1:+e)),o.initialize=function(e,n){t=e,i=n,u()},o.iterations=function(e){return arguments.length?(a=+e,o):a},o.strength=function(e){return arguments.length?(r=+e,o):r},o.radius=function(t){return arguments.length?(e="function"==typeof t?t:ZA(+t),u(),o):e},o},nbody:function(){var e,t,n,i,r,a=ZA(-30),o=1,s=1/0,u=.81;function l(n){var r,a=e.length,o=XA(e,ok,sk).visitAfter(f);for(i=n,r=0;r<a;++r)t=e[r],o.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]=+a(n,t,e)}}function f(e){var t,n,i,a,o,s=0,u=0;if(e.length){for(i=a=o=0;o<4;++o)(t=e[o])&&(n=Math.abs(t.value))&&(s+=t.value,u+=n,i+=n*t.x,a+=n*t.y);e.x=i/u,e.y=a/u}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,a,l,c){if(!e.value)return!0;var f=e.x-t.x,d=e.y-t.y,h=c-a,p=f*f+d*d;if(h*h/u<p)return p<s&&(0===f&&(p+=(f=ek(n))*f),0===d&&(p+=(d=ek(n))*d),p<o&&(p=Math.sqrt(o*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=ek(n))*f),0===d&&(p+=(d=ek(n))*d),p<o&&(p=Math.sqrt(o*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 l.initialize=function(t,i){e=t,n=i,c()},l.strength=function(e){return arguments.length?(a="function"==typeof e?e:ZA(+e),c(),l):a},l.distanceMin=function(e){return arguments.length?(o=e*e,l):Math.sqrt(o)},l.distanceMax=function(e){return arguments.length?(s=e*e,l):Math.sqrt(s)},l.theta=function(e){return arguments.length?(u=e*e,l):Math.sqrt(u)},l},link:function(e){var t,n,i,r,a,o,s=ik,u=function(e){return 1/Math.min(r[e.source.index],r[e.target.index])},l=ZA(30),c=1;function f(i){for(var r=0,s=e.length;r<c;++r)for(var u,l,f,d,h,p,m,g=0;g<s;++g)l=(u=e[g]).source,d=(f=u.target).x+f.vx-l.x-l.vx||ek(o),h=f.y+f.vy-l.y-l.vy||ek(o),d*=p=((p=Math.sqrt(d*d+h*h))-n[g])/p*i*t[g],h*=p,f.vx-=d*(m=a[g]),f.vy-=h*m,l.vx+=d*(m=1-m),l.vy+=h*m}function d(){if(i){var o,u,l=i.length,c=e.length,f=new Map(i.map(((e,t)=>[s(e,t,i),e])));for(o=0,r=new Array(l);o<c;++o)(u=e[o]).index=o,"object"!=typeof u.source&&(u.source=rk(f,u.source)),"object"!=typeof u.target&&(u.target=rk(f,u.target)),r[u.source.index]=(r[u.source.index]||0)+1,r[u.target.index]=(r[u.target.index]||0)+1;for(o=0,a=new Array(c);o<c;++o)u=e[o],a[o]=r[u.source.index]/(r[u.source.index]+r[u.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]=+u(e[n],n,e)}function p(){if(i)for(var t=0,r=e.length;t<r;++t)n[t]=+l(e[t],t,e)}return null==e&&(e=[]),f.initialize=function(e,t){i=e,o=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?(u="function"==typeof e?e:ZA(+e),h(),f):u},f.distance=function(e){return arguments.length?(l="function"==typeof e?e:ZA(+e),p(),f):l},f},x:function(e){var t,n,i,r=ZA(.1);function a(e){for(var r,a=0,o=t.length;a<o;++a)(r=t[a]).vx+=(i[a]-r.x)*n[a]*e}function o(){if(t){var a,o=t.length;for(n=new Array(o),i=new Array(o),a=0;a<o;++a)n[a]=isNaN(i[a]=+e(t[a],a,t))?0:+r(t[a],a,t)}}return"function"!=typeof e&&(e=ZA(null==e?0:+e)),a.initialize=function(e){t=e,o()},a.strength=function(e){return arguments.length?(r="function"==typeof e?e:ZA(+e),o(),a):r},a.x=function(t){return arguments.length?(e="function"==typeof t?t:ZA(+t),o(),a):e},a},y:function(e){var t,n,i,r=ZA(.1);function a(e){for(var r,a=0,o=t.length;a<o;++a)(r=t[a]).vy+=(i[a]-r.y)*n[a]*e}function o(){if(t){var a,o=t.length;for(n=new Array(o),i=new Array(o),a=0;a<o;++a)n[a]=isNaN(i[a]=+e(t[a],a,t))?0:+r(t[a],a,t)}}return"function"!=typeof e&&(e=ZA(null==e?0:+e)),a.initialize=function(e){t=e,o()},a.strength=function(e){return arguments.length?(r="function"==typeof e?e:ZA(+e),o(),a):r},a.y=function(t){return arguments.length?(e="function"==typeof t?t:ZA(+t),o(),a):e},a}},fk="forces",dk=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],hk=["static","iterations"],pk=["x","y","vx","vy"];function mk(e){tu.call(this,null,e)}function gk(e,t,n,i){var r,a,o,s,u=c(t.forces);for(r=0,a=dk.length;r<a;++r)(o=dk[r])!==fk&&t.modified(o)&&e[o](t[o]);for(r=0,a=u.length;r<a;++r)s=fk+r,(o=n||t.modified(fk,r)?vk(u[r]):i&&yk(u[r],i)?e.force(s):null)&&e.force(s,o);for(a=e.numForces||0;r<a;++r)e.force(fk+r,null);return e.numForces=u.length,e}function yk(e,t){var n,i;for(n in e)if(m(i=e[n])&&t.modified(E(i)))return 1;return 0}function vk(e){var n,i;for(i in t(ck,e.force)||v("Unrecognized force: "+e.force),n=ck[e.force](),e)m(n[i])&&bk(n[i],e[i],e);return n}function bk(e,t,n){e(m(t)?e=>t(e,n):t)}mk.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:pk}]},_(mk,tu,{transform(e,t){var n,i,r=this.value,a=t.changed(t.ADD_REM),o=e.modified(dk),s=e.iterations||300;if(r?(a&&(t.modifies("index"),r.nodes(t.source)),(o||t.changed(t.MOD))&&gk(r,e,0,t)):(this.value=r=function(e,t){const n=lk(e),i=n.stop,r=n.restart;let a=!1;return n.stopped=()=>a,n.restart=()=>(a=!1,r()),n.stop=()=>(a=!0,i()),gk(n,t,!0).on("end",(()=>a=!0))}(t.source,e),r.on("tick",(n=t.dataflow,i=this,()=>n.touch(i).run())),e.static||(a=!0,r.tick()),t.modifies("index")),o||a||e.modified(hk)||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(),!a)return t.StopPropagation;return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let s,u=this._argops,l=0,c=u.length;l<c;++l)if(s=u[l],s.name===fk&&"link"===s.op._argval.force)for(var i,r=s.op._argops,a=0,o=r.length;a<o;++a)if("links"===r[a].name&&(i=r[a].op.source)){n.pulse(i,n.changeset().reflow());break}return t.reflow(e.modified()).modifies(pk)}});const xk=Object.freeze(Object.defineProperty({__proto__:null,force:mk},Symbol.toStringTag,{value:"Module"}));function wk(e,t){return e.parent===t.parent?1:2}function _k(e,t){return e+t.x}function Ak(e,t){return Math.max(e,t.y)}function kk(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 Dk(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=Ck)):void 0===t&&(t=Fk);for(var n,i,r,a,o,s=new Sk(e),u=[s];n=u.pop();)if((r=t(n.data))&&(o=(r=Array.from(r)).length))for(n.children=r,a=o-1;a>=0;--a)u.push(i=r[a]=new Sk(r[a])),i.parent=n,i.depth=n.depth+1;return s.eachBefore($k)}function Fk(e){return e.children}function Ck(e){return Array.isArray(e)?e[1]:null}function Ek(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function $k(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function Sk(e){this.data=e,this.depth=this.height=0,this.parent=null}function Mk(e){return null==e?null:Bk(e)}function Bk(e){if("function"!=typeof e)throw new Error;return e}function zk(){return 0}function Ok(e){return function(){return e}}Sk.prototype=Dk.prototype={constructor:Sk,count:function(){return this.eachAfter(kk)},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,a=this,o=[a],s=[],u=-1;a=o.pop();)if(s.push(a),n=a.children)for(i=0,r=n.length;i<r;++i)o.push(n[i]);for(;a=s.pop();)e.call(t,a,++u,this);return this},eachBefore:function(e,t){for(var n,i,r=this,a=[r],o=-1;r=a.pop();)if(e.call(t,r,++o,this),n=r.children)for(i=n.length-1;i>=0;--i)a.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 Dk(this).eachBefore(Ek)},[Symbol.iterator]:function*(){var e,t,n,i,r=this,a=[r];do{for(e=a.reverse(),a=[];r=e.pop();)if(yield r,t=r.children)for(n=0,i=t.length;n<i;++n)a.push(t[n])}while(a.length)}};const Nk=4294967296;function Rk(e,t){var n,i;if(jk(t,e))return[t];for(n=0;n<e.length;++n)if(Tk(t,e[n])&&jk(qk(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(Tk(qk(e[n],e[i]),t)&&Tk(qk(e[n],t),e[i])&&Tk(qk(e[i],t),e[n])&&jk(Uk(e[n],e[i],t),e))return[e[n],e[i],t];throw new Error}function Tk(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 Pk(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 jk(e,t){for(var n=0;n<t.length;++n)if(!Pk(e,t[n]))return!1;return!0}function Lk(e){switch(e.length){case 1:return{x:(t=e[0]).x,y:t.y,r:t.r};case 2:return qk(e[0],e[1]);case 3:return Uk(e[0],e[1],e[2])}var t}function qk(e,t){var n=e.x,i=e.y,r=e.r,a=t.x,o=t.y,s=t.r,u=a-n,l=o-i,c=s-r,f=Math.sqrt(u*u+l*l);return{x:(n+a+u/f*c)/2,y:(i+o+l/f*c)/2,r:(f+r+s)/2}}function Uk(e,t,n){var i=e.x,r=e.y,a=e.r,o=t.x,s=t.y,u=t.r,l=n.x,c=n.y,f=n.r,d=i-o,h=i-l,p=r-s,m=r-c,g=u-a,y=f-a,v=i*i+r*r-a*a,b=v-o*o-s*s+u*u,x=v-l*l-c*c+f*f,w=h*p-d*m,_=(p*x-m*b)/(2*w)-i,A=(m*g-p*y)/w,k=(h*b-d*x)/(2*w)-r,D=(d*y-h*g)/w,F=A*A+D*D-1,C=2*(a+_*A+k*D),E=_*_+k*k-a*a,$=-(Math.abs(F)>1e-6?(C+Math.sqrt(C*C-4*F*E))/(2*F):E/C);return{x:i+_+A*$,y:r+k+D*$,r:$}}function Ik(e,t,n){var i,r,a,o,s=e.x-t.x,u=e.y-t.y,l=s*s+u*u;l?(r=t.r+n.r,r*=r,o=e.r+n.r,r>(o*=o)?(i=(l+o-r)/(2*l),a=Math.sqrt(Math.max(0,o/l-i*i)),n.x=e.x-i*s-a*u,n.y=e.y-i*u+a*s):(i=(l+r-o)/(2*l),a=Math.sqrt(Math.max(0,r/l-i*i)),n.x=t.x+i*s-a*u,n.y=t.y+i*u+a*s)):(n.x=t.x+n.r,n.y=t.y)}function Wk(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 Hk(e){var t=e._,n=e.next._,i=t.r+n.r,r=(t.x*n.r+n.x*t.r)/i,a=(t.y*n.r+n.y*t.r)/i;return r*r+a*a}function Gk(e){this._=e,this.next=null,this.previous=null}function Vk(e,t){if(!(a=(e=function(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(e)).length))return 0;var n,i,r,a,o,s,u,l,c,f,d;if((n=e[0]).x=0,n.y=0,!(a>1))return n.r;if(i=e[1],n.x=-i.r,i.x=n.r,i.y=0,!(a>2))return n.r+i.r;Ik(i,n,r=e[2]),n=new Gk(n),i=new Gk(i),r=new Gk(r),n.next=r.previous=i,i.next=n.previous=r,r.next=i.previous=n;e:for(u=3;u<a;++u){Ik(n._,i._,r=e[u]),r=new Gk(r),l=i.next,c=n.previous,f=i._.r,d=n._.r;do{if(f<=d){if(Wk(l._,r._)){i=l,n.next=i,i.previous=n,--u;continue e}f+=l._.r,l=l.next}else{if(Wk(c._,r._)){(n=c).next=i,i.previous=n,--u;continue e}d+=c._.r,c=c.previous}}while(l!==c.next);for(r.previous=n,r.next=i,n.next=i.previous=i=r,o=Hk(n);(r=r.next)!==i;)(s=Hk(r))<o&&(n=r,o=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,a=(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,o=[];r<a;)n=e[r],i&&Pk(i,n)?++r:(i=Lk(o=Rk(o,n)),r=0);return i}(n,t),u=0;u<a;++u)(n=e[u]).x-=r.x,n.y-=r.y;return r.r}function Yk(e){return Math.sqrt(e.value)}function Xk(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function Jk(e,t,n){return function(i){if(r=i.children){var r,a,o,s=r.length,u=e(i)*t||0;if(u)for(a=0;a<s;++a)r[a].r+=u;if(o=Vk(r,n),u)for(a=0;a<s;++a)r[a].r-=u;i.r=o+u}}}function Qk(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 Kk(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 Zk(e,t,n,i,r){for(var a,o=e.children,s=-1,u=o.length,l=e.value&&(i-t)/e.value;++s<u;)(a=o[s]).y0=n,a.y1=r,a.x0=t,a.x1=t+=a.value*l}var eD={depth:-1},tD={},nD={};function iD(e){return e.id}function rD(e){return e.parentId}function aD(){var e,t=iD,n=rD;function i(i){var r,a,o,s,u,l,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;sD(e,t-1)&&!sD(e,t-2)&&(e=e.slice(0,-1));return"/"===e[0]?e:`/${e}`}(e(t,n,i)))),n=t.map(oD),r=new Set(t).add("");for(const e of n)r.has(e)||(r.add(e),t.push(e),n.push(oD(e)),d.push(nD));h=(e,n)=>t[n],p=(e,t)=>n[t]}for(o=0,r=d.length;o<r;++o)a=d[o],l=d[o]=new Sk(a),null!=(c=h(a,o,i))&&(c+="")&&(f=l.id=c,m.set(f,m.has(f)?tD:l)),null!=(c=p(a,o,i))&&(c+="")&&(l.parent=c);for(o=0;o<r;++o)if(c=(l=d[o]).parent){if(!(u=m.get(c)))throw new Error("missing: "+c);if(u===tD)throw new Error("ambiguous: "+c);u.children?u.children.push(l):u.children=[l],l.parent=u}else{if(s)throw new Error("multiple roots");s=l}if(!s)throw new Error("no root");if(null!=e){for(;s.data===nD&&1===s.children.length;)s=s.children[0],--r;for(let e=d.length-1;e>=0&&(l=d[e]).data===nD;--e)l.data=null}if(s.parent=eD,s.eachBefore((function(e){e.depth=e.parent.depth+1,--r})).eachBefore($k),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(e){return arguments.length?(t=Mk(e),i):t},i.parentId=function(e){return arguments.length?(n=Mk(e),i):n},i.path=function(t){return arguments.length?(e=Mk(t),i):e},i}function oD(e){let t=e.length;if(t<2)return"";for(;--t>1&&!sD(e,t););return e.slice(0,t)}function sD(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(!(1&n))return!0}return!1}function uD(e,t){return e.parent===t.parent?1:2}function lD(e){var t=e.children;return t?t[0]:e.t}function cD(e){var t=e.children;return t?t[t.length-1]:e.t}function fD(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 dD(e,t,n){return e.a.parent===t.parent?e.a:n}function hD(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 pD(e,t,n,i,r){for(var a,o=e.children,s=-1,u=o.length,l=e.value&&(r-n)/e.value;++s<u;)(a=o[s]).x0=t,a.x1=i,a.y0=n,a.y1=n+=a.value*l}hD.prototype=Object.create(Sk.prototype);var mD=(1+Math.sqrt(5))/2;function gD(e,t,n,i,r,a){for(var o,s,u,l,c,f,d,h,p,m,g,y=[],v=t.children,b=0,x=0,w=v.length,_=t.value;b<w;){u=r-n,l=a-i;do{c=v[x++].value}while(!c&&x<w);for(f=d=c,g=c*c*(m=Math.max(l/u,u/l)/(_*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(o={value:c,dice:u<l,children:v.slice(b,x)}),o.dice?Zk(o,n,i,r,_?i+=l*c/_:a):pD(o,n,i,_?n+=u*c/_:r,a),_-=c,b=x}return y}const yD=function e(t){function n(e,n,i,r,a){gD(t,e,n,i,r,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n}(mD);const vD=function e(t){function n(e,n,i,r,a){if((o=e._squarify)&&o.ratio===t)for(var o,s,u,l,c,f=-1,d=o.length,h=e.value;++f<d;){for(u=(s=o[f]).children,l=s.value=0,c=u.length;l<c;++l)s.value+=u[l].value;s.dice?Zk(s,n,i,r,h?i+=(a-i)*s.value/h:a):pD(s,n,i,h?n+=(r-n)*s.value/h:r,a),h-=s.value}else e._squarify=o=gD(t,e,n,i,r,a),o.ratio=t}return n.ratio=function(t){return e((t=+t)>1?t:1)},n}(mD);function bD(e,t,n){const i={};return e.each((e=>{const r=e.data;n(r)&&(i[t(r)]=e)})),e.lookup=i,e}function xD(e){tu.call(this,null,e)}xD.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const wD=e=>e.values;function _D(){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,a=e[i++],o={},s={};let u,l,c,f=-1;for(;++f<r;)u=a(l=t[f])+"",(c=o[u])?c.push(l):o[u]=[l];for(u in o)s[u]=n(o[u],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 AD(e){tu.call(this,null,e)}_(xD,tu,{transform(e,t){t.source||v("Nest transform requires an upstream data source.");var n=e.generate,i=e.modified(),r=t.clone(),a=this.value;return(!a||i||t.changed())&&(a&&a.each((e=>{e.children&&ws(e.data)&&r.rem.push(e.data)})),this.value=a=Dk({values:c(e.keys).reduce(((e,t)=>(e.key(t),e)),_D()).entries(r.source)},wD),n&&a.each((e=>{e.children&&(e=ks(e.data),r.add.push(e),r.source.push(e))})),bD(a,_s,_s)),r.source.root=a,r}});const kD=(e,t)=>e.parent===t.parent?1:2;_(AD,tu,{transform(e,t){t.source&&t.source.root||v(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),i=this.fields,r=t.source.root,a=e.as||i;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(Es(e.sort,(e=>e.data))),function(e,t,n){for(let i,r=0,a=t.length;r<a;++r)i=t[r],i in n&&e[i](n[i])}(n,this.params,e),n.separation&&n.separation(!1!==e.separation?kD:ce);try{this.value=n(r)}catch(o){v(o)}return r.each((e=>function(e,t,n){const i=e.data,r=t.length-1;for(let a=0;a<r;++a)i[n[a]]=e[t[a]];i[n[r]]=e.children?e.children.length:0}(e,i,a))),t.reflow(e.modified()).modifies(a).modifies("leaf")}});const DD=["x","y","r","depth","children"];function FD(e){AD.call(this,e)}FD.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:DD.length,default:DD}]},_(FD,AD,{layout:function(){var e=null,t=1,n=1,i=zk;function r(r){const a=function(){let e=1;return()=>(e=(1664525*e+1013904223)%Nk)/Nk}();return r.x=t/2,r.y=n/2,e?r.eachBefore(Xk(e)).eachAfter(Jk(i,.5,a)).eachBefore(Qk(1)):r.eachBefore(Xk(Yk)).eachAfter(Jk(zk,1,a)).eachAfter(Jk(i,r.r/Math.min(t,n),a)).eachBefore(Qk(Math.min(t,n)/(2*r.r))),r}return r.radius=function(t){return arguments.length?(e=Mk(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:Ok(+e),r):i},r},params:["radius","size","padding"],fields:DD});const CD=["x0","y0","x1","y1","depth","children"];function ED(e){AD.call(this,e)}function $D(e){tu.call(this,null,e)}ED.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:CD.length,default:CD}]},_(ED,AD,{layout:function(){var e=1,t=1,n=0,i=!1;function r(r){var a=r.height+1;return r.x0=r.y0=n,r.x1=e,r.y1=t/a,r.eachBefore(function(e,t){return function(i){i.children&&Zk(i,i.x0,e*(i.depth+1)/t,i.x1,e*(i.depth+2)/t);var r=i.x0,a=i.y0,o=i.x1-n,s=i.y1-n;o<r&&(r=o=(r+o)/2),s<a&&(a=s=(a+s)/2),i.x0=r,i.y0=a,i.x1=o,i.y1=s}}(t,a)),i&&r.eachBefore(Kk),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:CD}),$D.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},_($D,tu,{transform(e,t){t.source||v("Stratify transform requires an upstream data source.");let n=this.value;const i=e.modified(),r=t.fork(t.ALL).materialize(t.SOURCE),a=!n||i||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return r.source=r.source.slice(),a&&(n=r.source.length?bD(aD().id(e.key).parentId(e.parentKey)(r.source),e.key,x):bD(aD()([{}]),e.key,e.key)),r.source.root=this.value=n,r}});const SD={tidy:function(){var e=uD,t=1,n=1,i=null;function r(r){var u=function(e){for(var t,n,i,r,a,o=new hD(e,0),s=[o];t=s.pop();)if(i=t._.children)for(t.children=new Array(a=i.length),r=a-1;r>=0;--r)s.push(n=t.children[r]=new hD(i[r],r)),n.parent=t;return(o.parent=new hD(null,0)).children=[o],o}(r);if(u.eachAfter(a),u.parent.m=-u.z,u.eachBefore(o),i)r.eachBefore(s);else{var l=r,c=r,f=r;r.eachBefore((function(e){e.x<l.x&&(l=e),e.x>c.x&&(c=e),e.depth>f.depth&&(f=e)}));var d=l===c?1:e(l,c)/2,h=d-l.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 a(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,a=r.length;--a>=0;)(t=r[a]).z+=n,t.m+=n,n+=t.s+(i+=t.c)}(t);var a=(n[0].z+n[n.length-1].z)/2;r?(t.z=r.z+e(t._,r._),t.m=t.z-a):t.z=a}else r&&(t.z=r.z+e(t._,r._));t.parent.A=function(t,n,i){if(n){for(var r,a=t,o=t,s=n,u=a.parent.children[0],l=a.m,c=o.m,f=s.m,d=u.m;s=cD(s),a=lD(a),s&&a;)u=lD(u),(o=cD(o)).a=t,(r=s.z+f-a.z-l+e(s._,a._))>0&&(fD(dD(s,t,i),t,r),l+=r,c+=r),f+=s.m,l+=a.m,d+=u.m,c+=o.m;s&&!cD(o)&&(o.t=s,o.m+=f-c),a&&!lD(u)&&(u.t=a,u.m+=l-d,i=t)}return i}(t,r,t.parent.A||i[0])}function o(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=wk,t=1,n=1,i=!1;function r(r){var a,o=0;r.eachAfter((function(t){var n=t.children;n?(t.x=function(e){return e.reduce(_k,0)/e.length}(n),t.y=function(e){return 1+e.reduce(Ak,0)}(n)):(t.x=a?o+=e(t,a):0,t.y=0,a=t)}));var s=function(e){for(var t;t=e.children;)e=t[0];return e}(r),u=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(r),l=s.x-e(s,u)/2,c=u.x+e(u,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-l)/(c-l)*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}},MD=["x","y","depth","children"];function BD(e){AD.call(this,e)}function zD(e){tu.call(this,[],e)}BD.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:MD.length,default:MD}]},_(BD,AD,{layout(e){const n=e||"tidy";if(t(SD,n))return SD[n]();v("Unrecognized Tree layout method: "+n)},params:["size","nodeSize"],fields:MD}),zD.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},_(zD,tu,{transform(e,t){const n=this.value,i=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),a={};return i||v("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,(e=>a[_s(e)]=1)),i.each((e=>{const t=e.data,n=e.parent&&e.parent.data;n&&a[_s(t)]&&a[_s(n)]&&r.add.push(ks({source:n,target:t}))})),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,(e=>a[_s(e)]=1)),n.forEach((e=>{(a[_s(e.source)]||a[_s(e.target)])&&r.mod.push(e)}))),r}});const OD={binary:function(e,t,n,i,r){var a,o,s=e.children,u=s.length,l=new Array(u+1);for(l[0]=o=a=0;a<u;++a)l[a+1]=o+=s[a].value;!function e(t,n,i,r,a,o,u){if(t>=n-1){var c=s[t];return c.x0=r,c.y0=a,c.x1=o,void(c.y1=u)}var f=l[t],d=i/2+f,h=t+1,p=n-1;for(;h<p;){var m=h+p>>>1;l[m]<d?h=m+1:p=m}d-l[h-1]<l[h]-d&&t+1<h&&--h;var g=l[h]-f,y=i-g;if(o-r>u-a){var v=i?(r*y+o*g)/i:o;e(t,h,g,r,a,v,u),e(h,n,y,v,a,o,u)}else{var b=i?(a*y+u*g)/i:u;e(t,h,g,r,a,o,b),e(h,n,y,r,b,o,u)}}(0,u,e.value,t,n,i,r)},dice:Zk,slice:pD,slicedice:function(e,t,n,i,r){(1&e.depth?pD:Zk)(e,t,n,i,r)},squarify:yD,resquarify:vD},ND=["x0","y0","x1","y1","depth","children"];function RD(e){AD.call(this,e)}RD.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:ND.length,default:ND}]},_(RD,AD,{layout(){const e=function(){var e=yD,t=!1,n=1,i=1,r=[0],a=zk,o=zk,s=zk,u=zk,l=zk;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=i,e.eachBefore(f),r=[0],t&&e.eachBefore(Kk),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]=a(t)/2,i+=l(t)-n,c+=o(t)-n,(f-=s(t)-n)<i&&(i=f=(i+f)/2),(d-=u(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=Bk(t),c):e},c.padding=function(e){return arguments.length?c.paddingInner(e).paddingOuter(e):c.paddingInner()},c.paddingInner=function(e){return arguments.length?(a="function"==typeof e?e:Ok(+e),c):a},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?(o="function"==typeof e?e:Ok(+e),c):o},c.paddingRight=function(e){return arguments.length?(s="function"==typeof e?e:Ok(+e),c):s},c.paddingBottom=function(e){return arguments.length?(u="function"==typeof e?e:Ok(+e),c):u},c.paddingLeft=function(e){return arguments.length?(l="function"==typeof e?e:Ok(+e),c):l},c}();return e.ratio=t=>{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=n=>{t(OD,n)?e.tile(OD[n]):v("Unrecognized Treemap layout method: "+n)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:ND});const TD=Object.freeze(Object.defineProperty({__proto__:null,nest:xD,pack:FD,partition:ED,stratify:$D,tree:BD,treelinks:zD,treemap:RD},Symbol.toStringTag,{value:"Module"})),PD=4278190080;function jD(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function LD(e,t,n){if(!t.length)return;const i=t[0].mark.marktype;"group"===i?t.forEach((t=>{t.items.forEach((t=>LD(e,t.items,n)))})):gm[i].draw(e,{items:n?t.map(qD):t})}function qD(e){const t=Fs(e,{});return t.stroke&&0!==t.strokeOpacity||t.fill&&0!==t.fillOpacity?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const UD=31,ID=new Uint32Array(33),WD=new Uint32Array(33);WD[0]=0,ID[0]=~WD[0];for(let KV=1;KV<=32;++KV)WD[KV]=WD[KV-1]<<1|1,ID[KV]=~WD[KV];function HD(e,t,n){const i=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+i)/i),a=~~((t+2*n+i)/i),o=e=>~~((e+n)/i);return o.invert=e=>e*i-n,o.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&UD)},set:(t,n)=>{const r=n*e+t;i(r>>>5,1<<(r&UD))},clear:(t,n)=>{const i=n*e+t;r(i>>>5,~(1<<(i&UD)))},getRange:(t,i,r,a)=>{let o,s,u,l,c=a;for(;c>=i;--c)if(o=c*e+t,s=c*e+r,u=o>>>5,l=s>>>5,u===l){if(n[u]&ID[o&UD]&WD[1+(s&UD)])return!0}else{if(n[u]&ID[o&UD])return!0;if(n[l]&WD[1+(s&UD)])return!0;for(let e=u+1;e<l;++e)if(n[e])return!0}return!1},setRange:(t,n,r,a)=>{let o,s,u,l,c;for(;n<=a;++n)if(o=n*e+t,s=n*e+r,u=o>>>5,l=s>>>5,u===l)i(u,ID[o&UD]&WD[1+(s&UD)]);else for(i(u,ID[o&UD]),i(l,WD[1+(s&UD)]),c=u+1;c<l;++c)i(c,4294967295)},clearRange:(t,n,i,a)=>{let o,s,u,l,c;for(;n<=a;++n)if(o=n*e+t,s=n*e+i,u=o>>>5,l=s>>>5,u===l)r(u,WD[o&UD]|ID[1+(s&UD)]);else for(r(u,WD[o&UD]),r(l,ID[1+(s&UD)]),c=u+1;c<l;++c)r(c,0)},outOfBounds:(n,i,r,a)=>n<0||i<0||a>=t||r>=e}}(r,a),o.ratio=i,o.padding=n,o.width=e,o.height=t,o}function GD(e,t,n,i,r,a){let o=n/2;return e-o<0||e+o>r||t-(o=i/2)<0||t+o>a}function VD(e,t,n,i,r,a,o,s){const u=r*a/(2*i),l=e(t-u),c=e(t+u),f=e(n-(a/=2)),d=e(n+a);return o.outOfBounds(l,f,c,d)||o.getRange(l,f,c,d)||s&&s.getRange(l,f,c,d)}const YD=[-1,-1,1,1],XD=[-1,1,-1,1];const JD=["right","center","left"],QD=["bottom","middle","top"];function KD(e,t,n,i,r,a,o,s,u,l,c,f){return!(r.outOfBounds(e,n,t,i)||(f&&a||r).getRange(e,n,t,i))}const ZD={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},eF={naive:function(e,t,n,i){const r=e.width,a=e.height;return function(e){const t=e.datum.datum.items[i].items,n=t.length,o=e.datum.fontSize,s=Qp.width(e.datum,e.datum.text);let u,l,c,f,d,h,p,m=0;for(let i=0;i<n;++i)u=t[i].x,c=t[i].y,l=void 0===t[i].x2?u:t[i].x2,f=void 0===t[i].y2?c:t[i].y2,d=(u+l)/2,h=(c+f)/2,p=Math.abs(l-u+f-c),p>=m&&(m=p,e.x=d,e.y=h);return d=s/2,h=o/2,u=e.x-d,l=e.x+d,c=e.y-h,f=e.y+h,e.align="center",u<0&&l<=r?e.align="left":0<=u&&r<l&&(e.align="right"),e.baseline="middle",c<0&&f<=a?e.baseline="top":0<=c&&a<f&&(e.baseline="bottom"),!0}},"reduced-search":function(e,t,n,i){const r=e.width,a=e.height,o=t[0],s=t[1];function u(t,n,i,u,l){const c=e.invert(t),f=e.invert(n);let d,h=i,p=a;if(!GD(c,f,u,l,r,a)&&!VD(e,c,f,l,u,h,o,s)&&!VD(e,c,f,l,u,l,o,null)){for(;p-h>=1;)d=(h+p)/2,VD(e,c,f,l,u,d,o,s)?p=d:h=d;if(h>i)return[c,f,h,!0]}}return function(t){const s=t.datum.datum.items[i].items,l=s.length,c=t.datum.fontSize,f=Qp.width(t.datum,t.datum.text);let d,h,p,m,g,y,v,b,x,w,_,A,k,D,F,C,E,$=n?c:0,S=!1,M=!1,B=0;for(let i=0;i<l;++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&&(E=d,d=h,h=E),p>m&&(E=p,p=m,m=E),x=e(d),_=e(h),w=~~((x+_)/2),A=e(p),D=e(m),k=~~((A+D)/2),v=w;v>=x;--v)for(b=k;b>=A;--b)C=u(v,b,$,f,c),C&&([t.x,t.y,$,S]=C);for(v=w;v<=_;++v)for(b=k;b<=D;++b)C=u(v,b,$,f,c),C&&([t.x,t.y,$,S]=C);S||n||(F=Math.abs(h-d+m-p),g=(d+h)/2,y=(p+m)/2,F>=B&&!GD(g,y,f,c,r,a)&&!VD(e,g,y,c,f,c,o,null)&&(B=F,t.x=g,t.y=y,M=!0))}return!(!S&&!M)&&(g=f/2,y=c/2,o.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,a=e.height,o=t[0],s=t[1],u=e.bitmap();return function(t){const l=t.datum.datum.items[i].items,c=l.length,f=t.datum.fontSize,d=Qp.width(t.datum,t.datum.text),h=[];let p,m,g,y,v,b,x,w,_,A,k,D,F=n?f:0,C=!1,E=!1,$=0;for(let i=0;i<c;++i){for(p=l[i].x,g=l[i].y,m=void 0===l[i].x2?p:l[i].x2,y=void 0===l[i].y2?g:l[i].y2,h.push([e((p+m)/2),e((g+y)/2)]);h.length;)if([x,w]=h.pop(),!(o.get(x,w)||s.get(x,w)||u.get(x,w))){u.set(x,w);for(let e=0;e<4;++e)v=x+YD[e],b=w+XD[e],u.outOfBounds(v,b,v,b)||h.push([v,b]);if(v=e.invert(x),b=e.invert(w),_=F,A=a,!GD(v,b,d,f,r,a)&&!VD(e,v,b,f,d,_,o,s)&&!VD(e,v,b,f,d,f,o,null)){for(;A-_>=1;)k=(_+A)/2,VD(e,v,b,f,d,k,o,s)?A=k:_=k;_>F&&(t.x=v,t.y=b,F=_,C=!0)}}C||n||(D=Math.abs(m-p+y-g),v=(p+m)/2,b=(g+y)/2,D>=$&&!GD(v,b,d,f,r,a)&&!VD(e,v,b,f,d,f,o,null)&&($=D,t.x=v,t.y=b,E=!0))}return!(!C&&!E)&&(v=d/2,b=f/2,o.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 tF(e,t,n,i,r,a,o,s,u,l,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]|=ZD[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[u].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,u),v=null===l||l===1/0,b=g&&"naive"===c;var x;let w=-1,_=-1;const A=e.map((e=>{const t=v?Qp.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}}));l=null===l||l===1/0?Math.max(w,_)+Math.max(...i):l;const k=HD(t[0],t[1],l);let D;if(!b){n&&A.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&&o||g)&&e.map((e=>e.datum));D=a.length||i?function(e,t,n,i,r){const a=e.width,o=e.height,s=i||r,u=Fc(a,o).getContext("2d"),l=Fc(a,o).getContext("2d"),c=s&&Fc(a,o).getContext("2d");n.forEach((e=>LD(u,e,!1))),LD(l,t,!1),s&&LD(c,t,!0);const f=jD(u,a,o),d=jD(l,a,o),h=s&&jD(c,a,o),p=e.bitmap(),m=s&&e.bitmap();let g,y,v,b,x,w,_,A;for(y=0;y<o;++y)for(g=0;g<a;++g)x=y*a+g,w=f[x]&PD,A=d[x]&PD,_=s&&h[x]&PD,(w||_||A)&&(v=e(g),b=e(y),r||!w&&!A||p.set(v,b),s&&(w||_)&&m.set(v,b));return[p,m]}(k,i||[],a,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]}(k,o&&A)}const F=g?eF[c](k,D,o,u):function(e,t,n,i){const r=e.width,a=e.height,o=t[0],s=t[1],u=i.length;return function(t){const l=t.boundary,c=t.datum.fontSize;if(l[2]<0||l[5]<0||l[0]>r||l[3]>a)return!1;let f,d,h,p,m,g,y,v,b,x,w,_,A,k,D,F=t.textWidth??0;for(let r=0;r<u;++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=l[1+f]+i[r]*f*p,w=l[4+d]+m*c*d/2+i[r]*d*p,v=w-c/2,b=w+c/2,_=e(g),k=e(v),D=e(b),!F){if(!KD(_,_,k,D,o,s,0,0,0,0,0,h))continue;F=Qp.width(t.datum,t.datum.text)}if(x=g+m*F*f/2,g=x-F/2,y=x+F/2,_=e(g),A=e(y),KD(_,A,k,D,o,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=JD[f*m+1],t.baseline=QD[d*m+1],o.setRange(_,k,A,D),!0}return!1}}(k,D,h,d);return A.forEach((e=>e.opacity=+F(e))),A}const nF=["x","y","opacity","align","baseline"],iF=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function rF(e){tu.call(this,null,e)}rF.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:iF},{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:nF.length,default:nF}]},_(rF,tu,{transform(e,t){const n=e.modified();if(!(n||t.changed(t.ADD_REM)||function(n){const i=e[n];return m(i)&&t.modified(i.fields)}("sort")))return;e.size&&2===e.size.length||v("Size parameter should be specified as a [width, height] array.");const i=e.as||nF;return tF(t.materialize(t.SOURCE).source||[],e.size,e.sort,c(null==e.offset?1:e.offset),c(e.anchor||iF),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 aF=Object.freeze(Object.defineProperty({__proto__:null,label:rF},Symbol.toStringTag,{value:"Module"}));function oF(e,t){var n,i,r,a,o,s,u=[],l=function(e){return e(a)};if(null==t)u.push(e);else for(n={},i=0,r=e.length;i<r;++i)a=e[i],(s=n[o=t.map(l)])||(n[o]=s=[],s.dims=o,u.push(s)),s.push(a);return u}function sF(e){tu.call(this,null,e)}sF.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}]},_(sF,tu,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=oF(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(C),a=r.length,o=e.as||[C(e.x),C(e.y)],s=[];i.forEach((t=>{Hu(t,e.x,e.y,e.bandwidth||.3).forEach((e=>{const n={};for(let i=0;i<a;++i)n[r[i]]=t.dims[i];n[o[0]]=e[0],n[o[1]]=e[1],s.push(ks(n))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=s}return n}});const uF={constant:zu,linear:Pu,log:ju,exp:Lu,pow:qu,quad:Uu,poly:Iu};function lF(e){tu.call(this,null,e)}lF.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(uF)},{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}]},_(lF,tu,{transform(e,n){const i=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||e.modified()){const r=oF(n.materialize(n.SOURCE).source,e.groupby),a=(e.groupby||[]).map(C),o=e.method||"linear",s=null==e.order?3:e.order,u=((e,t)=>"poly"===e?t:"quad"===e?2:1)(o,s),l=e.as||[C(e.x),C(e.y)],c=uF[o],f=[];let d=e.extent;t(uF,o)||v("Invalid regression method: "+o),null!=d&&"log"===o&&d[0]<=0&&(n.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),r.forEach((t=>{if(t.length<=u)return void n.dataflow.warn("Skipping regression with more parameters than data points.");const i=c(t,e.x,e.y,s);if(e.params)return void f.push(ks({keys:t.dims,coef:i.coef,rSquared:i.rSquared}));const r=d||M(t,e.x),h=e=>{const n={};for(let i=0;i<a.length;++i)n[a[i]]=t.dims[i];n[l[0]]=e[0],n[l[1]]=e[1],f.push(ks(n))};"linear"===o||"constant"===o?r.forEach((e=>h([e,i.predict(e)]))):Xu(i.predict,r,25,200).forEach(h)})),this.value&&(i.rem=this.value),this.value=i.add=i.source=f}return i}});const cF=Object.freeze(Object.defineProperty({__proto__:null,loess:sF,regression:lF},Symbol.toStringTag,{value:"Module"})),fF=134217729;function dF(e,t,n,i,r){let a,o,s,u,l=t[0],c=i[0],f=0,d=0;c>l==c>-l?(a=l,l=t[++f]):(a=c,c=i[++d]);let h=0;if(f<e&&d<n)for(c>l==c>-l?(o=l+a,s=a-(o-l),l=t[++f]):(o=c+a,s=a-(o-c),c=i[++d]),a=o,0!==s&&(r[h++]=s);f<e&&d<n;)c>l==c>-l?(o=a+l,u=o-a,s=a-(o-u)+(l-u),l=t[++f]):(o=a+c,u=o-a,s=a-(o-u)+(c-u),c=i[++d]),a=o,0!==s&&(r[h++]=s);for(;f<e;)o=a+l,u=o-a,s=a-(o-u)+(l-u),l=t[++f],a=o,0!==s&&(r[h++]=s);for(;d<n;)o=a+c,u=o-a,s=a-(o-u)+(c-u),c=i[++d],a=o,0!==s&&(r[h++]=s);return 0===a&&0!==h||(r[h++]=a),h}function hF(e){return new Float64Array(e)}const pF=hF(4),mF=hF(8),gF=hF(12),yF=hF(16),vF=hF(4);function bF(e,t,n,i,r,a){const o=(t-a)*(n-r),s=(e-r)*(i-a),u=o-s,l=Math.abs(o+s);return Math.abs(u)>=33306690738754716e-32*l?u:-function(e,t,n,i,r,a,o){let s,u,l,c,f,d,h,p,m,g,y,v,b,x,w,_,A,k;const D=e-r,F=n-r,C=t-a,E=i-a;x=D*E,d=fF*D,h=d-(d-D),p=D-h,d=fF*E,m=d-(d-E),g=E-m,w=p*g-(x-h*m-p*m-h*g),_=C*F,d=fF*C,h=d-(d-C),p=C-h,d=fF*F,m=d-(d-F),g=F-m,A=p*g-(_-h*m-p*m-h*g),y=w-A,f=w-y,pF[0]=w-(y+f)+(f-A),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,pF[1]=b-(y+f)+(f-_),k=v+y,f=k-v,pF[2]=v-(k-f)+(y-f),pF[3]=k;let $=function(e,t){let n=t[0];for(let i=1;i<e;i++)n+=t[i];return n}(4,pF),S=22204460492503146e-32*o;if($>=S||-$>=S)return $;if(f=e-D,s=e-(D+f)+(f-r),f=n-F,l=n-(F+f)+(f-r),f=t-C,u=t-(C+f)+(f-a),f=i-E,c=i-(E+f)+(f-a),0===s&&0===u&&0===l&&0===c)return $;if(S=11093356479670487e-47*o+33306690738754706e-32*Math.abs($),$+=D*c+E*s-(C*l+F*u),$>=S||-$>=S)return $;x=s*E,d=fF*s,h=d-(d-s),p=s-h,d=fF*E,m=d-(d-E),g=E-m,w=p*g-(x-h*m-p*m-h*g),_=u*F,d=fF*u,h=d-(d-u),p=u-h,d=fF*F,m=d-(d-F),g=F-m,A=p*g-(_-h*m-p*m-h*g),y=w-A,f=w-y,vF[0]=w-(y+f)+(f-A),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,vF[1]=b-(y+f)+(f-_),k=v+y,f=k-v,vF[2]=v-(k-f)+(y-f),vF[3]=k;const M=dF(4,pF,4,vF,mF);x=D*c,d=fF*D,h=d-(d-D),p=D-h,d=fF*c,m=d-(d-c),g=c-m,w=p*g-(x-h*m-p*m-h*g),_=C*l,d=fF*C,h=d-(d-C),p=C-h,d=fF*l,m=d-(d-l),g=l-m,A=p*g-(_-h*m-p*m-h*g),y=w-A,f=w-y,vF[0]=w-(y+f)+(f-A),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,vF[1]=b-(y+f)+(f-_),k=v+y,f=k-v,vF[2]=v-(k-f)+(y-f),vF[3]=k;const B=dF(M,mF,4,vF,gF);x=s*c,d=fF*s,h=d-(d-s),p=s-h,d=fF*c,m=d-(d-c),g=c-m,w=p*g-(x-h*m-p*m-h*g),_=u*l,d=fF*u,h=d-(d-u),p=u-h,d=fF*l,m=d-(d-l),g=l-m,A=p*g-(_-h*m-p*m-h*g),y=w-A,f=w-y,vF[0]=w-(y+f)+(f-A),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,vF[1]=b-(y+f)+(f-_),k=v+y,f=k-v,vF[2]=v-(k-f)+(y-f),vF[3]=k;const z=dF(B,gF,4,vF,yF);return yF[z-1]}(e,t,n,i,r,a,l)}const xF=Math.pow(2,-52),wF=new Uint32Array(512);class _F{static from(e,t=EF,n=$F){const i=e.length,r=new Float64Array(2*i);for(let a=0;a<i;a++){const i=e[a];r[2*a]=t(i),r[2*a+1]=n(i)}return new _F(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,a=e.length>>1;let o=1/0,s=1/0,u=-1/0,l=-1/0;for(let D=0;D<a;D++){const t=e[2*D],n=e[2*D+1];t<o&&(o=t),n<s&&(s=n),t>u&&(u=t),n>l&&(l=n),this._ids[D]=D}const c=(o+u)/2,f=(s+l)/2;let d,h,p,m=1/0;for(let D=0;D<a;D++){const t=AF(c,f,e[2*D],e[2*D+1]);t<m&&(d=D,m=t)}const g=e[2*d],y=e[2*d+1];m=1/0;for(let D=0;D<a;D++){if(D===d)continue;const t=AF(g,y,e[2*D],e[2*D+1]);t<m&&t>0&&(h=D,m=t)}let v=e[2*h],b=e[2*h+1],x=1/0;for(let D=0;D<a;D++){if(D===d||D===h)continue;const t=DF(g,y,v,b,e[2*D],e[2*D+1]);t<x&&(p=D,x=t)}let w=e[2*p],_=e[2*p+1];if(x===1/0){for(let i=0;i<a;i++)this._dists[i]=e[2*i]-e[0]||e[2*i+1]-e[1];FF(this._ids,this._dists,0,a-1);const t=new Uint32Array(a);let n=0;for(let e=0,i=-1/0;e<a;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(bF(g,y,v,b,w,_)<0){const e=h,t=v,n=b;h=p,v=w,b=_,p=e,w=t,_=n}const A=function(e,t,n,i,r,a){const o=n-e,s=i-t,u=r-e,l=a-t,c=o*o+s*s,f=u*u+l*l,d=.5/(o*l-s*u),h=e+(l*c-s*f)*d;return{x:h,y:t+(o*f-u*c)*d}}(g,y,v,b,w,_);this._cx=A.x,this._cy=A.y;for(let D=0;D<a;D++)this._dists[D]=AF(e[2*D],e[2*D+1],A.x,A.y);FF(this._ids,this._dists,0,a-1),this._hullStart=d;let k=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 D,F,C=0;C<this._ids.length;C++){const a=this._ids[C],o=e[2*a],s=e[2*a+1];if(C>0&&Math.abs(o-D)<=xF&&Math.abs(s-F)<=xF)continue;if(D=o,F=s,a===d||a===h||a===p)continue;let u=0;for(let e=0,t=this._hashKey(o,s);e<this._hashSize&&(u=r[(t+e)%this._hashSize],-1===u||u===n[u]);e++);u=t[u];let l,c=u;for(;l=n[c],bF(o,s,e[2*c],e[2*c+1],e[2*l],e[2*l+1])>=0;)if(c=l,c===u){c=-1;break}if(-1===c)continue;let f=this._addTriangle(c,a,n[c],-1,-1,i[c]);i[a]=this._legalize(f+2),i[c]=f,k++;let m=n[c];for(;l=n[m],bF(o,s,e[2*m],e[2*m+1],e[2*l],e[2*l+1])<0;)f=this._addTriangle(m,a,l,i[a],-1,i[m]),i[a]=this._legalize(f+2),n[m]=m,k--,m=l;if(c===u)for(;l=t[c],bF(o,s,e[2*l],e[2*l+1],e[2*c],e[2*c+1])<0;)f=this._addTriangle(l,a,c,-1,i[c],i[l]),this._legalize(f+2),i[l]=f,n[c]=c,k--,c=l;this._hullStart=t[a]=c,n[c]=t[m]=a,n[a]=m,r[this._hashKey(o,s)]=a,r[this._hashKey(e[2*c],e[2*c+1])]=c}this.hull=new Uint32Array(k);for(let D=0,F=this._hullStart;D<k;D++)this.hull[D]=F,F=n[F];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,a=0;for(;;){const o=n[e],s=e-e%3;if(a=s+(e+2)%3,-1===o){if(0===r)break;e=wF[--r];continue}const u=o-o%3,l=s+(e+1)%3,c=u+(o+2)%3,f=t[a],d=t[e],h=t[l],p=t[c];if(kF(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[o]=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(o,n[a]),this._link(a,c);const s=u+(o+1)%3;r<wF.length&&(wF[r++]=s)}else{if(0===r)break;e=wF[--r]}}return a}_link(e,t){this._halfedges[e]=t,-1!==t&&(this._halfedges[t]=e)}_addTriangle(e,t,n,i,r,a){const o=this.trianglesLen;return this._triangles[o]=e,this._triangles[o+1]=t,this._triangles[o+2]=n,this._link(o,i),this._link(o+1,r),this._link(o+2,a),this.trianglesLen+=3,o}}function AF(e,t,n,i){const r=e-n,a=t-i;return r*r+a*a}function kF(e,t,n,i,r,a,o,s){const u=e-o,l=t-s,c=n-o,f=i-s,d=r-o,h=a-s,p=c*c+f*f,m=d*d+h*h;return u*(f*m-p*h)-l*(c*m-p*d)+(u*u+l*l)*(c*h-f*d)<0}function DF(e,t,n,i,r,a){const o=n-e,s=i-t,u=r-e,l=a-t,c=o*o+s*s,f=u*u+l*l,d=.5/(o*l-s*u),h=(l*c-s*f)*d,p=(o*f-u*c)*d;return h*h+p*p}function FF(e,t,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const i=e[r],a=t[i];let o=r-1;for(;o>=n&&t[e[o]]>a;)e[o+1]=e[o--];e[o+1]=i}else{let r=n+1,a=i;CF(e,n+i>>1,r),t[e[n]]>t[e[i]]&&CF(e,n,i),t[e[r]]>t[e[i]]&&CF(e,r,i),t[e[n]]>t[e[r]]&&CF(e,n,r);const o=e[r],s=t[o];for(;;){do{r++}while(t[e[r]]<s);do{a--}while(t[e[a]]>s);if(a<r)break;CF(e,r,a)}e[n+1]=e[a],e[a]=o,i-r+1>=a-n?(FF(e,t,r,i),FF(e,t,n,a-1)):(FF(e,t,n,a-1),FF(e,t,r,i))}}function CF(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function EF(e){return e[0]}function $F(e){return e[1]}const SF=1e-6;class MF{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)>SF||Math.abs(this._y1-r)>SF)&&(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 BF{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 zF=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,a;const o=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],u=2*n[g+2],l=e[i],c=e[i+1],f=e[s],d=e[s+1],h=e[u],v=e[u+1],b=f-l,x=d-c,w=h-l,_=v-c,A=2*(b*_-x*w);if(Math.abs(A)<1e-9){if(void 0===r){r=a=0;for(const n of t)r+=e[2*n],a+=e[2*n+1];r/=t.length,a/=t.length}const n=1e9*Math.sign((r-l)*_-(a-c)*w);p=(l+h)/2-n*_,m=(c+v)/2+n*w}else{const e=1/A,t=b*b+x*x,n=w*w+_*_;p=l+(_*t-x*n)*e,m=c+(b*n-w*t)*e}o[y]=p,o[y+1]=m}let s,u,l,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,u=d,l=h,f=4*c,d=e[2*c],h=e[2*c+1],i[s+2]=i[f]=l-h,i[s+3]=i[f+1]=d-u}render(e){const t=null==e?e=new MF:void 0,{delaunay:{halfedges:n,inedges:i,hull:r},circumcenters:a,vectors:o}=this;if(r.length<=1)return null;for(let l=0,c=n.length;l<c;++l){const t=n[l];if(t<l)continue;const i=2*Math.floor(l/3),r=2*Math.floor(t/3),o=a[i],s=a[i+1],u=a[r],c=a[r+1];this._renderSegment(o,s,u,c,e)}let s,u=r[r.length-1];for(let l=0;l<r.length;++l){s=u,u=r[l];const t=2*Math.floor(i[u]/3),n=a[t],c=a[t+1],f=4*s,d=this._project(n,c,o[f+2],o[f+3]);d&&this._renderSegment(n,c,d[0],d[1],e)}return t&&t.value()}renderBounds(e){const t=null==e?e=new MF: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 MF: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 a=2;a<r;a+=2)i[a]===i[a-2]&&i[a+1]===i[a-1]||t.lineTo(i[a],i[a+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 BF;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,i,r){let a;const o=this._regioncode(e,t),s=this._regioncode(n,i);0===o&&0===s?(r.moveTo(e,t),r.lineTo(n,i)):(a=this._clipSegment(e,t,n,i,o,s))&&(r.moveTo(a[0],a[1]),r.lineTo(a[2],a[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 a=0,o=e.length;a<o;a+=2)if(t[i]===e[a]&&t[i+1]===e[a+1]&&t[(i+2)%r]===e[(a+o-2)%o]&&t[(i+3)%r]===e[(a+o-1)%o]){yield n;break e}}}_cell(e){const{circumcenters:t,delaunay:{inedges:n,halfedges:i,triangles:r}}=this,a=n[e];if(-1===a)return null;const o=[];let s=a;do{const n=Math.floor(s/3);if(o.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!==a&&-1!==s);return o}_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,a,o,s=null,u=t[n-2],l=t[n-1],c=this._regioncode(u,l),f=0;for(let d=0;d<n;d+=2)if(i=u,r=l,u=t[d],l=t[d+1],a=c,c=this._regioncode(u,l),0===a&&0===c)o=f,f=0,s?s.push(u,l):s=[u,l];else{let t,n,d,h,p;if(0===a){if(null===(t=this._clipSegment(i,r,u,l,a,c)))continue;[n,d,h,p]=t}else{if(null===(t=this._clipSegment(u,l,i,r,c,a)))continue;[h,p,n,d]=t,o=f,f=this._edgecode(n,d),o&&f&&this._edge(e,o,f,s,s.length),s?s.push(n,d):s=[n,d]}o=f,f=this._edgecode(h,p),o&&f&&this._edge(e,o,f,s,s.length),s?s.push(h,p):s=[h,p]}if(s)o=f,f=this._edgecode(s[0],s[1]),o&&f&&this._edge(e,o,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,a){const o=r<a;for(o&&([e,t,n,i,r,a]=[n,i,e,t,a,r]);;){if(0===r&&0===a)return o?[n,i,e,t]:[e,t,n,i];if(r&a)return null;let s,u,l=r||a;8&l?(s=e+(n-e)*(this.ymax-t)/(i-t),u=this.ymax):4&l?(s=e+(n-e)*(this.ymin-t)/(i-t),u=this.ymin):2&l?(u=t+(i-t)*(this.xmax-e)/(n-e),s=this.xmax):(u=t+(i-t)*(this.xmin-e)/(n-e),s=this.xmin),r?(e=s,t=u,r=this._regioncode(e,t)):(n=s,i=u,a=this._regioncode(n,i))}}_clipInfinite(e,t,n,i,r,a){let o,s=Array.from(t);if((o=this._project(s[0],s[1],n,i))&&s.unshift(o[0],o[1]),(o=this._project(s[s.length-2],s[s.length-1],r,a))&&s.push(o[0],o[1]),s=this._clipFinite(e,s))for(let u,l=0,c=s.length,f=this._edgecode(s[c-2],s[c-1]);l<c;l+=2)u=f,f=this._edgecode(s[l],s[l+1]),u&&f&&(l=this._edge(e,u,f,s,l),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,a;switch(t){case 5:t=4;continue;case 4:t=6,n=this.xmax,a=this.ymin;break;case 6:t=2;continue;case 2:t=10,n=this.xmax,a=this.ymax;break;case 10:t=8;continue;case 8:t=9,n=this.xmin,a=this.ymax;break;case 9:t=1;continue;case 1:t=5,n=this.xmin,a=this.ymin}i[r]===n&&i[r+1]===a||!this.contains(e,n,a)||(i.splice(r,0,n,a),r+=2)}return r}_project(e,t,n,i){let r,a,o,s=1/0;if(i<0){if(t<=this.ymin)return null;(r=(this.ymin-t)/i)<s&&(o=this.ymin,a=e+(s=r)*n)}else if(i>0){if(t>=this.ymax)return null;(r=(this.ymax-t)/i)<s&&(o=this.ymax,a=e+(s=r)*n)}if(n>0){if(e>=this.xmax)return null;(r=(this.xmax-e)/n)<s&&(a=this.xmax,o=t+(s=r)*i)}else if(n<0){if(e<=this.xmin)return null;(r=(this.xmin-e)/n)<s&&(a=this.xmin,o=t+(s=r)*i)}return[a,o]}_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 OF=2*Math.PI,NF=Math.pow;function RF(e){return e[0]}function TF(e){return e[1]}function PF(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class jF{static from(e,t=RF,n=TF,i){return new jF("length"in e?function(e,t,n,i){const r=e.length,a=new Float64Array(2*r);for(let o=0;o<r;++o){const r=e[o];a[2*o]=t.call(i,r,o,e),a[2*o+1]=n.call(i,r,o,e)}return a}(e,t,n,i):Float64Array.from(function*(e,t,n,i){let r=0;for(const a of e)yield t.call(i,a,r,e),yield n.call(i,a,r,e),++r}(e,t,n,i)))}constructor(e){this._delaunator=new _F(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],a=2*t[i+2];if((n[a]-n[e])*(n[r+1]-n[e+1])-(n[r]-n[e])*(n[a+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 a=0,o=t.length/2;a<o;++a){const e=PF(t[2*a],t[2*a+1],r);t[2*a]=e[0],t[2*a+1]=e[1]}this._delaunator=new _F(t)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,r=this.triangles=this._delaunator.triangles,a=this.inedges.fill(-1),o=this._hullIndex.fill(-1);for(let s=0,u=n.length;s<u;++s){const e=r[s%3==2?s-2:s+1];-1!==n[s]&&-1!==a[e]||(a[e]=s)}for(let s=0,u=i.length;s<u;++s)o[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],a[i[0]]=1,2===i.length&&(a[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(e){return new zF(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:i,halfedges:r,triangles:a,collinear:o}=this;if(o){const t=o.indexOf(e);return t>0&&(yield o[t-1]),void(t<o.length-1&&(yield o[t+1]))}const s=t[e];if(-1===s)return;let u=s,l=-1;do{if(yield l=a[u],u=u%3==2?u-2:u+1,a[u]!==e)return;if(u=r[u],-1===u){const t=n[(i[e]+1)%n.length];return void(t!==l&&(yield t))}}while(u!==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:a,halfedges:o,triangles:s,points:u}=this;if(-1===i[e]||!u.length)return(e+1)%(u.length>>1);let l=e,c=NF(t-u[2*e],2)+NF(n-u[2*e+1],2);const f=i[e];let d=f;do{let i=s[d];const f=NF(t-u[2*i],2)+NF(n-u[2*i+1],2);if(f<c&&(c=f,l=i),d=d%3==2?d-2:d+1,s[d]!==e)break;if(d=o[d],-1===d){if(d=r[(a[e]+1)%r.length],d!==i&&NF(t-u[2*d],2)+NF(n-u[2*d+1],2)<c)return d;break}}while(d!==f);return l}render(e){const t=null==e?e=new MF:void 0,{points:n,halfedges:i,triangles:r}=this;for(let a=0,o=i.length;a<o;++a){const t=i[a];if(t<a)continue;const o=2*r[a],s=2*r[t];e.moveTo(n[o],n[o+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 MF:void 0,{points:i}=this;for(let r=0,a=i.length;r<a;r+=2){const n=i[r],a=i[r+1];e.moveTo(n+t,a),e.arc(n,a,t,0,OF)}return n&&n.value()}renderHull(e){const t=null==e?e=new MF:void 0,{hull:n,points:i}=this,r=2*n[0],a=n.length;e.moveTo(i[r],i[r+1]);for(let o=1;o<a;++o){const t=2*n[o];e.lineTo(i[t],i[t+1])}return e.closePath(),t&&t.value()}hullPolygon(){const e=new BF;return this.renderHull(e),e.value()}renderTriangle(e,t){const n=null==t?t=new MF:void 0,{points:i,triangles:r}=this,a=2*r[e*=3],o=2*r[e+1],s=2*r[e+2];return t.moveTo(i[a],i[a+1]),t.lineTo(i[o],i[o+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 BF;return this.renderTriangle(e,t),t.value()}}function LF(e){tu.call(this,null,e)}LF.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 qF=[-1e5,-1e5,1e5,1e5];function UF(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"}_(LF,tu,{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]]:qF;const a=this.value=jF.from(i,e.x,e.y).voronoi(r);for(let s=0,u=i.length;s<u;++s){const e=a.cellPolygon(s);i[s][n]=e&&(2!==(o=e).length||o[0][0]!==o[1][0]||o[0][1]!==o[1][1])?UF(e):null}var o;return t.reflow(e.modified()).modifies(n)}});const IF=Object.freeze(Object.defineProperty({__proto__:null,voronoi:LF},Symbol.toStringTag,{value:"Module"}));var WF=Math.PI/180,HF=2048;function GF(){var e,t,n,i,r,a,o,s=[256,256],u=JF,l=[],c=Math.random,f={};function d(e,t,n){for(var i,r,a,o,l,f=t.x,d=t.y,h=Math.hypot(s[0],s[1]),p=u(s),m=c()<.5?1:-1,g=-m;(i=p(g+=m))&&(r=~~i[0],a=~~i[1],!(Math.min(Math.abs(r),Math.abs(a))>=h));)if(t.x=f+r,t.y=d+a,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>s[0]||t.y+t.y1>s[1]||n&&YF(t,e,s[0])||n&&(l=n,!((o=t).x+o.x1>l[0].x&&o.x+o.x0<l[1].x&&o.y+o.y1>l[0].y&&o.y+o.y0<l[1].y)))){for(var y,v=t.sprite,b=t.width>>5,x=s[0]>>5,w=t.x-(b<<4),_=127&w,A=32-_,k=t.y1-t.y0,D=(t.y+t.y0)*x+(w>>5),F=0;F<k;F++){y=0;for(var C=0;C<=b;C++)e[D+C]|=y<<A|(C<b?(y=v[F*b+C])>>>_:0);D+=x}return t.sprite=null,!0}return!1}return f.layout=function(){for(var u=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=HF/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(Fc()),f=function(e){var t=[],n=-1;for(;++n<e;)t[n]=0;return t}((s[0]>>5)*s[1]),h=null,p=l.length,m=-1,g=[],y=l.map((s=>({text:e(s),font:t(s),style:i(s),weight:r(s),rotate:a(s),size:~~(n(s)+1e-14),padding:o(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,VF(u,v,y,m),v.hasText&&d(f,v,h)&&(g.push(v),h?XF(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?(l=e,f):l},f.size=function(e){return arguments.length?(s=[+e[0],+e[1]],f):s},f.font=function(e){return arguments.length?(t=QF(e),f):t},f.fontStyle=function(e){return arguments.length?(i=QF(e),f):i},f.fontWeight=function(e){return arguments.length?(r=QF(e),f):r},f.rotate=function(e){return arguments.length?(a=QF(e),f):a},f.text=function(t){return arguments.length?(e=QF(t),f):e},f.spiral=function(e){return arguments.length?(u=KF[e]||e,f):u},f.fontSize=function(e){return arguments.length?(n=QF(e),f):n},f.padding=function(e){return arguments.length?(o=QF(e),f):o},f.random=function(e){return arguments.length?(c=e,f):c},f}function VF(e,t,n,i){if(!t.sprite){var r=e.context,a=e.ratio;r.clearRect(0,0,2048/a,HF/a);var o,s,u,l,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)/a)+"px "+t.font,o=r.measureText(t.text+"m").width*a,u=t.size<<1,t.rotate){var m=Math.sin(t.rotate*WF),g=Math.cos(t.rotate*WF),y=o*g,v=o*m,b=u*g,x=u*m;o=Math.max(Math.abs(y+x),Math.abs(y-x))+31>>5<<5,u=~~Math.max(Math.abs(v+b),Math.abs(v-b))}else o=o+31>>5<<5;if(u>h&&(h=u),f+o>=2048&&(f=0,d+=h,h=0),d+u>=HF)break;r.translate((f+(o>>1))/a,(d+(u>>1))/a),t.rotate&&r.rotate(t.rotate*WF),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=o,t.height=u,t.xoff=f,t.yoff=d,t.x1=o>>1,t.y1=u>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,f+=o}for(var w=r.getImageData(0,0,2048/a,HF/a).data,_=[];--i>=0;)if((t=n[i]).hasText){for(s=(o=t.width)>>5,u=t.y1-t.y0,l=0;l<u*s;l++)_[l]=0;if(null==(f=t.xoff))return;d=t.yoff;var A=0,k=-1;for(c=0;c<u;c++){for(l=0;l<o;l++){var D=s*c+(l>>5),F=w[2048*(d+c)+(f+l)<<2]?1<<31-l%32:0;_[D]|=F,A|=F}A?k=c:(t.y0++,u--,c--,d++)}t.y1=t.y0+k,t.sprite=_.slice(0,(t.y1-t.y0)*s)}}}function YF(e,t,n){n>>=5;for(var i,r=e.sprite,a=e.width>>5,o=e.x-(a<<4),s=127&o,u=32-s,l=e.y1-e.y0,c=(e.y+e.y0)*n+(o>>5),f=0;f<l;f++){i=0;for(var d=0;d<=a;d++)if((i<<u|(d<a?(i=r[f*a+d])>>>s:0))&t[c+d])return!0;c+=n}return!1}function XF(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 JF(e){var t=e[0]/e[1];return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}function QF(e){return"function"==typeof e?e:function(){return e}}var KF={archimedean:JF,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 ZF=["x","y","font","fontSize","fontStyle","fontWeight","angle"],eC=["text","font","rotate","fontSize","fontStyle","fontWeight"];function tC(e){tu.call(this,GF(),e)}tC.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:ZF}]},_(tC,tu,{transform(e,t){!e.size||e.size[0]&&e.size[1]||v("Wordcloud size dimensions must be non-zero.");const n=e.modified();if(!(n||t.changed(t.ADD_REM)||eC.some((function(n){const i=e[n];return m(i)&&t.modified(i.fields)}))))return;const i=t.materialize(t.SOURCE).source,r=this.value,a=e.as||ZF;let o,s=e.fontSize||14;if(m(s)?o=e.fontSizeRange:s=g(s),o){const e=s,t=Nf("sqrt")().domain(M(i,e)).range(o);s=n=>t(e(n))}i.forEach((e=>{e[a[0]]=NaN,e[a[1]]=NaN,e[a[3]]=0}));const u=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(s).random(cu).layout(),l=r.size(),c=l[0]>>1,f=l[1]>>1,d=u.length;for(let h,p,m=0;m<d;++m)h=u[m],p=h.datum,p[a[0]]=h.x+c,p[a[1]]=h.y+f,p[a[2]]=h.font,p[a[3]]=h.size,p[a[4]]=h.style,p[a[5]]=h.weight,p[a[6]]=h.rotate;return t.reflow(n).modifies(a)}});const nC=Object.freeze(Object.defineProperty({__proto__:null,wordcloud:tC},Symbol.toStringTag,{value:"Module"})),iC=e=>new Uint8Array(e),rC=e=>new Uint16Array(e),aC=e=>new Uint32Array(e);function oC(e,t,n){const i=(t<257?iC:t<65537?rC:aC)(e);return n&&i.set(n),i}function sC(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),a=e.index,o=r[0],s=r[1],u=a.length;let l;for(l=0;l<o;++l)t[a[l]]|=i;for(l=s;l<u;++l)t[a[l]]|=i;return n}}}function uC(){let e=aC(0),t=[],n=0;return{insert:function(i,r,a){if(!r.length)return[];const o=n,s=r.length,u=aC(s);let l,c,f,d=Array(s);for(f=0;f<s;++f)d[f]=i(r[f]),u[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,u),o)l=t,c=e,t=Array(o+s),e=aC(o+s),function(e,t,n,i,r,a,o,s,u){let l,c=0,f=0;for(l=0;c<i&&f<o;++l)t[c]<r[f]?(s[l]=t[c],u[l]=n[c++]):(s[l]=r[f],u[l]=a[f++]+e);for(;c<i;++c,++l)s[l]=t[c],u[l]=n[c];for(;f<o;++f,++l)s[l]=r[f],u[l]=a[f]+e}(a,l,c,o,d,u,s,t,e);else{if(a>0)for(f=0;f<s;++f)u[f]+=a;t=d,e=u}return n=o+s,{index:u,value:d}},remove:function(i,r){const a=n;let o,s,u;for(s=0;!r[e[s]]&&s<a;++s);for(u=s;s<a;++s)r[o=e[s]]||(e[u]=o,t[u]=t[s],++u);n=a-i},bisect:function(e,i){let r;return i?r=i.length:(i=t,r=n),[Wt(i,e[0],0,r),qt(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 lC(e){tu.call(this,function(){let e=8,t=[],n=aC(0),i=oC(0,e),r=oC(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,a=e.length;i<a;++i)n=e[i],n._index=r++,t.push(n)},remove(e,n){const a=t.length,o=Array(a-e),s=t;let u,l,c;for(l=0;!n[l]&&l<a;++l)o[l]=t[l],s[l]=l;for(c=l;l<a;++l)u=t[l],n[l]?s[l]=-1:(s[l]=c,i[c]=i[l],r[c]=r[l],o[c]=u,u._index=c++),i[l]=0;return t=o,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=oC(t,e,i),r=oC(t,e))}}}(),e),this._indices=null,this._dims=null}function cC(e){tu.call(this,null,e)}lC.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}}]},_(lC,tu,{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={},a=this._dims=[],o=i.length;let s,u,l=0;for(;l<o;++l)s=n[l].fname,u=r[s]||(r[s]=uC()),a.push(sC(u,l,i[l]));return this.eval(e,t)},reinit(e,t){const n=t.materialize().fork(),i=e.fields,r=e.query,a=this._indices,o=this._dims,s=this.value,u=s.curr(),l=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,_,A;if(l.set(u),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)A=i[w],(!o[w]||e.modified("fields",w)||t.modified(A.fields))&&(y=A.fname,(m=p[y])||(a[y]=g=uC(),p[y]=m=g.insert(A,t.source,0)),o[w]=sC(g,w,r[w]).onAdd(m,u));for(w=0,_=s.data().length;w<_;++w)b[w]||(l[w]!==u[w]?f.push(w):x[w]&&u[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,a=this._dims,o=this._indices,s=e.fields,u={},l=n.add,c=r.size()+i.length,f=a.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=u[h]||(u[h]=o[h].insert(s[d],i,m)),a[d].onAdd(p,g);for(;m<c;++m)y[m]=v,g[m]!==v&&l.push(m)},modify(e,t){const n=t.mod,i=this.value,r=i.curr(),a=i.all(),o=e.mod;let s,u,l;for(s=0,u=o.length;s<u;++s)l=o[s]._index,r[l]!==a&&n.push(l)},remove(e,t,n){const i=this._indices,r=this.value,a=r.curr(),o=r.prev(),s=r.all(),u={},l=n.rem,c=t.rem;let f,d,h,p;for(f=0,d=c.length;f<d;++f)h=c[f]._index,u[h]=1,o[h]=p=a[h],a[h]=s,p!==s&&l.push(h);for(h in i)i[h].remove(d,u);return this.reindex(t,d,u),u},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,a=t.stamp,o=i.length;let s,u,l=0;for(n.filters=0,u=0;u<o;++u)e.modified("query",u)&&(s=u,++l);if(1===l)l=i[s].one,this.incrementOne(i[s],r[s],n.add,n.rem);else for(u=0,l=0;u<o;++u)e.modified("query",u)&&(l|=i[u].one,this.incrementAll(i[u],r[u],a,n.add),n.rem=n.add);return l},incrementAll(e,t,n,i){const r=this.value,a=r.seen(),o=r.curr(),s=r.prev(),u=e.index(),l=e.bisect(e.range),c=e.bisect(t),f=c[0],d=c[1],h=l[0],p=l[1],m=e.one;let g,y,v;if(f<h)for(g=f,y=Math.min(h,d);g<y;++g)v=u[g],a[v]!==n&&(s[v]=o[v],a[v]=n,i.push(v)),o[v]^=m;else if(f>h)for(g=h,y=Math.min(f,p);g<y;++g)v=u[g],a[v]!==n&&(s[v]=o[v],a[v]=n,i.push(v)),o[v]^=m;if(d>p)for(g=Math.max(f,p),y=d;g<y;++g)v=u[g],a[v]!==n&&(s[v]=o[v],a[v]=n,i.push(v)),o[v]^=m;else if(d<p)for(g=Math.max(h,d),y=p;g<y;++g)v=u[g],a[v]!==n&&(s[v]=o[v],a[v]=n,i.push(v)),o[v]^=m;e.range=t.slice()},incrementOne(e,t,n,i){const r=this.value.curr(),a=e.index(),o=e.bisect(e.range),s=e.bisect(t),u=s[0],l=s[1],c=o[0],f=o[1],d=e.one;let h,p,m;if(u<c)for(h=u,p=Math.min(c,l);h<p;++h)m=a[h],r[m]^=d,n.push(m);else if(u>c)for(h=c,p=Math.min(u,f);h<p;++h)m=a[h],r[m]^=d,i.push(m);if(l>f)for(h=Math.max(u,f),p=l;h<p;++h)m=a[h],r[m]^=d,n.push(m);else if(l<f)for(h=Math.max(c,l),p=f;h<p;++h)m=a[h],r[m]^=d,i.push(m);e.range=t.slice()}}),cC.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."}]},_(cC,tu,{transform(e,t){const n=~(e.ignore||0),i=e.filter,r=i.mask;if(!(r&n))return t.StopPropagation;const a=t.fork(t.ALL),o=i.data(),s=i.curr(),u=i.prev(),l=e=>s[e]&n?null:o[e];return a.filter(a.MOD,l),r&r-1?(a.filter(a.ADD,(e=>{const t=s[e]&n;return!t&&t^u[e]&n?o[e]:null})),a.filter(a.REM,(e=>{const t=s[e]&n;return t&&!(0^u[e]&n)?o[e]:null}))):(a.filter(a.ADD,l),a.filter(a.REM,(e=>(s[e]&n)===r?o[e]:null))),a.filter(a.SOURCE,(e=>l(e._index)))}});const fC=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:lC,resolvefilter:cC},Symbol.toStringTag,{value:"Module"})),dC="Literal",hC="Property",pC="ArrayExpression",mC="BinaryExpression",gC="CallExpression",yC="ConditionalExpression",vC="LogicalExpression",bC="MemberExpression",xC="ObjectExpression",wC="UnaryExpression";function _C(e){this.type=e}var AC,kC,DC,FC,CC;_C.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case pC:return e.elements;case mC:case vC:return[e.left,e.right];case gC:return[e.callee].concat(e.arguments);case yC:return[e.test,e.consequent,e.alternate];case bC:return[e.object,e.property];case xC:return e.properties;case hC:return[e.key,e.value];case wC:return[e.argument];default:return[]}}(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};(AC={})[1]="Boolean",AC[2]="<end>",AC[3]="Identifier",AC[4]="Keyword",AC[5]="Null",AC[6]="Numeric",AC[7]="Punctuator",AC[8]="String",AC[9]="RegularExpression";var EC="Identifier",$C="Unexpected token %0",SC="Invalid regular expression",MC="Invalid regular expression: missing /",BC="Octal literals are not allowed in strict mode.",zC="ILLEGAL",OC="Disabled.",NC=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]"),RC=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 TC(e,t){if(!e)throw new Error("ASSERT: "+t)}function PC(e){return e>=48&&e<=57}function jC(e){return"0123456789abcdefABCDEF".includes(e)}function LC(e){return"01234567".includes(e)}function qC(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 UC(e){return 10===e||13===e||8232===e||8233===e}function IC(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&NC.test(String.fromCharCode(e))}function WC(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&RC.test(String.fromCharCode(e))}const HC={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 GC(){for(;DC<FC;){const e=kC.charCodeAt(DC);if(!qC(e)&&!UC(e))break;++DC}}function VC(e){var t,n,i,r=0;for(n="u"===e?4:2,t=0;t<n;++t)DC<FC&&jC(kC[DC])?(i=kC[DC++],r=16*r+"0123456789abcdef".indexOf(i.toLowerCase())):lE({},$C,zC);return String.fromCharCode(r)}function YC(){var e,t,n,i;for(t=0,"}"===(e=kC[DC])&&lE({},$C,zC);DC<FC&&jC(e=kC[DC++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&lE({},$C,zC),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function XC(){var e,t;for(e=kC.charCodeAt(DC++),t=String.fromCharCode(e),92===e&&(117!==kC.charCodeAt(DC)&&lE({},$C,zC),++DC,(e=VC("u"))&&"\\"!==e&&IC(e.charCodeAt(0))||lE({},$C,zC),t=e);DC<FC&&WC(e=kC.charCodeAt(DC));)++DC,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==kC.charCodeAt(DC)&&lE({},$C,zC),++DC,(e=VC("u"))&&"\\"!==e&&WC(e.charCodeAt(0))||lE({},$C,zC),t+=e);return t}function JC(){var e,t;return e=DC,t=92===kC.charCodeAt(DC)?XC():function(){var e,t;for(e=DC++;DC<FC;){if(92===(t=kC.charCodeAt(DC)))return DC=e,XC();if(!WC(t))break;++DC}return kC.slice(e,DC)}(),{type:1===t.length?3:HC.hasOwnProperty(t)?4:"null"===t?5:"true"===t||"false"===t?1:3,value:t,start:e,end:DC}}function QC(){var e,t,n,i,r=DC,a=kC.charCodeAt(DC),o=kC[DC];switch(a){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++DC,{type:7,value:String.fromCharCode(a),start:r,end:DC};default:if(61===(e=kC.charCodeAt(DC+1)))switch(a){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return DC+=2,{type:7,value:String.fromCharCode(a)+String.fromCharCode(e),start:r,end:DC};case 33:case 61:return DC+=2,61===kC.charCodeAt(DC)&&++DC,{type:7,value:kC.slice(r,DC),start:r,end:DC}}}return">>>="===(i=kC.substr(DC,4))?{type:7,value:i,start:r,end:DC+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:r,end:DC+=3}:o===(t=n.substr(0,2))[1]&&"+-<>&|".includes(o)||"=>"===t?{type:7,value:t,start:r,end:DC+=2}:("//"===t&&lE({},$C,zC),"<>=!+-*%&|^/".includes(o)?{type:7,value:o,start:r,end:++DC}:void lE({},$C,zC))}function KC(){var e,t,n;if(TC(PC((n=kC[DC]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=DC,e="","."!==n){if(e=kC[DC++],n=kC[DC],"0"===e){if("x"===n||"X"===n)return++DC,function(e){let t="";for(;DC<FC&&jC(kC[DC]);)t+=kC[DC++];return 0===t.length&&lE({},$C,zC),IC(kC.charCodeAt(DC))&&lE({},$C,zC),{type:6,value:parseInt("0x"+t,16),start:e,end:DC}}(t);if(LC(n))return function(e){let t="0"+kC[DC++];for(;DC<FC&&LC(kC[DC]);)t+=kC[DC++];return(IC(kC.charCodeAt(DC))||PC(kC.charCodeAt(DC)))&&lE({},$C,zC),{type:6,value:parseInt(t,8),octal:!0,start:e,end:DC}}(t);n&&PC(n.charCodeAt(0))&&lE({},$C,zC)}for(;PC(kC.charCodeAt(DC));)e+=kC[DC++];n=kC[DC]}if("."===n){for(e+=kC[DC++];PC(kC.charCodeAt(DC));)e+=kC[DC++];n=kC[DC]}if("e"===n||"E"===n)if(e+=kC[DC++],"+"!==(n=kC[DC])&&"-"!==n||(e+=kC[DC++]),PC(kC.charCodeAt(DC)))for(;PC(kC.charCodeAt(DC));)e+=kC[DC++];else lE({},$C,zC);return IC(kC.charCodeAt(DC))&&lE({},$C,zC),{type:6,value:parseFloat(e),start:t,end:DC}}function ZC(){var e,t,n,i;return CC=null,GC(),e=DC,t=function(){var e,t,n,i;for(TC("/"===(e=kC[DC]),"Regular expression literal must start with a slash"),t=kC[DC++],n=!1,i=!1;DC<FC;)if(t+=e=kC[DC++],"\\"===e)UC((e=kC[DC++]).charCodeAt(0))&&lE({},MC),t+=e;else if(UC(e.charCodeAt(0)))lE({},MC);else if(n)"]"===e&&(n=!1);else{if("/"===e){i=!0;break}"["===e&&(n=!0)}return i||lE({},MC),{value:t.substr(1,t.length-2),literal:t}}(),n=function(){var e,t,n;for(t="",n="";DC<FC&&WC((e=kC[DC]).charCodeAt(0));)++DC,"\\"===e&&DC<FC?lE({},$C,zC):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&lE({},SC,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";lE({},SC)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(i){lE({},SC)}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:DC}}function eE(){if(GC(),DC>=FC)return{type:2,start:DC,end:DC};const e=kC.charCodeAt(DC);return IC(e)?JC():40===e||41===e||59===e?QC():39===e||34===e?function(){var e,t,n,i,r="",a=!1;for(TC("'"===(e=kC[DC])||'"'===e,"String literal must starts with a quote"),t=DC,++DC;DC<FC;){if((n=kC[DC++])===e){e="";break}if("\\"===n)if((n=kC[DC++])&&UC(n.charCodeAt(0)))"\r"===n&&"\n"===kC[DC]&&++DC;else switch(n){case"u":case"x":"{"===kC[DC]?(++DC,r+=YC()):r+=VC(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:LC(n)?(0!==(i="01234567".indexOf(n))&&(a=!0),DC<FC&&LC(kC[DC])&&(a=!0,i=8*i+"01234567".indexOf(kC[DC++]),"0123".includes(n)&&DC<FC&&LC(kC[DC])&&(i=8*i+"01234567".indexOf(kC[DC++]))),r+=String.fromCharCode(i)):r+=n}else{if(UC(n.charCodeAt(0)))break;r+=n}}return""!==e&&lE({},$C,zC),{type:8,value:r,octal:a,start:t,end:DC}}():46===e?PC(kC.charCodeAt(DC+1))?KC():QC():PC(e)?KC():QC()}function tE(){const e=CC;return DC=e.end,CC=eE(),DC=e.end,e}function nE(){const e=DC;CC=eE(),DC=e}function iE(e,t,n){const i=new _C("||"===e||"&&"===e?"LogicalExpression":"BinaryExpression");return i.operator=e,i.left=t,i.right=n,i}function rE(e,t){const n=new _C("CallExpression");return n.callee=e,n.arguments=t,n}function aE(e){const t=new _C(EC);return t.name=e,t}function oE(e){const t=new _C("Literal");return t.value=e.value,t.raw=kC.slice(e.start,e.end),e.regex&&("//"===t.raw&&(t.raw="/(?:)/"),t.regex=e.regex),t}function sE(e,t,n){const i=new _C("MemberExpression");return i.computed="["===e,i.object=t,i.property=n,i.computed||(n.member=!0),i}function uE(e,t,n){const i=new _C("Property");return i.key=t,i.value=n,i.kind=e,i}function lE(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,((e,t)=>(TC(t<i.length,"Message reference must be in range"),i[t])));throw(n=new Error(r)).index=DC,n.description=r,n}function cE(e){2===e.type&&lE(e,"Unexpected end of input"),6===e.type&&lE(e,"Unexpected number"),8===e.type&&lE(e,"Unexpected string"),3===e.type&&lE(e,"Unexpected identifier"),4===e.type&&lE(e,"Unexpected reserved word"),lE(e,$C,e.value)}function fE(e){const t=tE();7===t.type&&t.value===e||cE(t)}function dE(e){return 7===CC.type&&CC.value===e}function hE(e){return 4===CC.type&&CC.value===e}function pE(){const e=[];for(DC=CC.start,fE("[");!dE("]");)dE(",")?(tE(),e.push(null)):(e.push(FE()),dE("]")||fE(","));return tE(),function(e){const t=new _C("ArrayExpression");return t.elements=e,t}(e)}function mE(){DC=CC.start;const e=tE();return 8===e.type||6===e.type?(e.octal&&lE(e,BC),oE(e)):aE(e.value)}function gE(){var e,t,n;return DC=CC.start,3===(e=CC).type?(n=mE(),fE(":"),uE("init",n,FE())):2!==e.type&&7!==e.type?(t=mE(),fE(":"),uE("init",t,FE())):void cE(e)}function yE(){var e,t,n=[],i={},r=String;for(DC=CC.start,fE("{");!dE("}");)t="$"+((e=gE()).key.type===EC?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(i,t)?lE({},"Duplicate data property in object literal not allowed in strict mode"):i[t]=!0,n.push(e),dE("}")||fE(",");return fE("}"),function(e){const t=new _C("ObjectExpression");return t.properties=e,t}(n)}const vE={if:1};function bE(){var e,t,n;if(dE("("))return function(){fE("(");const e=CE();return fE(")"),e}();if(dE("["))return pE();if(dE("{"))return yE();if(e=CC.type,DC=CC.start,3===e||vE[CC.value])n=aE(tE().value);else if(8===e||6===e)CC.octal&&lE(CC,BC),n=oE(tE());else{if(4===e)throw new Error(OC);1===e?((t=tE()).value="true"===t.value,n=oE(t)):5===e?((t=tE()).value=null,n=oE(t)):dE("/")||dE("/=")?(n=oE(ZC()),nE()):cE(tE())}return n}function xE(){const e=[];if(fE("("),!dE(")"))for(;DC<FC&&(e.push(FE()),!dE(")"));)fE(",");return fE(")"),e}function wE(){return fE("."),function(){DC=CC.start;const e=tE();return function(e){return 3===e.type||4===e.type||1===e.type||5===e.type}(e)||cE(e),aE(e.value)}()}function _E(){fE("[");const e=CE();return fE("]"),e}function AE(){const e=function(){var e;for(e=bE();;)if(dE("."))e=sE(".",e,wE());else if(dE("("))e=rE(e,xE());else{if(!dE("["))break;e=sE("[",e,_E())}return e}();if(7===CC.type&&(dE("++")||dE("--")))throw new Error(OC);return e}function kE(){var e,t;if(7!==CC.type&&4!==CC.type)t=AE();else{if(dE("++")||dE("--"))throw new Error(OC);if(dE("+")||dE("-")||dE("~")||dE("!"))e=tE(),t=kE(),t=function(e,t){const n=new _C("UnaryExpression");return n.operator=e,n.argument=t,n.prefix=!0,n}(e.value,t);else{if(hE("delete")||hE("void")||hE("typeof"))throw new Error(OC);t=AE()}}return t}function DE(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 FE(){var e,t;return e=function(){var e,t,n,i,r,a,o,s,u,l;if(e=CC,u=kE(),0===(r=DE(i=CC)))return u;for(i.prec=r,tE(),t=[e,CC],a=[u,i,o=kE()];(r=DE(CC))>0;){for(;a.length>2&&r<=a[a.length-2].prec;)o=a.pop(),s=a.pop().value,u=a.pop(),t.pop(),n=iE(s,u,o),a.push(n);(i=tE()).prec=r,a.push(i),t.push(CC),n=kE(),a.push(n)}for(n=a[l=a.length-1],t.pop();l>1;)t.pop(),n=iE(a[l-1].value,a[l-2],n),l-=2;return n}(),dE("?")&&(tE(),t=FE(),fE(":"),e=function(e,t,n){const i=new _C("ConditionalExpression");return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,FE())),e}function CE(){const e=FE();if(dE(","))throw new Error(OC);return e}function EE(e){DC=0,FC=(kC=e).length,CC=null,nE();const t=CE();if(2!==CC.type)throw new Error("Unexpect token after expression.");return t}var $E={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 SE(e){function t(t,n,i){return r=>function(t,n,i,r){let a=e(n[0]);return i&&(a=i+"("+a+")",0===i.lastIndexOf("new ",0)&&(a="("+a+")")),a+"."+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&&v("Missing arguments to clamp function."),t.length>3&&v("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),btoa:"btoa",atob:"atob",regexp:r,test:t("test",r),if:function(t){t.length<3&&v("Missing arguments to if function."),t.length>3&&v("Too many arguments to if function.");const n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function ME(e){const n=(e=e||{}).allowed?se(e.allowed):{},r=e.forbidden?se(e.forbidden):{},a=e.constants||$E,o=(e.functions||SE)(h),s=e.globalvar,u=e.fieldvar,l=m(s)?s:e=>`${s}["${e}"]`;let c={},f={},d=0;function h(e){if(i(e))return e;const t=p[e.type];return null==t&&v("Unsupported type: "+e.type),t(e)}const p={Literal:e=>e.raw,Identifier:e=>{const i=e.name;return d>0?i:t(r,i)?v("Illegal identifier: "+i):t(a,i)?a[i]:t(n,i)?i:(c[i]=1,l(i))},MemberExpression:e=>{const t=!e.computed,n=h(e.object);t&&(d+=1);const i=h(e.property);return n===u&&(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&&v("Illegal callee type: "+e.callee.type);const n=e.callee.name,i=e.arguments,r=t(o,n)&&o[n];return r||v("Unrecognized function: "+n),m(r)?r(i):r+"("+i.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=o,g.constants=a,g}const BE=Symbol("vega_selection_getter");function zE(e){return e.getter&&e.getter[BE]||(e.getter=q(e.field),e.getter[BE]=!0),e.getter}const OE="intersect",NE="union",RE="or",TE="and",PE="_vgsid_",jE=q(PE),LE="index:unit";function qE(e,t){for(var n,i,r=t.fields,a=t.values,o=r.length,s=0;s<o;++s)if(n=zE(i=r[s])(e),ge(n)&&(n=S(n)),ge(a[s])&&(a[s]=S(a[s])),l(a[s])&&ge(a[s][0])&&(a[s]=a[s].map(S)),"E"===i.type){if(l(a[s])?!a[s].includes(n):n!==a[s])return!1}else if("R"===i.type){if(!ye(n,a[s]))return!1}else if("R-RE"===i.type){if(!ye(n,a[s],!0,!1))return!1}else if("R-E"===i.type){if(!ye(n,a[s],!1,!1))return!1}else if("R-LE"===i.type){if(!ye(n,a[s],!1,!0))return!1}else if("E-LT"===i.type){if(n>=a[s])return!1}else if("E-LTE"===i.type){if(n>a[s])return!1}else if("E-GT"===i.type){if(n<=a[s])return!1}else if("E-GTE"===i.type){if(n<a[s])return!1}else if("E-VALID"===i.type){if(null===n||isNaN(n))return!1}else if("E-ONE"===i.type&&-1===a[s].indexOf(n))return!1;return!0}const UE=L(jE),IE=UE.left,WE=UE.right;var HE={[`${PE}_union`]:function(...e){const t=new Vn;for(const n of e)for(const e of n)t.add(e);return t},[`${PE}_intersect`]:function(e,...t){e=new Vn(e),t=t.map(si);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.includes(t[n])||e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter((e=>t.includes(e))):t},R_union:function(e,t){var n=S(t[0]),i=S(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=S(t[0]),i=S(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 GE(e,n,i,r){n[0].type!==dC&&v("First argument to selection functions must be a string literal.");const a=n[0].value,o="unit",s="@"+o,u=":"+a;(n.length>=2&&T(n).value)!==OE||t(r,s)||(r[s]=i.getData(a).indataRef(i,o)),t(r,u)||(r[u]=i.getData(a).tuplesRef())}function VE(e){const t=this.context.data[e];return t?t.values.value:[]}const YE=e=>function(t,n){const i=this.context.dataflow.locale();return null===t?"null":i[e](n)(t)},XE=YE("format"),JE=YE("timeFormat"),QE=YE("utcFormat"),KE=YE("timeParse"),ZE=YE("utcParse"),e$=new Date(2e3,0,1);function t$(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(e$.setYear(2e3),e$.setMonth(e),e$.setDate(t),JE.call(this,e$,n)):""}function n$(e,n,i,r){n[0].type!==dC&&v("First argument to data functions must be a string literal.");const a=n[0].value,o=":"+a;if(!t(o,r))try{r[o]=i.getData(a).tuplesRef()}catch(s){}}function i$(e,t,n,i){if(t[0].type===dC)r$(n,i,t[0].value);else for(e in n.scales)r$(n,i,e)}function r$(e,n,i){const r="%"+i;if(!t(n,r))try{n[r]=e.scaleRef(i)}catch(a){}}function a$(e,t){if(i(e)){const n=t.scales[e];return n&&Of(n.value)?n.value:void 0}if(m(e))return Of(e)?e:void 0}function o$(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=i$,n._range=i$,n._scale=i$;const i=t=>"_["+(t.type===dC?a("%"+t.value):a("%")+"+"+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 s$(e,t){return function(n,i,r){if(n){const t=a$(n,(r||this).context);return t&&t.path[e](i)}return t(i)}}const u$=s$("area",(function(e){return Vb=new Kn,$b(e,Yb),2*Vb})),l$=s$("bounds",(function(e){var t,n,i,r,a,o,s;if(Pb=Tb=-(Nb=Rb=1/0),Wb=[],$b(e,_x),n=Wb.length){for(Wb.sort(Mx),t=1,a=[i=Wb[0]];t<n;++t)Bx(i,(r=Wb[t])[0])||Bx(i,r[1])?(Sx(i[0],r[1])>Sx(i[0],i[1])&&(i[1]=r[1]),Sx(r[0],i[1])>Sx(i[0],i[1])&&(i[0]=r[0])):a.push(i=r);for(o=-1/0,t=0,i=a[n=a.length-1];t<=n;i=r,++t)r=a[t],(s=Sx(i[1],r[0]))>o&&(o=s,Nb=r[0],Tb=i[1])}return Wb=Hb=null,Nb===1/0||Rb===1/0?[[NaN,NaN],[NaN,NaN]]:[[Nb,Rb],[Tb,Pb]]})),c$=s$("centroid",(function(e){ox=sx=ux=lx=cx=fx=dx=hx=0,px=new Kn,mx=new Kn,gx=new Kn,$b(e,zx);var t=+px,n=+mx,i=+gx,r=pb(t,n,i);return r<tb&&(t=fx,n=dx,i=hx,sx<eb&&(t=ux,n=lx,i=cx),(r=pb(t,n,i))<tb)?[NaN,NaN]:[cb(n,t)*ob,_b(i/r)*ob]}));function f$(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(i){e.warn(i)}return n[n.length-1]}function d$(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function h$(e){const t=Un(e);return.2126*d$(t.r)+.7152*d$(t.g)+.0722*d$(t.b)}function p$(e,t){return e===t||e!=e&&t!=t||(l(e)?!(!l(t)||e.length!==t.length)&&function(e,t){for(let n=0,i=e.length;n<i;++n)if(!p$(e[n],t[n]))return!1;return!0}(e,t):!(!o(e)||!o(t))&&m$(e,t))}function m$(e,t){for(const n in e)if(!p$(e[n],t[n]))return!1;return!0}function g$(e){return t=>m$(e,t)}const y$={};function v$(e){return l(e)||ArrayBuffer.isView(e)?e:null}function b$(e){return v$(e)||(i(e)?e:null)}const x$=e=>e.data;function w$(e,t){const n=VE.call(t,e);return n.root&&n.root.lookup||{}}const _$=()=>"undefined"!=typeof window&&window||null;function A$(e,t,n){if(!e)return[];const[i,r]=e,a=(new wh).set(i[0],i[1],r[0],r[1]);return ry(n||this.context.dataflow.scenegraph().root,a,function(e){let t=null;if(e){const n=c(e.marktype),i=c(e.markname);t=e=>(!n.length||n.some((t=>e.marktype===t)))&&(!i.length||i.some((t=>e.name===t)))}return t}(t))}const k$={random:()=>cu(),cumulativeNormal:vu,cumulativeLogNormal:ku,cumulativeUniform:Su,densityNormal:yu,densityLogNormal:Au,densityUniform:$u,quantileNormal:bu,quantileLogNormal:Du,quantileUniform:Mu,sampleNormal:gu,sampleLogNormal:_u,sampleUniform:Eu,isArray:l,isBoolean:u,isDate:ge,isDefined:e=>void 0!==e,isNumber:n,isObject:o,isRegExp:Le,isString:i,isTuple:ws,isValid:e=>null!=e&&e==e,toBoolean:je,toDate:e=>qe(e),toNumber:S,toString:Pe,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 b$(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 v$(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 b$(e).lastIndexOf(...n)},replace:function(e,t,n){return m(n)&&v("Function argument passed to replace."),i(t)||Le(t)||v("Please pass a string or RegExp argument to replace."),String(e).replace(t,n)},reverse:function(e){return v$(e).slice().reverse()},sort:function(e){return v$(e).slice().sort(B)},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 b$(e).slice(...n)},flush:Te,lerp:Re,merge:function(){const e=[].slice.call(arguments);return e.unshift({}),D(...e)},pad:Ne,peek:T,pluck:function(e,t){const n=y$[t]||(y$[t]=q(t));return l(e)?e.map(n):n(e)},span:I,inrange:ye,truncate:Oe,rgb:Un,lab:bt,hcl:Ct,hsl:en,luminance:h$,contrast:function(e,t){const n=h$(e),i=h$(t);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)},sequence:Ht,format:XE,utcFormat:QE,utcParse:ZE,utcOffset:ze,utcSequence:Be,timeFormat:JE,timeParse:KE,timeOffset:Me,timeSequence:Se,timeUnitSpecifier:$e,monthFormat:function(e){return t$.call(this,e,1,"%B")},monthAbbrevFormat:function(e){return t$.call(this,e,1,"%b")},dayFormat:function(e){return t$.call(this,0,2+e,"%A")},dayAbbrevFormat:function(e){return t$.call(this,0,2+e,"%a")},quarter:Ee,utcquarter:Ce,week:Fe,utcweek:De,dayofyear:ke,utcdayofyear:Ae,warn:function(){return f$(this.context.dataflow,"warn",arguments)},info:function(){return f$(this.context.dataflow,"info",arguments)},debug:function(){return f$(this.context.dataflow,"debug",arguments)},extent:e=>M(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:A$,clampRange:_e,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=_$();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=_$();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return af(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(x).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?Wd(n,t=t||zd(e)):e}},panLinear:we,panLog:xe,panPow:be,panSymlog:ve,zoomLinear:pe,zoomLog:fe,zoomPow:de,zoomSymlog:he,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,a){const o=this.context.dataflow,s=this.context.data[e],u=s.input,c=o.stamp();let f,d,h=s.changes;if(!1===o._trigger||!(u.value.length||t||i))return 0;if((!h||h.stamp<c)&&(s.changes=h=o.changeset(),h.stamp=c,o.runAfter((()=>{s.modified=!0,o.pulse(u,h).run()}),!0,1)),n&&(f=!0===n?x:l(n)||ws(n)?n:g$(n),h.remove(f)),t&&h.insert(t),i&&(f=g$(i),u.value.some(f)?h.remove(f):h.insert(i)),r)for(d in a)h.modify(r,d,a[d]);return 1},lassoAppend:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const r=(e=c(e))[e.length-1];return void 0===r||Math.hypot(r[0]-t,r[1]-n)>i?[...e,[t,n]]:e},lassoPath:function(e){return c(e).reduce(((t,n,i)=>{let[r,a]=n;return t+(0==i?`M ${r},${a} `:i===e.length-1?" Z":`L ${r},${a} `)}),"")},intersectLasso:function(e,t,n){const{x:i,y:r,mark:a}=n,o=(new wh).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[s,u]of t)s<o.x1&&(o.x1=s),s>o.x2&&(o.x2=s),u<o.y1&&(o.y1=u),u>o.y2&&(o.y2=u);return o.translate(i,r),A$([[o.x1,o.y1],[o.x2,o.y2]],e,a).filter((e=>function(e,t,n){let i=0;for(let r=0,a=n.length-1;r<n.length;a=r++){const[o,s]=n[a],[u,l]=n[r];l>t!=s>t&&e<(o-u)*(t-l)/(s-l)+u&&i++}return 1&i}(e.x,e.y,t)))}},D$=["view","item","group","xy","x","y"],F$="this.",C$={},E$={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${a("$"+e)}]`,functions:function(e){const t=SE(e);D$.forEach((e=>t[e]="event.vega."+e));for(const n in k$)t[n]=F$+n;return D(t,o$(e,k$,C$)),t},constants:$E,visitors:C$},$$=ME(E$);function S$(e,t,n){return 1===arguments.length?k$[e]:(k$[e]=t,n&&(C$[e]=n),$$&&($$.functions[e]=F$+e),this)}function M$(e,n){const r={};let o;try{o=EE(e=i(e)?e:a(e)+"")}catch(u){v("Expression parse error: "+e)}o.visit((e=>{if(e.type!==gC)return;const t=e.callee.name,i=E$.visitors[t];i&&i(t,e.arguments,n,r)}));const s=$$(o);return s.globals.forEach((e=>{const i="$"+e;!t(r,i)&&n.getSignal(e)&&(r[i]=n.signalRef(e))})),{$expr:D({code:s.code},n.options.ast?{ast:o}:null),$fields:s.fields,$params:r}}S$("bandwidth",(function(e,t){const n=a$(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}),i$),S$("copy",(function(e,t){const n=a$(e,(t||this).context);return n?n.copy():void 0}),i$),S$("domain",(function(e,t){const n=a$(e,(t||this).context);return n?n.domain():[]}),i$),S$("range",(function(e,t){const n=a$(e,(t||this).context);return n&&n.range?n.range():[]}),i$),S$("invert",(function(e,t,n){const i=a$(e,(n||this).context);return i?l(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0}),i$),S$("scale",(function(e,t,n){const i=a$(e,(n||this).context);return i?i(t):void 0}),i$),S$("gradient",(function(e,t,n,i,r){e=a$(e,(r||this).context);const a=Dd(t,n);let o=e.domain(),s=o[0],u=T(o),l=y;return u-s?l=Yf(e,s,u):e=(e.interpolator?Nf("sequential")().interpolator(e.interpolator()):Nf("linear")().interpolate(e.interpolate()).range(e.range())).domain([s=0,u=1]),e.ticks&&(o=e.ticks(+i||15),s!==o[0]&&o.unshift(s),u!==T(o)&&o.push(u)),o.forEach((t=>a.stop(l(t),e(t)))),a}),i$),S$("geoArea",u$,i$),S$("geoBounds",l$,i$),S$("geoCentroid",c$,i$),S$("geoShape",(function(e,t,n){const i=a$(e,(n||this).context);return function(e){return i?i.path.context(e)(t):""}}),i$),S$("geoScale",(function(e,t){const n=a$(e,(t||this).context);return n&&n.scale()}),i$),S$("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,n,i,r){n[0].type!==dC&&v("First argument to indata must be a string literal."),n[1].type!==dC&&v("Second argument to indata must be a string literal.");const a=n[0].value,o=n[1].value,s="@"+o;t(s,r)||(r[s]=i.getData(a).indataRef(i,o))})),S$("data",VE,n$),S$("treePath",(function(e,t,n){const i=w$(e,this),r=i[t],a=i[n];return r&&a?r.path(a).map(x$):void 0}),n$),S$("treeAncestors",(function(e,t){const n=w$(e,this)[t];return n?n.ancestors().map(x$):void 0}),n$),S$("vlSelectionTest",(function(e,t,n){for(var i,r,a,o,s,u=this.context.data[e],l=u?u.values.value:[],c=u?u[LE]&&u[LE].value:void 0,f=n===OE,d=l.length,h=0;h<d;++h)if(i=l[h],c&&f){if(-1===(a=(r=r||{})[o=i.unit]||0))continue;if(s=qE(t,i),r[o]=s?-1:++a,s&&1===c.size)return!0;if(!s&&a===c.get(o).count)return!1}else if(f^(s=qE(t,i)))return s;return d&&f}),GE),S$("vlSelectionIdTest",(function(e,t,n){const i=this.context.data[e],r=i?i.values.value:[],a=i?i[LE]&&i[LE].value:void 0,o=n===OE,s=jE(t),u=IE(r,s);if(u===r.length)return!1;if(jE(r[u])!==s)return!1;if(a&&o){if(1===a.size)return!0;if(WE(r,s)-u<a.size)return!1}return!0}),GE),S$("vlSelectionResolve",(function(e,t,n,i){for(var r,a,o,s,u,l,f,d,h,p,m,g,y=this.context.data[e],v=y?y.values.value:[],b={},x={},w={},_=v.length,A=0;A<_;++A)if(s=(r=v[A]).unit,a=r.fields,o=r.values,a&&o){for(m=0,g=a.length;m<g;++m)u=a[m],d=(f=b[u.field]||(b[u.field]={}))[s]||(f[s]=[]),w[u.field]=h=u.type.charAt(0),p=HE[`${h}_union`],f[s]=p(d,c(o[m]));n&&(d=x[s]||(x[s]=[])).push(c(o).reduce(((e,t,n)=>(e[a[n].field]=t,e)),{}))}else u=PE,l=jE(r),(d=(f=b[u]||(b[u]={}))[s]||(f[s]=[])).push(l),n&&(d=x[s]||(x[s]=[])).push({[PE]:l});if(t=t||NE,b[PE]?b[PE]=HE[`${PE}_${t}`](...Object.values(b[PE])):Object.keys(b).forEach((e=>{b[e]=Object.keys(b[e]).map((t=>b[e][t])).reduce(((n,i)=>void 0===n?i:HE[`${w[e]}_${t}`](n,i)))})),v=Object.keys(x),n&&v.length){b[i?"vlPoint":"vlMulti"]=t===NE?{[RE]:v.reduce(((e,t)=>(e.push(...x[t]),e)),[])}:{[TE]:v.map((e=>({[RE]:x[e]})))}}return b}),GE),S$("vlSelectionTuples",(function(e,t){return e.map((e=>D(t.fields?{values:t.fields.map((t=>zE(t)(e.datum)))}:{[PE]:jE(e.datum)},t)))}));const B$=se(["rule"]),z$=se(["group","image","rect"]);function O$(e){return(e+"").toLowerCase()}function N$(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}var R$={operator:(e,t)=>N$(e,["_"],t.code),parameter:(e,t)=>N$(e,["datum","_"],t.code),event:(e,t)=>N$(e,["event"],t.code),handler:(e,t)=>N$(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["+a(o)+"]";r+=`$=${i[o].code};if(${e}!==$)${e}=$,m=1;`}return r+=function(e,t){let n="";return B$[t]||(e.x2&&(e.x?(z$[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?(z$[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;",N$(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(a).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 a,o;return e.path?(a=`a${e.path}`,o=`b${e.path}`):((n=n||{})["f"+i]=e,a=`this.f${i}(a)`,o=`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} : `}(a,o,-r,r)})).join("")+"0;");return n?i.bind(n):i}}};function T$(e,n,i){if(!e||!o(e))return e;for(let r,a=0,o=P$.length;a<o;++a)if(r=P$[a],t(e,r.key))return r.parse(e,n,i);return e}var P$=[{key:"$ref",parse:function(e,t){return t.get(e.$ref)||v("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]=G(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]=$(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]=q(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]=$(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=c(e.$compare).map((e=>e&&e.$tupleid?_s:e));return t.fn[n]||(t.fn[n]=H(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 a=t.fork().parse(n),o=a.get(n.operators[0].id),s=a.signals.parent;return s&&s.set(r),o.detachSubflow=()=>t.detach(a),o}}},{key:"$tupleid",parse:function(){return _s}}];const j$={skip:!0};function L$(e,t,n,i){return new q$(e,t,n,i)}function q$(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||R$,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function U$(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 I$(e,t){e&&(null==t?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}q$.prototype=U$.prototype={fork(){const e=new U$(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"===O$(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 a in e.data){const i=n.data[a]||(n.data[a]={});e.data[a].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[O$(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"!==O$(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||v("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]=l(r)?r.map((e=>T$(e,n,t))):T$(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&&v("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),n.stream(e,r)},parseUpdate:function(e){var t,n=this,i=o(i=e.source)?i.$ref:i,r=n.get(i),a=e.update,s=void 0;r||v("Source not defined: "+e.source),t=e.target&&e.target.$expr?n.eventExpression(e.target.$expr):n.get(e.target),a&&a.$expr&&(a.$params&&(s=n.parseParameters(a.$params)),a=n.handlerExpression(a.$expr)),n.update(e,r,t,a,s)},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],j$)})),Object.keys(i||{}).forEach((e=>{n.pulse(t.data[e].input,n.changeset().remove(x).insert(i[e]))})),(e.subcontext||[]).forEach(((e,n)=>{const i=t.subcontext[n];i&&i.setState(e)}))}};const W$="default";function H$(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 G$(e,n){var i=e._runtime.data;return t(i,n)||v("Unrecognized data set: "+n),i[n]}function V$(e,t){$s(t)||v("Second argument to changes must be a changeset.");const n=G$(this,e);return n.modified=!0,this.pulse(n.input,t)}function Y$(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function X$(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function J$(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function Q$(e,t,n){var r,a,o=e._renderer,s=o&&o.canvas();return s&&(a=J$(e),(r=Mm(t.changedTouches?t.changedTouches[0]:t,s))[0]-=a[0],r[1]-=a[1]),t.dataflow=e,t.item=n,t.vega=function(e,t,n){const r=t?"group"===t.mark.marktype?t:t.mark.group:null;function a(e){var n,i=r;if(e)for(n=t;n;n=n.mark.group)if(n.mark.name===e){i=n;break}return i&&i.mark&&i.mark.interactive?i:{}}function o(e){if(!e)return n;i(e)&&(e=a(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:a,xy:o,x:e=>o(e)[0],y:e=>o(e)[1]}}(e,n,r),t}const K$="view",Z$={trap:!1};function eS(e,t,n,i){e._eventListeners.push({type:n,sources:c(t),handler:i})}function tS(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return!(!1===i||o(i)&&!i[n])||(e.warn(`Blocked ${t} ${n} event listener.`),!1)}function nS(e){return e.item}function iS(e){return e.item.mark.source}function rS(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function aS(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 oS(e,t,n,i){const r=n.event||"input",a=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,a),eS(i,t,r,a),e.set=e=>{t.value=e,t.dispatchEvent(function(e){return"undefined"!=typeof Event?new Event(e):{type:e}}(r))}}function sS(e,t,n,i){const r=i.signal(n.signal),a=aS("div",{class:"vega-bind"}),o="radio"===n.input?a:a.appendChild(aS("label"));o.appendChild(aS("span",{class:"vega-bind-name"},n.name||n.signal)),t.appendChild(a);let s=uS;switch(n.input){case"checkbox":s=lS;break;case"select":s=cS;break;case"radio":s=fS;break;case"range":s=dS}s(e,o,n,r)}function uS(e,t,n,i){const r=aS("input");for(const a in n)"signal"!==a&&"element"!==a&&r.setAttribute("input"===a?"type":a,n[a]);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 lS(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const a=aS("input",r);t.appendChild(a),a.addEventListener("change",(()=>e.update(a.checked))),e.elements=[a],e.set=e=>a.checked=!!e||null}function cS(e,t,n,i){const r=aS("select",{name:n.signal}),a=n.labels||[];n.options.forEach(((e,t)=>{const n={value:e};hS(e,i)&&(n.selected=!0),r.appendChild(aS("option",n,(a[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(hS(n.options[t],e))return void(r.selectedIndex=t)}}function fS(e,t,n,i){const r=aS("span",{class:"vega-bind-radio"}),a=n.labels||[];t.appendChild(r),e.elements=n.options.map(((t,o)=>{const s={type:"radio",name:n.signal,value:t};hS(t,i)&&(s.checked=!0);const u=aS("input",s);u.addEventListener("change",(()=>e.update(t)));const l=aS("label",{},(a[o]||t)+"");return l.prepend(u),r.appendChild(l),u})),e.set=t=>{const n=e.elements,i=n.length;for(let e=0;e<i;++e)hS(n[e].value,t)&&(n[e].checked=!0)}}function dS(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,a=n.min||Math.min(0,r,+i)||0,o=n.step||me(a,r,100),s=aS("input",{type:"range",name:n.signal,min:a,max:r,step:o});s.value=i;const u=aS("span",{},+i);t.appendChild(s),t.appendChild(u);const l=()=>{u.textContent=s.value,e.update(+s.value)};s.addEventListener("input",l),s.addEventListener("change",l),e.elements=[s],e.set=e=>{s.value=e,u.textContent=e}}function hS(e,t){return e===t||e+""==t+""}function pS(e,t,n,i,r,a){return(t=t||new i(e.loader())).initialize(n,Y$(e),X$(e),J$(e),r,a).background(e.background())}function mS(e,t){return t?function(){try{t.apply(this,arguments)}catch(n){e.error(n)}}:null}function gS(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 yS=e=>+e||0;function vS(e){return o(e)?{top:yS(e.top),bottom:yS(e.bottom),left:yS(e.left),right:yS(e.right)}:(e=>({top:e,bottom:e,left:e,right:e}))(yS(e))}async function bS(e,t,n,i){const r=iy(t),a=r&&r.headless;return a||v("Unrecognized renderer type: "+t),await e.runAsync(),pS(e,null,null,a,n,i).renderAsync(e._scenegraph.root)}var xS="width",wS="height",_S="padding",AS={skip:!0};function kS(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===_S?i.left+i.right:0)}function DS(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===_S?i.top+i.bottom:0)}function FS(e,t){return t.modified&&l(t.input.value)&&!e.startsWith("_:vega:_")}function CS(e,t){return!("parent"===e||t instanceof nu.proxy)}function ES(e,t,n,i){const r=e.element();r&&r.setAttribute("title",function(e){return null==e?"":l(e)?$S(e):o(e)&&!ge(e)?(t=e,Object.keys(t).map((e=>{const n=t[e];return e+": "+(l(n)?$S(n):SS(n))})).join("\n")):e+"";var t}(i))}function $S(e){return"["+e.map(SS).join(", ")+"]"}function SS(e){return l(e)?"[…]":o(e)&&!ge(e)?"{…}":e}function MS(e,t){const n=this;if(t=t||{},Zs.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=D({},e.locale,t.locale);n.locale(Ue(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||ty.Canvas,n._scenegraph=new km;const r=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||ES,n._redraw=!0,n._handler=(new tg).scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(e){const t=D({defaults:{}},e),n=(e,t)=>{t.forEach((t=>{l(e[t])&&(e[t]=se(e[t]))}))};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const a=function(e,t,n){return L$(e,nu,k$,n).parse(t)}(n,e,t.expr);n._runtime=a,n._signals=a.signals,n._bind=(e.bindings||[]).map((e=>({state:null,param:D({},e)}))),a.root&&a.root.set(r),r.source=a.data.root.input,n.pulse(a.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=kS(n,n._width),n._viewHeight=DS(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(e){var t=e._signals,n=t[xS],i=t[wS],r=t[_S];function a(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(t=>{e._width=t.size,e._viewWidth=kS(e,t.size),a()}),{size:n}),e._resizeHeight=e.add(null,(t=>{e._height=t.size,e._viewHeight=DS(e,t.size),a()}),{size:i});const o=e.add(null,a,{pad:r});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=i.rank+1,o.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:W$,item:null}));e.on(e.events("view","pointermove"),t,((e,n)=>{const r=t.value,a=r?i(r)?r:r.user:W$,o=n.item&&n.item.cursor||null;return r&&a===r.user&&o==r.item?r:{user:a,item:o}})),e.add(null,(function(t){let n=t.cursor,r=this.value;return i(n)||(r=n.item,n=n.user),H$(e,n&&n!==W$?n:r||n),r}),{cursor:t})}(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function BS(e,n){return t(e._signals,n)?e._signals[n]:v("Unrecognized signal name: "+a(n))}function zS(e,t){const n=(e._targets||[]).filter((e=>e._update&&e._update.handler===t));return n.length?n[0]:null}function OS(e,t,n,i){let r=zS(n,i);return r||(r=mS(e,(()=>i(t,n.value))),r.handler=i,e.on(n,null,r)),e}function NS(e,t,n){const i=zS(t,n);return i&&t._targets.remove(i),e}_(MS,Zs,{async evaluate(e,t,n){if(await Zs.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,r=J$(i=this),a=Y$(i),o=X$(i),i._renderer.background(i.background()),i._renderer.resize(a,o,r),i._handler.origin(r),i._resizeListeners.forEach((e=>{try{e(a,o)}catch(t){i.error(t)}}))),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(s){this.error(s)}var i,r,a,o;return n&&vs(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&&I$(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=BS(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",vS(e)):vS(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?(iy(e)||v("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&&(Zs.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(BS(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(e,t,n,i,r,a){this.runAfter((o=>{let s=0;o._autosize=0,o.width()!==n&&(s=1,o.signal(xS,n,AS),o._resizeWidth.skip(!0)),o.height()!==i&&(s=1,o.signal(wS,i,AS),o._resizeHeight.skip(!0)),o._viewWidth!==e&&(o._resize=1,o._viewWidth=e),o._viewHeight!==t&&(o._resize=1,o._viewHeight=t),o._origin[0]===r[0]&&o._origin[1]===r[1]||(o._resize=1,o._origin=r),s&&o.run("enter"),a&&o.runAfter((e=>e.resize()))}),!1,1)},addEventListener(e,t,n){let i=t;return n&&!1===n.trap||(i=mS(this,t),i.raw=t),this._handler.on(e,i),this},removeEventListener(e,t){for(var n,i,r=this._handler.handlers(e),a=r.length;--a>=0;)if(i=r[a].type,n=r[a].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 OS(this,e,BS(this,e),t)},removeSignalListener(e,t){return NS(this,BS(this,e),t)},addDataListener(e,t){return OS(this,e,G$(this,e).values,t)},removeDataListener(e,t){return NS(this,G$(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=H$(this,null);this._globalCursor=!!e,t&&H$(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 dn,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?hn():+n,i._restart((function a(o){o+=r,i._restart(a,r+=t,n),e(o)}),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,a=new Ps(n),o=function(n,i){r.runAsync(null,(()=>{e===K$&&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(),a.receive(Q$(r,n,i))}))};if("timer"===e)tS(r,"timer",t)&&r.timer(o,t);else if(e===K$)tS(r,"view",t)&&r.addEventListener(t,o,Z$);else if("window"===e?tS(r,"window",t)&&"undefined"!=typeof window&&(i=[window]):"undefined"!=typeof document&&tS(r,"selector",t)&&(i=Array.from(document.querySelectorAll(e))),i){for(var s=0,u=i.length;s<u;++s)i[s].addEventListener(t,o);eS(r,i,t,o)}else r.warn("Can not resolve event source: "+e);return a},finalize:function(){var e,t,n,i,r,a=this._tooltip,o=this._timers,s=this._handler.handlers(),u=this._eventListeners;for(e=o.length;--e>=0;)o[e].stop();for(e=u.length;--e>=0;)for(t=(n=u[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);for(a&&a.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",nS),iS,rS(e)),this.on(this.events("view","pointerout",nS),iS,rS(t)),this},data:function(e,t){return arguments.length<2?G$(this,e).values.value:V$.call(this,e,Ss().remove(x).insert(t))},change:V$,insert:function(e,t){return V$.call(this,e,Ss().insert(t))},remove:function(e,t){return V$.call(this,e,Ss().remove(t))},scale:function(e){var n=this._runtime.scales;return t(n,e)||v("Unrecognized scale or projection: "+e),n[e].value},initialize:function(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,a=iy(i);e=n._el=e?gS(n,e,!0):null,function(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),I$(t,e.description()))}(n),a||n.error("Unrecognized renderer type: "+i);const o=a.handler||tg,s=e?a.renderer:a.headless;return n._renderer=s?pS(n,n._renderer,e,s):null,n._handler=function(e,t,n,i){const r=new i(e.loader(),mS(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,J$(e),e);return t&&t.handlers().forEach((e=>{r.on(e.type,e.handler)})),r}(n,n._handler,e,o),n._redraw=!0,e&&"none"!==r&&(t=t?n._elBind=gS(n,t,!0):e.appendChild(aS("form",{class:"vega-bindings"})),n._bind.forEach((e=>{e.param.element&&"container"!==r&&(e.element=gS(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=F(i.debounce,r.update))),(null==i.input&&i.element?oS:sS)(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!==ty.Canvas&&e!==ty.SVG&&e!==ty.PNG&&v("Unrecognized image type: "+e);const n=await bS(this,e,t);return e===ty.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 bS(this,ty.Canvas,e,t)).canvas()},toSVG:async function(e){return(await bS(this,ty.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:FS,signals:CS,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 RS="[",TS="]",PS=/[[\]{}]/,jS={"*":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 LS,qS;function US(e,t,n){return LS=t||"view",qS=n||jS,WS(e.trim()).map(HS)}function IS(e,t,n,i,r){const a=e.length;let o,s=0;for(;t<a;++t){if(o=e[t],!s&&o===n)return t;r&&r.indexOf(o)>=0?--s:i&&i.indexOf(o)>=0&&++s}return t}function WS(e){const t=[],n=e.length;let i=0,r=0;for(;r<n;)r=IS(e,r,",","[{","]}"),t.push(e.substring(i,r).trim()),i=++r;if(0===t.length)throw"Empty event selector: "+e;return t}function HS(e){return"["===e[0]?function(e){const t=e.length;let n,i=1;if(i=IS(e,i,TS,RS,TS),i===t)throw"Empty between selector: "+e;if(n=WS(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(HS);const r=HS(e.slice(1).trim());if(r.between)return{between:n,stream:r};r.between=n;return r}(e):function(e){const t={source:LS},n=[];let i,r,a=[0,0],o=0,s=0,u=e.length,l=0;if("}"===e[u-1]){if(l=e.lastIndexOf("{"),!(l>=0))throw"Unmatched right brace: "+e;try{a=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(l+1,u-1))}catch(f){throw"Invalid throttle specification: "+e}u=(e=e.slice(0,l).trim()).length,l=0}if(!u)throw e;"@"===e[0]&&(o=++l);i=IS(e,l,":"),i<u&&(n.push(e.substring(s,i).trim()),s=l=++i);if(l=IS(e,l,RS),l===u)n.push(e.substring(s,u).trim());else if(n.push(e.substring(s,l).trim()),r=[],s=++l,s===u)throw"Unmatched left bracket: "+e;for(;l<u;){if(l=IS(e,l,TS),l===u)throw"Unmatched left bracket: "+e;if(r.push(e.substring(s,l).trim()),l<u-1&&e[++l]!==RS)throw"Expected left bracket: "+e;s=++l}if(!(u=n.length)||PS.test(n[u-1]))throw"Invalid event selector: "+e;u>1?(t.type=n[1],o?t.markname=n[0].slice(1):(c=n[0],qS[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);a[0]&&(t.throttle=a[0]);a[1]&&(t.debounce=a[1]);return t}(e)}function GS(e){return o(e)?e:{type:e||"pad"}}const VS=e=>+e||0;function YS(e){return o(e)?e.signal?e:{top:VS(e.top),bottom:VS(e.bottom),left:VS(e.left),right:VS(e.right)}:{top:t=VS(e),bottom:t,left:t,right:t};var t}const XS=e=>o(e)&&!l(e)?D({},e):{value:e};function JS(e,t,n,i){if(null!=n){return o(n)&&!l(n)||l(n)&&n.length&&o(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1}return 0}function QS(e,t,n){for(const i in t)JS(e,i,t[i]);for(const i in n)JS(e,i,n[i],"update")}function KS(e,n,i){for(const r in n)i&&t(i,r)||(e[r]=D(e[r]||{},n[r]));return e}function ZS(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const eM="mark",tM="frame",nM="scope",iM="legend-label",rM="title-text",aM="title-subtitle";function oM(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const sM=e=>i(e)?a(e):e.signal?`(${e.signal})`:fM(e);function uM(e){if(null!=e.gradient)return function(e){const t=[e.start,e.stop,e.count].map((e=>null==e?null:a(e)));for(;t.length&&null==T(t);)t.pop();return t.unshift(sM(e.gradient)),`gradient(${t.join(",")})`}(e);let t=e.signal?`(${e.signal})`:e.color?function(e){return e.c?lM("hcl",e.h,e.c,e.l):e.h||e.s?lM("hsl",e.h,e.s,e.l):e.l||e.a?lM("lab",e.l,e.a,e.b):e.r||e.g||e.b?lM("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?fM(e.field):void 0!==e.value?a(e.value):void 0;return null!=e.scale&&(t=function(e,t){const n=sM(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?"":"*"+cM(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},${cM(e.exponent)})`),null!=e.mult&&(t+=`*${cM(e.mult)}`),null!=e.offset&&(t+=`+${cM(e.offset)}`),e.round&&(t=`round(${t})`),t}const lM=(e,t,n,i)=>`(${e}(${[t,n,i].map(uM).join(",")})+'')`;function cM(e){return o(e)?"("+uM(e)+")":e}function fM(e){return dM(o(e)?e:{datum:e})}function dM(e){let t,n,o;if(e.signal)t="datum",o=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?(o=e.parent,t+=".datum"):o=e.group}else e.datum?(t="datum",o=e.datum):v("Invalid field reference: "+a(e));return e.signal||(o=i(o)?r(o).map(a).join("]["):dM(o)),t+"["+o+"]"}function hM(e,t,n,i,r,a){const o={};(a=a||{}).encoders={$encode:o},e=function(e,t,n,i,r){const a={},o={};let s,u,l,f;for(u in u="lineBreak","text"!==t||null==r[u]||ZS(u,e)||oM(a,u,r[u]),("legend"==n||String(n).startsWith("axis"))&&(n=null),f=n===tM?r.group:n===eM?D({},r.mark,r[t]):null,f)l=ZS(u,e)||("fill"===u||"stroke"===u)&&(ZS("fill",e)||ZS("stroke",e)),l||oM(a,u,f[u]);for(u in c(i).forEach((t=>{const n=r.style&&r.style[t];for(const i in n)ZS(i,e)||oM(a,i,n[i])})),e=D({},e),a)f=a[u],f.signal?(s=s||{})[u]=f:o[u]=f;return e.enter=D(o,e.enter),s&&(e.update=D(s,e.update)),e}(e,t,n,i,r.config);for(const s in e)o[s]=pM(e[s],t,a,r);return a}function pM(e,t,n,i){const r={},a={};for(const s in e)null!=e[s]&&(r[s]=mM((o=e[s],l(o)?function(e){let t="";return e.forEach((e=>{const n=uM(e);t+=e.test?`(${e.test})?${n}:`:n})),":"===T(t)&&(t+="null"),t}(o):uM(o)),i,n,a));var o;return{$expr:{marktype:t,channels:r},$fields:Object.keys(a),$output:Object.keys(e)}}function mM(e,t,n,i){const r=M$(e,t);return r.$fields.forEach((e=>i[e]=1)),D(n,r.$params),r.$expr}const gM=["value","update","init","react","bind"];function yM(e,t){v(e+' for "outer" push: '+a(t))}function vM(e,t){const n=e.name;if("outer"===e.push)t.signals[n]||yM("No prior signal definition",n),gM.forEach((t=>{void 0!==e[t]&&yM("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 bM(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function xM(e,t,n,i){return new bM(e,t,n,i)}function wM(e,t){return xM("operator",e,t)}function _M(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function AM(e,t){return t?{$field:e,$name:t}:{$field:e}}const kM=AM("key");function DM(e,t){return{$compare:e,$order:t}}function FM(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const CM="scope",EM="view";function $M(e){return e&&e.signal}function SM(e){if($M(e))return!0;if(o(e))for(const t in e)if(SM(e[t]))return!0;return!1}function MM(e,t){return null!=e?e:t}function BM(e){return e&&e.signal||e}const zM="timer";function OM(e,t){return(e.merge?NM:e.stream?RM:e.type?TM:v("Invalid stream specification: "+a(e)))(e,t)}function NM(e,t){const n=PM({merge:e.merge.map((e=>OM(e,t)))},e,t);return t.addStream(n).id}function RM(e,t){const n=PM({stream:OM(e.stream,t)},e,t);return t.addStream(n).id}function TM(e,t){let n;var i;e.type===zM?(n=t.event(zM,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===CM?EM:i||EM,e.type);const r=PM({stream:n},e,t);return 1===Object.keys(r).length?n:t.addStream(r).id}function PM(e,t,n){let i=t.between;return i&&(2!==i.length&&v('Stream "between" parameter must have 2 entries: '+a(t)),e.between=[OM(i[0],n),OM(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===CM&&i.push("inScope(event.item)"),i.length&&(e.filter=M$("("+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 jM={code:"_.$value",ast:{type:"Identifier",value:"value"}};function LM(e,t,n){const r=e.encode,o={target:n};let s=e.events,u=e.update,l=[];s||v("Signal update missing events specification."),i(s)&&(s=US(s,t.isSubscope()?CM:EM)),s=c(s).filter((e=>e.signal||e.scale?(l.push(e),0):1)),l.length>1&&(l=[qM(l)]),s.length&&l.push(s.length>1?{merge:s}:s[0]),null!=r&&(u&&v("Signal encode and update are mutually exclusive."),u="encode(item(),"+a(r)+")"),o.update=i(u)?M$(u,t):null!=u.expr?M$(u.expr,t):null!=u.value?u.value:null!=u.signal?{$expr:jM,$params:{$value:t.signalRef(u.signal)}}:v("Invalid signal update specification."),e.force&&(o.options={force:!0}),l.forEach((e=>t.addUpdate(D(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):OM(e,t)}}(e,t),o))))}function qM(e){return{signal:"["+e.map((e=>e.scale?'scale("'+e.scale+'")':e.signal))+"]"}}const UM=e=>(t,n,i)=>xM(e,n,t||void 0,i),IM=UM("aggregate"),WM=UM("axisticks"),HM=UM("bound"),GM=UM("collect"),VM=UM("compare"),YM=UM("datajoin"),XM=UM("encode"),JM=UM("expression"),QM=UM("facet"),KM=UM("field"),ZM=UM("key"),eB=UM("legendentries"),tB=UM("load"),nB=UM("mark"),iB=UM("multiextent"),rB=UM("multivalues"),aB=UM("overlap"),oB=UM("params"),sB=UM("prefacet"),uB=UM("projection"),lB=UM("proxy"),cB=UM("relay"),fB=UM("render"),dB=UM("scale"),hB=UM("sieve"),pB=UM("sortitems"),mB=UM("viewlayout"),gB=UM("values");let yB=0;const vB={min:"min",max:"max",count:"sum"};function bB(e,n){const i=n.getScale(e.name).params;let r;for(r in i.domain=AB(e.domain,e,n),null!=e.range&&(i.range=MB(e,n,i)),null!=e.interpolate&&function(e,t){t.interpolate=xB(e.type||e),null!=e.gamma&&(t.interpolateGamma=xB(e.gamma))}(e.interpolate,i),null!=e.nice&&(i.nice=function(e,t){return e.signal?t.signalRef(e.signal):o(e)?{interval:xB(e.interval),step:xB(e.step)}:xB(e)}(e.nice,n)),null!=e.bins&&(i.bins=function(e,t){return e.signal||l(e)?wB(e,t):t.objectProperty(e)}(e.bins,n)),e)t(i,r)||"name"===r||(i[r]=xB(e[r],n))}function xB(e,t){return o(e)?e.signal?t.signalRef(e.signal):v("Unsupported object: "+a(e)):e}function wB(e,t){return e.signal?t.signalRef(e.signal):e.map((e=>xB(e,t)))}function _B(e){v("Can not find data set: "+a(e))}function AB(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(l(e)?kB:e.fields?FB:DB)(e,t,n);null==t.domainMin&&null==t.domainMax||v("No scale domain defined for domainMin/domainMax to override.")}function kB(e,t,n){return e.map((e=>xB(e,n)))}function DB(e,t,n){const i=n.getData(e.data);return i||_B(e.data),jf(t.type)?i.valuesRef(n,e.field,EB(e.sort,!1)):If(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function FB(e,t,n){const r=e.data,o=e.fields.reduce(((e,t)=>(t=i(t)?{data:r,field:t}:l(t)||t.signal?function(e,t){const n="_:vega:_"+yB++,i=GM({});if(l(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+a(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,hB({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e)),[]);return(jf(t.type)?CB:If(t.type)?$B:SB)(e,n,o)}function CB(e,t,n){const i=EB(e.sort,!0);let r,a;const o=n.map((e=>{const n=t.getData(e.data);return n||_B(e.data),n.countsRef(t,e.field,i)})),s={groupby:kM,pulse:o};i&&(r=i.op||"count",a=i.field?FM(r,i.field):"count",s.ops=[vB[r]],s.fields=[t.fieldRef(a)],s.as=[a]),r=t.add(IM(s));const u=t.add(GM({pulse:_M(r)}));return a=t.add(gB({field:kM,sort:t.sortRef(i),pulse:_M(u)})),_M(a)}function EB(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!vB[e.op]&&v("Multiple domain scales can not be sorted using "+e.op):v("No field provided for sort aggregate op: "+e.op):o(e)?e.field="key":e={field:"key"}),e}function $B(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||_B(e.data),n.domainRef(t,e.field)}));return _M(t.add(rB({values:i})))}function SB(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||_B(e.data),n.extentRef(t,e.field)}));return _M(t.add(iB({extents:i})))}function MB(e,n,r){const o=n.config.range;let s=e.range;if(s.signal)return n.signalRef(s.signal);if(i(s)){if(o&&t(o,s))return MB(e=D({},e,{range:o[s]}),n,r);"width"===s?s=[0,{signal:"width"}]:"height"===s?s=jf(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:v("Unrecognized scale range value: "+a(s))}else{if(s.scheme)return r.scheme=l(s.scheme)?wB(s.scheme,n):xB(s.scheme,n),s.extent&&(r.schemeExtent=wB(s.extent,n)),void(s.count&&(r.schemeCount=xB(s.count,n)));if(s.step)return void(r.rangeStep=xB(s.step,n));if(jf(e.type)&&!l(s))return AB(s,e,n);l(s)||v("Unsupported range type: "+a(s))}return s.map((e=>(l(e)?wB:xB)(e,n)))}function BB(e,t,n){return l(e)?e.map((e=>BB(e,t,n))):o(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:v("Unsupported parameter object: "+a(e)):e}const zB="top",OB="left",NB="right",RB="bottom",TB="center",PB="index",jB="label",LB="perc",qB="value",UB="guide-label",IB="guide-title",WB="group-title",HB="group-subtitle",GB="symbol",VB="gradient",YB="discrete",XB="size",JB=[XB,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],QB={name:1,style:1,interactive:1},KB={value:0},ZB={value:1},ez="group",tz="rect",nz="rule",iz="text";function rz(e){return e.type=ez,e.interactive=e.interactive||!1,e}function az(e,t){const n=(n,i)=>MM(e[n],MM(t[n],i));return n.isVertical=n=>"vertical"===MM(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>MM(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>MM(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>MM(e.columns,MM(t.columns,+n.isVertical(!0))),n}function oz(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 sz(e,t,n){return`item.anchor === 'start' ? ${e} : item.anchor === 'end' ? ${t} : ${n}`}const uz=sz(a(OB),a(NB),a(TB));function lz(e,t){return t?e?o(e)?Object.assign({},e,{offset:lz(e.offset,t)}):{value:e,offset:t}:t:e}function cz(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=KS(e.encode,t,QB)):e.interactive=!1,e}function fz(e,t,n,i){const r=az(e,n),a=r.isVertical(),o=r.gradientThickness(),s=r.gradientLength();let u,l,c,f,d;a?(l=[0,1],c=[0,0],f=o,d=s):(l=[0,0],c=[1,0],f=s,d=o);const h={enter:u={opacity:KB,x:KB,y:KB,width:XS(f),height:XS(d)},update:D({},u,{opacity:ZB,fill:{gradient:t,start:l,stop:c}}),exit:{opacity:KB}};return QS(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),cz({type:tz,role:"legend-gradient",encode:h},i)}function dz(e,t,n,i,r){const a=az(e,n),o=a.isVertical(),s=a.gradientThickness(),u=a.gradientLength();let l,c,f,d,h="";o?(l="y",f="y2",c="x",d="width",h="1-"):(l="x",f="x2",c="y",d="height");const p={opacity:KB,fill:{scale:t,field:qB}};p[l]={signal:h+"datum."+LB,mult:u},p[c]=KB,p[f]={signal:h+"datum.perc2",mult:u},p[d]=XS(s);const m={enter:p,update:D({},p,{opacity:ZB}),exit:{opacity:KB}};return QS(m,{stroke:a("gradientStrokeColor"),strokeWidth:a("gradientStrokeWidth")},{opacity:a("gradientOpacity")}),cz({type:tz,role:"legend-band",key:qB,from:r,encode:m},i)}const hz=`datum.${LB}<=0?"${OB}":datum.${LB}>=1?"${NB}":"${TB}"`,pz=`datum.${LB}<=0?"${RB}":datum.${LB}>=1?"${zB}":"middle"`;function mz(e,t,n,i){const r=az(e,t),a=r.isVertical(),o=XS(r.gradientThickness()),s=r.gradientLength();let u,l,c,f,d=r("labelOverlap"),h="";const p={enter:u={opacity:KB},update:l={opacity:ZB,text:{field:jB}},exit:{opacity:KB}};return QS(p,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:MM(e.labelLimit,t.gradientLabelLimit)}),a?(u.align={value:"left"},u.baseline=l.baseline={signal:pz},c="y",f="x",h="1-"):(u.align=l.align={signal:hz},u.baseline={value:"top"},c="x",f="y"),u[c]=l[c]={signal:h+"datum."+LB,mult:s},u[f]=l[f]=o,o.offset=MM(e.labelOffset,t.gradientLabelOffset)||0,d=d?{separation:r("labelSeparation"),method:d,order:"datum."+PB}:void 0,cz({type:iz,role:iM,style:UB,key:qB,from:i,encode:p,overlap:d},n)}function gz(e,t,n,i,r){const a=az(e,t),o=n.entries,s=!(!o||!o.interactive),u=o?o.name:void 0,l=a("clipHeight"),c=a("symbolOffset"),f={data:"value"},d=`(${r}) ? datum.offset : datum.${XB}`,h=l?XS(l):{field:XB},p=`datum.${PB}`,m=`max(1, ${r})`;let g,y,v,b,x;h.mult=.5,g={enter:y={opacity:KB,x:{signal:d,mult:.5,offset:c},y:h},update:v={opacity:ZB,x:y.x,y:y.y},exit:{opacity:KB}};let w=null,_=null;e.fill||(w=t.symbolBaseFillColor,_=t.symbolBaseStrokeColor),QS(g,{fill:a("symbolFillColor",w),shape:a("symbolType"),size:a("symbolSize"),stroke:a("symbolStrokeColor",_),strokeDash:a("symbolDash"),strokeDashOffset:a("symbolDashOffset"),strokeWidth:a("symbolStrokeWidth")},{opacity:a("symbolOpacity")}),JB.forEach((t=>{e[t]&&(v[t]=y[t]={scale:e[t],field:qB})}));const A=cz({type:"symbol",role:"legend-symbol",key:qB,from:f,clip:!!l||void 0,encode:g},n.symbols),k=XS(c);k.offset=a("labelOffset"),g={enter:y={opacity:KB,x:{signal:d,offset:k},y:h},update:v={opacity:ZB,text:{field:jB},x:y.x,y:y.y},exit:{opacity:KB}},QS(g,{align:a("labelAlign"),baseline:a("labelBaseline"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontStyle:a("labelFontStyle"),fontWeight:a("labelFontWeight"),limit:a("labelLimit")});const D=cz({type:iz,role:iM,style:UB,key:qB,from:f,encode:g},n.labels);return g={enter:{noBound:{value:!l},width:KB,height:l?XS(l):KB,opacity:KB},exit:{opacity:KB},update:v={opacity:ZB,row:{signal:null},column:{signal:null}}},a.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}`,rz({role:nM,from:i={facet:{data:i,name:"value",groupby:PB}},encode:KS(g,o,QB),marks:[A,D],name:u,interactive:s,sort:x})}const yz='item.orient === "left"',vz='item.orient === "right"',bz=`(${yz} || ${vz})`,xz=`datum.vgrad && ${bz}`,wz=sz('"top"','"bottom"','"middle"'),_z=`datum.vgrad && ${vz} ? (${sz('"right"','"left"','"center"')}) : (${bz} && !(datum.vgrad && ${yz})) ? "left" : ${uz}`,Az=`item._anchor || (${bz} ? "middle" : "start")`,kz=`${xz} ? (${yz} ? -90 : 90) : 0`,Dz=`${bz} ? (datum.vgrad ? (${vz} ? "bottom" : "top") : ${wz}) : "top"`;function Fz(e,t){let n;return o(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+Cz(e.path)+")":e.sphere&&(n="geoShape("+Cz(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function Cz(e){return o(e)&&e.signal?e.signal:a(e)}function Ez(e){const t=e.role||"";return t.startsWith("axis")||t.startsWith("legend")||t.startsWith("title")?t:e.type===ez?nM:t||eM}function $z(e){return{marktype:e.type,name:e.name||void 0,role:e.role||Ez(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function Sz(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function Mz(e,t){const n=iu(e.type);n||v("Unrecognized transform type: "+a(e.type));const i=xM(n.type.toLowerCase(),null,Bz(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function Bz(e,t,n){const i={},r=e.params.length;for(let a=0;a<r;++a){const r=e.params[a];i[r.name]=zz(r,t,n)}return i}function zz(e,t,n){const r=e.type,o=t[e.name];return"index"===r?function(e,t,n){i(t.from)||v('Lookup "from" parameter must be a string literal.');return n.getData(t.from).lookupRef(n,t.key)}(0,t,n):void 0!==o?"param"===r?function(e,t,n){const i=t[e.name];return e.array?(l(i)||v("Expected an array of sub-parameters. Instead: "+a(i)),i.map((t=>Nz(e,t,n)))):Nz(e,i,n)}(e,t,n):"projection"===r?n.projectionRef(t[e.name]):e.array&&!$M(o)?o.map((t=>Oz(e,t,n))):Oz(e,o,n):void(e.required&&v("Missing required "+a(t.type)+" parameter: "+a(e.name)))}function Oz(e,t,n){const i=e.type;if($M(t))return jz(i)?v("Expression references can not be signals."):Lz(i)?n.fieldRef(t):qz(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||Lz(i);return r&&Rz(t)?n.exprRef(t.expr,t.as):r&&Tz(t)?AM(t.field,t.as):jz(i)?M$(t,n):Pz(i)?_M(n.getData(t).values):Lz(i)?AM(t):qz(i)?n.compareRef(t):t}}function Nz(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||v("Unsupported parameter: "+a(t));const o=D(Bz(r,t,n),r.key);return _M(n.add(oB(o)))}const Rz=e=>e&&e.expr,Tz=e=>e&&e.field,Pz=e=>"data"===e,jz=e=>"expr"===e,Lz=e=>"field"===e,qz=e=>"compare"===e;function Uz(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:_M(t.getData(e.data).output)}function Iz(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}function Wz(e){return i(e)?e:null}function Hz(e,t,n){const i=FM(n.op,n.field);let r;if(t.ops){for(let a=0,o=t.as.length;a<o;++a)if(t.as[a]===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 Gz(e,t,n,i,r,a,s){const u=t[n]||(t[n]={}),l=function(e){return o(e)?("descending"===e.order?"-":"+")+FM(e.op,e.field):""}(a);let c,f,d=Wz(r);if(null!=d&&(e=t.scope,d+=l?"|"+l:"",c=u[d]),!c){const n=a?{field:kM,pulse:t.countsRef(e,r,a)}:{field:e.fieldRef(r),pulse:_M(t.output)};l&&(n.sort=e.sortRef(a)),f=e.add(xM(i,void 0,n)),s&&(t.index[r]=f),c=_M(f),null!=d&&(u[d]=c)}return c}function Vz(e,t,n){const i=e.remove,r=e.insert,a=e.toggle,o=e.modify,s=e.values,u=t.add(wM()),l=M$("if("+e.trigger+',modify("'+n+'",'+[r,i,a,o,s].map((e=>null==e?"null":e)).join(",")+"),0)",t);u.update=l.$expr,u.params=l.$params}function Yz(e,t){const n=Ez(e),i=e.type===ez,r=e.from&&e.from.facet,o=e.overlap;let s,u,l,f,d,h,p,m=e.layout||n===nM||n===tM;const g=n===eM||m||r,y=function(e,t,n){let i,r,a,o,s;return e?(i=e.facet)&&(t||v("Only group marks can be faceted."),null!=i.field?o=s=Uz(i,n):(e.data?s=_M(n.getData(e.data).aggregate):(a=Mz(D({type:"aggregate",groupby:c(i.groupby)},i.aggregate),n),a.params.key=n.keyRef(i.groupby),a.params.pulse=Uz(i,n),o=s=_M(n.add(a))),r=n.keyRef(i.groupby,!0))):o=_M(n.add(GM(null,[{}]))),o||(o=Uz(e,n)),{key:r,pulse:o,parent:s}}(e.from,i,t);u=t.add(YM({key:y.key||(e.key?AM(e.key):void 0),pulse:y.pulse,clean:!i}));const b=_M(u);u=l=t.add(GM({pulse:b})),u=t.add(nB({markdef:$z(e),interactive:Sz(e.interactive,t),clip:Fz(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:_M(u)}));const x=_M(u);u=f=t.add(XM(hM(e.encode,e.type,n,e.style,t,{mod:!1,pulse:x}))),u.params.parent=t.encode(),e.transform&&e.transform.forEach((e=>{const n=Mz(e,t),i=n.metadata;(i.generates||i.changes)&&v("Mark transforms should not generate new data."),i.nomod||(f.params.mod=!0),n.params.pulse=_M(u),t.add(u=n)})),e.sort&&(u=t.add(pB({sort:t.compareRef(e.sort),pulse:_M(u)})));const w=_M(u);(r||m)&&(m=t.add(mB({layout:t.objectProperty(e.layout),legends:t.legends,mark:x,pulse:w})),h=_M(m));const _=t.add(HM({mark:x,pulse:h||w}));p=_M(_),i&&(g&&(s=t.operators,s.pop(),m&&s.pop()),t.pushState(w,h||p,b),r?function(e,t,n){const i=e.from.facet,r=i.name,o=Uz(i,t);let s;i.name||v("Facet must have a name: "+a(i)),i.data||v("Facet must reference a data set: "+a(i)),i.field?s=t.add(sB({field:t.fieldRef(i.field),pulse:o})):i.groupby?s=t.add(QM({key:t.keyRef(i.groupby),group:_M(t.proxy(n.parent)),pulse:o})):v("Facet must specify groupby or field: "+a(i));const u=t.fork(),l=u.add(GM()),c=u.add(hB({pulse:_M(l)}));u.addData(r,new Iz(u,l,l,c)),u.addSignal("parent",null),s.params.subflow={$subflow:u.parse(e).toRuntime()}}(e,t,y):g?function(e,t,n){const i=t.add(sB({pulse:n.pulse})),r=t.fork();r.add(hB()),r.addSignal("parent",null),i.params.subflow={$subflow:r.parse(e).toRuntime()}}(e,t,y):t.parse(e),t.popState(),g&&(m&&s.push(m),s.push(_))),o&&(p=function(e,t,n){const i=e.method,r=e.bound,a=e.separation,o={separation:$M(a)?n.signalRef(a.signal):a,method:$M(i)?n.signalRef(i.signal):i,pulse:t};e.order&&(o.sort=n.compareRef({field:e.order}));if(r){const e=r.tolerance;o.boundTolerance=$M(e)?n.signalRef(e.signal):+e,o.boundScale=n.scaleRef(r.scale),o.boundOrient=r.orient}return _M(n.add(aB(o)))}(o,p,t));const A=t.add(fB({pulse:p})),k=t.add(hB({pulse:_M(A)},void 0,t.parent()));null!=e.name&&(d=e.name,t.addData(d,new Iz(t,l,A,k)),e.on&&e.on.forEach((e=>{(e.insert||e.remove||e.toggle)&&v("Marks only support modify triggers."),Vz(e,t,d)})))}function Xz(e,t){const n=t.config.legend,i=e.encode||{},r=az(e,n),a=i.legend||{},o=a.name||void 0,s=a.interactive,u=a.style,l={};let c,f,d,h=0;JB.forEach((t=>e[t]?(l[t]=e[t],h=h||e[t]):0)),h||v("Missing valid scale for legend.");const p=function(e,t){let n=e.type||GB;e.type||1!==function(e){return JB.reduce(((t,n)=>t+(e[n]?1:0)),0)}(e)||!e.fill&&!e.stroke||(n=Pf(t)?VB:Lf(t)?YB:GB);return n!==VB?n:Lf(t)?YB:VB}(e,t.scaleType(h)),m={title:null!=e.title,scales:l,type:p,vgrad:"symbol"!==p&&r.isVertical()},g=_M(t.add(GM(null,[m]))),y=_M(t.add(eB(f={type:p,scale:t.scaleRef(h),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 p===VB?(d=[fz(e,h,n,i.gradient),mz(e,n,i.labels,y)],f.count=f.count||t.signalRef(`max(2,2*floor((${BM(r.gradientLength())})/100))`)):p===YB?d=[dz(e,h,n,i.gradient,y),mz(e,n,i.labels,y)]:(c=function(e,t){const n=az(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,n),d=[gz(e,n,i,y,BM(c.columns))],f.size=function(e,t,n){const i=BM(Qz("size",e,n)),r=BM(Qz("strokeWidth",e,n)),a=BM(function(e,t,n){return oz("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i[e]}("fontSize",t,n)}(n[1].encode,t,UB));return M$(`max(ceil(sqrt(${i})+${r}),${a})`,t)}(e,t,d[0].marks)),d=[rz({role:"legend-entry",from:g,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:c,interactive:s})],m.title&&d.push(function(e,t,n,i){const r=az(e,t),a={enter:{opacity:KB},update:{opacity:ZB,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:KB}};return QS(a,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:Az},angle:{signal:kz},align:{signal:_z},baseline:{signal:Dz},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")}),cz({type:iz,role:"legend-title",style:IB,from:i,encode:a},n)}(e,n,i.title,g)),Yz(rz({role:"legend",from:g,encode:KS(Jz(r,e,n),a,QB),marks:d,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:o,interactive:s,style:u}),t)}function Jz(e,t,n){const i={enter:{},update:{}};return QS(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 Qz(e,t,n){return t[e]?`scale("${t[e]}",datum)`:oz(e,n[0].encode)}Iz.fromEntries=function(e,t){const n=t.length,i=t[n-1],r=t[n-2];let a=t[0],o=null,s=1;for(a&&"load"===a.type&&(a=t[1]),e.add(t[0]);s<n;++s)t[s].params.pulse=_M(t[s-1]),e.add(t[s]),"aggregate"===t[s].type&&(o=t[s]);return new Iz(e,a,r,i,o)},Iz.prototype={countsRef(e,t,n){const i=this,r=i.counts||(i.counts={}),a=Wz(t);let o,s,u;return null!=a&&(e=i.scope,o=r[a]),o?n&&n.field&&Hz(e,o.agg.params,n):(u={groupby:e.fieldRef(t,"key"),pulse:_M(i.output)},n&&n.field&&Hz(e,u,n),s=e.add(IM(u)),o=e.add(GM({pulse:_M(s)})),o={agg:s,ref:_M(o)},null!=a&&(r[a]=o)),o.ref},tuplesRef(){return _M(this.values)},extentRef(e,t){return Gz(e,this,"extent","extent",t,!1)},domainRef(e,t){return Gz(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return Gz(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return Gz(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return Gz(e,this,"indata","tupleindex",t,!0,!0)}};const Kz=`item.orient==="${OB}"?-90:item.orient==="${NB}"?90:0`;function Zz(e,t){const n=az(e=i(e)?{text:e}:e,t.config.title),r=e.encode||{},a=r.group||{},o=a.name||void 0,s=a.interactive,u=a.style,l=[],c=_M(t.add(GM(null,[{}])));return l.push(function(e,t,n,i){const r={value:0},a=e.text,o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return QS(o,{text:a,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")}),cz({type:iz,role:rM,style:WB,from:i,encode:o},n)}(e,n,function(e){const t=e.encode;return t&&t.title||D({name:e.name,interactive:e.interactive,style:e.style},t)}(e),c)),e.subtitle&&l.push(function(e,t,n,i){const r={value:0},a=e.subtitle,o={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return QS(o,{text:a,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")}),cz({type:iz,role:aM,style:HB,from:i,encode:o},n)}(e,n,r.subtitle,c)),Yz(rz({role:"title",from:c,encode:eO(n,a),marks:l,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:o,interactive:s,style:u}),t)}function eO(e,t){const n={enter:{},update:{}};return QS(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:uz},angle:{signal:Kz},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),KS(n,t,QB)}function tO(e,t){const n=[];e.transform&&e.transform.forEach((e=>{n.push(Mz(e,t))})),e.on&&e.on.forEach((n=>{Vz(n,t,e.name)})),t.addDataPipeline(e.name,function(e,t,n){const i=[];let r,a,o,s,u,l=null,f=!1,d=!1;e.values?$M(e.values)||SM(e.format)?(i.push(iO(t,e)),i.push(l=nO())):i.push(l=nO({$ingest:e.values,$format:e.format})):e.url?SM(e.url)||SM(e.format)?(i.push(iO(t,e)),i.push(l=nO())):i.push(l=nO({$request:e.url,$format:e.format})):e.source&&(l=r=c(e.source).map((e=>_M(t.getData(e).output))),i.push(null));for(a=0,o=n.length;a<o;++a)s=n[a],u=s.metadata,l||u.source||i.push(l=nO()),i.push(s),u.generates&&(d=!0),u.modifies&&!d&&(f=!0),u.source?l=s:u.changes&&(l=null);r&&(o=r.length-1,i[0]=cB({derive:f,pulse:o?r:r[0]}),(f||o)&&i.splice(1,0,nO()));l||i.push(nO());return i.push(hB({})),i}(e,t,n))}function nO(e){const t=GM({},e);return t.metadata={source:!0},t}function iO(e,t){return tB({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 rO=e=>e===RB||e===zB,aO=(e,t,n)=>$M(e)?fO(e.signal,t,n):e===OB||e===zB?t:n,oO=(e,t,n)=>$M(e)?lO(e.signal,t,n):rO(e)?t:n,sO=(e,t,n)=>$M(e)?cO(e.signal,t,n):rO(e)?n:t,uO=(e,t,n)=>$M(e)?dO(e.signal,t,n):e===zB?{value:t}:{value:n},lO=(e,t,n)=>pO(`${e} === '${zB}' || ${e} === '${RB}'`,t,n),cO=(e,t,n)=>pO(`${e} !== '${zB}' && ${e} !== '${RB}'`,t,n),fO=(e,t,n)=>gO(`${e} === '${OB}' || ${e} === '${zB}'`,t,n),dO=(e,t,n)=>gO(`${e} === '${zB}'`,t,n),hO=(e,t,n)=>gO(`${e} === '${NB}'`,t,n),pO=(e,t,n)=>(t=null!=t?XS(t):t,n=null!=n?XS(n):n,mO(t)&&mO(n)?{signal:`${e} ? (${t=t?t.signal||a(t.value):null}) : (${n=n?n.signal||a(n.value):null})`}:[D({test:e},t)].concat(n||[])),mO=e=>null==e||1===Object.keys(e).length,gO=(e,t,n)=>({signal:`${e} ? (${yO(t)}) : (${yO(n)})`}),yO=e=>$M(e)?e.signal:null==e?null:a(e),vO=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function bO(e,n,i,r){let a;if(n&&t(n,e))return n[e];if(t(i,e))return i[e];if(e.startsWith("title")){switch(e){case"titleColor":a="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":a=e[5].toLowerCase()+e.slice(6)}return r[IB][a]}if(e.startsWith("label")){switch(e){case"labelColor":a="fill";break;case"labelFont":case"labelFontSize":a=e[5].toLowerCase()+e.slice(6)}return r[UB][a]}return null}function xO(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function wO(e,t){return{scale:e.scale,range:t}}function _O(e,t,n,i,r){const a=az(e,t),s=e.orient,u=e.gridScale,l=aO(s,1,-1),c=function(e,t){if(1===t);else if(o(e)){let n=e=D({},e);for(;null!=n.mult;){if(!o(n.mult))return n.mult=$M(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n=n.mult=D({},n.mult)}n.mult=t}else e=$M(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);return e}(e.offset,l);let f,d,h;const p={enter:f={opacity:KB},update:h={opacity:ZB},exit:d={opacity:KB}};QS(p,{stroke:a("gridColor"),strokeCap:a("gridCap"),strokeDash:a("gridDash"),strokeDashOffset:a("gridDashOffset"),strokeOpacity:a("gridOpacity"),strokeWidth:a("gridWidth")});const m={scale:e.scale,field:qB,band:r.band,extra:r.extra,offset:r.offset,round:a("tickRound")},g=oO(s,{signal:"height"},{signal:"width"}),y=u?{scale:u,range:0,mult:l,offset:c}:{value:0,offset:c},v=u?{scale:u,range:1,mult:l,offset:c}:D(g,{mult:l,offset:c});return f.x=h.x=oO(s,m,y),f.y=h.y=sO(s,m,y),f.x2=h.x2=sO(s,v),f.y2=h.y2=oO(s,v),d.x=oO(s,m),d.y=sO(s,m),cz({type:nz,role:"axis-grid",key:qB,from:i,encode:p},n)}function AO(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function kO(e,t,n,i,r,a){const o=az(e,t),s=e.orient,u=e.scale,l=aO(s,-1,1),c=BM(o("labelFlush")),f=BM(o("labelFlushOffset")),d=o("labelAlign"),h=o("labelBaseline");let p,m=0===c||!!c;const g=XS(r);g.mult=l,g.offset=XS(o("labelPadding")||0),g.offset.mult=l;const y={scale:u,field:qB,band:.5,offset:lz(a.offset,o("labelOffset"))},v=oO(s,m?AO(u,c,'"left"','"right"','"center"'):{value:"center"},((e,t,n)=>$M(e)?hO(e.signal,t,n):e===NB?{value:t}:{value:n})(s,"left","right")),b=oO(s,uO(s,"bottom","top"),m?AO(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=AO(u,c,`-(${f})`,f,0);m=m&&f;const w={opacity:KB,x:oO(s,y,g),y:sO(s,y,g)},_={enter:w,update:p={opacity:ZB,text:{field:jB},x:w.x,y:w.y,align:v,baseline:b},exit:{opacity:KB,x:w.x,y:w.y}};QS(_,{dx:!d&&m?oO(s,x):null,dy:!h&&m?sO(s,x):null}),QS(_,{angle:o("labelAngle"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontWeight:o("labelFontWeight"),fontStyle:o("labelFontStyle"),limit:o("labelLimit"),lineHeight:o("labelLineHeight")},{align:d,baseline:h});const A=o("labelBound");let k=o("labelOverlap");return k=k||A?{separation:o("labelSeparation"),method:k,order:"datum.index",bound:A?{scale:u,orient:s,tolerance:A}:null}:void 0,p.align!==v&&(p.align=vO(p.align,v)),p.baseline!==b&&(p.baseline=vO(p.baseline,b)),cz({type:iz,role:"axis-label",style:UB,key:qB,from:i,encode:_,overlap:k},n)}function DO(e,t,n,i){const r=az(e,t),a=e.orient,o=aO(a,-1,1);let s,u;const l={enter:s={opacity:KB,anchor:XS(r("titleAnchor",null)),align:{signal:uz}},update:u=D({},s,{opacity:ZB,text:XS(e.title)}),exit:{opacity:KB}},c={signal:`lerp(range("${e.scale}"), ${sz(0,1,.5)})`};return u.x=oO(a,c),u.y=sO(a,c),s.angle=oO(a,KB,((e,t)=>0===t?0:$M(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t})(o,90)),s.baseline=oO(a,uO(a,RB,zB),{value:RB}),u.angle=s.angle,u.baseline=s.baseline,QS(l,{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]=vO(XS(e),n.update[t]),!1):!ZS(t,i),a=r(e("titleX"),"x"),o=r(e("titleY"),"y");n.enter.auto=o===a?XS(o):oO(t,XS(o),XS(a))}(r,a,l,n),l.update.align=vO(l.update.align,s.align),l.update.angle=vO(l.update.angle,s.angle),l.update.baseline=vO(l.update.baseline,s.baseline),cz({type:iz,role:"axis-title",style:IB,from:i,encode:l},n)}function FO(e,t){const n=function(e,t){var n,i,r,a,o,s,u,l,c=t.config,f=c.style,d=c.axis,h="band"===t.scaleType(e.scale)&&c.axisBand,p=e.orient;if($M(p)){const e=xO([c.axisX,c.axisY]),t=xO([c.axisTop,c.axisBottom,c.axisLeft,c.axisRight]);for(r of(n={},e))n[r]=oO(p,bO(r,c.axisX,d,f),bO(r,c.axisY,d,f));for(r of(i={},t))i[r]=(a=p.signal,o=bO(r,c.axisTop,d,f),s=bO(r,c.axisBottom,d,f),u=bO(r,c.axisLeft,d,f),l=bO(r,c.axisRight,d,f),{signal:(null!=u?`${a} === '${OB}' ? (${yO(u)}) : `:"")+(null!=s?`${a} === '${RB}' ? (${yO(s)}) : `:"")+(null!=l?`${a} === '${NB}' ? (${yO(l)}) : `:"")+(null!=o?`${a} === '${zB}' ? (${yO(o)}) : `:"")+"(null)"})}else n=p===zB||p===RB?c.axisX:c.axisY,i=c["axis"+p[0].toUpperCase()+p.slice(1)];return n||i||h?D({},d,n,i,h):d}(e,t),i=e.encode||{},r=i.axis||{},a=r.name||void 0,s=r.interactive,u=r.style,l=az(e,n),c=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'`},o(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),f={scale:e.scale,ticks:!!l("ticks"),labels:!!l("labels"),grid:!!l("grid"),domain:!!l("domain"),title:null!=e.title},d=_M(t.add(GM({},[f]))),h=_M(t.add(WM({scale:t.scaleRef(e.scale),extra:t.property(c.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)}))),p=[];let m;return f.grid&&p.push(_O(e,n,i.grid,h,c)),f.ticks&&(m=l("tickSize"),p.push(function(e,t,n,i,r,a){const o=az(e,t),s=e.orient,u=aO(s,-1,1);let l,c,f;const d={enter:l={opacity:KB},update:f={opacity:ZB},exit:c={opacity:KB}};QS(d,{stroke:o("tickColor"),strokeCap:o("tickCap"),strokeDash:o("tickDash"),strokeDashOffset:o("tickDashOffset"),strokeOpacity:o("tickOpacity"),strokeWidth:o("tickWidth")});const h=XS(r);h.mult=u;const p={scale:e.scale,field:qB,band:a.band,extra:a.extra,offset:a.offset,round:o("tickRound")};return f.y=l.y=oO(s,KB,p),f.y2=l.y2=oO(s,h),c.x=oO(s,p),f.x=l.x=sO(s,KB,p),f.x2=l.x2=sO(s,h),c.y=sO(s,p),cz({type:nz,role:"axis-tick",key:qB,from:i,encode:d},n)}(e,n,i.ticks,h,m,c))),f.labels&&(m=f.ticks?m:0,p.push(kO(e,n,i.labels,h,m,c))),f.domain&&p.push(function(e,t,n,i){const r=az(e,t),a=e.orient;let o,s;const u={enter:o={opacity:KB},update:s={opacity:ZB},exit:{opacity:KB}};QS(u,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const l=wO(e,0),c=wO(e,1);return o.x=s.x=oO(a,l,KB),o.x2=s.x2=oO(a,c),o.y=s.y=sO(a,l,KB),o.y2=s.y2=sO(a,c),cz({type:nz,role:"axis-domain",from:i,encode:u},n)}(e,n,i.domain,d)),f.title&&p.push(DO(e,n,i.title,d)),Yz(rz({role:"axis",from:d,encode:KS(CO(l,e),r,QB),marks:p,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:a,interactive:s,style:u}),t)}function CO(e,t){const n={enter:{},update:{}};return QS(n,{orient:e("orient"),offset:e("offset")||0,position:MM(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 EO(e,t,n){const i=c(e.signals),r=c(e.scales);return n||i.forEach((e=>vM(e,t))),c(e.projections).forEach((e=>function(e,t){const n=t.config.projection||{},i={};for(const r in e)"name"!==r&&(i[r]=BB(e[r],r,t));for(const r in n)null==i[r]&&(i[r]=BB(n[r],r,t));t.addProjection(e.name,i)}(e,t))),r.forEach((e=>function(e,t){const n=e.type||"linear";Rf(n)||v("Unrecognized scale type: "+a(n)),t.addScale(e.name,{type:n,domain:void 0})}(e,t))),c(e.data).forEach((e=>tO(e,t))),r.forEach((e=>bB(e,t))),(n||i).forEach((e=>function(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?v("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=M$(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach((e=>LM(e,t,n.id)))}(e,t))),c(e.axes).forEach((e=>FO(e,t))),c(e.marks).forEach((e=>Yz(e,t))),c(e.legends).forEach((e=>Xz(e,t))),e.title&&Zz(e.title,t),t.parseLambdas(),t}function $O(e,n){const i=n.config,r=_M(n.root=n.add(wM())),a=function(e,n){const i=t=>MM(e[t],n[t]),r=[SO("background",i("background")),SO("autosize",GS(i("autosize"))),SO("padding",YS(i("padding"))),SO("width",i("width")||0),SO("height",i("height")||0)],a=r.reduce(((e,t)=>(e[t.name]=t,e)),{}),o={};return c(e.signals).forEach((e=>{t(a,e.name)?e=D(a[e.name],e):r.push(e),o[e.name]=e})),c(n.signals).forEach((e=>{t(o,e.name)||t(a,e.name)||r.push(e)})),r}(e,i);a.forEach((e=>vM(e,n))),n.description=e.description||i.description,n.eventConfig=i.events,n.legends=n.objectProperty(i.legend&&i.legend.layout),n.locale=i.locale;const o=n.add(GM()),s=n.add(XM(hM((e=>KS({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e))(e.encode),ez,tM,e.style,n,{pulse:_M(o)}))),u=n.add(mB({layout:n.objectProperty(e.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:r,pulse:_M(s)}));n.operators.pop(),n.pushState(_M(s),_M(u),null),EO(e,n,a),n.operators.push(u);let l=n.add(HM({mark:r,pulse:_M(u)}));return l=n.add(fB({pulse:_M(l)})),l=n.add(hB({pulse:_M(l)})),n.addData("root",new Iz(n,o,o,l)),n}function SO(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function MO(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 BO(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 zO(e){return(l(e)?OO:NO)(e)}function OO(e){const t=e.length;let n="[";for(let i=0;i<t;++i){const t=e[i];n+=(i>0?",":"")+(o(t)?t.signal||zO(t):a(t))}return n+"]"}function NO(e){let t,n,i="{",r=0;for(t in e)n=e[t],i+=(++r>1?",":"")+a(t)+":"+(o(n)?n.signal||zO(n):a(n));return i+"}"}MO.prototype=BO.prototype={parse(e){return EO(e,this)},fork(){return new BO(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 bM?_M(e):e;return this.add(lB({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(_M(this.add(hB({pulse:e})))),this._parent.push(t),this._lookup.push(n?_M(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return T(this._parent)},encode(){return T(this._encode)},lookup(){return T(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(i(e))return AM(e,t);e.signal||v("Unsupported field reference: "+a(e));const n=e.signal;let r=this.field[n];if(!r){const e={name:this.signalRef(n)};t&&(e.as=t),this.field[n]=r=_M(this.add(KM(e)))}return r},compareRef(e){let t=!1;const n=e=>$M(e)?(t=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(t=!0,this.exprRef(e.expr)):e,i=c(e.field).map(n),r=c(e.order).map(n);return t?_M(this.add(VM({fields:i,orders:r}))):DM(i,r)},keyRef(e,t){let n=!1;const i=this.signals;return e=c(e).map((e=>$M(e)?(n=!0,_M(i[e.signal])):e)),n?_M(this.add(ZM({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=FM(e.op,e.field),n=e.order||"ascending";return n.signal?_M(this.add(VM({fields:t,orders:this.signalRef(n.signal)}))):DM(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 t(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&v("Duplicate signal name: "+a(e));const n=t instanceof bM?t:this.add(wM(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||v("Unrecognized signal name: "+a(e)),this.signals[e]},signalRef(e){return this.signals[e]?_M(this.signals[e]):(t(this.lambdas,e)||(this.lambdas[e]=this.add(wM(null))),_M(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=M$(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&&o(e)?this.signalRef(e.signal||zO(e)):e},exprRef(e,t){const n={expr:M$(e,this)};return t&&(n.expr.$name=t),_M(this.add(JM(n)))},addBinding(e,t){this.bindings||v("Nested signals do not support binding: "+a(e)),this.bindings.push(D({signal:e},t))},addScaleProj(e,n){t(this.scales,e)&&v("Duplicate scale or projection name: "+a(e)),this.scales[e]=this.add(n)},addScale(e,t){this.addScaleProj(e,dB(t))},addProjection(e,t){this.addScaleProj(e,uB(t))},getScale(e){return this.scales[e]||v("Unrecognized scale name: "+a(e)),this.scales[e]},scaleRef(e){return _M(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,n){return t(this.data,e)&&v("Duplicate data set name: "+a(e)),this.data[e]=n},getData(e){return this.data[e]||v("Undefined data set name: "+a(e)),this.data[e]},addDataPipeline(e,n){return t(this.data,e)&&v("Duplicate data set name: "+a(e)),this.addData(e,Iz.fromEntries(this,n))}};D(nu,Ac,_v,Zv,WA,xk,aF,TD,cF,IF,nC,fC);const RO=Object.freeze(Object.defineProperty({__proto__:null,Bounds:wh,CanvasHandler:tg,CanvasRenderer:ug,DATE:We,DAY:He,DAYOFYEAR:Ge,Dataflow:Zs,Debug:Ve,Error:d,EventStream:Ps,Gradient:Dd,GroupItem:Ah,HOURS:Ye,Handler:Bm,HybridHandler:Qg,HybridRenderer:Jg,Info:Xe,Item:_h,MILLISECONDS:Je,MINUTES:Qe,MONTH:Ke,Marks:gm,MultiPulse:Ys,None:Ze,Operator:Ns,Parameters:Bs,Pulse:Ws,QUARTER:et,RenderType:ty,Renderer:Om,ResourceLoader:kh,SECONDS:tt,SVGHandler:cg,SVGRenderer:Ng,SVGStringRenderer:Yg,Scenegraph:km,TIME_UNITS:X,Transform:tu,View:MS,WEEK:nt,Warn:it,YEAR:rt,accessor:$,accessorFields:E,accessorName:C,array:c,ascending:B,bandwidthNRD:uu,bin:lu,bootstrapCI:fu,boundClip:ly,boundContext:Hh,boundItem:ym,boundMark:bm,boundStroke:Ch,changeset:Ss,clampRange:_e,codegenExpression:ME,compare:H,constant:g,cumulativeLogNormal:ku,cumulativeNormal:vu,cumulativeUniform:Su,dayofyear:ke,debounce:F,defaultLocale:h,definition:iu,densityLogNormal:Au,densityNormal:yu,densityUniform:$u,domChild:Em,domClear:$m,domCreate:Fm,domFind:Cm,dotbin:du,error:v,expressionFunction:S$,extend:D,extent:M,extentIndex:Y,falsy:le,fastmap:W,field:q,flush:Te,font:lm,fontFamily:um,fontSize:im,format:at,formatLocale:ot,formats:st,hasOwnProperty:t,id:b,identity:y,inferType:ut,inferTypes:lt,ingest:ks,inherits:_,inrange:ye,interpolate:Xf,interpolateColors:Gf,interpolateRange:Hf,intersect:ry,intersectBoxLine:np,intersectPath:Kh,intersectPoint:Zh,intersectRule:tp,isArray:l,isBoolean:u,isDate:ge,isFunction:m,isIterable:ct,isNumber:n,isObject:o,isRegExp:Le,isString:i,isTuple:ws,key:G,lerp:Re,lineHeight:rm,loader:p,locale:Ue,logger:f,lruCache:ue,markup:Cg,merge:U,mergeConfig:Ie,multiLineOffset:om,one:ce,pad:Ne,panLinear:we,panLog:xe,panPow:be,panSymlog:ve,parse:function(e,t,n){return o(e)||v("Input Vega specification must be an object."),$O(e,new MO(t=Ie(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:EE,parseSelector:US,path:qn,pathCurves:Cd,pathEqual:fy,pathParse:zd,pathRectangle:ih,pathRender:Wd,pathSymbols:Yd,pathTrail:rh,peek:T,point:Mm,projection:dA,quantileLogNormal:Du,quantileNormal:bu,quantileUniform:Mu,quantiles:ou,quantizeInterpolator:Vf,quarter:Ee,quartiles:su,get random(){return cu},randomInteger:function(e,t){let n,i,r;null==t&&(t=e,e=0);const a={min(e){return arguments.length?(n=e||0,r=i-n,a):n},max(e){return arguments.length?(i=e||0,r=i-n,a):i},sample:()=>n+Math.floor(r*cu()),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 a.min(e).max(t)},randomKDE:wu,randomLCG:function(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}},randomLogNormal:Fu,randomMixture:Cu,randomNormal:xu,randomUniform:Bu,read:k,regressionConstant:zu,regressionExp:Lu,regressionLinear:Pu,regressionLoess:Hu,regressionLog:ju,regressionPoly:Iu,regressionPow:qu,regressionQuad:Uu,renderModule:iy,repeat:ft,resetDefaultLocale:dt,resetSVGClipId:bh,resetSVGDefIds:function(){bh(),xd=0},responseType:A,runtimeContext:L$,sampleCurve:Xu,sampleLogNormal:_u,sampleNormal:gu,sampleUniform:Eu,scale:Nf,sceneEqual:cy,sceneFromJSON:_m,scenePickVisit:hp,sceneToJSON:wm,sceneVisit:dp,sceneZOrder:fp,scheme:Zf,serializeXML:Eg,setHybridRendererOptions:function(e){Xg.svgMarkTypes=e.svgMarkTypes??["text"],Xg.svgOnTop=e.svgOnTop??!0,Xg.debug=e.debug??!1},setRandom:function(e){cu=e},span:I,splitAccessPath:r,stringValue:a,textMetrics:Qp,timeBin:z,timeFloor:R,timeFormatLocale:ht,timeInterval:j,timeOffset:Me,timeSequence:Se,timeUnitSpecifier:$e,timeUnits:O,toBoolean:je,toDate:qe,toNumber:S,toSet:se,toString:Pe,transform:ru,transforms:nu,truncate:Oe,truthy:x,tupleid:_s,typeParsers:pt,utcFloor:N,utcInterval:P,utcOffset:ze,utcSequence:Be,utcdayofyear:Ae,utcquarter:Ce,utcweek:De,version:"5.33.0",visitArray:w,week:Fe,writeConfig:s,zero:V,zoomLinear:pe,zoomLog:fe,zoomPow:de,zoomSymlog:he},Symbol.toStringTag,{value:"Module"}));function TO(e){return`Invalid specification ${Ar(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const PO='Autosize "fit" only works for single views and layered views.';function jO(e){return`${"width"==e?"Width":"Height"} "container" only works for single views and layered views.`}function LO(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function qO(e){return e?`Dropping "fit-${e}" because spec has discrete ${Oa(e)}.`:'Dropping "fit" because spec has discrete size.'}function UO(e){return`Unknown field for ${e}. Cannot calculate view size.`}function IO(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function WO(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function HO(e){return`Selection not supported for ${e} yet.`}const GO="The same selection must be used to override scale domains in a layered view.";function VO(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const YO="Animation involving facet, layer, or concat is currently unsupported.";function XO(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function JO(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function QO(e){return`${e}Offset dropped because ${e} is continuous`}function KO(e){return`Invalid field type "${e}".`}function ZO(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 eN(e,t){return`Dropping ${Ar(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function tN(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function nN(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function iN(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function rN(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function aN(e){return`Using unaggregated domain with raw field has no effect (${Ar(e)}).`}function oN(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function sN(e){return`Unaggregated domain is currently unsupported for log scale (${Ar(e)}).`}function uN(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function lN(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const cN="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function fN(e,t){return`Invalid ${e}: ${Ar(t)}.`}function dN(e){return`1D error band does not support ${e}.`}function hN(e){return`Channel ${e} is required for "binned" bin.`}const pN=f(it);let mN=pN;function gN(...e){mN.error(...e)}function yN(...e){mN.warn(...e)}function vN(e){if(e&&o(e))for(const t of FN)if(kr(e,t))return!0;return!1}const bN=["january","february","march","april","may","june","july","august","september","october","november","december"],xN=bN.map((e=>e.substr(0,3))),wN=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],_N=wN.map((e=>e.substr(0,3)));function AN(e,t){const i=[];if(t&&void 0!==e.day&&Qi(e).length>1&&(yN(function(e){return`Dropping day from datetime ${Ar(e)} as day cannot be combined with other units.`}(e)),delete(e=zi(e)).day),void 0!==e.year?i.push(e.year):i.push(2012),void 0!==e.month){const r=t?function(e){if(xr(e)&&(e=+e),n(e))return e-1;{const t=e.toLowerCase(),n=bN.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=xN.indexOf(i);if(-1!==r)return r;throw new Error(fN("month",e))}}(e.month):e.month;i.push(r)}else if(void 0!==e.quarter){const r=t?function(e){if(xr(e)&&(e=+e),n(e))return e>4&&yN(fN("quarter",e)),e-1;throw new Error(fN("quarter",e))}(e.quarter):e.quarter;i.push(n(r)?3*r:`${r}*3`)}else i.push(0);if(void 0!==e.date)i.push(e.date);else if(void 0!==e.day){const r=t?function(e){if(xr(e)&&(e=+e),n(e))return e%7;{const t=e.toLowerCase(),n=wN.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=_N.indexOf(i);if(-1!==r)return r;throw new Error(fN("day",e))}}(e.day):e.day;i.push(n(r)?r+1:`${r}+1`)}else i.push(1);for(const n of["hours","minutes","seconds","milliseconds"]){const t=e[n];i.push(void 0===t?0:t)}return i}function kN(e){const t=AN(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const DN={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},FN=Qi(DN);function CN(e){return o(e)?e.binned:EN(e)}function EN(e){return e&&e.startsWith("binned")}function $N(e){return e.startsWith("utc")}const SN={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function MN(e){return FN.filter((t=>zN(e,t)))}function BN(e){const t=MN(e);return t[t.length-1]}function zN(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 ON(e,t,{end:n}={end:!1}){const i=ar(t),r=$N(e)?"utc":"";let a;const o={};for(const u of FN)zN(e,u)&&(o[u]="quarter"===(s=u)?`(${r}quarter(${i})-1)`:`${r}${s}(${i})`,a=u);var s;return n&&(o[a]+="+1"),function(e){const t=AN(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(o)}function NN(e){if(!e)return;return`timeUnitSpecifier(${Ar(MN(e))}, ${Ar(SN)})`}function RN(e){if(!e)return;let t;return i(e)?t=EN(e)?{unit:e.substring(6),binned:!0}:{unit:e}:o(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),$N(t.unit)&&(t.utc=!0,t.unit=t.unit.substring(3)),t}function TN(e,t=e=>e){const n=RN(e),i=BN(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:a}=jN(i,n.step);return`${t(kN({...e,[a]:+e[a]+r}))} - ${t(kN(e))}`}}const PN={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function jN(e,n=1){if(function(e){return t(PN,e)}(e))return{part:e,step:n};switch(e){case"day":case"dayofyear":return{part:"date",step:n};case"quarter":return{part:"month",step:3*n};case"week":return{part:"date",step:7*n}}}function LN(e){return!!(null==e?void 0:e.field)&&void 0!==e.equal}function qN(e){return!!(null==e?void 0:e.field)&&void 0!==e.lt}function UN(e){return!!(null==e?void 0:e.field)&&void 0!==e.lte}function IN(e){return!!(null==e?void 0:e.field)&&void 0!==e.gt}function WN(e){return!!(null==e?void 0:e.field)&&void 0!==e.gte}function HN(e){if(null==e?void 0:e.field){if(l(e.range)&&2===e.range.length)return!0;if(Xo(e.range))return!0}return!1}function GN(e){return!!(null==e?void 0:e.field)&&(l(e.oneOf)||l(e.in))}function VN(e){return GN(e)||LN(e)||HN(e)||qN(e)||IN(e)||UN(e)||WN(e)}function YN(e,t){return CP(e,{timeUnit:t,wrapTime:!0})}function XN(e,t=!0){const{field:n}=e,i=RN(e.timeUnit),{unit:r,binned:a}=i||{},o=cP(e,{expr:"datum"}),s=r?`time(${a?o:ON(r,n)})`:o;if(LN(e))return`${s}===${YN(e.equal,r)}`;if(qN(e)){return`${s}<${YN(e.lt,r)}`}if(IN(e)){return`${s}>${YN(e.gt,r)}`}if(UN(e)){return`${s}<=${YN(e.lte,r)}`}if(WN(e)){return`${s}>=${YN(e.gte,r)}`}if(GN(e))return`indexof([${(u=e.oneOf,l=r,u.map((e=>YN(e,l)))).join(",")}], ${s}) !== -1`;if(function(e){return!!(null==e?void 0:e.field)&&void 0!==e.valid}(e))return JN(s,e.valid);if(HN(e)){const{range:n}=Go(e),i=Xo(n)?{signal:`${n.signal}[0]`}:n[0],a=Xo(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==a&&t)return"inrange("+s+", ["+YN(i,r)+", "+YN(a,r)+"])";const o=[];return null!==i&&o.push(`${s} >= ${YN(i,r)}`),null!==a&&o.push(`${s} <= ${YN(a,r)}`),o.length>0?o.join(" && "):"true"}var u,l;throw new Error(`Invalid field predicate: ${Ar(e)}`)}function JN(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function QN(e){return VN(e)&&e.timeUnit?{...e,timeUnit:RN(e.timeUnit)}:e}function KN(e){return"ordinal"===e||"nominal"===e}const ZN="quantitative",eR="ordinal",tR="temporal",nR="nominal",iR="geojson";const rR="linear",aR="log",oR="pow",sR="sqrt",uR="time",lR="utc",cR="point",fR="band",dR={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 hR(e,t){const n=dR[e],i=dR[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const pR={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 mR(e){return pR[e]}const gR=new Set(["linear","log","pow","sqrt","symlog"]),yR=new Set([...gR,"time","utc"]);function vR(e){return gR.has(e)}const bR=new Set(["quantile","quantize","threshold"]),xR=new Set([...yR,...bR,"sequential","identity"]),wR=new Set(["ordinal","bin-ordinal","point","band"]);function _R(e){return wR.has(e)}function AR(e){return xR.has(e)}function kR(e){return yR.has(e)}function DR(e){return bR.has(e)}function FR(e){return kr(e,"param")}const{type:CR,domain:ER,range:$R,rangeMax:SR,rangeMin:MR,scheme:BR,...zR}={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},OR=Qi(zR);function NR(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 kR(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return kR(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 kR(e);case"nice":return kR(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return AR(e)&&!ji(["log","time","utc","threshold","quantile"],e)}}function RR(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return ma(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 TR={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"},PR=TR.arc,jR=TR.area,LR=TR.bar,qR=TR.image,UR=TR.line,IR=TR.point,WR=TR.rect,HR=TR.rule,GR=TR.text,VR=TR.tick,YR=TR.trail,XR=TR.circle,JR=TR.square,QR=TR.geoshape;function KR(e){return["line","area","trail"].includes(e)}function ZR(e){return["rect","bar","image","arc","tick"].includes(e)}const eT=new Set(Qi(TR));function tT(e){return kr(e,"type")}const nT=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],iT=Qi({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),rT=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],aT={area:["line","point"],bar:rT,rect:rT,line:["point"],tick:["bandSize","thickness",...rT]},oT=Qi({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 sT(e){return kr(e,"band")}const uT={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},lT={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},cT={...lT,binSpacing:1},fT={...lT,thickness:1};function dT(e,{isPath:t}){return void 0===e||"break-paths-show-path-domains"===e?t?"break-paths-show-domains":"filter":null===e?"show":e}function hT({markDef:e,config:t,scaleChannel:n,scaleType:i,isCountAggregate:r}){var a,o;if(!i||!AR(i)||r)return"always-valid";const s=dT(ls("invalid",e,t),{isPath:KR(e.type)});return void 0!==(null==(o=null==(a=t.scale)?void 0:a.invalid)?void 0:o[n])?"show":s}function pT({scaleName:e,scale:t,mode:n}){const i=`domain('${e}')`;if(!t||!e)return;const r=`${i}[0]`,a=`peek(${i})`,o=t.domainHasZero();if("definitely"===o)return{scale:e,value:0};if("maybe"===o){return{signal:`scale('${e}', inrange(0, ${i}) ? 0 : ${"zeroOrMin"===n?r:a})`}}return{signal:`scale('${e}', ${"zeroOrMin"===n?r:a})`}}function mT({scaleChannel:e,channelDef:t,scale:n,scaleName:i,markDef:r,config:a}){var o;const s=null==n?void 0:n.get("type"),u=bP(t),l=hT({scaleChannel:e,markDef:r,config:a,scaleType:s,isCountAggregate:Ro(null==u?void 0:u.aggregate)});if(u&&"show"===l){const t=(null==(o=a.scale.invalid)?void 0:o[e])??"zero-or-min";return{test:JN(cP(u,{expr:"datum"}),!1),...gT(t,n,i)}}}function gT(e,t,n){if(o(i=e)&&"value"in i){const{value:t}=e;return Xo(t)?{signal:t.signal}:{value:t}}var i;return pT({scale:t,scaleName:n,mode:"zeroOrMin"})}function yT(e){const{channel:t,channelDef:n,markDef:i,scale:r,scaleName:a,config:o}=e,s=Ma(t),u=xT(e),l=mT({scaleChannel:s,channelDef:n,scale:r,scaleName:a,markDef:i,config:o});return void 0!==l?[l,u]:u}function vT(e,t,n,i){const r={};if(t&&(r.scale=t),KT(e)){const{datum:t}=e;vN(t)?r.signal=kN(t):Xo(t)?r.signal=t.signal:Ho(t)?r.signal=t.expr:r.value=t}else r.field=cP(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function bT({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,endSuffix:a="end",bandPosition:o=.5}){const s=!Xo(o)&&0<o&&o<1?"datum":void 0,u=cP(t,{expr:s,suffix:r}),l=void 0!==n?cP(n,{expr:s}):cP(t,{suffix:a,expr:s}),c={};if(0===o||1===o){c.scale=e;const t=0===o?u:l;c.field=t}else{const t=Xo(o)?`(1-${o.signal}) * ${u} + ${o.signal} * ${l}`:`${1-o} * ${u} + ${o} * ${l}`;c.signal=`scale("${e}", ${t})`}return i&&(c.offset=i),c}function xT({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:a,scale:o,stack:s,offset:u,defaultRef:l,bandPosition:c}){if(t){if(nP(t)){const l=null==o?void 0:o.get("type");if(iP(t)){c??(c=IT({fieldDef:t,fieldDef2:n,markDef:i,config:r}));const{bin:o,timeUnit:f,type:d}=t;if(Lo(o)||c&&f&&d===tR)return(null==s?void 0:s.impute)?vT(t,a,{binSuffix:"mid"},{offset:u}):c&&!_R(l)?bT({scaleName:a,fieldOrDatumDef:t,bandPosition:c,offset:u}):vT(t,a,$P(t,e)?{binSuffix:"range"}:{},{offset:u});if(qo(o)){if(JT(n))return bT({scaleName:a,fieldOrDatumDef:t,fieldOrDatumDef2:n,bandPosition:c,offset:u});yN(hN(e===Er?Sr:Mr))}}return vT(t,a,_R(l)?{binSuffix:"range"}:{},{offset:u,band:"band"===l?c??t.bandPosition??.5:void 0})}if(rP(t)){const n=u?{offset:u}:{};return{...wT(e,t.value),...n}}}return m(l)&&(l=l()),l?{...l,...u?{offset:u}:{}}:l}function wT(e,t){return ji(["x","x2"],e)&&"width"===t?{field:{group:"width"}}:ji(["y","y2"],e)&&"height"===t?{field:{group:"height"}}:rs(t)}function _T(e){return e&&"number"!==e&&"time"!==e}function AT(e,t,n){return`${e}(${t}${n?`, ${Ar(n)}`:""})`}function kT({fieldOrDatumDef:e,format:t,formatType:n,expr:r,normalizeStack:a,config:o}){var s,u;if(_T(n))return FT({fieldOrDatumDef:e,format:t,formatType:n,expr:r,config:o});const l=DT(e,r,a),c=QT(e);if(void 0===t&&void 0===n&&o.customFormatTypes){if("quantitative"===c){if(a&&o.normalizedNumberFormatType)return FT({fieldOrDatumDef:e,format:o.normalizedNumberFormat,formatType:o.normalizedNumberFormatType,expr:r,config:o});if(o.numberFormatType)return FT({fieldOrDatumDef:e,format:o.numberFormat,formatType:o.numberFormatType,expr:r,config:o})}if("temporal"===c&&o.timeFormatType&&JT(e)&&void 0===e.timeUnit)return FT({fieldOrDatumDef:e,format:o.timeFormat,formatType:o.timeFormatType,expr:r,config:o})}if(FP(e)){const n=function({field:e,timeUnit:t,format:n,formatType:r,rawTimeFormat:a,isUTCScale:o}){return!t||n?!t&&r?`${r}(${e}, '${n}')`:`${o?"utc":"time"}Format(${e}, '${n=i(n)?n:a}')`:function(e,t,n){if(!e)return;const i=NN(e);return`${n||$N(e)?"utc":"time"}Format(${t}, ${i})`}(t,e,o)}({field:l,timeUnit:JT(e)?null==(s=RN(e.timeUnit))?void 0:s.unit:void 0,format:t,formatType:o.timeFormatType,rawTimeFormat:o.timeFormat,isUTCScale:aP(e)&&(null==(u=e.scale)?void 0:u.type)===lR});return n?{signal:n}:void 0}if(t=$T({type:c,specifiedFormat:t,config:o,normalizeStack:a}),JT(e)&&Lo(e.bin)){return{signal:BT(l,cP(e,{expr:r,binSuffix:"end"}),t,n,o)}}return t||"quantitative"===QT(e)?{signal:`${ST(l,t)}`}:{signal:`isValid(${l}) ? ${l} : ""+${l}`}}function DT(e,t,n){return JT(e)?n?`${cP(e,{expr:t,suffix:"end"})}-${cP(e,{expr:t,suffix:"start"})}`:cP(e,{expr:t}):function(e){const{datum:t}=e;return vN(t)?kN(t):`${Ar(t)}`}(e)}function FT({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:a,field:o}){if(o??(o=DT(e,i,r)),"datum.value"!==o&&JT(e)&&Lo(e.bin)){return{signal:BT(o,cP(e,{expr:i,binSuffix:"end"}),t,n,a)}}return{signal:AT(n,o,t)}}function CT(e,t,n,r,a,o){var s;if(!i(r)||!_T(r)){if(void 0===n&&void 0===r&&a.customFormatTypes&&"quantitative"===QT(e)){if(a.normalizedNumberFormatType&&oP(e)&&"normalize"===e.stack)return;if(a.numberFormatType)return}if(oP(e)&&"normalize"===e.stack&&a.normalizedNumberFormat)return $T({type:"quantitative",config:a,normalizeStack:!0});if(FP(e)){const t=JT(e)?null==(s=RN(e.timeUnit))?void 0:s.unit:void 0;if(void 0===t&&a.customFormatTypes&&a.timeFormatType)return;return function({specifiedFormat:e,timeUnit:t,config:n,omitTimeFormatConfig:i}){if(e)return e;if(t)return{signal:NN(t)};return i?void 0:n.timeFormat}({specifiedFormat:n,timeUnit:t,config:a,omitTimeFormatConfig:o})}return $T({type:t,specifiedFormat:n,config:a})}}function ET(e,t,n){var i;return e&&(Xo(e)||"number"===e||"time"===e)?e:FP(t)&&"time"!==n&&"utc"!==n?JT(t)&&(null==(i=RN(null==t?void 0:t.timeUnit))?void 0:i.utc)?"utc":"time":void 0}function $T({type:e,specifiedFormat:t,config:n,normalizeStack:r}){return i(t)?t:e===ZN?r?n.normalizedNumberFormat:n.numberFormat:void 0}function ST(e,t){return`format(${e}, "${t||""}")`}function MT(e,t,n,r){return _T(n)?AT(n,e,t):ST(e,(i(t)?t:void 0)??r.numberFormat)}function BT(e,t,n,i,r){if(void 0===n&&void 0===i&&r.customFormatTypes&&r.numberFormatType)return BT(e,t,r.numberFormat,r.numberFormatType,r);const a=MT(e,n,i,r),o=MT(t,n,i,r);return`${JN(e,!1)} ? "null" : ${a} + " – " + ${o}`}const zT="min",OT={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 NT(e){return t(OT,e)}function RT(e){return e&&("count"===e.op||kr(e,"field"))}function TT(e){return e&&l(e)}function PT(e){return kr(e,"row")||kr(e,"column")}function jT(e){return kr(e,"header")}function LT(e){return kr(e,"facet")}function qT(e){const{field:t,timeUnit:n,bin:i,aggregate:r}=e;return{...n?{timeUnit:n}:{},...i?{bin:i}:{},...r?{aggregate:r}:{},field:t}}function UT(e){return kr(e,"sort")}function IT({fieldDef:e,fieldDef2:t,markDef:n,config:i}){if(nP(e)&&void 0!==e.bandPosition)return e.bandPosition;if(JT(e)){const{timeUnit:r,bin:a}=e;if(r&&!t)return cs("timeUnitBandPosition",n,i);if(Lo(a))return.5}}function WT({channel:e,fieldDef:t,fieldDef2:n,markDef:i,config:r,scaleType:a,useVlSizeChannel:o}){var s,u,l;const c=Oa(e),f=ls(o?"size":c,i,r,{vgChannel:c});if(void 0!==f)return f;if(JT(t)){const{timeUnit:e,bin:o}=t;if(e&&!n)return{band:cs("timeUnitBandSize",i,r)};if(Lo(o)&&!_R(a))return{band:1}}return ZR(i.type)?a?_R(a)?(null==(s=r[i.type])?void 0:s.discreteBandSize)||{band:1}:null==(u=r[i.type])?void 0:u.continuousBandSize:null==(l=r[i.type])?void 0:l.discreteBandSize:void 0}function HT(e,t,n,i){return!!(Lo(e.bin)||e.timeUnit&&iP(e)&&"temporal"===e.type)&&void 0!==IT({fieldDef:e,fieldDef2:t,markDef:n,config:i})}function GT(e){return kr(e,"sort")&&!kr(e,"field")}function VT(e){return kr(e,"condition")}function YT(e){const t=null==e?void 0:e.condition;return!!t&&!l(t)&&JT(t)}function XT(e){const t=null==e?void 0:e.condition;return!!t&&!l(t)&&nP(t)}function JT(e){return kr(e,"field")||"count"===(null==e?void 0:e.aggregate)}function QT(e){return null==e?void 0:e.type}function KT(e){return kr(e,"datum")}function ZT(e){return iP(e)&&!fP(e)||tP(e)}function eP(e){return iP(e)&&"quantitative"===e.type&&!e.bin||tP(e)}function tP(e){return KT(e)&&n(e.datum)}function nP(e){return JT(e)||KT(e)}function iP(e){return e&&(kr(e,"field")||"count"===e.aggregate)&&kr(e,"type")}function rP(e){return kr(e,"value")}function aP(e){return kr(e,"scale")||kr(e,"sort")}function oP(e){return kr(e,"axis")||kr(e,"stack")||kr(e,"impute")}function sP(e){return kr(e,"legend")}function uP(e){return kr(e,"format")||kr(e,"formatType")}function lP(e){return Ri(e,["legend","axis","header","scale"])}function cP(e,t={}){let n=e.field;const i=t.prefix;let r=t.suffix,a="";if(function(e){return"count"===e.aggregate}(e))n=yr("count");else{let i;if(!t.nofn)if(function(e){return kr(e,"op")}(e))i=e.op;else{const{bin:o,aggregate:s,timeUnit:u}=e;Lo(o)?(i=jo(o),r=(t.binSuffix??"")+(t.suffix??"")):s?zo(s)?(a=`["${n}"]`,n=`argmax_${s.argmax}`):Bo(s)?(a=`["${n}"]`,n=`argmin_${s.argmin}`):i=String(s):u&&!CN(u)&&(i=function(e){const{utc:t,...n}=RN(e);return n.unit?(t?"utc":"")+Qi(n).map((e=>tr(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+Qi(n).map((e=>tr(`_${e}_${n[e]}`))).join("")}(u),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?fr(n):t.expr?or(n,t.expr)+a:lr(n)+a}function fP(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return JT(e)&&!!e.bin;case"temporal":return!1}throw new Error(KO(e.type))}const dP=(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(zo(t))return`${r} for argmax(${t.argmax})`;if(Bo(t))return`${r} for argmin(${t.argmin})`;const a=i&&!CN(i)?RN(i):void 0,o=t||(null==a?void 0:a.unit)||(null==a?void 0:a.maxbins)&&"timeunit"||Lo(n)&&"bin";return o?`${o.toUpperCase()}(${r})`:r}(e);default:return function(e,t){var n;const{field:i,bin:r,timeUnit:a,aggregate:o}=e;if("count"===o)return t.countTitle;if(Lo(r))return`${i} (binned)`;if(a&&!CN(a)){const e=null==(n=RN(a))?void 0:n.unit;if(e)return`${i} (${MN(e).join("-")})`}else if(o)return zo(o)?`${i} for max ${o.argmax}`:Bo(o)?`${i} for min ${o.argmin}`:`${rr(o)} of ${i}`;return i}(e,t)}};let hP=dP;function pP(e){hP=e}function mP(e,t,{allowDisabling:n,includeDefault:i=!0}){var r;const a=null==(r=gP(e))?void 0:r.title;if(!JT(e))return a??e.title;const o=e,s=i?yP(o,t):void 0;return n?hr(a,o.title,s):a??o.title??s}function gP(e){return oP(e)&&e.axis?e.axis:sP(e)&&e.legend?e.legend:jT(e)&&e.header?e.header:void 0}function yP(e,t){return hP(e,t)}function vP(e){if(uP(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=gP(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function bP(e){return JT(e)?e:YT(e)?e.condition:void 0}function xP(e){return nP(e)?e:XT(e)?e.condition:void 0}function wP(e,t,r,a={}){if(i(e)||n(e)||u(e)){return yN(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${Ar(n)}}.`}(t,i(e)?"string":n(e)?"number":"boolean",e)),{value:e}}return nP(e)?_P(e,t,r,a):XT(e)?{...e,condition:_P(e.condition,t,r,a)}:e}function _P(e,t,r,a){if(uP(e)){const{format:n,formatType:i,...o}=e;if(_T(i)&&!r.customFormatTypes)return yN(JO(t)),_P(o,t,r,a)}else{const n=oP(e)?"axis":sP(e)?"legend":jT(e)?"header":null;if(n&&e[n]){const{format:i,formatType:o,...s}=e[n];if(_T(o)&&!r.customFormatTypes)return yN(JO(t)),_P({...e,[n]:s},t,r,a)}}return JT(e)?AP(e,t,a):function(e){let t=e.type;if(t)return e;const{datum:r}=e;return t=n(r)?"quantitative":i(r)?"nominal":vN(r)?"temporal":void 0,{...e,type:t}}(e)}function AP(e,t,{compositeMark:n=!1}={}){const{aggregate:r,timeUnit:a,bin:o,field:s}=e,u={...e};if(n||!r||Oo(r)||zo(r)||Bo(r)||(yN(function(e){return`Invalid aggregation operator "${e}".`}(r)),delete u.aggregate),a&&(u.timeUnit=RN(a)),s&&(u.field=`${s}`),Lo(o)&&(u.bin=kP(o,t)),qo(o)&&!io(t)&&yN(function(e){return`Channel ${e} should not be used with "binned" bin.`}(t)),iP(u)){const{type:e}=u,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case ZN:return"quantitative";case"t":case tR:return"temporal";case"o":case eR:return"ordinal";case"n":case nR:return"nominal";case iR:return"geojson"}}(e);e!==t&&(u.type=t),"quantitative"!==e&&Ro(r)&&(yN(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,r)),u.type="quantitative")}else if(!Sa(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(UT(e)&&l(e.sort))return"ordinal";const{aggregate:i,bin:r,timeUnit:a}=e;if(a)return"temporal";if(r||i&&!zo(i)&&!Bo(i))return"quantitative";if(aP(e)&&(null==(n=e.scale)?void 0:n.type))switch(dR[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(u,t);u.type=e}if(iP(u)){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 Dr:case Fr:case Cr:return fP(e)?DP:{compatible:!1,warning:nN(t)};case Er:case $r:case Br:case zr:case Ir:case Wr:case Hr:case ea:case na:case ia:case ra:case aa:case oa:case Yr:case Rr:case Or:case sa:return DP;case jr:case qr:case Pr:case Lr:return n!==ZN?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:DP;case Xr:case Jr:case Qr:case Kr:case Vr:case Tr:case Nr:case Sr:case Mr:case Ur:return"nominal"!==n||e.sort?DP:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case Gr:case Zr:return fP(e)||aP(i=e)&&DR(null==(r=i.scale)?void 0:r.type)?DP:{compatible:!1,warning:iN(t)};case ta:return"nominal"!==e.type||"sort"in e?DP:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}var i,r}(u,t)||{};!1===e&&yN(n)}if(UT(u)&&i(u.sort)){const{sort:e}=u;if(NT(e))return{...u,sort:{encoding:e}};const t=e.substring(1);if("-"===e.charAt(0)&&NT(t))return{...u,sort:{encoding:t,order:"descending"}}}if(jT(u)){const{header:e}=u;if(e){const{orient:t,...n}=e;if(t)return{...u,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return u}function kP(e,t){return u(e)?{maxbins:Wo(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:Wo(t)}}const DP={compatible:!0};function FP(e){const{formatType:t}=vP(e);return"time"===t||!t&&((n=e)&&("temporal"===n.type||JT(n)&&!!n.timeUnit));var n}function CP(e,{timeUnit:r,type:a,wrapTime:o,undefinedIfExprNotRequired:s}){var u;const l=r&&(null==(u=RN(r))?void 0:u.unit);let c,f=l||"temporal"===a;return Ho(e)?c=e.expr:Xo(e)?c=e.signal:vN(e)?(f=!0,c=kN(e)):(i(e)||n(e))&&f&&(c=`datetime(${Ar(e)})`,function(e){return t(DN,e)}(l)&&(n(e)&&e<1e4||i(e)&&isNaN(Date.parse(e)))&&(c=kN({[l]:e}))),c?o&&f?`time(${c})`:c:s?void 0:Ar(e)}function EP(e,t){const{type:n}=e;return t.map((t=>{const i=CP(t,{timeUnit:JT(e)&&!CN(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function $P(e,t){return Lo(e.bin)?ko(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const SP={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 MP(e){return null==e?void 0:e.condition}const BP=["domain","grid","labels","ticks","title"],zP={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"},OP={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},NP={...OP,style:1,labelExpr:1,encoding:1};function RP(e){return t(NP,e)}const TP=Qi({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 PP(e){return kr(e,"mark")}class jP{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!PP(e)&&(tT(t=e.mark)?t.type:t)===this.name;var t}}function LP(e,t){const n=e&&e[t];return!!n&&(l(n)?Li(n,(e=>!!e.field)):JT(n)||YT(n))}function qP(e,t){const n=e&&e[t];return!!n&&(l(n)?Li(n,(e=>!!e.field)):JT(n)||KT(n)||XT(n))}function UP(e,t){if(io(t)){const n=e[t];if((JT(n)||KT(n))&&(KN(n.type)||JT(n)&&n.timeUnit)){return qP(e,Ra(t))}}return!1}function IP(e){return Li(ba,(t=>{if(LP(e,t)){const n=e[t];if(l(n))return Li(n,(e=>!!e.aggregate));{const e=bP(n);return e&&!!e.aggregate}}return!1}))}function WP(e,n){const i=[],r=[],a=[],o=[],s={};return VP(e,((u,l)=>{if(JT(u)){const{field:c,aggregate:f,bin:d,timeUnit:h,...p}=u;if(f||h||d){const e=gP(u),m=null==e?void 0:e.title;let g=cP(u,{forAs:!0});const y={...m?[]:{title:mP(u,n,{allowDisabling:!0})},...p,field:g};if(f){let e;if(zo(f)?(e="argmax",g=cP({op:"argmax",field:f.argmax},{forAs:!0}),y.field=`${g}.${c}`):Bo(f)?(e="argmin",g=cP({op:"argmin",field:f.argmin},{forAs:!0}),y.field=`${g}.${c}`):"boxplot"!==f&&"errorbar"!==f&&"errorband"!==f&&(e=f),e){const t={op:e,as:g};c&&(t.field=c),o.push(t)}}else if(i.push(g),iP(u)&&Lo(d)){if(r.push({bin:d,field:c,as:g}),i.push(cP(u,{binSuffix:"end"})),$P(u,l)&&i.push(cP(u,{binSuffix:"range"})),io(l)){const e={field:`${g}_end`};s[`${l}2`]=e}y.bin="binned",Sa(l)||(y.type=ZN)}else if(h&&!CN(h)){a.push({timeUnit:h,field:c,as:g});const e=iP(u)&&u.type!==tR&&"time";e&&(l===ea||l===ra?y.formatType=e:!function(e){return t(Za,e)}(l)?io(l)&&(y.axis={formatType:e,...y.axis}):y.legend={formatType:e,...y.legend})}s[l]=y}else i.push(c),s[l]=e[l]}else s[l]=e[l]})),{bins:r,timeUnits:a,aggregate:o,groupby:i,encoding:s}}function HP(e,t,n){const i=Do(t,n);if(!i)return!1;if("binned"===i){const n=e[t===Sr?Er:$r];return!!(JT(n)&&JT(e[t])&&qo(n.bin))}return!0}function GP(e,t){const n={};for(const i of Qi(e)){const r=wP(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function VP(e,t,n){if(e)for(const i of Qi(e)){const r=e[i];if(l(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function YP(e,t){return Qi(t).reduce(((n,i)=>{switch(i){case Er:case $r:case aa:case sa:case oa:case Sr:case Mr:case Br:case zr:case Rr:case Tr:case Or:case Nr:case Ur:case Pr:case jr:case Lr:case qr:case ea:case Gr:case Yr:case ra:return n;case ta:if("line"===e||"trail"===e)return n;case na:case ia:{const e=t[i];if(l(e)||JT(e))for(const t of c(e))t.aggregate||n.push(cP(t,{}));return n}case Vr:if("trail"===e)return n;case Ir:case Wr:case Hr:case Xr:case Jr:case Qr:case Zr:case Kr:{const e=bP(t[i]);return e&&!e.aggregate&&n.push(cP(e,{})),n}}}),[])}function XP(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 ${JP(t)}`:"";return{field:e+t.field,type:t.type,title:Xo(n)?{signal:`${n}"${escape(r)}"`}:n+r}})),...Wi(function(e){const t=[];for(const n of Qi(e))if(LP(e,n)){const i=e[n],r=c(i);for(const e of r)JT(e)?t.push(e):YT(e)&&t.push(e.condition)}return t}(n).map(lP),Ti)]}}function JP(e){const{title:t,field:n}=e;return hr(t,n)}function QP(e,t,n,r,a){const{scale:o,axis:s}=n;return({partName:u,mark:l,positionPrefix:c,endPositionPrefix:f,extraEncoding:d={}})=>{const h=JP(n);return KP(e,u,a,{mark:l,encoding:{[t]:{field:`${c}_${n.field}`,type:n.type,...void 0!==h?{title:h}:{},...void 0!==o?{scale:o}:{},...void 0!==s?{axis:s}:{}},...i(f)?{[`${t}2`]:{field:`${f}_${n.field}`}}:{},...r,...d}})}}function KP(e,t,n,i){const{clip:r,color:a,opacity:o}=e,s=e.type;return e[t]||void 0===e[t]&&n[t]?[{...i,mark:{...n[t],...r?{clip:r}:{},...a?{color:a}:{},...o?{opacity:o}:{},...tT(i.mark)?i.mark:{type:i.mark},style:`${s}-${String(t)}`,...u(e[t])?{}:e[t]}}]:[]}function ZP(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",a=i[r],o=i[`${r}2`],s=i[`${r}Error`],u=i[`${r}Error2`];return{continuousAxisChannelDef:ej(a,n),continuousAxisChannelDef2:ej(o,n),continuousAxisChannelDefError:ej(s,n),continuousAxisChannelDefError2:ej(u,n),continuousAxis:r}}function ej(e,t){if(null==e?void 0:e.aggregate){const{aggregate:n,...i}=e;return n!==t&&yN(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function tj(e,t){const{mark:n,encoding:i}=e,{x:r,y:a}=i;if(tT(n)&&n.orient)return n.orient;if(ZT(r)){if(ZT(a)){const e=JT(r)&&r.aggregate,n=JT(a)&&a.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 FP(a)&&!FP(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(ZT(a))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const nj="boxplot",ij=new jP(nj,aj);function rj(e){return n(e)?"tukey":e}function aj(e,{config:t}){e={...e,encoding:GP(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:a,...s}=e,u=tT(n)?n:{type:n};r&&yN(HO("boxplot"));const c=u.extent??t.boxplot.extent,f=ls("size",u,t),d=u.invalid,h=rj(c),{bins:p,timeUnits:m,transform:g,continuousAxisChannelDef:y,continuousAxis:v,groupby:b,aggregate:x,encodingWithoutContinuousAxis:w,ticksOrient:_,boxOrient:A,customTooltipWithoutAggregatedField:k}=function(e,t,n){const i=tj(e,nj),{continuousAxisChannelDef:r,continuousAxis:a}=ZP(e,i,nj),o=r.field,s=fr(o),u=rj(t),c=[...oj(o),{op:"median",field:o,as:`mid_box_${s}`},{op:"min",field:o,as:("min-max"===u?"lower_whisker_":"min_")+s},{op:"max",field:o,as:("min-max"===u?"upper_whisker_":"max_")+s}],f="min-max"===u||"tukey"===u?[]:[{calculate:`${sr(`upper_box_${s}`)} - ${sr(`lower_box_${s}`)}`,as:`iqr_${s}`},{calculate:`min(${sr(`upper_box_${s}`)} + ${sr(`iqr_${s}`)} * ${t}, ${sr(`max_${s}`)})`,as:`upper_whisker_${s}`},{calculate:`max(${sr(`lower_box_${s}`)} - ${sr(`iqr_${s}`)} * ${t}, ${sr(`min_${s}`)})`,as:`lower_whisker_${s}`}],{[a]:d,...h}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:m}=function(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let i,r;if(l(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 l(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(h),{bins:g,timeUnits:y,aggregate:v,groupby:b,encoding:x}=WP(m,n),w="vertical"===i?"horizontal":"vertical",_=i,A=[...g,...y,{aggregate:[...v,...c],groupby:b},...f];return{bins:g,timeUnits:y,transform:A,groupby:b,aggregate:v,continuousAxisChannelDef:r,continuousAxis:a,encodingWithoutContinuousAxis:x,ticksOrient:w,boxOrient:_,customTooltipWithoutAggregatedField:p}}(e,c,t),D=fr(y.field),{color:F,size:C,...E}=w,$=e=>QP(u,v,y,e,t.boxplot),S=$(E),M=$(w),B=(o(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||"#4c78a8",z=$({...E,...C?{size:C}:{},color:{condition:{test:`${sr(`lower_box_${y.field}`)} >= ${sr(`upper_box_${y.field}`)}`,...F||{value:B}}}}),O=XP([{fieldPrefix:"min-max"===h?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===h?"lower_whisker_":"min_",titlePrefix:"Min"}],y,w),N={type:"tick",color:"black",opacity:1,orient:_,invalid:d,aria:!1},R="min-max"===h?O:XP([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],y,w),T=[...S({partName:"rule",mark:{type:"rule",invalid:d,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:R}),...S({partName:"rule",mark:{type:"rule",invalid:d,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:R}),...S({partName:"ticks",mark:N,positionPrefix:"lower_whisker",extraEncoding:R}),...S({partName:"ticks",mark:N,positionPrefix:"upper_whisker",extraEncoding:R})],P=[..."tukey"!==h?T:[],...M({partName:"box",mark:{type:"bar",...f?{size:f}:{},orient:A,invalid:d,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:O}),...z({partName:"median",mark:{type:"tick",invalid:d,...o(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...f?{size:f}:{},orient:_,aria:!1},positionPrefix:"mid_box",extraEncoding:O})];if("min-max"===h)return{...s,transform:(s.transform??[]).concat(g),layer:P};const j=sr(`lower_box_${y.field}`),L=sr(`upper_box_${y.field}`),q=`(${L} - ${j})`,U=`${j} - ${c} * ${q}`,I=`${L} + ${c} * ${q}`,W=sr(y.field),H={joinaggregate:oj(y.field),groupby:b},G={transform:[{filter:`(${U} <= ${W}) && (${W} <= ${I})`},{aggregate:[{op:"min",field:y.field,as:`lower_whisker_${D}`},{op:"max",field:y.field,as:`upper_whisker_${D}`},{op:"min",field:`lower_box_${y.field}`,as:`lower_box_${D}`},{op:"max",field:`upper_box_${y.field}`,as:`upper_box_${D}`},...x],groupby:b}],layer:T},{tooltip:V,...Y}=E,{scale:X,axis:J}=y,Q=JP(y),K=Ri(J,["title"]),Z=KP(u,"outliers",t.boxplot,{transform:[{filter:`(${W} < ${U}) || (${W} > ${I})`}],mark:"point",encoding:{[v]:{field:y.field,type:y.type,...void 0!==Q?{title:Q}:{},...void 0!==X?{scale:X}:{},...Ji(K)?{}:{axis:K}},...Y,...F?{color:F}:{},...k?{tooltip:k}:{}}})[0];let ee;const te=[...p,...m,H];return Z?ee={transform:te,layer:[Z,G]}:(ee=G,ee.transform.unshift(...te)),{...s,layer:[ee,{transform:g,layer:P}]}}function oj(e){const t=fr(e);return[{op:"q1",field:e,as:`lower_box_${t}`},{op:"q3",field:e,as:`upper_box_${t}`}]}const sj="errorbar",uj=new jP(sj,lj);function lj(e,{config:t}){e={...e,encoding:GP(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:a,ticksOrient:o,markDef:s,outerSpec:u,tooltipEncoding:l}=fj(e,sj,t);delete a.size;const c=QP(s,r,i,a,t.errorbar),f=s.thickness,d=s.size,h={type:"tick",orient:o,aria:!1,...void 0!==f?{thickness:f}:{},...void 0!==d?{size:d}:{}},p=[...c({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return{...u,transform:n,...p.length>1?{layer:p}:{...p[0]}}}function cj(e,t){const{encoding:n}=e;if(function(e){return(nP(e.x)||nP(e.y))&&!nP(e.x2)&&!nP(e.y2)&&!nP(e.xError)&&!nP(e.xError2)&&!nP(e.yError)&&!nP(e.yError2)}(n))return{orient:tj(e,t),inputType:"raw"};const i=function(e){return nP(e.x2)||nP(e.y2)}(n),r=function(e){return nP(e.xError)||nP(e.xError2)||nP(e.yError)||nP(e.yError2)}(n),a=n.x,o=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(nP(e)&&nP(i))throw new Error(`${t} cannot have both x2 and y2`);if(nP(e)){if(ZT(a))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(nP(i)){if(ZT(o))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(nP(i)&&!nP(e))throw new Error(`${t} cannot have xError2 without xError`);if(nP(s)&&!nP(r))throw new Error(`${t} cannot have yError2 without yError`);if(nP(e)&&nP(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(nP(e)){if(ZT(a))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(nP(r)){if(ZT(o))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 fj(e,t,n){const{mark:i,encoding:r,params:a,projection:o,...s}=e,u=tT(i)?i:{type:i};a&&yN(HO(t));const{orient:l,inputType:c}=cj(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:m}=ZP(e,l,t),{errorBarSpecificAggregate:g,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,a,o,s){let u=[],l=[];const c=t.field;let f,d=!1;if("raw"===a){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)&&yN(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,o)),"stderr"===n||"stdev"===n)u=[{op:n,field:c,as:`extent_${c}`},{op:t,field:c,as:`center_${c}`}],l=[{calculate:`${sr(`center_${c}`)} + ${sr(`extent_${c}`)}`,as:`upper_${c}`},{calculate:`${sr(`center_${c}`)} - ${sr(`extent_${c}`)}`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:rr(t)},{fieldPrefix:"upper_",titlePrefix:dj(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:dj(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),u=[{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:mP({field:c,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:mP({field:c,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:mP({field:c,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&yN((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"===a?(f=[],l=[{calculate:sr(n.field),as:`upper_${c}`},{calculate:sr(c),as:`lower_${c}`}]):"aggregated-error"===a&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`${sr(c)} + ${sr(i.field)}`,as:`upper_${c}`}],r?l.push({calculate:`${sr(c)} + ${sr(r.field)}`,as:`lower_${c}`}):l.push({calculate:`${sr(c)} - ${sr(i.field)}`,as:`lower_${c}`}));for(const e of l)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:cr(cr(e.calculate,"datum['",""),"']","")})}var h,p;return{postAggregateCalculates:l,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}(u,f,d,h,p,c,t,n),{[m]:x,["x"===m?"x2":"y2"]:w,["x"===m?"xError":"yError"]:_,["x"===m?"xError2":"yError2"]:A,...k}=r,{bins:D,timeUnits:F,aggregate:C,groupby:E,encoding:$}=WP(k,n),S=[...C,...g],M="raw"!==c?[]:E,B=XP(v,f,$,b);return{transform:[...s.transform??[],...D,...F,...0===S.length?[]:[{aggregate:S,groupby:M}],...y],groupby:M,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:$,ticksOrient:"vertical"===l?"horizontal":"vertical",markDef:u,outerSpec:s,tooltipEncoding:B}}function dj(e,t,n){return`${rr(e)} ${n} ${t}`}const hj="errorband",pj=new jP(hj,mj);function mj(e,{config:t}){e={...e,encoding:GP(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:a,markDef:o,outerSpec:s,tooltipEncoding:u}=fj(e,hj,t),l=o,c=QP(l,r,i,a,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={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},h={...h,...p,aria:!1}):l.interpolate?yN(dN("interpolate")):l.tension&&yN(dN("tension")),{...s,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:u})]}}const gj={};function yj(e,t,n){const i=new jP(e,t);gj[e]={normalizer:i,parts:n}}yj(nj,aj,["box","median","outliers","rule","ticks"]),yj(sj,lj,["ticks","rule"]),yj(hj,mj,["band","borders"]);const vj=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],bj={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"},xj={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"},wj=Qi(bj),_j=Qi(xj),Aj=Qi({header:1,headerRow:1,headerColumn:1,headerFacet:1}),kj=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],Dj="_vgsid_",Fj={point:{on:"click",fields:[Dj],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 Cj(e){return"legend"===e||!!(null==e?void 0:e.legend)}function Ej(e){return Cj(e)&&o(e)}function $j(e){return!!(null==e?void 0:e.select)}function Sj(e){const t=[];for(const n of e||[]){if($j(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 Mj(e){return kr(e,"concat")}function Bj(e){return kr(e,"vconcat")}function zj(e){return kr(e,"hconcat")}function Oj({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function Nj(e){return kr(e,"step")}function Rj(e){return kr(e,"view")||kr(e,"width")||kr(e,"height")}const Tj=Qi({align:1,bounds:1,center:1,columns:1,spacing:1});function Pj(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function jj(e,t){const n=Lj(e,t);return Nj(n)?n.step:qj}function Lj(e,t){return hr(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const qj=20,Uj={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:qj},mark:{color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},arc:{},area:{},bar:cT,circle:{},geoshape:{},image:{},line:{},point:{},rect:lT,rule:{color:"black"},square:{},text:{color:"black"},tick:fT,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,framesPerSecond:2,animationDuration:5},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%"},Ij=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],Wj={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},Hj={blue:Ij[0],orange:Ij[1],red:Ij[2],teal:Ij[3],green:Ij[4],yellow:Ij[5],purple:Ij[6],pink:Ij[7],brown:Ij[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 Gj(e){const t=Qi(e||{}),n={};for(const i of t){const t=e[i];n[i]=MP(t)?ts(t):ns(t)}return n}const Vj=[...oT,...TP,...Aj,"background","padding","legend","lineBreak","scale","style","title","view"];function Yj(e={}){const{color:t,font:n,fontSize:i,selection:r,...a}=e,u=Ie({},zi(Uj),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:o(e)?{...Hj,...e}:Hj}],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:o(e)?{...Wj,...e}:Wj}],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):{},a||{});r&&s(u,"selection",r,!0);const l=Ri(u,Vj);for(const o of["background","lineBreak","padding"])u[o]&&(l[o]=ns(u[o]));for(const o of oT)u[o]&&(l[o]=Go(u[o]));for(const o of TP)u[o]&&(l[o]=Gj(u[o]));for(const o of Aj)u[o]&&(l[o]=Go(u[o]));if(u.legend&&(l.legend=Go(u.legend)),u.scale){const{invalid:e,...t}=u.scale,n=Go(e,{level:1});l.scale={...Go(t),...Qi(n).length>0?{invalid:n}:{}}}return u.style&&(l.style=function(e){const t=Qi(e),n={};for(const i of t)n[i]=Gj(e[i]);return n}(u.style)),u.title&&(l.title=Go(u.title)),u.view&&(l.view=Go(u.view)),l}const Xj=new Set(["view",...eT]),Jj=["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"],Qj={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...aT};function Kj(e){e=zi(e);for(const t of Jj)delete e[t];if(e.axis)for(const t in e.axis)MP(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of vj)delete e.legend[t];if(e.mark){for(const t of iT)delete e.mark[t];e.mark.tooltip&&o(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(Sj(e.params)),delete e.params);for(const t of Xj){for(const i of iT)delete e[t][i];const n=Qj[t];if(n)for(const i of n)delete e[t][i];Zj(e,t)}for(const t of Qi(gj))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=Vo(e.title);Ji(t)||(e.style["group-title"]={...e.style["group-title"],...t});Ji(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n});Ji(i)?delete e.title:e.title=i}(e);for(const t in e)o(e[t])&&Ji(e[t])&&delete e[t];return Ji(e)?void 0:e}function Zj(e,t,n,i){"view"===t&&(n="cell");const r={...e[t],...e.style[n??t]};Ji(r)||(e.style[n??t]=r),delete e[t]}function eL(e){return kr(e,"layer")}class tL{map(e,t){return LT(e)?this.mapFacet(e,t):function(e){return kr(e,"repeat")}(e)?this.mapRepeat(e,t):zj(e)?this.mapHConcat(e,t):Bj(e)?this.mapVConcat(e,t):Mj(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(eL(e))return this.mapLayer(e,t);if(PP(e))return this.mapUnit(e,t);throw new Error(TO(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 nL={zero:1,center:1,normalize:1};const iL=new Set([PR,LR,jR,HR,IR,XR,JR,UR,GR,VR]),rL=new Set([LR,jR,PR]);function aL(e){return JT(e)&&"quantitative"===QT(e)&&!e.bin}function oL(e,t,{orient:n,type:i}){const r="x"===t?"y":"radius",a="x"===t&&["bar","area"].includes(i),o=e[t],s=e[r];if(JT(o)&&JT(s))if(aL(o)&&aL(s)){if(o.stack)return t;if(s.stack)return r;const e=JT(o)&&!!o.aggregate;if(e!==(JT(s)&&!!s.aggregate))return e?t:r;if(a){if("vertical"===n)return r;if("horizontal"===n)return t}}else{if(aL(o))return t;if(aL(s))return r}else{if(aL(o)){if(a&&"vertical"===n)return;return t}if(aL(s)){if(a&&"horizontal"===n)return;return r}}}function sL(e,n){var i,r;const a=tT(e)?e:{type:e},o=a.type;if(!iL.has(o))return null;const s=oL(n,"x",a)||oL(n,"theta",a);if(!s)return null;const l=n[s],f=JT(l)?cP(l,{}):void 0,d=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(s),h=[],p=new Set;if(n[d]){const e=n[d],t=JT(e)?cP(e,{}):void 0;t&&t!==f&&(h.push(d),p.add(t))}const m="x"===d?"xOffset":"yOffset",g=n[m],y=JT(g)?cP(g,{}):void 0;y&&y!==f&&(h.push(m),p.add(y));const v=eo.reduce(((e,t)=>{if("tooltip"!==t&&LP(n,t)){const i=n[t];for(const n of c(i)){const i=bP(n);if(i.aggregate)continue;const r=cP(i,{});r&&p.has(r)||e.push({channel:t,fieldDef:i})}}return e}),[]);let b;return void 0!==l.stack?b=u(l.stack)?l.stack?"zero":null:l.stack:rL.has(o)&&(b="zero"),b&&t(nL,b)?IP(n)&&0===v.length?null:((null==(i=null==l?void 0:l.scale)?void 0:i.type)&&(null==(r=null==l?void 0:l.scale)?void 0:r.type)!==rR&&(null==l?void 0:l.stack)&&yN(`Stack is applied to a non-linear scale (${l.scale.type}).`),nP(n[za(s)])?(void 0!==l.stack&&yN(`Cannot stack "${x=s}" if there is already "${x}2".`),null):(JT(l)&&l.aggregate&&!To.has(l.aggregate)&&yN(`Stacking is applied even though the aggregate function is non-summative ("${l.aggregate}").`),{groupbyChannels:h,groupbyFields:p,fieldChannel:s,impute:null!==l.impute&&KR(o),stackBy:v,offset:b})):null;var x}function uL(e,t,n){const i=Go(e),r=ls("orient",i,n);if(i.orient=function(e,t,n){switch(e){case IR:case XR:case JR:case GR:case WR:case qR:return}const{x:i,y:r,x2:a,y2:o}=t;switch(e){case LR:if(JT(i)&&(qo(i.bin)||JT(r)&&r.aggregate&&!i.aggregate))return"vertical";if(JT(r)&&(qo(r.bin)||JT(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(o||a){if(n)return n;if(!a)return(JT(i)&&i.type===ZN&&!Lo(i.bin)||tP(i))&&JT(r)&&qo(r.bin)?"horizontal":"vertical";if(!o)return(JT(r)&&r.type===ZN&&!Lo(r.bin)||tP(r))&&JT(i)&&qo(i.bin)?"vertical":"horizontal"}case HR:if(a&&(!JT(i)||!qo(i.bin))&&o&&(!JT(r)||!qo(r.bin)))return;case jR:if(o)return JT(r)&&qo(r.bin)?"horizontal":"vertical";if(a)return JT(i)&&qo(i.bin)?"vertical":"horizontal";if(e===HR){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case UR:case VR:{const t=eP(i),a=eP(r);if(n)return n;if(t&&!a)return"tick"!==e?"horizontal":"vertical";if(!t&&a)return"tick"!==e?"vertical":"horizontal";if(t&&a)return"vertical";{const e=iP(i)&&i.type===tR,t=iP(r)&&r.type===tR;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&yN(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=ls("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:uT[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}const a=ls("opacity",i,n),o=ls("fillOpacity",i,n);void 0===a&&void 0===o&&(i.opacity=function(e,t){if(ji([IR,VR,XR,JR],e)&&!IP(t))return.7;return}(i.type,t));return void 0===ls("cursor",i,n)&&(i.cursor=function(e,t,n){if(t.href||e.href||ls("href",e,n))return"pointer";return e.cursor}(i,t,n)),i}function lL(e){const{point:t,line:n,...i}=e;return Qi(i).length>1?i:i.type}function cL(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:Ri(e[t],["point","line"])});return e}function fL(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?o(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?o(t.point)?t.point:{}:void 0}function dL(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 hL{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(PP(e)){const{mark:n,encoding:i}=e,r=tT(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!fL(r,t[r.type],i);case"area":return!!fL(r,t[r.type],i)||!!dL(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:a,mark:o,name:s,encoding:u,...l}=e,c=GP(u,i),f=tT(o)?o:{type:o},d=fL(f,i[f.type],c),h="area"===f.type&&dL(f,i[f.type]),p=[{name:s,...r?{params:r}:{},mark:lL({..."area"===f.type&&void 0===f.opacity&&void 0===f.fillOpacity?{opacity:.7}:{},...f}),encoding:Ri(c,["shape"])}],m=sL(uL(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=Ri(g,["y2","x2"]),h&&p.push({...a?{projection:a}:{},mark:{type:"line",...Ni(f,["clip","interpolate","tension","tooltip"]),...h},encoding:g}),d&&p.push({...a?{projection:a}:{},mark:{type:"point",opacity:1,filled:!0,...Ni(f,["clip","tooltip"]),...d},encoding:g}),n({...l,layer:p},{...t,config:cL(i)})}}function pL(e,t){return t?PT(e)?xL(e,t):yL(e,t):e}function mL(e,t){return t?xL(e,t):e}function gL(e,t,n){const r=t[e];return!i(a=r)&&kr(a,"repeat")?r.repeat in n?{...t,[e]:n[r.repeat]}:void yN(function(e){return`Unknown repeated value "${e}".`}(r.repeat)):t;var a}function yL(e,t){if(void 0!==(e=gL("field",e,t))){if(null===e)return null;if(UT(e)&&RT(e.sort)){const n=gL("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function vL(e,t){if(JT(e))return yL(e,t);{const n=gL("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function bL(e,t){if(!nP(e)){if(XT(e)){const n=vL(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=vL(e,t);if(n)return n;if(VT(e))return{condition:e.condition}}}function xL(e,t){const n={};for(const i in e)if(kr(e,i)){const r=e[i];if(l(r))n[i]=r.map((e=>bL(e,t))).filter((e=>e));else{const e=bL(r,t);void 0!==e&&(n[i]=e)}}return n}class wL{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(PP(e)){const{encoding:t,mark:n}=e;if("line"===n||tT(n)&&"line"===n.type)for(const e of $a){const n=t[Ma(e)];if(t[e]&&(JT(n)&&!qo(n.bin)||KT(n)))return!0}}return!1}run(e,t,n){const{encoding:i,mark:r}=e;var a,s;return yN((a=!!i.x2,s=!!i.y2,`Line mark is for continuous lines and thus cannot be used with ${a&&s?"x2 and y2":a?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),n({...e,mark:o(r)?{...r,type:"rule"}:"rule"},t)}}function _L({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...Qi(e),...Qi(t)]);for(const a of r){const r=t[a],o=e[a];if(nP(r)){const e={...o,...r};i[a]=e}else XT(r)?i[a]={...r,condition:{...o,...r.condition}}:r||null===r?i[a]=r:(n||rP(o)||Xo(o)||nP(o)||l(o))&&(i[a]=o)}}else i=t;return!i||Ji(i)?void 0:i}function AL(e){const{parentProjection:t,projection:n}=e;return t&&n&&yN(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${Ar(t)} is overridden by a child projection ${Ar(n)}.`}({parentProjection:t,projection:n})),n??t}function kL(e){return kr(e,"filter")}function DL(e){return kr(e,"lookup")}function FL(e){return kr(e,"pivot")}function CL(e){return kr(e,"density")}function EL(e){return kr(e,"quantile")}function $L(e){return kr(e,"regression")}function SL(e){return kr(e,"loess")}function ML(e){return kr(e,"sample")}function BL(e){return kr(e,"window")}function zL(e){return kr(e,"joinaggregate")}function OL(e){return kr(e,"flatten")}function NL(e){return kr(e,"calculate")}function RL(e){return kr(e,"bin")}function TL(e){return kr(e,"impute")}function PL(e){return kr(e,"timeUnit")}function jL(e){return kr(e,"aggregate")}function LL(e){return kr(e,"stack")}function qL(e){return kr(e,"fold")}function UL(e){return kr(e,"extent")&&!kr(e,"density")&&!kr(e,"regression")}function IL(e,t){const{transform:n,...i}=e;if(n){return{...i,transform:n.map((e=>{if(kL(e))return{filter:GL(e,t)};if(RL(e)&&Uo(e.bin))return{...e,bin:HL(e.bin)};if(DL(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}))}}return e}function WL(e,t){var n,i;const r=zi(e);if(JT(r)&&Uo(r.bin)&&(r.bin=HL(r.bin)),aP(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(VT(r))if(l(r.condition))r.condition=r.condition.map((e=>{const{selection:n,param:i,test:r,...a}=e;return i?e:{...a,test:GL(e,t)}}));else{const{selection:e,param:n,test:i,...a}=WL(r.condition,t);r.condition=n?r.condition:{...a,test:GL(r.condition,t)}}return r}function HL(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 GL(e,t){const n=e=>Bi(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):Bi(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class VL extends tL{map(e,t){const n=t.selections??[];if(e.params&&!PP(e)){const t=[];for(const i of e.params)$j(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 r=(t.path??[]).concat(e.name),a=[];for(const o of n)if(o.views&&o.views.length)for(const t of o.views)(i(t)&&(t===e.name||r.includes(t))||l(t)&&t.map((e=>r.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&a.push(o);else a.push(o);return a.length&&(e.params=a),e}}for(const KV of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const e=VL.prototype[KV];VL.prototype[KV]=function(t,n){return e.call(this,t,YL(t,n))}}function YL(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function XL(e,t){void 0===t&&(t=Yj(e.config));const n=function(e,t={}){const n={config:t};return KL.map(JL.map(QL.map(e,n),n),n)}(e,t),{width:i,height:r}=e,a=function(e,t,n){let{width:i,height:r}=t;const a=PP(e)||eL(e),o={};a?"container"==i&&"container"==r?(o.type="fit",o.contains="padding"):"container"==i?(o.type="fit-x",o.contains="padding"):"container"==r&&(o.type="fit-y",o.contains="padding"):("container"==i&&(yN(jO("width")),i=void 0),"container"==r&&(yN(jO("height")),r=void 0));const s={type:"pad",...o,...n?ZL(n.autosize):{},...ZL(e.autosize)};"fit"!==s.type||a||(yN(PO),s.type="pad");"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&yN(LO("width"));"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&yN(LO("height"));if(_r(s,{type:"pad"}))return;return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...a?{autosize:a}:{}}}const JL=new class extends tL{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[ij,uj,pj,new hL,new wL]}map(e,t){if(PP(e)){const n=LP(e.encoding,Dr),i=LP(e.encoding,Fr),r=LP(e.encoding,Cr);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=mL(e.encoding,t.repeater),a={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{},...r?{encoding:r}:{}};if(n||i)return this.mapUnitWithParentEncodingOrProjection(a,t);const o=this.mapLayerOrUnit.bind(this);for(const s of this.nonFacetUnitNormalizers)if(s.hasMatchingType(a,t.config))return s.run(a,t,o);return a}mapRepeat(e,t){return function(e){return!l(e.repeat)&&kr(e.repeat,"layer")}(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){const{repeat:n,spec:i,...r}=e,{row:a,column:o,layer:s}=n,{repeater:u={},repeaterPrefix:l=""}=t;return a||o?this.mapRepeat({...e,repeat:{...a?{row:a}:{},...o?{column:o}:{}},spec:{repeat:{layer:s},spec:i}},t):{...r,layer:s.map((e=>{const n={...u,layer:e},r=`${(i.name?`${i.name}_`:"")+l}child__layer_${tr(e)}`,a=this.mapLayerOrUnit(i,{...t,repeater:n,repeaterPrefix:r});return a.name=r,a}))}}mapNonLayerRepeat(e,t){const{repeat:n,spec:i,data:r,...a}=e;!l(n)&&e.columns&&(e=Ri(e,["columns"]),yN(VO("repeat")));const o=[],{repeater:s={},repeaterPrefix:u=""}=t,c=!l(n)&&n.row||[s?s.row:null],f=!l(n)&&n.column||[s?s.column:null],d=l(n)&&n||[s?s.repeat:null];for(const p of d)for(const e of c)for(const r of f){const a={repeat:p,row:e,column:r,layer:s.layer},c=(i.name?`${i.name}_`:"")+u+"child__"+(l(n)?`${tr(p)}`:(n.row?`row_${tr(e)}`:"")+(n.column?`column_${tr(r)}`:"")),f=this.map(i,{...t,repeater:a,repeaterPrefix:c});f.name=c,o.push(Ri(f,["data"]))}const h=l(n)?e.columns:n.column?n.column.length:1;return{data:i.data??r,align:"all",...a,columns:h,concat:o}}mapFacet(e,t){const{facet:n}=e;return PT(n)&&e.columns&&(e=Ri(e,["columns"]),yN(VO("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:a,config:o}=t,s=AL({parentProjection:a,projection:i}),u=_L({parentEncoding:r,encoding:mL(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...u?{encoding:u}:{}},{config:o})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...a}=e.encoding,{mark:o,width:s,projection:u,height:l,view:c,params:f,encoding:d,...h}=e,{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),g=mL(a,t.repeater);return this.mapFacet({...h,...m,facet:p,spec:{...s?{width:s}:{},...l?{height:l}:{},...c?{view:c}:{},...u?{projection:u}:{},mark:o,encoding:g,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&yN(`Facet encoding dropped as ${(a=[...n?[Dr]:[],...i?[Fr]:[]]).join(" and ")} ${a.length>1?"are":"is"} also specified.`);const t={},o={};for(const n of[Dr,Fr]){const i=e[n];if(i){const{align:e,center:r,spacing:a,columns:s,...u}=i;t[n]=u;for(const t of["align","center","spacing"])void 0!==i[t]&&(o[t]??(o[t]={}),o[t][n]=i[t])}}return{facetMapping:t,layout:o}}{const{align:e,center:n,spacing:i,columns:a,...o}=r;return{facetMapping:pL(o,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...i?{spacing:i}:{},...a?{columns:a}:{}}}}var a}mapLayer(e,{parentEncoding:t,parentProjection:n,...i}){const{encoding:r,projection:a,...o}=e,s={...i,parentEncoding:_L({parentEncoding:t,encoding:r,layer:!0}),parentProjection:AL({parentProjection:n,projection:a})};return super.mapLayer({...o,...e.name?{name:[s.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{}},s)}},QL=new class extends tL{map(e,t){return t.emptySelections??(t.emptySelections={}),t.selectionPredicates??(t.selectionPredicates={}),e=IL(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=IL(e,t)).encoding){const n={};for(const[i,r]of Zi(e.encoding))n[i]=WL(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:Zi(n).map((([e,n])=>{const{init:i,bind:r,empty:a,...o}=n;"single"===o.type?(o.type="point",o.toggle=!1):"multi"===o.type&&(o.type="point"),t.emptySelections[e]="none"!==a;for(const s of Ki(t.selectionPredicates[e]??{}))s.empty="none"!==a;return{name:e,value:i,select:o,bind:r}}))}:e}},KL=new VL;function ZL(e){return i(e)?{type:e}:e??{}}const eq=["background","padding"];function tq(e,t){const n={};for(const i of eq)e&&void 0!==e[i]&&(n[i]=ns(e[i]));return t&&(n.params=e.params),n}class nq{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new nq(zi(this.explicit),zi(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return hr(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 Qi(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function iq(e){return{explicit:!0,value:e}}function rq(e){return{explicit:!1,value:e}}function aq(e){return(t,n,i,r)=>{const a=e(t.value,n.value);return a>0?t:a<0?n:oq(t,n,i,r)}}function oq(e,t,n,i){return e.explicit&&t.explicit&&yN(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${Ar(n)} and ${Ar(i)}). Using ${Ar(n)}.`}(n,i,e.value,t.value)),e}function sq(e,t,n,i,r=oq){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:_r(e.value,t.value)?e:r(e,t,n,i)}class uq extends nq{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 lq(e){return kr(e,"url")}function cq(e){return kr(e,"values")}function fq(e){return kr(e,"name")&&!lq(e)&&!cq(e)&&!dq(e)}function dq(e){return e&&(hq(e)||pq(e)||mq(e))}function hq(e){return kr(e,"sequence")}function pq(e){return kr(e,"sphere")}function mq(e){return kr(e,"graticule")}var gq,yq;function vq({invalid:e,isPath:t}){switch(dT(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"}}}(yq=gq||(gq={}))[yq.Raw=0]="Raw",yq[yq.Main=1]="Main",yq[yq.Row=2]="Row",yq[yq.Column=3]="Column",yq[yq.Lookup=4]="Lookup",yq[yq.PreFilterInvalid=5]="PreFilterInvalid",yq[yq.PostFilterInvalid=6]="PostFilterInvalid";class bq{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)?yN("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 xq extends bq{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 ${mr()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}function wq(e){return void 0!==e.as}function _q(e){return`${e}_end`}class Aq extends bq{clone(){return new Aq(null,zi(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:a}=n;if(a){let o;if(CN(a)){if(KG(t)){const{mark:e,markDef:i,config:s}=t,u=IT({fieldDef:n,markDef:i,config:s});(ZR(e)||u)&&(o={timeUnit:RN(a),field:r})}}else o={as:cP(n,{forAs:!0}),field:r,timeUnit:a};if(KG(t)){const{mark:e,markDef:r,config:a}=t,s=IT({fieldDef:n,markDef:r,config:a});ZR(e)&&io(i)&&.5!==s&&(o.rectBandPosition=s)}o&&(e[Ti(o)]=o)}return e}),{});return Ji(n)?null:new Aq(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:RN(n)};return new Aq(e,{[Ti(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 Zi(this.timeUnits)){const r=wq(i)?i.as:`${i.field}_end`;e.has(r)||(t[n]=i)}this.timeUnits=t}producedFields(){return new Set(Ki(this.timeUnits).map((e=>wq(e)?e.as:_q(e.field))))}dependentFields(){return new Set(Ki(this.timeUnits).map((e=>e.field)))}hash(){return`TimeUnit ${Ti(this.timeUnits)}`}assemble(){const e=[];for(const t of Ki(this.timeUnits)){const{rectBandPosition:n}=t,i=RN(t.timeUnit);if(wq(t)){const{field:r,as:a}=t,{unit:o,utc:s,...u}=i,l=[a,`${a}_end`];e.push({field:lr(r),type:"timeunit",...o?{units:MN(o)}:{},...s?{timezone:"utc"}:{},...u,as:l}),e.push(...Cq(l,n,i))}else if(t){const{field:r}=t,a=r.replaceAll("\\.","."),o=Fq({timeUnit:i,field:a}),s=_q(a);e.push({type:"formula",expr:o,as:s}),e.push(...Cq([a,s],n,i))}}return e}}const kq="offsetted_rect_start",Dq="offsetted_rect_end";function Fq({timeUnit:e,field:t,reverse:n}){const{unit:i,utc:r}=e,a=BN(i),{part:o,step:s}=jN(a,e.step);return`${r?"utcOffset":"timeOffset"}('${o}', ${sr(t)}, ${n?-s:s})`}function Cq([e,t],n,i){if(void 0!==n&&.5!==n){const r=sr(e),a=sr(t);return[{type:"formula",expr:Eq([Fq({timeUnit:i,field:e,reverse:!0}),r],n+.5),as:`${e}_${kq}`},{type:"formula",expr:Eq([r,a],n+.5),as:`${e}_${Dq}`}]}return[]}function Eq([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const $q="_tuple_fields";class Sq{constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const Mq={defined:()=>!0,parse:(e,n,i)=>{const r=n.name,a=n.project??(n.project=new Sq),s={},u={},l=new Set,f=(e,t)=>{const n="visual"===t?e.channel:e.field;let i=tr(`${r}_${n}`);for(let a=1;l.has(i);a++)i=tr(`${r}_${n}_${a}`);return l.add(i),{[t]:i}},d=n.type,h=e.config.selection[d],p=void 0!==i.value?c(i.value):null;let{fields:m,encodings:g}=o(i.select)?i.select:{};if(!m&&!g&&p)for(const c of p)if(o(c))for(const e of Qi(c))t(Ca,e)?(g||(g=[])).push(e):"interval"===d?(yN('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),g=h.encodings):(m??(m=[])).push(e);m||g||(g=h.encodings,"fields"in h&&(m=h.fields));for(const t of g??[]){const n=e.fieldDef(t);if(n){let i=n.field;if(n.aggregate){yN(WO(t,n.aggregate));continue}if(!i){yN(IO(t));continue}if(n.timeUnit&&!CN(n.timeUnit)){i=e.vgField(t);const r={timeUnit:n.timeUnit,as:i,field:n.field};u[Ti(r)]=r}if(!s[i]){const r={field:i,channel:t,type:"interval"===d&&ko(t)&&AR(e.getScaleComponent(t).get("type"))?"R":n.bin?"R-RE":"E",index:a.items.length};r.signals={...f(r,"data"),...f(r,"visual")},a.items.push(s[i]=r),a.hasField[i]=s[i],a.hasSelectionId=a.hasSelectionId||i===Dj,da(t)?(r.geoChannel=t,r.channel=fa(t),a.hasChannel[r.channel]=s[i]):a.hasChannel[t]=s[i]}}else yN(IO(t))}for(const t of m??[]){if(a.hasField[t])continue;const e={type:"E",field:t,index:a.items.length};e.signals={...f(e,"data")},a.items.push(e),a.hasField[t]=e,a.hasSelectionId=a.hasSelectionId||t===Dj}p&&(n.init=p.map((e=>a.items.map((t=>o(e)?void 0!==e[t.geoChannel||t.channel]?e[t.geoChannel||t.channel]:e[t.field]:e))))),Ji(u)||(a.timeUnit=new Aq(null,u))},signals:(e,t,n)=>{const i=t.name+$q;return n.filter((e=>e.name===i)).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(Uq)})}},Bq="_curr",zq="anim_value",Oq="anim_clock",Nq="eased_anim_clock",Rq="min_extent",Tq="max_range_extent",Pq="last_tick_at",jq="is_playing",Lq=1/60*1e3,qq={defined:e=>"point"===e.type,topLevelSignals:(e,t,n)=>(iI(t)&&(n=n.concat([{name:Oq,init:"0",on:[{events:{type:"timer",throttle:Lq},update:`${jq} ? (${Oq} + (now() - ${Pq}) > ${Tq} ? 0 : ${Oq} + (now() - ${Pq})) : ${Oq}`}]},{name:Pq,init:"now()",on:[{events:[{signal:Oq},{signal:jq}],update:"now()"}]},{name:jq,init:"true"}])),n),signals:(e,t,n)=>{const i=t.name,r=i+$q,o=t.project,s="(item().isVoronoi ? datum.datum : datum)",u=Ki(e.component.selection??{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+Qq):e),[]).map((e=>`indexof(item().mark.name, '${e}') < 0`)).join(" && "),l="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(u?` && ${u}`:"");let c=`unit: ${eI(e)}, `;if(t.project.hasSelectionId)c+=`${Dj}: ${s}[${a(Dj)}]`;else if(iI(t))c+=`fields: ${r}, values: [${zq} ? ${zq} : ${Rq}]`;else{c+=`fields: ${r}, values: [${o.items.map((t=>{const n=e.fieldDef(t.channel);return(null==n?void 0:n.bin)?`[${s}[${a(e.vgField(t.channel,{}))}], ${s}[${a(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${s}[${a(t.field)}]`})).join(", ")}]`}if(iI(t))return n.concat((f=t.name,d=e.scaleName(Ur),[{name:Nq,update:Oq},{name:`${f}_domain`,init:`domain('${d}')`},{name:Rq,init:`extent(${f}_domain)[0]`},{name:Tq,init:`extent(range('${d}'))[1]`},{name:zq,update:`invert('${d}', ${Nq})`}]),[{name:i+JU,on:[{events:[{signal:Nq},{signal:zq}],update:`{${c}}`,force:!0}]}]);{const e=t.events;return n.concat([{name:i+JU,on:e?[{events:e,update:`${l} ? {${c}} : null`,force:!0}]:[]}])}var f,d}};function Uq(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=lr(r.field),r}function Iq(e,t=!0,n=y){if(l(e)){const i=e.map((e=>Iq(e,t,n)));return t?`[${i.join(", ")}]`:i}return vN(e)?n(t?kN(e):function(e){const t=AN(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(Ar(e)):e}function Wq(e,t){for(const n of Ki(e.component.selection??{})){const i=n.name;let r=`${i}${JU}, ${"global"===n.resolve?"true":`{unit: ${eI(e)}}`}`;for(const a of ZU)a.defined(n)&&(a.signals&&(t=a.signals(e,n,t)),a.modifyExpr&&(r=a.modifyExpr(e,n,r)));t.push({name:i+QU,on:[{events:{signal:n.name+JU},update:`modify(${a(n.name+XU)}, ${r})`}]})}return Vq(t)}function Hq(e,t){if(e.component.selection&&Qi(e.component.selection).length){const n=a(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:US("pointermove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return Vq(t)}function Gq(e,t){for(const n of Ki(e.component.selection??{}))for(const i of ZU)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function Vq(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}const Yq={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(!ko(r))continue;const a=e.getScaleComponent(r),o=a?a.get("type"):void 0;"sequential"==o&&yN("Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc"),a&&AR(o)?(a.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):yN("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||Jq(e)||0===i.length)return n;const r=n.find((e=>e.name===t.name));let o=r.update;if(o.includes(KU))r.update=`{${i.map((e=>`${a(lr(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of i){const t=`${a(lr(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&&!Jq(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 Xq(e,t){return`domain(${a(e.scaleName(t))})`}function Jq(e){return e.parent&&tV(e.parent)&&(!e.parent.parent||Jq(e.parent.parent))}const Qq="_brush",Kq="_scale_trigger",Zq="geo_interval_init_tick",eU="_init",tU={defined:e=>"interval"===e.type,parse:(e,t,n)=>{var i;if(e.hasProjection){const e={...o(n.select)?n.select:{}};e.fields=[Dj],e.encodings||(e.encodings=n.value?Qi(n.value):[jr,Pr]),n.select={type:"interval",...e}}if(t.translate&&!Yq.defined(t)){const e=`!event.item || event.item.mark.name !== ${a(t.name+Qq)}`;for(const n of t.events){if(!n.between){yN(`${n} is not an ordered event stream for interval selections.`);continue}const t=c((i=n.between[0]).filter??(i.filter=[]));t.includes(e)||t.push(e)}}},signals:(e,t,n)=>{const i=t.name,r=i+JU,o=Ki(t.project.hasChannel).filter((e=>e.channel===Er||e.channel===$r)),s=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,s=n.signals.visual,u=a(r?e.scaleName(o):e.projectionName()),l=e=>`scale(${u}, ${e})`,c=e.getSizeSignalRef(o===Er?"width":"height").signal,f=`${o}(unit)`,d=t.events.reduce(((e,t)=>[...e,{events:t.between[0],update:`[${f}, ${f}]`},{events:t,update:`[${s}[0], clamp(${f}, 0, ${c})]`}]),[]);if(r){const r=n.signals.data,a=Yq.defined(t),c=e.getScaleComponent(o),f=c?c.get("type"):void 0,h=i?{init:Iq(i,!0,l)}:{value:[]};return d.push({events:{signal:t.name+Kq},update:AR(f)?`[${l(`${r}[0]`)}, ${l(`${r}[1]`)}]`:"[0, 0]"}),a?[{name:r,on:[]}]:[{name:s,...h,on:d},{name:r,...i?{init:Iq(i)}:{},on:[{events:{signal:s},update:`${s}[0] === ${s}[1] ? null : invert(${u}, ${s})`}]}]}{const e=o===Er?0:1,n=t.name+eU;return[{name:s,...i?{init:`[${n}[0][${e}], ${n}[1][${e}]]`}:{value:[]},on:d}]}}(e,t,i,s&&s[i.index]))),[])),e.hasProjection){const u=a(e.projectionName()),l=e.projectionName()+"_center",{x:c,y:f}=t.project.hasChannel,d=c&&c.signals.visual,h=f&&f.signals.visual,p=c?s&&s[c.index]:`${l}[0]`,m=f?s&&s[f.index]:`${l}[1]`,g=t=>e.getSizeSignalRef(t).signal,y=`[[${d?d+"[0]":"0"}, ${h?h+"[0]":"0"}],[${d?d+"[1]":g("width")}, ${h?h+"[1]":g("height")}]]`;if(s&&(n.unshift({name:i+eU,init:`[scale(${u}, [${c?p[0]:p}, ${f?m[0]:m}]), scale(${u}, [${c?p[1]:p}, ${f?m[1]:m}])]`}),!c||!f)){n.find((e=>e.name===l))||n.unshift({name:l,update:`invert(${u}, [${g("width")}/2, ${g("height")}/2])`})}const v=`vlSelectionTuples(${`intersect(${y}, {markname: ${a(e.getName("marks"))}}, unit.mark)`}, ${`{unit: ${eI(e)}}`})`,b=o.map((e=>e.signals.visual));return n.concat({name:r,on:[{events:[...b.length?[{signal:b.join(" || ")}]:[],...s?[{signal:Zq}]:[]],update:v}]})}{if(!Yq.defined(t)){const t=i+Kq,r=o.map((t=>{const n=t.channel,{data:i,visual:r}=t.signals,o=a(e.scaleName(n)),s=AR(e.getScaleComponent(n).get("type"))?"+":"";return`(!isArray(${i}) || (${s}invert(${o}, ${r})[0] === ${s}${i}[0] && ${s}invert(${o}, ${r})[1] === ${s}${i}[1]))`}));r.length&&n.push({name:t,value:{},on:[{events:o.map((t=>({scale:e.scaleName(t.channel)}))),update:r.join(" && ")+` ? ${t} : {}`}]})}const u=o.map((e=>e.signals.data)),l=`unit: ${eI(e)}, fields: ${i+$q}, values`;return n.concat({name:r,...s?{init:`{${l}: ${Iq(s)}}`}:{},...u.length?{on:[{events:[{signal:u.join(" || ")}],update:`${u.join(" && ")} ? {${l}: [${u}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(KG(e)&&e.hasProjection&&t.init){n.filter((e=>e.name===Zq)).length||n.unshift({name:Zq,value:null,on:[{events:"timer{1}",update:`${Zq} === null ? {} : ${Zq}`}]})}return n},marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,s=null==r?void 0:r.signals.visual,u=null==o?void 0:o.signals.visual,l=`data(${a(t.name+XU)})`;if(Yq.defined(t)||!r&&!o)return n;const c={x:void 0!==r?{signal:`${s}[0]`}:{value:0},y:void 0!==o?{signal:`${u}[0]`}:{value:0},x2:void 0!==r?{signal:`${s}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${u}[1]`}:{field:{group:"height"}}};if("global"===t.resolve)for(const a of Qi(c))c[a]=[{test:`${l}.length && ${l}[0].unit === ${eI(e)}`,...c[a]},{value:0}];const{fill:f,fillOpacity:d,cursor:h,...p}=t.mark,m=Qi(p).reduce(((e,t)=>(e[t]=[{test:[void 0!==r&&`${s}[0] !== ${s}[1]`,void 0!==o&&`${u}[0] !== ${u}[1]`].filter((e=>e)).join(" && "),value:p[t]},{value:null}],e)),{}),g=h??(t.translate?"move":null);return[{name:`${i+Qq}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:d}},update:c}},...n,{name:i+Qq,type:"rect",clip:!0,encode:{enter:{...g?{cursor:{value:g}}:{},fill:{value:"transparent"}},update:{...c,...m}}}]}};function nU({model:e,channelDef:t,vgChannel:n,invalidValueRef:i,mainRefFn:r}){const a=VT(t)&&t.condition;let o=[];if(a){o=c(a).map((t=>{const n=r(t);if(function(e){return kr(e,"param")}(t)){const{param:i,empty:r}=t;return{test:AW(e,{param:i,empty:r}),...n}}return{test:DW(e,t.test),...n}}))}void 0!==i&&o.push(i);const s=r(t);return void 0!==s&&o.push(s),o.length>1||1===o.length&&Boolean(o[0].test)?{[n]:o}:1===o.length?{[n]:o[0]}:{}}function iU(e,t="text"){const n=e.encoding[t];return nU({model:e,channelDef:n,vgChannel:t,mainRefFn:t=>rU(t,e.config),invalidValueRef:void 0})}function rU(e,t,n="datum"){if(e){if(rP(e))return rs(e.value);if(nP(e)){const{format:i,formatType:r}=vP(e);return kT({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function aU(e,t={}){const{encoding:n,markDef:r,config:a,stack:s}=e,u=n.tooltip;if(l(u))return{tooltip:sU({tooltip:u},s,a,t)};{const l=t.reactiveGeom?"datum.datum":"datum";return nU({model:e,channelDef:u,vgChannel:"tooltip",mainRefFn:e=>{const u=rU(e,a,l);if(u)return u;if(null===e)return;let c=ls("tooltip",r,a);return!0===c&&(c={content:"encoding"}),i(c)?{value:c}:o(c)?Xo(c)?c:"encoding"===c.content?sU(n,s,a,t):{signal:l}:void 0},invalidValueRef:void 0})}}function oU(e,t,n,{reactiveGeom:i}={}){const r={...n,...n.tooltipFormat},a=new Set,o=i?"datum.datum":"datum",s=[];function u(n,i){const u=Ma(i),l=iP(n)?n:{...n,type:e[u].type},f=l.title||yP(l,r),d=c(f).join(", ").replaceAll(/"/g,'\\"');let h;if(io(i)){const t="x"===i?"x2":"y2",n=bP(e[t]);if(qo(l.bin)&&n){const e=cP(l,{expr:o}),i=cP(n,{expr:o}),{format:s,formatType:u}=vP(l);h=BT(e,i,s,u,r),a.add(t)}}if((io(i)||i===Rr||i===Or)&&t&&t.fieldChannel===i&&"normalize"===t.offset){const{format:e,formatType:t}=vP(l);h=kT({fieldOrDatumDef:l,format:e,formatType:t,expr:o,config:r,normalizeStack:!0}).signal}h??(h=rU(l,r,o).signal),s.push({channel:i,key:d,value:h})}VP(e,((e,t)=>{JT(e)?u(e,t):YT(e)&&u(e.condition,t)}));const l={};for(const{channel:c,key:f,value:d}of s)a.has(c)||l[f]||(l[f]=d);return l}function sU(e,t,n,{reactiveGeom:i}={}){const r=oU(e,t,n,{reactiveGeom:i}),a=Zi(r).map((([e,t])=>`"${e}": ${t}`));return a.length>0?{signal:`{${a.join(", ")}}`}:void 0}function uU(e){const{markDef:t,config:n}=e,i=ls("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...lU(e),...cU(e)}}function lU(e){const{mark:n,markDef:i,config:r}=e;if(!1===r.aria)return{};const a=ls("ariaRoleDescription",i,r);return null!=a?{ariaRoleDescription:{value:a}}:t(Zo,n)?{}:{ariaRoleDescription:{value:n}}}function cU(e){const{encoding:t,markDef:n,config:i,stack:r}=e,a=t.description;if(a)return nU({model:e,channelDef:a,vgChannel:"description",mainRefFn:t=>rU(t,e.config),invalidValueRef:void 0});const o=ls("description",n,i);if(null!=o)return{description:rs(o)};if(!1===i.aria)return{};const s=oU(t,r,i);return Ji(s)?void 0:{description:{signal:Zi(s).map((([e,t],n)=>`"${n>0?"; ":""}${e}: " + (${t})`)).join(" + ")}}}function fU(e,t,n={}){const{markDef:i,encoding:r,config:a}=t,{vgChannel:o}=n;let{defaultRef:s,defaultValue:u}=n;const l=r[e];void 0===s&&(u??(u=ls(e,i,a,{vgChannel:o,ignoreVgConfig:!VT(l)})),void 0!==u&&(s=rs(u)));const c={markDef:i,config:a,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},f=mT({...c,scaleChannel:e,channelDef:l});return nU({model:t,channelDef:l,vgChannel:o??e,invalidValueRef:f,mainRefFn:t=>xT({...c,channel:e,channelDef:t,stack:null,defaultRef:s})})}function dU(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:a}=n,o=t.filled??ls("filled",n,r),s=ji(["bar","point","circle","square","geoshape"],a)?"transparent":void 0,u=ls(!0===o?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===o&&"color"]??s,l=ls(!1===o?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===o&&"color"],c=o?"fill":"stroke",f={...u?{fill:rs(u)}:{},...l?{stroke:rs(l)}:{}};return n.color&&(o?n.fill:n.stroke)&&yN(ZO("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...fU("color",e,{vgChannel:c,defaultValue:o?u:l}),...fU("fill",e,{defaultValue:i.fill?u:void 0}),...fU("stroke",e,{defaultValue:i.stroke?l:void 0})}}function hU(e){const{encoding:t,mark:n}=e,i=t.order;return!KR(n)&&rP(i)?nU({model:e,channelDef:i,vgChannel:"zindex",mainRefFn:e=>rs(e.value),invalidValueRef:void 0}):{}}function pU({channel:e,markDef:t,encoding:n={},model:i,bandPosition:r}){const a=`${e}Offset`,o=t[a],s=n[a];if(("xOffset"===a||"yOffset"===a)&&s){return{offsetType:"encoding",offset:xT({channel:a,channelDef:s,markDef:t,config:null==i?void 0:i.config,scaleName:i.scaleName(a),scale:i.getScaleComponent(a),stack:null,defaultRef:rs(o),bandPosition:r})}}const u=t[a];return u?{offsetType:"visual",offset:u}:{}}function mU(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:a,config:o,stack:s}=t,u=r[e],l=r[za(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=pU({channel:e,markDef:a,encoding:r,model:t,bandPosition:.5}),p=gU({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),m=!u&&io(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:a,markDef:o}=e;if(nP(n)&&r&&t===r.fieldChannel){if(JT(n)){let e=n.bandPosition;if(void 0!==e||"text"!==o.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return bT({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:a})}return vT(n,i,{suffix:"end"},{offset:a})}return yT(e)}({channel:e,channelDef:u,channel2Def:l,markDef:a,config:o,scaleName:c,scale:f,stack:s,offset:d,defaultRef:p,bandPosition:"encoding"===h?0:void 0});return m?{[i||e]:m}:void 0}function gU({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:a,config:o}=e;return()=>{const s=Ma(n),u=Ba(n),l=ls(n,a,o,{vgChannel:u});if(void 0!==l)return wT(n,l);switch(t){case"zeroOrMin":return yU({scaleName:i,scale:r,mode:"zeroOrMin",mainChannel:s,config:o});case"zeroOrMax":return yU({scaleName:i,scale:r,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:s,config:o});case"mid":return{...e[Oa(n)],mult:.5}}}}function yU({mainChannel:e,config:t,...n}){const i=pT(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 vU={left:"x",center:"xc",right:"x2"},bU={top:"y",middle:"yc",bottom:"y2"};function xU(e,t,n,i="middle"){if("radius"===e||"theta"===e)return Ba(e);const r="x"===e?"align":"baseline",a=ls(r,t,n);let o;return Xo(a)?(yN(function(e){return`The ${e} for range marks cannot be an expression`}(r)),o=void 0):o=a,"x"===e?vU[o||("top"===i?"left":"center")]:bU[o||i]}function wU(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?_U(e,t,{defaultPos:n,defaultPos2:i}):mU(e,t,{defaultPos:n})}function _U(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:a}=t,o=za(e),s=Oa(e),u=function(e,t,n){const{encoding:i,mark:r,markDef:a,stack:o,config:s}=e,u=Ma(n),l=Oa(n),c=Ba(n),f=i[u],d=e.scaleName(u),h=e.getScaleComponent(u),{offset:p}=pU(n in i||n in a?{channel:n,markDef:a,encoding:i,model:e}:{channel:u,markDef:a,encoding:i,model:e});if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=Oa(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:a,scale:o,stack:s,offset:u,defaultRef:l}){if(nP(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0))return vT(t,a,{suffix:"start"},{offset:u});return yT({channel:e,channelDef:n,scaleName:a,scale:o,stack:s,markDef:i,config:r,offset:u,defaultRef:l})}({channel:n,channelDef:f,channel2Def:i[n],markDef:a,config:s,scaleName:d,scale:h,stack:o,offset:p,defaultRef:void 0});if(void 0!==m)return{[c]:m};return AU(n,a)||AU(n,{[n]:fs(n,a,s.style),[l]:fs(l,a,s.style)})||AU(n,s[r])||AU(n,s.mark)||{[c]:gU({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}(t,i,o);return{...mU(e,t,{defaultPos:n,vgChannel:u[s]?xU(e,r,a):Ba(e)}),...u}}function AU(e,t){const n=Oa(e),i=Ba(e);if(void 0!==t[i])return{[i]:wT(e,t[i])};if(void 0!==t[e])return{[i]:wT(e,t[e])};if(t[n]){const i=t[n];if(!sT(i))return{[n]:wT(e,i)};yN(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function kU(e,t){const{config:n,encoding:i,markDef:r}=e,a=r.type,o=za(t),s=Oa(t),u=i[t],c=i[o],f=e.getScaleComponent(t),d=f?f.get("type"):void 0,h=r.orient,p=i[s]??i.size??ls("size",r,n,{vgChannel:s}),m=Na(t),g="bar"===a&&("x"===t?"vertical"===h:"horizontal"===h)||"tick"===a&&("y"===t?"vertical"===h:"horizontal"===h);return!JT(u)||!(Lo(u.bin)||qo(u.bin)||u.timeUnit&&!c)||p&&!sT(p)||i[m]||_R(d)?(nP(u)&&_R(d)||g)&&!c?function(e,t,n){var i,r;const{markDef:a,encoding:o,config:s,stack:u}=n,c=a.orient,f=n.scaleName(t),d=n.getScaleComponent(t),h=Oa(t),p=za(t),m=Na(t),g=n.scaleName(m),y=n.getScaleComponent(Ra(t)),v="tick"===a.type||"horizontal"===c&&"y"===t||"vertical"===c&&"x"===t;let b;(o.size||a.size)&&(v?b=fU("size",n,{vgChannel:h,defaultRef:rs(a.size)}):yN(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(a.type)));const x=!!b,w=WT({channel:t,fieldDef:e,markDef:a,config:s,scaleType:null==(i=d||y)?void 0:i.get("type"),useVlSizeChannel:v});b=b||{[h]:DU(h,g||f,y||d,s,w,!!e,a.type)};const _="band"===(null==(r=d||y)?void 0:r.get("type"))&&sT(w)&&!x?"top":"middle",A=xU(t,a,s,_),k="xc"===A||"yc"===A,{offset:D,offsetType:F}=pU({channel:t,markDef:a,encoding:o,model:n,bandPosition:k?.5:0}),C=yT({channel:t,channelDef:e,markDef:a,config:s,scaleName:f,scale:d,stack:u,offset:D,defaultRef:gU({model:n,defaultPos:"mid",channel:t,scaleName:f,scale:d}),bandPosition:k?"encoding"===F?0:.5:Xo(w)?{signal:`(1-${w})/2`}:sT(w)?(1-w.band)/2:0});if(h)return{[A]:C,...b};{const e=Ba(p),t=b[h],n=D?{...t,offset:D}:t;return{[A]:C,[e]:l(C)?[C[0],{...C[1],offset:n}]:{...C,offset:n}}}}(u,t,e):_U(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:e,fieldDef2:t,channel:n,model:i}){var r;const{config:a,markDef:o,encoding:s}=i,u=i.getScaleComponent(n),l=i.scaleName(n),c=u?u.get("type"):void 0,f=u.get("reverse"),d=WT({channel:n,fieldDef:e,markDef:o,config:a,scaleType:c}),h=null==(r=i.component.axes[n])?void 0:r[0],p=(null==h?void 0:h.get("translate"))??.5,m=io(n)?ls("binSpacing",o,a)??0:0,g=za(n),y=Ba(n),v=Ba(g),b=cs("minBandSize",o,a),{offset:x}=pU({channel:n,markDef:o,encoding:s,model:i,bandPosition:0}),{offset:w}=pU({channel:g,markDef:o,encoding:s,model:i,bandPosition:0}),_=function({scaleName:e,fieldDef:t}){const n=cP(t,{expr:"datum"});return`abs(scale("${e}", ${cP(t,{expr:"datum",suffix:"end"})}) - scale("${e}", ${n}))`}({fieldDef:e,scaleName:l}),A=FU(n,m,f,p,x,b,_),k=FU(g,m,f,p,w??x,b,_),D=Xo(d)?{signal:`(1-${d.signal})/2`}:sT(d)?(1-d.band)/2:.5,F=IT({fieldDef:e,fieldDef2:t,markDef:o,config:a});if(Lo(e.bin)||e.timeUnit){const t=e.timeUnit&&.5!==F;return{[v]:CU({fieldDef:e,scaleName:l,bandPosition:D,offset:k,useRectOffsetField:t}),[y]:CU({fieldDef:e,scaleName:l,bandPosition:Xo(D)?{signal:`1-${D.signal}`}:1-D,offset:A,useRectOffsetField:t})}}if(qo(e.bin)){const n=vT(e,l,{},{offset:k});if(JT(t))return{[v]:n,[y]:vT(t,l,{},{offset:A})};if(Uo(e.bin)&&e.bin.step)return{[v]:n,[y]:{signal:`scale("${l}", ${cP(e,{expr:"datum"})} + ${e.bin.step})`,offset:A}}}return void yN(hN(g))}({fieldDef:u,fieldDef2:c,channel:t,model:e})}function DU(e,t,i,r,a,o,s){if(sT(a)){if(!i)return{mult:a.band,field:{group:e}};{const e=i.get("type");if("band"===e){let e=`bandwidth('${t}')`;1!==a.band&&(e=`${a.band} * ${e}`);const n=cs("minBandSize",{type:s},r);return{signal:n?`max(${os(n)}, ${e})`:e}}1!==a.band&&(yN(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),a=void 0)}}else{if(Xo(a))return a;if(a)return{value:a}}if(i){const e=i.get("range");if(Jo(e)&&n(e.step))return{value:e.step-2}}if(!o){const{bandPaddingInner:t,barBandPaddingInner:i,rectBandPaddingInner:a,tickBandPaddingInner:o}=r.scale,u=hr(t,"tick"===s?o:"bar"===s?i:a);if(Xo(u))return{signal:`(1 - (${u.signal})) * ${e}`};if(n(u))return{signal:`${1-u} * ${e}`}}return{value:jj(r.view,e)-2}}function FU(e,t,n,i,r,a,o){if(la(e))return 0;const s="x"===e||"y2"===e,u=s?-t/2:t/2;if(Xo(n)||Xo(r)||Xo(i)||a){const e=os(n),t=os(r),l=os(i),c=os(a),f=a?`(${o} < ${c} ? ${s?"":"-"}0.5 * (${c} - (${o})) : ${u})`:u;return{signal:(l?`${l} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${f})`:f)}}return r=r||0,i+(n?-r-u:+r+u)}function CU({fieldDef:e,scaleName:t,bandPosition:n,offset:i,useRectOffsetField:r}){return bT({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i,...r?{startSuffix:kq,endSuffix:Dq}:{}})}const EU=new Set(["aria","width","height"]);function $U(e,t){const{fill:n,stroke:i}="include"===t.color?dU(e):{};return{...MU(e.markDef,t),...SU("fill",n),...SU("stroke",i),...fU("opacity",e),...fU("fillOpacity",e),...fU("strokeOpacity",e),...fU("strokeWidth",e),...fU("strokeDash",e),...hU(e),...aU(e),...iU(e,"href"),...uU(e)}}function SU(e,t){return t?{[e]:t}:{}}function MU(e,t){return Ko.reduce(((n,i)=>(!EU.has(i)&&kr(e,i)&&"ignore"!==t[i]&&(n[i]=rs(e[i])),n)),{})}function BU(e){const{config:t,markDef:n}=e,i=new Set;if(e.forEachFieldDef(((r,a)=>{var o;let s;if(!ko(a)||!(s=e.getScaleType(a)))return;const u=Ro(r.aggregate),l=hT({scaleChannel:a,markDef:n,config:t,scaleType:s,isCountAggregate:u});if("break-paths-filter-domains"===(c=l)||"break-paths-show-domains"===c){const t=e.vgField(a,{expr:"datum",binSuffix:(null==(o=e.stack)?void 0:o.impute)?"mid":void 0});t&&i.add(t)}var c})),i.size>0){return{defined:{signal:[...i].map((e=>JN(e,!0))).join(" && ")}}}}function zU(e,t){if(void 0!==t)return{[e]:rs(t)}}const OU="voronoi",NU={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(OU)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,a=e.mark;if(KR(a))return yN(`The "nearest" transform is not supported for ${a} marks.`),n;const o={name:e.getName(OU),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...aU(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,u=!1;return n.forEach(((t,n)=>{const i=t.name??"";i===e.component.mark[0].name?s=n:i.includes(OU)&&(u=!0)})),u||n.splice(s+1,0,o),n}},RU={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!Cj(e.bind),parse:(e,t,n)=>nI(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,s=t.init&&t.init[0],u=NU.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach(((e,r)=>{const l=tr(`${i}_${e.field}`);n.filter((e=>e.name===l)).length||n.unshift({name:l,...s?{init:Iq(s[r])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${u}[${a(e.field)}] : null`}]:[],bind:o[e.field]??o[e.channel]??o})})),n},signals:(e,t,n)=>{const i=t.name,r=t.project,a=n.find((e=>e.name===i+JU)),o=i+$q,s=r.items.map((e=>tr(`${i}_${e.field}`))),u=s.map((e=>`${e} !== null`)).join(" && ");return s.length&&(a.update=`${u} ? {fields: ${o}, values: [${s.join(", ")}]} : null`),delete a.value,delete a.on,n}},TU="_toggle",PU={defined:e=>"point"===e.type&&!iI(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+TU,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+JU,i=t.name+TU;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${eI(e)}}, `)+`${i} ? ${n} : null`}},jU={defined:e=>void 0!==e.clear&&!1!==e.clear&&!iI(e),parse:(e,t)=>{t.clear&&(t.clear=i(t.clear)?US(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(RU.defined(t))for(const i of t.project.items){const e=n.findIndex((e=>e.name===tr(`${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+JU));i(e,"null"),PU.defined(t)&&(e=n.findIndex((e=>e.name===t.name+TU)),i(e,"false"))}return n}},LU={defined:e=>{const t="global"===e.resolve&&e.bind&&Cj(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==Dj;return t&&!n&&yN("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n)=>{const r=zi(n);if(r.select=i(r.select)?{type:r.select,toggle:t.toggle}:{...r.select,toggle:t.toggle},nI(t,r),o(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=c(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}const a=Ej(t.bind)?t.bind.legend:"click",s=i(a)?US(a,"view"):c(a);t.bind={legend:{merge:s}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=Ej(t.bind)&&t.bind.legend,a=e=>t=>{const n=zi(t);return n.markname=e,n};for(const o of t.project.items){if(!o.hasLegend)continue;const e=`${tr(o.field)}_legend`,s=`${i}_${e}`;if(0===n.filter((e=>e.name===s)).length){const i=r.merge.map(a(`${e}_symbols`)).concat(r.merge.map(a(`${e}_labels`))).concat(r.merge.map(a(`${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,a=n.find((e=>e.name===i+JU)),o=i+$q,s=r.items.filter((e=>e.hasLegend)).map((e=>tr(`${i}_${tr(e.field)}_legend`))),u=`${s.map((e=>`${e} !== null`)).join(" && ")} ? {fields: ${o}, values: [${s.join(", ")}]} : null`;t.events&&s.length>0?a.on.push({events:s.map((e=>({signal:e}))),update:u}):s.length>0&&(a.update=u,delete a.value,delete a.on);const l=n.find((e=>e.name===i+TU)),c=Ej(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push({...l.on[0],events:c}):l.on[0].events=c),n}};const qU="_translate_anchor",UU="_translate_delta",IU={defined:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=Yq.defined(t),a=i+qU,{x:o,y:s}=t.project.hasChannel;let u=US(t.translate,"scope");return r||(u=u.map((e=>(e.between[0].markname=i+Qq,e)))),n.push({name:a,value:{},on:[{events:u.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==o?`, extent_x: ${r?Xq(e,Er):`slice(${o.signals.visual})`}`:"")+(void 0!==s?`, extent_y: ${r?Xq(e,$r):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:i+UU,value:{},on:[{events:u,update:`{x: ${a}.x - x(unit), y: ${a}.y - y(unit)}`}]}),void 0!==o&&WU(e,t,o,"width",n),void 0!==s&&WU(e,t,s,"height",n),n}};function WU(e,t,n,i,r){const a=t.name,o=a+qU,s=a+UU,u=n.channel,l=Yq.defined(t),c=r.find((e=>e.name===n.signals[l?"data":"visual"])),f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(u),h=d&&d.get("type"),p=d&&d.get("reverse"),m=`${o}.extent_${u}`,g=`${l&&d?"log"===h?"panLog":"symlog"===h?"panSymlog":"pow"===h?"panPow":"panLinear":"panLinear"}(${m}, ${`${l?u===Er?p?"":"-":p?"-":"":""}${s}.${u} / ${l?`${f}`:`span(${m})`}`}${l?"pow"===h?`, ${d.get("exponent")??1}`:"symlog"===h?`, ${d.get("constant")??1}`:"":""})`;c.on.push({events:{signal:s},update:l?g:`clampRange(${g}, 0, ${f})`})}const HU="_zoom_anchor",GU="_zoom_delta",VU={defined:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=Yq.defined(t),o=i+GU,{x:s,y:u}=t.project.hasChannel,l=a(e.scaleName(Er)),c=a(e.scaleName($r));let f=US(t.zoom,"scope");return r||(f=f.map((e=>(e.markname=i+Qq,e)))),n.push({name:i+HU,on:[{events:f,update:r?"{"+[l?`x: invert(${l}, x(unit))`:"",c?`y: invert(${c}, y(unit))`:""].filter((e=>e)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:f,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==s&&YU(e,t,s,"width",n),void 0!==u&&YU(e,t,u,"height",n),n}};function YU(e,t,n,i,r){const a=t.name,o=n.channel,s=Yq.defined(t),u=r.find((e=>e.name===n.signals[s?"data":"visual"])),l=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(o),f=c&&c.get("type"),d=s?Xq(e,o):u.name,h=a+GU,p=`${s&&c?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${`${a}${HU}.${o}`}, ${h}${s?"pow"===f?`, ${c.get("exponent")??1}`:"symlog"===f?`, ${c.get("constant")??1}`:"":""})`;u.on.push({events:{signal:h},update:s?p:`clampRange(${p}, 0, ${l})`})}const XU="_store",JU="_tuple",QU="_modify",KU="vlSelectionResolve",ZU=[qq,tU,Mq,PU,RU,Yq,LU,jU,IU,VU,NU];function eI(e,{escape:t}={escape:!0}){let n=t?a(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!ZG(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of ya)e[t]&&(n+=` + '__facet_${t}_' + (facet[${a(i.vgField(t))}])`)}return n}function tI(e){return Ki(e.component.selection??{}).reduce(((e,t)=>e||t.project.hasSelectionId),!1)}function nI(e,t){!i(t.select)&&t.select.on||delete e.events,!i(t.select)&&t.select.clear||delete e.clear,!i(t.select)&&t.select.toggle||delete e.toggle}function iI(e){var t;return null==(t=e.events)?void 0:t.find((e=>"type"in e&&"timer"===e.type))}const rI="Property",aI="ArrayExpression",oI="BinaryExpression",sI="CallExpression",uI="ConditionalExpression",lI="LogicalExpression",cI="MemberExpression",fI="ObjectExpression",dI="UnaryExpression";function hI(e){this.type=e}var pI,mI,gI,yI,vI;hI.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case aI:return e.elements;case oI:case lI:return[e.left,e.right];case sI:return[e.callee].concat(e.arguments);case uI:return[e.test,e.consequent,e.alternate];case cI:return[e.object,e.property];case fI:return e.properties;case rI:return[e.key,e.value];case dI:return[e.argument];default:return[]}}(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};(pI={})[1]="Boolean",pI[2]="<end>",pI[3]="Identifier",pI[4]="Keyword",pI[5]="Null",pI[6]="Numeric",pI[7]="Punctuator",pI[8]="String",pI[9]="RegularExpression";var bI="Identifier",xI="Unexpected token %0",wI="Invalid regular expression",_I="Invalid regular expression: missing /",AI="Octal literals are not allowed in strict mode.",kI="ILLEGAL",DI="Disabled.",FI=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]"),CI=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 EI(e,t){if(!e)throw new Error("ASSERT: "+t)}function $I(e){return e>=48&&e<=57}function SI(e){return"0123456789abcdefABCDEF".includes(e)}function MI(e){return"01234567".includes(e)}function BI(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 zI(e){return 10===e||13===e||8232===e||8233===e}function OI(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&FI.test(String.fromCharCode(e))}function NI(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&CI.test(String.fromCharCode(e))}const RI={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 TI(){for(;gI<yI;){const e=mI.charCodeAt(gI);if(!BI(e)&&!zI(e))break;++gI}}function PI(e){var t,n,i,r=0;for(n="u"===e?4:2,t=0;t<n;++t)gI<yI&&SI(mI[gI])?(i=mI[gI++],r=16*r+"0123456789abcdef".indexOf(i.toLowerCase())):eW({},xI,kI);return String.fromCharCode(r)}function jI(){var e,t,n,i;for(t=0,"}"===(e=mI[gI])&&eW({},xI,kI);gI<yI&&SI(e=mI[gI++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&eW({},xI,kI),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function LI(){var e,t;for(e=mI.charCodeAt(gI++),t=String.fromCharCode(e),92===e&&(117!==mI.charCodeAt(gI)&&eW({},xI,kI),++gI,(e=PI("u"))&&"\\"!==e&&OI(e.charCodeAt(0))||eW({},xI,kI),t=e);gI<yI&&NI(e=mI.charCodeAt(gI));)++gI,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==mI.charCodeAt(gI)&&eW({},xI,kI),++gI,(e=PI("u"))&&"\\"!==e&&NI(e.charCodeAt(0))||eW({},xI,kI),t+=e);return t}function qI(){var e,t;return e=gI,t=92===mI.charCodeAt(gI)?LI():function(){var e,t;for(e=gI++;gI<yI;){if(92===(t=mI.charCodeAt(gI)))return gI=e,LI();if(!NI(t))break;++gI}return mI.slice(e,gI)}(),{type:1===t.length?3:RI.hasOwnProperty(t)?4:"null"===t?5:"true"===t||"false"===t?1:3,value:t,start:e,end:gI}}function UI(){var e,t,n,i,r=gI,a=mI.charCodeAt(gI),o=mI[gI];switch(a){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++gI,{type:7,value:String.fromCharCode(a),start:r,end:gI};default:if(61===(e=mI.charCodeAt(gI+1)))switch(a){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return gI+=2,{type:7,value:String.fromCharCode(a)+String.fromCharCode(e),start:r,end:gI};case 33:case 61:return gI+=2,61===mI.charCodeAt(gI)&&++gI,{type:7,value:mI.slice(r,gI),start:r,end:gI}}}return">>>="===(i=mI.substr(gI,4))?{type:7,value:i,start:r,end:gI+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:r,end:gI+=3}:o===(t=n.substr(0,2))[1]&&"+-<>&|".includes(o)||"=>"===t?{type:7,value:t,start:r,end:gI+=2}:("//"===t&&eW({},xI,kI),"<>=!+-*%&|^/".includes(o)?{type:7,value:o,start:r,end:++gI}:void eW({},xI,kI))}function II(){var e,t,n;if(EI($I((n=mI[gI]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=gI,e="","."!==n){if(e=mI[gI++],n=mI[gI],"0"===e){if("x"===n||"X"===n)return++gI,function(e){let t="";for(;gI<yI&&SI(mI[gI]);)t+=mI[gI++];return 0===t.length&&eW({},xI,kI),OI(mI.charCodeAt(gI))&&eW({},xI,kI),{type:6,value:parseInt("0x"+t,16),start:e,end:gI}}(t);if(MI(n))return function(e){let t="0"+mI[gI++];for(;gI<yI&&MI(mI[gI]);)t+=mI[gI++];return(OI(mI.charCodeAt(gI))||$I(mI.charCodeAt(gI)))&&eW({},xI,kI),{type:6,value:parseInt(t,8),octal:!0,start:e,end:gI}}(t);n&&$I(n.charCodeAt(0))&&eW({},xI,kI)}for(;$I(mI.charCodeAt(gI));)e+=mI[gI++];n=mI[gI]}if("."===n){for(e+=mI[gI++];$I(mI.charCodeAt(gI));)e+=mI[gI++];n=mI[gI]}if("e"===n||"E"===n)if(e+=mI[gI++],"+"!==(n=mI[gI])&&"-"!==n||(e+=mI[gI++]),$I(mI.charCodeAt(gI)))for(;$I(mI.charCodeAt(gI));)e+=mI[gI++];else eW({},xI,kI);return OI(mI.charCodeAt(gI))&&eW({},xI,kI),{type:6,value:parseFloat(e),start:t,end:gI}}function WI(){var e,t,n,i;return vI=null,TI(),e=gI,t=function(){var e,t,n,i;for(EI("/"===(e=mI[gI]),"Regular expression literal must start with a slash"),t=mI[gI++],n=!1,i=!1;gI<yI;)if(t+=e=mI[gI++],"\\"===e)zI((e=mI[gI++]).charCodeAt(0))&&eW({},_I),t+=e;else if(zI(e.charCodeAt(0)))eW({},_I);else if(n)"]"===e&&(n=!1);else{if("/"===e){i=!0;break}"["===e&&(n=!0)}return i||eW({},_I),{value:t.substr(1,t.length-2),literal:t}}(),n=function(){var e,t,n;for(t="",n="";gI<yI&&NI((e=mI[gI]).charCodeAt(0));)++gI,"\\"===e&&gI<yI?eW({},xI,kI):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&eW({},wI,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";eW({},wI)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(i){eW({},wI)}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:gI}}function HI(){if(TI(),gI>=yI)return{type:2,start:gI,end:gI};const e=mI.charCodeAt(gI);return OI(e)?qI():40===e||41===e||59===e?UI():39===e||34===e?function(){var e,t,n,i,r="",a=!1;for(EI("'"===(e=mI[gI])||'"'===e,"String literal must starts with a quote"),t=gI,++gI;gI<yI;){if((n=mI[gI++])===e){e="";break}if("\\"===n)if((n=mI[gI++])&&zI(n.charCodeAt(0)))"\r"===n&&"\n"===mI[gI]&&++gI;else switch(n){case"u":case"x":"{"===mI[gI]?(++gI,r+=jI()):r+=PI(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:MI(n)?(0!==(i="01234567".indexOf(n))&&(a=!0),gI<yI&&MI(mI[gI])&&(a=!0,i=8*i+"01234567".indexOf(mI[gI++]),"0123".includes(n)&&gI<yI&&MI(mI[gI])&&(i=8*i+"01234567".indexOf(mI[gI++]))),r+=String.fromCharCode(i)):r+=n}else{if(zI(n.charCodeAt(0)))break;r+=n}}return""!==e&&eW({},xI,kI),{type:8,value:r,octal:a,start:t,end:gI}}():46===e?$I(mI.charCodeAt(gI+1))?II():UI():$I(e)?II():UI()}function GI(){const e=vI;return gI=e.end,vI=HI(),gI=e.end,e}function VI(){const e=gI;vI=HI(),gI=e}function YI(e,t,n){const i=new hI("||"===e||"&&"===e?"LogicalExpression":"BinaryExpression");return i.operator=e,i.left=t,i.right=n,i}function XI(e,t){const n=new hI("CallExpression");return n.callee=e,n.arguments=t,n}function JI(e){const t=new hI(bI);return t.name=e,t}function QI(e){const t=new hI("Literal");return t.value=e.value,t.raw=mI.slice(e.start,e.end),e.regex&&("//"===t.raw&&(t.raw="/(?:)/"),t.regex=e.regex),t}function KI(e,t,n){const i=new hI("MemberExpression");return i.computed="["===e,i.object=t,i.property=n,i.computed||(n.member=!0),i}function ZI(e,t,n){const i=new hI("Property");return i.key=t,i.value=n,i.kind=e,i}function eW(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,((e,t)=>(EI(t<i.length,"Message reference must be in range"),i[t])));throw(n=new Error(r)).index=gI,n.description=r,n}function tW(e){2===e.type&&eW(e,"Unexpected end of input"),6===e.type&&eW(e,"Unexpected number"),8===e.type&&eW(e,"Unexpected string"),3===e.type&&eW(e,"Unexpected identifier"),4===e.type&&eW(e,"Unexpected reserved word"),eW(e,xI,e.value)}function nW(e){const t=GI();7===t.type&&t.value===e||tW(t)}function iW(e){return 7===vI.type&&vI.value===e}function rW(e){return 4===vI.type&&vI.value===e}function aW(){const e=[];for(gI=vI.start,nW("[");!iW("]");)iW(",")?(GI(),e.push(null)):(e.push(yW()),iW("]")||nW(","));return GI(),function(e){const t=new hI("ArrayExpression");return t.elements=e,t}(e)}function oW(){gI=vI.start;const e=GI();return 8===e.type||6===e.type?(e.octal&&eW(e,AI),QI(e)):JI(e.value)}function sW(){var e,t,n;return gI=vI.start,3===(e=vI).type?(n=oW(),nW(":"),ZI("init",n,yW())):2!==e.type&&7!==e.type?(t=oW(),nW(":"),ZI("init",t,yW())):void tW(e)}function uW(){var e,t,n=[],i={},r=String;for(gI=vI.start,nW("{");!iW("}");)t="$"+((e=sW()).key.type===bI?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(i,t)?eW({},"Duplicate data property in object literal not allowed in strict mode"):i[t]=!0,n.push(e),iW("}")||nW(",");return nW("}"),function(e){const t=new hI("ObjectExpression");return t.properties=e,t}(n)}const lW={if:1};function cW(){var e,t,n;if(iW("("))return function(){nW("(");const e=vW();return nW(")"),e}();if(iW("["))return aW();if(iW("{"))return uW();if(e=vI.type,gI=vI.start,3===e||lW[vI.value])n=JI(GI().value);else if(8===e||6===e)vI.octal&&eW(vI,AI),n=QI(GI());else{if(4===e)throw new Error(DI);1===e?((t=GI()).value="true"===t.value,n=QI(t)):5===e?((t=GI()).value=null,n=QI(t)):iW("/")||iW("/=")?(n=QI(WI()),VI()):tW(GI())}return n}function fW(){const e=[];if(nW("("),!iW(")"))for(;gI<yI&&(e.push(yW()),!iW(")"));)nW(",");return nW(")"),e}function dW(){return nW("."),function(){gI=vI.start;const e=GI();return function(e){return 3===e.type||4===e.type||1===e.type||5===e.type}(e)||tW(e),JI(e.value)}()}function hW(){nW("[");const e=vW();return nW("]"),e}function pW(){const e=function(){var e;for(e=cW();;)if(iW("."))e=KI(".",e,dW());else if(iW("("))e=XI(e,fW());else{if(!iW("["))break;e=KI("[",e,hW())}return e}();if(7===vI.type&&(iW("++")||iW("--")))throw new Error(DI);return e}function mW(){var e,t;if(7!==vI.type&&4!==vI.type)t=pW();else{if(iW("++")||iW("--"))throw new Error(DI);if(iW("+")||iW("-")||iW("~")||iW("!"))e=GI(),t=mW(),t=function(e,t){const n=new hI("UnaryExpression");return n.operator=e,n.argument=t,n.prefix=!0,n}(e.value,t);else{if(rW("delete")||rW("void")||rW("typeof"))throw new Error(DI);t=pW()}}return t}function gW(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 yW(){var e,t;return e=function(){var e,t,n,i,r,a,o,s,u,l;if(e=vI,u=mW(),0===(r=gW(i=vI)))return u;for(i.prec=r,GI(),t=[e,vI],a=[u,i,o=mW()];(r=gW(vI))>0;){for(;a.length>2&&r<=a[a.length-2].prec;)o=a.pop(),s=a.pop().value,u=a.pop(),t.pop(),n=YI(s,u,o),a.push(n);(i=GI()).prec=r,a.push(i),t.push(vI),n=mW(),a.push(n)}for(n=a[l=a.length-1],t.pop();l>1;)t.pop(),n=YI(a[l-1].value,a[l-2],n),l-=2;return n}(),iW("?")&&(GI(),t=yW(),nW(":"),e=function(e,t,n){const i=new hI("ConditionalExpression");return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,yW())),e}function vW(){const e=yW();if(iW(","))throw new Error(DI);return e}function bW(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...bW(e.object)),t.push(...bW(e.property))),t)}function xW(e){return"MemberExpression"===e.object.type?xW(e.object):"datum"===e.object.name}function wW(e){const t=function(e){gI=0,yI=(mI=e).length,vI=null,VI();const t=vW();if(2!==vI.type)throw new Error("Unexpect token after expression.");return t}(e),n=new Set;return t.visit((e=>{"MemberExpression"===e.type&&xW(e)&&n.add(bW(e).slice(1).join("."))})),n}class _W extends bq{clone(){return new _W(null,this.model,zi(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=DW(this.model,this.filter,this),this._dependentFields=wW(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function AW(e,t,n,r="datum"){const o=i(t)?t:t.param,s=tr(o),u=a(s+XU);let l;try{l=e.getSelectionComponent(s,o)}catch(d){return`!!${s}`}if(l.project.timeUnit){const t=n??e.component.data.raw,i=l.project.timeUnit.clone();t.parent?i.insertAsParentOf(t):t.parent=i}const c=`${l.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${u}, ${r}${"global"===l.resolve?")":`, ${a(l.resolve)})`}`,f=`length(data(${u}))`;return!1===t.empty?`${f} && ${c}`:`!${f} || ${c}`}function kW(e,t,n){const i=tr(t),r=n.encoding;let o,s=n.field;try{o=e.getSelectionComponent(i,t)}catch(u){return i}if(r||s){if(r&&!s){const e=o.project.items.filter((e=>e.channel===r));!e.length||e.length>1?(s=o.project.items[0].field,yN(function(e,t,n,i){return(e.length?"Multiple ":"No ")+`matching ${a(t)} encoding found for selection ${a(n.param)}. Using "field": ${a(i)}.`}(e,r,n,s))):s=e[0].field}}else s=o.project.items[0].field,o.project.items.length>1&&yN(function(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${a(e)}.`}(s));return`${o.name}[${a(lr(s))}]`}function DW(e,t,n){return nr(t,(t=>i(t)?t:function(e){return kr(e,"param")}(t)?AW(e,t,n):XN(t)))}function FW(e,t,n,i){var r,a;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(a=e.encode[t]).update??(a.update={}),e.encode[t].update[n]=i}function CW(e,t,n,i={header:!1}){var r,a;const{disable:o,orient:s,scale:u,labelExpr:f,title:d,zindex:h,...p}=e.combine();if(!o){for(const e in p){const n=e,i=zP[n],r=p[n];if(i&&i!==t&&"both"!==i)delete p[n];else if(MP(r)){const{condition:e,...t}=r,i=c(e),a=SP[n];if(a){const{vgProp:e,part:r}=a;FW(p,r,e,[...i.map((e=>{const{test:t,...n}=e;return{test:DW(null,t),...n}})),t]),delete p[n]}else if(null===a){const e={signal:i.map((e=>{const{test:t,...n}=e;return`${DW(null,t)} ? ${as(n)} : `})).join("")+as(t)};p[n]=e}}else if(Xo(r)){const e=SP[n];if(e){const{vgProp:t,part:i}=e;FW(p,i,t,r),delete p[n]}}ji(["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}:{}},Ji(p.encode)&&delete p.encode}return{scale:u,orient:s,...p,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:hr(h,0)}}{if(!i.header&&e.mainExtracted)return;if(void 0!==f){let e=f;(null==(a=null==(r=p.encode)?void 0:r.labels)?void 0:a.update)&&Xo(p.encode.labels.update.text)&&(e=cr(f,"datum.label",p.encode.labels.update.text.signal)),FW(p,"labels","text",{signal:e})}if(null===p.labelAlign&&delete p.labelAlign,p.encode){for(const t of BP)e.hasAxisPart(t)||delete p.encode[t];Ji(p.encode)&&delete p.encode}const t=function(e,t){if(e)return l(e)&&!Yo(e)?e.map((e=>yP(e,t))).join(", "):e}(d,n);return{scale:u,orient:s,grid:!1,...t?{title:t}:{},...p,...!1===n.aria?{aria:!1}:{},zindex:hr(h,0)}}}}function EW(e){const{axes:t}=e.component,n=[];for(const i of no)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 $W(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"]||{},a=t["x"===n?"axisTop":"axisRight"]||{},o=new Set([...Qi(r),...Qi(a)]),s={};for(const t of o.values())s[t]={signal:`${i.signal} === "${e}" ? ${os(r[t])} : ${os(a[t])}`};return s}return t[e]}))])}function SW(e,t){var n;const i=[{}];for(const r of e){let e=null==(n=t[r])?void 0:n.style;if(e){e=c(e);for(const n of e)i.push(t.style[n])}}return Object.assign.apply(null,i)}function MW(e,t,n,i={}){var r;const a=ds(e,n,t);if(void 0!==a)return{configFrom:"style",configValue:a};for(const o of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==(null==(r=i[o])?void 0:r[e]))return{configFrom:o,configValue:i[o][e]};return{}}const BW={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!_R(e)&&JT(t)&&!Lo(null==t?void 0:t.bin)&&!qo(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||NW(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||OW(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??function(e,t){if("x"===t&&ji(["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&&!o(i)||"nominal"!==e&&"ordinal"!==e)return"log"!==t&&"symlog"!==t||"greedy";return}(t.type,n,JT(t)&&!!t.timeUnit,JT(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{const a="x"===e?"width":"y"===e?"height":void 0,o=a?t.getSizeSignalRef(a):void 0;return n.tickCount??function({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){var r;if(!i&&!_R(t)&&"log"!==t){if(JT(e)){if(Lo(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&ji(["month","hours","day","quarter"],null==(r=RN(e.timeUnit))?void 0:r.unit))return}return{signal:`ceil(${n.signal}/40)`}}return}({fieldOrDatumDef:i,scaleType:r,size:o,values:n.values})},tickMinStep:function({format:e,fieldOrDatumDef:t}){if("d"===e)return 1;if(JT(t)){const{timeUnit:e}=t;if(e){const t=TN(e);if(t)return{signal:t}}}return},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=RW(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),a="x"===n?"x2":"y2",o=t.fieldDef(a);return ps(r?[qT(r)]:[],JT(o)?[qT(o)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;if(l(n))return EP(t,n);if(Xo(n))return n;return}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??function(e,t){if("rect"===e&&fP(t))return 1;return 0}(n,t)};function zW(e){return`(((${e.signal} % 360) + 360) % 360)`}function OW(e,t,n,i){if(void 0!==e){if("x"===n){if(Xo(e)){const n=zW(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${Xo(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45<e&&e<135||225<e&&e<315)return"middle";if(Xo(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(Xo(e)){const n=zW(e);return{signal:`${n} <= 45 || 315 <= ${n} || (135 <= ${n} && ${n} <= 225) ? ${i?'"middle"':"null"} : (45 <= ${n} && ${n} <= 135) === ${Xo(t)?`(${t.signal} === "left")`:"left"===t} ? "top" : "bottom"`}}if(e<=45||315<=e||135<=e&&e<=225)return i?"middle":null;if(Xo(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 NW(e,t,n){if(void 0===e)return;const i="x"===n,r=i?0:90,a=i?"bottom":"left";if(Xo(e)){const n=zW(e);return{signal:`(${r?`(${n} + 90)`:n} % 180 === 0) ? ${i?null:'"center"'} :(${r} < ${n} && ${n} < ${180+r}) === ${Xo(t)?`(${t.signal} === "${a}")`:t===a} ? "left" : "right"`}}if((e+r)%180==0)return i?null:"center";if(Xo(t)){const n=r<e&&e<180+r?"===":"!==";return{signal:`${`${t.signal} ${n} "${a}"`} ? "left" : "right"`}}return(r<e&&e<180+r)==(t===a)?"left":"right"}function RW(e,t){const n="x"===t?"x2":"y2",i=e.fieldDef(t),r=e.fieldDef(n),a=i?i.title:void 0,o=r?r.title:void 0;return a&&o?ms(a,o):a||(o||(void 0!==a?a:void 0!==o?o:void 0))}class TW extends bq{clone(){return new TW(null,zi(this.transform))}constructor(e,t){super(e),this.transform=t,this._dependentFields=wW(this.transform.calculate)}static parseAllForSortIndex(e,t){return t.forEachFieldDef(((t,n)=>{if(aP(t)&&TT(t.sort)){const{field:i,timeUnit:r}=t,a=t.sort,o=a.map(((e,t)=>`${XN({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+a.length;e=new TW(e,{calculate:o,as:PW(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 ${Ti(this.transform)}`}}function PW(e,t,n){return cP(e,{prefix:t,suffix:"sort_index",...n})}function jW(e,t){return ji(["top","bottom"],t)?"column":ji(["left","right"],t)||"row"===e?"row":"column"}function LW(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return hr((t||{})[e],r[e],n.header[e])}function qW(e,t,n,i){const r={};for(const a of e){const e=LW(a,t||{},n,i);void 0!==e&&(r[a]=e)}return r}const UW=["row","column"],IW=["header","footer"];function WW(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:a,titleAngle:o,titleOrient:s}=qW(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),u=jW(t,s),l=br(o);return{name:`${t}-title`,type:"group",role:`${u}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...GW(l,u),...HW(u,l,a),...ZW(i,r,t,wj,bj)}}}function HW(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=NW(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function GW(e,t){const n=OW(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function VW(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of IW)if(n[r])for(const a of n[r]){const o=JW(e,t,r,n,a);null!=o&&i.push(o)}return i}function YW(e,t){const{sort:n}=e;return RT(n)?{field:cP(n,{expr:"datum"}),order:n.order??"ascending"}:l(n)?{field:PW(e,t,{expr:"datum"}),order:"ascending"}:{field:cP(e,{expr:"datum"}),order:n??"ascending"}}function XW(e,t,n){const{format:i,formatType:r,labelAngle:a,labelAnchor:o,labelOrient:s,labelExpr:u}=qW(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),l=kT({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=jW(t,s);return{text:{signal:u?cr(cr(u,"datum.label",l),"datum.value",cP(e,{expr:"parent"})):l},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...GW(a,c),...HW(c,a,o),...ZW(n,e,t,_j,xj)}}function JW(e,t,n,i,r){if(r){let a=null;const{facetFieldDef:o}=i,s=e.config?e.config:void 0;if(o&&r.labels){const{labelOrient:e}=qW(["labelOrient"],o.header,s,t);("row"===t&&!ji(["top","bottom"],e)||"column"===t&&!ji(["left","right"],e))&&(a=XW(o,t,s))}const u=ZG(e)&&!PT(e.facet),l=r.axes,c=(null==l?void 0:l.length)>0;if(a||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:YW(o,t)}:{},...c&&u?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...a?{title:a}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...c?{axes:l}:{}}}}return null}const QW={column:{start:0,end:1},row:{start:1,end:0}};function KW(e,t){return QW[t][e]}function ZW(e,t,n,i,r){const a={};for(const o of i){if(!r[o])continue;const i=LW(o,null==t?void 0:t.header,e,n);void 0!==i&&(a[r[o]]=i)}return a}function eH(e){return[...tH(e,"width"),...tH(e,"height"),...tH(e,"childWidth"),...tH(e,"childHeight")]}function tH(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"),a=t.get("range");if(_R(i)&&Jo(a)){const i=e.scaleName(n);if(ZG(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[nH(i,a)]}return[nH(i,a),{name:r,update:iH(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} : ${Pj(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function nH(e,t){const n=`${e}_step`;return Xo(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function iH(e,t,n){const i=t.get("type"),r=t.get("padding"),a=hr(t.get("paddingOuter"),r);let o=t.get("paddingInner");return o="band"===i?void 0!==o?o:r:1,`bandspace(${n}, ${os(o)}, ${os(a)}) * ${e}_step`}function rH(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function aH(e,t){return Qi(e).reduce(((n,i)=>({...n,...nU({model:t,channelDef:e[i],vgChannel:i,mainRefFn:e=>rs(e.value),invalidValueRef:void 0})})),{})}function oH(e,t){if(ZG(t))return"theta"===e?"independent":"shared";if(tV(t))return"shared";if(eV(t))return io(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function sH(e,t){const n=e.scale[t],i=io(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&yN(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 uH=Qi({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 lH extends nq{}const cH={symbols:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:a}){if("symbol"!==a)return;const{markDef:o,encoding:s,config:u,mark:c}=n,f=o.filled&&"trail"!==c;let d={...ss({},n,nT),...dU(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?fH(s.opacity)??o.opacity:void 0;if(d.fill)if("fill"===i||f&&i===Ir)delete d.fill;else if(kr(d.fill,"field"))p?delete d.fill:(d.fill=rs(u.legend.symbolBaseFillColor??"black"),d.fillOpacity=rs(g??1));else if(l(d.fill)){const e=dH(s.fill??s.color)??o.fill??(f&&o.color);e&&(d.fill=rs(e))}if(d.stroke)if("stroke"===i||!f&&i===Ir)delete d.stroke;else if(kr(d.stroke,"field")||m)delete d.stroke;else if(l(d.stroke)){const e=hr(dH(s.stroke||s.color),o.stroke,f?o.color:void 0);e&&(d.stroke={value:e})}if(i!==Xr){const e=JT(t)&&pH(n,r,t);e?d.opacity=[{test:e,...rs(g??1)},rs(u.legend.unselectedOpacity)]:g&&(d.opacity=rs(g))}return d={...d,...e},Ji(d)?void 0:d},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){if("gradient"!==n)return;const{config:r,markDef:a,encoding:o}=t;let s={};const u=void 0===(i.get("gradientOpacity")??r.legend.gradientOpacity)?fH(o.opacity)||a.opacity:void 0;u&&(s.opacity=rs(u));return s={...s,...e},Ji(s)?void 0:s},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const a=n.legend(i)||{},o=n.config,s=JT(t)?pH(n,r,t):void 0,u=s?[{test:s,value:1},{value:o.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=a;let f;_T(c)?f=FT({fieldOrDatumDef:t,field:"datum.value",format:l,formatType:c,config:o}):void 0===l&&void 0===c&&o.customFormatTypes&&("quantitative"===t.type&&o.numberFormatType?f=FT({fieldOrDatumDef:t,field:"datum.value",format:o.numberFormat,formatType:o.numberFormatType,config:o}):"temporal"===t.type&&o.timeFormatType&&JT(t)&&void 0===t.timeUnit&&(f=FT({fieldOrDatumDef:t,field:"datum.value",format:o.timeFormat,formatType:o.timeFormatType,config:o})));const d={...u?{opacity:u}:{},...f?{text:f}:{},...e};return Ji(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 fH(e){return hH(e,((e,t)=>Math.max(e,t.value)))}function dH(e){return hH(e,((e,t)=>hr(e,t.value)))}function hH(e,t){return function(e){const t=null==e?void 0:e.condition;return!!t&&(l(t)||rP(t))}(e)?c(e.condition).reduce(t,e.value):rP(e)?e.value:void 0}function pH(e,t,n){const i=t.get("selections");if(!(null==i?void 0:i.length))return;const r=a(n.field);return i.map((e=>`(!length(data(${a(tr(e)+XU)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`)).join(" || ")}const mH={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return CT(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return ET(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:a,gradientHorizontalMinLength:o,gradientVerticalMaxLength:s,gradientVerticalMinLength:u}=e;if(kR(r))return"horizontal"===n?"top"===i||"bottom"===i?yH(t,"width",o,a):o:yH(t,"height",u,s);return}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??function(e){if(ji(["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=dH(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})=>mP(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(ma(n)&&kR(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(l(n))return EP(t,n);if(Xo(n))return n;return}(t,e)};function gH(e){const{legend:t}=e;return hr(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(ma(e)){if(ji(["quarter","month","day"],t))return"symbol";if(kR(n))return"gradient"}return"symbol"}(e))}function yH(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function vH(e){const t=KG(e)?function(e){const{encoding:t}=e,n={};for(const i of[Ir,...kj]){const r=xP(t[i]);r&&e.getScaleComponent(i)&&(i===Gr&&JT(r)&&r.type===iR||(n[i]=xH(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){vH(i);for(const r of Qi(i.component.legends))n.legend[r]=sH(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=wH(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of Qi(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 bH(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 xH(e,t){var n;let i=e.legend(t);const{markDef:r,encoding:a,config:o}=e,s=o.legend,u=new lH({},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 a of Ki(e.component.selection??{})){const e=a.project.hasField[r]??a.project.hasChannel[t];if(e&&LU.defined(a)){const t=n.get("selections")??[];t.push(a.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,u);const l=void 0!==i?!i:s.disable;if(u.set("disable",l,void 0!==i),l)return u;i=i||{};const c=e.getScaleComponent(t).get("type"),f=xP(a[t]),d=JT(f)?null==(n=RN(f.timeUnit))?void 0:n.unit:void 0,h=i.orient||o.legend.orient||"right",p=gH({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:a,fieldOrDatumDef:f,legendConfig:s,config:o,scaleType:c,orient:h,legendType:p,direction:m};for(const w of uH){if("gradient"===p&&w.startsWith("symbol")||"symbol"===p&&w.startsWith("gradient"))continue;const n=w in mH?mH[w](g):i[w];if(void 0!==n){const r=bH(n,w,i,e.fieldDef(t));(r||void 0===o.legend[w])&&u.set(w,n,r)}}const y=(null==i?void 0:i.encoding)??{},v=u.get("selections"),b={},x={fieldOrDatumDef:f,model:e,channel:t,legendCmpt:u,legendType:p};for(const w of["labels","legend","title","symbols","gradient","entries"]){const t=aH(y[w]??{},e),n=w in cH?cH[w](t,x):t;void 0===n||Ji(n)||(b[w]={...(null==v?void 0:v.length)&&JT(f)?{name:`${tr(f.field)}_legend_${w}`}:{},...(null==v?void 0:v.length)?{interactive:!!v}:{},update:n})}return Ji(b)||u.set("encode",b,!!(null==i?void 0:i.encoding)),u}function wH(e,t){var n,i,r,a;if(!e)return t.clone();const o=e.getWithExplicit("orient"),s=t.getWithExplicit("orient");if(o.explicit&&s.explicit&&o.value!==s.value)return;let u=!1;for(const l of uH){const n=sq(e.getWithExplicit(l),t.getWithExplicit(l),l,"legend",((e,t)=>{switch(l){case"symbolType":return _H(e,t);case"title":return gs(e,t);case"type":return u=!0,rq("symbol")}return oq(e,t,l,"legend")}));e.setWithExplicit(l,n)}return u&&((null==(i=null==(n=e.implicit)?void 0:n.encode)?void 0:i.gradient)&&ir(e.implicit,["encode","gradient"]),(null==(a=null==(r=e.explicit)?void 0:r.encode)?void 0:a.gradient)&&ir(e.explicit,["encode","gradient"])),e}function _H(e,t){return"circle"===t.value?t:e}function AH(e){const t=e.component.legends,n={};for(const i of Qi(t)){const r=Ar(e.getScaleComponent(i).get("domains"));if(n[r])for(const e of n[r]){wH(e,t[i])||n[r].push(t[i])}else n[r]=[t[i].clone()]}return Ki(n).flat().map((t=>function(e,t){var n,i,r;const{disable:a,labelExpr:o,selections:s,...u}=e.combine();if(a)return;!1===t.aria&&null==u.aria&&(u.aria=!1);if(null==(n=u.encode)?void 0:n.symbols){const e=u.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||u.stroke||(e.stroke={value:"transparent"});for(const t of kj)u[t]&&delete e[t]}u.title||delete u.title;if(void 0!==o){let e=o;(null==(r=null==(i=u.encode)?void 0:i.labels)?void 0:r.update)&&Xo(u.encode.labels.update.text)&&(e=cr(o,"datum.label",u.encode.labels.update.text.signal)),function(e,t,n,i){var r,a;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(a=e.encode[t]).update??(a.update={}),e.encode[t].update[n]=i}(u,"labels","text",{signal:e})}return u}(t,e.config))).filter((e=>void 0!==e))}function kH(e){return tV(e)||eV(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),DH(e))}(e):DH(e)}function DH(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(", ")}]`},a=t.data.reduce(((t,n)=>{const i=Xo(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return ji(t,i)||t.push(i),t}),[]);if(a.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:a.length>1?`[${a.join(", ")}]`:a[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const FH=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class CH extends nq{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 EH(e){e.component.projection=KG(e)?function(e){if(e.hasProjection){const t=Go(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[[jr,Pr],[qr,Lr]])(xP(n[i[0]])||xP(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField(Gr)&&e.typedFieldDef(Gr).type===iR&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(gq.Main));return t}(e):void 0,a=new CH(e.projectionName(!0),{...Go(e.config.projection),...t},i,r);return a.get("type")||a.set("type","equalEarth",!1),a}return}(e):function(e){if(0===e.children.length)return;let n;for(const t of e.children)EH(t);const i=qi(e.children,(e=>{const i=e.component.projection;if(i){if(n){const e=function(e,n){const i=qi(FH,(i=>!t(e.explicit,i)&&!t(n.explicit,i)||!!(t(e.explicit,i)&&t(n.explicit,i)&&_r(e.get(i),n.get(i)))));if(_r(e.size,n.size)){if(i)return e;if(_r(e.explicit,{}))return n;if(_r(n.explicit,{}))return e}return null}(n,i);return e&&(n=e),!!e}return n=i,!0}return!0}));if(n&&i){const t=e.projectionName(!0),i=new CH(t,n.specifiedProjection,n.size,zi(n.data));for(const n of e.children){const e=n.component.projection;e&&(e.isFit&&i.data.push(...n.component.projection.data),n.renameProjection(e.get("name"),t),e.merged=!0)}return i}return}(e)}function $H(e,t,n,i){if($P(t,n)){const r=KG(e)?e.axis(n)??e.legend(n)??{}:{},a=cP(t,{expr:"datum"}),o=cP(t,{expr:"datum",binSuffix:"end"});return{formulaAs:cP(t,{binSuffix:"range",forAs:!0}),formula:BT(a,o,r.format,r.formatType,i)}}return{}}function SH(e,t){return`${jo(e)}_${t}`}function MH(e,t,n){const i=SH(kP(n,void 0)??{},t);return e.getName(`${i}_bins`)}function BH(e,t,n){let r,a;r=function(e){return"as"in e}(e)?i(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[cP(e,{forAs:!0}),cP(e,{binSuffix:"end",forAs:!0})];const o={...kP(t,void 0)},s=SH(o,e.field),{signal:u,extentSignal:l}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,s);if(Io(o.extent)){const e=o.extent;a=kW(n,e.param,e),delete o.extent}return{key:s,binComponent:{bin:o,field:e.field,as:[r],...u?{signal:u}:{},...l?{extentSignal:l}:{},...a?{span:a}:{}}}}class zH extends bq{clone(){return new zH(null,zi(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(iP(n)&&Lo(n.bin)){const{key:r,binComponent:a}=BH(n,n.bin,t);e[r]={...a,...e[r],...$H(t,n,i,t.config)}}return e}),{});return Ji(n)?null:new zH(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=BH(t,t.bin,n);return new zH(e,{[i]:r})}merge(e,t){for(const n of Qi(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=Wi([...this.bins[n].as,...e.bins[n].as],Ti)):this.bins[n]=e.bins[n];for(const n of e.children)e.removeChild(n),n.parent=this;e.remove()}producedFields(){return new Set(Ki(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(Ki(this.bins).map((e=>e.field)))}hash(){return`Bin ${Ti(this.bins)}`}assemble(){return Ki(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...a}=e.bin,o={type:"bin",field:lr(e.field),as:n,signal:e.signal,...Io(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...a};!r&&e.extentSignal&&(t.push({type:"extent",field:lr(e.field),signal:e.extentSignal}),o.extent={signal:e.extentSignal}),t.push(o);for(const s of i)for(let e=0;e<2;e++)t.push({type:"formula",expr:cP({field:n[e]},{expr:"datum"}),as:s[e]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}function OH(e,t,n,i){var r;const a=KG(i)?i.encoding[za(t)]:void 0;if(iP(n)&&KG(i)&&HT(n,a,i.markDef,i.config)){e.add(cP(n,{})),e.add(cP(n,{suffix:"end"}));const{mark:r,markDef:a,config:o}=i,s=IT({fieldDef:n,markDef:a,config:o});ZR(r)&&.5!==s&&io(t)&&(e.add(cP(n,{suffix:kq})),e.add(cP(n,{suffix:Dq}))),n.bin&&$P(n,t)&&e.add(cP(n,{binSuffix:"range"}))}else if(da(t)){const n=fa(t);e.add(i.getName(n))}else e.add(cP(n));var s;return aP(n)&&(s=null==(r=n.scale)?void 0:r.range,o(s)&&"field"in s)&&e.add(n.scale.range.field),e}class NH extends bq{clone(){return new NH(null,new Set(this.dimensions),zi(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:a,field:o}=e;if(a)if("count"===a)i["*"]??(i["*"]={}),i["*"].count=new Set([cP(e,{forAs:!0})]);else{if(Bo(a)||zo(a)){const e=Bo(a)?"argmin":"argmax",t=a[e];i[t]??(i[t]={}),i[t][e]=new Set([cP({op:e,field:t},{forAs:!0})])}else i[o]??(i[o]={}),i[o][a]=new Set([cP(e,{forAs:!0})]);ko(n)&&"unaggregated"===t.scaleDomain(n)&&(i[o]??(i[o]={}),i[o].min=new Set([cP({field:o,aggregate:"min"},{forAs:!0})]),i[o].max=new Set([cP({field:o,aggregate:"max"},{forAs:!0})]))}else OH(r,n,e,t)})),r.size+Qi(i).length===0?null:new NH(e,r,i)):null}static makeFromTransform(e,t){var n;const i=new Set,r={};for(const a of t.aggregate){const{op:e,field:t,as:i}=a;e&&("count"===e?(r["*"]??(r["*"]={}),r["*"].count=new Set([i||cP(a,{forAs:!0})])):(r[t]??(r[t]={}),(n=r[t])[e]??(n[e]=new Set),r[t][e].add(i||cP(a,{forAs:!0}))))}for(const a of t.groupby??[])i.add(a);return i.size+Qi(r).length===0?null:new NH(e,i,r)}merge(e){return Gi(this.dimensions,e.dimensions)?(function(e,t){for(const n of Qi(t)){const i=t[n];for(const t of Qi(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){mN.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...Qi(this.measures)])}producedFields(){const e=new Set;for(const t of Qi(this.measures))for(const n of Qi(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 ${Ti({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of Qi(this.measures))for(const r of Qi(this.measures[i]))for(const a of this.measures[i][r])n.push(a),e.push(r),t.push("*"===i?null:lr(i));return{type:"aggregate",groupby:[...this.dimensions].map(lr),ops:e,fields:t,as:n}}}class RH extends bq{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const r of ya){const e=t.facet[r];if(e){const{bin:n,sort:i}=e;this[r]={name:t.getName(`${r}_domain`),fields:[cP(e),...Lo(n)?[cP(e,{binSuffix:"end"})]:[]],...RT(i)?{sortField:i}:l(i)?{sortIndexField:PW(e,r)}:{}}}}this.childModel=t.child}hash(){let e="Facet";for(const t of ya)this[t]&&(e+=` ${t.charAt(0)}:${Ti(this[t])}`);return e}get fields(){var e;const t=[];for(const n of ya)(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 ya)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 no){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(_R(i)&&Jo(r)){const n=$G(SG(this.childModel,t));n?e[t]=n:yN(UO(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x",facet:void 0}[e],r=[],a=[],o=[];i&&n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),a.push("max")):(r.push(n[i]),a.push("distinct")),o.push(`distinct_${n[i]}`));const{sortField:s,sortIndexField:u}=this[e];if(s){const{op:e=zT,field:t}=s;r.push(t),a.push(e),o.push(cP(s,{forAs:!0}))}else u&&(r.push(u),a.push("max"),o.push(u));return{name:this[e].name,source:t??this.data,transform:[{type:"aggregate",groupby:this[e].fields,...r.length?{fields:r,ops:a,as:o}:{}}]}}assembleFacetHeaderData(e){var t;const{columns:n}=this.model.layout,{layoutHeaders:i}=this.model.component,r=[],a={};for(const u of UW){for(const e of IW){const n=(i[u]&&i[u][e])??[];for(const e of n)if((null==(t=e.axes)?void 0:t.length)>0){a[u]=!0;break}}if(a[u]){const e=`length(data("${this.facet.name}"))`,t="row"===u?n?{signal:`ceil(${e} / ${n})`}:1:n?{signal:`min(${e}, ${n})`}:{signal:e};r.push({name:`${this.facet.name}_${u}`,transform:[{type:"sequence",start:0,stop:t}]})}}const{row:o,column:s}=a;return(o||s)&&r.unshift(this.assembleRowColumnHeaderData("facet",null,e)),r}assemble(){const e=[];let t=null;const n=this.getChildIndependentFieldsWithStep(),{column:i,row:r,facet:a}=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 o of[Fr,Dr])this[o]&&e.push(this.assembleRowColumnHeaderData(o,t,n));if(a){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function TH(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function PH(e){const t={};return Mi(e.filter,(e=>{if(VN(e)){let r=null;LN(e)?r=ns(e.equal):UN(e)?r=ns(e.lte):qN(e)?r=ns(e.lt):IN(e)?r=ns(e.gt):WN(e)?r=ns(e.gte):HN(e)?r=e.range[0]:GN(e)&&(r=(e.oneOf??e.in)[0]),r&&(vN(r)?t[e.field]="date":n(r)?t[e.field]="number":i(r)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}})),t}function jH(e){const t={};function n(e){var n;FP(e)?t[e.field]="date":"quantitative"===e.type&&(n=e.aggregate,i(n)&&ji(["min","max"],n))?t[e.field]="number":dr(e.field)>1?e.field in t||(t[e.field]="flatten"):aP(e)&&RT(e.sort)&&dr(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((KG(e)||ZG(e))&&e.forEachFieldDef(((t,i)=>{if(iP(t))n(t);else{const r=Ma(i),a=e.fieldDef(r);n({...t,type:a.type})}})),KG(e)){const{mark:n,markDef:i,encoding:r}=e;if(KR(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];JT(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}class LH extends bq{clone(){return new LH(null,zi(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${Ti(this._parse)}`}static makeExplicit(e,t,n){var i;let r={};const a=t.data;return!dq(a)&&(null==(i=null==a?void 0:a.format)?void 0:i.parse)&&(r=a.format.parse),this.makeWithAncestors(e,r,{},n)}static makeWithAncestors(e,t,n,i){for(const o of Qi(n)){const e=i.getWithExplicit(o);void 0!==e.value&&(e.explicit||e.value===n[o]||"derived"===e.value||"flatten"===n[o]?delete n[o]:yN(XO(o,n[o],e.value)))}for(const o of Qi(t)){const e=i.get(o);void 0!==e&&(e===t[o]?delete t[o]:yN(XO(o,t[o],e)))}const r=new nq(t,n);i.copyAll(r);const a={};for(const o of Qi(r.combine())){const e=r.get(o);null!==e&&(a[o]=e)}return 0===Qi(a).length||i.parseNothing?null:new LH(e,a)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of Qi(this._parse)){const n=this._parse[t];1===dr(t)&&(e[t]=n)}return e}producedFields(){return new Set(Qi(this._parse))}dependentFields(){return new Set(Qi(this._parse))}assembleTransforms(e=!1){return Qi(this._parse).filter((t=>!e||dr(t)>1)).map((e=>{const t=function(e,t){const n=ar(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},'${TH(t.slice(5,t.length))}')`;if(t.startsWith("utc:"))return`utcParse(${n},'${TH(t.slice(4,t.length))}')`;return yN(`Unrecognized parse "${t}".`),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:fr(e)}})).filter((e=>null!==e))}}class qH extends bq{clone(){return new qH(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([Dj])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:Dj}}}class UH extends bq{clone(){return new UH(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${Ti(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class IH extends bq{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 ${Ti(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class WH extends bq{constructor(e){let t;if(super(null),e??(e={name:"source"}),dq(e)||(t=e.format?{...Ri(e.format,["parse"])}:{}),cq(e))this._data={values:e.values};else if(lq(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];ji(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else pq(e)?this._data={values:[{type:"Sphere"}]}:(fq(e)||dq(e))&&(this._data={});this._generator=dq(e),e.name&&(this._name=e.name),t&&!Ji(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 HH,GH=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 VH(e){return e instanceof WH||e instanceof UH||e instanceof IH}class YH{constructor(){HH.set(this,void 0),GH(this,HH,!1,"f")}setModified(){GH(this,HH,!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,HH,"f")}}HH=new WeakMap;class XH extends YH{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 JH extends YH{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class QH extends JH{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 Qi(n))n[i].length>1&&(this.setModified(),this.mergeNodes(e,n[i]))}}class KH extends JH{constructor(e){super(),this.requiresSelectionId=e&&tI(e)}run(e){e instanceof qH&&(this.requiresSelectionId&&(VH(e.parent)||e.parent instanceof NH||e.parent instanceof LH)||(this.setModified(),e.remove()))}}class ZH extends YH{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof Aq&&(n=e.producedFields(),Vi(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 eG extends JH{constructor(){super()}run(e){e instanceof xq&&!e.isRequired()&&(this.setModified(),e.remove())}}class tG extends XH{run(e){if(!(VH(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof LH)if(e instanceof LH)this.setModified(),e.merge(t);else{if(Xi(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class nG extends XH{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof LH));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 Qi(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!Ji(i)){this.setModified();const n=new LH(e,i);for(const r of t){if(r instanceof LH)for(const e of Qi(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof LH&&0===Qi(r.parse).length&&r.remove()}}}}}class iG extends XH{run(e){e instanceof xq||e.numChildren()>0||e instanceof RH||e instanceof WH||(this.setModified(),e.remove())}}class rG extends XH{run(e){const t=e.children.filter((e=>e instanceof Aq)),n=t.pop();for(const i of t)this.setModified(),n.merge(i)}}class aG extends XH{run(e){const t=e.children.filter((e=>e instanceof NH)),n={};for(const i of t){const e=Ti(i.groupBy);e in n||(n[e]=[]),n[e].push(i)}for(const i of Qi(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 oG extends XH{constructor(e){super(),this.model=e}run(e){const t=!(VH(e)||e instanceof _W||e instanceof LH||e instanceof qH),n=[],i=[];for(const r of e.children)r instanceof zH&&(t&&!Xi(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 zH?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 sG extends XH{run(e){const t=[...e.children];if(!Li(t,(e=>e instanceof xq))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof xq){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof xq))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 uG extends bq{clone(){return new uG(null,zi(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=Wi(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??cP(e)}hash(){return`JoinAggregateTransform ${Ti(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 lG extends bq{clone(){return new lG(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t,n){const{config:i,markDef:r}=t,{marks:a,scales:o}=n;if("include-invalid-values"===a&&"include-invalid-values"===o)return null;const s=t.reduceFieldDef(((e,n,a)=>{const o=ko(a)&&t.getScaleComponent(a);if(o){const t=o.get("type"),{aggregate:s}=n,u=hT({scaleChannel:a,markDef:r,config:i,scaleType:t,isCountAggregate:Ro(s)});"show"!==u&&"always-valid"!==u&&(e[n.field]=n)}return e}),{});return Qi(s).length?new lG(e,s):null}dependentFields(){return new Set(Qi(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${Ti(this.filter)}`}assemble(){const e=Qi(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=cP(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (${cG(i)}))`):"quantitative"===n.type&&e.push(cG(i))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}function cG(e){return`isValid(${e}) && isFinite(+${e})`}class fG extends bq{clone(){return new fG(null,zi(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(e,t){const{stack:n,groupby:r,as:a,offset:o="zero"}=t,s=[],u=[];if(void 0!==t.sort)for(const i of t.sort)s.push(i.field),u.push(hr(i.order,"ascending"));const c={field:s,order:u};let f;return f=function(e){return l(e)&&e.every((e=>i(e)))&&e.length>1}(a)?a:i(a)?[a,`${a}_end`]:[`${t.stack}_start`,`${t.stack}_end`],new fG(e,{dimensionFieldDefs:[],stackField:n,groupby:r,offset:o,sort:c,facetby:[],as:f})}static makeFromEncoding(e,t){const n=t.stack,{encoding:i}=t;if(!n)return null;const{groupbyChannels:r,fieldChannel:a,offset:o,impute:s}=n,u=r.map((e=>bP(i[e]))).filter((e=>!!e)),c=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=cP(t.fieldDef);return n&&e.push(n),e}),[])}(t),f=t.encoding.order;let d;if(l(f)||JT(f))d=hs(f);else{const e=GT(f)?f.sort:"y"===a?"descending":"ascending";d=c.reduce(((t,n)=>(t.field.includes(n)||(t.field.push(n),t.order.push(e)),t)),{field:[],order:[]})}return new fG(e,{dimensionFieldDefs:u,stackField:t.vgField(a),facetby:[],stackby:c,sort:d,offset:o,impute:s,as:[t.vgField(a,{suffix:"start",forAs:!0}),t.vgField(a,{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 ${Ti(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[cP(e,{binSuffix:"mid"})]:[cP(e,{}),cP(e,{binSuffix:"end"})]:[cP(e)])).flat():n??[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:r,sort:a,offset:o,impute:s,as:u}=this._stack;if(s)for(const l of n){const{bandPosition:n=.5,bin:a}=l;if(a){const t=cP(l,{expr:"datum"}),i=cP(l,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${cG(t)} ? ${n}*${t}+${1-n}*${i} : ${t}`,as:cP(l,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:cP(l,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:a,as:u,offset:o}),e}}class dG extends bq{clone(){return new dG(null,zi(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=Wi(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??cP(e)}hash(){return`WindowTransform ${Ti(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,a=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every((e=>Oo(e))))return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==a?{groupby:a}:{}};const o=[],s=[];if(void 0!==this.transform.sort)for(const c of this.transform.sort)o.push(c.field),s.push(c.order??"ascending");const u={field:o,order:s},l=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:u,...void 0!==l?{ignorePeers:l}:{},...void 0!==a?{groupby:a}:{},...void 0!==r?{frame:r}:{}}}}function hG(e){if(e instanceof RH)if(1!==e.numChildren()||e.children[0]instanceof xq){const n=e.model.component.data.main;pG(n);const i=(t=e,function e(n){if(!(n instanceof RH)){const i=n.clone();if(i instanceof xq){const e=mG+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof NH||i instanceof fG||i instanceof dG||i instanceof uG)&&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 NH||t instanceof fG||t instanceof dG||t instanceof uG)&&t.addDimensions(e.fields),t.swapWithParent(),hG(e)}else e.children.map(hG);var t}function pG(e){if(e instanceof xq&&e.type===gq.Main&&1===e.numChildren()){const t=e.children[0];t instanceof RH||(t.swapWithParent(),pG(e))}}const mG="scale_";function gG(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!gG(t.children))return!1}return!0}function yG(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function vG(e,t,n){let i=e.sources,r=!1;return r=yG(new eG,i)||r,r=yG(new KH(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=yG(new iG,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=yG(new tG,i)||r,r=yG(new oG(t),i)||r,r=yG(new ZH,i)||r,r=yG(new nG,i)||r,r=yG(new aG,i)||r,r=yG(new rG,i)||r,r=yG(new QH,i)||r,r=yG(new sG,i)||r),e.sources=i,r}class bG{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new bG((()=>e(t)))}}function xG(e){KG(e)?function(e){const t=e.component.scales;for(const n of Qi(t)){const i=wG(e,n);if(t[n].setWithExplicit("domains",i),DG(e,n),e.component.data.isFaceted){let t=e;for(;!ZG(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)Qo(e)&&(e.data=mG+e.data.replace(mG,""))}}}(e):function(e){for(const n of e.children)xG(n);const t=e.component.scales;for(const n of Qi(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"):sq(i,e.getWithExplicit("domains"),"domains","scale",CG);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&yN(GO),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function wG(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}=FG(t,n);if(!e)return void yN(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=FG(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&&xP(i.x2)?xP(i.x)?sq(AG(n,r,e,"x"),AG(n,r,e,"x2"),"domain","scale",CG):AG(n,r,e,"x2"):"y"===t&&xP(i.y2)?xP(i.y)?sq(AG(n,r,e,"y"),AG(n,r,e,"y2"),"domain","scale",CG):AG(n,r,e,"y2"):AG(n,r,e,t)}function _G(e,t,n){var i;const r=null==(i=RN(n))?void 0:i.unit;return"temporal"===t||r?function(e,t,n){return e.map((e=>({signal:`{data: ${CP(e,{timeUnit:n,type:t})}}`})))}(e,t,r):[e]}function AG(e,t,n,i){const{encoding:r,markDef:a,mark:s,config:u,stack:l}=n,c=xP(r[i]),{type:f}=c,d=c.timeUnit,h=function(e){const{marks:t,scales:n}=vq(e);return t===n?gq.Main:"include-invalid-values"===n?gq.PreFilterInvalid:gq.PostFilterInvalid}({invalid:cs("invalid",a,u),isPath:KR(s)});if(function(e){return kr(e,"unionWith")}(t)){const r=AG(e,void 0,n,i);return iq([..._G(t.unionWith,f,d),...r.value])}if(Xo(t))return iq([t]);if(t&&"unaggregated"!==t&&!FR(t))return iq(_G(t,f,d));if(l&&i===l.fieldChannel){if("normalize"===l.offset)return rq([[0,1]]);const e=n.requestDataName(h);return rq([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const p=ko(i)&&JT(c)?function(e,t,n){if(!_R(n))return;const i=e.fieldDef(t),r=i.sort;if(TT(r))return{op:"min",field:PW(i,t),order:"ascending"};const{stack:a}=e,o=a?new Set([...a.groupbyFields,...a.stackBy.map((e=>e.fieldDef.field))]):void 0;if(RT(r)){return kG(r,a&&!o.has(r.field))}if(function(e){return kr(e,"encoding")}(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:u}=i,l=a&&!o.has(u);if(Bo(s)||zo(s))return kG({field:cP(i),order:n},l);if(Oo(s)||!s)return kG({op:s,field:u,order:n},l)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(ji(["ascending",void 0],r))return!0}return}(n,i,e):void 0;if(KT(c)){return rq(_G([c.datum],f,d))}const m=c;if("unaggregated"===t){const{field:e}=c;return rq([{data:n.requestDataName(h),field:cP({field:e,aggregate:"min"})},{data:n.requestDataName(h),field:cP({field:e,aggregate:"max"})}])}if(Lo(m.bin)){if(_R(e))return rq("bin-ordinal"===e?[]:[{data:er(p)?n.requestDataName(h):n.requestDataName(gq.Raw),field:n.vgField(i,$P(m,i)?{binSuffix:"range"}:{}),sort:!0!==p&&o(p)?p:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=m;if(Lo(e)){const t=MH(n,m.field,e);return rq([new bG((()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return rq([{data:n.requestDataName(h),field:n.vgField(i,{})}])}}if(m.timeUnit&&ji(["time","utc"],e)){const e=r[za(i)];if(HT(m,e,a,u)){const t=n.requestDataName(h),r=IT({fieldDef:m,fieldDef2:e,markDef:a,config:u}),o=ZR(s)&&.5!==r&&io(i);return rq([{data:t,field:n.vgField(i,o?{suffix:kq}:{})},{data:t,field:n.vgField(i,{suffix:o?Dq:"end"})}])}}return rq(p?[{data:er(p)?n.requestDataName(h):n.requestDataName(gq.Raw),field:n.vgField(i),sort:p}]:[{data:n.requestDataName(h),field:n.vgField(i)}])}function kG(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":zT),...i?{field:lr(i)}:{},...r?{order:r}:{}}}function DG(e,t){var n;const i=e.component.scales[t],r=e.specifiedScales[t].domain,a=null==(n=e.fieldDef(t))?void 0:n.bin,o=FR(r)?r:void 0,s=Uo(a)&&Io(a.extent)?a.extent:void 0;(o||s)&&i.set("selectionExtent",o??s,!0)}function FG(e,t){const{aggregate:n,type:r}=e;return n?i(n)&&!Po.has(n)?{valid:!1,reason:oN(n)}:"quantitative"===r&&"log"===t?{valid:!1,reason:sN(e)}:{valid:!0}:{valid:!1,reason:aN(e)}}function CG(e,t,n,i){return e.explicit&&t.explicit&&yN(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${Ar(n)} and ${Ar(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function EG(e){const n=Wi(e.map((e=>{if(Qo(e)){const{sort:t,...n}=e;return n}return e})),Ti),r=Wi(e.map((e=>{if(Qo(e)){const t=e.sort;return void 0===t||er(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),Ti);if(0===n.length)return;if(1===n.length){const t=e[0];if(Qo(t)&&r.length>0){let e=r[0];if(r.length>1){yN(cN);const t=r.filter((e=>o(e)&&"op"in e&&"min"!==e.op));e=!r.every((e=>o(e)&&"op"in e))||1!==t.length||t[0]}else if(o(e)&&"field"in e){const n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return{...t,sort:e}}return t}const a=Wi(r.map((e=>er(e)||!("op"in e)||i(e.op)&&t(Mo,e.op)?e:(yN(function(e){return`Dropping sort property ${Ar(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),Ti);let s;1===a.length?s=a[0]:a.length>1&&(yN(cN),s=!0);const u=Wi(e.map((e=>Qo(e)?e.data:null)),(e=>e));if(1===u.length&&null!==u[0]){return{data:u[0],fields:n.map((e=>e.field)),...s?{sort:s}:{}}}return{fields:n,...s?{sort:s}:{}}}function $G(e){if(Qo(e)&&i(e.field))return e.field;if(function(e){return!l(e)&&kr(e,"fields")&&!kr(e,"data")}(e)){let t;for(const n of e.fields)if(Qo(n)&&i(n.field))if(t){if(t!==n.field)return yN("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 yN("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!l(e)&&kr(e,"fields")&&kr(e,"data")}(e)){yN("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 i(t)?t:void 0}}function SG(e,t){return EG(e.component.scales[t].get("domains").map((t=>(Qo(t)&&(t.data=e.lookupDataSource(t.data)),t))))}function MG(e){return tV(e)||eV(e)?e.children.reduce(((e,t)=>e.concat(MG(t))),BG(e)):BG(e)}function BG(e){return Qi(e.component.scales).reduce(((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:a,type:s,selectionExtent:u,domains:c,range:f,reverse:d,...h}=r,p=function(e,t,n,i){if(io(n)){if(Jo(e))return{step:{signal:`${t}_step`}}}else if(o(e)&&Qo(e))return{...e,data:i.lookupDataSource(e.data)};return e}(r.range,a,n,e),m=SG(e,n),g=u?function(e,t,n,i){const r=kW(e,t.param,t);return{signal:AR(n.get("type"))&&l(i)&&i[0]>i[1]?`isValid(${r}) && reverse(${r})`:r}}(e,u,i,m):null;return t.push({name:a,type:s,...m?{domain:m}:{},...g?{domainRaw:g}:{},range:p,...void 0!==d?{reverse:d}:{},...h}),t}),[])}class zG extends nq{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainHasZero(){const e=this.get("type");if(ji([aR,uR,lR],e))return"definitely-not";const t=this.get("zero");if(!0===t||void 0===t&&ji([rR,sR,oR],e))return"definitely";const i=this.get("domains");if(i.length>0){let e=!1,t=!1,r=!1;for(const a of i){if(l(a)){const i=a[0],r=a[a.length-1];if(n(i)&&n(r)){if(i<=0&&r>=0){e=!0;continue}t=!0;continue}}r=!0}if(e)return"definitely";if(t&&!r)return"definitely-not"}return"maybe"}}const OG=["range","scheme"];function NG(e,t){const n=e.fieldDef(t);if(null==n?void 0:n.bin){const{bin:i,field:r}=n,a=Oa(t),s=e.getName(a);if(o(i)&&i.binned&&void 0!==i.step)return new bG((()=>{const n=e.scaleName(t),r=`(domain("${n}")[1] - domain("${n}")[0]) / ${i.step}`;return`${e.getSignalName(s)} / (${r})`}));if(Lo(i)){const t=MH(e,r,i);return new bG((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(s)} / (${i})`}))}}}function RG(e,t){const i=t.specifiedScales[e],{size:r}=t,a=t.getScaleComponent(e).get("type");for(const n of OG)if(void 0!==i[n]){const r=NR(a,n),s=RR(e,n);if(r)if(s)yN(s);else switch(n){case"range":{const n=i.range;if(l(n)){if(io(e))return iq(n.map((e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return bG.fromName(i,n)}return e})))}else if(o(n))return iq({data:t.requestDataName(gq.Main),field:n.field,sort:{op:"min",field:t.vgField(e)}});return iq(n)}case"scheme":return iq(TG(i[n]))}else yN(uN(a,n,e))}const s=e===Er||"xOffset"===e?"width":"height",u=r[s];if(Nj(u))if(io(e))if(_R(a)){const n=jG(u,t,e);if(n)return iq({step:n})}else yN(lN(s));else if(uo(e)){const n=e===Br?"x":"y";if("band"===t.getScaleComponent(n).get("type")){const e=LG(u,a);if(e)return iq(e)}}const{rangeMin:c,rangeMax:f}=i,d=function(e,t){const{size:i,config:r,mark:a,encoding:o}=t,{type:s}=xP(o[e]),u=t.getScaleComponent(e),c=u.get("type"),{domain:f,domainMid:d}=t.specifiedScales[e];switch(e){case Er:case $r:if(ji(["point","band"],c)){const n=qG(e,i,r.view);if(Nj(n)){return{step:jG(n,t,e)}}}return PG(e,t,c);case Br:case zr:return function(e,t,n){const i=e===Br?"x":"y",r=t.getScaleComponent(i);if(!r)return PG(i,t,n,{center:!0});const a=r.get("type"),o=t.scaleName(i),{markDef:s,config:u}=t;if("band"===a){const e=qG(i,t.size,t.config.view);if(Nj(e)){const t=LG(e,n);if(t)return t}return[0,{signal:`bandwidth('${o}')`}]}{const n=t.encoding[i];if(JT(n)&&n.timeUnit){const e=TN(n.timeUnit,(e=>`scale('${o}', ${e})`)),i=t.config.scale.bandWithNestedOffsetPaddingInner,r=IT({fieldDef:n,markDef:s,config:u})-.5,a=0!==r?` + ${r}`:"";if(i){return[{signal:`${Xo(i)?`${i.signal}/2`+a:`${i/2+r}`} * (${e})`},{signal:`${Xo(i)?`(1 - ${i.signal}/2)`+a:`${1-i/2+r}`} * (${e})`}]}return[0,{signal:e}]}return Oi(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,t,c);case Vr:{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(tN("size",e))}(a,r),s=function(e,t,i,r){const a={x:NG(i,"x"),y:NG(i,"y")};switch(e){case"bar":case"tick":{if(void 0!==r.scale.maxBandSize)return r.scale.maxBandSize;const e=IG(t,a,r.view);return n(e)?e-1:new bG((()=>`${e.signal} - 1`))}case"line":case"trail":case"rule":return r.scale.maxStrokeWidth;case"text":return r.scale.maxFontSize;case"point":case"square":case"circle":{if(r.scale.maxSize)return r.scale.maxSize;const e=IG(t,a,r.view);return n(e)?Math.pow(UG*e,2):new bG((()=>`pow(${UG} * ${e.signal}, 2)`))}}throw new Error(tN("size",e))}(a,i,t,r);return DR(c)?function(e,t,n){const i=()=>{const i=os(t),r=os(e),a=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${a}, ${a})`};return Xo(t)?new bG(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&&l(n)?n.length+1:(yN(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(c,r,f,e)):[o,s]}case Rr:return[0,2*Math.PI];case Yr:return[0,360];case Or:return[0,new bG((()=>`min(${t.getSignalName(ZG(t.parent)?"child_width":"width")},${t.getSignalName(ZG(t.parent)?"child_height":"height")})/2`))];case Ur:return{step:1e3/r.scale.framesPerSecond};case Kr:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case Zr:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case Gr:return"symbol";case Ir:case Wr:case Hr:return"ordinal"===c?"nominal"===s?"category":"ordinal":void 0!==d?"diverging":"rect"===a||"geoshape"===a?"heatmap":"ramp";case Xr:case Jr:case Qr:return[r.scale.minOpacity,r.scale.maxOpacity]}}(e,t);return(void 0!==c||void 0!==f)&&NR(a,"rangeMin")&&l(d)&&2===d.length?iq([c??d[0],f??d[1]]):rq(d)}function TG(e){return function(e){return!i(e)&&kr(e,"name")}(e)?{scheme:e.name,...Ri(e,["name"])}:{scheme:e}}function PG(e,t,n,{center:i}={}){const r=Oa(e),a=t.getName(r),o=t.getSignalName.bind(t);return e===$r&&AR(n)?i?[bG.fromName((e=>`${o(e)}/2`),a),bG.fromName((e=>`-${o(e)}/2`),a)]:[bG.fromName(o,a),0]:i?[bG.fromName((e=>`-${o(e)}/2`),a),bG.fromName((e=>`${o(e)}/2`),a)]:[0,bG.fromName(o,a)]}function jG(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),o=Ra(n),s=i[o];if("offset"===Oj({step:e,offsetIsDiscrete:nP(s)&&KN(s.type)})&&qP(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 s=r.get("paddingInner")??r.get("padding");return{signal:`${e.step} * ${i} / (1-${u=s,Xo(u)?u.signal:a(u)})`}}return e.step;var u}function LG(e,t){if("offset"===Oj({step:e,offsetIsDiscrete:_R(t)}))return{step:e.step}}function qG(e,t,n){const i=e===Er?"width":"height",r=t[i];return r||Lj(n,i)}const UG=.95;function IG(e,t,n){const i=Nj(e.width)?e.width.step:jj(n,"width"),r=Nj(e.height)?e.height.step:jj(n,"height");return t.x||t.y?new bG((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function WG(e,t){KG(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:a,specifiedScales:o}=e;for(const s of Qi(n)){const u=o[s],l=n[s],c=e.getScaleComponent(s),f=xP(r[s]),d=u[t],h=c.get("type"),p=c.get("padding"),m=c.get("paddingInner"),g=NR(h,t),y=RR(s,t);if(void 0!==d&&(g?y&&yN(y):yN(uN(h,t,s))),g&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":vN(u[t])||"temporal"===n||e?l.set(t,{signal:CP(u[t],{type:n,timeUnit:e})},!0):l.set(t,u[t],!0);break;default:l.copyKeyFromObject(t,u)}}else{const n=kr(HG,t)?HG[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:h,scalePadding:p,scalePaddingInner:m,domain:u.domain,domainMin:u.domainMin,domainMax:u.domainMax,markDef:a,config:i,hasNestedOffsetScale:UP(r,s),hasSecondaryRangeChannel:!!r[za(s)]}):i.scale[t];void 0!==n&&l.set(t,n,!1)}}}(e,t):VG(e,t)}const HG={bins:({model:e,fieldOrDatumDef:t})=>JT(t)?function(e,t){const n=t.bin;if(Lo(n)){const i=MH(e,t.field,n);return new bG((()=>e.getSignalName(i)))}if(qo(n)&&Uo(n)&&void 0!==n.step)return{step:n.step};return}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(ji([Ir,Wr,Hr],e)&&"nominal"!==t)return"hcl";return}(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:i,domainMax:r,fieldOrDatumDef:a})=>function(e,t,n,i,r,a){var o;if((null==(o=bP(a))?void 0:o.bin)||l(n)||null!=r||null!=i||ji([uR,lR],e))return;return!!io(t)||void 0}(e,t,n,i,r,a),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>function(e,t,n,i,r,a){if(io(e)){if(kR(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:o}=r;if("bar"===t&&(!JT(i)||!i.bin&&!i.timeUnit)&&("vertical"===o&&"x"===e||"horizontal"===o&&"y"===e))return a.continuousBandSize}if(t===cR)return n.pointPadding}return}(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:i,config:r,hasNestedOffsetScale:a})=>function(e,t,n,i,r,a=!1){if(void 0!==e)return;if(io(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,tickBandPaddingInner:o,bandWithNestedOffsetPaddingInner:s}=r;return a?s:hr(e,"bar"===n?t:"tick"===n?o:i)}if(uo(t)&&i===fR)return r.offsetBandPaddingInner;return}(e,t,n.type,i,r.scale,a),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:i,config:r,hasNestedOffsetScale:a})=>function(e,t,n,i,r,a=!1){if(void 0!==e)return;if(io(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(a)return t;if(n===fR)return hr(e,Xo(i)?{signal:`${i.signal}/2`}:i/2)}else if(uo(t)){if(n===cR)return.5;if(n===fR)return r.offsetBandPaddingOuter}return}(e,t,n,i,r.scale,a),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){if("x"===n&&void 0!==i.xReverse)return AR(e)&&"descending"===t?Xo(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse;if(AR(e)&&"descending"===t)return!0;return}(t,JT(e)?e.sort:void 0,n,i.scale),zero:({channel:e,fieldOrDatumDef:t,domain:i,markDef:r,scaleType:a,config:o,hasSecondaryRangeChannel:s})=>function(e,t,i,r,a,o,s){if(i&&"unaggregated"!==i&&AR(a)){if(l(i)){const e=i[0],t=i[i.length-1];if(n(e)&&e<=0&&n(t)&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!DR(a))return!0;if((!JT(t)||!t.bin)&&ji([...no,...ao],e)){const{orient:t,type:n}=r;return(!ji(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!ji(["bar","area"],n)||s)||(null==o?void 0:o.zero))}return!1}(e,t,i,r,a,o.scale,s)};function GG(e){KG(e)?function(e){const t=e.component.scales;for(const n of Ao){const i=t[n];if(!i)continue;const r=RG(n,e);i.setWithExplicit("range",r)}}(e):VG(e,"range")}function VG(e,t){const n=e.component.scales;for(const i of e.children)"range"===t?GG(i):WG(i,t);for(const i of Qi(n)){let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=sq(r,e.getWithExplicit(t),t,"scale",aq(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0)))}}n[i].setWithExplicit(t,r)}}function YG(e,t,n,i,r=!1){const a=function(e,t,n,i){var r;switch(t.type){case"nominal":case"ordinal":if(ma(e)||"discrete"===$o(e))return"shape"===e&&"ordinal"===t.type&&yN(rN(e,"ordinal")),"ordinal";if(co(e))return"band";if(io(e)||uo(e)){if(ji(["rect","bar","image","rule","tick"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in ro)return"band";return sT(n[Oa(e)])||oP(t)&&(null==(r=t.axis)?void 0:r.tickBand)?"band":"point";case"temporal":return ma(e)?"time":"discrete"===$o(e)?(yN(rN(e,"temporal")),"ordinal"):JT(t)&&t.timeUnit&&RN(t.timeUnit).utc?"utc":co(e)?"band":"time";case"quantitative":return ma(e)?JT(t)&&Lo(t.bin)?"bin-ordinal":"linear":"discrete"===$o(e)?(yN(rN(e,"quantitative")),"ordinal"):co(e)?"band":"linear";case"geojson":return}throw new Error(KO(t.type))}(t,n,i,r),{type:o}=e;return ko(t)?void 0!==o?function(e,t,n=!1){if(!ko(e))return!1;switch(e){case Er:case $r:case Br:case zr:case Rr:case Or:return!!kR(t)||"band"===t||"point"===t&&!n;case Ur:return ji(["linear","band"],t);case Vr:case Kr:case Xr:case Jr:case Qr:case Yr:return kR(t)||DR(t)||ji(["band","point","ordinal"],t);case Ir:case Wr:case Hr:return"band"!==t;case Zr:case Gr:return"ordinal"===t||DR(t)}}(t,o)?JT(n)&&(s=o,u=n.type,!(ji([eR,nR],u)?void 0===s||_R(s):u===tR?ji([uR,lR,void 0],s):u!==ZN||vR(s)||DR(s)||void 0===s))?(yN(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(o,a)),a):o:(yN(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,o,a)),a):a:null;var s,u}function XG(e){KG(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const a of Ao){const o=xP(t[a]);if(o&&n===QR&&a===Gr&&o.type===iR)continue;let s=o&&o.scale;if(o&&null!==s&&!1!==s){s??(s={});const n=YG(s,a,o,i,UP(t,a));r[a]=new zG(e.scaleName(`${a}`,!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 a of e.children){XG(a);for(const n of Qi(a.component.scales))if((t=r.scale)[n]??(t[n]=oH(n,e)),"shared"===r.scale[n]){const e=i[n],t=a.component.scales[n].getWithExplicit("type");e?hR(e.value,t.value)?i[n]=sq(e,t,"type","scale",JG):(r.scale[n]="independent",delete i[n]):i[n]=t}}for(const a of Qi(i)){const t=e.scaleName(a,!0),r=i[a];n[a]=new zG(t,r);for(const n of e.children){const e=n.component.scales[a];e&&(n.renameScale(e.get("name"),t),e.merged=!0)}}return n}(e)}const JG=aq(((e,t)=>mR(e)-mR(t)));class QG{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 KG(e){return"unit"===(null==e?void 0:e.type)}function ZG(e){return"facet"===(null==e?void 0:e.type)}function eV(e){return"concat"===(null==e?void 0:e.type)}function tV(e){return"layer"===(null==e?void 0:e.type)}class nV{constructor(e,t,i,r,a,o,s){this.type=t,this.parent=i,this.config=a,this.parent=i,this.config=a,this.view=Go(s),this.name=e.name??r,this.title=Yo(e.title)?{text:e.title}:e.title?Go(e.title):void 0,this.scaleNameMap=i?i.scaleNameMap:new QG,this.projectionNameMap=i?i.projectionNameMap:new QG,this.signalNameMap=i?i.signalNameMap:new QG,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map((e=>kL(e)?{filter:Bi(e.filter,QN)}:e)),this.layout="layer"===t||"unit"===t?{}:function(e,t,i){const r=i[t],a={},{spacing:o,columns:s}=r;void 0!==o&&(a.spacing=o),void 0!==s&&(LT(e)&&!PT(e.facet)||Mj(e))&&(a.columns=s),Bj(e)&&(a.columns=1);for(const u of Tj)if(void 0!==e[u])if("spacing"===u){const t=e[u];a[u]=n(t)?t:{row:t.row??o,column:t.column??o}}else a[u]=e[u];return a}(e,t,a),this.component={data:{sources:i?i.component.data.sources:[],outputNodes:i?i.component.data.outputNodes:{},outputNodeRefCounts:i?i.component.data.outputNodeRefCounts:{},isFaceted:LT(e)||(null==i?void 0:i.component.data.isFaceted)&&void 0===e.data},layoutSize:new nq,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?zi(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}={}){XG(e),xG(e);for(const n of OR)WG(e,n);t||GG(e)}(this)}parseProjection(){EH(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){vH(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const r of Qi(n)){const e=n[r];void 0!==e&&(i[r]=rs(e))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=rs(this.description)),"unit"!==this.type&&"layer"!==this.type)?Ji(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 ya){const r=e[i];if(null==r?void 0:r.facetFieldDef){const{titleAnchor:e,titleOrient:a}=qW(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),o=jW(i,a),s=KW(e,o);void 0!==s&&(n[o]=s)}}return Ji(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 ya)e[n].title&&t.push(WW(this,n));for(const n of UW)t=t.concat(VW(this,n));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>CW(e,"grid",t))),...i.map((e=>CW(e,"grid",t))),...n.map((e=>CW(e,"main",t))),...i.map((e=>CW(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return AH(this)}assembleProjections(){return kH(this)}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...Vo(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return ji(["unit","layer"],this.type)?ji(["middle",void 0],n.anchor)&&(n.frame??(n.frame="group")):n.anchor??(n.anchor="start"),Ji(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||ZG(this.parent)?MG(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const a=this.assembleLegends();return a.length>0&&(t.legends=a),t}getName(e){return tr((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(gq[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(ZG(this.parent)){const t=oo(rH(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(_R(e)&&Jo(i)){const e=n.get("name"),i=$G(SG(this,t));if(i){return{signal:iH(e,n,cP({aggregate:"distinct",field:i},{expr:"datum"}))}}return yN(UO(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):Ea(e)&&ko(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 iV extends nV{vgField(e,t={}){const n=this.fieldDef(e);if(n)return cP(n,t)}reduceFieldDef(e,t){return function(e,t,n,i){return e?Qi(e).reduce(((n,r)=>{const a=e[r];return l(a)?a.reduce(((e,n)=>t.call(i,e,n,r)),n):t.call(i,n,a,r)}),n):n}(this.getMapping(),((t,n,i)=>{const r=bP(n);return r?e(t,r,i):t}),t)}forEachFieldDef(e,t){VP(this.getMapping(),((t,n)=>{const i=bP(t);i&&e(i,n)}),t)}}class rV extends bq{clone(){return new rV(null,zi(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=zi(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 ${Ti(this.transform)}`}assemble(){const{density:e,...t}=this.transform,n={type:"kde",field:e,...t};return n.resolve=this.transform.resolve,n}}class aV extends bq{clone(){return new aV(null,zi(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=zi(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${Ti(this.transform)}`}assemble(){const{extent:e,param:t}=this.transform;return{type:"extent",field:e,signal:t}}}class oV extends bq{clone(){return new oV(this.parent,zi(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=zi(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 ${Ti(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class sV extends bq{clone(){return new sV(null,zi(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=zi(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 ${Ti(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class uV extends bq{clone(){return new uV(null,zi(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[[jr,Pr],[qr,Lr]]){const r=i.map((e=>{const n=xP(t.encoding[e]);return JT(n)?n.field:KT(n)?{expr:`${n.datum}`}:rP(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new uV(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(Gr)){const i=t.typedFieldDef(Gr);i.type===iR&&(e=new uV(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(i);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${Ti(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 lV extends bq{clone(){return new lV(null,this.projection,zi(this.fields),zi(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[[jr,Pr],[qr,Lr]]){const i=n.map((e=>{const n=xP(t.encoding[e]);return JT(n)?n.field:KT(n)?{expr:`${n.datum}`}:rP(n)?{expr:`${n.value}`}:void 0})),r=n[0]===qr?"2":"";(i[0]||i[1])&&(e=new lV(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(i))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${Ti(this.fields)} ${Ti(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class cV extends bq{clone(){return new cV(null,zi(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 cV(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(JT(i)&&JT(r)){const a=i.impute?i:r.impute?r:void 0;if(void 0===a)return;const o=i.impute?r:r.impute?i:void 0,{method:s,value:u,frame:l,keyvals:c}=a.impute,f=YP(t.mark,n);return new cV(e,{impute:a.field,key:o.field,...s?{method:s}:{},...void 0!==u?{value:u}:{},...l?{frame:l}:{},...void 0!==c?{keyvals:c}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${Ti(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:a,frame:o=[null,null]}=this.transform,s={type:"impute",field:e,key:t,...n?{keyvals:(u=n,kr(u,"stop")?this.processSequence(n):n)}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:a};var u;if(i&&"value"!==i){return[s,{type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:o,ignorePeers:!1,...r?{groupby:r}:{}},{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}return[s]}}class fV extends bq{clone(){return new fV(null,zi(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=zi(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 ${Ti(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class dV extends bq{clone(){return new dV(null,zi(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:a}=n;let o=null;if(function(e){return kr(e,"data")}(a)){let e=FV(a.data,r);e||(e=new WH(a.data),r.push(e));const n=t.getName(`lookup_${i}`);o=new xq(e,n,gq.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=o}else if(function(e){return kr(e,"param")}(a)){const e=a.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(tr(e),e)}catch(s){throw new Error(`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`)}if(o=i.materialized,!o)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 dV(e,n,o.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?c(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${Ti({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:c(this.transform.as)}:{}};else{let t=this.transform.as;i(t)||(yN('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 hV extends bq{clone(){return new hV(null,zi(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=zi(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 ${Ti(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class pV extends bq{clone(){return new pV(null,zi(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=zi(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 ${Ti(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class mV extends bq{clone(){return new mV(null,zi(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=Wi((this.transform.groupby??[]).concat(e),(e=>e))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${Ti(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 gV extends bq{clone(){return new gV(null,zi(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${Ti(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function yV(e){let t=0;return function n(i,r){if(i instanceof WH&&!i.isGenerator&&!lq(i.data)){e.push(r);r={name:null,source:r.name,transform:[]}}if(i instanceof LH&&(i.parent instanceof WH&&!r.source?(r.format={...r.format,parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof RH)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 UH||i instanceof IH||i instanceof lG||i instanceof _W||i instanceof TW||i instanceof lV||i instanceof NH||i instanceof dV||i instanceof dG||i instanceof uG||i instanceof sV||i instanceof oV||i instanceof rV||i instanceof fV||i instanceof hV||i instanceof pV||i instanceof qH||i instanceof gV||i instanceof mV||i instanceof aV)&&r.transform.push(i.assemble()),(i instanceof zH||i instanceof Aq||i instanceof cV||i instanceof fG||i instanceof uV)&&r.transform.push(...i.assemble()),i instanceof xq)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof xq)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 xq&&(!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 a=r.name;!r.source||r.transform.length>0?e.push(r):a=r.source;for(const e of i.children){n(e,{name:null,source:a,transform:[]})}break}}}}function vV(e,t){var n;const{facet:i,config:r,child:a,component:o}=e;if(e.channelHasField(t)){const s=i[t],u=LW("title",null,r,t);let c=mP(s,r,{allowDisabling:!0,includeDefault:void 0===u||!!u});a.component.layoutHeaders[t].title&&(c=l(c)?c.join(", "):c,c+=` / ${a.component.layoutHeaders[t].title}`,a.component.layoutHeaders[t].title=null);const f=LW("labelOrient",s.header,r,t),d=null!==s.header&&hr(null==(n=s.header)?void 0:n.labels,r.header.labels,!0),h=ji(["bottom","right"],f)?"footer":"header";o.layoutHeaders[t]={title:null!==s.header?c:null,facetFieldDef:s,[h]:"facet"===t?[]:[bV(e,t,d)]}}}function bV(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 xV(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:a}=e.component;if(a.axis[t]=sH(a,t),"shared"===a.axis[t]){const a="x"===t?"column":"row",o=r[a];for(const r of n.component.axes[t]){const t="top"===(i=r.get("orient"))||"left"===i||Xo(i)?"header":"footer";o[t]??(o[t]=[bV(e,a,!1)]);const n=CW(r,"main",e.config,{header:!0});n&&o[t][0].axes.push(n),r.mainExtracted=!0}}}var i}function wV(e){for(const t of e.children)t.parseLayoutSize()}function _V(e,t){const n=rH(t),i=oo(n),r=e.component.resolve,a=e.component.layoutSize;let o;for(const s of e.children){const t=s.component.layoutSize.getWithExplicit(n),a=r.scale[i]??oH(i,e);if("independent"===a&&"step"===t.value){o=void 0;break}if(o){if("independent"===a&&o.value!==t.value){o=void 0;break}o=sq(o,t,n,"")}else o=t}if(o){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);a.setWithExplicit(t,o)}else a.setWithExplicit(t,{explicit:!1,value:void 0})}function AV(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(_R(e)){const e=Lj(i.view,t);return Jo(n)||Nj(e)?"step":e}return Pj(i.view,t)}if(e.hasProjection||"arc"===e.mark)return Pj(i.view,t);{const e=Lj(i.view,t);return Nj(e)?e.step:e}}function kV(e,t,n){return cP(t,{suffix:`by_${cP(e)}`,...n})}class DV extends iV{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=JV(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!PT(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=Qi(e),n={};for(const i of t){if(![Dr,Fr].includes(i)){yN(tN(i,"facet"));break}const t=e[i];if(void 0===t.field){yN(eN(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=AP(e,t);return n.header?n.header=Go(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return kr(this.facet,e)}fieldDef(e){return this.facet[e]}parseData(){this.component.data=CV(this),this.child.parseData()}parseLayoutSize(){wV(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Object.values(this.component.selection).some((e=>iI(e)))&&gN(YO)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of ya)vV(e,t);xV(e,"x"),xV(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 ya)for(const n of IW){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:a}=i;if(a){const n=LW("titleOrient",a.header,this.config,t);if(["right","bottom"].includes(n)){const i=jW(t,n);e.titleAnchor??(e.titleAnchor={}),e.titleAnchor[i]="end"}}if(null==r?void 0:r[0]){const r="row"===t?"height":"width",a="header"===n?"headerBand":"footerBand";"facet"===t||this.child.component.layoutSize.get(r)||(e[a]??(e[a]={}),e[a][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 DV)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof DV?{...this.channelHasField("column")?{encode:{update:{columns:{field:cP(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof DV){if(this.child.channelHasField("column")){const i=cP(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of no){const r=this.child.component.scales[i];if(r&&!r.merged){const a=r.get("type"),o=r.get("range");if(_R(a)&&Jo(o)){const r=$G(SG(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):yN(UO(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:a,as:o}=this.getCardinalityAggregateForChild(),s=[];for(const c of ya){const e=this.facet[c];if(e){s.push(cP(e));const{bin:t,sort:u}=e;if(Lo(t)&&s.push(cP(e,{binSuffix:"end"})),RT(u)){const{field:t,op:s=zT}=u,l=kV(e,u);n&&i?(r.push(l),a.push("max"),o.push(l)):(r.push(t),a.push(s),o.push(l))}else if(l(u)){const t=PW(e,c);r.push(t),a.push("max"),o.push(t)}}}const u=!!n&&!!i;return{name:e,data:t,groupby:s,...u||r.length>0?{aggregate:{...u?{cross:u}:{},...r.length?{fields:r,ops:a,as:o}:{}}}:{}}}facetSortFields(e){const{facet:t}=this,n=t[e];return n?RT(n.sort)?[kV(n,n.sort,{expr:"datum"})]:l(n.sort)?[PW(n,e,{expr:"datum"})]:[cP(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(RT(e)?e.order:!l(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){var e;const{facet:t,config:n}=this;if(t.facet)return XW(t.facet,"facet",n);const i={row:["top","bottom"],column:["left","right"]};for(const r of UW)if(t[r]){const a=LW("labelOrient",null==(e=t[r])?void 0:e.header,n,r);if(i[r].includes(a))return XW(t[r],r,n)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=yV(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:ya.map((e=>this.facetSortFields(e))).flat(),order:ya.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(Hq(this,[]))}]}getMapping(){return this.facet}}function FV(e,t){var n,i,r,a;for(const o of t){const t=o.data;if(e.name&&o.hasName()&&e.name!==o.dataName)continue;const s=null==(n=e.format)?void 0:n.mesh,u=null==(i=t.format)?void 0:i.feature;if(s&&u)continue;const l=null==(r=e.format)?void 0:r.feature;if((l||u)&&l!==u)continue;const c=null==(a=t.format)?void 0:a.mesh;if(!s&&!c||s===c)if(cq(e)&&cq(t)){if(_r(e.values,t.values))return o}else if(lq(e)&&lq(t)){if(e.url===t.url)return o}else if(fq(e)&&e.name===o.dataName)return o}return null}function CV(e){var t;let n=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new WH({values:[]});return t.push(e),e}const n=FV(e.data,t);if(n)return dq(e.data)||(n.data.format=Ui({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new WH(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,a=e.data,o=!(a&&(dq(a)||lq(a)||cq(a)))&&e.parent?e.parent.component.data.ancestorParse.clone():new uq;dq(a)?(hq(a)?n=new IH(n,a.sequence):mq(a)&&(n=new UH(n,a.graticule)),o.parseNothing=!0):null===(null==(t=null==a?void 0:a.format)?void 0:t.parse)&&(o.parseNothing=!0),n=LH.makeExplicit(n,e,o)??n,n=new qH(n);const s=e.parent&&tV(e.parent);(KG(e)||ZG(e))&&s&&(n=zH.makeFromEncoding(n,e)??n),e.transforms.length>0&&(n=function(e,t,n){let i=0;for(const r of t.transforms){let a,o;if(NL(r))o=e=new TW(e,r),a="derived";else if(kL(r)){const i=PH(r);o=e=LH.makeWithAncestors(e,{},i,n)??e,e=new _W(e,t,r.filter)}else if(RL(r))o=e=zH.makeFromTransform(e,r,t),a="number";else if(PL(r))a="date",void 0===n.getWithExplicit(r.field).value&&(e=new LH(e,{[r.field]:a}),n.set(r.field,a,!1)),o=e=Aq.makeFromTransform(e,r);else if(jL(r))o=e=NH.makeFromTransform(e,r),a="number",tI(t)&&(e=new qH(e));else if(DL(r))o=e=dV.make(e,t,r,i++),a="derived";else if(BL(r))o=e=new dG(e,r),a="number";else if(zL(r))o=e=new uG(e,r),a="number";else if(LL(r))o=e=fG.makeFromTransform(e,r),a="derived";else if(qL(r))o=e=new sV(e,r),a="derived";else if(UL(r))o=e=new aV(e,r),a="derived";else if(OL(r))o=e=new oV(e,r),a="derived";else if(FL(r))o=e=new mV(e,r),a="derived";else if(ML(r))e=new gV(e,r);else if(TL(r))o=e=cV.makeFromTransform(e,r),a="derived";else if(CL(r))o=e=new rV(e,r),a="derived";else if(EL(r))o=e=new hV(e,r),a="derived";else if($L(r))o=e=new pV(e,r),a="derived";else{if(!SL(r)){yN(`Ignoring an invalid transform: ${Ar(r)}.`);continue}o=e=new fV(e,r),a="derived"}if(o&&void 0!==a)for(const e of o.producedFields()??[])n.set(e,a,!1)}return e}(n,e,o));const u=function(e){const t={};if(KG(e)&&e.component.selection)for(const n of Qi(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&dr(e.field)>1&&(t[e.field]="flatten")}return t}(e),l=jH(e);n=LH.makeWithAncestors(n,{},{...u,...l},o)??n,KG(e)&&(n=uV.parseAll(n,e),n=lV.parseAll(n,e)),(KG(e)||ZG(e))&&(s||(n=zH.makeFromEncoding(n,e)??n),n=Aq.makeFromEncoding(n,e)??n,n=TW.parseAllForSortIndex(n,e));const c=n=EV(gq.Raw,e,n);if(KG(e)){const t=NH.makeFromEncoding(n,e);t&&(n=t,tI(e)&&(n=new qH(n))),n=cV.makeFromEncoding(n,e)??n,n=fG.makeFromEncoding(n,e)??n}let f,d;if(KG(e)){const{markDef:t,mark:i,config:r}=e,a=ls("invalid",t,r),{marks:o,scales:s}=d=vq({invalid:a,isPath:KR(i)});o!==s&&"include-invalid-values"===s&&(f=n=EV(gq.PreFilterInvalid,e,n)),"exclude-invalid-values"===o&&(n=lG.make(n,e,d)??n)}const h=n=EV(gq.Main,e,n);let p;if(KG(e)&&d){const{marks:t,scales:i}=d;"include-invalid-values"===t&&"exclude-invalid-values"===i&&(n=lG.make(n,e,d)??n,p=n=EV(gq.PostFilterInvalid,e,n))}KG(e)&&function(e,t){for(const[n,i]of Zi(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new xq(new _W(t,e,{param:n}),r,gq.Lookup,e.component.data.outputNodeRefCounts)}}(e,h);let m=null;if(ZG(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(RT(r.sort)){const{field:n,op:i=zT}=r.sort;e=t=new uG(e,{joinaggregate:[{op:i,field:n,as:kV(r,r.sort,{forAs:!0})}],groupby:[cP(r)]})}return t}return null}(n,e.facet)??n,m=new RH(n,e,t,h.getSource()),i[t]=m}return{...e.component.data,outputNodes:i,outputNodeRefCounts:r,raw:c,main:h,facetRoot:m,ancestorParse:o,preFilterInvalid:f,postFilterInvalid:p}}function EV(e,t,n){const{outputNodes:i,outputNodeRefCounts:r}=t.component.data,a=t.getDataName(e),o=new xq(n,a,e,r);return i[a]=o,o}class $V extends nV{constructor(e,t,n,i){var r,a,o,s;super(e,"concat",t,n,i,e.resolve),"shared"!==(null==(a=null==(r=e.resolve)?void 0:r.axis)?void 0:a.x)&&"shared"!==(null==(s=null==(o=e.resolve)?void 0:o.axis)?void 0:s.y)||yN("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)=>JV(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=CV(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 Qi(e.component.selection))this.component.selection[t]=e.component.selection[t]}Object.values(this.component.selection).some((e=>iI(e)))&&gN(YO)}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return Bj(e)?e.vconcat:zj(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){wV(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";_V(e,t),_V(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=eH(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 SV={disable:1,gridScale:1,scale:1,...OP,labelExpr:1,encode:1},MV=Qi(SV);class BV extends nq{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new BV(zi(this.explicit),zi(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 Xo(this.explicit.orient)}}const zV={bottom:"top",top:"bottom",left:"right",right:"left"};function OV(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"),a=r.getWithExplicit("orient");if(t.explicit&&a.explicit&&t.value!==a.value)return;e[i]=NV(n,r)}}}return e}function NV(e,t){for(const n of MV){const i=sq(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",((e,t)=>{switch(n){case"title":return gs(e,t);case"gridScale":return{explicit:e.explicit,value:hr(e.value,t.value)}}return oq(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function RV(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(Xo(n.labelAngle)?n.labelAngle:br(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===RW(i,r))return!0}return e===n[t]}const TV=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function PV(e,t){var n,i;let r=t.axis(e);const a=new BV,o=xP(t.encoding[e]),{mark:s,config:u}=t,l=(null==r?void 0:r.orient)||(null==(n=u["x"===e?"axisX":"axisY"])?void 0:n.orient)||(null==(i=u.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"]:vR(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],a="x"===e?"axisX":"axisY",o=Xo(n)?"axisOrient":`axis${rr(n)}`,s=[...r,...r.map((e=>a+e.substr(4)))],u=["axis",o,a];return{vlOnlyAxisConfig:$W(s,i,e,n),vgAxisConfig:$W(u,i,e,n),axisConfigStyle:SW([...u,...s],i)}}(e,c,l,t.config),d=void 0!==r?!r:MW("disable",u.style,null==r?void 0:r.style,f).configValue;if(a.set("disable",d,void 0!==r),d)return a;r=r||{};const h=function(e,t,n,i,r){const a=null==t?void 0:t.labelAngle;if(void 0!==a)return Xo(a)?a:br(a);{const{configValue:a}=MW("labelAngle",i,null==t?void 0:t.style,r);return void 0!==a?br(a):n!==Er||!ji([nR,eR],e.type)||JT(e)&&e.timeUnit?void 0:270}}(o,r,e,u.style,f),p=ET(r.formatType,o,c),m=CT(o,o.type,r.format,r.formatType,u,!0),g={fieldOrDatumDef:o,axis:r,channel:e,model:t,scaleType:c,orient:l,labelAngle:h,format:m,formatType:p,mark:s,config:u};for(const b of MV){const n=b in BW?BW[b](g):RP(b)?r[b]:void 0,i=void 0!==n,o=RV(n,b,r,t,e);if(i&&o)a.set(b,n,o);else{const{configValue:e,configFrom:t}=RP(b)&&"values"!==b?MW(b,u.style,r.style,f):{},s=void 0!==e;i&&!s?a.set(b,n,o):("vgAxisConfig"!==t||TV.has(b)&&s||MP(e)||Xo(e))&&a.set(b,e,!1)}}const y=r.encoding??{},v=BP.reduce(((n,i)=>{if(!a.hasAxisPart(i))return n;const r=aH(y[i]??{},t),o="labels"===i?function(e,t,n){const{encoding:i,config:r}=e,a=xP(i[t])??xP(i[za(t)]),o=e.axis(t)||{},{format:s,formatType:u}=o;if(_T(u))return{text:FT({fieldOrDatumDef:a,field:"datum.value",format:s,formatType:u,config:r}),...n};if(void 0===s&&void 0===u&&r.customFormatTypes){if("quantitative"===QT(a)){if(oP(a)&&"normalize"===a.stack&&r.normalizedNumberFormatType)return{text:FT({fieldOrDatumDef:a,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:FT({fieldOrDatumDef:a,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===QT(a)&&r.timeFormatType&&JT(a)&&!a.timeUnit)return{text:FT({fieldOrDatumDef:a,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(t,e,r):r;return void 0===o||Ji(o)||(n[i]={update:o}),n}),{});return Ji(v)||a.set("encode",v,!!r.encoding||void 0!==r.labelAngle),a}function jV(e,t){const{config:n}=e;return{...$U(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...mU("x",e,{defaultPos:"mid"}),...mU("y",e,{defaultPos:"mid"}),...fU("size",e),...fU("angle",e),...LV(e,n,t)}}function LV(e,t,n){return n?{shape:{value:n}}:fU("shape",e)}function qV(e,t,n){if(void 0===ls("align",e,n))return"center"}function UV(e,t,n){if(void 0===ls("baseline",e,n))return"middle"}const IV={arc:{vgMark:"arc",encodeEntry:e=>({...$U(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...mU("x",e,{defaultPos:"mid"}),...mU("y",e,{defaultPos:"mid"}),...kU(e,"radius"),...kU(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...$U(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...wU("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...wU("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...BU(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...$U(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...kU(e,"x"),...kU(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>jV(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...$U(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&&JT(n)&&n.type===iR?{field:cP(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...$U(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...kU(e,"x"),...kU(e,"y"),...iU(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...$U(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...mU("x",e,{defaultPos:"mid"}),...mU("y",e,{defaultPos:"mid"}),...fU("size",e,{vgChannel:"strokeWidth"}),...BU(e)})},point:{vgMark:"symbol",encodeEntry:e=>jV(e)},rect:{vgMark:"rect",encodeEntry:e=>({...$U(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...kU(e,"x"),...kU(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?{...$U(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...wU("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...wU("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...fU("size",e,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:e=>jV(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...$U(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...mU("x",e,{defaultPos:"mid"}),...mU("y",e,{defaultPos:"mid"}),...iU(e),...fU("size",e,{vgChannel:"fontSize"}),...fU("angle",e),...zU("align",qV(e.markDef,n,t)),...zU("baseline",UV(e.markDef,n,t)),...mU("radius",e,{defaultPos:null}),...mU("theta",e,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"x":"y",a="horizontal"===i?"y":"x",o="horizontal"===i?"height":"width";return{...$U(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...kU(e,r),...mU(a,e,{defaultPos:"mid",vgChannel:"y"===a?"yc":"xc"}),[o]:rs(ls("thickness",n,t))}}},trail:{vgMark:"trail",encodeEntry:e=>({...$U(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...mU("x",e,{defaultPos:"mid"}),...mU("y",e,{defaultPos:"mid"}),...fU("size",e),...BU(e)})}};function WV(e){if(ji([UR,jR,YR],e.mark)){const t=YP(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:HV+e.requestDataName(gq.Main),data:e.requestDataName(gq.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:VV(e,{fromPrefix:HV})}]}(e,t)}else if(e.mark===LR){const t=es.some((t=>ls(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){var t;const[n]=VV(e,{fromPrefix:GV}),i=e.scaleName(e.stack.fieldChannel),r=(t={})=>e.vgField(e.stack.fieldChannel,t),a=(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 o,s;"x"===e.stack.fieldChannel?(o={...Ni(n.encode.update,["y","yc","y2","height",...es]),x:{signal:a("min","datum")},x2:{signal:a("max","datum")},clip:{value:!0}},s={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update={...Ri(n.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...Ni(n.encode.update,["x","xc","x2","width"]),y:{signal:a("min","datum")},y2:{signal:a("max","datum")},clip:{value:!0}},s={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update={...Ri(n.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const l of es){const t=cs(l,e.markDef,e.config);n.encode.update[l]?(o[l]=n.encode.update[l],delete n.encode.update[l]):t&&(o[l]=rs(t)),t&&(n.encode.update[l]={value:0})}const u=[];if((null==(t=e.stack.groupbyChannels)?void 0:t.length)>0)for(const l of e.stack.groupbyChannels){const t=e.fieldDef(l),n=cP(t);n&&u.push(n),((null==t?void 0:t.bin)||(null==t?void 0:t.timeUnit))&&u.push(cP(t,{binSuffix:"end"}))}o=["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=cs(i,e.markDef,e.config);return void 0!==n?{...t,[i]:rs(n)}:t}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0});return[{type:"group",from:{facet:{data:e.requestDataName(gq.Main),name:GV+e.requestDataName(gq.Main),groupby:u,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:s},marks:[n]}]}]}(e)}return VV(e)}const HV="faceted_path_";const GV="stack_group_";function VV(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:a}=e,o=hr(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)),s=us(i),u=r.key,c=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:a}=e,o=t.order;if(!(!l(o)&&rP(o)&&Pi(o.value)||!o&&Pi(ls("order",r,a)))){if((l(o)||JT(o))&&!n)return hs(o,{expr:"datum"});if(KR(i)){const e="horizontal"===r.orient?"y":"x";if(JT(t[e]))return{field:e}}}}(e),f=function(e){if(!e.component.selection)return null;const t=Qi(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=Qi(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}(e),d=ls("aria",i,a),h=IV[n].postEncodingTransform?IV[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:IV[n].vgMark,...o?{clip:o}:{},...s?{style:s}:{},...u?{key:u.field}:{},...c?{sort:c}:{},...f||{},...!1===d?{aria:d}:{},from:{data:t.fromPrefix+e.requestDataName(gq.Main)},encode:{update:IV[n].encodeEntry(e)},...h?{transform:h}:{}}]}class YV extends iV{constructor(e,t,n,i={},r){super(e,"unit",t,n,r,void 0,Rj(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[],this.correctDataNames=e=>{var t,n,i;return(null==(t=e.from)?void 0:t.data)&&(e.from.data=this.lookupDataSource(e.from.data),"time"in this.encoding&&(e.from.data=e.from.data+Bq)),(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};const a=tT(e.mark)?{...e.mark}:{type:e.mark},o=a.type;void 0===a.filled&&(a.filled=function(e,t,{graticule:n}){if(n)return!1;const i=cs("filled",e,t),r=e.type;return hr(i,r!==IR&&r!==UR&&r!==HR)}(a,r,{graticule:e.data&&mq(e.data)}));const s=this.encoding=function(e,t,n,i){const r={};for(const s of Qi(e))Ea(s)||yN(`${a=s}-encoding is dropped as ${a} is not a valid encoding channel.`);var a,o;for(let s of Pa){if(!e[s])continue;const a=e[s];if(uo(s)){const e=Ta(s),t=r[e];if(JT(t)&&("quantitative"===(o=t.type)||"temporal"===o)&&JT(a)&&!t.timeUnit){yN(QO(e));continue}}if("angle"!==s||"arc"!==t||e.theta||(yN("Arc marks uses theta channel rather than angle, replacing angle with theta."),s=Rr),HP(e,s,t)){if(s===Vr&&"line"===t){const t=bP(e[s]);if(null==t?void 0:t.aggregate){yN("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(s===Ir&&(n?"fill"in e:"stroke"in e))yN(ZO("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(s===na||s===ta&&!l(a)&&!rP(a)||s===ra&&l(a)){if(a){if(s===ta){const t=e[s];if(GT(t)){r[s]=t;continue}}r[s]=c(a).reduce(((e,t)=>(JT(t)?e.push(AP(t,s)):yN(eN(t,s)),e)),[])}}else{if(s===ra&&null===a)r[s]=null;else if(!(JT(a)||KT(a)||rP(a)||VT(a)||Xo(a))){yN(eN(a,s));continue}r[s]=wP(a,s,i)}}else yN(tN(s,t))}return r}(e.encoding||{},o,a.filled,r);this.markDef=uL(a,s,r),this.size=function({encoding:e,size:t}){for(const n of no){const i=Oa(n);Nj(t[i])&&ZT(e[n])&&(delete t[i],yN(lN(i)))}return t}({encoding:s,size:Rj(e)?{...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:i}),this.stack=sL(this.markDef,s),this.specifiedScales=this.initScales(o,s),this.specifiedAxes=this.initAxes(s),this.specifiedLegends=this.initLegends(s),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter((e=>$j(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===QR,n=e&&ha.some((t=>nP(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 Ao.reduce(((e,n)=>{const i=xP(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e}),{})}initScale(e){const{domain:t,range:n}=e,i=Go(e);return l(t)&&(i.domain=t.map(ns)),l(n)&&(i.range=n.map(ns)),i}initAxes(e){return no.reduce(((t,n)=>{const i=e[n];if(nP(i)||n===Er&&nP(e.x2)||n===$r&&nP(e.y2)){const e=nP(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=Qi(e),n={};for(const i of t){const t=e[i];n[i]=MP(t)?ts(t):ns(t)}return n}initLegends(e){return wo.reduce(((t,n)=>{const i=xP(e[n]);if(i&&function(e){switch(e){case Ir:case Wr:case Hr:case Vr:case Gr:case Xr:case Kr:case Zr:return!0;case Jr:case Qr:case Yr:case Ur:return!1}}(n)){const e=i.legend;t[n]=e?Go(e):e}return t}),{})}parseData(){this.component.data=CV(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of no){const r=Oa(i);if(t[r]){const e=t[r];n.layoutSize.set(r,Nj(e)?"step":e,!0)}else{const t=AV(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){const n={},r=e.config.selection;if(!t||!t.length)return n;let a=0;for(const s of t){const t=tr(s.name),u=s.select,l=i(u)?u:u.type,f=o(u)?zi(u):{type:l},d=r[l];for(const e in d)"fields"!==e&&"encodings"!==e&&("mark"===e&&(f.mark={...d.mark,...f.mark}),void 0!==f[e]&&!0!==f[e]||(f[e]=zi(d[e]??f[e])));const h=n[t]={...f,name:t,type:l,init:s.value,bind:s.bind,events:i(f.on)?US(f.on,"scope"):c(zi(f.on))};if(iI(h)&&(a++,a>1)){delete n[t];continue}const p=zi(s);for(const n of ZU)n.defined(h)&&n.parse&&n.parse(e,h,p)}return a>1&&yN("Multiple timer selections in one unit spec are not supported. Ignoring all but the first."),n}(this,this.selection)}parseMarkGroup(){this.component.mark=WV(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,no.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[PV(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;for(const i of Ki(e.component.selection??{})){const r=i.name,o=a(r+XU);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:`${KU}(${o}, ${a(e)}${n}`})}n=!0;for(const n of ZU)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 Vq(t)}(this,e)}assembleSignals(){return[...EW(this),...Wq(this,[])]}assembleSelectionData(e){return function(e,t){const n=[],i=[],r=eI(e,{escape:!1});for(const a of Ki(e.component.selection??{})){const o={name:a.name+XU};if(a.project.hasSelectionId&&(o.transform=[{type:"collect",sort:{field:Dj}}]),a.init){const e=a.project.items.map(Uq);o.values=a.project.hasSelectionId?a.init.map((e=>({unit:r,[Dj]:Iq(e,!1)[0]}))):a.init.map((t=>({unit:r,fields:e,values:Iq(t,!1)})))}if([...n,...t].filter((e=>e.name===a.name+XU)).length||n.push(o),iI(a)&&t.length){const n=e.lookupDataSource(e.getDataName(gq.Main)),r=t.find((e=>e.name===n)),a=r.transform.find((e=>"filter"===e.type&&e.expr.includes("vlSelectionTest")));if(a){r.transform=r.transform.filter((e=>e!==a));const e={name:r.name+Bq,source:r.name,transform:[a]};i.push(e)}}}return n.concat(t,i)}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return eH(this)}assembleMarks(){let e=this.component.mark??[];return this.parent&&tV(this.parent)||(e=Gq(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 LP(this.encoding,e)}fieldDef(e){return bP(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return iP(t)?t:null}}class XV extends nV{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view);const a={...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}};this.children=e.layer.map(((e,t)=>{if(eL(e))return new XV(e,this,this.getName(`layer_${t}`),a,r);if(PP(e))return new YV(e,this,this.getName(`layer_${t}`),a,r);throw new Error(TO(e))}))}parseData(){this.component.data=CV(this);for(const e of this.children)e.parseData()}parseLayoutSize(){var e;wV(e=this),_V(e,"width"),_V(e,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of Qi(e.component.selection))this.component.selection[t]=e.component.selection[t]}Object.values(this.component.selection).some((e=>iI(e)))&&gN(YO)}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 Qi(r.component.axes))n.axis[i]=sH(e.component.resolve,i),"shared"===n.axis[i]&&(t[i]=OV(t[i],r.component.axes[i]),t[i]||(n.axis[i]="independent",delete t[i]))}for(const r of no){for(const a of e.children)if(a.component.axes[r]){if("independent"===n.axis[r]){t[r]=(t[r]??[]).concat(a.component.axes[r]);for(const e of a.component.axes[r]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!Xo(t)){if(i[t]>0&&!n){const n=zV[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}}delete a.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())),EW(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),eH(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 c(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)KG(n)&&(t=Gq(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),AH(this))}}function JV(e,t,n,i,r){if(LT(e))return new DV(e,t,n,r);if(eL(e))return new XV(e,t,n,i,r);if(PP(e))return new YV(e,t,n,i,r);if(function(e){return Bj(e)||zj(e)||Mj(e)}(e))return new $V(e,t,n,r);throw new Error(TO(e))}function QV(e,t={}){var n;t.logger&&(n=t.logger,mN=n),t.fieldTitle&&pP(t.fieldTitle);try{const n=Yj(Ie(t.config,e.config)),r=XL(e,n),a=JV(r,null,"",void 0,n);a.parse(),function(e,t){gG(e.sources);let n=0,i=0;for(let r=0;r<5&&vG(e,t,!0);r++)n++;e.sources.map(hG);for(let r=0;r<5&&vG(e,t,!1);r++)i++;gG(e.sources),5===Math.max(n,i)&&yN("Maximum optimization runs(5) reached.")}(a.component.data,a);const o=function(e,t,n={},i){const r=e.config?Kj(e.config):void 0,a=function(e,t){const n=[],i=yV(n);let r=0;for(const o of e.sources){o.hasName()||(o.dataName="source_"+r++);const e=o.assemble();i(o,e)}for(const o of n)0===o.transform.length&&delete o.transform;let a=0;for(const[o,s]of n.entries())0!==(s.transform??[]).length||s.source||n.splice(a++,0,n.splice(o,1)[0]);for(const o of n)for(const t of o.transform??[])"lookup"===t.type&&(t.from=e.outputNodes[t.from].getSource());for(const o of n)o.name in t&&(o.values=t[o.name]);return n}(e.component.data,n),o=e.assembleSelectionData(a),s=e.assembleProjections(),u=e.assembleTitle(),l=e.assembleGroupStyle(),c=e.assembleGroupEncodeEntry(!0);let f=e.assembleLayoutSignals();f=f.filter((e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:d,...h}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...h,...u?{title:u}:{},...l?{style:l}:{},...c?{encode:{update:c}}:{},data:o,...s.length>0?{projections:s}:{},...e.assembleGroup([...f,...e.assembleSelectionTopLevelSignals([]),...Sj(d)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}(a,function(e,t,n,r){const a=r.component.layoutSize.get("width"),o=r.component.layoutSize.get("height");void 0===t?(t={type:"pad"},r.hasAxisOrientSignalRef()&&(t.resize=!0)):i(t)&&(t={type:t});if(a&&o&&(s=t.type,["fit","fit-x","fit-y"].includes(s)))if("step"===a&&"step"===o)yN(qO()),t.type="pad";else if("step"===a||"step"===o){const e="step"===a?"width":"height";yN(qO(oo(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${oo(e)}`:"fit"}(n)}var s;return{...1===Qi(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t},...tq(n,!1),...tq(e,!0)}}(e,r.autosize,n,a),e.datasets,e.usermeta);return{spec:o,normalized:r}}finally{t.logger&&(mN=pN),t.fieldTitle&&pP(dP)}}export{Oi as A,XL as B,br as C,Ri as D,Ni as E,Yi as F,fr as G,cr as H,lr as I,gr as J,Gi as K,Li as L,TR as M,Ar as N,rr as O,Wi as P,mr as Q,Ki as R,tr as S,RO as T,Oo as U,wo as V,bi as W,dr as a,ar as b,sr as c,QV as d,ji as e,_r as f,ir as g,zi as h,Zi as i,qi as j,Xi as k,or as l,hr as m,Vi as n,kr as o,Ti as p,yr as q,er as r,Ji as s,Hi as t,vr as u,Pi as v,xr as w,Qi as x,nr as y,Ui as z};