@orbcharts/plugins-basic 3.0.0-alpha.72 → 3.0.0-alpha.73

Sign up to get free protection for your applications and to get access to all the features.
@@ -21884,34 +21884,7 @@ c2.textRenderFn.toString = () => `(eventData) => {
21884
21884
  }
21885
21885
  return []
21886
21886
  }`;
21887
- const Jh = "Tooltip", c0 = it(Jh, "g"), SE = it(Jh, "box");
21888
- function AE(t, e) {
21889
- const n = e.textSizePx * 1.5, i = (t == null ? [] : Array.isArray(t) ? t : typeof t == "string" ? t.split(`
21890
- `) : [t]).filter((o) => o != "").map((o, a) => `<tspan x="0" y="${a * n}">${o}</tspan>`).join("");
21891
- return i ? `<text font-size="${e.textSize}" fill="${e.textColor}" x="0" y="0" style="dominant-baseline:text-before-edge">
21892
- ${i}
21893
- </text>` : "";
21894
- }
21895
- function TE({ rootSelection: t, pluginName: e, rootWidth: n, rootHeight: r, svgString: i, tooltipStyle: o, event: a }) {
21896
- t.interrupt("fadeout");
21897
- const s = 5, u = i ? [i] : [], l = i ? [o] : [], f = t.selectAll(`g.${c0}`).data(u).join(
21898
- (x) => x.append("g").classed(c0, !0).attr("pointer-events", "none"),
21899
- (x) => x,
21900
- (x) => x.style("opacity", 0).remove()
21901
- ).attr("transform", () => `translate(${a.offsetX}, ${a.offsetY})`).selectAll(`g.${SE}`).data(l).join(
21902
- (x) => x.append("g").classed(it(e, "box"), !0)
21903
- ), h = f.selectAll("rect").data(l).join(
21904
- (x) => x.append("rect").attr("rx", s).attr("ry", s)
21905
- ).attr("fill", (x) => x.backgroundColor).attr("stroke", (x) => x.strokeColor).attr("opacity", (x) => x.backgroundOpacity), p = f.selectAll("g").data(u).join(
21906
- (x) => x.append("g").classed(it(e, "content"), !0).attr("transform", () => `translate(${o.padding}, ${o.padding})`)
21907
- );
21908
- u.length && WR(p, u[0]);
21909
- const d = p != null && p.node() ? Vg(p) : { width: 0, height: 0 };
21910
- h.attr("width", d.width + o.padding * 2).attr("height", d.height + o.padding * 2);
21911
- const g = f != null && f.node() ? Vg(f) : { width: 0, height: 0 }, m = n - g.width, y = r - g.height, b = a.offsetX + o.offset[0] > m ? m - a.offsetX : o.offset[0], v = a.offsetY + o.offset[1] > y ? y - a.offsetY : o.offset[1];
21912
- f.attr("transform", (x) => `translate(${b}, ${v})`), f.attr("transform", (x) => `translate(${b}, ${v})`);
21913
- }
21914
- const PE = {
21887
+ const Jh = "Tooltip", c0 = it(Jh, "g"), SE = it(Jh, "box"), AE = {
21915
21888
  name: Jh,
21916
21889
  defaultParams: c2,
21917
21890
  layerIndex: tI,
@@ -21936,13 +21909,40 @@ const PE = {
21936
21909
  toBeOption: "ColorType"
21937
21910
  },
21938
21911
  textRenderFn: {
21939
- toBeTypes: ["Function"]
21912
+ toBeTypes: ["Function", "null"]
21940
21913
  },
21941
21914
  svgRenderFn: {
21942
- toBeTypes: ["Function"]
21915
+ toBeTypes: ["Function", "null"]
21943
21916
  }
21944
21917
  })
