@mesh.ai/rabbit 0.0.24 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16786,7 +16786,7 @@ const Dy = (e, t, n) => {
16786
16786
  textStyles: {
16787
16787
  fontFamily: "system-ui",
16788
16788
  fontSize: "10px",
16789
- fontWeight: 400,
16789
+ fontWeight: 600,
16790
16790
  fill: "#666666",
16791
16791
  textAnchor: "middle"
16792
16792
  },
@@ -16818,7 +16818,7 @@ const Dy = (e, t, n) => {
16818
16818
  tickLabelProps: {
16819
16819
  fontFamily: "system-ui",
16820
16820
  fontSize: "10px",
16821
- fontWeight: 400,
16821
+ fontWeight: 600,
16822
16822
  fill: "#666666"
16823
16823
  },
16824
16824
  labelProps: {
@@ -16929,7 +16929,7 @@ const Dy = (e, t, n) => {
16929
16929
  })
16930
16930
  ] })
16931
16931
  ] }),
16932
- d === "mini" && /* @__PURE__ */ ae("div", { className: "flex flex-row flex-wrap justify-center gap-4 text-[10px] text-[#666666]", children: S.map((M) => {
16932
+ d === "mini" && /* @__PURE__ */ ae("div", { className: "flex flex-row flex-wrap justify-center gap-4 text-[10px] text-[#666666] font-semibold", children: S.map((M) => {
16933
16933
  const T = e.find((C) => C.id === M.points[0].nodeId);
16934
16934
  return /* @__PURE__ */ He("div", { className: "flex justify-center items-center gap-1", children: [
16935
16935
  /* @__PURE__ */ ae(
@@ -43,4 +43,4 @@ z`).split(`
43
43
  `)} {
44
44
  ${$n}
45
45
  }
46
- `}),I.appendChild(E.createTextNode(tt))}W.timeEnd("clone node"),oe==null||oe(be),te!==!1&&ae(be)&&(W.time("embed web font"),yield xN(be,M),W.timeEnd("embed web font")),W.time("embed node"),by(be,M);const _e=Y.length;let Oe=0;const Ae=()=>g(this,null,function*(){for(;;){const tt=Y.pop();if(!tt)break;try{yield tt}catch(sn){De("Failed to run task",sn)}re==null||re(++Oe,_e)}});re==null||re(Oe,_e),yield Promise.all([...Array(4)].map(Ae)),W.timeEnd("embed node"),ge==null||ge(be);const Se=CN(be,M);return B&&Se.insertBefore(B,Se.children[0]),I&&Se.insertBefore(I,Se.children[0]),se&&py(M),me==null||me(Se),Se})}function CN(v,_){const{width:M,height:E}=_,W=Ut(M,E,v.ownerDocument),Y=W.ownerDocument.createElementNS(W.namespaceURI,"foreignObject");return Y.setAttributeNS(null,"x","0%"),Y.setAttributeNS(null,"y","0%"),Y.setAttributeNS(null,"width","100%"),Y.setAttributeNS(null,"height","100%"),Y.append(v),W.appendChild(Y),W}function Va(v,_){return g(this,null,function*(){var M;const E=yield st(v,_),W=yield wy(E),Y=Hr(W,E.isEnable("removeControlCharacter"));E.autoDestruct||(E.svgStyleElement=et(E.ownerDocument),E.svgDefsElement=(M=E.ownerDocument)==null?void 0:M.createElementNS(it,"defs"),E.svgStyles.clear());const I=Yt(Y,W.ownerDocument);return yield un(I,E)})}function kN(v,_){return g(this,null,function*(){const M=yield st(v,_),{log:E,type:W,quality:Y,dpi:I}=M,B=yield Va(M);E.time("canvas to blob");const J=yield ja(B,W,Y);if(["image/png","image/jpeg"].includes(W)&&I){const te=yield za(J.slice(0,33));let re=new Uint8Array(te);return W==="image/png"?re=k(re,I):W==="image/jpeg"&&(re=x(re,I)),new Blob([re,J.slice(33)],{type:W})}return E.timeEnd("canvas to blob"),J})}function Gr(v,_){return g(this,null,function*(){const M=yield st(v,_),{log:E,quality:W,type:Y,dpi:I}=M,B=yield Va(M);E.time("canvas to data url");let J=B.toDataURL(Y,W);if(["image/png","image/jpeg"].includes(Y)&&I&&z&&q){const[te,re]=J.split(",");let se=0,oe=!1;if(Y==="image/png"){const Se=G(re);Se>=0?(se=Math.ceil((Se+28)/3)*4,oe=!0):se=33/3*4}else Y==="image/jpeg"&&(se=18/3*4);const ge=re.substring(0,se),me=re.substring(se),be=window.atob(ge),_e=new Uint8Array(be.length);for(let Se=0;Se<_e.length;Se++)_e[Se]=be.charCodeAt(Se);const Oe=Y==="image/png"?k(_e,I,oe):x(_e,I),Ae=window.btoa(String.fromCharCode(...Oe));J=[te,",",Ae,me].join("")}return E.timeEnd("canvas to data url"),J})}function xy(v,_){return g(this,null,function*(){const M=yield st(v,_),{width:E,height:W,ownerDocument:Y}=M,I=yield Gr(M),B=Ut(E,W,Y),J=B.ownerDocument.createElementNS(B.namespaceURI,"image");return J.setAttributeNS(null,"href",I),J.setAttributeNS(null,"height","100%"),J.setAttributeNS(null,"width","100%"),B.appendChild(J),Hr(B,M.isEnable("removeControlCharacter"))})}function EN(v,_){return g(this,null,function*(){const M=yield st(v,_),{ownerDocument:E,width:W,height:Y,scale:I,type:B}=M,J=B==="image/svg+xml"?yield xy(M):yield Gr(M),te=Yt(J,E);return te.width=Math.floor(W*I),te.height=Math.floor(Y*I),te.style.width=`${W}px`,te.style.height=`${Y}px`,te})}function DN(v,_){return g(this,null,function*(){return Gr(yield st(v,p(d({},_),{type:"image/jpeg"})))})}function AN(v,_){return g(this,null,function*(){const M=yield st(v,_),E=yield Va(M);return E.getContext("2d").getImageData(0,0,E.width,E.height).data})}function NN(v,_){return g(this,null,function*(){return Gr(yield st(v,p(d({},_),{type:"image/png"})))})}function LN(v,_){return g(this,null,function*(){return Gr(yield st(v,p(d({},_),{type:"image/webp"})))})}n.createContext=Ba,n.destroyContext=py,n.domToBlob=kN,n.domToCanvas=Va,n.domToDataUrl=Gr,n.domToForeignObjectSvg=wy,n.domToImage=EN,n.domToJpeg=DN,n.domToPixel=AN,n.domToPng=NN,n.domToSvg=xy,n.domToWebp=LN,n.loadMedia=an,n.waitUntilLoad=Go,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})})})(Nc,Nc.exports);var GA=Nc.exports;const Zg=(e,t,n)=>{m.useImperativeHandle(t,()=>({download(){e.current&&GA.domToPng(e.current,{scale:5}).then(r=>{const o=document.createElement("a");o.download=`${n}.png`,o.href=r,o.click()})}}))},VA=({x:e,y:t,datum:n,size:r})=>K.jsx(fc,{cx:e,cy:t,stroke:n.color.dark,strokeWidth:1,fill:n.color.light,r:r/2}),XA=({x:e,y:t,datum:n})=>K.jsx(fc,{cx:e,cy:t,stroke:n.color.dark,strokeWidth:1,fill:n.color.dark,r:5,style:{zIndex:1500}}),Na={xAccessor:e=>e.x,yAccessor:e=>e.y},Qg=(e,t,n)=>n==="pre"?`${t}${e}`:`${e}${t}`,Jg=10,KA=5,Lc=m.forwardRef(({nodes:e,height:t,width:n,xAxisValues:r,series:o,xAxisLabel:i,yAxisLabel:a,xAxisDomain:u,yAxisDomain:l,xAxisUnitSymbol:s,yAxisUnitSymbol:c,tooltipTitle:f,mode:d,xAxisCharLimit:p,connectNulls:h=!1,tooltipStackCharLimit:g=Jg},x)=>{const[b,w]=m.useState(e.map(S=>S.id)),$=m.useRef(null);Zg($,x,`${i}-${a}-LineChart`);const T=m.useMemo(()=>o.map((S,C)=>({points:S.data.map((k,j)=>({x:r[j],y:k,nodeId:S.id,color:Lt(C)}))})).slice(0,d==="mini"?KA:o.length),[r,o,d]),y=m.useMemo(()=>d==="full"?T.filter(S=>b.includes(S.points[0].nodeId)):T,[T,b,d]),P=m.useMemo(()=>Math.floor((n-(d==="mini"?0:150))/(r.length*8)),[n,r,d]);return K.jsxs("div",{ref:$,id:"line-chart",className:"bg-white flex flex-col",style:{width:n,height:t},children:[K.jsxs("div",{className:"w-full min-w-0 min-h-0 h-full flex flex-row",children:[K.jsx("div",{className:"w-full min-w-0 min-h-0 h-full",children:K.jsxs(jr,{margin:{top:10,left:50,right:50,bottom:50},xScale:{type:"band",nice:!0,...u&&{domain:u}},yScale:{type:"linear",nice:!0,...l&&{domain:l}},children:[K.jsx(qC,{columns:!1,numTicks:6,lineStyle:{stroke:"#EBEFF3",strokeWidth:1}}),K.jsx(mm,{hideTicks:!0,orientation:"bottom",stroke:"#CFD7DF",strokeWidth:1,numTicks:6,tickFormat:S=>s?Qg(S,s.symbol,s.position):S,rangePadding:{end:10},tickComponent:S=>K.jsx(Ec,{textLabel:S.formattedValue||"",x:S.x,y:S.y,textStyles:{fontFamily:"system-ui",fontSize:"10px",fontWeight:400,fill:"#666666",textAnchor:"middle"},axisCharLimit:p??P}),label:`${i} ➔`,labelProps:{fontFamily:"system-ui",fontSize:"10px",fontWeight:600,dy:10,fill:"#666666",textAnchor:"middle",verticalAnchor:"middle"}}),K.jsx(mm,{hideTicks:!0,numTicks:6,strokeWidth:1,orientation:"left",stroke:"#CFD7DF",label:`${a} ➔`,tickFormat:S=>c?Qg(S,c.symbol,c.position):S,tickLabelProps:{fontFamily:"system-ui",fontSize:"10px",fontWeight:400,fill:"#666666"},labelProps:{fontFamily:"system-ui",fontSize:"10px",fontWeight:500,dx:-20,fill:"#666666",textAnchor:"middle",verticalAnchor:"middle"}}),y.map((S,C)=>K.jsxs(K.Fragment,{children:[K.jsx(YA,{data:S.points,xAccessor:Na.xAccessor,yAccessor:Na.yAccessor,connectNulls:h}),K.jsx(c2,{dataKey:`Performance Management ${C}`,data:S.points,size:8,renderGlyph:VA,xAccessor:Na.xAccessor,yAccessor:Na.yAccessor})]})),K.jsx(Tm,{showDatumGlyph:!0,scroll:!0,debounce:500,snapTooltipToDatumX:!0,snapTooltipToDatumY:!0,detectBounds:!0,unstyled:!0,applyPositionStyle:!0,renderGlyph:XA,renderTooltip:({tooltipData:S})=>{var j,L,H,G,V,O;const C=e.find(N=>{var z;return N.id===((z=S==null?void 0:S.nearestDatum)==null?void 0:z.datum.nodeId)}),k=((j=S==null?void 0:S.nearestDatum)==null?void 0:j.datum)&&((L=S==null?void 0:S.nearestDatum)==null?void 0:L.datum.x.length)<g;return K.jsx(Kg,{xValue:(H=S==null?void 0:S.nearestDatum)==null?void 0:H.datum.x,yValue:(G=S==null?void 0:S.nearestDatum)==null?void 0:G.datum.y,xAxisLabel:i,yAxisLabel:a,showSideBySide:!!k,tooltipTitle:f,legendValue:(C==null?void 0:C.name)||"",legendDarkColor:((V=S==null?void 0:S.nearestDatum)==null?void 0:V.datum.color.dark)||Lt(0).dark,legendLightColor:((O=S==null?void 0:S.nearestDatum)==null?void 0:O.datum.color.light)||Lt(0).light})}})]})}),d==="full"&&K.jsxs("div",{className:"w-64 p-4 bg-zinc-100 rounded-lg flex-col justify-start items-start gap-0.5 inline-flex text-xs grow-0 shrink-0 basis-auto",children:[K.jsxs("div",{className:"text-sm font-semibold pb-2",children:[K.jsx("span",{className:"pr-1",children:i}),"(",T.length,")"]}),T.map(S=>{const C=e.find(k=>k.id===S.points[0].nodeId);return C&&K.jsxs("div",{className:"flex justify-between items-center gap-1 py-1 w-full",children:[K.jsxs("div",{className:"flex justify-between items-center",children:[K.jsx("div",{style:{backgroundColor:S.points[0].color.light,borderColor:S.points[0].color.dark},className:"h-3 w-3 rounded-full border mr-1"}),C.name]}),K.jsx("div",{className:"flex items-center",children:K.jsx(dD,{checked:b.includes(C.id),onCheckedChange:k=>{let j=[...b];k?j=[...b,C.id]:j.splice(b.indexOf(C.id),1),w(j)}})})]},C.id)})]})]}),d==="mini"&&K.jsx("div",{className:"flex flex-row flex-wrap justify-center gap-4 text-[10px] text-[#666666]",children:T.map(S=>{const C=e.find(k=>k.id===S.points[0].nodeId);return K.jsxs("div",{className:"flex justify-center items-center gap-1",children:[K.jsx("div",{style:{backgroundColor:S.points[0].color.light,borderColor:S.points[0].color.dark},className:"h-3 w-3 rounded-full border"}),C==null?void 0:C.name]},C==null?void 0:C.id)})})]})}),ZA={xAxisUnitSymbol:void 0,yAxisUnitSymbol:void 0,mode:"mini",xAxisCharLimit:void 0,tooltipStackCharLimit:Jg,xAxisDomain:void 0,yAxisDomain:void 0,connectNulls:!1};Lc.defaultProps=ZA,Lc.displayName="LineBase";const ey=m.forwardRef((e,t)=>K.jsx(dc,{debounceTime:10,children:({width:n,height:r})=>K.jsx(Lc,{ref:t,width:n,height:r,...e})}));ey.displayName="LineChart";const QA=ey;function ty(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of e)(o=t(o,++r,e))!=null&&(n<o||n===void 0&&o>=o)&&(n=o)}return n}function JA(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of e)(o=t(o,++r,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function Ic(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let o of e)(o=+t(o,++r,e))&&(n+=o)}return n}function eN(e,t){return e.sourceLinks.length?e.depth:t-1}function La(e){return function(){return e}}function ny(e,t){return Ia(e.source,t.source)||e.index-t.index}function ry(e,t){return Ia(e.target,t.target)||e.index-t.index}function Ia(e,t){return e.y0-t.y0}function jc(e){return e.value}function tN(e){return e.index}function nN(e){return e.nodes}function rN(e){return e.links}function oy(e,t){const n=e.get(t);if(!n)throw new Error("missing: "+t);return n}function iy({nodes:e}){for(const t of e){let n=t.y0,r=n;for(const o of t.sourceLinks)o.y0=n+o.width/2,n+=o.width;for(const o of t.targetLinks)o.y1=r+o.width/2,r+=o.width}}function oN(){let e=0,t=0,n=1,r=1,o=24,i=8,a,u=tN,l=eN,s,c,f=nN,d=rN,p=6;function h(){const O={nodes:f.apply(null,arguments),links:d.apply(null,arguments)};return g(O),x(O),b(O),w(O),y(O),iy(O),O}h.update=function(O){return iy(O),O},h.nodeId=function(O){return arguments.length?(u=typeof O=="function"?O:La(O),h):u},h.nodeAlign=function(O){return arguments.length?(l=typeof O=="function"?O:La(O),h):l},h.nodeSort=function(O){return arguments.length?(s=O,h):s},h.nodeWidth=function(O){return arguments.length?(o=+O,h):o},h.nodePadding=function(O){return arguments.length?(i=a=+O,h):i},h.nodes=function(O){return arguments.length?(f=typeof O=="function"?O:La(O),h):f},h.links=function(O){return arguments.length?(d=typeof O=="function"?O:La(O),h):d},h.linkSort=function(O){return arguments.length?(c=O,h):c},h.size=function(O){return arguments.length?(e=t=0,n=+O[0],r=+O[1],h):[n-e,r-t]},h.extent=function(O){return arguments.length?(e=+O[0][0],n=+O[1][0],t=+O[0][1],r=+O[1][1],h):[[e,t],[n,r]]},h.iterations=function(O){return arguments.length?(p=+O,h):p};function g({nodes:O,links:N}){for(const[q,R]of O.entries())R.index=q,R.sourceLinks=[],R.targetLinks=[];const z=new Map(O.map((q,R)=>[u(q,R,O),q]));for(const[q,R]of N.entries()){R.index=q;let{source:A,target:F}=R;typeof A!="object"&&(A=R.source=oy(z,A)),typeof F!="object"&&(F=R.target=oy(z,F)),A.sourceLinks.push(R),F.targetLinks.push(R)}if(c!=null)for(const{sourceLinks:q,targetLinks:R}of O)q.sort(c),R.sort(c)}function x({nodes:O}){for(const N of O)N.value=N.fixedValue===void 0?Math.max(Ic(N.sourceLinks,jc),Ic(N.targetLinks,jc)):N.fixedValue}function b({nodes:O}){const N=O.length;let z=new Set(O),q=new Set,R=0;for(;z.size;){for(const A of z){A.depth=R;for(const{target:F}of A.sourceLinks)q.add(F)}if(++R>N)throw new Error("circular link");z=q,q=new Set}}function w({nodes:O}){const N=O.length;let z=new Set(O),q=new Set,R=0;for(;z.size;){for(const A of z){A.height=R;for(const{source:F}of A.targetLinks)q.add(F)}if(++R>N)throw new Error("circular link");z=q,q=new Set}}function $({nodes:O}){const N=ty(O,R=>R.depth)+1,z=(n-e-o)/(N-1),q=new Array(N);for(const R of O){const A=Math.max(0,Math.min(N-1,Math.floor(l.call(null,R,N))));R.layer=A,R.x0=e+A*z,R.x1=R.x0+o,q[A]?q[A].push(R):q[A]=[R]}if(s)for(const R of q)R.sort(s);return q}function T(O){const N=JA(O,z=>(r-t-(z.length-1)*a)/Ic(z,jc));for(const z of O){let q=t;for(const R of z){R.y0=q,R.y1=q+R.value*N,q=R.y1+a;for(const A of R.sourceLinks)A.width=A.value*N}q=(r-q+a)/(z.length+1);for(let R=0;R<z.length;++R){const A=z[R];A.y0+=q*(R+1),A.y1+=q*(R+1)}H(z)}}function y(O){const N=$(O);a=Math.min(i,(r-t)/(ty(N,z=>z.length)-1)),T(N);for(let z=0;z<p;++z){const q=Math.pow(.99,z),R=Math.max(1-q,(z+1)/p);S(N,q,R),P(N,q,R)}}function P(O,N,z){for(let q=1,R=O.length;q<R;++q){const A=O[q];for(const F of A){let ne=0,X=0;for(const{source:ee,value:ae}of F.targetLinks){let le=ae*(F.layer-ee.layer);ne+=G(ee,F)*le,X+=le}if(!(X>0))continue;let ie=(ne/X-F.y0)*N;F.y0+=ie,F.y1+=ie,L(F)}s===void 0&&A.sort(Ia),C(A,z)}}function S(O,N,z){for(let q=O.length,R=q-2;R>=0;--R){const A=O[R];for(const F of A){let ne=0,X=0;for(const{target:ee,value:ae}of F.sourceLinks){let le=ae*(ee.layer-F.layer);ne+=V(F,ee)*le,X+=le}if(!(X>0))continue;let ie=(ne/X-F.y0)*N;F.y0+=ie,F.y1+=ie,L(F)}s===void 0&&A.sort(Ia),C(A,z)}}function C(O,N){const z=O.length>>1,q=O[z];j(O,q.y0-a,z-1,N),k(O,q.y1+a,z+1,N),j(O,r,O.length-1,N),k(O,t,0,N)}function k(O,N,z,q){for(;z<O.length;++z){const R=O[z],A=(N-R.y0)*q;A>1e-6&&(R.y0+=A,R.y1+=A),N=R.y1+a}}function j(O,N,z,q){for(;z>=0;--z){const R=O[z],A=(R.y1-N)*q;A>1e-6&&(R.y0-=A,R.y1-=A),N=R.y0-a}}function L({sourceLinks:O,targetLinks:N}){if(c===void 0){for(const{source:{sourceLinks:z}}of N)z.sort(ry);for(const{target:{targetLinks:z}}of O)z.sort(ny)}}function H(O){if(c===void 0)for(const{sourceLinks:N,targetLinks:z}of O)N.sort(ry),z.sort(ny)}function G(O,N){let z=O.y0-(O.sourceLinks.length-1)*a/2;for(const{target:q,width:R}of O.sourceLinks){if(q===N)break;z+=R+a}for(const{source:q,width:R}of N.targetLinks){if(q===O)break;z-=R}return z}function V(O,N){let z=N.y0-(N.targetLinks.length-1)*a/2;for(const{source:q,width:R}of N.targetLinks){if(q===O)break;z+=R+a}for(const{target:q,width:R}of O.sourceLinks){if(q===N)break;z-=R}return z}return h}function iN({tooltipData:e,fromLabel:t,toLabel:n,weightLabel:r,tooltipTitle:o}){var u,l,s,c;const i=e.source,a=e.target;return K.jsxs(lt,{tooltipTitle:o,children:[K.jsx(lt.Item,{label:t,value:i.name}),K.jsx(lt.Item,{label:n,value:a.name}),K.jsx(lt.Item,{label:r,value:e.weight.toString()}),K.jsx(lt.Legend,{value:i.name,darkColor:(u=Lt(i.index||0))==null?void 0:u.dark,lightColor:(l=Lt(i.index||0))==null?void 0:l.light}),K.jsx(lt.Legend,{value:a.name,darkColor:(s=Lt(a.index||0))==null?void 0:s.dark,lightColor:(c=Lt(a.index||0))==null?void 0:c.light})]})}const ay=80,uy=20,aN=30,uN=12,ly=m.forwardRef(({height:e,width:t,tooltipTitle:n,nodes:r,links:o,groups:i,weightLabel:a},u)=>{const l=m.useMemo(()=>oN().nodeId(O=>O.id).nodeWidth(uN).nodePadding(aN).nodeAlign(O=>O.group),[]),s=m.useRef(null);Zg(s,u,`${n}-SankeyChart`);const[c,f]=m.useState(""),[d,p]=m.useState(null),{tooltipData:h,tooltipLeft:g,tooltipTop:x,tooltipOpen:b,showTooltip:w,hideTooltip:$}=gm(),{containerBounds:T,containerRef:y,TooltipInPortal:P}=$m({detectBounds:!0,debounce:500,scroll:!0,zIndex:1500}),S=m.useMemo(()=>l.extent([[ay,uy],[t-ay,e-uy-50]])({nodes:r,links:o.map(O=>({...O,value:Number(O.weight)}))}),[e,t,l,r,o]),C=m.useMemo(()=>Math.max(...S.nodes.map(O=>O.depth??0)),[S]),k=m.useMemo(()=>{const O={};let N=-1/0;return S.nodes.forEach(z=>{const{group:q}=z;O[q]?(O[q].x=Math.max(O[q].x??-1/0,z.x0??-1/0),O[q].y=Math.max(O[q].y??-1/0,z.y1??-1/0)):(O[q]={},O[q].x=z.x0,O[q].y=z.y1),N=Math.max(N,O[q].y??-1/0),O[q].y=N}),O},[S]),j=m.useCallback(O=>{const N=l.nodeId()(O);f(c===N?"":N)},[c,l]),L=m.useCallback(()=>{f(""),p(null)},[]),H=m.useMemo(()=>c===""&&d===null?new Set:new Set(S.links.filter(O=>l.nodeId()(O.source)===c||l.nodeId()(O.target)===c||(d==null?void 0:d.source)===O.source&&(d==null?void 0:d.target)===O.target)),[c,S,d,l]),G=m.useCallback((O,N)=>{const z=("clientX"in O?O.clientX:0)-T.left,q=("clientY"in O?O.clientY:0)-T.top;p(N),z&&q&&w({tooltipLeft:z,tooltipTop:q,tooltipData:N})},[w,T]),V=m.useCallback(()=>{L(),$()},[L,$]);return K.jsxs("div",{ref:s,className:"bg-white w-min h-min",children:[K.jsxs("svg",{height:e,width:t,ref:y,children:[K.jsx("g",{children:S.links.map(O=>K.jsx(iC,{data:O,source:N=>({x:N.source.x1,y:N.y0}),target:N=>({x:N.target.x0,y:N.y1}),x:N=>N.x??0,y:N=>N.y??0,fill:"none",pointerEvents:"stroke",onMouseLeave:()=>V(),onMouseMove:N=>G(N,O),stroke:Lt(O.source.index||0).light,strokeWidth:O.width,strokeOpacity:H.has(O)?.7:.25},O.index))}),K.jsx("g",{children:S.nodes.map(O=>{var N,z,q;return K.jsx("g",{children:K.jsx(ZT,{x:O.x0??0,height:(O.y1??0)-(O.y0??0)+10,width:(O.x1??0)-(O.x0??0),y:(O.y0??0)-5,onMouseEnter:()=>j(O),onMouseLeave:()=>L(),radius:2,fill:c===O.id?(N=Lt(O.index||0))==null?void 0:N.dark:(z=Lt(O.index||0))==null?void 0:z.light,stroke:(q=Lt(O.index||0))==null?void 0:q.dark,all:!0})},O.index)})}),K.jsx("g",{children:i.map(O=>K.jsx(Ec,{axisCharLimit:20,x:k[O.id].x??0,y:(k[O.id].y??0)+40,textLabel:O.name,textStyles:{fontSize:10,fontWeight:600,textAnchor:"middle",fill:"#666666"}},O.id))}),K.jsxs("g",{children:[S.nodes.map(O=>K.jsx(Ec,{axisCharLimit:8,x:O.depth===C?(O.x1??0)+10:(O.x0??0)-10,y:(O.y0??0)+((O.y1??0)-(O.y0??0))/2,textLabel:O.name,textStyles:{fontSize:10,fontWeight:600,textAnchor:O.depth===C?"start":"end",fill:"#666666"}},O.index)),S.nodes.map(O=>O.value&&K.jsx(pu,{x:O.depth===C?(O.x1??0)+10:(O.x0??0)-10,y:(O.y0??0)+((O.y1??0)-(O.y0??0))/2+16,style:{fontSize:10,fontWeight:400,textAnchor:O.depth===C?"start":"end",fill:"#666666"},children:`(${O.value.toString()})`},O.index))]})]}),b&&h&&K.jsx(P,{top:x,left:g,unstyled:!0,applyPositionStyle:!0,children:K.jsx(iN,{tooltipData:h,fromLabel:`From: ${i[h.source.group].name}`,toLabel:`To: ${i[h.target.group].name}`,weightLabel:a,tooltipTitle:n})},Math.random())]})});ly.displayName="Sankey";const sy=m.forwardRef((e,t)=>K.jsx(dc,{debounceTime:10,children:({width:n,height:r})=>n&&r&&K.jsx(ly,{ref:t,width:n,height:r,...e})}));sy.displayName="SankeyChart";const lN=sy;ft.LineChart=QA,ft.SankeyChart=lN,Object.defineProperty(ft,Symbol.toStringTag,{value:"Module"})});
46
+ `}),I.appendChild(E.createTextNode(tt))}W.timeEnd("clone node"),oe==null||oe(be),te!==!1&&ae(be)&&(W.time("embed web font"),yield xN(be,M),W.timeEnd("embed web font")),W.time("embed node"),by(be,M);const _e=Y.length;let Oe=0;const Ae=()=>g(this,null,function*(){for(;;){const tt=Y.pop();if(!tt)break;try{yield tt}catch(sn){De("Failed to run task",sn)}re==null||re(++Oe,_e)}});re==null||re(Oe,_e),yield Promise.all([...Array(4)].map(Ae)),W.timeEnd("embed node"),ge==null||ge(be);const Se=CN(be,M);return B&&Se.insertBefore(B,Se.children[0]),I&&Se.insertBefore(I,Se.children[0]),se&&py(M),me==null||me(Se),Se})}function CN(v,_){const{width:M,height:E}=_,W=Ut(M,E,v.ownerDocument),Y=W.ownerDocument.createElementNS(W.namespaceURI,"foreignObject");return Y.setAttributeNS(null,"x","0%"),Y.setAttributeNS(null,"y","0%"),Y.setAttributeNS(null,"width","100%"),Y.setAttributeNS(null,"height","100%"),Y.append(v),W.appendChild(Y),W}function Va(v,_){return g(this,null,function*(){var M;const E=yield st(v,_),W=yield wy(E),Y=Hr(W,E.isEnable("removeControlCharacter"));E.autoDestruct||(E.svgStyleElement=et(E.ownerDocument),E.svgDefsElement=(M=E.ownerDocument)==null?void 0:M.createElementNS(it,"defs"),E.svgStyles.clear());const I=Yt(Y,W.ownerDocument);return yield un(I,E)})}function kN(v,_){return g(this,null,function*(){const M=yield st(v,_),{log:E,type:W,quality:Y,dpi:I}=M,B=yield Va(M);E.time("canvas to blob");const J=yield ja(B,W,Y);if(["image/png","image/jpeg"].includes(W)&&I){const te=yield za(J.slice(0,33));let re=new Uint8Array(te);return W==="image/png"?re=k(re,I):W==="image/jpeg"&&(re=x(re,I)),new Blob([re,J.slice(33)],{type:W})}return E.timeEnd("canvas to blob"),J})}function Gr(v,_){return g(this,null,function*(){const M=yield st(v,_),{log:E,quality:W,type:Y,dpi:I}=M,B=yield Va(M);E.time("canvas to data url");let J=B.toDataURL(Y,W);if(["image/png","image/jpeg"].includes(Y)&&I&&z&&q){const[te,re]=J.split(",");let se=0,oe=!1;if(Y==="image/png"){const Se=G(re);Se>=0?(se=Math.ceil((Se+28)/3)*4,oe=!0):se=33/3*4}else Y==="image/jpeg"&&(se=18/3*4);const ge=re.substring(0,se),me=re.substring(se),be=window.atob(ge),_e=new Uint8Array(be.length);for(let Se=0;Se<_e.length;Se++)_e[Se]=be.charCodeAt(Se);const Oe=Y==="image/png"?k(_e,I,oe):x(_e,I),Ae=window.btoa(String.fromCharCode(...Oe));J=[te,",",Ae,me].join("")}return E.timeEnd("canvas to data url"),J})}function xy(v,_){return g(this,null,function*(){const M=yield st(v,_),{width:E,height:W,ownerDocument:Y}=M,I=yield Gr(M),B=Ut(E,W,Y),J=B.ownerDocument.createElementNS(B.namespaceURI,"image");return J.setAttributeNS(null,"href",I),J.setAttributeNS(null,"height","100%"),J.setAttributeNS(null,"width","100%"),B.appendChild(J),Hr(B,M.isEnable("removeControlCharacter"))})}function EN(v,_){return g(this,null,function*(){const M=yield st(v,_),{ownerDocument:E,width:W,height:Y,scale:I,type:B}=M,J=B==="image/svg+xml"?yield xy(M):yield Gr(M),te=Yt(J,E);return te.width=Math.floor(W*I),te.height=Math.floor(Y*I),te.style.width=`${W}px`,te.style.height=`${Y}px`,te})}function DN(v,_){return g(this,null,function*(){return Gr(yield st(v,p(d({},_),{type:"image/jpeg"})))})}function AN(v,_){return g(this,null,function*(){const M=yield st(v,_),E=yield Va(M);return E.getContext("2d").getImageData(0,0,E.width,E.height).data})}function NN(v,_){return g(this,null,function*(){return Gr(yield st(v,p(d({},_),{type:"image/png"})))})}function LN(v,_){return g(this,null,function*(){return Gr(yield st(v,p(d({},_),{type:"image/webp"})))})}n.createContext=Ba,n.destroyContext=py,n.domToBlob=kN,n.domToCanvas=Va,n.domToDataUrl=Gr,n.domToForeignObjectSvg=wy,n.domToImage=EN,n.domToJpeg=DN,n.domToPixel=AN,n.domToPng=NN,n.domToSvg=xy,n.domToWebp=LN,n.loadMedia=an,n.waitUntilLoad=Go,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})})})(Nc,Nc.exports);var GA=Nc.exports;const Zg=(e,t,n)=>{m.useImperativeHandle(t,()=>({download(){e.current&&GA.domToPng(e.current,{scale:5}).then(r=>{const o=document.createElement("a");o.download=`${n}.png`,o.href=r,o.click()})}}))},VA=({x:e,y:t,datum:n,size:r})=>K.jsx(fc,{cx:e,cy:t,stroke:n.color.dark,strokeWidth:1,fill:n.color.light,r:r/2}),XA=({x:e,y:t,datum:n})=>K.jsx(fc,{cx:e,cy:t,stroke:n.color.dark,strokeWidth:1,fill:n.color.dark,r:5,style:{zIndex:1500}}),Na={xAccessor:e=>e.x,yAccessor:e=>e.y},Qg=(e,t,n)=>n==="pre"?`${t}${e}`:`${e}${t}`,Jg=10,KA=5,Lc=m.forwardRef(({nodes:e,height:t,width:n,xAxisValues:r,series:o,xAxisLabel:i,yAxisLabel:a,xAxisDomain:u,yAxisDomain:l,xAxisUnitSymbol:s,yAxisUnitSymbol:c,tooltipTitle:f,mode:d,xAxisCharLimit:p,connectNulls:h=!1,tooltipStackCharLimit:g=Jg},x)=>{const[b,w]=m.useState(e.map(S=>S.id)),$=m.useRef(null);Zg($,x,`${i}-${a}-LineChart`);const T=m.useMemo(()=>o.map((S,C)=>({points:S.data.map((k,j)=>({x:r[j],y:k,nodeId:S.id,color:Lt(C)}))})).slice(0,d==="mini"?KA:o.length),[r,o,d]),y=m.useMemo(()=>d==="full"?T.filter(S=>b.includes(S.points[0].nodeId)):T,[T,b,d]),P=m.useMemo(()=>Math.floor((n-(d==="mini"?0:150))/(r.length*8)),[n,r,d]);return K.jsxs("div",{ref:$,id:"line-chart",className:"bg-white flex flex-col",style:{width:n,height:t},children:[K.jsxs("div",{className:"w-full min-w-0 min-h-0 h-full flex flex-row",children:[K.jsx("div",{className:"w-full min-w-0 min-h-0 h-full",children:K.jsxs(jr,{margin:{top:10,left:50,right:50,bottom:50},xScale:{type:"band",nice:!0,...u&&{domain:u}},yScale:{type:"linear",nice:!0,...l&&{domain:l}},children:[K.jsx(qC,{columns:!1,numTicks:6,lineStyle:{stroke:"#EBEFF3",strokeWidth:1}}),K.jsx(mm,{hideTicks:!0,orientation:"bottom",stroke:"#CFD7DF",strokeWidth:1,numTicks:6,tickFormat:S=>s?Qg(S,s.symbol,s.position):S,rangePadding:{end:10},tickComponent:S=>K.jsx(Ec,{textLabel:S.formattedValue||"",x:S.x,y:S.y,textStyles:{fontFamily:"system-ui",fontSize:"10px",fontWeight:600,fill:"#666666",textAnchor:"middle"},axisCharLimit:p??P}),label:`${i} ➔`,labelProps:{fontFamily:"system-ui",fontSize:"10px",fontWeight:600,dy:10,fill:"#666666",textAnchor:"middle",verticalAnchor:"middle"}}),K.jsx(mm,{hideTicks:!0,numTicks:6,strokeWidth:1,orientation:"left",stroke:"#CFD7DF",label:`${a} ➔`,tickFormat:S=>c?Qg(S,c.symbol,c.position):S,tickLabelProps:{fontFamily:"system-ui",fontSize:"10px",fontWeight:600,fill:"#666666"},labelProps:{fontFamily:"system-ui",fontSize:"10px",fontWeight:500,dx:-20,fill:"#666666",textAnchor:"middle",verticalAnchor:"middle"}}),y.map((S,C)=>K.jsxs(K.Fragment,{children:[K.jsx(YA,{data:S.points,xAccessor:Na.xAccessor,yAccessor:Na.yAccessor,connectNulls:h}),K.jsx(c2,{dataKey:`Performance Management ${C}`,data:S.points,size:8,renderGlyph:VA,xAccessor:Na.xAccessor,yAccessor:Na.yAccessor})]})),K.jsx(Tm,{showDatumGlyph:!0,scroll:!0,debounce:500,snapTooltipToDatumX:!0,snapTooltipToDatumY:!0,detectBounds:!0,unstyled:!0,applyPositionStyle:!0,renderGlyph:XA,renderTooltip:({tooltipData:S})=>{var j,L,H,G,V,O;const C=e.find(N=>{var z;return N.id===((z=S==null?void 0:S.nearestDatum)==null?void 0:z.datum.nodeId)}),k=((j=S==null?void 0:S.nearestDatum)==null?void 0:j.datum)&&((L=S==null?void 0:S.nearestDatum)==null?void 0:L.datum.x.length)<g;return K.jsx(Kg,{xValue:(H=S==null?void 0:S.nearestDatum)==null?void 0:H.datum.x,yValue:(G=S==null?void 0:S.nearestDatum)==null?void 0:G.datum.y,xAxisLabel:i,yAxisLabel:a,showSideBySide:!!k,tooltipTitle:f,legendValue:(C==null?void 0:C.name)||"",legendDarkColor:((V=S==null?void 0:S.nearestDatum)==null?void 0:V.datum.color.dark)||Lt(0).dark,legendLightColor:((O=S==null?void 0:S.nearestDatum)==null?void 0:O.datum.color.light)||Lt(0).light})}})]})}),d==="full"&&K.jsxs("div",{className:"w-64 p-4 bg-zinc-100 rounded-lg flex-col justify-start items-start gap-0.5 inline-flex text-xs grow-0 shrink-0 basis-auto",children:[K.jsxs("div",{className:"text-sm font-semibold pb-2",children:[K.jsx("span",{className:"pr-1",children:i}),"(",T.length,")"]}),T.map(S=>{const C=e.find(k=>k.id===S.points[0].nodeId);return C&&K.jsxs("div",{className:"flex justify-between items-center gap-1 py-1 w-full",children:[K.jsxs("div",{className:"flex justify-between items-center",children:[K.jsx("div",{style:{backgroundColor:S.points[0].color.light,borderColor:S.points[0].color.dark},className:"h-3 w-3 rounded-full border mr-1"}),C.name]}),K.jsx("div",{className:"flex items-center",children:K.jsx(dD,{checked:b.includes(C.id),onCheckedChange:k=>{let j=[...b];k?j=[...b,C.id]:j.splice(b.indexOf(C.id),1),w(j)}})})]},C.id)})]})]}),d==="mini"&&K.jsx("div",{className:"flex flex-row flex-wrap justify-center gap-4 text-[10px] text-[#666666] font-semibold",children:T.map(S=>{const C=e.find(k=>k.id===S.points[0].nodeId);return K.jsxs("div",{className:"flex justify-center items-center gap-1",children:[K.jsx("div",{style:{backgroundColor:S.points[0].color.light,borderColor:S.points[0].color.dark},className:"h-3 w-3 rounded-full border"}),C==null?void 0:C.name]},C==null?void 0:C.id)})})]})}),ZA={xAxisUnitSymbol:void 0,yAxisUnitSymbol:void 0,mode:"mini",xAxisCharLimit:void 0,tooltipStackCharLimit:Jg,xAxisDomain:void 0,yAxisDomain:void 0,connectNulls:!1};Lc.defaultProps=ZA,Lc.displayName="LineBase";const ey=m.forwardRef((e,t)=>K.jsx(dc,{debounceTime:10,children:({width:n,height:r})=>K.jsx(Lc,{ref:t,width:n,height:r,...e})}));ey.displayName="LineChart";const QA=ey;function ty(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of e)(o=t(o,++r,e))!=null&&(n<o||n===void 0&&o>=o)&&(n=o)}return n}function JA(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of e)(o=t(o,++r,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function Ic(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let o of e)(o=+t(o,++r,e))&&(n+=o)}return n}function eN(e,t){return e.sourceLinks.length?e.depth:t-1}function La(e){return function(){return e}}function ny(e,t){return Ia(e.source,t.source)||e.index-t.index}function ry(e,t){return Ia(e.target,t.target)||e.index-t.index}function Ia(e,t){return e.y0-t.y0}function jc(e){return e.value}function tN(e){return e.index}function nN(e){return e.nodes}function rN(e){return e.links}function oy(e,t){const n=e.get(t);if(!n)throw new Error("missing: "+t);return n}function iy({nodes:e}){for(const t of e){let n=t.y0,r=n;for(const o of t.sourceLinks)o.y0=n+o.width/2,n+=o.width;for(const o of t.targetLinks)o.y1=r+o.width/2,r+=o.width}}function oN(){let e=0,t=0,n=1,r=1,o=24,i=8,a,u=tN,l=eN,s,c,f=nN,d=rN,p=6;function h(){const O={nodes:f.apply(null,arguments),links:d.apply(null,arguments)};return g(O),x(O),b(O),w(O),y(O),iy(O),O}h.update=function(O){return iy(O),O},h.nodeId=function(O){return arguments.length?(u=typeof O=="function"?O:La(O),h):u},h.nodeAlign=function(O){return arguments.length?(l=typeof O=="function"?O:La(O),h):l},h.nodeSort=function(O){return arguments.length?(s=O,h):s},h.nodeWidth=function(O){return arguments.length?(o=+O,h):o},h.nodePadding=function(O){return arguments.length?(i=a=+O,h):i},h.nodes=function(O){return arguments.length?(f=typeof O=="function"?O:La(O),h):f},h.links=function(O){return arguments.length?(d=typeof O=="function"?O:La(O),h):d},h.linkSort=function(O){return arguments.length?(c=O,h):c},h.size=function(O){return arguments.length?(e=t=0,n=+O[0],r=+O[1],h):[n-e,r-t]},h.extent=function(O){return arguments.length?(e=+O[0][0],n=+O[1][0],t=+O[0][1],r=+O[1][1],h):[[e,t],[n,r]]},h.iterations=function(O){return arguments.length?(p=+O,h):p};function g({nodes:O,links:N}){for(const[q,R]of O.entries())R.index=q,R.sourceLinks=[],R.targetLinks=[];const z=new Map(O.map((q,R)=>[u(q,R,O),q]));for(const[q,R]of N.entries()){R.index=q;let{source:A,target:F}=R;typeof A!="object"&&(A=R.source=oy(z,A)),typeof F!="object"&&(F=R.target=oy(z,F)),A.sourceLinks.push(R),F.targetLinks.push(R)}if(c!=null)for(const{sourceLinks:q,targetLinks:R}of O)q.sort(c),R.sort(c)}function x({nodes:O}){for(const N of O)N.value=N.fixedValue===void 0?Math.max(Ic(N.sourceLinks,jc),Ic(N.targetLinks,jc)):N.fixedValue}function b({nodes:O}){const N=O.length;let z=new Set(O),q=new Set,R=0;for(;z.size;){for(const A of z){A.depth=R;for(const{target:F}of A.sourceLinks)q.add(F)}if(++R>N)throw new Error("circular link");z=q,q=new Set}}function w({nodes:O}){const N=O.length;let z=new Set(O),q=new Set,R=0;for(;z.size;){for(const A of z){A.height=R;for(const{source:F}of A.targetLinks)q.add(F)}if(++R>N)throw new Error("circular link");z=q,q=new Set}}function $({nodes:O}){const N=ty(O,R=>R.depth)+1,z=(n-e-o)/(N-1),q=new Array(N);for(const R of O){const A=Math.max(0,Math.min(N-1,Math.floor(l.call(null,R,N))));R.layer=A,R.x0=e+A*z,R.x1=R.x0+o,q[A]?q[A].push(R):q[A]=[R]}if(s)for(const R of q)R.sort(s);return q}function T(O){const N=JA(O,z=>(r-t-(z.length-1)*a)/Ic(z,jc));for(const z of O){let q=t;for(const R of z){R.y0=q,R.y1=q+R.value*N,q=R.y1+a;for(const A of R.sourceLinks)A.width=A.value*N}q=(r-q+a)/(z.length+1);for(let R=0;R<z.length;++R){const A=z[R];A.y0+=q*(R+1),A.y1+=q*(R+1)}H(z)}}function y(O){const N=$(O);a=Math.min(i,(r-t)/(ty(N,z=>z.length)-1)),T(N);for(let z=0;z<p;++z){const q=Math.pow(.99,z),R=Math.max(1-q,(z+1)/p);S(N,q,R),P(N,q,R)}}function P(O,N,z){for(let q=1,R=O.length;q<R;++q){const A=O[q];for(const F of A){let ne=0,X=0;for(const{source:ee,value:ae}of F.targetLinks){let le=ae*(F.layer-ee.layer);ne+=G(ee,F)*le,X+=le}if(!(X>0))continue;let ie=(ne/X-F.y0)*N;F.y0+=ie,F.y1+=ie,L(F)}s===void 0&&A.sort(Ia),C(A,z)}}function S(O,N,z){for(let q=O.length,R=q-2;R>=0;--R){const A=O[R];for(const F of A){let ne=0,X=0;for(const{target:ee,value:ae}of F.sourceLinks){let le=ae*(ee.layer-F.layer);ne+=V(F,ee)*le,X+=le}if(!(X>0))continue;let ie=(ne/X-F.y0)*N;F.y0+=ie,F.y1+=ie,L(F)}s===void 0&&A.sort(Ia),C(A,z)}}function C(O,N){const z=O.length>>1,q=O[z];j(O,q.y0-a,z-1,N),k(O,q.y1+a,z+1,N),j(O,r,O.length-1,N),k(O,t,0,N)}function k(O,N,z,q){for(;z<O.length;++z){const R=O[z],A=(N-R.y0)*q;A>1e-6&&(R.y0+=A,R.y1+=A),N=R.y1+a}}function j(O,N,z,q){for(;z>=0;--z){const R=O[z],A=(R.y1-N)*q;A>1e-6&&(R.y0-=A,R.y1-=A),N=R.y0-a}}function L({sourceLinks:O,targetLinks:N}){if(c===void 0){for(const{source:{sourceLinks:z}}of N)z.sort(ry);for(const{target:{targetLinks:z}}of O)z.sort(ny)}}function H(O){if(c===void 0)for(const{sourceLinks:N,targetLinks:z}of O)N.sort(ry),z.sort(ny)}function G(O,N){let z=O.y0-(O.sourceLinks.length-1)*a/2;for(const{target:q,width:R}of O.sourceLinks){if(q===N)break;z+=R+a}for(const{source:q,width:R}of N.targetLinks){if(q===O)break;z-=R}return z}function V(O,N){let z=N.y0-(N.targetLinks.length-1)*a/2;for(const{source:q,width:R}of N.targetLinks){if(q===O)break;z+=R+a}for(const{target:q,width:R}of O.sourceLinks){if(q===N)break;z-=R}return z}return h}function iN({tooltipData:e,fromLabel:t,toLabel:n,weightLabel:r,tooltipTitle:o}){var u,l,s,c;const i=e.source,a=e.target;return K.jsxs(lt,{tooltipTitle:o,children:[K.jsx(lt.Item,{label:t,value:i.name}),K.jsx(lt.Item,{label:n,value:a.name}),K.jsx(lt.Item,{label:r,value:e.weight.toString()}),K.jsx(lt.Legend,{value:i.name,darkColor:(u=Lt(i.index||0))==null?void 0:u.dark,lightColor:(l=Lt(i.index||0))==null?void 0:l.light}),K.jsx(lt.Legend,{value:a.name,darkColor:(s=Lt(a.index||0))==null?void 0:s.dark,lightColor:(c=Lt(a.index||0))==null?void 0:c.light})]})}const ay=80,uy=20,aN=30,uN=12,ly=m.forwardRef(({height:e,width:t,tooltipTitle:n,nodes:r,links:o,groups:i,weightLabel:a},u)=>{const l=m.useMemo(()=>oN().nodeId(O=>O.id).nodeWidth(uN).nodePadding(aN).nodeAlign(O=>O.group),[]),s=m.useRef(null);Zg(s,u,`${n}-SankeyChart`);const[c,f]=m.useState(""),[d,p]=m.useState(null),{tooltipData:h,tooltipLeft:g,tooltipTop:x,tooltipOpen:b,showTooltip:w,hideTooltip:$}=gm(),{containerBounds:T,containerRef:y,TooltipInPortal:P}=$m({detectBounds:!0,debounce:500,scroll:!0,zIndex:1500}),S=m.useMemo(()=>l.extent([[ay,uy],[t-ay,e-uy-50]])({nodes:r,links:o.map(O=>({...O,value:Number(O.weight)}))}),[e,t,l,r,o]),C=m.useMemo(()=>Math.max(...S.nodes.map(O=>O.depth??0)),[S]),k=m.useMemo(()=>{const O={};let N=-1/0;return S.nodes.forEach(z=>{const{group:q}=z;O[q]?(O[q].x=Math.max(O[q].x??-1/0,z.x0??-1/0),O[q].y=Math.max(O[q].y??-1/0,z.y1??-1/0)):(O[q]={},O[q].x=z.x0,O[q].y=z.y1),N=Math.max(N,O[q].y??-1/0),O[q].y=N}),O},[S]),j=m.useCallback(O=>{const N=l.nodeId()(O);f(c===N?"":N)},[c,l]),L=m.useCallback(()=>{f(""),p(null)},[]),H=m.useMemo(()=>c===""&&d===null?new Set:new Set(S.links.filter(O=>l.nodeId()(O.source)===c||l.nodeId()(O.target)===c||(d==null?void 0:d.source)===O.source&&(d==null?void 0:d.target)===O.target)),[c,S,d,l]),G=m.useCallback((O,N)=>{const z=("clientX"in O?O.clientX:0)-T.left,q=("clientY"in O?O.clientY:0)-T.top;p(N),z&&q&&w({tooltipLeft:z,tooltipTop:q,tooltipData:N})},[w,T]),V=m.useCallback(()=>{L(),$()},[L,$]);return K.jsxs("div",{ref:s,className:"bg-white w-min h-min",children:[K.jsxs("svg",{height:e,width:t,ref:y,children:[K.jsx("g",{children:S.links.map(O=>K.jsx(iC,{data:O,source:N=>({x:N.source.x1,y:N.y0}),target:N=>({x:N.target.x0,y:N.y1}),x:N=>N.x??0,y:N=>N.y??0,fill:"none",pointerEvents:"stroke",onMouseLeave:()=>V(),onMouseMove:N=>G(N,O),stroke:Lt(O.source.index||0).light,strokeWidth:O.width,strokeOpacity:H.has(O)?.7:.25},O.index))}),K.jsx("g",{children:S.nodes.map(O=>{var N,z,q;return K.jsx("g",{children:K.jsx(ZT,{x:O.x0??0,height:(O.y1??0)-(O.y0??0)+10,width:(O.x1??0)-(O.x0??0),y:(O.y0??0)-5,onMouseEnter:()=>j(O),onMouseLeave:()=>L(),radius:2,fill:c===O.id?(N=Lt(O.index||0))==null?void 0:N.dark:(z=Lt(O.index||0))==null?void 0:z.light,stroke:(q=Lt(O.index||0))==null?void 0:q.dark,all:!0})},O.index)})}),K.jsx("g",{children:i.map(O=>K.jsx(Ec,{axisCharLimit:20,x:k[O.id].x??0,y:(k[O.id].y??0)+40,textLabel:O.name,textStyles:{fontSize:10,fontWeight:600,textAnchor:"middle",fill:"#666666"}},O.id))}),K.jsxs("g",{children:[S.nodes.map(O=>K.jsx(Ec,{axisCharLimit:8,x:O.depth===C?(O.x1??0)+10:(O.x0??0)-10,y:(O.y0??0)+((O.y1??0)-(O.y0??0))/2,textLabel:O.name,textStyles:{fontSize:10,fontWeight:600,textAnchor:O.depth===C?"start":"end",fill:"#666666"}},O.index)),S.nodes.map(O=>O.value&&K.jsx(pu,{x:O.depth===C?(O.x1??0)+10:(O.x0??0)-10,y:(O.y0??0)+((O.y1??0)-(O.y0??0))/2+16,style:{fontSize:10,fontWeight:400,textAnchor:O.depth===C?"start":"end",fill:"#666666"},children:`(${O.value.toString()})`},O.index))]})]}),b&&h&&K.jsx(P,{top:x,left:g,unstyled:!0,applyPositionStyle:!0,children:K.jsx(iN,{tooltipData:h,fromLabel:`From: ${i[h.source.group].name}`,toLabel:`To: ${i[h.target.group].name}`,weightLabel:a,tooltipTitle:n})},Math.random())]})});ly.displayName="Sankey";const sy=m.forwardRef((e,t)=>K.jsx(dc,{debounceTime:10,children:({width:n,height:r})=>n&&r&&K.jsx(ly,{ref:t,width:n,height:r,...e})}));sy.displayName="SankeyChart";const lN=sy;ft.LineChart=QA,ft.SankeyChart=lN,Object.defineProperty(ft,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mesh.ai/rabbit",
3
3
  "private": false,
4
- "version": "0.0.24",
4
+ "version": "0.0.25",
5
5
  "packageManager": "pnpm@8.6.0",
6
6
  "main": "./dist/@mesh.ai/rabbit.umd.js",
7
7
  "module": "./dist/@mesh.ai/rabbit.es.js ",