import{a as e,i as t,n,t as r}from"./defaultLocale.CNPGWpMu.js";import{n as i}from"./init.ZlXS9mIS.js";import{n as a}from"./string.2gFcx07-.js";import{t as o}from"./value.D6n4OHqi.js";function s(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function c(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function l(e){let t,n,r;e.length===2?(t=e===s||e===c?e:u,n=e,r=e):(t=s,n=(t,n)=>s(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function u(){return 0}function d(e){return e===null?NaN:+e}function*f(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var p=l(s),m=p.right,h=p.left;l(d).center;var g=Math.sqrt(50),_=Math.sqrt(10),v=Math.sqrt(2);function y(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=g?10:a>=_?5:a>=v?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?y(e,t,n*2):[s,c,l]}function b(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?y(t,e,n):y(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r){if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o}else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function x(e,t,n){return t=+t,e=+e,n=+n,y(e,t,n)[2]}function S(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?x(t,e,n):x(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function C(t){return Math.max(0,-e(Math.abs(t)))}function w(t,n){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(e(n)/3)))*3-e(Math.abs(t)))}function T(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,e(n)-e(t))+1}function E(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function D(e){return function(){return e}}function O(e){return+e}var k=[0,1];function A(e){return e}function j(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:D(isNaN(t)?NaN:.5)}function M(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function N(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=j(i,r),a=n(o,a)):(r=j(r,i),a=n(a,o)),function(e){return a(r(e))}}function P(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=j(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=m(e,t,1,r)-1;return a[n](i[n](t))}}function F(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function I(){var e=k,t=k,n=o,r,i,s,c=A,l,u,d;function f(){var n=Math.min(e.length,t.length);return c!==A&&(c=M(e[0],e[n-1])),l=n>2?P:N,u=d=null,p}function p(i){return i==null||isNaN(i=+i)?s:(u||=l(e.map(r),t,n))(r(c(i)))}return p.invert=function(n){return c(i((d||=l(t,e.map(r),a))(n)))},p.domain=function(t){return arguments.length?(e=Array.from(t,O),f()):e.slice()},p.range=function(e){return arguments.length?(t=Array.from(e),f()):t.slice()},p.rangeRound=function(e){return t=Array.from(e),n=E,f()},p.clamp=function(e){return arguments.length?(c=e?!0:A,f()):c!==A},p.interpolate=function(e){return arguments.length?(n=e,f()):n},p.unknown=function(e){return arguments.length?(s=e,p):s},function(e,t){return r=e,i=t,f()}}function L(){return I()(A,A)}function R(e,i,a,o){var s=S(e,i,a),c;switch(o=t(o??`,f`),o.type){case`s`:var l=Math.max(Math.abs(e),Math.abs(i));return o.precision==null&&!isNaN(c=w(s,l))&&(o.precision=c),n(o,l);case``:case`e`:case`g`:case`p`:case`r`:o.precision==null&&!isNaN(c=T(s,Math.max(Math.abs(e),Math.abs(i))))&&(o.precision=c-(o.type===`e`));break;case`f`:case`%`:o.precision==null&&!isNaN(c=C(s))&&(o.precision=c-(o.type===`%`)*2)}return r(o)}function z(e){var t=e.domain;return e.ticks=function(e){var n=t();return b(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return R(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-->0;){if(l=x(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function B(){var e=L();return e.copy=function(){return F(e,B())},i.apply(e,arguments),z(e)}export{d as _,F as a,s as b,O as c,w as d,C as f,m as g,h,L as i,E as l,b as m,z as n,A as o,S as p,R as r,I as s,B as t,T as u,f as v,l as y};