21945
- }, JN = CT(PE)(({ selection: t, rootSelection: e, name: n, chartType: r, observer: i, subject: o }) => {
21918
+ };
21919
+ function TE(t, e) {
21920
+ const n = e.textSizePx * 1.5, i = (t == null ? [] : Array.isArray(t) ? t : typeof t == "string" ? t.split(`
21921
+ `) : [t]).filter((o) => o != "").map((o, a) => `<tspan x="0" y="${a * n}">${o}</tspan>`).join("");
21922
+ return i ? `<text font-size="${e.textSize}" fill="${e.textColor}" x="0" y="0" style="dominant-baseline:text-before-edge">
21923
+ ${i}
21924
+ </text>` : "";
21925
+ }
21926
+ function PE({ rootSelection: t, pluginName: e, rootWidth: n, rootHeight: r, svgString: i, tooltipStyle: o, event: a }) {
21927
+ t.interrupt("fadeout");
21928
+ const s = 5, u = i ? [i] : [], l = i ? [o] : [], f = t.selectAll(`g.${c0}`).data(u).join(
21929
+ (x) => x.append("g").classed(c0, !0).attr("pointer-events", "none"),
21930
+ (x) => x,
21931
+ (x) => x.style("opacity", 0).remove()
21932
+ ).attr("transform", () => `translate(${a.offsetX}, ${a.offsetY})`).selectAll(`g.${SE}`).data(l).join(
21933
+ (x) => x.append("g").classed(it(e, "box"), !0)
21934
+ ), h = f.selectAll("rect").data(l).join(
21935
+ (x) => x.append("rect").attr("rx", s).attr("ry", s)
21936
+ ).attr("fill", (x) => x.backgroundColor).attr("stroke", (x) => x.strokeColor).attr("opacity", (x) => x.backgroundOpacity), p = f.selectAll("g").data(u).join(
21937
+ (x) => x.append("g").classed(it(e, "content"), !0).attr("transform", () => `translate(${o.padding}, ${o.padding})`)
21938
+ );
21939
+ u.length && WR(p, u[0]);
21940
+ const d = p != null && p.node() ? Vg(p) : { width: 0, height: 0 };
21941
+ h.attr("width", d.width + o.padding * 2).attr("height", d.height + o.padding * 2);
21942
+ const g = f != null && f.node() ? Vg(f) : { width: 0, height: 0 }, m = n - g.width, y = r - g.height, b = a.offsetX + o.offset[0] > m ? m - a.offsetX : o.offset[0], v = a.offsetY + o.offset[1] > y ? y - a.offsetY : o.offset[1];
21943
+ f.attr("transform", (x) => `translate(${b}, ${v})`), f.attr("transform", (x) => `translate(${b}, ${v})`);
21944
+ }
21945
+ const JN = CT(AE)(({ selection: t, rootSelection: e, name: n, chartType: r, observer: i, subject: o }) => {
21946
21946
  const a = new et(), s = o.event$.pipe(
21947
21947
  E(a),
21948
21948
  Qi((g) => g.eventName === "mouseover" || g.eventName === "mousemove")
@@ -21977,8 +21977,8 @@ const PE = {
21977
21977
  E(a),
21978
21978
  H(async (g) => g),
21979
21979
  B((g) => g.fullParams.svgRenderFn ? g.fullParams.svgRenderFn : (m) => {
21980
- const y = g.fullParams.textRenderFn(m);
21981
- return AE(y, g.tooltipStyle);
21980
+ const y = g.fullParams.textRenderFn ? g.fullParams.textRenderFn(m) : null;
21981
+ return TE(y, g.tooltipStyle);
21982
21982
  })
21983
21983
  ), h = W({
21984
21984
  event: s,
@@ -22007,7 +22007,7 @@ const PE = {
22007
22007
  E(a),
22008
22008
  H(async (g) => g)
22009
22009
  ).subscribe((g) => {
22010
- TE({
22010
+ PE({
22011
22011
  rootSelection: e,
22012
22012
  pluginName: n,
22013
22013
  rootWidth: g.layout.rootWidth,
@@ -56,10 +56,10 @@
56
56
  return [label, value]
57
57
  }
58
58
  return []
59
- }`;const np="Tooltip",A2=ot(np,"g"),RI=ot(np,"box");function EI(t,e){const n=e.textSizePx*1.5,i=(t==null?[]:Array.isArray(t)?t:typeof t=="string"?t.split(`
59
+ }`;const np="Tooltip",A2=ot(np,"g"),RI=ot(np,"box"),EI={name:np,defaultParams:ep,layerIndex:gE,validator:(t,{validateColumns:e})=>e(t,{backgroundColorType:{toBeOption:"ColorType"},backgroundOpacity:{toBeTypes:["number"]},strokeColorType:{toBeOption:"ColorType"},offset:{toBe:"[number, number]",test:r=>Array.isArray(r)&&r.length===2&&typeof r[0]=="number"&&typeof r[1]=="number"},padding:{toBeTypes:["number"]},textColorType:{toBeOption:"ColorType"},textRenderFn:{toBeTypes:["Function","null"]},svgRenderFn:{toBeTypes:["Function","null"]}})};function II(t,e){const n=e.textSizePx*1.5,i=(t==null?[]:Array.isArray(t)?t:typeof t=="string"?t.split(`
60
60
  `):[t]).filter(o=>o!="").map((o,a)=>`<tspan x="0" y="${a*n}">${o}</tspan>`).join("");return i?`<text font-size="${e.textSize}" fill="${e.textColor}" x="0" y="0" style="dominant-baseline:text-before-edge">
61
61
  ${i}
62
- </text>`:""}function II({rootSelection:t,pluginName:e,rootWidth:n,rootHeight:r,svgString:i,tooltipStyle:o,event:a}){t.interrupt("fadeout");const s=5,u=i?[i]:[],l=i?[o]:[],f=t.selectAll(`g.${A2}`).data(u).join(x=>x.append("g").classed(A2,!0).attr("pointer-events","none"),x=>x,x=>x.style("opacity",0).remove()).attr("transform",()=>`translate(${a.offsetX}, ${a.offsetY})`).selectAll(`g.${RI}`).data(l).join(x=>x.append("g").classed(ot(e,"box"),!0)),h=f.selectAll("rect").data(l).join(x=>x.append("rect").attr("rx",s).attr("ry",s)).attr("fill",x=>x.backgroundColor).attr("stroke",x=>x.strokeColor).attr("opacity",x=>x.backgroundOpacity),p=f.selectAll("g").data(u).join(x=>x.append("g").classed(ot(e,"content"),!0).attr("transform",()=>`translate(${o.padding}, ${o.padding})`));u.length&&iE(p,u[0]);const d=p!=null&&p.node()?Dv(p):{width:0,height:0};h.attr("width",d.width+o.padding*2).attr("height",d.height+o.padding*2);const g=f!=null&&f.node()?Dv(f):{width:0,height:0},m=n-g.width,y=r-g.height,b=a.offsetX+o.offset[0]>m?m-a.offsetX:o.offset[0],v=a.offsetY+o.offset[1]>y?y-a.offsetY:o.offset[1];f.attr("transform",x=>`translate(${b}, ${v})`),f.attr("transform",x=>`translate(${b}, ${v})`)}const NI=HT({name:np,defaultParams:ep,layerIndex:gE,validator:(t,{validateColumns:e})=>e(t,{backgroundColorType:{toBeOption:"ColorType"},backgroundOpacity:{toBeTypes:["number"]},strokeColorType:{toBeOption:"ColorType"},offset:{toBe:"[number, number]",test:r=>Array.isArray(r)&&r.length===2&&typeof r[0]=="number"&&typeof r[1]=="number"},padding:{toBeTypes:["number"]},textColorType:{toBeOption:"ColorType"},textRenderFn:{toBeTypes:["Function"]},svgRenderFn:{toBeTypes:["Function"]}})})(({selection:t,rootSelection:e,name:n,chartType:r,observer:i,subject:o})=>{const a=new nt,s=o.event$.pipe(I(a),$i(g=>g.eventName==="mouseover"||g.eventName==="mousemove")),u=o.event$.pipe(I(a),$i(g=>g.eventName==="mouseout")),l=GT(i.fullChartParams$),c=U({fullChartParams:i.fullChartParams$,fullParams:i.fullParams$,textSizePx:l}).pipe(I(a),W(async g=>g),B(g=>({backgroundColor:kt(g.fullParams.backgroundColorType,g.fullChartParams),backgroundOpacity:g.fullParams.backgroundOpacity,strokeColor:kt(g.fullParams.strokeColorType,g.fullChartParams),offset:g.fullParams.offset,padding:g.fullParams.padding,textSize:g.fullChartParams.styles.textSize,textSizePx:g.textSizePx,textColor:kt(g.fullParams.textColorType,g.fullChartParams)}))),f=U({fullParams:i.fullParams$,tooltipStyle:c}).pipe(I(a),W(async g=>g),B(g=>g.fullParams.svgRenderFn?g.fullParams.svgRenderFn:m=>{const y=g.fullParams.textRenderFn(m);return EI(y,g.tooltipStyle)})),h=U({event:s,contentRenderFn:f}).pipe(I(a),W(async g=>g),B(g=>g.contentRenderFn(g.event))),p=u.pipe(I(a),B(g=>"")),d=il(s,u).pipe(I(a),B(g=>g.event));return U({svgString:il(h,p),event:d,layout:i.layout$,tooltipStyle:c}).pipe(I(a),W(async g=>g)).subscribe(g=>{II({rootSelection:e,pluginName:n,rootWidth:g.layout.rootWidth,rootHeight:g.layout.rootHeight,svgString:g.svgString,tooltipStyle:g.tooltipStyle,event:g.event})}),function(){a.next(void 0)}}),T2={force:{strength:.08,velocityDecay:.3,collisionSpacing:2},bubbleText:{fillRate:.6,lineHeight:12,lineLengthMin:4},arcScaleType:"area"},P2={outerRadius:.85,innerRadius:0,outerRadiusWhileHighlight:.9,startAngle:0,endAngle:Math.PI*2,padAngle:0,strokeColorType:"background",strokeWidth:1,cornerRadius:0},rp={eventFn:(t,e,n)=>e==="mouseover"||e==="mousemove"?[String(t.datum.value)]:[String(Math.round(t.data.reduce((r,i)=>r+i.reduce((o,a)=>o+(a.value??0),0),0)*n))],textAttrs:[{transform:"translate(0, 0)"}],textStyles:[{"font-weight":"bold","text-anchor":"middle","pointer-events":"none","dominant-baseline":"middle","font-size":64,fill:"#000"}]};rp.eventFn.toString=()=>`(eventData: EventSeries, eventName: EventName, t: number) => {
62
+ </text>`:""}function NI({rootSelection:t,pluginName:e,rootWidth:n,rootHeight:r,svgString:i,tooltipStyle:o,event:a}){t.interrupt("fadeout");const s=5,u=i?[i]:[],l=i?[o]:[],f=t.selectAll(`g.${A2}`).data(u).join(x=>x.append("g").classed(A2,!0).attr("pointer-events","none"),x=>x,x=>x.style("opacity",0).remove()).attr("transform",()=>`translate(${a.offsetX}, ${a.offsetY})`).selectAll(`g.${RI}`).data(l).join(x=>x.append("g").classed(ot(e,"box"),!0)),h=f.selectAll("rect").data(l).join(x=>x.append("rect").attr("rx",s).attr("ry",s)).attr("fill",x=>x.backgroundColor).attr("stroke",x=>x.strokeColor).attr("opacity",x=>x.backgroundOpacity),p=f.selectAll("g").data(u).join(x=>x.append("g").classed(ot(e,"content"),!0).attr("transform",()=>`translate(${o.padding}, ${o.padding})`));u.length&&iE(p,u[0]);const d=p!=null&&p.node()?Dv(p):{width:0,height:0};h.attr("width",d.width+o.padding*2).attr("height",d.height+o.padding*2);const g=f!=null&&f.node()?Dv(f):{width:0,height:0},m=n-g.width,y=r-g.height,b=a.offsetX+o.offset[0]>m?m-a.offsetX:o.offset[0],v=a.offsetY+o.offset[1]>y?y-a.offsetY:o.offset[1];f.attr("transform",x=>`translate(${b}, ${v})`),f.attr("transform",x=>`translate(${b}, ${v})`)}const BI=HT(EI)(({selection:t,rootSelection:e,name:n,chartType:r,observer:i,subject:o})=>{const a=new nt,s=o.event$.pipe(I(a),$i(g=>g.eventName==="mouseover"||g.eventName==="mousemove")),u=o.event$.pipe(I(a),$i(g=>g.eventName==="mouseout")),l=GT(i.fullChartParams$),c=U({fullChartParams:i.fullChartParams$,fullParams:i.fullParams$,textSizePx:l}).pipe(I(a),W(async g=>g),B(g=>({backgroundColor:kt(g.fullParams.backgroundColorType,g.fullChartParams),backgroundOpacity:g.fullParams.backgroundOpacity,strokeColor:kt(g.fullParams.strokeColorType,g.fullChartParams),offset:g.fullParams.offset,padding:g.fullParams.padding,textSize:g.fullChartParams.styles.textSize,textSizePx:g.textSizePx,textColor:kt(g.fullParams.textColorType,g.fullChartParams)}))),f=U({fullParams:i.fullParams$,tooltipStyle:c}).pipe(I(a),W(async g=>g),B(g=>g.fullParams.svgRenderFn?g.fullParams.svgRenderFn:m=>{const y=g.fullParams.textRenderFn?g.fullParams.textRenderFn(m):null;return II(y,g.tooltipStyle)})),h=U({event:s,contentRenderFn:f}).pipe(I(a),W(async g=>g),B(g=>g.contentRenderFn(g.event))),p=u.pipe(I(a),B(g=>"")),d=il(s,u).pipe(I(a),B(g=>g.event));return U({svgString:il(h,p),event:d,layout:i.layout$,tooltipStyle:c}).pipe(I(a),W(async g=>g)).subscribe(g=>{NI({rootSelection:e,pluginName:n,rootWidth:g.layout.rootWidth,rootHeight:g.layout.rootHeight,svgString:g.svgString,tooltipStyle:g.tooltipStyle,event:g.event})}),function(){a.next(void 0)}}),T2={force:{strength:.08,velocityDecay:.3,collisionSpacing:2},bubbleText:{fillRate:.6,lineHeight:12,lineLengthMin:4},arcScaleType:"area"},P2={outerRadius:.85,innerRadius:0,outerRadiusWhileHighlight:.9,startAngle:0,endAngle:Math.PI*2,padAngle:0,strokeColorType:"background",strokeWidth:1,cornerRadius:0},rp={eventFn:(t,e,n)=>e==="mouseover"||e==="mousemove"?[String(t.datum.value)]:[String(Math.round(t.data.reduce((r,i)=>r+i.reduce((o,a)=>o+(a.value??0),0),0)*n))],textAttrs:[{transform:"translate(0, 0)"}],textStyles:[{"font-weight":"bold","text-anchor":"middle","pointer-events":"none","dominant-baseline":"middle","font-size":64,fill:"#000"}]};rp.eventFn.toString=()=>`(eventData: EventSeries, eventName: EventName, t: number) => {
63
63
  if (eventName === 'mouseover' || eventName === 'mousemove') {
64
64
  return [String(eventData.datum!.value)]
65
65
  }
@@ -74,6 +74,6 @@
74
74
  )
75
75
  )
76
76
  ]
77
- }`;const ip={outerRadius:.85,outerRadiusWhileHighlight:.9,startAngle:0,endAngle:Math.PI*2,labelCentroid:2.1,labelColorType:"primary",labelFn:t=>String(t.label)};ip.labelFn.toString=()=>"d => String(d.label)";const M2={outerRadius:.85,padAngle:0,strokeColorType:"background",strokeWidth:0,cornerRadius:0,arcScaleType:"area",angleIncreaseWhileHighlight:.05},op={outerRadius:.85,labelCentroid:2.1,labelFn:t=>String(t.label),labelColorType:"primary",arcScaleType:"area"};op.labelFn.toString=()=>"d => String(d.label)";const D2={position:"right",justify:"end",padding:28,backgroundFill:"none",backgroundStroke:"none",gap:10,listRectWidth:14,listRectHeight:14,listRectRadius:0,textColorType:"primary"},BI={name:"Bubbles",defaultParams:T2,layerIndex:ke,validator:(t,{validateColumns:e})=>{const n=e(t,{force:{toBeTypes:["object"]},bubbleText:{toBeTypes:["object"]},arcScaleType:{toBe:'"area" | "radius"',test:r=>r==="area"||r==="radius"}});if(t.force){const r=e(t.force,{velocityDecay:{toBeTypes:["number"]},collisionSpacing:{toBeTypes:["number"]},strength:{toBeTypes:["number"]}});if(r.status==="error")return r}if(t.bubbleText){const r=e(t.bubbleText,{fillRate:{toBeTypes:["number"]},lineHeight:{toBeTypes:["number"]},lineLengthMin:{toBeTypes:["number"]}});if(r.status==="error")return r}return n}};let Ln;function FI(t,e){return o1().velocityDecay(e.force.velocityDecay).force("collision",n1().radius(n=>n.r+e.force.collisionSpacing)).force("charge",a1().strength(n=>-Math.pow(n.r,2)*e.force.strength)).on("tick",()=>{t.attr("transform",n=>`translate(${n.x},${n.y})`)})}function OI({visibleComputedLayoutData:t,LastBubbleDataMap:e,graphicWidth:n,graphicHeight:r,SeriesContainerPositionMap:i,scaleType:o}){const a=Math.min(n,r)/2,s=t.flat(),u=s.reduce((h,p)=>h+p.value,0),l=li().domain([0,u]).range([0,a]).exponent(o==="area"?.5:1),c=o==="area"?1:(()=>{const h=a*a*Math.PI;return Math.sqrt(h/e0(s,p=>Math.PI*Math.pow(l(p.value),2)))})(),f=.9;return s.map(h=>{const p=h,d=e.get(p.id);if(d)p.x=d.x,p.y=d.y;else{const m=i.get(p.seriesLabel);p.x=Math.random()*m.width,p.y=Math.random()*m.height}const g=l(p.value??0)*c*f;return p.r=g,p._originR=g,p})}function GI({selection:t,bubblesData:e,fullParams:n,sumSeries:r}){const i=t.selectAll("g").data(e,a=>a.id).join(a=>{const s=a.append("g").attr("cursor","pointer").attr("font-size",12).style("fill","#ffffff").attr("text-anchor","middle");return s.append("circle").attr("class","node").attr("cx",0).attr("cy",0).attr("fill",u=>u.color),s.append("text").style("opacity",.8).attr("pointer-events","none"),s},a=>a,a=>a.remove()).attr("transform",a=>`translate(${a.x},${a.y})`),o=r?"seriesLabel":"label";return i.select("circle").transition().duration(200).attr("r",a=>a.r).attr("fill",a=>a.color),i.each((a,s,u)=>{const l=V(u[s]);let c=!0;a[o].length<=n.bubbleText.lineLengthMin&&(c=!1),l.call(JE,{text:a[o],radius:a.r*n.bubbleText.fillRate,lineHeight:n.bubbleText.lineHeight,isBreakAll:c})}),i}function zI(){return x0().on("start",(t,e)=>{t.active||Ln.alpha(1).restart(),e.fx=e.x,e.fy=e.y}).on("drag",(t,e)=>{t.active||Ln.alphaTarget(0),e.fx=t.x,e.fy=t.y}).on("end",(t,e)=>{e.fx=null,e.fy=null})}function YI({fullParams:t,SeriesContainerPositionMap:e}){Ln.force("x",s1().strength(t.force.strength).x(n=>e.get(n.seriesLabel).centerX)).force("y",u1().strength(t.force.strength).y(n=>e.get(n.seriesLabel).centerY)),Ln.alpha(1).restart()}function UI({bubblesSelection:t,highlightIds:e,fullChartParams:n}){if(t.interrupt("highlight"),!e.length){t.transition("highlight").style("opacity",1);return}t.each((r,i,o)=>{const a=V(o[i]);e.includes(r.id)?a.style("opacity",1).transition("highlight").ease(no).duration(500):a.style("opacity",n.styles.unhighlightedOpacity)})}const WI=Fn(BI)(({selection:t,name:e,observer:n,subject:r})=>{const i=new nt;let o=new Map;const a=n.fullDataFormatter$.pipe(B(f=>f.sumSeries),tt()),s=n.fullParams$.pipe(I(i),B(f=>f.arcScaleType),tt()),u=U({layout:n.layout$,SeriesContainerPositionMap:n.SeriesContainerPositionMap$,visibleComputedLayoutData:n.visibleComputedLayoutData$,scaleType:s}).pipe(I(i),W(async f=>f),B(f=>OI({visibleComputedLayoutData:f.visibleComputedLayoutData,LastBubbleDataMap:o,graphicWidth:f.layout.width,graphicHeight:f.layout.height,SeriesContainerPositionMap:f.SeriesContainerPositionMap,scaleType:f.scaleType})),St(1));u.subscribe(f=>{o=new Map(f.map(h=>[h.id,h]))});const l=n.fullChartParams$.pipe(I(i),B(f=>f.highlightTarget),tt()),c=U({bubblesData:u,fullParams:n.fullParams$,SeriesContainerPositionMap:n.SeriesContainerPositionMap$,sumSeries:a}).pipe(I(i),W(async f=>f),B(f=>{Ln&&Ln.stop();const h=GI({selection:t,bubblesData:f.bubblesData,fullParams:f.fullParams,sumSeries:f.sumSeries});return Ln=FI(h,f.fullParams),Ln.nodes(f.bubblesData),YI({fullParams:f.fullParams,SeriesContainerPositionMap:f.SeriesContainerPositionMap}),h}));return U({bubblesSelection:c,computedData:n.computedData$,SeriesDataMap:n.SeriesDataMap$,highlightTarget:l}).pipe(I(i),W(async f=>f)).subscribe(f=>{f.bubblesSelection.on("mouseover",(h,p)=>{r.event$.next({type:"series",eventName:"mouseover",pluginName:e,highlightTarget:f.highlightTarget,datum:p,series:f.SeriesDataMap.get(p.seriesLabel),seriesIndex:p.seriesIndex,seriesLabel:p.seriesLabel,event:h,data:f.computedData})}).on("mousemove",(h,p)=>{r.event$.next({type:"series",eventName:"mousemove",pluginName:e,highlightTarget:f.highlightTarget,datum:p,series:f.SeriesDataMap.get(p.seriesLabel),seriesIndex:p.seriesIndex,seriesLabel:p.seriesLabel,event:h,data:f.computedData})}).on("mouseout",(h,p)=>{r.event$.next({type:"series",eventName:"mouseout",pluginName:e,highlightTarget:f.highlightTarget,datum:p,series:f.SeriesDataMap.get(p.seriesLabel),seriesIndex:p.seriesIndex,seriesLabel:p.seriesLabel,event:h,data:f.computedData})}).on("click",(h,p)=>{r.event$.next({type:"series",eventName:"click",pluginName:e,highlightTarget:f.highlightTarget,datum:p,series:f.SeriesDataMap.get(p.seriesLabel),seriesIndex:p.seriesIndex,seriesLabel:p.seriesLabel,event:h,data:f.computedData})}).call(zI())}),U({bubblesSelection:c,bubblesData:u,highlight:n.seriesHighlight$.pipe(B(f=>f.map(h=>h.id))),fullChartParams:n.fullChartParams$,fullParams:n.fullParams$,sumSeries:a,SeriesContainerPositionMap:n.SeriesContainerPositionMap$}).pipe(I(i),W(async f=>f)).subscribe(f=>{UI({bubblesSelection:f.bubblesSelection,highlightIds:f.highlight,fullChartParams:f.fullChartParams})}),()=>{i.next(void 0)}});function C2({data:t,startAngle:e,endAngle:n}){return Yx().startAngle(e).endAngle(n).value(o=>o.value).sort((o,a)=>o.seq-a.seq)(t).map((o,a)=>{let s=o;return s.id=o.data.id,s})}function HI({selection:t,pluginName:e,separateSeries$:n,seriesLabels$:r}){const i=ot(e,"series");return U({seriesLabels:r,separateSeries:n}).pipe(W(async o=>o),B((o,a)=>{const s=o.separateSeries?o.seriesLabels:[o.seriesLabels.join("")];return t.selectAll(`g.${i}`).data(s,u=>u).join(u=>u.append("g").classed(i,!0),u=>u,u=>u.remove())}),St(1))}const Ho=({selection:t,pluginName:e,separateSeries$:n,seriesLabels$:r,seriesContainerPosition$:i})=>{const o=HI({selection:t,pluginName:e,separateSeries$:n,seriesLabels$:r});return U({seriesCenterSelection:o,seriesContainerPosition:i}).pipe(W(async a=>a),tt((a,s)=>a.seriesContainerPosition.length===s.seriesContainerPosition.length)).subscribe(a=>{a.seriesCenterSelection.attr("transform",(s,u)=>{const l=a.seriesContainerPosition[u]??a.seriesContainerPosition[0];return`translate(${l.centerX}, ${l.centerY})`})}),U({seriesCenterSelection:o,seriesContainerPosition:i}).pipe(W(async a=>a)).subscribe(a=>{a.seriesCenterSelection.transition().attr("transform",(s,u)=>{const l=a.seriesContainerPosition[u]??a.seriesContainerPosition[0];return`translate(${l.centerX}, ${l.centerY})`})}),{seriesCenterSelection$:o}},ap="Pie",XI={name:ap,defaultParams:P2,layerIndex:ke,validator:(t,{validateColumns:e})=>e(t,{outerRadius:{toBeTypes:["number"]},innerRadius:{toBeTypes:["number"]},outerRadiusWhileHighlight:{toBeTypes:["number"]},startAngle:{toBeTypes:["number"]},endAngle:{toBeTypes:["number"]},padAngle:{toBeTypes:["number"]},strokeColorType:{toBeTypes:["string"]},strokeWidth:{toBeTypes:["number"]},cornerRadius:{toBeTypes:["number"]}})};function jI({enter:t,exit:e,data:n,lastTweenData:r,fullParams:i}){return!t.size()&&!e.size()?o=>{const a=n.map((s,u)=>{const l=r[u]??{startAngle:0,endAngle:0,value:0};return{...s,startAngle:s.startAngle*o+l.startAngle*(1-o),endAngle:s.endAngle*o+l.endAngle*(1-o),value:s.value*o+l.value*(1-o)}});return sp(a,i.startAngle,i.endAngle,1)}:o=>sp(n,i.startAngle,i.endAngle,o)}function sp(t,e,n,r){return t.map((i,o)=>{const a=e+(i.startAngle-e)*r,s=a+(i.endAngle-i.startAngle)*r;return{...i,startAngle:a,endAngle:s}})}function L2({selection:t,data:e,arc:n,pathClassName:r,fullParams:i,fullChartParams:o}){return t.selectAll("path").data(e,s=>s.id).join("path").classed(r,!0).style("cursor","pointer").attr("fill",(s,u)=>s.data.color).attr("stroke",(s,u)=>Mn({datum:s.data,colorType:i.strokeColorType,fullChartParams:o})).attr("stroke-width",i.strokeWidth).attr("d",(s,u)=>n(s))}function VI({pathSelection:t,ids:e,fullChartParams:n,arc:r,arcHighlight:i}){if(t.interrupt("highlight"),!e.length){t.transition("highlight").style("opacity",1).attr("d",o=>r(o));return}t.each((o,a,s)=>{const u=V(s[a]);e.includes(o.data.id)?u.style("opacity",1).transition("highlight").ease(no).duration(500).attr("d",l=>i(l)):u.style("opacity",n.styles.unhighlightedOpacity).transition("highlight").attr("d",l=>r(l))})}function qI(t,e){const n=new nt,r=ot(t,"path");let i=[],o=[];const a=e.seriesContainerPosition$.pipe(I(n),B(h=>h.width<h.height?h.width:h.height),tt()),s=new dt(h=>{U({containerVisibleComputedLayoutData:e.containerVisibleComputedLayoutData$,fullParams:e.fullParams$}).pipe(I(n),W(async p=>p)).subscribe(p=>{const d=C2({data:p.containerVisibleComputedLayoutData,startAngle:p.fullParams.startAngle,endAngle:p.fullParams.endAngle});h.next(d)})}),u=new dt(h=>{U({shorterSideWith:a,fullParams:e.fullParams$}).pipe(I(n),W(async p=>p)).subscribe(p=>{const d=Nu({axisWidth:p.shorterSideWith,innerRadius:p.fullParams.innerRadius,outerRadius:p.fullParams.outerRadius,padAngle:p.fullParams.padAngle,cornerRadius:p.fullParams.cornerRadius});h.next(d)})}),l=new dt(h=>{U({shorterSideWith:a,fullParams:e.fullParams$}).pipe(I(n),W(async p=>p)).subscribe(p=>{const d=Nu({axisWidth:p.shorterSideWith,innerRadius:p.fullParams.innerRadius,outerRadius:p.fullParams.outerRadiusWhileHighlight,padAngle:p.fullParams.padAngle,cornerRadius:p.fullParams.cornerRadius});h.next(d)})}),c=e.fullChartParams$.pipe(I(n),B(h=>h.highlightTarget),tt()),f=new dt(h=>{U({pieData:s,arc:u,computedData:e.computedData$,fullParams:e.fullParams$,fullChartParams:e.fullChartParams$,highlightTarget:c}).pipe(I(n),W(async p=>p)).subscribe(p=>{e.containerSelection.interrupt("graphicMove");const d=e.containerSelection.selectAll("path").data(p.pieData,b=>b.id),g=d.enter(),m=d.exit(),y=jI({enter:g,exit:m,data:p.pieData,lastTweenData:i,fullParams:p.fullParams});e.containerSelection.transition("graphicMove").duration(p.fullChartParams.transitionDuration).tween("move",(b,v)=>x=>{o=y(x),L2({selection:e.containerSelection,data:o,arc:p.arc,pathClassName:r,fullParams:p.fullParams,fullChartParams:p.fullChartParams})}).on("end",(b,v)=>{o=sp(p.pieData,p.fullParams.startAngle,p.fullParams.endAngle,1);const x=L2({selection:e.containerSelection,data:o,arc:p.arc,pathClassName:r,fullParams:p.fullParams,fullChartParams:p.fullChartParams});h.next(x),i=Object.assign([],p.pieData),e.event$.next({type:"series",pluginName:t,eventName:"transitionEnd",event:void 0,highlightTarget:p.highlightTarget,datum:null,series:[],seriesIndex:-1,seriesLabel:"",data:p.computedData})})})}).pipe(St(1));return U({pathSelection:f,SeriesDataMap:e.SeriesDataMap$,computedData:e.computedData$,highlightTarget:c}).pipe(I(n),W(async h=>h)).subscribe(h=>{h.pathSelection.on("mouseover",(p,d)=>{p.stopPropagation(),e.event$.next({type:"series",eventName:"mouseover",pluginName:t,highlightTarget:h.highlightTarget,datum:d.data,series:h.SeriesDataMap.get(d.data.seriesLabel),seriesIndex:d.data.seriesIndex,seriesLabel:d.data.seriesLabel,event:p,data:h.computedData})}).on("mousemove",(p,d)=>{p.stopPropagation(),e.event$.next({type:"series",eventName:"mousemove",pluginName:t,highlightTarget:h.highlightTarget,datum:d.data,series:h.SeriesDataMap.get(d.data.seriesLabel),seriesIndex:d.data.seriesIndex,seriesLabel:d.data.seriesLabel,event:p,data:h.computedData})}).on("mouseout",(p,d)=>{p.stopPropagation(),e.event$.next({type:"series",eventName:"mouseout",pluginName:t,highlightTarget:h.highlightTarget,datum:d.data,series:h.SeriesDataMap.get(d.data.seriesLabel),seriesIndex:d.data.seriesIndex,seriesLabel:d.data.seriesLabel,event:p,data:h.computedData})}).on("click",(p,d)=>{p.stopPropagation(),e.event$.next({type:"series",eventName:"click",pluginName:t,highlightTarget:h.highlightTarget,datum:d.data,series:h.SeriesDataMap.get(d.data.seriesLabel),seriesIndex:d.data.seriesIndex,seriesLabel:d.data.seriesLabel,event:p,data:h.computedData})})}),U({pathSelection:f,highlight:e.seriesHighlight$.pipe(B(h=>h.map(p=>p.id))),fullChartParams:e.fullChartParams$,arc:u,arcHighlight:l}).pipe(I(n),W(async h=>h)).subscribe(h=>{VI({pathSelection:h.pathSelection,ids:h.highlight,fullChartParams:h.fullChartParams,arc:h.arc,arcHighlight:h.arcHighlight})}),()=>{n.next(void 0)}}const ZI=Fn(XI)(({selection:t,name:e,subject:n,observer:r})=>{const i=new nt,{seriesCenterSelection$:o}=Ho({selection:t,pluginName:ap,separateSeries$:r.separateSeries$,seriesLabels$:r.seriesLabels$,seriesContainerPosition$:r.seriesContainerPosition$}),a=[];return o.pipe(I(i)).subscribe(s=>{a.forEach(u=>u()),s.each((u,l,c)=>{const f=V(c[l]),h=r.visibleComputedLayoutData$.pipe(I(i),B(d=>d[l]??d[0])),p=r.seriesContainerPosition$.pipe(I(i),B(d=>d[l]??d[0]));a[l]=qI(ap,{containerSelection:f,computedData$:r.computedData$,containerVisibleComputedLayoutData$:h,SeriesDataMap$:r.SeriesDataMap$,fullParams$:r.fullParams$,fullChartParams$:r.fullChartParams$,seriesHighlight$:r.seriesHighlight$,seriesContainerPosition$:p,event$:n.event$})})}),()=>{i.next(void 0),a.forEach(s=>s())}}),zu="PieEventTexts",k2=ot(zu,"text"),KI={name:zu,defaultParams:rp,layerIndex:Oh,validator:(t,{validateColumns:e})=>e(t,{eventFn:{toBeTypes:["Function"]},textAttrs:{toBeTypes:["object[]"]},textStyles:{toBeTypes:["object[]"]}})};function up(t,e){const n=t.selectAll(`text.${k2}`).data(e),r=n.enter().append("text").classed(k2,!0),i=n.merge(r);return i.each((o,a,s)=>{const u=V(s[a]).text(o.text);Object.keys(o.attr).forEach(l=>{u.attr(l,o.attr[l])}),Object.keys(o.style).forEach(l=>{u.style(l,o.style[l])})}),n.exit().remove(),i}function lp({eventData:t,eventName:e,t:n,eventFn:r,textAttrs:i,textStyles:o}){return r(t,e,n).map((s,u)=>({text:s,attr:i[u],style:o[u]}))}function QI(t,e){const n=new nt;let r;const i=e.fullChartParams$.pipe(I(n),B(o=>o.highlightTarget),tt());return U({computedData:e.computedData$,fullParams:e.fullParams$,fullChartParams:e.fullChartParams$,highlightTarget:i}).pipe(I(n),W(async o=>o)).subscribe(o=>{e.containerSelection.transition("move").duration(o.fullChartParams.transitionDuration).tween("move",(a,s)=>u=>{const l=lp({eventData:{type:"series",pluginName:t,eventName:"transitionMove",event:a,highlightTarget:o.highlightTarget,data:o.computedData,series:[],seriesIndex:-1,seriesLabel:"",datum:null},eventName:"transitionMove",t:u,eventFn:o.fullParams.eventFn,textAttrs:o.fullParams.textAttrs,textStyles:o.fullParams.textStyles});up(e.containerSelection,l)}).on("end",(a,s)=>{const u=lp({eventData:{type:"series",pluginName:t,eventName:"transitionEnd",event:a,highlightTarget:o.highlightTarget,data:o.computedData,series:[],seriesIndex:-1,seriesLabel:"",datum:null},eventName:"transitionMove",t:1,eventFn:o.fullParams.eventFn,textAttrs:o.fullParams.textAttrs,textStyles:o.fullParams.textStyles});up(e.containerSelection,u),r&&r.unsubscribe(),r=e.event$.subscribe(l=>{const c=lp({eventData:l,eventName:l.eventName,t:1,eventFn:o.fullParams.eventFn,textAttrs:o.fullParams.textAttrs,textStyles:o.fullParams.textStyles});up(e.containerSelection,c)})})}),()=>{n.next(void 0)}}const JI=Fn(KI)(({selection:t,name:e,observer:n,subject:r})=>{const i=new nt,{seriesCenterSelection$:o}=Ho({selection:t,pluginName:zu,separateSeries$:n.separateSeries$,seriesLabels$:n.seriesLabels$,seriesContainerPosition$:n.seriesContainerPosition$}),a=[];return o.pipe(I(i)).subscribe(s=>{a.forEach(u=>u()),s.each((u,l,c)=>{const f=V(c[l]),h=n.computedLayoutData$.pipe(I(i),B(d=>d[l]??d[0])),p=n.seriesContainerPosition$.pipe(I(i),B(d=>d[l]??d[0]));a[l]=QI(zu,{containerSelection:f,computedData$:n.computedData$,containerComputedLayoutData$:h,SeriesDataMap$:n.SeriesDataMap$,fullParams$:n.fullParams$,fullChartParams$:n.fullChartParams$,seriesHighlight$:n.seriesHighlight$,seriesContainerPosition$:p,event$:r.event$})})}),()=>{i.next(void 0),a.forEach(s=>s())}}),xi="PieLabels",tN=ot(xi,"label-g"),eN=ot(xi,"line-g"),nN=ot(xi,"text"),R2=2,rN={name:xi,defaultParams:ip,layerIndex:Oh,validator:(t,{validateColumns:e})=>e(t,{outerRadius:{toBeTypes:["number"]},outerRadiusWhileHighlight:{toBeTypes:["number"]},startAngle:{toBeTypes:["number"]},endAngle:{toBeTypes:["number"]},labelCentroid:{toBeTypes:["number"]},labelFn:{toBeTypes:["Function"]},labelColorType:{toBeOption:"ColorType"}})};function iN({pieData:t,arc:e,arcMouseover:n,labelCentroid:r,lineStartCentroid:i,fullParams:o}){return t.map((a,s)=>{const[u,l]=e.centroid(a),[c,f]=n.centroid(a),h=o.labelFn(a.data);return{pieDatum:a,arcIndex:s,arcLabels:h.split(`
78
- `),lineStartX:u*i,lineStartY:l*i,lineStartMouseoverX:c*i,lineStartMouseoverY:f*i,x:u*r,y:l*r,mouseoverX:c*r,mouseoverY:f*r,textWidth:0,collisionShiftX:0,collisionShiftY:0,quadrant:u>=0&&l<=0?1:u<0&&l<=0?2:u<0&&l>0?3:4}}).filter(a=>a.pieDatum.data.visible)}function oN({labelGSelection:t,data:e,fullParams:n,fullChartParams:r,textSizePx:i}){const o=t.selectAll("text").data(e,a=>a.pieDatum.id).join("text").classed(nN,!0).attr("font-weight","bold").attr("text-anchor",a=>a.quadrant==1||a.quadrant==4?"start":"end").style("dominant-baseline",a=>a.quadrant==1||a.quadrant==2?"auto":"hanging").style("cursor",a=>r.highlightTarget&&r.highlightTarget!="none"?"pointer":"none").attr("font-size",r.styles.textSize).attr("x",0).attr("y",0).attr("fill",(a,s)=>Mn({datum:a.pieDatum.data,colorType:n.labelColorType,fullChartParams:r})).each((a,s,u)=>{t2(V(u[s]),{textArr:a.arcLabels,textSizePx:i,quadrant:a.quadrant})});return o.transition().attr("transform",a=>"translate("+a.x+","+a.y+")"),o}function aN(t,e,n){const r=t.nodes(),i=n,o=r.map((a,s)=>{const u=a.getBBox(),l=[e[s].x,e[s].y];return{node:a,x:l[0],y:l[1],width:u.width,height:u.height}});for(let a=0;a<o.length;a++){const s=o[a];for(let u=a+1;u<o.length;u++){const l=o[u];e[a].textWidth=s.width;const c=s.x+e[a].collisionShiftX,f=s.y+e[a].collisionShiftY,h=l.x+e[u].collisionShiftX,p=l.y+e[u].collisionShiftY;if(!(c+s.width/2<h-l.width/2||c-s.width/2>h+l.width/2||f+s.height/2<p-l.height/2||f-s.height/2>p+l.height/2)){if(e[u].quadrant==2){const d=p>f?-i*2:-i;e[u].collisionShiftY+=d}else if(e[u].quadrant==4){const d=p>f?i:i*2;e[u].collisionShiftY+=d}}}}for(let a=o.length-1;a>=0;a--){const s=o[a];for(let u=a-1;u>=0;u--){const l=o[u];e[a].textWidth=s.width;const c=s.x+e[a].collisionShiftX,f=s.y+e[a].collisionShiftY,h=l.x+e[u].collisionShiftX,p=l.y+e[u].collisionShiftY;if(!(c+s.width/2<h-l.width/2||c-s.width/2>h+l.width/2||f+s.height/2<p-l.height/2||f-s.height/2>p+l.height/2)){if(e[u].quadrant==1){const d=p>f?-i*2:-i;e[u].collisionShiftY+=d}else if(e[u].quadrant==3){const d=p>f?i:i*2;e[u].collisionShiftY+=d}}}}t.data(e).transition().attr("transform",a=>`translate(${a.x+a.collisionShiftX},${a.y+a.collisionShiftY})`)}function sN({lineGSelection:t,data:e,fullParams:n,fullChartParams:r}){const i=e.filter(a=>a.collisionShiftX||a.collisionShiftY),o=t.selectAll("polyline").data(i,a=>a.pieDatum.id).join("polyline").attr("stroke",a=>Mn({datum:a.pieDatum.data,colorType:n.labelColorType,fullChartParams:r})).attr("stroke-width",1).attr("fill","none").attr("points",a=>[[a.lineStartX,a.lineStartY],[a.lineStartX,a.lineStartY]]);return o.transition().attr("points",a=>{let s=a.x+a.collisionShiftX,u=a.y+a.collisionShiftY;return[[s,u],[a.lineStartX,a.lineStartY]]}),o}function uN({textSelection:t,lineSelection:e,ids:n,fullChartParams:r}){if(t.interrupt("highlight"),e.interrupt("highlight"),!n.length){t.transition("highlight").duration(200).attr("transform",i=>`translate(${i.x+i.collisionShiftX},${i.y+i.collisionShiftY})`).style("opacity",1),e.transition("highlight").duration(200).style("opacity",1);return}t.each((i,o,a)=>{const s=V(a[o]);n.includes(i.pieDatum.id)?s.style("opacity",1).transition("highlight").duration(200).attr("transform",u=>u.collisionShiftX||u.collisionShiftY?`translate(${u.x+u.collisionShiftX},${u.y+u.collisionShiftY})`:`translate(${u.mouseoverX+u.collisionShiftX},${u.mouseoverY+u.collisionShiftY})`):s.style("opacity",r.styles.unhighlightedOpacity).transition("highlight").duration(200).attr("transform",u=>`translate(${u.x+u.collisionShiftX},${u.y+u.collisionShiftY})`)}),e.each((i,o,a)=>{const s=V(a[o]);n.includes(i.pieDatum.data.id)?s.style("opacity",1).transition("highlight").duration(200):s.style("opacity",r.styles.unhighlightedOpacity).transition("highlight").duration(200)})}function lN(t,e){const n=new nt;e.containerSelection.selectAll("g").remove();const r=e.containerSelection.append("g");r.classed(eN,!0);const i=e.containerSelection.append("g");i.classed(tN,!0);const o=new nt,a=new nt;let s=[];const u=e.seriesContainerPosition$.pipe(I(n),B(c=>c.width<c.height?c.width:c.height),tt()),l=e.fullParams$.pipe(I(n),B(c=>c.labelCentroid>=R2?R2:c.labelCentroid));return U({shorterSideWith:u,containerVisibleComputedLayoutData:e.containerVisibleComputedLayoutData$,fullParams:e.fullParams$,fullChartParams:e.fullChartParams$,textSizePx:e.textSizePx$,lineStartCentroid:l}).pipe(I(n),W(async c=>c)).subscribe(c=>{const f=Nu({axisWidth:c.shorterSideWith,innerRadius:0,outerRadius:c.fullParams.outerRadius,padAngle:0,cornerRadius:0}),h=Nu({axisWidth:c.shorterSideWith,innerRadius:0,outerRadius:c.fullParams.outerRadiusWhileHighlight,padAngle:0,cornerRadius:0}),p=C2({data:c.containerVisibleComputedLayoutData,startAngle:c.fullParams.startAngle,endAngle:c.fullParams.endAngle});s=iN({pieData:p,arc:f,arcMouseover:h,labelCentroid:c.fullParams.labelCentroid,lineStartCentroid:c.lineStartCentroid,fullParams:c.fullParams}),r.selectAll("polyline").remove();const d=oN({labelGSelection:i,data:s,fullParams:c.fullParams,fullChartParams:c.fullChartParams,textSizePx:c.textSizePx});setTimeout(()=>{aN(d,s,c.textSizePx);const g=sN({lineGSelection:r,data:s,fullParams:c.fullParams,fullChartParams:c.fullChartParams});a.next(g)},1e3),o.next(d)}),U({textSelection:o,lineSelection:a,highlight:e.seriesHighlight$.pipe(B(c=>c.map(f=>f.id))),fullChartParams:e.fullChartParams$}).pipe(I(n),W(async c=>c)).subscribe(c=>{uN({textSelection:c.textSelection,lineSelection:c.lineSelection,ids:c.highlight,fullChartParams:c.fullChartParams})}),()=>{n.next(void 0)}}const cN=Fn(rN)(({selection:t,observer:e,subject:n})=>{const r=new nt,{seriesCenterSelection$:i}=Ho({selection:t,pluginName:xi,separateSeries$:e.separateSeries$,seriesLabels$:e.seriesLabels$,seriesContainerPosition$:e.seriesContainerPosition$}),o=[];return i.pipe(I(r)).subscribe(a=>{o.forEach(s=>s()),a.each((s,u,l)=>{const c=V(l[u]),f=e.visibleComputedLayoutData$.pipe(I(r),B(p=>p[u]??p[0])),h=e.seriesContainerPosition$.pipe(I(r),B(p=>p[u]??p[0]));o[u]=lN(xi,{containerSelection:c,containerVisibleComputedLayoutData$:f,fullParams$:e.fullParams$,fullChartParams$:e.fullChartParams$,textSizePx$:e.textSizePx$,seriesHighlight$:e.seriesHighlight$,seriesContainerPosition$:h,event$:n.event$})})}),()=>{r.next(void 0)}}),cp="Rose",fN=Math.PI*2,hN={name:cp,defaultParams:M2,layerIndex:ke,validator:(t,{validateColumns:e})=>e(t,{outerRadius:{toBeTypes:["number"]},padAngle:{toBeTypes:["number"]},strokeColorType:{toBeOption:"ColorType"},strokeWidth:{toBeTypes:["number"]},cornerRadius:{toBeTypes:["number"]},arcScaleType:{toBe:'"area" | "radius"',test:r=>r==="area"||r==="radius"},angleIncreaseWhileHighlight:{toBeTypes:["number"]}})};function pN({cornerRadius:t,outerRadius:e,axisWidth:n,maxValue:r,arcScaleType:i,fullParams:o}){const a=n/2*e,s=i==="area"?.5:1,u=li().domain([0,r]).range([0,a]).exponent(s);return l=>{const c=u(l.prevValue),f=u(l.value),h=Ze(c,f);return p=>{const d=h(p);return $u().innerRadius(0).outerRadius(d).padAngle(o.padAngle).padRadius(d).cornerRadius(t)(l)}}}function dN({pathSelection:t,ids:e,fullParams:n,fullChartParams:r,tweenArc:i}){if(t.interrupt("highlight"),!e.length){t.transition("highlight").style("opacity",1).attr("d",o=>i(o)(1));return}t.each((o,a,s)=>{const u=V(s[a]);e.includes(o.data.id)?u.style("opacity",1).transition("highlight").ease(no).duration(500).attr("d",l=>i({...l,startAngle:l.startAngle-n.angleIncreaseWhileHighlight,endAngle:l.endAngle+n.angleIncreaseWhileHighlight})(1)):u.style("opacity",r.styles.unhighlightedOpacity).transition("highlight").attr("d",l=>i(l)(1))})}function gN(t,e){const n=new nt,r=ot(t,"path");let i=[];const o=e.seriesContainerPosition$.pipe(I(n),B(p=>p.width<p.height?p.width:p.height),tt()),a=U({containerVisibleComputedLayoutData:e.containerVisibleComputedLayoutData$,fullParams:e.fullParams$}).pipe(I(n),W(async p=>p),B(p=>{const d=fN/p.containerVisibleComputedLayoutData.length;return p.containerVisibleComputedLayoutData.map((g,m)=>({id:g.id,data:g,index:m,value:g.value,startAngle:d*m,endAngle:d*(m+1),padAngle:p.fullParams.padAngle,prevValue:i[m]&&i[m].id===g.id?i[m].value:0}))})),s=e.fullChartParams$.pipe(I(n),B(p=>p.highlightTarget),tt()),u=e.visibleComputedLayoutData$.pipe(B(p=>Math.max(...p.flat().map(d=>d.value))),tt()),l=U({fullParams:e.fullParams$,axisWidth:o,maxValue:u}).pipe(I(n),W(async p=>p),B(p=>pN({cornerRadius:p.fullParams.cornerRadius,outerRadius:p.fullParams.outerRadius,axisWidth:p.axisWidth,maxValue:p.maxValue,arcScaleType:p.fullParams.arcScaleType,fullParams:p.fullParams}))),c=e.fullChartParams$.pipe(I(n),B(p=>p.transitionDuration),tt()),f=new t_(!1),h=new dt(p=>{U({pieData:a,tweenArc:l,transitionDuration:c,fullParams:e.fullParams$,fullChartParams:e.fullChartParams$}).pipe(I(n),W(async d=>d)).subscribe(d=>{const g=d.pieData.map((y,b)=>(y.prevValue=i[b]&&i[b].id===y.id?i[b].value:0,y));f.next(!0);const m=e.containerSelection.selectAll("path").data(g,y=>y.id).join("path").classed(r,!0).style("cursor","pointer").attr("fill",(y,b)=>y.data.color).attr("stroke",(y,b)=>Mn({datum:y.data,colorType:d.fullParams.strokeColorType,fullChartParams:d.fullChartParams})).attr("stroke-width",d.fullParams.strokeWidth);m.interrupt("graphicMove"),m.transition("graphicMove").duration(d.transitionDuration).attrTween("d",d.tweenArc).on("end",()=>{p.next(m),f.next(!1)}),i=Object.assign([],g)})}).pipe(St(1));return U({pathSelection:h,SeriesDataMap:e.SeriesDataMap$,computedData:e.computedData$,highlightTarget:s}).pipe(I(n),W(async p=>p)).subscribe(p=>{p.pathSelection.on("mouseover",(d,g)=>{d.stopPropagation(),e.event$.next({type:"series",eventName:"mouseover",pluginName:t,highlightTarget:p.highlightTarget,datum:g.data,series:p.SeriesDataMap.get(g.data.seriesLabel),seriesIndex:g.data.seriesIndex,seriesLabel:g.data.seriesLabel,event:d,data:p.computedData})}).on("mousemove",(d,g)=>{d.stopPropagation(),e.event$.next({type:"series",eventName:"mousemove",pluginName:t,highlightTarget:p.highlightTarget,datum:g.data,series:p.SeriesDataMap.get(g.data.seriesLabel),seriesIndex:g.data.seriesIndex,seriesLabel:g.data.seriesLabel,event:d,data:p.computedData})}).on("mouseout",(d,g)=>{d.stopPropagation(),e.event$.next({type:"series",eventName:"mouseout",pluginName:t,highlightTarget:p.highlightTarget,datum:g.data,series:p.SeriesDataMap.get(g.data.seriesLabel),seriesIndex:g.data.seriesIndex,seriesLabel:g.data.seriesLabel,event:d,data:p.computedData})}).on("click",(d,g)=>{d.stopPropagation(),e.event$.next({type:"series",eventName:"click",pluginName:t,highlightTarget:p.highlightTarget,datum:g.data,series:p.SeriesDataMap.get(g.data.seriesLabel),seriesIndex:g.data.seriesIndex,seriesLabel:g.data.seriesLabel,event:d,data:p.computedData})})}),U({pathSelection:h,highlight:e.seriesHighlight$.pipe(B(p=>p.map(d=>d.id))),fullParams:e.fullParams$,fullChartParams:e.fullChartParams$,tweenArc:l,isTransitionMoving:f}).pipe(I(n),W(async p=>p),$i(p=>!p.isTransitionMoving)).subscribe(p=>{dN({pathSelection:p.pathSelection,ids:p.highlight,fullParams:p.fullParams,fullChartParams:p.fullChartParams,tweenArc:p.tweenArc})}),()=>{n.next(void 0)}}const mN=Fn(hN)(({selection:t,name:e,subject:n,observer:r})=>{const i=new nt,{seriesCenterSelection$:o}=Ho({selection:t,pluginName:cp,separateSeries$:r.separateSeries$,seriesLabels$:r.seriesLabels$,seriesContainerPosition$:r.seriesContainerPosition$}),a=[];return o.pipe(I(i)).subscribe(s=>{a.forEach(u=>u()),s.each((u,l,c)=>{const f=V(c[l]),h=r.visibleComputedLayoutData$.pipe(I(i),B(d=>JSON.parse(JSON.stringify(d[l]??d[0])))),p=r.seriesContainerPosition$.pipe(I(i),B(d=>JSON.parse(JSON.stringify(d[l]??d[0]))));a[l]=gN(cp,{containerSelection:f,computedData$:r.computedData$,visibleComputedData$:r.visibleComputedData$,visibleComputedLayoutData$:r.visibleComputedLayoutData$,containerVisibleComputedLayoutData$:h,SeriesDataMap$:r.SeriesDataMap$,fullParams$:r.fullParams$,fullChartParams$:r.fullChartParams$,seriesHighlight$:r.seriesHighlight$,seriesContainerPosition$:p,event$:n.event$})})}),()=>{i.next(void 0),a.forEach(s=>s())}}),vi="RoseLabels",yN=ot(vi,"label-g"),bN=ot(vi,"line-g"),xN=ot(vi,"text"),E2=2,vN={name:vi,defaultParams:op,layerIndex:Oh,validator:(t,{validateColumns:e})=>e(t,{outerRadius:{toBeTypes:["number"]},labelCentroid:{toBeTypes:["number"]},labelFn:{toBeTypes:["Function"]},labelColorType:{toBeOption:"ColorType"},arcScaleType:{toBe:'"area" | "radius"',test:r=>r==="area"||r==="radius"}})};function _N({pieData:t,labelCentroid:e,arcScaleType:n,maxValue:r,axisWidth:i,outerRadius:o,lineStartCentroid:a,fullParams:s}){const u=i/2*o,l=n==="area"?.5:1,c=li().domain([0,r]).range([0,u]).exponent(l);return t.map((f,h)=>{const p=c(f.value),d=$u().innerRadius(0).outerRadius(p).padAngle(0).padRadius(p).cornerRadius(0),[g,m]=d.centroid(f),[y,b]=[g,m],v=s.labelFn(f.data);return{pieDatum:f,arcIndex:h,arcLabels:v.split(`
79
- `),lineStartX:g*a,lineStartY:m*a,lineStartMouseoverX:y*a,lineStartMouseoverY:b*a,x:g*e,y:m*e,mouseoverX:y*e,mouseoverY:b*e,textWidth:0,collisionShiftX:0,collisionShiftY:0,quadrant:g>=0&&m<=0?1:g<0&&m<=0?2:g<0&&m>0?3:4}}).filter(f=>f.pieDatum.data.visible)}function wN({labelGSelection:t,data:e,fullParams:n,fullChartParams:r,textSizePx:i}){const o=t.selectAll("text").data(e,a=>a.pieDatum.id).join("text").classed(xN,!0).attr("font-weight","bold").attr("text-anchor",a=>a.quadrant==1||a.quadrant==4?"start":"end").style("dominant-baseline",a=>a.quadrant==1||a.quadrant==2?"auto":"hanging").style("cursor",a=>r.highlightTarget&&r.highlightTarget!="none"?"pointer":"none").attr("font-size",r.styles.textSize).attr("fill",(a,s)=>Mn({datum:a.pieDatum.data,colorType:n.labelColorType,fullChartParams:r})).each((a,s,u)=>{t2(V(u[s]),{textArr:a.arcLabels,textSizePx:i,quadrant:a.quadrant})});return o.transition().attr("transform",a=>"translate("+a.x+","+a.y+")"),o}function $N(t,e,n){const r=t.nodes(),i=n,o=r.map((a,s)=>{const u=a.getBBox(),l=[e[s].x,e[s].y];return{node:a,x:l[0],y:l[1],width:u.width,height:u.height}});for(let a=0;a<o.length;a++){const s=o[a];for(let u=a+1;u<o.length;u++){const l=o[u];e[a].textWidth=s.width;const c=s.x+e[a].collisionShiftX,f=s.y+e[a].collisionShiftY,h=l.x+e[u].collisionShiftX,p=l.y+e[u].collisionShiftY;if(!(c+s.width/2<h-l.width/2||c-s.width/2>h+l.width/2||f+s.height/2<p-l.height/2||f-s.height/2>p+l.height/2)){if(e[u].quadrant==2){const d=p>f?-i*2:-i;e[u].collisionShiftY+=d}else if(e[u].quadrant==4){const d=p>f?i:i*2;e[u].collisionShiftY+=d}}}}for(let a=o.length-1;a>=0;a--){const s=o[a];for(let u=a-1;u>=0;u--){const l=o[u];e[a].textWidth=s.width;const c=s.x+e[a].collisionShiftX,f=s.y+e[a].collisionShiftY,h=l.x+e[u].collisionShiftX,p=l.y+e[u].collisionShiftY;if(!(c+s.width/2<h-l.width/2||c-s.width/2>h+l.width/2||f+s.height/2<p-l.height/2||f-s.height/2>p+l.height/2)){if(e[u].quadrant==1){const d=p>f?-i*2:-i;e[u].collisionShiftY+=d}else if(e[u].quadrant==3){const d=p>f?i:i*2;e[u].collisionShiftY+=d}}}}t.data(e).transition().attr("transform",a=>`translate(${a.x+a.collisionShiftX},${a.y+a.collisionShiftY})`)}function SN({lineGSelection:t,data:e,fullParams:n,fullChartParams:r}){const i=e.filter(a=>a.collisionShiftX||a.collisionShiftY),o=t.selectAll("polyline").data(i,a=>a.pieDatum.id).join("polyline").attr("stroke",a=>Mn({datum:a.pieDatum.data,colorType:n.labelColorType,fullChartParams:r})).attr("stroke-width",1).attr("fill","none").attr("points",a=>[[a.lineStartX,a.lineStartY],[a.lineStartX,a.lineStartY]]);return o.transition().attr("points",a=>{let s=a.x+a.collisionShiftX,u=a.y+a.collisionShiftY;return[[s,u],[a.lineStartX,a.lineStartY]]}),o}function AN({textSelection:t,lineSelection:e,ids:n,fullChartParams:r}){if(t.interrupt("highlight"),e.interrupt("highlight"),!n.length){t.transition("highlight").duration(200).attr("transform",i=>`translate(${i.x+i.collisionShiftX},${i.y+i.collisionShiftY})`).style("opacity",1),e.transition("highlight").duration(200).style("opacity",1);return}t.each((i,o,a)=>{const s=V(a[o]);n.includes(i.pieDatum.data.id)?s.style("opacity",1).transition("highlight").duration(200).attr("transform",u=>`translate(${u.mouseoverX+u.collisionShiftX},${u.mouseoverY+u.collisionShiftY})`):s.style("opacity",r.styles.unhighlightedOpacity).transition("highlight").duration(200).attr("transform",u=>`translate(${u.x+u.collisionShiftX},${u.y+u.collisionShiftY})`)}),e.each((i,o,a)=>{const s=V(a[o]);n.includes(i.pieDatum.data.id)?s.style("opacity",1).transition("highlight").duration(200):s.style("opacity",r.styles.unhighlightedOpacity).transition("highlight").duration(200)})}function TN(t,e){const n=new nt;e.containerSelection.selectAll("g").remove();const r=e.containerSelection.append("g");r.classed(bN,!0);const i=e.containerSelection.append("g");i.classed(yN,!0);const o=new nt,a=new nt;let s=[];const u=e.seriesContainerPosition$.pipe(I(n),B(f=>f.width<f.height?f.width:f.height),tt()),l=e.visibleComputedLayoutData$.pipe(B(f=>Math.max(...f.flat().map(h=>h.value))),tt()),c=e.fullParams$.pipe(I(n),B(f=>f.labelCentroid>=E2?E2:f.labelCentroid));return U({shorterSideWith:u,containerVisibleComputedLayoutData:e.containerVisibleComputedLayoutData$,maxValue:l,fullParams:e.fullParams$,fullChartParams:e.fullChartParams$,textSizePx:e.textSizePx$,lineStartCentroid:c}).pipe(I(n),W(async f=>f)).subscribe(f=>{const h=Math.PI*2/f.containerVisibleComputedLayoutData.length,p=f.containerVisibleComputedLayoutData.map((g,m)=>({id:g.id,data:g,index:m,value:g.value,startAngle:h*m,endAngle:h*(m+1),padAngle:0}));s=_N({pieData:p,labelCentroid:f.fullParams.labelCentroid,arcScaleType:f.fullParams.arcScaleType,maxValue:f.maxValue,axisWidth:f.shorterSideWith,outerRadius:f.fullParams.outerRadius,lineStartCentroid:f.lineStartCentroid,fullParams:f.fullParams}),r.selectAll("polyline").remove();const d=wN({labelGSelection:i,data:s,fullParams:f.fullParams,fullChartParams:f.fullChartParams,textSizePx:f.textSizePx});setTimeout(()=>{$N(d,s,f.textSizePx);const g=SN({lineGSelection:r,data:s,fullParams:f.fullParams,fullChartParams:f.fullChartParams});a.next(g)},1e3),o.next(d)}),U({textSelection:o,lineSelection:a,highlight:e.seriesHighlight$.pipe(B(f=>f.map(h=>h.id))),fullChartParams:e.fullChartParams$}).pipe(I(n),W(async f=>f)).subscribe(f=>{AN({textSelection:f.textSelection,lineSelection:f.lineSelection,ids:f.highlight,fullChartParams:f.fullChartParams})}),()=>{n.next(void 0)}}const PN=Fn(vN)(({selection:t,observer:e,subject:n})=>{const r=new nt,{seriesCenterSelection$:i}=Ho({selection:t,pluginName:vi,separateSeries$:e.separateSeries$,seriesLabels$:e.seriesLabels$,seriesContainerPosition$:e.seriesContainerPosition$}),o=[];return i.pipe(I(r)).subscribe(a=>{o.forEach(s=>s()),a.each((s,u,l)=>{const c=V(l[u]),f=e.visibleComputedLayoutData$.pipe(I(r),B(p=>JSON.parse(JSON.stringify(p[u]??p[0])))),h=e.seriesContainerPosition$.pipe(I(r),B(p=>JSON.parse(JSON.stringify(p[u]??p[0]))));o[u]=TN(vi,{containerSelection:c,visibleComputedLayoutData$:e.visibleComputedLayoutData$,containerVisibleComputedLayoutData$:f,fullParams$:e.fullParams$,fullChartParams$:e.fullChartParams$,textSizePx$:e.textSizePx$,seriesHighlight$:e.seriesHighlight$,seriesContainerPosition$:h,event$:n.event$})})}),()=>{r.next(void 0)}}),I2="SeriesLegend",MN=Fn({name:I2,defaultParams:D2,layerIndex:Bu,validator:(t,{validateColumns:e})=>e(t,{padding:{toBeTypes:["number"]},backgroundFill:{toBeOption:"ColorType"},backgroundStroke:{toBeOption:"ColorType"},gap:{toBeTypes:["number"]},listRectWidth:{toBeTypes:["number"]},listRectHeight:{toBeTypes:["number"]},listRectRadius:{toBeTypes:["number"]},textColorType:{toBeOption:"ColorType"}})})(({selection:t,rootSelection:e,observer:n,subject:r})=>{const i=new nt,o=n.SeriesDataMap$.pipe(I(i),B(u=>Array.from(u.keys()))),a=n.fullParams$.pipe(I(i),B(u=>{const l=[{listRectWidth:u.listRectWidth,listRectHeight:u.listRectHeight,listRectRadius:u.listRectRadius}];return{...u,seriesList:l}})),s=Fu(I2,{rootSelection:e,seriesLabels$:o,fullParams$:a,layout$:n.layout$,fullChartParams$:n.fullChartParams$,textSizePx$:n.textSizePx$});return()=>{i.next(void 0),s()}}),fp={paddingInner:2,paddingOuter:2,labelColorType:"primary",squarifyRatio:1.618034,sort:(t,e)=>e.value-t.value};fp.sort.toString=()=>"(a, b) => b.value - a.value";const N2={position:"right",justify:"end",padding:28,backgroundFill:"none",backgroundStroke:"none",gap:10,listRectWidth:14,listRectHeight:14,listRectRadius:0,textColorType:"primary"},B2="TreeLegend",DN=Lg({name:B2,defaultParams:N2,layerIndex:Bu,validator:(t,{validateColumns:e})=>e(t,{padding:{toBeTypes:["number"]},backgroundFill:{toBeOption:"ColorType"},backgroundStroke:{toBeOption:"ColorType"},gap:{toBeTypes:["number"]},listRectWidth:{toBeTypes:["number"]},listRectHeight:{toBeTypes:["number"]},listRectRadius:{toBeTypes:["number"]},textColorType:{toBeOption:"ColorType"}})})(({selection:t,rootSelection:e,observer:n,subject:r})=>{const i=new nt,o=n.CategoryDataMap$.pipe(I(i),B(u=>Array.from(u.keys()))),a=n.fullParams$.pipe(I(i),B(u=>{const l=[{listRectWidth:u.listRectWidth,listRectHeight:u.listRectHeight,listRectRadius:u.listRectRadius}];return{...u,seriesList:l}})),s=Fu(B2,{rootSelection:e,seriesLabels$:o,fullParams$:a,layout$:n.layout$,fullChartParams$:n.fullChartParams$,textSizePx$:n.textSizePx$});return()=>{i.next(void 0),s()}}),dr="TreeMap",F2=ot(dr,"tree"),O2=ot(dr,"tile"),CN={name:dr,defaultParams:fp,layerIndex:ke,validator:(t,{validateColumns:e})=>e(t,{paddingInner:{toBeTypes:["number"]},paddingOuter:{toBeTypes:["number"]},labelColorType:{toBeOption:"ColorType"},squarifyRatio:{toBeTypes:["number"]},sort:{toBeTypes:["Function"]}})};function LN({selection:t,treeData:e,fullParams:n,fullChartParams:r,textSizePx:i}){const o=i/2,a=i,s=t.selectAll(`g.${F2}`).data(e,u=>u.data.id).join("g").attr("class",F2);return s.attr("transform",u=>!u.x0||!u.y0?null:`translate(${u.x0},${u.y0})`).each((u,l,c)=>{const f=V(c[l]);f.selectAll(`rect.${O2}`).data([u],h=>h.data.id).join("rect").attr("id",h=>h.data.id).attr("class",O2).attr("cursor","pointer").attr("width",h=>h.x1-h.x0).attr("height",h=>h.y1-h.y0).attr("fill",h=>h.data.color).attr("data-name",h=>h.data.label).attr("data-category",h=>h.data.categoryLabel).attr("data-value",h=>h.data.value),f.selectAll("g").data([u]).join("g").each((h,p,d)=>{V(d[p]).selectAll("text").data([h]).join("text").text(m=>m.data.label).attr("dominant-baseline","hanging").attr("x",o).attr("y",o).attr("font-size",r.styles.textSize).each(function(m){const y=V(this),b=m.data.label.split(/\s+/).reverse();let v,x=[];const S=y.attr("x");let $=y.attr("y"),R=0,T=y.text(null).append("tspan").attr("cursor","pointer").attr("fill",kt(n.labelColorType,r)).attr("font-size",r.styles.textSize).attr("x",S).attr("y",$);for(;v=b.pop();)x.push(v),T.text(x.join(" ")),T.node().getComputedTextLength()>m.x1-m.x0-o&&(x.pop(),T.text(x.join(" ")),x=[v],R+=a,T=y.append("tspan").attr("cursor","pointer").attr("fill",kt(n.labelColorType,r)).attr("font-size",r.styles.textSize).attr("x",S).attr("y",$).attr("dy",R+"px").text(v))})})}),s}function kN({selection:t,ids:e,fullChartParams:n}){if(t.interrupt("highlight"),!e.length){t.transition("highlight").duration(200).style("opacity",1);return}t.each((r,i,o)=>{e.includes(r.data.id)?V(o[i]).style("opacity",1):V(o[i]).style("opacity",n.styles.unhighlightedOpacity)})}const RN=Lg(CN)(({selection:t,name:e,subject:n,observer:r})=>{const i=new nt,o=U({layout:r.layout$,visibleComputedData:r.visibleComputedData$,fullParams:r.fullParams$,fullDataFormatter:r.fullDataFormatter$,fullChartParams:r.fullChartParams$}).pipe(I(i),W(async u=>u),B(u=>{const l=Qy().size([u.layout.width,u.layout.height]).paddingInner(u.fullParams.paddingInner).paddingOuter(u.fullParams.paddingOuter).round(!0).tile(Qf.ratio(u.fullParams.squarifyRatio)),c=eu(u.visibleComputedData).sum(h=>h.value).sort(u.fullParams.sort);return l(c),c.leaves()})),a=U({selection:Qo(t),treeData:o,fullParams:r.fullParams$,fullChartParams:r.fullChartParams$,textSizePx:r.textSizePx$}).pipe(I(i),W(async u=>u),B(u=>LN({selection:t,treeData:u.treeData,fullParams:u.fullParams,fullChartParams:u.fullChartParams,textSizePx:u.textSizePx}))),s=r.fullChartParams$.pipe(I(i),B(u=>u.highlightTarget),tt());return U({cellSelection:a,computedData:r.computedData$,treeData:o,fullParams:r.fullParams$,fullChartParams:r.fullChartParams$,highlightTarget:s,CategoryDataMap:r.CategoryDataMap$}).pipe(I(i),W(async u=>u)).subscribe(u=>{u.cellSelection.on("mouseover",(l,c)=>{l.stopPropagation(),n.event$.next({type:"tree",eventName:"mouseover",pluginName:dr,highlightTarget:u.highlightTarget,datum:c.data,category:u.CategoryDataMap.get(c.data.categoryLabel),categoryIndex:c.data.categoryIndex,categoryLabel:c.data.categoryLabel,event:l,data:u.computedData})}).on("mousemove",(l,c)=>{l.stopPropagation(),n.event$.next({type:"tree",eventName:"mousemove",pluginName:dr,highlightTarget:u.highlightTarget,datum:c.data,category:u.CategoryDataMap.get(c.data.categoryLabel),categoryIndex:c.data.categoryIndex,categoryLabel:c.data.categoryLabel,event:l,data:u.computedData})}).on("mouseout",(l,c)=>{l.stopPropagation(),n.event$.next({type:"tree",eventName:"mouseout",pluginName:dr,highlightTarget:u.highlightTarget,datum:c.data,category:u.CategoryDataMap.get(c.data.categoryLabel),categoryIndex:c.data.categoryIndex,categoryLabel:c.data.categoryLabel,event:l,data:u.computedData})}).on("click",(l,c)=>{l.stopPropagation(),n.event$.next({type:"tree",eventName:"click",pluginName:dr,highlightTarget:u.highlightTarget,datum:c.data,category:u.CategoryDataMap.get(c.data.categoryLabel),categoryIndex:c.data.categoryIndex,categoryLabel:c.data.categoryLabel,event:l,data:u.computedData})})}),U({cellSelection:a,highlight:r.treeHighlight$.pipe(B(u=>u.map(l=>l.id))),fullChartParams:r.fullChartParams$}).pipe(I(i),W(async u=>u)).subscribe(u=>{kN({selection:u.cellSelection,ids:u.highlight,fullChartParams:u.fullChartParams})}),()=>{i.next(void 0)}});K.BarStack=FE,K.Bars=CE,K.BarsPN=LE,K.BarsTriangle=XE,K.Bubbles=WI,K.CONTAINER_PLUGIN_PARAMS=kI,K.DEFAULT_BARS_DIVERGING_PARAMS=G2,K.DEFAULT_BARS_PARAMS=jo,K.DEFAULT_BARS_TRIANGLE_PARAMS=gp,K.DEFAULT_BAR_STACK_PARAMS=dp,K.DEFAULT_BUBBLES_PARAMS=T2,K.DEFAULT_DOTS_PARAMS=pp,K.DEFAULT_GRID_LEGEND_PARAMS=bp,K.DEFAULT_GROUP_AREA_PARAMS=Yu,K.DEFAULT_GROUP_AXIS_PARAMS=Uu,K.DEFAULT_LINES_PARAMS=gr,K.DEFAULT_LINE_AREAS_PARAMS=hp,K.DEFAULT_MULTI_BARS_PARAMS=a2,K.DEFAULT_MULTI_BARS_TRIANGLE_PARAMS=u2,K.DEFAULT_MULTI_BAR_STACK_PARAMS=s2,K.DEFAULT_MULTI_DOTS_PARAMS=f2,K.DEFAULT_MULTI_GRID_LEGEND_PARAMS=o2,K.DEFAULT_MULTI_GROUP_AXIS_PARAMS=Yh,K.DEFAULT_MULTI_LINES_PARAMS=l2,K.DEFAULT_MULTI_LINE_AREAS_PARAMS=c2,K.DEFAULT_MULTI_VALUE_AXIS_PARAMS=Gu,K.DEFAULT_MULTI_VALUE_STACK_AXIS_PARAMS=xI,K.DEFAULT_OVERLAPPING_VALUE_AXES_PARAMS=Uh,K.DEFAULT_OVERLAPPING_VALUE_STACK_AXES_PARAMS=h2,K.DEFAULT_PIE_EVENT_TEXTS_PARAMS=rp,K.DEFAULT_PIE_LABELS_PARAMS=ip,K.DEFAULT_PIE_PARAMS=P2,K.DEFAULT_ROSE_LABELS_PARAMS=op,K.DEFAULT_ROSE_PARAMS=M2,K.DEFAULT_SCALING_AREA_PARAMS=yp,K.DEFAULT_SERIES_LEGEND_PARAMS=D2,K.DEFAULT_TREE_LEGEND_PARAMS=N2,K.DEFAULT_TREE_MAP_PARAMS=fp,K.DEFAULT_VALUE_AXIS_PARAMS=Wu,K.DEFAULT_VALUE_STACK_AXIS_PARAMS=mp,K.Dots=ZE,K.GridLegend=QE,K.GroupAux=bI,K.GroupAxis=iI,K.LineAreas=$E,K.Lines=mE,K.MultiBarStack=wI,K.MultiBars=_I,K.MultiBarsTriangle=$I,K.MultiDots=TI,K.MultiGridLegend=vI,K.MultiGroupAxis=PI,K.MultiLineAreas=AI,K.MultiLines=SI,K.MultiValueAxis=MI,K.MultiValueStackAxis=DI,K.OverlappingValueAxes=CI,K.OverlappingValueStackAxes=LI,K.Pie=ZI,K.PieEventTexts=JI,K.PieLabels=cN,K.Rose=mN,K.RoseLabels=PN,K.ScalingArea=cI,K.SeriesLegend=MN,K.TOOLTIP_PARAMS=ep,K.Tooltip=NI,K.TreeLegend=DN,K.TreeMap=RN,K.ValueAxis=uI,K.ValueStackAxis=lI,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"})});
77
+ }`;const ip={outerRadius:.85,outerRadiusWhileHighlight:.9,startAngle:0,endAngle:Math.PI*2,labelCentroid:2.1,labelColorType:"primary",labelFn:t=>String(t.label)};ip.labelFn.toString=()=>"d => String(d.label)";const M2={outerRadius:.85,padAngle:0,strokeColorType:"background",strokeWidth:0,cornerRadius:0,arcScaleType:"area",angleIncreaseWhileHighlight:.05},op={outerRadius:.85,labelCentroid:2.1,labelFn:t=>String(t.label),labelColorType:"primary",arcScaleType:"area"};op.labelFn.toString=()=>"d => String(d.label)";const D2={position:"right",justify:"end",padding:28,backgroundFill:"none",backgroundStroke:"none",gap:10,listRectWidth:14,listRectHeight:14,listRectRadius:0,textColorType:"primary"},FI={name:"Bubbles",defaultParams:T2,layerIndex:ke,validator:(t,{validateColumns:e})=>{const n=e(t,{force:{toBeTypes:["object"]},bubbleText:{toBeTypes:["object"]},arcScaleType:{toBe:'"area" | "radius"',test:r=>r==="area"||r==="radius"}});if(t.force){const r=e(t.force,{velocityDecay:{toBeTypes:["number"]},collisionSpacing:{toBeTypes:["number"]},strength:{toBeTypes:["number"]}});if(r.status==="error")return r}if(t.bubbleText){const r=e(t.bubbleText,{fillRate:{toBeTypes:["number"]},lineHeight:{toBeTypes:["number"]},lineLengthMin:{toBeTypes:["number"]}});if(r.status==="error")return r}return n}};let Ln;function OI(t,e){return o1().velocityDecay(e.force.velocityDecay).force("collision",n1().radius(n=>n.r+e.force.collisionSpacing)).force("charge",a1().strength(n=>-Math.pow(n.r,2)*e.force.strength)).on("tick",()=>{t.attr("transform",n=>`translate(${n.x},${n.y})`)})}function GI({visibleComputedLayoutData:t,LastBubbleDataMap:e,graphicWidth:n,graphicHeight:r,SeriesContainerPositionMap:i,scaleType:o}){const a=Math.min(n,r)/2,s=t.flat(),u=s.reduce((h,p)=>h+p.value,0),l=li().domain([0,u]).range([0,a]).exponent(o==="area"?.5:1),c=o==="area"?1:(()=>{const h=a*a*Math.PI;return Math.sqrt(h/e0(s,p=>Math.PI*Math.pow(l(p.value),2)))})(),f=.9;return s.map(h=>{const p=h,d=e.get(p.id);if(d)p.x=d.x,p.y=d.y;else{const m=i.get(p.seriesLabel);p.x=Math.random()*m.width,p.y=Math.random()*m.height}const g=l(p.value??0)*c*f;return p.r=g,p._originR=g,p})}function zI({selection:t,bubblesData:e,fullParams:n,sumSeries:r}){const i=t.selectAll("g").data(e,a=>a.id).join(a=>{const s=a.append("g").attr("cursor","pointer").attr("font-size",12).style("fill","#ffffff").attr("text-anchor","middle");return s.append("circle").attr("class","node").attr("cx",0).attr("cy",0).attr("fill",u=>u.color),s.append("text").style("opacity",.8).attr("pointer-events","none"),s},a=>a,a=>a.remove()).attr("transform",a=>`translate(${a.x},${a.y})`),o=r?"seriesLabel":"label";return i.select("circle").transition().duration(200).attr("r",a=>a.r).attr("fill",a=>a.color),i.each((a,s,u)=>{const l=V(u[s]);let c=!0;a[o].length<=n.bubbleText.lineLengthMin&&(c=!1),l.call(JE,{text:a[o],radius:a.r*n.bubbleText.fillRate,lineHeight:n.bubbleText.lineHeight,isBreakAll:c})}),i}function YI(){return x0().on("start",(t,e)=>{t.active||Ln.alpha(1).restart(),e.fx=e.x,e.fy=e.y}).on("drag",(t,e)=>{t.active||Ln.alphaTarget(0),e.fx=t.x,e.fy=t.y}).on("end",(t,e)=>{e.fx=null,e.fy=null})}function UI({fullParams:t,SeriesContainerPositionMap:e}){Ln.force("x",s1().strength(t.force.strength).x(n=>e.get(n.seriesLabel).centerX)).force("y",u1().strength(t.force.strength).y(n=>e.get(n.seriesLabel).centerY)),Ln.alpha(1).restart()}function WI({bubblesSelection:t,highlightIds:e,fullChartParams:n}){if(t.interrupt("highlight"),!e.length){t.transition("highlight").style("opacity",1);return}t.each((r,i,o)=>{const a=V(o[i]);e.includes(r.id)?a.style("opacity",1).transition("highlight").ease(no).duration(500):a.style("opacity",n.styles.unhighlightedOpacity)})}const HI=Fn(FI)(({selection:t,name:e,observer:n,subject:r})=>{const i=new nt;let o=new Map;const a=n.fullDataFormatter$.pipe(B(f=>f.sumSeries),tt()),s=n.fullParams$.pipe(I(i),B(f=>f.arcScaleType),tt()),u=U({layout:n.layout$,SeriesContainerPositionMap:n.SeriesContainerPositionMap$,visibleComputedLayoutData:n.visibleComputedLayoutData$,scaleType:s}).pipe(I(i),W(async f=>f),B(f=>GI({visibleComputedLayoutData:f.visibleComputedLayoutData,LastBubbleDataMap:o,graphicWidth:f.layout.width,graphicHeight:f.layout.height,SeriesContainerPositionMap:f.SeriesContainerPositionMap,scaleType:f.scaleType})),St(1));u.subscribe(f=>{o=new Map(f.map(h=>[h.id,h]))});const l=n.fullChartParams$.pipe(I(i),B(f=>f.highlightTarget),tt()),c=U({bubblesData:u,fullParams:n.fullParams$,SeriesContainerPositionMap:n.SeriesContainerPositionMap$,sumSeries:a}).pipe(I(i),W(async f=>f),B(f=>{Ln&&Ln.stop();const h=zI({selection:t,bubblesData:f.bubblesData,fullParams:f.fullParams,sumSeries:f.sumSeries});return Ln=OI(h,f.fullParams),Ln.nodes(f.bubblesData),UI({fullParams:f.fullParams,SeriesContainerPositionMap:f.SeriesContainerPositionMap}),h}));return U({bubblesSelection:c,computedData:n.computedData$,SeriesDataMap:n.SeriesDataMap$,highlightTarget:l}).pipe(I(i),W(async f=>f)).subscribe(f=>{f.bubblesSelection.on("mouseover",(h,p)=>{r.event$.next({type:"series",eventName:"mouseover",pluginName:e,highlightTarget:f.highlightTarget,datum:p,series:f.SeriesDataMap.get(p.seriesLabel),seriesIndex:p.seriesIndex,seriesLabel:p.seriesLabel,event:h,data:f.computedData})}).on("mousemove",(h,p)=>{r.event$.next({type:"series",eventName:"mousemove",pluginName:e,highlightTarget:f.highlightTarget,datum:p,series:f.SeriesDataMap.get(p.seriesLabel),seriesIndex:p.seriesIndex,seriesLabel:p.seriesLabel,event:h,data:f.computedData})}).on("mouseout",(h,p)=>{r.event$.next({type:"series",eventName:"mouseout",pluginName:e,highlightTarget:f.highlightTarget,datum:p,series:f.SeriesDataMap.get(p.seriesLabel),seriesIndex:p.seriesIndex,seriesLabel:p.seriesLabel,event:h,data:f.computedData})}).on("click",(h,p)=>{r.event$.next({type:"series",eventName:"click",pluginName:e,highlightTarget:f.highlightTarget,datum:p,series:f.SeriesDataMap.get(p.seriesLabel),seriesIndex:p.seriesIndex,seriesLabel:p.seriesLabel,event:h,data:f.computedData})}).call(YI())}),U({bubblesSelection:c,bubblesData:u,highlight:n.seriesHighlight$.pipe(B(f=>f.map(h=>h.id))),fullChartParams:n.fullChartParams$,fullParams:n.fullParams$,sumSeries:a,SeriesContainerPositionMap:n.SeriesContainerPositionMap$}).pipe(I(i),W(async f=>f)).subscribe(f=>{WI({bubblesSelection:f.bubblesSelection,highlightIds:f.highlight,fullChartParams:f.fullChartParams})}),()=>{i.next(void 0)}});function C2({data:t,startAngle:e,endAngle:n}){return Yx().startAngle(e).endAngle(n).value(o=>o.value).sort((o,a)=>o.seq-a.seq)(t).map((o,a)=>{let s=o;return s.id=o.data.id,s})}function XI({selection:t,pluginName:e,separateSeries$:n,seriesLabels$:r}){const i=ot(e,"series");return U({seriesLabels:r,separateSeries:n}).pipe(W(async o=>o),B((o,a)=>{const s=o.separateSeries?o.seriesLabels:[o.seriesLabels.join("")];return t.selectAll(`g.${i}`).data(s,u=>u).join(u=>u.append("g").classed(i,!0),u=>u,u=>u.remove())}),St(1))}const Ho=({selection:t,pluginName:e,separateSeries$:n,seriesLabels$:r,seriesContainerPosition$:i})=>{const o=XI({selection:t,pluginName:e,separateSeries$:n,seriesLabels$:r});return U({seriesCenterSelection:o,seriesContainerPosition:i}).pipe(W(async a=>a),tt((a,s)=>a.seriesContainerPosition.length===s.seriesContainerPosition.length)).subscribe(a=>{a.seriesCenterSelection.attr("transform",(s,u)=>{const l=a.seriesContainerPosition[u]??a.seriesContainerPosition[0];return`translate(${l.centerX}, ${l.centerY})`})}),U({seriesCenterSelection:o,seriesContainerPosition:i}).pipe(W(async a=>a)).subscribe(a=>{a.seriesCenterSelection.transition().attr("transform",(s,u)=>{const l=a.seriesContainerPosition[u]??a.seriesContainerPosition[0];return`translate(${l.centerX}, ${l.centerY})`})}),{seriesCenterSelection$:o}},ap="Pie",jI={name:ap,defaultParams:P2,layerIndex:ke,validator:(t,{validateColumns:e})=>e(t,{outerRadius:{toBeTypes:["number"]},innerRadius:{toBeTypes:["number"]},outerRadiusWhileHighlight:{toBeTypes:["number"]},startAngle:{toBeTypes:["number"]},endAngle:{toBeTypes:["number"]},padAngle:{toBeTypes:["number"]},strokeColorType:{toBeTypes:["string"]},strokeWidth:{toBeTypes:["number"]},cornerRadius:{toBeTypes:["number"]}})};function VI({enter:t,exit:e,data:n,lastTweenData:r,fullParams:i}){return!t.size()&&!e.size()?o=>{const a=n.map((s,u)=>{const l=r[u]??{startAngle:0,endAngle:0,value:0};return{...s,startAngle:s.startAngle*o+l.startAngle*(1-o),endAngle:s.endAngle*o+l.endAngle*(1-o),value:s.value*o+l.value*(1-o)}});return sp(a,i.startAngle,i.endAngle,1)}:o=>sp(n,i.startAngle,i.endAngle,o)}function sp(t,e,n,r){return t.map((i,o)=>{const a=e+(i.startAngle-e)*r,s=a+(i.endAngle-i.startAngle)*r;return{...i,startAngle:a,endAngle:s}})}function L2({selection:t,data:e,arc:n,pathClassName:r,fullParams:i,fullChartParams:o}){return t.selectAll("path").data(e,s=>s.id).join("path").classed(r,!0).style("cursor","pointer").attr("fill",(s,u)=>s.data.color).attr("stroke",(s,u)=>Mn({datum:s.data,colorType:i.strokeColorType,fullChartParams:o})).attr("stroke-width",i.strokeWidth).attr("d",(s,u)=>n(s))}function qI({pathSelection:t,ids:e,fullChartParams:n,arc:r,arcHighlight:i}){if(t.interrupt("highlight"),!e.length){t.transition("highlight").style("opacity",1).attr("d",o=>r(o));return}t.each((o,a,s)=>{const u=V(s[a]);e.includes(o.data.id)?u.style("opacity",1).transition("highlight").ease(no).duration(500).attr("d",l=>i(l)):u.style("opacity",n.styles.unhighlightedOpacity).transition("highlight").attr("d",l=>r(l))})}function ZI(t,e){const n=new nt,r=ot(t,"path");let i=[],o=[];const a=e.seriesContainerPosition$.pipe(I(n),B(h=>h.width<h.height?h.width:h.height),tt()),s=new dt(h=>{U({containerVisibleComputedLayoutData:e.containerVisibleComputedLayoutData$,fullParams:e.fullParams$}).pipe(I(n),W(async p=>p)).subscribe(p=>{const d=C2({data:p.containerVisibleComputedLayoutData,startAngle:p.fullParams.startAngle,endAngle:p.fullParams.endAngle});h.next(d)})}),u=new dt(h=>{U({shorterSideWith:a,fullParams:e.fullParams$}).pipe(I(n),W(async p=>p)).subscribe(p=>{const d=Nu({axisWidth:p.shorterSideWith,innerRadius:p.fullParams.innerRadius,outerRadius:p.fullParams.outerRadius,padAngle:p.fullParams.padAngle,cornerRadius:p.fullParams.cornerRadius});h.next(d)})}),l=new dt(h=>{U({shorterSideWith:a,fullParams:e.fullParams$}).pipe(I(n),W(async p=>p)).subscribe(p=>{const d=Nu({axisWidth:p.shorterSideWith,innerRadius:p.fullParams.innerRadius,outerRadius:p.fullParams.outerRadiusWhileHighlight,padAngle:p.fullParams.padAngle,cornerRadius:p.fullParams.cornerRadius});h.next(d)})}),c=e.fullChartParams$.pipe(I(n),B(h=>h.highlightTarget),tt()),f=new dt(h=>{U({pieData:s,arc:u,computedData:e.computedData$,fullParams:e.fullParams$,fullChartParams:e.fullChartParams$,highlightTarget:c}).pipe(I(n),W(async p=>p)).subscribe(p=>{e.containerSelection.interrupt("graphicMove");const d=e.containerSelection.selectAll("path").data(p.pieData,b=>b.id),g=d.enter(),m=d.exit(),y=VI({enter:g,exit:m,data:p.pieData,lastTweenData:i,fullParams:p.fullParams});e.containerSelection.transition("graphicMove").duration(p.fullChartParams.transitionDuration).tween("move",(b,v)=>x=>{o=y(x),L2({selection:e.containerSelection,data:o,arc:p.arc,pathClassName:r,fullParams:p.fullParams,fullChartParams:p.fullChartParams})}).on("end",(b,v)=>{o=sp(p.pieData,p.fullParams.startAngle,p.fullParams.endAngle,1);const x=L2({selection:e.containerSelection,data:o,arc:p.arc,pathClassName:r,fullParams:p.fullParams,fullChartParams:p.fullChartParams});h.next(x),i=Object.assign([],p.pieData),e.event$.next({type:"series",pluginName:t,eventName:"transitionEnd",event:void 0,highlightTarget:p.highlightTarget,datum:null,series:[],seriesIndex:-1,seriesLabel:"",data:p.computedData})})})}).pipe(St(1));return U({pathSelection:f,SeriesDataMap:e.SeriesDataMap$,computedData:e.computedData$,highlightTarget:c}).pipe(I(n),W(async h=>h)).subscribe(h=>{h.pathSelection.on("mouseover",(p,d)=>{p.stopPropagation(),e.event$.next({type:"series",eventName:"mouseover",pluginName:t,highlightTarget:h.highlightTarget,datum:d.data,series:h.SeriesDataMap.get(d.data.seriesLabel),seriesIndex:d.data.seriesIndex,seriesLabel:d.data.seriesLabel,event:p,data:h.computedData})}).on("mousemove",(p,d)=>{p.stopPropagation(),e.event$.next({type:"series",eventName:"mousemove",pluginName:t,highlightTarget:h.highlightTarget,datum:d.data,series:h.SeriesDataMap.get(d.data.seriesLabel),seriesIndex:d.data.seriesIndex,seriesLabel:d.data.seriesLabel,event:p,data:h.computedData})}).on("mouseout",(p,d)=>{p.stopPropagation(),e.event$.next({type:"series",eventName:"mouseout",pluginName:t,highlightTarget:h.highlightTarget,datum:d.data,series:h.SeriesDataMap.get(d.data.seriesLabel),seriesIndex:d.data.seriesIndex,seriesLabel:d.data.seriesLabel,event:p,data:h.computedData})}).on("click",(p,d)=>{p.stopPropagation(),e.event$.next({type:"series",eventName:"click",pluginName:t,highlightTarget:h.highlightTarget,datum:d.data,series:h.SeriesDataMap.get(d.data.seriesLabel),seriesIndex:d.data.seriesIndex,seriesLabel:d.data.seriesLabel,event:p,data:h.computedData})})}),U({pathSelection:f,highlight:e.seriesHighlight$.pipe(B(h=>h.map(p=>p.id))),fullChartParams:e.fullChartParams$,arc:u,arcHighlight:l}).pipe(I(n),W(async h=>h)).subscribe(h=>{qI({pathSelection:h.pathSelection,ids:h.highlight,fullChartParams:h.fullChartParams,arc:h.arc,arcHighlight:h.arcHighlight})}),()=>{n.next(void 0)}}const KI=Fn(jI)(({selection:t,name:e,subject:n,observer:r})=>{const i=new nt,{seriesCenterSelection$:o}=Ho({selection:t,pluginName:ap,separateSeries$:r.separateSeries$,seriesLabels$:r.seriesLabels$,seriesContainerPosition$:r.seriesContainerPosition$}),a=[];return o.pipe(I(i)).subscribe(s=>{a.forEach(u=>u()),s.each((u,l,c)=>{const f=V(c[l]),h=r.visibleComputedLayoutData$.pipe(I(i),B(d=>d[l]??d[0])),p=r.seriesContainerPosition$.pipe(I(i),B(d=>d[l]??d[0]));a[l]=ZI(ap,{containerSelection:f,computedData$:r.computedData$,containerVisibleComputedLayoutData$:h,SeriesDataMap$:r.SeriesDataMap$,fullParams$:r.fullParams$,fullChartParams$:r.fullChartParams$,seriesHighlight$:r.seriesHighlight$,seriesContainerPosition$:p,event$:n.event$})})}),()=>{i.next(void 0),a.forEach(s=>s())}}),zu="PieEventTexts",k2=ot(zu,"text"),QI={name:zu,defaultParams:rp,layerIndex:Oh,validator:(t,{validateColumns:e})=>e(t,{eventFn:{toBeTypes:["Function"]},textAttrs:{toBeTypes:["object[]"]},textStyles:{toBeTypes:["object[]"]}})};function up(t,e){const n=t.selectAll(`text.${k2}`).data(e),r=n.enter().append("text").classed(k2,!0),i=n.merge(r);return i.each((o,a,s)=>{const u=V(s[a]).text(o.text);Object.keys(o.attr).forEach(l=>{u.attr(l,o.attr[l])}),Object.keys(o.style).forEach(l=>{u.style(l,o.style[l])})}),n.exit().remove(),i}function lp({eventData:t,eventName:e,t:n,eventFn:r,textAttrs:i,textStyles:o}){return r(t,e,n).map((s,u)=>({text:s,attr:i[u],style:o[u]}))}function JI(t,e){const n=new nt;let r;const i=e.fullChartParams$.pipe(I(n),B(o=>o.highlightTarget),tt());return U({computedData:e.computedData$,fullParams:e.fullParams$,fullChartParams:e.fullChartParams$,highlightTarget:i}).pipe(I(n),W(async o=>o)).subscribe(o=>{e.containerSelection.transition("move").duration(o.fullChartParams.transitionDuration).tween("move",(a,s)=>u=>{const l=lp({eventData:{type:"series",pluginName:t,eventName:"transitionMove",event:a,highlightTarget:o.highlightTarget,data:o.computedData,series:[],seriesIndex:-1,seriesLabel:"",datum:null},eventName:"transitionMove",t:u,eventFn:o.fullParams.eventFn,textAttrs:o.fullParams.textAttrs,textStyles:o.fullParams.textStyles});up(e.containerSelection,l)}).on("end",(a,s)=>{const u=lp({eventData:{type:"series",pluginName:t,eventName:"transitionEnd",event:a,highlightTarget:o.highlightTarget,data:o.computedData,series:[],seriesIndex:-1,seriesLabel:"",datum:null},eventName:"transitionMove",t:1,eventFn:o.fullParams.eventFn,textAttrs:o.fullParams.textAttrs,textStyles:o.fullParams.textStyles});up(e.containerSelection,u),r&&r.unsubscribe(),r=e.event$.subscribe(l=>{const c=lp({eventData:l,eventName:l.eventName,t:1,eventFn:o.fullParams.eventFn,textAttrs:o.fullParams.textAttrs,textStyles:o.fullParams.textStyles});up(e.containerSelection,c)})})}),()=>{n.next(void 0)}}const tN=Fn(QI)(({selection:t,name:e,observer:n,subject:r})=>{const i=new nt,{seriesCenterSelection$:o}=Ho({selection:t,pluginName:zu,separateSeries$:n.separateSeries$,seriesLabels$:n.seriesLabels$,seriesContainerPosition$:n.seriesContainerPosition$}),a=[];return o.pipe(I(i)).subscribe(s=>{a.forEach(u=>u()),s.each((u,l,c)=>{const f=V(c[l]),h=n.computedLayoutData$.pipe(I(i),B(d=>d[l]??d[0])),p=n.seriesContainerPosition$.pipe(I(i),B(d=>d[l]??d[0]));a[l]=JI(zu,{containerSelection:f,computedData$:n.computedData$,containerComputedLayoutData$:h,SeriesDataMap$:n.SeriesDataMap$,fullParams$:n.fullParams$,fullChartParams$:n.fullChartParams$,seriesHighlight$:n.seriesHighlight$,seriesContainerPosition$:p,event$:r.event$})})}),()=>{i.next(void 0),a.forEach(s=>s())}}),xi="PieLabels",eN=ot(xi,"label-g"),nN=ot(xi,"line-g"),rN=ot(xi,"text"),R2=2,iN={name:xi,defaultParams:ip,layerIndex:Oh,validator:(t,{validateColumns:e})=>e(t,{outerRadius:{toBeTypes:["number"]},outerRadiusWhileHighlight:{toBeTypes:["number"]},startAngle:{toBeTypes:["number"]},endAngle:{toBeTypes:["number"]},labelCentroid:{toBeTypes:["number"]},labelFn:{toBeTypes:["Function"]},labelColorType:{toBeOption:"ColorType"}})};function oN({pieData:t,arc:e,arcMouseover:n,labelCentroid:r,lineStartCentroid:i,fullParams:o}){return t.map((a,s)=>{const[u,l]=e.centroid(a),[c,f]=n.centroid(a),h=o.labelFn(a.data);return{pieDatum:a,arcIndex:s,arcLabels:h.split(`
78
+ `),lineStartX:u*i,lineStartY:l*i,lineStartMouseoverX:c*i,lineStartMouseoverY:f*i,x:u*r,y:l*r,mouseoverX:c*r,mouseoverY:f*r,textWidth:0,collisionShiftX:0,collisionShiftY:0,quadrant:u>=0&&l<=0?1:u<0&&l<=0?2:u<0&&l>0?3:4}}).filter(a=>a.pieDatum.data.visible)}function aN({labelGSelection:t,data:e,fullParams:n,fullChartParams:r,textSizePx:i}){const o=t.selectAll("text").data(e,a=>a.pieDatum.id).join("text").classed(rN,!0).attr("font-weight","bold").attr("text-anchor",a=>a.quadrant==1||a.quadrant==4?"start":"end").style("dominant-baseline",a=>a.quadrant==1||a.quadrant==2?"auto":"hanging").style("cursor",a=>r.highlightTarget&&r.highlightTarget!="none"?"pointer":"none").attr("font-size",r.styles.textSize).attr("x",0).attr("y",0).attr("fill",(a,s)=>Mn({datum:a.pieDatum.data,colorType:n.labelColorType,fullChartParams:r})).each((a,s,u)=>{t2(V(u[s]),{textArr:a.arcLabels,textSizePx:i,quadrant:a.quadrant})});return o.transition().attr("transform",a=>"translate("+a.x+","+a.y+")"),o}function sN(t,e,n){const r=t.nodes(),i=n,o=r.map((a,s)=>{const u=a.getBBox(),l=[e[s].x,e[s].y];return{node:a,x:l[0],y:l[1],width:u.width,height:u.height}});for(let a=0;a<o.length;a++){const s=o[a];for(let u=a+1;u<o.length;u++){const l=o[u];e[a].textWidth=s.width;const c=s.x+e[a].collisionShiftX,f=s.y+e[a].collisionShiftY,h=l.x+e[u].collisionShiftX,p=l.y+e[u].collisionShiftY;if(!(c+s.width/2<h-l.width/2||c-s.width/2>h+l.width/2||f+s.height/2<p-l.height/2||f-s.height/2>p+l.height/2)){if(e[u].quadrant==2){const d=p>f?-i*2:-i;e[u].collisionShiftY+=d}else if(e[u].quadrant==4){const d=p>f?i:i*2;e[u].collisionShiftY+=d}}}}for(let a=o.length-1;a>=0;a--){const s=o[a];for(let u=a-1;u>=0;u--){const l=o[u];e[a].textWidth=s.width;const c=s.x+e[a].collisionShiftX,f=s.y+e[a].collisionShiftY,h=l.x+e[u].collisionShiftX,p=l.y+e[u].collisionShiftY;if(!(c+s.width/2<h-l.width/2||c-s.width/2>h+l.width/2||f+s.height/2<p-l.height/2||f-s.height/2>p+l.height/2)){if(e[u].quadrant==1){const d=p>f?-i*2:-i;e[u].collisionShiftY+=d}else if(e[u].quadrant==3){const d=p>f?i:i*2;e[u].collisionShiftY+=d}}}}t.data(e).transition().attr("transform",a=>`translate(${a.x+a.collisionShiftX},${a.y+a.collisionShiftY})`)}function uN({lineGSelection:t,data:e,fullParams:n,fullChartParams:r}){const i=e.filter(a=>a.collisionShiftX||a.collisionShiftY),o=t.selectAll("polyline").data(i,a=>a.pieDatum.id).join("polyline").attr("stroke",a=>Mn({datum:a.pieDatum.data,colorType:n.labelColorType,fullChartParams:r})).attr("stroke-width",1).attr("fill","none").attr("points",a=>[[a.lineStartX,a.lineStartY],[a.lineStartX,a.lineStartY]]);return o.transition().attr("points",a=>{let s=a.x+a.collisionShiftX,u=a.y+a.collisionShiftY;return[[s,u],[a.lineStartX,a.lineStartY]]}),o}function lN({textSelection:t,lineSelection:e,ids:n,fullChartParams:r}){if(t.interrupt("highlight"),e.interrupt("highlight"),!n.length){t.transition("highlight").duration(200).attr("transform",i=>`translate(${i.x+i.collisionShiftX},${i.y+i.collisionShiftY})`).style("opacity",1),e.transition("highlight").duration(200).style("opacity",1);return}t.each((i,o,a)=>{const s=V(a[o]);n.includes(i.pieDatum.id)?s.style("opacity",1).transition("highlight").duration(200).attr("transform",u=>u.collisionShiftX||u.collisionShiftY?`translate(${u.x+u.collisionShiftX},${u.y+u.collisionShiftY})`:`translate(${u.mouseoverX+u.collisionShiftX},${u.mouseoverY+u.collisionShiftY})`):s.style("opacity",r.styles.unhighlightedOpacity).transition("highlight").duration(200).attr("transform",u=>`translate(${u.x+u.collisionShiftX},${u.y+u.collisionShiftY})`)}),e.each((i,o,a)=>{const s=V(a[o]);n.includes(i.pieDatum.data.id)?s.style("opacity",1).transition("highlight").duration(200):s.style("opacity",r.styles.unhighlightedOpacity).transition("highlight").duration(200)})}function cN(t,e){const n=new nt;e.containerSelection.selectAll("g").remove();const r=e.containerSelection.append("g");r.classed(nN,!0);const i=e.containerSelection.append("g");i.classed(eN,!0);const o=new nt,a=new nt;let s=[];const u=e.seriesContainerPosition$.pipe(I(n),B(c=>c.width<c.height?c.width:c.height),tt()),l=e.fullParams$.pipe(I(n),B(c=>c.labelCentroid>=R2?R2:c.labelCentroid));return U({shorterSideWith:u,containerVisibleComputedLayoutData:e.containerVisibleComputedLayoutData$,fullParams:e.fullParams$,fullChartParams:e.fullChartParams$,textSizePx:e.textSizePx$,lineStartCentroid:l}).pipe(I(n),W(async c=>c)).subscribe(c=>{const f=Nu({axisWidth:c.shorterSideWith,innerRadius:0,outerRadius:c.fullParams.outerRadius,padAngle:0,cornerRadius:0}),h=Nu({axisWidth:c.shorterSideWith,innerRadius:0,outerRadius:c.fullParams.outerRadiusWhileHighlight,padAngle:0,cornerRadius:0}),p=C2({data:c.containerVisibleComputedLayoutData,startAngle:c.fullParams.startAngle,endAngle:c.fullParams.endAngle});s=oN({pieData:p,arc:f,arcMouseover:h,labelCentroid:c.fullParams.labelCentroid,lineStartCentroid:c.lineStartCentroid,fullParams:c.fullParams}),r.selectAll("polyline").remove();const d=aN({labelGSelection:i,data:s,fullParams:c.fullParams,fullChartParams:c.fullChartParams,textSizePx:c.textSizePx});setTimeout(()=>{sN(d,s,c.textSizePx);const g=uN({lineGSelection:r,data:s,fullParams:c.fullParams,fullChartParams:c.fullChartParams});a.next(g)},1e3),o.next(d)}),U({textSelection:o,lineSelection:a,highlight:e.seriesHighlight$.pipe(B(c=>c.map(f=>f.id))),fullChartParams:e.fullChartParams$}).pipe(I(n),W(async c=>c)).subscribe(c=>{lN({textSelection:c.textSelection,lineSelection:c.lineSelection,ids:c.highlight,fullChartParams:c.fullChartParams})}),()=>{n.next(void 0)}}const fN=Fn(iN)(({selection:t,observer:e,subject:n})=>{const r=new nt,{seriesCenterSelection$:i}=Ho({selection:t,pluginName:xi,separateSeries$:e.separateSeries$,seriesLabels$:e.seriesLabels$,seriesContainerPosition$:e.seriesContainerPosition$}),o=[];return i.pipe(I(r)).subscribe(a=>{o.forEach(s=>s()),a.each((s,u,l)=>{const c=V(l[u]),f=e.visibleComputedLayoutData$.pipe(I(r),B(p=>p[u]??p[0])),h=e.seriesContainerPosition$.pipe(I(r),B(p=>p[u]??p[0]));o[u]=cN(xi,{containerSelection:c,containerVisibleComputedLayoutData$:f,fullParams$:e.fullParams$,fullChartParams$:e.fullChartParams$,textSizePx$:e.textSizePx$,seriesHighlight$:e.seriesHighlight$,seriesContainerPosition$:h,event$:n.event$})})}),()=>{r.next(void 0)}}),cp="Rose",hN=Math.PI*2,pN={name:cp,defaultParams:M2,layerIndex:ke,validator:(t,{validateColumns:e})=>e(t,{outerRadius:{toBeTypes:["number"]},padAngle:{toBeTypes:["number"]},strokeColorType:{toBeOption:"ColorType"},strokeWidth:{toBeTypes:["number"]},cornerRadius:{toBeTypes:["number"]},arcScaleType:{toBe:'"area" | "radius"',test:r=>r==="area"||r==="radius"},angleIncreaseWhileHighlight:{toBeTypes:["number"]}})};function dN({cornerRadius:t,outerRadius:e,axisWidth:n,maxValue:r,arcScaleType:i,fullParams:o}){const a=n/2*e,s=i==="area"?.5:1,u=li().domain([0,r]).range([0,a]).exponent(s);return l=>{const c=u(l.prevValue),f=u(l.value),h=Ze(c,f);return p=>{const d=h(p);return $u().innerRadius(0).outerRadius(d).padAngle(o.padAngle).padRadius(d).cornerRadius(t)(l)}}}function gN({pathSelection:t,ids:e,fullParams:n,fullChartParams:r,tweenArc:i}){if(t.interrupt("highlight"),!e.length){t.transition("highlight").style("opacity",1).attr("d",o=>i(o)(1));return}t.each((o,a,s)=>{const u=V(s[a]);e.includes(o.data.id)?u.style("opacity",1).transition("highlight").ease(no).duration(500).attr("d",l=>i({...l,startAngle:l.startAngle-n.angleIncreaseWhileHighlight,endAngle:l.endAngle+n.angleIncreaseWhileHighlight})(1)):u.style("opacity",r.styles.unhighlightedOpacity).transition("highlight").attr("d",l=>i(l)(1))})}function mN(t,e){const n=new nt,r=ot(t,"path");let i=[];const o=e.seriesContainerPosition$.pipe(I(n),B(p=>p.width<p.height?p.width:p.height),tt()),a=U({containerVisibleComputedLayoutData:e.containerVisibleComputedLayoutData$,fullParams:e.fullParams$}).pipe(I(n),W(async p=>p),B(p=>{const d=hN/p.containerVisibleComputedLayoutData.length;return p.containerVisibleComputedLayoutData.map((g,m)=>({id:g.id,data:g,index:m,value:g.value,startAngle:d*m,endAngle:d*(m+1),padAngle:p.fullParams.padAngle,prevValue:i[m]&&i[m].id===g.id?i[m].value:0}))})),s=e.fullChartParams$.pipe(I(n),B(p=>p.highlightTarget),tt()),u=e.visibleComputedLayoutData$.pipe(B(p=>Math.max(...p.flat().map(d=>d.value))),tt()),l=U({fullParams:e.fullParams$,axisWidth:o,maxValue:u}).pipe(I(n),W(async p=>p),B(p=>dN({cornerRadius:p.fullParams.cornerRadius,outerRadius:p.fullParams.outerRadius,axisWidth:p.axisWidth,maxValue:p.maxValue,arcScaleType:p.fullParams.arcScaleType,fullParams:p.fullParams}))),c=e.fullChartParams$.pipe(I(n),B(p=>p.transitionDuration),tt()),f=new t_(!1),h=new dt(p=>{U({pieData:a,tweenArc:l,transitionDuration:c,fullParams:e.fullParams$,fullChartParams:e.fullChartParams$}).pipe(I(n),W(async d=>d)).subscribe(d=>{const g=d.pieData.map((y,b)=>(y.prevValue=i[b]&&i[b].id===y.id?i[b].value:0,y));f.next(!0);const m=e.containerSelection.selectAll("path").data(g,y=>y.id).join("path").classed(r,!0).style("cursor","pointer").attr("fill",(y,b)=>y.data.color).attr("stroke",(y,b)=>Mn({datum:y.data,colorType:d.fullParams.strokeColorType,fullChartParams:d.fullChartParams})).attr("stroke-width",d.fullParams.strokeWidth);m.interrupt("graphicMove"),m.transition("graphicMove").duration(d.transitionDuration).attrTween("d",d.tweenArc).on("end",()=>{p.next(m),f.next(!1)}),i=Object.assign([],g)})}).pipe(St(1));return U({pathSelection:h,SeriesDataMap:e.SeriesDataMap$,computedData:e.computedData$,highlightTarget:s}).pipe(I(n),W(async p=>p)).subscribe(p=>{p.pathSelection.on("mouseover",(d,g)=>{d.stopPropagation(),e.event$.next({type:"series",eventName:"mouseover",pluginName:t,highlightTarget:p.highlightTarget,datum:g.data,series:p.SeriesDataMap.get(g.data.seriesLabel),seriesIndex:g.data.seriesIndex,seriesLabel:g.data.seriesLabel,event:d,data:p.computedData})}).on("mousemove",(d,g)=>{d.stopPropagation(),e.event$.next({type:"series",eventName:"mousemove",pluginName:t,highlightTarget:p.highlightTarget,datum:g.data,series:p.SeriesDataMap.get(g.data.seriesLabel),seriesIndex:g.data.seriesIndex,seriesLabel:g.data.seriesLabel,event:d,data:p.computedData})}).on("mouseout",(d,g)=>{d.stopPropagation(),e.event$.next({type:"series",eventName:"mouseout",pluginName:t,highlightTarget:p.highlightTarget,datum:g.data,series:p.SeriesDataMap.get(g.data.seriesLabel),seriesIndex:g.data.seriesIndex,seriesLabel:g.data.seriesLabel,event:d,data:p.computedData})}).on("click",(d,g)=>{d.stopPropagation(),e.event$.next({type:"series",eventName:"click",pluginName:t,highlightTarget:p.highlightTarget,datum:g.data,series:p.SeriesDataMap.get(g.data.seriesLabel),seriesIndex:g.data.seriesIndex,seriesLabel:g.data.seriesLabel,event:d,data:p.computedData})})}),U({pathSelection:h,highlight:e.seriesHighlight$.pipe(B(p=>p.map(d=>d.id))),fullParams:e.fullParams$,fullChartParams:e.fullChartParams$,tweenArc:l,isTransitionMoving:f}).pipe(I(n),W(async p=>p),$i(p=>!p.isTransitionMoving)).subscribe(p=>{gN({pathSelection:p.pathSelection,ids:p.highlight,fullParams:p.fullParams,fullChartParams:p.fullChartParams,tweenArc:p.tweenArc})}),()=>{n.next(void 0)}}const yN=Fn(pN)(({selection:t,name:e,subject:n,observer:r})=>{const i=new nt,{seriesCenterSelection$:o}=Ho({selection:t,pluginName:cp,separateSeries$:r.separateSeries$,seriesLabels$:r.seriesLabels$,seriesContainerPosition$:r.seriesContainerPosition$}),a=[];return o.pipe(I(i)).subscribe(s=>{a.forEach(u=>u()),s.each((u,l,c)=>{const f=V(c[l]),h=r.visibleComputedLayoutData$.pipe(I(i),B(d=>JSON.parse(JSON.stringify(d[l]??d[0])))),p=r.seriesContainerPosition$.pipe(I(i),B(d=>JSON.parse(JSON.stringify(d[l]??d[0]))));a[l]=mN(cp,{containerSelection:f,computedData$:r.computedData$,visibleComputedData$:r.visibleComputedData$,visibleComputedLayoutData$:r.visibleComputedLayoutData$,containerVisibleComputedLayoutData$:h,SeriesDataMap$:r.SeriesDataMap$,fullParams$:r.fullParams$,fullChartParams$:r.fullChartParams$,seriesHighlight$:r.seriesHighlight$,seriesContainerPosition$:p,event$:n.event$})})}),()=>{i.next(void 0),a.forEach(s=>s())}}),vi="RoseLabels",bN=ot(vi,"label-g"),xN=ot(vi,"line-g"),vN=ot(vi,"text"),E2=2,_N={name:vi,defaultParams:op,layerIndex:Oh,validator:(t,{validateColumns:e})=>e(t,{outerRadius:{toBeTypes:["number"]},labelCentroid:{toBeTypes:["number"]},labelFn:{toBeTypes:["Function"]},labelColorType:{toBeOption:"ColorType"},arcScaleType:{toBe:'"area" | "radius"',test:r=>r==="area"||r==="radius"}})};function wN({pieData:t,labelCentroid:e,arcScaleType:n,maxValue:r,axisWidth:i,outerRadius:o,lineStartCentroid:a,fullParams:s}){const u=i/2*o,l=n==="area"?.5:1,c=li().domain([0,r]).range([0,u]).exponent(l);return t.map((f,h)=>{const p=c(f.value),d=$u().innerRadius(0).outerRadius(p).padAngle(0).padRadius(p).cornerRadius(0),[g,m]=d.centroid(f),[y,b]=[g,m],v=s.labelFn(f.data);return{pieDatum:f,arcIndex:h,arcLabels:v.split(`
79
+ `),lineStartX:g*a,lineStartY:m*a,lineStartMouseoverX:y*a,lineStartMouseoverY:b*a,x:g*e,y:m*e,mouseoverX:y*e,mouseoverY:b*e,textWidth:0,collisionShiftX:0,collisionShiftY:0,quadrant:g>=0&&m<=0?1:g<0&&m<=0?2:g<0&&m>0?3:4}}).filter(f=>f.pieDatum.data.visible)}function $N({labelGSelection:t,data:e,fullParams:n,fullChartParams:r,textSizePx:i}){const o=t.selectAll("text").data(e,a=>a.pieDatum.id).join("text").classed(vN,!0).attr("font-weight","bold").attr("text-anchor",a=>a.quadrant==1||a.quadrant==4?"start":"end").style("dominant-baseline",a=>a.quadrant==1||a.quadrant==2?"auto":"hanging").style("cursor",a=>r.highlightTarget&&r.highlightTarget!="none"?"pointer":"none").attr("font-size",r.styles.textSize).attr("fill",(a,s)=>Mn({datum:a.pieDatum.data,colorType:n.labelColorType,fullChartParams:r})).each((a,s,u)=>{t2(V(u[s]),{textArr:a.arcLabels,textSizePx:i,quadrant:a.quadrant})});return o.transition().attr("transform",a=>"translate("+a.x+","+a.y+")"),o}function SN(t,e,n){const r=t.nodes(),i=n,o=r.map((a,s)=>{const u=a.getBBox(),l=[e[s].x,e[s].y];return{node:a,x:l[0],y:l[1],width:u.width,height:u.height}});for(let a=0;a<o.length;a++){const s=o[a];for(let u=a+1;u<o.length;u++){const l=o[u];e[a].textWidth=s.width;const c=s.x+e[a].collisionShiftX,f=s.y+e[a].collisionShiftY,h=l.x+e[u].collisionShiftX,p=l.y+e[u].collisionShiftY;if(!(c+s.width/2<h-l.width/2||c-s.width/2>h+l.width/2||f+s.height/2<p-l.height/2||f-s.height/2>p+l.height/2)){if(e[u].quadrant==2){const d=p>f?-i*2:-i;e[u].collisionShiftY+=d}else if(e[u].quadrant==4){const d=p>f?i:i*2;e[u].collisionShiftY+=d}}}}for(let a=o.length-1;a>=0;a--){const s=o[a];for(let u=a-1;u>=0;u--){const l=o[u];e[a].textWidth=s.width;const c=s.x+e[a].collisionShiftX,f=s.y+e[a].collisionShiftY,h=l.x+e[u].collisionShiftX,p=l.y+e[u].collisionShiftY;if(!(c+s.width/2<h-l.width/2||c-s.width/2>h+l.width/2||f+s.height/2<p-l.height/2||f-s.height/2>p+l.height/2)){if(e[u].quadrant==1){const d=p>f?-i*2:-i;e[u].collisionShiftY+=d}else if(e[u].quadrant==3){const d=p>f?i:i*2;e[u].collisionShiftY+=d}}}}t.data(e).transition().attr("transform",a=>`translate(${a.x+a.collisionShiftX},${a.y+a.collisionShiftY})`)}function AN({lineGSelection:t,data:e,fullParams:n,fullChartParams:r}){const i=e.filter(a=>a.collisionShiftX||a.collisionShiftY),o=t.selectAll("polyline").data(i,a=>a.pieDatum.id).join("polyline").attr("stroke",a=>Mn({datum:a.pieDatum.data,colorType:n.labelColorType,fullChartParams:r})).attr("stroke-width",1).attr("fill","none").attr("points",a=>[[a.lineStartX,a.lineStartY],[a.lineStartX,a.lineStartY]]);return o.transition().attr("points",a=>{let s=a.x+a.collisionShiftX,u=a.y+a.collisionShiftY;return[[s,u],[a.lineStartX,a.lineStartY]]}),o}function TN({textSelection:t,lineSelection:e,ids:n,fullChartParams:r}){if(t.interrupt("highlight"),e.interrupt("highlight"),!n.length){t.transition("highlight").duration(200).attr("transform",i=>`translate(${i.x+i.collisionShiftX},${i.y+i.collisionShiftY})`).style("opacity",1),e.transition("highlight").duration(200).style("opacity",1);return}t.each((i,o,a)=>{const s=V(a[o]);n.includes(i.pieDatum.data.id)?s.style("opacity",1).transition("highlight").duration(200).attr("transform",u=>`translate(${u.mouseoverX+u.collisionShiftX},${u.mouseoverY+u.collisionShiftY})`):s.style("opacity",r.styles.unhighlightedOpacity).transition("highlight").duration(200).attr("transform",u=>`translate(${u.x+u.collisionShiftX},${u.y+u.collisionShiftY})`)}),e.each((i,o,a)=>{const s=V(a[o]);n.includes(i.pieDatum.data.id)?s.style("opacity",1).transition("highlight").duration(200):s.style("opacity",r.styles.unhighlightedOpacity).transition("highlight").duration(200)})}function PN(t,e){const n=new nt;e.containerSelection.selectAll("g").remove();const r=e.containerSelection.append("g");r.classed(xN,!0);const i=e.containerSelection.append("g");i.classed(bN,!0);const o=new nt,a=new nt;let s=[];const u=e.seriesContainerPosition$.pipe(I(n),B(f=>f.width<f.height?f.width:f.height),tt()),l=e.visibleComputedLayoutData$.pipe(B(f=>Math.max(...f.flat().map(h=>h.value))),tt()),c=e.fullParams$.pipe(I(n),B(f=>f.labelCentroid>=E2?E2:f.labelCentroid));return U({shorterSideWith:u,containerVisibleComputedLayoutData:e.containerVisibleComputedLayoutData$,maxValue:l,fullParams:e.fullParams$,fullChartParams:e.fullChartParams$,textSizePx:e.textSizePx$,lineStartCentroid:c}).pipe(I(n),W(async f=>f)).subscribe(f=>{const h=Math.PI*2/f.containerVisibleComputedLayoutData.length,p=f.containerVisibleComputedLayoutData.map((g,m)=>({id:g.id,data:g,index:m,value:g.value,startAngle:h*m,endAngle:h*(m+1),padAngle:0}));s=wN({pieData:p,labelCentroid:f.fullParams.labelCentroid,arcScaleType:f.fullParams.arcScaleType,maxValue:f.maxValue,axisWidth:f.shorterSideWith,outerRadius:f.fullParams.outerRadius,lineStartCentroid:f.lineStartCentroid,fullParams:f.fullParams}),r.selectAll("polyline").remove();const d=$N({labelGSelection:i,data:s,fullParams:f.fullParams,fullChartParams:f.fullChartParams,textSizePx:f.textSizePx});setTimeout(()=>{SN(d,s,f.textSizePx);const g=AN({lineGSelection:r,data:s,fullParams:f.fullParams,fullChartParams:f.fullChartParams});a.next(g)},1e3),o.next(d)}),U({textSelection:o,lineSelection:a,highlight:e.seriesHighlight$.pipe(B(f=>f.map(h=>h.id))),fullChartParams:e.fullChartParams$}).pipe(I(n),W(async f=>f)).subscribe(f=>{TN({textSelection:f.textSelection,lineSelection:f.lineSelection,ids:f.highlight,fullChartParams:f.fullChartParams})}),()=>{n.next(void 0)}}const MN=Fn(_N)(({selection:t,observer:e,subject:n})=>{const r=new nt,{seriesCenterSelection$:i}=Ho({selection:t,pluginName:vi,separateSeries$:e.separateSeries$,seriesLabels$:e.seriesLabels$,seriesContainerPosition$:e.seriesContainerPosition$}),o=[];return i.pipe(I(r)).subscribe(a=>{o.forEach(s=>s()),a.each((s,u,l)=>{const c=V(l[u]),f=e.visibleComputedLayoutData$.pipe(I(r),B(p=>JSON.parse(JSON.stringify(p[u]??p[0])))),h=e.seriesContainerPosition$.pipe(I(r),B(p=>JSON.parse(JSON.stringify(p[u]??p[0]))));o[u]=PN(vi,{containerSelection:c,visibleComputedLayoutData$:e.visibleComputedLayoutData$,containerVisibleComputedLayoutData$:f,fullParams$:e.fullParams$,fullChartParams$:e.fullChartParams$,textSizePx$:e.textSizePx$,seriesHighlight$:e.seriesHighlight$,seriesContainerPosition$:h,event$:n.event$})})}),()=>{r.next(void 0)}}),I2="SeriesLegend",DN=Fn({name:I2,defaultParams:D2,layerIndex:Bu,validator:(t,{validateColumns:e})=>e(t,{padding:{toBeTypes:["number"]},backgroundFill:{toBeOption:"ColorType"},backgroundStroke:{toBeOption:"ColorType"},gap:{toBeTypes:["number"]},listRectWidth:{toBeTypes:["number"]},listRectHeight:{toBeTypes:["number"]},listRectRadius:{toBeTypes:["number"]},textColorType:{toBeOption:"ColorType"}})})(({selection:t,rootSelection:e,observer:n,subject:r})=>{const i=new nt,o=n.SeriesDataMap$.pipe(I(i),B(u=>Array.from(u.keys()))),a=n.fullParams$.pipe(I(i),B(u=>{const l=[{listRectWidth:u.listRectWidth,listRectHeight:u.listRectHeight,listRectRadius:u.listRectRadius}];return{...u,seriesList:l}})),s=Fu(I2,{rootSelection:e,seriesLabels$:o,fullParams$:a,layout$:n.layout$,fullChartParams$:n.fullChartParams$,textSizePx$:n.textSizePx$});return()=>{i.next(void 0),s()}}),fp={paddingInner:2,paddingOuter:2,labelColorType:"primary",squarifyRatio:1.618034,sort:(t,e)=>e.value-t.value};fp.sort.toString=()=>"(a, b) => b.value - a.value";const N2={position:"right",justify:"end",padding:28,backgroundFill:"none",backgroundStroke:"none",gap:10,listRectWidth:14,listRectHeight:14,listRectRadius:0,textColorType:"primary"},B2="TreeLegend",CN=Lg({name:B2,defaultParams:N2,layerIndex:Bu,validator:(t,{validateColumns:e})=>e(t,{padding:{toBeTypes:["number"]},backgroundFill:{toBeOption:"ColorType"},backgroundStroke:{toBeOption:"ColorType"},gap:{toBeTypes:["number"]},listRectWidth:{toBeTypes:["number"]},listRectHeight:{toBeTypes:["number"]},listRectRadius:{toBeTypes:["number"]},textColorType:{toBeOption:"ColorType"}})})(({selection:t,rootSelection:e,observer:n,subject:r})=>{const i=new nt,o=n.CategoryDataMap$.pipe(I(i),B(u=>Array.from(u.keys()))),a=n.fullParams$.pipe(I(i),B(u=>{const l=[{listRectWidth:u.listRectWidth,listRectHeight:u.listRectHeight,listRectRadius:u.listRectRadius}];return{...u,seriesList:l}})),s=Fu(B2,{rootSelection:e,seriesLabels$:o,fullParams$:a,layout$:n.layout$,fullChartParams$:n.fullChartParams$,textSizePx$:n.textSizePx$});return()=>{i.next(void 0),s()}}),dr="TreeMap",F2=ot(dr,"tree"),O2=ot(dr,"tile"),LN={name:dr,defaultParams:fp,layerIndex:ke,validator:(t,{validateColumns:e})=>e(t,{paddingInner:{toBeTypes:["number"]},paddingOuter:{toBeTypes:["number"]},labelColorType:{toBeOption:"ColorType"},squarifyRatio:{toBeTypes:["number"]},sort:{toBeTypes:["Function"]}})};function kN({selection:t,treeData:e,fullParams:n,fullChartParams:r,textSizePx:i}){const o=i/2,a=i,s=t.selectAll(`g.${F2}`).data(e,u=>u.data.id).join("g").attr("class",F2);return s.attr("transform",u=>!u.x0||!u.y0?null:`translate(${u.x0},${u.y0})`).each((u,l,c)=>{const f=V(c[l]);f.selectAll(`rect.${O2}`).data([u],h=>h.data.id).join("rect").attr("id",h=>h.data.id).attr("class",O2).attr("cursor","pointer").attr("width",h=>h.x1-h.x0).attr("height",h=>h.y1-h.y0).attr("fill",h=>h.data.color).attr("data-name",h=>h.data.label).attr("data-category",h=>h.data.categoryLabel).attr("data-value",h=>h.data.value),f.selectAll("g").data([u]).join("g").each((h,p,d)=>{V(d[p]).selectAll("text").data([h]).join("text").text(m=>m.data.label).attr("dominant-baseline","hanging").attr("x",o).attr("y",o).attr("font-size",r.styles.textSize).each(function(m){const y=V(this),b=m.data.label.split(/\s+/).reverse();let v,x=[];const S=y.attr("x");let $=y.attr("y"),R=0,T=y.text(null).append("tspan").attr("cursor","pointer").attr("fill",kt(n.labelColorType,r)).attr("font-size",r.styles.textSize).attr("x",S).attr("y",$);for(;v=b.pop();)x.push(v),T.text(x.join(" ")),T.node().getComputedTextLength()>m.x1-m.x0-o&&(x.pop(),T.text(x.join(" ")),x=[v],R+=a,T=y.append("tspan").attr("cursor","pointer").attr("fill",kt(n.labelColorType,r)).attr("font-size",r.styles.textSize).attr("x",S).attr("y",$).attr("dy",R+"px").text(v))})})}),s}function RN({selection:t,ids:e,fullChartParams:n}){if(t.interrupt("highlight"),!e.length){t.transition("highlight").duration(200).style("opacity",1);return}t.each((r,i,o)=>{e.includes(r.data.id)?V(o[i]).style("opacity",1):V(o[i]).style("opacity",n.styles.unhighlightedOpacity)})}const EN=Lg(LN)(({selection:t,name:e,subject:n,observer:r})=>{const i=new nt,o=U({layout:r.layout$,visibleComputedData:r.visibleComputedData$,fullParams:r.fullParams$,fullDataFormatter:r.fullDataFormatter$,fullChartParams:r.fullChartParams$}).pipe(I(i),W(async u=>u),B(u=>{const l=Qy().size([u.layout.width,u.layout.height]).paddingInner(u.fullParams.paddingInner).paddingOuter(u.fullParams.paddingOuter).round(!0).tile(Qf.ratio(u.fullParams.squarifyRatio)),c=eu(u.visibleComputedData).sum(h=>h.value).sort(u.fullParams.sort);return l(c),c.leaves()})),a=U({selection:Qo(t),treeData:o,fullParams:r.fullParams$,fullChartParams:r.fullChartParams$,textSizePx:r.textSizePx$}).pipe(I(i),W(async u=>u),B(u=>kN({selection:t,treeData:u.treeData,fullParams:u.fullParams,fullChartParams:u.fullChartParams,textSizePx:u.textSizePx}))),s=r.fullChartParams$.pipe(I(i),B(u=>u.highlightTarget),tt());return U({cellSelection:a,computedData:r.computedData$,treeData:o,fullParams:r.fullParams$,fullChartParams:r.fullChartParams$,highlightTarget:s,CategoryDataMap:r.CategoryDataMap$}).pipe(I(i),W(async u=>u)).subscribe(u=>{u.cellSelection.on("mouseover",(l,c)=>{l.stopPropagation(),n.event$.next({type:"tree",eventName:"mouseover",pluginName:dr,highlightTarget:u.highlightTarget,datum:c.data,category:u.CategoryDataMap.get(c.data.categoryLabel),categoryIndex:c.data.categoryIndex,categoryLabel:c.data.categoryLabel,event:l,data:u.computedData})}).on("mousemove",(l,c)=>{l.stopPropagation(),n.event$.next({type:"tree",eventName:"mousemove",pluginName:dr,highlightTarget:u.highlightTarget,datum:c.data,category:u.CategoryDataMap.get(c.data.categoryLabel),categoryIndex:c.data.categoryIndex,categoryLabel:c.data.categoryLabel,event:l,data:u.computedData})}).on("mouseout",(l,c)=>{l.stopPropagation(),n.event$.next({type:"tree",eventName:"mouseout",pluginName:dr,highlightTarget:u.highlightTarget,datum:c.data,category:u.CategoryDataMap.get(c.data.categoryLabel),categoryIndex:c.data.categoryIndex,categoryLabel:c.data.categoryLabel,event:l,data:u.computedData})}).on("click",(l,c)=>{l.stopPropagation(),n.event$.next({type:"tree",eventName:"click",pluginName:dr,highlightTarget:u.highlightTarget,datum:c.data,category:u.CategoryDataMap.get(c.data.categoryLabel),categoryIndex:c.data.categoryIndex,categoryLabel:c.data.categoryLabel,event:l,data:u.computedData})})}),U({cellSelection:a,highlight:r.treeHighlight$.pipe(B(u=>u.map(l=>l.id))),fullChartParams:r.fullChartParams$}).pipe(I(i),W(async u=>u)).subscribe(u=>{RN({selection:u.cellSelection,ids:u.highlight,fullChartParams:u.fullChartParams})}),()=>{i.next(void 0)}});K.BarStack=FE,K.Bars=CE,K.BarsPN=LE,K.BarsTriangle=XE,K.Bubbles=HI,K.CONTAINER_PLUGIN_PARAMS=kI,K.DEFAULT_BARS_DIVERGING_PARAMS=G2,K.DEFAULT_BARS_PARAMS=jo,K.DEFAULT_BARS_TRIANGLE_PARAMS=gp,K.DEFAULT_BAR_STACK_PARAMS=dp,K.DEFAULT_BUBBLES_PARAMS=T2,K.DEFAULT_DOTS_PARAMS=pp,K.DEFAULT_GRID_LEGEND_PARAMS=bp,K.DEFAULT_GROUP_AREA_PARAMS=Yu,K.DEFAULT_GROUP_AXIS_PARAMS=Uu,K.DEFAULT_LINES_PARAMS=gr,K.DEFAULT_LINE_AREAS_PARAMS=hp,K.DEFAULT_MULTI_BARS_PARAMS=a2,K.DEFAULT_MULTI_BARS_TRIANGLE_PARAMS=u2,K.DEFAULT_MULTI_BAR_STACK_PARAMS=s2,K.DEFAULT_MULTI_DOTS_PARAMS=f2,K.DEFAULT_MULTI_GRID_LEGEND_PARAMS=o2,K.DEFAULT_MULTI_GROUP_AXIS_PARAMS=Yh,K.DEFAULT_MULTI_LINES_PARAMS=l2,K.DEFAULT_MULTI_LINE_AREAS_PARAMS=c2,K.DEFAULT_MULTI_VALUE_AXIS_PARAMS=Gu,K.DEFAULT_MULTI_VALUE_STACK_AXIS_PARAMS=xI,K.DEFAULT_OVERLAPPING_VALUE_AXES_PARAMS=Uh,K.DEFAULT_OVERLAPPING_VALUE_STACK_AXES_PARAMS=h2,K.DEFAULT_PIE_EVENT_TEXTS_PARAMS=rp,K.DEFAULT_PIE_LABELS_PARAMS=ip,K.DEFAULT_PIE_PARAMS=P2,K.DEFAULT_ROSE_LABELS_PARAMS=op,K.DEFAULT_ROSE_PARAMS=M2,K.DEFAULT_SCALING_AREA_PARAMS=yp,K.DEFAULT_SERIES_LEGEND_PARAMS=D2,K.DEFAULT_TREE_LEGEND_PARAMS=N2,K.DEFAULT_TREE_MAP_PARAMS=fp,K.DEFAULT_VALUE_AXIS_PARAMS=Wu,K.DEFAULT_VALUE_STACK_AXIS_PARAMS=mp,K.Dots=ZE,K.GridLegend=QE,K.GroupAux=bI,K.GroupAxis=iI,K.LineAreas=$E,K.Lines=mE,K.MultiBarStack=wI,K.MultiBars=_I,K.MultiBarsTriangle=$I,K.MultiDots=TI,K.MultiGridLegend=vI,K.MultiGroupAxis=PI,K.MultiLineAreas=AI,K.MultiLines=SI,K.MultiValueAxis=MI,K.MultiValueStackAxis=DI,K.OverlappingValueAxes=CI,K.OverlappingValueStackAxes=LI,K.Pie=KI,K.PieEventTexts=tN,K.PieLabels=fN,K.Rose=yN,K.RoseLabels=MN,K.ScalingArea=cI,K.SeriesLegend=DN,K.TOOLTIP_PARAMS=ep,K.Tooltip=BI,K.TreeLegend=CN,K.TreeMap=EN,K.ValueAxis=uI,K.ValueStackAxis=lI,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"})});
@@ -19,6 +19,6 @@ export type TooltipParams = {
19
19
  textColorType: ColorType;
20
20
  offset: [number, number];
21
21
  padding: number;
22
- textRenderFn: <T extends ChartType>(eventData: EventTypeMap<T>) => string[] | string | null;
22
+ textRenderFn: (<T extends ChartType>(eventData: EventTypeMap<T>) => string[] | string) | null;
23
23
  svgRenderFn: (<T extends ChartType>(eventData: EventTypeMap<T>) => string) | null;
24
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbcharts/plugins-basic",
3
- "version": "3.0.0-alpha.72",
3
+ "version": "3.0.0-alpha.73",
4
4
  "description": "plugins for OrbCharts",
5
5
  "author": "Blue Planet Inc.",
6
6
  "license": "Apache-2.0",
@@ -35,6 +35,48 @@ const pluginName = 'Tooltip'
35
35
  const gClassName = getClassName(pluginName, 'g')
36
36
  const boxClassName = getClassName(pluginName, 'box')
37
37
 
38
+ const pluginConfig: DefinePluginConfig<typeof pluginName, typeof TOOLTIP_PARAMS> = {
39
+ name: pluginName,
40
+ defaultParams: TOOLTIP_PARAMS,
41
+ layerIndex: LAYER_INDEX_OF_TOOLTIP,
42
+ validator: (params, { validateColumns }) => {
43
+ const result = validateColumns(params, {
44
+ backgroundColorType: {
45
+ toBeOption: 'ColorType',
46
+ },
47
+ backgroundOpacity: {
48
+ toBeTypes: ['number']
49
+ },
50
+ strokeColorType: {
51
+ toBeOption: 'ColorType',
52
+ },
53
+ offset: {
54
+ toBe: '[number, number]',
55
+ test: (value: any) => {
56
+ return Array.isArray(value)
57
+ && value.length === 2
58
+ && typeof value[0] === 'number'
59
+ && typeof value[1] === 'number'
60
+ }
61
+ },
62
+ padding: {
63
+ toBeTypes: ['number']
64
+ },
65
+ textColorType: {
66
+ toBeOption: 'ColorType',
67
+ },
68
+ textRenderFn: {
69
+ toBeTypes: ['Function', 'null']
70
+ },
71
+ svgRenderFn: {
72
+ toBeTypes: ['Function', 'null']
73
+ }
74
+ })
75
+ return result
76
+ }
77
+ }
78
+
79
+
38
80
  function textToSvg (_textArr: string[] | string | null | undefined, textStyle: TooltipStyle) {
39
81
  const lineHeight = textStyle.textSizePx * 1.5
40
82
 
@@ -206,46 +248,6 @@ function renderTooltip ({ rootSelection, pluginName, rootWidth, rootHeight, svgS
206
248
 
207
249
  }
208
250
 
209
- const pluginConfig: DefinePluginConfig<typeof pluginName, typeof TOOLTIP_PARAMS> = {
210
- name: pluginName,
211
- defaultParams: TOOLTIP_PARAMS,
212
- layerIndex: LAYER_INDEX_OF_TOOLTIP,
213
- validator: (params, { validateColumns }) => {
214
- const result = validateColumns(params, {
215
- backgroundColorType: {
216
- toBeOption: 'ColorType',
217
- },
218
- backgroundOpacity: {
219
- toBeTypes: ['number']
220
- },
221
- strokeColorType: {
222
- toBeOption: 'ColorType',
223
- },
224
- offset: {
225
- toBe: '[number, number]',
226
- test: (value: any) => {
227
- return Array.isArray(value)
228
- && value.length === 2
229
- && typeof value[0] === 'number'
230
- && typeof value[1] === 'number'
231
- }
232
- },
233
- padding: {
234
- toBeTypes: ['number']
235
- },
236
- textColorType: {
237
- toBeOption: 'ColorType',
238
- },
239
- textRenderFn: {
240
- toBeTypes: ['Function']
241
- },
242
- svgRenderFn: {
243
- toBeTypes: ['Function']
244
- }
245
- })
246
- return result
247
- }
248
- }
249
251
 
250
252
  export const Tooltip = defineNoneDataPlugin(pluginConfig)(({ selection, rootSelection, name, chartType, observer, subject }) => {
251
253
  const destroy$ = new Subject()
@@ -299,7 +301,9 @@ export const Tooltip = defineNoneDataPlugin(pluginConfig)(({ selection, rootSele
299
301
  }
300
302
  // 將textRenderFn回傳的資料使用<text>包裝起來
301
303
  return (eventData: EventTypeMap<any>) => {
302
- const textArr = data.fullParams.textRenderFn(eventData as any)
304
+ const textArr: string | string[] | null = data.fullParams.textRenderFn
305
+ ? data.fullParams.textRenderFn(eventData as any)
306
+ : null
303
307
  return textToSvg(textArr, data.tooltipStyle)
304
308
  }
305
309
  })
@@ -20,7 +20,7 @@ export type TooltipParams = {
20
20
  textColorType: ColorType
21
21
  offset: [number, number]
22
22
  padding: number
23
- textRenderFn: <T extends ChartType> (eventData: EventTypeMap<T>) => string[] | string | null
24
- svgRenderFn: (<T extends ChartType> (eventData: EventTypeMap<T>) => string) | null
23
+ textRenderFn: (<T extends ChartType>(eventData: EventTypeMap<T>) => string[] | string) | null
24
+ svgRenderFn: (<T extends ChartType>(eventData: EventTypeMap<T>) => string) | null
25
25
  }
26
26