import{n as e}from"./path-B8eU812l.js";import{p as t}from"./math-PTJA2B8q.js";import{t as n}from"./array-D2R06_hj.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=e(0),l=e(t),u=e(0);function d(e){var r,i=(e=n(e)).length,d,f,p=0,m=Array(i),h=Array(i),g=+c.apply(this,arguments),_=Math.min(t,Math.max(-t,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(e[r],r,e))>0&&(p+=x);for(o==null?s!=null&&m.sort(function(t,n){return s(e[t],e[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:e[d],index:r,value:x,startAngle:g,endAngle:v,padAngle:y};return h}return d.value=function(t){return arguments.length?(a=typeof t==`function`?t:e(+t),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(t){return arguments.length?(c=typeof t==`function`?t:e(+t),d):c},d.endAngle=function(t){return arguments.length?(l=typeof t==`function`?t:e(+t),d):l},d.padAngle=function(t){return arguments.length?(u=typeof t==`function`?t:e(+t),d):u},d}export{a as t};