function f(n,t,e){return n.fields=t||[],n.fname=e,n}function H(n){return n==null?null:n.fname}function R(n){return n==null?null:n.fields}function I(n){return n.length===1?Q(n[0]):Y(n)}const Q=n=>function(t){return t[n]},Y=n=>{const t=n.length;return function(e){for(let r=0;ri?l():i=c+1:s==="["?(c>i&&l(),o=i=c+1):s==="]"&&(o||b("Access path missing open bracket: "+n),o>0&&l(),o=0,i=c+1)}return o&&b("Access path missing closing bracket: "+n),r&&b("Access path missing closing quote: "+n),c>i&&(c++,l()),t}function z(n,t,e){const r=N(n);return n=r.length===1?r[0]:n,f((e&&e.get||I)(r),[n],t||n)}const k=z("id"),A=f(n=>n,[],"identity"),y=f(()=>0,[],"zero"),v=f(()=>1,[],"one"),_=f(()=>!0,[],"true"),nn=f(()=>!1,[],"false");function tn(n,t,e){const r=[t].concat([].slice.call(e));console[n].apply(console,r)}const C=0,$=1,q=2,F=3,T=4;function en(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tn,r=n||C;return{level(o){return arguments.length?(r=+o,this):r},error(){return r>=$&&e(t||"error","ERROR",arguments),this},warn(){return r>=q&&e(t||"warn","WARN",arguments),this},info(){return r>=F&&e(t||"log","INFO",arguments),this},debug(){return r>=T&&e(t||"log","DEBUG",arguments),this}}}var w=Array.isArray;function M(n){return n===Object(n)}const U=n=>n!=="__proto__";function rn(){for(var n=arguments.length,t=new Array(n),e=0;e{for(const u in o)if(u==="signals")r.signals=on(r.signals,o.signals);else{const i=u==="legend"?{layout:1}:u==="style"?!0:null;S(r,u,o[u],i)}return r},{})}function S(n,t,e,r){if(!U(t))return;let o,u;if(M(e)&&!w(e)){u=M(n[t])?n[t]:n[t]={};for(o in e)r&&(r===!0||r[o])?S(u,o,e[o]):U(o)&&(u[o]=e[o])}else n[t]=e}function on(n,t){if(n==null)return t;const e={},r=[];function o(u){e[u.name]||(e[u.name]=1,r.push(u))}return t.forEach(o),n.forEach(o),r}function a(n){return n[n.length-1]}function L(n){return n==null||n===""?null:+n}const B=n=>t=>n*Math.exp(t),G=n=>t=>Math.log(n*t),W=n=>t=>Math.sign(t)*Math.log1p(Math.abs(t/n)),x=n=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*n,E=n=>t=>t<0?-Math.pow(-t,n):Math.pow(t,n);function d(n,t,e,r){const o=e(n[0]),u=e(a(n)),i=(u-o)*t;return[r(o-i),r(u-i)]}function un(n,t){return d(n,t,L,A)}function cn(n,t){var e=Math.sign(n[0]);return d(n,t,G(e),B(e))}function sn(n,t,e){return d(n,t,E(e),E(1/e))}function ln(n,t,e){return d(n,t,W(e),x(e))}function j(n,t,e,r,o){const u=r(n[0]),i=r(a(n)),c=t!=null?r(t):(u+i)/2;return[o(c+(u-c)*e),o(c+(i-c)*e)]}function fn(n,t,e){return j(n,t,e,L,A)}function gn(n,t,e){const r=Math.sign(n[0]);return j(n,t,e,G(r),B(r))}function an(n,t,e,r){return j(n,t,e,E(r),E(1/r))}function hn(n,t,e,r){return j(n,t,e,W(r),x(r))}function pn(n){return 1+~~(new Date(n).getMonth()/3)}function mn(n){return 1+~~(new Date(n).getUTCMonth()/3)}function p(n){return n!=null?w(n)?n:[n]:[]}function bn(n,t,e){let r=n[0],o=n[1],u;return o=e-t?[t,e]:[r=Math.min(Math.max(r,t),e-u),r+u]}function O(n){return typeof n=="function"}const wn="descending";function Mn(n,t,e){e=e||{},t=p(t)||[];const r=[],o=[],u={},i=e.comparator||En;return p(n).forEach((c,s)=>{if(c==null)return;r.push(t[s]===wn?-1:1),o.push(c=O(c)?c:z(c,null,e)),(R(c)||[]).forEach(l=>u[l]=1)}),o.length===0?null:f(i(o,r),Object.keys(u))}const P=(n,t)=>(nt||t==null)&&n!=null?1:(t=t instanceof Date?+t:t,n=n instanceof Date?+n:n)!==n&&t===t?-1:t!==t&&n===n?1:0,En=(n,t)=>n.length===1?dn(n[0],t[0]):jn(n,t,n.length),dn=(n,t)=>function(e,r){return P(n(e),n(r))*t},jn=(n,t,e)=>(t.push(0),function(r,o){let u,i=0,c=-1;for(;i===0&&++cn}function Dn(n,t){let e;return r=>{e&&clearTimeout(e),e=setTimeout(()=>(t(r),e=null),n)}}function J(n){for(let t,e,r=1,o=arguments.length;ri&&(i=o))}else{for(o=t(n[e]);ei&&(i=o))}return[u,i]}function zn(n,t){const e=n.length;let r=-1,o,u,i,c,s;if(t==null){for(;++r=u){o=i=u;break}if(r===e)return[-1,-1];for(c=s=r;++ru&&(o=u,c=r),i=u){o=i=u;break}if(r===e)return[-1,-1];for(c=s=r;++ru&&(o=u,c=r),i{o.set(u,n[u])}),o}function Ln(n,t,e,r,o,u){if(!e&&e!==0)return u;const i=+e;let c=n[0],s=a(n),l;su&&(i=o,o=u,u=i),e=e===void 0||e,r=r===void 0||r,(e?o<=n:oc.replace(/\\(.)/g,"$1")):p(n));const r=n&&n.length,o=e&&e.get||I,u=c=>o(t?[c]:N(c));let i;if(!r)i=function(){return""};else if(r===1){const c=u(n[0]);i=function(s){return""+c(s)}}else{const c=n.map(u);i=function(s){let l=""+c[0](s),h=0;for(;++h{t={},e={},r=0},u=(i,c)=>(++r>n&&(e=t,t={},r=1),t[i]=c);return o(),{clear:o,has:i=>g(t,i)||g(e,i),get:i=>g(t,i)?t[i]:g(e,i)?u(i,e[i]):void 0,set:(i,c)=>g(t,i)?t[i]=c:u(i,c)}}function Bn(n,t,e,r){const o=t.length,u=e.length;if(!u)return t;if(!o)return e;const i=r||new t.constructor(o+u);let c=0,s=0,l=0;for(;c0?e[s++]:t[c++];for(;c=0;)e+=n;return e}function Gn(n,t,e,r){const o=e||" ",u=n+"",i=t-u.length;return i<=0?u:r==="left"?m(o,i)+u:r==="center"?m(o,~~(i/2))+u+m(o,Math.ceil(i/2)):u+m(o,i)}function Wn(n){return n&&a(n)-n[0]||0}function Z(n){return w(n)?"["+n.map(Z)+"]":M(n)||X(n)?JSON.stringify(n).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):n}function xn(n){return n==null||n===""?null:!n||n==="false"||n==="0"?!1:!!n}const Jn=n=>V(n)||K(n)?n:Date.parse(n);function Kn(n,t){return t=t||Jn,n==null||n===""?null:t(n)}function Vn(n){return n==null||n===""?null:n+""}function Xn(n){const t={},e=n.length;for(let r=0;r