1 line
1.2 KiB
JavaScript
1 line
1.2 KiB
JavaScript
import{I as e,L as t,S as n}from"./src-BrOGWJpF.js";function r(e,t){return t<e?-1:t>e?1:t>=e?0:NaN}function i(e){return e}function a(){var a=i,o=r,s=null,c=t(0),l=t(e),u=t(0);function d(t){var r,i=(t=n(t)).length,d,f,p=0,m=Array(i),h=Array(i),g=+c.apply(this,arguments),_=Math.min(e,Math.max(-e,l.apply(this,arguments)-g)),v,y=Math.min(Math.abs(_)/i,u.apply(this,arguments)),b=y*(_<0?-1:1),x;for(r=0;r<i;++r)(x=h[m[r]=r]=+a(t[r],r,t))>0&&(p+=x);for(o==null?s!=null&&m.sort(function(e,n){return s(t[e],t[n])}):m.sort(function(e,t){return o(h[e],h[t])}),r=0,f=p?(_-i*b)/p:0;r<i;++r,g=v)d=m[r],x=h[d],v=g+(x>0?x*f:0)+b,h[d]={data:t[d],index:r,value:x,startAngle:g,endAngle:v,padAngle:y};return h}return d.value=function(e){return arguments.length?(a=typeof e==`function`?e:t(+e),d):a},d.sortValues=function(e){return arguments.length?(o=e,s=null,d):o},d.sort=function(e){return arguments.length?(s=e,o=null,d):s},d.startAngle=function(e){return arguments.length?(c=typeof e==`function`?e:t(+e),d):c},d.endAngle=function(e){return arguments.length?(l=typeof e==`function`?e:t(+e),d):l},d.padAngle=function(e){return arguments.length?(u=typeof e==`function`?e:t(+e),d):u},d}export{a as t}; |