@nice2dev/ui 1.1.9 → 1.1.10
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.
- package/CHANGELOG.md +74 -0
- package/README.md +17 -16
- package/dist/NiceCodeEditor-BfkH1bsZ.cjs +260 -0
- package/dist/NiceCodeEditor-CduGYggj.js +1179 -0
- package/dist/NiceColorPicker-CdUnhM-A.cjs +1 -0
- package/dist/NiceColorPicker-DpXwnDwL.js +598 -0
- package/dist/NiceConfirmDialog-B7aNRL2K.cjs +1 -0
- package/dist/NiceConfirmDialog-BdhWenrO.js +81 -0
- package/dist/NiceDataGrid-CVYEo_nv.cjs +10 -0
- package/dist/NiceDataGrid-D-rm4lu8.js +2217 -0
- package/dist/NiceDocumentViewer-BgcgLWJ3.cjs +180 -0
- package/dist/NiceDocumentViewer-sukmGhRx.js +672 -0
- package/dist/NiceForm-DVc0Xoly.js +4819 -0
- package/dist/NiceForm-qD_RKPYz.cjs +1 -0
- package/dist/NiceGantt-4UBd4uJ8.cjs +1 -0
- package/dist/NiceGantt-B_1lwEsp.js +328 -0
- package/dist/NiceHtmlEditor-Bce9Vwe1.cjs +10 -0
- package/dist/NiceHtmlEditor-CGRgcu2h.js +848 -0
- package/dist/NiceLoginForm-BTuQ0eKk.cjs +1 -0
- package/dist/NiceLoginForm-o1A-TBcp.js +736 -0
- package/dist/NiceMention-Dds9GQzk.cjs +430 -0
- package/dist/NiceMention-DlLXWddO.js +11268 -0
- package/dist/NiceModal-Dr1e3nQZ.cjs +1 -0
- package/dist/NiceModal-sihGCfDy.js +95 -0
- package/dist/NiceModuleLifecyclePanel-Du7G3-RG.js +7053 -0
- package/dist/NiceModuleLifecyclePanel-js1p7LIY.cjs +1 -0
- package/dist/NicePagination-D44waj9o.cjs +1 -0
- package/dist/NicePagination-DdxH8KMG.js +179 -0
- package/dist/NicePivotGrid-B2YHP3Z6.js +1183 -0
- package/dist/NicePivotGrid-BtVUWiud.cjs +152 -0
- package/dist/NiceSavedQueryPanel-C0A-eoYN.js +5142 -0
- package/dist/NiceSavedQueryPanel-ZrilZRtf.cjs +586 -0
- package/dist/NiceScheduler-KSzaUQxC.js +1693 -0
- package/dist/NiceScheduler-O3AwmdGG.cjs +5 -0
- package/dist/NiceSelect-BCbWtu1v.js +433 -0
- package/dist/NiceSelect-BqtiQbfD.cjs +1 -0
- package/dist/NiceWindow-BU1Ce7gS.js +1623 -0
- package/dist/NiceWindow-jjdE6vGy.cjs +1 -0
- package/dist/charts-C44vJber.cjs +768 -0
- package/dist/charts-XVlDwU0y.js +4732 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +8 -8
- package/dist/core-BxiH7vkV.cjs +1 -0
- package/dist/core-DMV6_SEE.js +795 -0
- package/dist/data-branching-oEH04O3i.js +6273 -0
- package/dist/data-branching-wmsbLNfa.cjs +1 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +2 -2
- package/dist/data.mjs +3 -3
- package/dist/devops-Bt6EsfPa.cjs +17 -0
- package/dist/devops-CnZQ1rU5.js +8312 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +2 -1
- package/dist/editors.mjs +7 -7
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +3 -3
- package/dist/index.cjs +142 -142
- package/dist/index.d.ts +45 -26
- package/dist/index.mjs +7480 -7459
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +69 -69
- package/dist/no-code-4GtIBr6f.js +7503 -0
- package/dist/no-code-Bdwh1vyS.cjs +332 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.mjs +102 -102
- package/dist/pickerCommons-31hyz1gs.js +1122 -0
- package/dist/pickerCommons-BifIkPdk.cjs +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,768 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),fe=require("@nice2dev/ui-core"),c=require("react"),Ye=require("@nice2dev/i18n"),Ne=["var(--nice-color-primary, #3b82f6)","var(--nice-color-error, #ef4444)","var(--nice-color-success, #22c55e)","var(--nice-color-warning, #f59e0b)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-accent-pink, #ec4899)","var(--nice-color-info, #06b6d4)","var(--nice-success, #84cc16)"],ke=({series:t,categories:s,width:m=600,height:a=400,title:i,showLegend:y=!0,showGrid:_=!0,axisLabels:S=!0,yAxisLabel:z,xAxisLabel:w,stacked:p,animated:j,zoomable:D,crosshair:A,annotations:N,legendInteractive:d,onDataPointClick:o,exportable:u,className:I,style:g})=>{const $=c.useRef(null),[b,R]=c.useState(new Set),[r,T]=c.useState(null),[h,M]=c.useState(null),[v,P]=c.useState(!1),F=c.useRef(null),V=c.useMemo(()=>t.filter(k=>!b.has(k.name)),[t,b]),X=c.useCallback(k=>{d&&R(G=>{const ne=new Set(G);return ne.has(k)?ne.delete(k):ne.add(k),ne})},[d]),B={top:i?40:20,right:20,bottom:w?60:40,left:z?60:50},Z=m-B.left-B.right,Y=a-B.top-B.bottom,J=V[0]?.data.length??t[0]?.data.length??0,x=h?.start??0,re=h?.end??J,Q=re-x,ee=c.useMemo(()=>V.map(k=>({...k,data:k.data.slice(x,re)})),[V,x,re]),U=c.useMemo(()=>s?.slice(x,re),[s,x,re]),{minY:se,maxY:E,yTicks:f}=c.useMemo(()=>{let k;if(p){k=[];for(let C=0;C<Q;C++)k.push(ee.reduce((K,de)=>K+(de.data[C]||0),0))}else k=ee.flatMap(C=>C.data);k.length===0&&(k=[0]);const G=Math.min(0,...k),ne=Math.max(0,...k),oe=ne-G||1,le=Math.pow(10,Math.floor(Math.log10(oe)))||1,n=Math.floor(G/le)*le;let O=Math.ceil(ne/le)*le;const W=[];for(let C=n;C<=O;C+=le)W.push(Math.round(C*1e6)/1e6);return W.length<2&&(O=n+le,W.push(Math.round(O*1e6)/1e6)),{minY:n,maxY:O,yTicks:W}},[ee,Q,p]),l=k=>Y-(k-se)/(E-se||1)*Y,L=k=>(k+.5)/Q*Z,te=Q>0?Z/Q/(p?1.5:Math.max(V.length,1)*1.5):20,ce=c.useCallback(k=>{if(!D)return;k.preventDefault();const G=h??{start:0,end:J},ne=G.end-G.start,oe=(G.start+G.end)/2,le=k.deltaY>0?1.2:.8,n=Math.max(2,Math.min(J,Math.round(ne*le))),O=Math.max(0,Math.round(oe-n/2)),W=Math.min(J,O+n);M({start:O,end:W})},[D,h,J]),H=c.useCallback(k=>{D&&(P(!0),F.current={x:k.clientX,range:h??{start:0,end:J}})},[D,h,J]),ie=c.useCallback(k=>{const G=$.current?.getBoundingClientRect();if(G&&T({x:k.clientX-G.left-B.left,y:k.clientY-G.top-B.top}),v&&F.current&&D){const ne=k.clientX-F.current.x,oe=Z/Q,le=-Math.round(ne/oe),n=F.current.range,O=n.end-n.start;let W=n.start+le;W<0&&(W=0),W+O>J&&(W=J-O),M({start:W,end:W+O})}},[v,D,Z,Q,J,B.left,B.top]),he=c.useCallback(()=>{P(!1),F.current=null},[]),ve=c.useCallback(()=>{T(null),P(!1),F.current=null},[]),be=c.useCallback(()=>{const k=$.current;if(!k)return;const G=new XMLSerializer().serializeToString(k),ne=document.createElement("canvas");ne.width=m,ne.height=a+(y?30:0);const oe=ne.getContext("2d");if(!oe)return;const le=new Image;le.onload=()=>{oe.fillStyle=fe.resolveCssColor("var(--nice-bg-primary, #fff)",oe.canvas),oe.fillRect(0,0,ne.width,ne.height),oe.drawImage(le,0,0);const n=document.createElement("a");n.download="chart.png",n.href=ne.toDataURL("image/png"),n.click()},le.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(G)},[m,a,y]),ye=a+(y?30:0),q=ee.length>0&&ee.every(k=>k.type==="radar"),ae=c.useMemo(()=>{if(!q)return 1;const k=ee.flatMap(G=>G.data);return Math.max(1,...k)},[q,ee]);if(q){const k=m/2,G=(a-B.top-B.bottom)/2+B.top,ne=Math.min(Z,a-B.top-B.bottom)/2-10,oe=U?.length??ee[0]?.data.length??0,le=W=>W/oe*Math.PI*2-Math.PI/2,n=(W,C)=>{const K=C/ae*ne;return[k+Math.cos(le(W))*K,G+Math.sin(le(W))*K]},O=4;return e.jsx("div",{className:`nice-chart nice-chart--radar ${I||""}`,style:g,children:e.jsxs("svg",{ref:$,viewBox:`0 0 ${m} ${ye}`,preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%",className:"nice-chart__svg",style:{display:"block",maxWidth:"100%",maxHeight:"100%"},children:[i&&e.jsx("text",{x:m/2,y:20,textAnchor:"middle",className:"nice-chart__title",children:i}),_&&Array.from({length:O},(W,C)=>{const K=(C+1)/O*ne,de=[];for(let ue=0;ue<oe;ue++)de.push(`${k+Math.cos(le(ue))*K},${G+Math.sin(le(ue))*K}`);return e.jsx("polygon",{points:de.join(" "),fill:"none",className:"nice-chart__grid-line"},C)}),Array.from({length:oe},(W,C)=>{const[K,de]=n(C,ae);return e.jsx("line",{x1:k,y1:G,x2:K,y2:de,className:"nice-chart__grid-line"},C)}),S&&U?.map((W,C)=>{const[K,de]=n(C,ae*1.12);return e.jsx("text",{x:K,y:de,textAnchor:"middle",dominantBaseline:"middle",className:"nice-chart__axis-label",children:W},C)}),ee.map((W,C)=>{const K=W.color||Ne[C%Ne.length],de=W.data.map((ue,xe)=>n(xe,ue).join(",")).join(" ");return e.jsxs("g",{className:j?"nice-chart__series nice-chart__series--radar nice-chart__series--anim":"nice-chart__series nice-chart__series--radar",children:[e.jsx("polygon",{points:de,fill:K,fillOpacity:.2,stroke:K,strokeWidth:2}),W.data.map((ue,xe)=>{const[_e,je]=n(xe,ue);return e.jsx("circle",{cx:_e,cy:je,r:3,fill:K,children:e.jsx("title",{children:`${W.name}: ${ue}`})},xe)})]},W.name)}),y&&e.jsx("g",{transform:`translate(${B.left}, ${a})`,children:t.map((W,C)=>{const K=C*120,de=b.has(W.name);return e.jsxs("g",{transform:`translate(${K}, 10)`,style:d?{cursor:"pointer"}:void 0,onClick:()=>X(W.name),opacity:de?.35:1,children:[e.jsx("rect",{width:12,height:12,rx:2,fill:W.color||Ne[C%Ne.length]}),e.jsx("text",{x:16,y:10,className:"nice-chart__legend-text",children:W.name})]},W.name)})})]})})}return e.jsxs("div",{className:`nice-chart ${I||""}`,style:g,children:[u&&e.jsx("button",{type:"button",className:"nice-chart__export-btn",onClick:be,title:"Export PNG","aria-label":"Export PNG",children:e.jsx(fe.NiceIcon,{name:"camera",size:16})}),e.jsxs("svg",{ref:$,viewBox:`0 0 ${m} ${ye}`,preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%",style:{display:"block",maxWidth:"100%",maxHeight:"100%"},className:"nice-chart__svg",onWheel:ce,onMouseDown:H,onMouseMove:ie,onMouseUp:he,onMouseLeave:ve,children:[e.jsxs("g",{transform:`translate(${B.left},${B.top})`,children:[i&&e.jsx("text",{x:Z/2,y:-10,textAnchor:"middle",className:"nice-chart__title",children:i}),_&&f.map(k=>e.jsx("line",{x1:0,y1:l(k),x2:Z,y2:l(k),className:"nice-chart__grid-line"},`grid-${k}`)),S&&f.map(k=>e.jsx("text",{x:-8,y:l(k)+4,textAnchor:"end",className:"nice-chart__axis-label",children:k},`ylabel-${k}`)),S&&U&&U.map((k,G)=>e.jsx("text",{x:L(G),y:Y+20,textAnchor:"middle",className:"nice-chart__axis-label",children:k},G)),z&&e.jsx("text",{x:-B.left+14,y:Y/2,textAnchor:"middle",transform:`rotate(-90, -${B.left-14}, ${Y/2})`,className:"nice-chart__axis-title",children:z}),w&&e.jsx("text",{x:Z/2,y:Y+45,textAnchor:"middle",className:"nice-chart__axis-title",children:w}),e.jsx("line",{x1:0,y1:0,x2:0,y2:Y,className:"nice-chart__axis"}),e.jsx("line",{x1:0,y1:Y,x2:Z,y2:Y,className:"nice-chart__axis"}),N?.map((k,G)=>{if(k.type==="line"){const ne=l(k.value);return e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:ne,x2:Z,y2:ne,stroke:k.color||"var(--nice-color-error, #ef4444)",strokeWidth:1.5,strokeDasharray:k.dash||"6,3"}),k.label&&e.jsx("text",{x:Z+4,y:ne+4,className:"nice-chart__annotation-label",fill:k.color||"var(--nice-color-error, #ef4444)",children:k.label})]},G)}return e.jsx("text",{x:L(k.value),y:-4,textAnchor:"middle",className:"nice-chart__annotation-label",fill:k.color||"var(--nice-text-muted, #6b7280)",children:k.label},G)}),A&&r&&r.x>=0&&r.x<=Z&&r.y>=0&&r.y<=Y&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:r.x,y1:0,x2:r.x,y2:Y,stroke:"var(--nice-text-muted, #9ca3af)",strokeWidth:1,strokeDasharray:"4,2"}),e.jsx("line",{x1:0,y1:r.y,x2:Z,y2:r.y,stroke:"var(--nice-text-muted, #9ca3af)",strokeWidth:1,strokeDasharray:"4,2"})]}),ee.map((k,G)=>{const ne=k.color||Ne[G%Ne.length],oe=k.type||"bar";if(oe==="bar")return e.jsx("g",{className:j?"nice-chart__series nice-chart__series--bar nice-chart__series--anim":"nice-chart__series nice-chart__series--bar",children:k.data.map((n,O)=>{let W,C;if(p){const de=ee.slice(0,G).reduce((ue,xe)=>ue+(xe.data[O]||0),0);W=l(de+n),C=l(de)-W}else W=l(Math.max(0,n)),C=Math.abs(l(n)-l(0));const K=p?L(O)-te/2:L(O)-ee.length*te/2+G*te;return e.jsx("rect",{x:K,y:W,width:te*.9,height:Math.max(0,C),fill:ne,rx:2,style:{transformOrigin:`${K+te*.9/2}px ${l(0)}px`,...o?{cursor:"pointer"}:{}},onClick:o?()=>o(k.name,x+O,n):void 0,children:e.jsx("title",{children:`${k.name}: ${n}`})},O)})},k.name);if(oe==="scatter")return e.jsx("g",{className:j?"nice-chart__series nice-chart__series--scatter nice-chart__series--anim":"nice-chart__series nice-chart__series--scatter",children:k.data.map((n,O)=>e.jsx("circle",{cx:L(O),cy:l(n),r:5,fill:ne,fillOpacity:.7,stroke:ne,strokeWidth:1.5,style:o?{cursor:"pointer"}:void 0,onClick:o?()=>o(k.name,x+O,n):void 0,children:e.jsx("title",{children:`${k.name}: ${n}`})},O))},k.name);const le=k.data.map((n,O)=>`${L(O)},${l(n)}`);return e.jsxs("g",{className:j?`nice-chart__series nice-chart__series--${oe} nice-chart__series--anim`:`nice-chart__series nice-chart__series--${oe}`,children:[oe==="area"&&Q>0&&e.jsx("polygon",{points:`${L(0)},${l(0)} ${le.join(" ")} ${L(Q-1)},${l(0)}`,fill:ne,opacity:.15}),e.jsx("polyline",{points:le.join(" "),fill:"none",stroke:ne,strokeWidth:2,className:j?"nice-chart__line":void 0}),k.data.map((n,O)=>e.jsx("circle",{cx:L(O),cy:l(n),r:3,fill:ne,style:o?{cursor:"pointer"}:void 0,onClick:o?()=>o(k.name,x+O,n):void 0,children:e.jsx("title",{children:`${k.name}: ${n}`})},O))]},k.name)})]}),y&&e.jsx("g",{transform:`translate(${B.left}, ${a})`,children:t.map((k,G)=>{const ne=G*120,oe=b.has(k.name);return e.jsxs("g",{transform:`translate(${ne}, 10)`,style:d?{cursor:"pointer"}:void 0,onClick:()=>X(k.name),opacity:oe?.35:1,children:[e.jsx("rect",{width:12,height:12,rx:2,fill:k.color||Ne[G%Ne.length]}),e.jsx("text",{x:16,y:10,className:"nice-chart__legend-text",style:oe?{textDecoration:"line-through"}:void 0,children:k.name})]},k.name)})})]})]})},Ve=Object.freeze(Object.defineProperty({__proto__:null,NiceChart:ke},Symbol.toStringTag,{value:"Module"})),Xe=({value:t,min:s=0,max:m=100,width:a=200,height:i=200,startAngle:y=225,endAngle:_=-45,color:S="var(--nice-color-primary, #3b82f6)",trackColor:z,label:w,formatValue:p,ranges:j,className:D,style:A})=>{const N=a/2,d=i/2,o=Math.min(N,d)-20,u=Math.max(0,Math.min(1,(t-s)/(m-s||1))),I=h=>h*Math.PI/180,g=(y-_+360)%360||360,$=h=>({x:N+o*Math.cos(I(h)),y:d-o*Math.sin(I(h))}),b=(h,M)=>{const v=$(h),P=$(M),V=(h-M+360)%360>180?1:0;return`M${v.x},${v.y} A${o},${o} 0 ${V},1 ${P.x},${P.y}`},R=y-u*g,r=$(R);let T=S;if(j){for(const h of j)if(t>=h.start&&t<=h.end){T=h.color;break}}return e.jsx("div",{className:`nice-gauge nice-gauge--circular ${D||""}`,style:A,children:e.jsxs("svg",{width:a,height:i,children:[e.jsx("path",{d:b(y,_),fill:"none",stroke:z||"var(--nice-border-color, #e2e8f0)",strokeWidth:12,strokeLinecap:"round"}),u>0&&e.jsx("path",{d:b(y,R),fill:"none",stroke:T,strokeWidth:12,strokeLinecap:"round"}),e.jsx("line",{x1:N,y1:d,x2:r.x,y2:r.y,stroke:"var(--nice-text-primary, #333)",strokeWidth:2,strokeLinecap:"round"}),e.jsx("circle",{cx:N,cy:d,r:4,fill:"var(--nice-text-primary, #333)"}),e.jsx("text",{x:N,y:d+o*.6,textAnchor:"middle",className:"nice-gauge__value",children:p?p(t):t}),w&&e.jsx("text",{x:N,y:d+o*.95,textAnchor:"middle",className:"nice-gauge__label",children:w})]})})},Ze=({value:t,min:s=0,max:m=100,width:a=300,height:i=60,orientation:y="horizontal",color:_="var(--nice-color-primary, #3b82f6)",label:S,formatValue:z,ranges:w,showTicks:p=!0,tickCount:j=5,className:D,style:A})=>{const N=y==="horizontal",d=N?a-40:i-40,o=Math.max(0,Math.min(1,(t-s)/(m-s||1))),u=10;let I=_;if(w){for(const $ of w)if(t>=$.start&&t<=$.end){I=$.color;break}}const g=Array.from({length:j},($,b)=>s+(m-s)*(b/(j-1)));return N?e.jsx("div",{className:`nice-gauge nice-gauge--linear ${D||""}`,style:A,children:e.jsxs("svg",{width:a,height:i,children:[e.jsx("text",{x:20+d*o,y:14,textAnchor:"middle",className:"nice-gauge__value",style:{fontSize:12},children:z?z(t):t}),e.jsx("rect",{x:20,y:i/2-u/2,width:d,height:u,rx:5,fill:"var(--nice-border-color, #e2e8f0)"}),e.jsx("rect",{x:20,y:i/2-u/2,width:d*o,height:u,rx:5,fill:I}),e.jsx("polygon",{points:`${20+d*o},${i/2-u/2-2} ${20+d*o-5},${i/2-u/2-8} ${20+d*o+5},${i/2-u/2-8}`,fill:"var(--nice-text-primary, #333)"}),p&&g.map(($,b)=>{const R=20+($-s)/(m-s)*d;return e.jsx("text",{x:R,y:i/2+u/2+12,textAnchor:"middle",className:"nice-gauge__tick",children:$},b)}),S&&e.jsx("text",{x:a/2,y:i-2,textAnchor:"middle",className:"nice-gauge__label",children:S})]})}):e.jsx("div",{className:`nice-gauge nice-gauge--linear nice-gauge--vertical ${D||""}`,style:A,children:e.jsxs("svg",{width:a,height:i,children:[e.jsx("rect",{x:a/2-u/2,y:20,width:u,height:d,rx:5,fill:"var(--nice-border-color, #e2e8f0)"}),e.jsx("rect",{x:a/2-u/2,y:20+d*(1-o),width:u,height:d*o,rx:5,fill:I}),e.jsx("text",{x:a/2,y:14,textAnchor:"middle",className:"nice-gauge__value",children:z?z(t):t}),S&&e.jsx("text",{x:a/2,y:i-4,textAnchor:"middle",className:"nice-gauge__label",children:S})]})})},ge=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#06b6d4","#84cc16"],Ue=({items:t,min:s=0,max:m=100,width:a=300,height:i=300,startAngle:y=225,endAngle:_=-45,formatValue:S,title:z,className:w,style:p})=>{const j=a/2,D=i/2,A=Math.min(j,D)-30,N=Math.min(20,A/(t.length+1)),d=4,o=g=>g*Math.PI/180,u=(y-_+360)%360||360,I=(g,$,b)=>{const R=j+g*Math.cos(o($)),r=D-g*Math.sin(o($)),T=j+g*Math.cos(o(b)),h=D-g*Math.sin(o(b)),M=($-b+360)%360;return`M${R},${r} A${g},${g} 0 ${M>180?1:0},1 ${T},${h}`};return e.jsx("div",{className:`nice-bargauge ${w||""}`,style:p,children:e.jsxs("svg",{width:a,height:i,children:[z&&e.jsx("text",{x:j,y:20,textAnchor:"middle",className:"nice-chart__title",children:z}),t.map((g,$)=>{const b=A-$*(N+d),R=Math.max(0,Math.min(1,(g.value-s)/(m-s||1))),r=y-R*u,T=g.color||ge[$%ge.length];return e.jsxs("g",{children:[e.jsx("path",{d:I(b,y,_),fill:"none",stroke:"var(--nice-border-color, #e2e8f0)",strokeWidth:N,strokeLinecap:"round"}),R>0&&e.jsx("path",{d:I(b,y,r),fill:"none",stroke:T,strokeWidth:N,strokeLinecap:"round"})]},$)}),e.jsx("g",{children:t.map((g,$)=>e.jsxs("text",{x:j,y:D-((t.length-1)/2-$)*16,textAnchor:"middle",dominantBaseline:"middle",className:"nice-gauge__value",style:{fontSize:12},children:[g.label?`${g.label}: `:"",S?S(g.value):g.value]},$))})]})})},Ge={sm:{width:160,height:22,fontSize:11},md:{width:220,height:32,fontSize:12},lg:{width:320,height:44,fontSize:14}},qe=({value:t,target:s,min:m=0,max:a=100,width:i,height:y,color:_="var(--nice-color-primary, #3b82f6)",targetColor:S="var(--nice-color-error, #ef4444)",size:z="md",label:w,labelPlacement:p="top",showValue:j=!1,showTarget:D=!1,formatValue:A=I=>String(I),state:N="normal",errorMessage:d,className:o,style:u})=>{const I=Ge[z],g=i??I.width,$=y??I.height,b=I.fontSize,R=4,r=g-R*2,T=D&&s!=null?b+4:R,h=D&&s!=null?$+(T-R):$,M=h-T-R,v=Math.max(0,Math.min(1,(t-m)/(a-m||1))),P=s!=null?Math.max(0,Math.min(1,(s-m)/(a-m||1))):null,F=()=>N==="error"?e.jsx("div",{role:"alert",style:{width:g,height:h,display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed var(--nice-color-error, #ef4444)",borderRadius:4,color:"var(--nice-color-error, #ef4444)",fontSize:b,padding:"0 8px",boxSizing:"border-box"},children:d??"Error"}):N==="loading"?e.jsx("div",{role:"status","aria-label":"Loading",className:"nice-bullet__skeleton",style:{width:g,height:h,borderRadius:4,background:"linear-gradient(90deg, var(--nice-bg-tertiary, #e5e7eb) 25%, var(--nice-bg-secondary, #f3f4f6) 50%, var(--nice-bg-tertiary, #e5e7eb) 75%)",backgroundSize:"200% 100%",animation:"nice-bullet-shimmer 1.4s linear infinite"}}):e.jsxs("svg",{width:g,height:h,role:"img","aria-label":typeof w=="string"?w:void 0,children:[e.jsx("rect",{x:R,y:T,width:r,height:M,rx:3,fill:"var(--nice-border-color, #e2e8f0)"}),e.jsx("rect",{x:R,y:T+M*.2,width:r*v,height:M*.6,rx:2,fill:_}),P!=null&&e.jsx("line",{x1:R+r*P,y1:T+2,x2:R+r*P,y2:T+M-2,stroke:S,strokeWidth:2}),j&&e.jsx("text",{x:R+Math.max(r*v,4),y:T+M/2,dx:r*v>24?-4:4,textAnchor:r*v>24?"end":"start",dominantBaseline:"middle",fontSize:b,fill:r*v>24?"var(--nice-text-on-primary, #ffffff)":"var(--nice-text-primary)",fontWeight:600,children:A(t)}),D&&P!=null&&e.jsx("text",{x:R+r*P,y:T-2,textAnchor:"middle",fontSize:b-1,fill:S,fontWeight:600,children:A(s)})]});if(p==="none"||!w)return e.jsxs("div",{className:`nice-bullet ${o||""}`,style:u,children:[F(),e.jsx("style",{children:Ae})]});const V=p==="top"||p==="bottom",X=e.jsx("span",{className:"nice-bullet__label",style:{fontSize:b,fontWeight:600,color:"var(--nice-text-primary)",...V?{marginBottom:p==="top"?4:0,marginTop:p==="bottom"?4:0}:{},...p==="left"?{marginRight:8}:{},...p==="right"?{marginLeft:8}:{}},children:w});return e.jsxs("div",{className:`nice-bullet nice-bullet--${p} ${o||""}`,style:{display:"inline-flex",flexDirection:V?"column":"row",alignItems:V?"flex-start":"center",...u},children:[(p==="top"||p==="left")&&X,F(),(p==="bottom"||p==="right")&&X,e.jsx("style",{children:Ae})]})},Ae=`
|
|
2
|
+
@keyframes nice-bullet-shimmer {
|
|
3
|
+
0% { background-position: 200% 0; }
|
|
4
|
+
100% { background-position: -200% 0; }
|
|
5
|
+
}
|
|
6
|
+
`,Je=({data:t,width:s=400,height:m=400,innerRadius:a=0,title:i,showLegend:y=!0,showLabels:_=!0,className:S,style:z})=>{const w=s/2,p=(m-(y?30:0))/2+(i?10:0),j=Math.min(w,p)-40,D=t.reduce((d,o)=>d+o.value,0);let A=-Math.PI/2;const N=t.map((d,o)=>{const u=d.value/(D||1)*Math.PI*2,I=A;A+=u;const g=A,$=(I+g)/2,b=w+j*Math.cos(I),R=p+j*Math.sin(I),r=w+j*Math.cos(g),T=p+j*Math.sin(g),h=u>Math.PI?1:0,M=d.color||ge[o%ge.length],v=u>=Math.PI*2-1e-9;let P;if(v){const B=(Z,Y)=>`M${w-Z},${p} A${Z},${Z} 0 1,${Y} ${w+Z},${p} A${Z},${Z} 0 1,${Y} ${w-Z},${p} Z`;P=a>0?`${B(j,1)} ${B(a,0)}`:B(j,1)}else if(a>0){const B=w+a*Math.cos(I),Z=p+a*Math.sin(I),Y=w+a*Math.cos(g),J=p+a*Math.sin(g);P=`M${b},${R} A${j},${j} 0 ${h},1 ${r},${T} L${Y},${J} A${a},${a} 0 ${h},0 ${B},${Z} Z`}else P=`M${w},${p} L${b},${R} A${j},${j} 0 ${h},1 ${r},${T} Z`;const F=v?w:w+j*.7*Math.cos($),V=v?p:p+j*.7*Math.sin($),X=D>0?Math.round(d.value/D*100):0;return{...d,path:P,labelX:F,labelY:V,pct:X,color:M}});return e.jsx("div",{className:`nice-piechart ${S||""}`,style:z,children:e.jsxs("svg",{viewBox:`0 0 ${s} ${m}`,preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%",style:{display:"block",maxWidth:"100%",maxHeight:"100%"},className:"nice-piechart__svg",children:[i&&e.jsx("text",{x:w,y:20,textAnchor:"middle",className:"nice-chart__title",children:i}),N.map((d,o)=>e.jsxs("g",{children:[e.jsx("path",{d:d.path,fill:d.color,stroke:"var(--nice-bg-primary, #fff)",strokeWidth:2,children:e.jsx("title",{children:`${d.label}: ${d.value} (${d.pct}%)`})}),_&&d.pct>=5&&e.jsxs("text",{x:d.labelX,y:d.labelY,textAnchor:"middle",dominantBaseline:"middle",className:"nice-piechart__label",children:[d.pct,"%"]})]},o)),y&&e.jsx("g",{transform:`translate(10, ${m-25})`,children:t.map((d,o)=>e.jsxs("g",{transform:`translate(${o*100}, 0)`,children:[e.jsx("rect",{width:10,height:10,rx:2,fill:d.color||ge[o%ge.length]}),e.jsx("text",{x:14,y:9,className:"nice-chart__legend-text",children:d.label})]},o))})]})})},Ke=({data:t,width:s=400,height:m=300,inverted:a,showLabels:i=!0,showValues:y=!0,title:_,className:S,style:z})=>{const w={top:_?30:10,bottom:10,x:40},p=s-w.x*2,j=m-w.top-w.bottom,D=a?[...t].reverse():t,A=Math.max(...D.map(d=>d.value),1),N=j/D.length;return e.jsx("div",{className:`nice-funnel ${S||""}`,style:z,children:e.jsxs("svg",{width:s,height:m,children:[_&&e.jsx("text",{x:s/2,y:20,textAnchor:"middle",className:"nice-chart__title",children:_}),D.map((d,o)=>{const u=d.value/A*p,I=o<D.length-1?D[o+1].value/A*p:u*.3,g=w.top+o*N,$=g+N,b=s/2,R=`${b-u/2},${g} ${b+u/2},${g} ${b+I/2},${$} ${b-I/2},${$}`,r=d.color||ge[o%ge.length];return e.jsxs("g",{children:[e.jsx("polygon",{points:R,fill:r,stroke:"var(--nice-bg-primary, #fff)",strokeWidth:1,children:e.jsx("title",{children:`${d.label}: ${d.value}`})}),i&&e.jsx("text",{x:b,y:g+N/2-(y?4:0),textAnchor:"middle",dominantBaseline:"middle",className:"nice-funnel__label",children:d.label}),y&&e.jsx("text",{x:b,y:g+N/2+10,textAnchor:"middle",dominantBaseline:"middle",className:"nice-funnel__value",children:d.value})]},o)})]})})};function Qe(t,s,m){const a=A=>{const N=A.replace("#","");return[parseInt(N.slice(0,2),16),parseInt(N.slice(2,4),16),parseInt(N.slice(4,6),16)]},[i,y,_]=a(t),[S,z,w]=a(s),p=Math.round(i+(S-i)*m),j=Math.round(y+(z-y)*m),D=Math.round(_+(w-_)*m);return`rgb(${p},${j},${D})`}const Le=c.forwardRef(({data:t,xLabels:s,yLabels:m,colors:a=["var(--nice-primary-bg, #e0f2fe)","var(--nice-color-primary-active, #1d4ed8)"],onCellClick:i,cellSize:y=40,showValues:_=!0,className:S,style:z,id:w},p)=>{const j=fe.useControlId(w),{minVal:D,maxVal:A}=c.useMemo(()=>{let d=1/0,o=-1/0;for(const u of t)for(const I of u)I<d&&(d=I),I>o&&(o=I);return{minVal:d,maxVal:o}},[t]),N=c.useCallback(d=>A===D?.5:(d-D)/(A-D),[D,A]);return e.jsx("div",{ref:p,id:j,className:`nice-heatmap ${S||""}`,style:z,children:e.jsxs("table",{className:"nice-heatmap__table",children:[s&&e.jsx("thead",{children:e.jsxs("tr",{children:[m&&e.jsx("th",{}),s.map((d,o)=>e.jsx("th",{className:"nice-heatmap__header",children:d},o))]})}),e.jsx("tbody",{children:t.map((d,o)=>e.jsxs("tr",{children:[m&&e.jsx("th",{className:"nice-heatmap__row-label",children:m[o]}),d.map((u,I)=>e.jsx("td",{className:"nice-heatmap__cell",style:{background:Qe(a[0],a[1],N(u)),width:y,height:y,textAlign:"center",color:N(u)>.6?"var(--nice-text-on-primary, #fff)":"var(--nice-text-primary, #333)",cursor:i?"pointer":void 0},onClick:()=>i?.(o,I,u),title:String(u),children:_?u:""},I))]},o))})]})})});Le.displayName="NiceHeatMap";const De=({nodes:t,links:s,width:m=600,height:a=400,nodeWidth:i=20,nodePadding:y=10,title:_,className:S,style:z})=>{const w={top:_?40:20,bottom:20,left:20,right:20},p=m-w.left-w.right,j=a-w.top-w.bottom,D=new Set(s.map(h=>h.source)),A=new Set(s.map(h=>h.target)),N=t.filter(h=>D.has(h.id)&&!A.has(h.id)),d=t.filter(h=>A.has(h.id)),o=t.filter(h=>D.has(h.id)&&A.has(h.id)),u=[N,...o.length?[o]:[],d].filter(h=>h.length>0),I=u.length,g=new Map;t.forEach(h=>{const M=s.filter(P=>P.source===h.id).reduce((P,F)=>P+F.value,0),v=s.filter(P=>P.target===h.id).reduce((P,F)=>P+F.value,0);g.set(h.id,Math.max(M,v))});const $=u.map(h=>h.reduce((M,v)=>M+(g.get(v.id)||0),0)+(h.length-1)*y),b=Math.max(...$,1),R=new Map;u.forEach((h,M)=>{const v=w.left+M/(I-1||1)*(p-i);let P=0;h.forEach(F=>{const V=(g.get(F.id)||0)/b*j;R.set(F.id,{x:v,y:w.top+P,h:V}),P+=V+y})});const r=new Map,T=new Map;return t.forEach(h=>{r.set(h.id,0),T.set(h.id,0)}),e.jsx("div",{className:`nice-sankey ${S||""}`,style:z,children:e.jsxs("svg",{width:m,height:a,children:[_&&e.jsx("text",{x:m/2,y:20,textAnchor:"middle",className:"nice-chart__title",children:_}),s.map((h,M)=>{const v=R.get(h.source),P=R.get(h.target);if(!v||!P)return null;const F=r.get(h.source)||0,V=T.get(h.target)||0,X=h.value/b*j;r.set(h.source,F+X),T.set(h.target,V+X);const B=v.x+i,Z=v.y+F,Y=P.x,J=P.y+V,x=(B+Y)/2,Q=t.find(ee=>ee.id===h.source)?.color||ge[M%ge.length];return e.jsx("path",{d:`M${B},${Z} C${x},${Z} ${x},${J} ${Y},${J} L${Y},${J+X} C${x},${J+X} ${x},${Z+X} ${B},${Z+X} Z`,fill:Q,fillOpacity:.3,stroke:Q,strokeOpacity:.5,strokeWidth:.5,children:e.jsx("title",{children:`${h.source} → ${h.target}: ${h.value}`})},M)}),t.map((h,M)=>{const v=R.get(h.id);if(!v)return null;const P=h.color||ge[M%ge.length];return e.jsxs("g",{children:[e.jsx("rect",{x:v.x,y:v.y,width:i,height:Math.max(v.h,2),fill:P,rx:2}),e.jsx("text",{x:v.x<p/2?v.x+i+4:v.x-4,y:v.y+v.h/2,textAnchor:v.x<p/2?"start":"end",dominantBaseline:"middle",className:"nice-chart__legend-text",children:h.label})]},h.id)})]})})},et=Object.freeze(Object.defineProperty({__proto__:null,NiceSankey:De},Symbol.toStringTag,{value:"Module"}));function tt(t,s){const m=t.reduce((w,p)=>w+p.value,0);if(m===0||t.length===0)return[];const a=[];let{x:i,y,w:_,h:S}=s;const z=[...t].sort((w,p)=>p.value-w.value);for(const w of z){const p=w.value/m;if(_>=S){const j=_*p;a.push({x:i,y,w:j,h:S,node:w}),i+=j,_-=j}else{const j=S*p;a.push({x:i,y,w:_,h:j,node:w}),y+=j,S-=j}}return a}const nt=["var(--nice-color-primary, #3b82f6)","var(--nice-color-success, #10b981)","var(--nice-color-warning, #f59e0b)","var(--nice-color-error, #ef4444)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-info, #06b6d4)","var(--nice-color-accent-pink, #ec4899)","var(--nice-success, #84cc16)"],Ie=c.forwardRef(({data:t,width:s=600,height:m=400,onNodeClick:a,colors:i=nt,className:y,style:_,id:S},z)=>{const w=fe.useControlId(S),p=c.useMemo(()=>{const j=t.children??[t];return tt(j,{x:0,y:0,w:s,h:m})},[t,s,m]);return e.jsx("div",{ref:z,id:w,className:`nice-treemap ${y||""}`,style:_,children:e.jsx("svg",{width:s,height:m,className:"nice-treemap__svg",children:p.map((j,D)=>e.jsxs("g",{onClick:()=>a?.(j.node),style:{cursor:a?"pointer":void 0},children:[e.jsx("rect",{x:j.x,y:j.y,width:Math.max(j.w-1,0),height:Math.max(j.h-1,0),fill:j.node.color??i[D%i.length],rx:2}),j.w>40&&j.h>20&&e.jsx("text",{x:j.x+j.w/2,y:j.y+j.h/2,textAnchor:"middle",dominantBaseline:"central",fill:"var(--nice-text-on-primary, #fff)",fontSize:Math.min(12,j.w/6),className:"nice-treemap__label",children:j.node.label})]},j.node.key))})})});Ie.displayName="NiceTreeMap";const rt=Object.freeze(Object.defineProperty({__proto__:null,NiceTreeMap:Ie},Symbol.toStringTag,{value:"Module"})),Te=({regions:t,width:s=600,height:m=400,viewBox:a="0 0 1000 600",colorRange:i=["#dbeafe","#1d4ed8"],maxValue:y,onRegionClick:_,selectedRegionId:S,title:z,showTooltip:w=!0,className:p,style:j})=>{const D=y??Math.max(...t.map(N=>N.value??0),1),A=N=>{const d=h=>[parseInt(h.slice(1,3),16),parseInt(h.slice(3,5),16),parseInt(h.slice(5,7),16)],[o,u,I]=d(i[0]),[g,$,b]=d(i[1]),R=Math.round(o+(g-o)*N),r=Math.round(u+($-u)*N),T=Math.round(I+(b-I)*N);return`rgb(${R},${r},${T})`};return e.jsxs("div",{className:`nice-vectormap ${p||""}`,style:j,children:[z&&e.jsx("div",{className:"nice-vectormap__title",children:z}),e.jsx("svg",{width:s,height:m,viewBox:a,children:t.map(N=>{const d=N.value!=null?Math.max(0,Math.min(1,N.value/D)):0,o=N.value!=null?A(d):"var(--nice-bg-tertiary, #e5e7eb)",u=N.id===S;return e.jsx("path",{d:N.path,fill:o,stroke:u?"var(--nice-color-primary, #3b82f6)":"var(--nice-border-color, #d1d5db)",strokeWidth:u?2:.5,cursor:_?"pointer":void 0,onClick:()=>_?.(N),children:w&&e.jsx("title",{children:`${N.name}${N.value!=null?`: ${N.value}`:""}`})},N.id)})})]})},at=Object.freeze(Object.defineProperty({__proto__:null,NiceVectorMap:Te},Symbol.toStringTag,{value:"Module"})),Be=c.forwardRef(({data:t,renderNode:s,selectable:m,selectedKey:a,onSelect:i,direction:y="top-down",collapsible:_=!0,className:S,style:z,id:w},p)=>{const j=fe.useControlId(w),[D,A]=c.useState(new Set),N=c.useCallback(u=>{A(I=>{const g=new Set(I);return g.has(u)?g.delete(u):g.add(u),g})},[]),d=c.useCallback(u=>{m&&i?.(u)},[m,i]),o=c.useCallback(u=>{const I=D.has(u.key),g=u.children&&u.children.length>0;return e.jsxs("li",{className:"nice-org-chart__item",children:[e.jsxs("div",{className:`nice-org-chart__node${a===u.key?" nice-org-chart__node--selected":""}`,onClick:()=>d(u.key),role:m?"button":void 0,children:[s?s(u):e.jsx("span",{children:u.label}),_&&g&&e.jsx("button",{type:"button",className:"nice-org-chart__toggle",onClick:$=>{$.stopPropagation(),N(u.key)},"aria-label":I?"Expand":"Collapse",children:e.jsx(fe.NiceIcon,{name:I?"plus":"minus",size:14})})]}),g&&!I&&e.jsx("ul",{className:"nice-org-chart__children",children:u.children.map($=>o($))})]},u.key)},[D,a,s,m,_,d,N]);return e.jsx("div",{ref:p,id:j,className:`nice-org-chart nice-org-chart--${y} ${S||""}`,style:z,children:e.jsx("ul",{className:"nice-org-chart__root",children:o(t)})})});Be.displayName="NiceOrganizationChart";const Ee=c.forwardRef(({data:t,type:s="candlestick",showVolume:m=!0,width:a=800,height:i=400,bullColor:y="var(--nice-color-success, #22c55e)",bearColor:_="var(--nice-color-error, #ef4444)",className:S,style:z,id:w},p)=>{const j=fe.useControlId(w),D={top:20,right:20,bottom:m?80:30,left:60},A=a-D.left-D.right,N=m?50:0,d=i-D.top-D.bottom-N,{minP:o,maxP:u,maxVol:I}=c.useMemo(()=>{let r=1/0,T=-1/0,h=0;for(const M of t)M.low<r&&(r=M.low),M.high>T&&(T=M.high),M.volume&&M.volume>h&&(h=M.volume);return{minP:r,maxP:T,maxVol:h}},[t]),g=Math.max(1,A/t.length*.7),$=r=>D.left+(r+.5)*(A/t.length),b=r=>D.top+d-(r-o)/(u-o||1)*d,R=r=>i-D.bottom-N+N*(1-r/(I||1));return e.jsx("div",{ref:p,id:j,className:`nice-stock-chart ${S||""}`,style:z,children:e.jsxs("svg",{width:a,height:i,className:"nice-stock-chart__svg",children:[[0,.25,.5,.75,1].map(r=>{const T=o+r*(u-o);return e.jsxs("g",{children:[e.jsx("line",{x1:D.left,x2:a-D.right,y1:b(T),y2:b(T),stroke:"var(--nice-border, #e5e7eb)",strokeDasharray:"2,2"}),e.jsx("text",{x:D.left-4,y:b(T)+4,textAnchor:"end",fontSize:10,fill:"var(--nice-text-secondary, #888)",children:T.toFixed(2)})]},r)}),s==="line"?e.jsx("polyline",{points:t.map((r,T)=>`${$(T)},${b(r.close)}`).join(" "),fill:"none",stroke:y,strokeWidth:1.5}):t.map((r,T)=>{const h=r.close>=r.open,M=h?y:_,v=$(T);if(s==="ohlc")return e.jsxs("g",{children:[e.jsx("line",{x1:v,x2:v,y1:b(r.high),y2:b(r.low),stroke:M,strokeWidth:1}),e.jsx("line",{x1:v-g/2,x2:v,y1:b(r.open),y2:b(r.open),stroke:M,strokeWidth:1.5}),e.jsx("line",{x1:v,x2:v+g/2,y1:b(r.close),y2:b(r.close),stroke:M,strokeWidth:1.5})]},T);const P=b(Math.max(r.open,r.close)),F=b(Math.min(r.open,r.close));return e.jsxs("g",{children:[e.jsx("line",{x1:v,x2:v,y1:b(r.high),y2:b(r.low),stroke:M,strokeWidth:1}),e.jsx("rect",{x:v-g/2,y:P,width:g,height:Math.max(F-P,1),fill:h?"transparent":M,stroke:M,strokeWidth:1})]},T)}),m&&t.map((r,T)=>{if(!r.volume)return null;const h=r.close>=r.open;return e.jsx("rect",{x:$(T)-g/2,y:R(r.volume),width:g,height:i-D.bottom-R(r.volume),fill:h?y:_,opacity:.3},`v${T}`)}),t.map((r,T)=>T%Math.max(1,Math.floor(t.length/8))!==0?null:e.jsx("text",{x:$(T),y:i-D.bottom+N+14,textAnchor:"middle",fontSize:9,fill:"var(--nice-text-secondary, #888)",children:r.date},`l${T}`))]})})});Ee.displayName="NiceStockChart";const ct=({data:t,width:s=120,height:m=30,type:a="line",color:i="var(--nice-color-primary, #3b82f6)",showMinMax:y,showLastPoint:_=!0,className:S,style:z})=>{if(t.length===0)return null;const w=2,p=Math.min(...t),j=Math.max(...t),D=j-p||1,A=s-w*2,N=m-w*2,d=b=>w+b/(t.length-1||1)*A,o=b=>w+N-(b-p)/D*N;if(a==="bar"){const b=Math.max(1,A/t.length-1);return e.jsx("svg",{width:s,height:m,className:`nice-sparkline ${S||""}`,style:z,children:t.map((R,r)=>e.jsx("rect",{x:w+r/t.length*A,y:o(R),width:b,height:N-(o(R)-w),fill:i,rx:1},r))})}const u=t.map((b,R)=>`${d(R)},${o(b)}`).join(" "),I=t.indexOf(p),g=t.indexOf(j),$=t.length-1;return e.jsxs("svg",{width:s,height:m,className:`nice-sparkline ${S||""}`,style:z,children:[a==="area"&&e.jsx("polygon",{points:`${d(0)},${w+N} ${u} ${d($)},${w+N}`,fill:i,opacity:.15}),e.jsx("polyline",{points:u,fill:"none",stroke:i,strokeWidth:1.5}),y&&e.jsx("circle",{cx:d(I),cy:o(p),r:2,fill:"var(--nice-danger, #ef4444)"}),y&&e.jsx("circle",{cx:d(g),cy:o(j),r:2,fill:"var(--nice-success, #22c55e)"}),_&&e.jsx("circle",{cx:d($),cy:o(t[$]),r:2,fill:i})]})},st=({series:t,categories:s,width:m=400,height:a=400,maxValue:i,title:y,showLegend:_=!0,className:S,style:z})=>{const w=m/2,p=(a-(_?30:0))/2+(y?10:0),j=Math.min(w,p)-60,D=s.length,A=i??Math.max(...t.flatMap(u=>u.data),1),N=Math.PI*2/D,d=5,o=(u,I)=>{const g=u*N-Math.PI/2,$=I/A*j;return{x:w+$*Math.cos(g),y:p+$*Math.sin(g)}};return e.jsx("div",{className:`nice-polarchart ${S||""}`,style:z,children:e.jsxs("svg",{width:m,height:a,className:"nice-polarchart__svg",children:[y&&e.jsx("text",{x:w,y:20,textAnchor:"middle",className:"nice-chart__title",children:y}),Array.from({length:d},(u,I)=>{const g=j*((I+1)/d);return e.jsx("circle",{cx:w,cy:p,r:g,fill:"none",stroke:"var(--nice-border-color, #ddd)",strokeWidth:.5},I)}),s.map((u,I)=>{const g=o(I,A),$=o(I,A*1.22),b=I*N-Math.PI/2,R=Math.cos(b),r=Math.sin(b),T=R>.2?"start":R<-.2?"end":"middle",h=r>.2?"hanging":r<-.2?"auto":"middle";return e.jsxs("g",{children:[e.jsx("line",{x1:w,y1:p,x2:g.x,y2:g.y,stroke:"var(--nice-border-color, #ddd)",strokeWidth:.5}),e.jsx("text",{x:$.x,y:$.y,textAnchor:T,dominantBaseline:h,className:"nice-chart__axis-label nice-chart__axis-label--polar",children:u})]},I)}),t.map((u,I)=>{const g=u.color||ge[I%ge.length],$=u.data.map((b,R)=>{const r=o(R,b);return`${r.x},${r.y}`}).join(" ");return e.jsxs("g",{children:[e.jsx("polygon",{points:$,fill:u.fill!==!1?g:"none",fillOpacity:.15,stroke:g,strokeWidth:2}),u.data.map((b,R)=>{const r=o(R,b);return e.jsx("circle",{cx:r.x,cy:r.y,r:3,fill:g,children:e.jsx("title",{children:`${u.name} - ${s[R]}: ${b}`})},R)})]},u.name)}),_&&e.jsx("g",{transform:`translate(10, ${a-25})`,children:t.map((u,I)=>e.jsxs("g",{transform:`translate(${I*100}, 0)`,children:[e.jsx("rect",{width:10,height:10,rx:2,fill:u.color||ge[I%ge.length]}),e.jsx("text",{x:14,y:9,className:"nice-chart__legend-text",children:u.name})]},I))})]})})},it=({data:t,min:s,max:m,start:a,end:i,onChange:y,width:_=500,height:S=100,step:z=1,formatValue:w,chartColor:p="var(--nice-color-primary, #3b82f6)",className:j,style:D})=>{const A={top:10,bottom:30,left:10,right:10},N=_-A.left-A.right,d=S-A.top-A.bottom,o=R=>A.left+(R-s)/(m-s||1)*N,u=R=>{const r=Math.max(0,Math.min(1,(R-A.left)/N)),T=s+r*(m-s);return Math.round(T/z)*z},I=(R,r)=>{r.preventDefault();const T=r.target.closest("svg");if(!T)return;const h=v=>{const P=T.getBoundingClientRect(),F=u(v.clientX-P.left);R==="start"?y(Math.min(F,i),i):y(a,Math.max(F,a))},M=()=>{document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",M)};document.addEventListener("pointermove",h),document.addEventListener("pointerup",M)},g=t?Math.min(...t):0,b=(t?Math.max(...t):1)-g||1;return e.jsx("div",{className:`nice-rangeselector ${j||""}`,style:D,children:e.jsxs("svg",{width:_,height:S,children:[t&&t.length>1&&e.jsx("polygon",{points:`${A.left},${A.top+d} ${t.map((R,r)=>`${A.left+r/(t.length-1)*N},${A.top+d-(R-g)/b*d}`).join(" ")} ${A.left+N},${A.top+d}`,fill:p,opacity:.15}),e.jsx("rect",{x:o(a),y:A.top,width:o(i)-o(a),height:d,fill:p,opacity:.1}),e.jsx("rect",{x:A.left,y:A.top,width:o(a)-A.left,height:d,fill:"var(--nice-bg-secondary, #f5f5f5)",opacity:.6}),e.jsx("rect",{x:o(i),y:A.top,width:A.left+N-o(i),height:d,fill:"var(--nice-bg-secondary, #f5f5f5)",opacity:.6}),e.jsx("rect",{x:o(a)-4,y:A.top,width:8,height:d,fill:p,rx:2,cursor:"ew-resize",onPointerDown:R=>I("start",R)}),e.jsx("rect",{x:o(i)-4,y:A.top,width:8,height:d,fill:p,rx:2,cursor:"ew-resize",onPointerDown:R=>I("end",R)}),e.jsx("text",{x:o(a),y:A.top+d+18,textAnchor:"middle",className:"nice-chart__axis-label",children:w?w(a):a}),e.jsx("text",{x:o(i),y:A.top+d+18,textAnchor:"middle",className:"nice-chart__axis-label",children:w?w(i):i})]})})},ot=`
|
|
7
|
+
.nice-forecast-chart {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
11
|
+
border: 1px solid var(--nice-border-color, #e5e7eb);
|
|
12
|
+
border-radius: var(--nice-radius-lg, 0.5rem);
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.nice-forecast-chart__header {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
padding: 0.75rem 1rem;
|
|
21
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.nice-forecast-chart__title {
|
|
25
|
+
font-size: 1rem;
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
color: var(--nice-text-primary);
|
|
28
|
+
margin: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.nice-forecast-chart__actions {
|
|
32
|
+
display: flex;
|
|
33
|
+
gap: 0.5rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.nice-forecast-chart__btn {
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
width: 2rem;
|
|
41
|
+
height: 2rem;
|
|
42
|
+
font-size: 1rem;
|
|
43
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
transition: all 0.15s ease;
|
|
46
|
+
border: 1px solid var(--nice-border-color, #d1d5db);
|
|
47
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
48
|
+
color: var(--nice-text-secondary);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.nice-forecast-chart__btn:hover {
|
|
52
|
+
background: var(--nice-bg-hover, #f3f4f6);
|
|
53
|
+
color: var(--nice-text-primary);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.nice-forecast-chart__btn:disabled {
|
|
57
|
+
opacity: 0.5;
|
|
58
|
+
cursor: not-allowed;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.nice-forecast-chart__container {
|
|
62
|
+
position: relative;
|
|
63
|
+
width: 100%;
|
|
64
|
+
padding: 1rem;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.nice-forecast-chart__svg {
|
|
68
|
+
width: 100%;
|
|
69
|
+
overflow: visible;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.nice-forecast-chart__grid-line {
|
|
73
|
+
stroke: var(--nice-border-divider, #f3f4f6);
|
|
74
|
+
stroke-width: 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.nice-forecast-chart__axis-line {
|
|
78
|
+
stroke: var(--nice-border-color, #e5e7eb);
|
|
79
|
+
stroke-width: 1;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.nice-forecast-chart__axis-label {
|
|
83
|
+
font-size: 0.6875rem;
|
|
84
|
+
fill: var(--nice-text-secondary);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.nice-forecast-chart__axis-title {
|
|
88
|
+
font-size: 0.75rem;
|
|
89
|
+
font-weight: 500;
|
|
90
|
+
fill: var(--nice-text-primary);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.nice-forecast-chart__historical-line {
|
|
94
|
+
fill: none;
|
|
95
|
+
stroke-width: 2;
|
|
96
|
+
stroke-linecap: round;
|
|
97
|
+
stroke-linejoin: round;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.nice-forecast-chart__forecast-line {
|
|
101
|
+
fill: none;
|
|
102
|
+
stroke-width: 2;
|
|
103
|
+
stroke-linecap: round;
|
|
104
|
+
stroke-linejoin: round;
|
|
105
|
+
stroke-dasharray: 6, 4;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.nice-forecast-chart__confidence-band {
|
|
109
|
+
opacity: 0.2;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.nice-forecast-chart__forecast-region {
|
|
113
|
+
fill: var(--nice-bg-secondary, #f9fafb);
|
|
114
|
+
opacity: 0.5;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.nice-forecast-chart__point {
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
transition: r 0.15s ease;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.nice-forecast-chart__point:hover {
|
|
123
|
+
r: 6;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.nice-forecast-chart__annotation-line {
|
|
127
|
+
stroke-dasharray: 4, 2;
|
|
128
|
+
stroke-width: 1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.nice-forecast-chart__annotation-marker {
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
transition: transform 0.15s ease;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.nice-forecast-chart__annotation-marker:hover {
|
|
137
|
+
transform: scale(1.2);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.nice-forecast-chart__reference-line {
|
|
141
|
+
stroke-width: 1;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.nice-forecast-chart__reference-label {
|
|
145
|
+
font-size: 0.625rem;
|
|
146
|
+
fill: var(--nice-text-secondary);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.nice-forecast-chart__cash-runway {
|
|
150
|
+
pointer-events: none;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.nice-forecast-chart__cash-runway-line {
|
|
154
|
+
stroke: var(--nice-danger, #ef4444);
|
|
155
|
+
stroke-width: 2;
|
|
156
|
+
stroke-dasharray: 8, 4;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.nice-forecast-chart__cash-runway-label-bg {
|
|
160
|
+
fill: var(--nice-danger, #ef4444);
|
|
161
|
+
rx: 4;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.nice-forecast-chart__cash-runway-label {
|
|
165
|
+
font-size: 0.6875rem;
|
|
166
|
+
font-weight: 600;
|
|
167
|
+
fill: var(--nice-bg, #FFFFFF);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.nice-forecast-chart__cash-runway-date {
|
|
171
|
+
font-size: 0.625rem;
|
|
172
|
+
fill: var(--nice-danger, #ef4444);
|
|
173
|
+
font-weight: 500;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.nice-forecast-chart__tooltip {
|
|
177
|
+
position: absolute;
|
|
178
|
+
pointer-events: none;
|
|
179
|
+
z-index: 100;
|
|
180
|
+
padding: 0.75rem;
|
|
181
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
182
|
+
border: 1px solid var(--nice-border-color, #e5e7eb);
|
|
183
|
+
border-radius: var(--nice-radius-lg, 0.5rem);
|
|
184
|
+
box-shadow: 0 4px 12px var(--nice-overlay-10, rgba(0, 0, 0, 0.1));
|
|
185
|
+
font-size: 0.8125rem;
|
|
186
|
+
max-width: 250px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.nice-forecast-chart__tooltip-date {
|
|
190
|
+
font-weight: 600;
|
|
191
|
+
color: var(--nice-text-primary);
|
|
192
|
+
margin-bottom: 0.5rem;
|
|
193
|
+
padding-bottom: 0.5rem;
|
|
194
|
+
border-bottom: 1px solid var(--nice-border-divider, #f3f4f6);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.nice-forecast-chart__tooltip-item {
|
|
198
|
+
display: flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
gap: 0.5rem;
|
|
201
|
+
margin-bottom: 0.25rem;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.nice-forecast-chart__tooltip-color {
|
|
205
|
+
width: 10px;
|
|
206
|
+
height: 10px;
|
|
207
|
+
border-radius: var(--nice-radius-sm, 2px);
|
|
208
|
+
flex-shrink: 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.nice-forecast-chart__tooltip-label {
|
|
212
|
+
color: var(--nice-text-secondary);
|
|
213
|
+
flex: 1;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.nice-forecast-chart__tooltip-value {
|
|
217
|
+
font-weight: 600;
|
|
218
|
+
color: var(--nice-text-primary);
|
|
219
|
+
font-variant-numeric: tabular-nums;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.nice-forecast-chart__tooltip-confidence {
|
|
223
|
+
font-size: 0.75rem;
|
|
224
|
+
color: var(--nice-text-tertiary);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.nice-forecast-chart__legend {
|
|
228
|
+
display: flex;
|
|
229
|
+
flex-wrap: wrap;
|
|
230
|
+
gap: 1rem;
|
|
231
|
+
padding: 0.75rem 1rem;
|
|
232
|
+
border-top: 1px solid var(--nice-border-color, #e5e7eb);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.nice-forecast-chart__legend-item {
|
|
236
|
+
display: flex;
|
|
237
|
+
align-items: center;
|
|
238
|
+
gap: 0.375rem;
|
|
239
|
+
font-size: 0.8125rem;
|
|
240
|
+
color: var(--nice-text-secondary);
|
|
241
|
+
cursor: pointer;
|
|
242
|
+
user-select: none;
|
|
243
|
+
transition: opacity 0.15s ease;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.nice-forecast-chart__legend-item:hover {
|
|
247
|
+
color: var(--nice-text-primary);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.nice-forecast-chart__legend-item--hidden {
|
|
251
|
+
opacity: 0.4;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.nice-forecast-chart__legend-color {
|
|
255
|
+
width: 16px;
|
|
256
|
+
height: 3px;
|
|
257
|
+
border-radius: var(--nice-radius-xs, 1px);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.nice-forecast-chart__legend-color--dashed {
|
|
261
|
+
background: repeating-linear-gradient(
|
|
262
|
+
90deg,
|
|
263
|
+
currentColor,
|
|
264
|
+
currentColor 4px,
|
|
265
|
+
transparent 4px,
|
|
266
|
+
transparent 6px
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.nice-forecast-chart__empty {
|
|
271
|
+
display: flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
justify-content: center;
|
|
274
|
+
height: 300px;
|
|
275
|
+
color: var(--nice-text-secondary);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Dark mode */
|
|
279
|
+
.dark .nice-forecast-chart {
|
|
280
|
+
background: var(--nice-bg-primary-dark, #111827);
|
|
281
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.dark .nice-forecast-chart__tooltip {
|
|
285
|
+
background: var(--nice-bg-secondary-dark, #1f2937);
|
|
286
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.dark .nice-forecast-chart__forecast-region {
|
|
290
|
+
fill: var(--nice-bg-secondary-dark, #1f2937);
|
|
291
|
+
}
|
|
292
|
+
`,ze=["var(--nice-color-primary, #3b82f6)","var(--nice-color-success, #10b981)","var(--nice-color-warning, #f59e0b)","var(--nice-color-error, #ef4444)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-accent-pink, #ec4899)","var(--nice-color-info, #06b6d4)","var(--nice-warning, #f97316)"];function pe(t){return t instanceof Date?t:new Date(t)}function Ce(t,s="pl-PL"){return t.toLocaleDateString(s,{year:"numeric",month:"short",day:"numeric"})}function Me(t,s="pl-PL"){return new Intl.NumberFormat(s,{minimumFractionDigits:0,maximumFractionDigits:2}).format(t)}const lt=c.forwardRef(function(s,m){const{scenarios:a,data:i,annotations:y=[],referenceLines:_=[],forecastStartDate:S,cashRunway:z,xAxis:w,yAxis:p,confidenceBands:j=[{level:95,color:"var(--nice-color-primary, #3b82f6)",opacity:.15}],tooltip:D,legend:A={enabled:!0,position:"bottom",interactive:!0},height:N=350,showForecastRegion:d=!0,lineWidth:o=2,showPoints:u=!1,pointRadius:I=4,enableZoom:g=!1,zoomEnabled:$,animationDuration:b=300,showLegend:R,responsive:r=!0,onPointClick:T,onAnnotationClick:h,onScenarioToggle:M,onViewportChange:v,size:P="medium",disabled:F=!1,labels:V={},locale:X="pl-PL",className:B,style:Z}=s,Y=a&&a.length>0?a:i?[{id:"default",name:"Series",data:i}]:[],J={...A,enabled:R??A.enabled},[x,re]=c.useState(()=>Y.map((n,O)=>({...n,color:n.color??ze[O%ze.length],visible:n.visible!==!1}))),[Q,ee]=c.useState(null),[U,se]=c.useState({x:0,y:0}),E=c.useRef(null),f=c.useRef(null),l={top:20,right:30,bottom:40,left:60},[L,te]=c.useState({width:600,height:typeof N=="number"?N:350});c.useEffect(()=>{if(!r||!E.current)return;const n=new ResizeObserver(O=>{for(const W of O)te(C=>({width:W.contentRect.width,height:C.height}))});return n.observe(E.current),()=>n.disconnect()},[r]),c.useEffect(()=>{const n="nice-forecast-chart-styles";if(!document.getElementById(n)){const O=document.createElement("style");O.id=n,O.textContent=ot,document.head.appendChild(O)}},[]);const{xScale:ce,yScale:H,allDates:ie,minY:he,maxY:ve}=c.useMemo(()=>{const O=x.filter(me=>me.visible!==!1).flatMap(me=>me.data);if(O.length===0)return{xScale:()=>0,yScale:()=>0,allDates:[],minY:0,maxY:100};const W=O.map(me=>pe(me.date).getTime()),C=Math.min(...W),K=Math.max(...W),de=O.flatMap(me=>[me.value,me.forecast,me.lowerBound,me.upperBound]).filter(me=>me!=null),ue=p?.min??Math.min(...de)*.95,xe=p?.max??Math.max(...de)*1.05,_e=L.width-l.left-l.right,je=L.height-l.top-l.bottom,we=me=>{const Se=typeof me=="number"?me:me.getTime();return l.left+(Se-C)/(K-C)*_e},$e=me=>l.top+je-(me-ue)/(xe-ue)*je,He=[...new Set(W)].sort((me,Se)=>me-Se).map(me=>new Date(me));return{xScale:we,yScale:$e,allDates:He,minY:ue,maxY:xe}},[x,L,l,p]),be=S?pe(S):null,ye=c.useMemo(()=>{if(!z?.enabled)return null;const n=z.threshold??0,O=z.scenarioId?x.find(C=>C.id===z.scenarioId&&C.visible!==!1):x.find(C=>C.visible!==!1);if(!O)return null;const W=O.data.sort((C,K)=>pe(C.date).getTime()-pe(K.date).getTime());for(let C=1;C<W.length;C++){const K=W[C-1],de=W[C],ue=K.forecast??K.value,xe=de.forecast??de.value;if(ue!=null&&xe!=null&&ue>n&&xe<=n){const _e=(ue-n)/(ue-xe),je=pe(K.date).getTime(),we=pe(de.date).getTime(),$e=je+_e*(we-je);return new Date($e)}}return null},[z,x]),q=c.useCallback((n,O)=>{const W=n.filter(C=>C[O]!=null).map(C=>({x:ce(pe(C.date)),y:H(C[O])}));return W.length===0?"":`M ${W.map(C=>`${C.x},${C.y}`).join(" L ")}`},[ce,H]),ae=c.useCallback(n=>{const O=n.filter(K=>K.lowerBound!=null&&K.upperBound!=null);if(O.length===0)return"";const W=O.map(K=>({x:ce(pe(K.date)),y:H(K.upperBound)})),C=O.map(K=>({x:ce(pe(K.date)),y:H(K.lowerBound)})).reverse();return`M ${W.map(K=>`${K.x},${K.y}`).join(" L ")} L ${C.map(K=>`${K.x},${K.y}`).join(" L ")} Z`},[ce,H]),k=c.useCallback(n=>{if(!f.current||D?.enabled===!1)return;const O=f.current.getBoundingClientRect(),W=n.clientX-O.left;n.clientY-O.top;let C=null,K=1/0;for(const de of ie){const ue=ce(de),xe=Math.abs(ue-W);xe<K&&(K=xe,C=de)}if(C&&K<50){const de=x.filter(xe=>xe.visible!==!1).map(xe=>{const _e=xe.data.find(je=>pe(je.date).getTime()===C.getTime());return{scenario:xe,value:_e?.value,forecast:_e?.forecast,lowerBound:_e?.lowerBound,upperBound:_e?.upperBound}}),ue=y.filter(xe=>Math.abs(pe(xe.date).getTime()-C.getTime())<864e5);ee({date:C,values:de,annotations:ue}),se({x:n.clientX-O.left+10,y:n.clientY-O.top-10})}else ee(null)},[ce,ie,x,y,D]),G=c.useCallback(n=>{if(!J.interactive)return;re(W=>W.map(C=>C.id===n?{...C,visible:!C.visible}:C));const O=x.find(W=>W.id===n);O&&M?.(n,!O.visible)},[J.interactive,x,M]);c.useImperativeHandle(m,()=>({getScenarios:()=>x,updateScenario:(n,O)=>{re(W=>W.map(C=>C.id===n?{...C,data:O}:C))},toggleScenario:G,setZoomRange:()=>{},resetZoom:()=>{},exportImage:n=>{if(!f.current)return null;const O=f.current,C=new XMLSerializer().serializeToString(O);return`data:image/svg+xml;base64,${btoa(C)}`},getDataAtDate:n=>{const O=x.filter(W=>W.visible!==!1).map(W=>{const C=W.data.find(K=>pe(K.date).getTime()===n.getTime());return{scenario:W,value:C?.value,forecast:C?.forecast,lowerBound:C?.lowerBound,upperBound:C?.upperBound}});return{date:n,values:O,annotations:y.filter(W=>pe(W.date).getTime()===n.getTime())}}}),[x,y,G]),L.width-l.left-l.right;const ne=L.height-l.top-l.bottom,oe=c.useMemo(()=>{const n=p?.tickCount??5,O=[],W=(ve-he)/(n-1);for(let C=0;C<n;C++)O.push(he+W*C);return O},[he,ve,p?.tickCount]),le=c.useMemo(()=>{const n=w?.tickCount??6;if(ie.length===0)return[];const O=Math.max(1,Math.floor(ie.length/(n-1)));return ie.filter((W,C)=>C%O===0||C===ie.length-1)},[ie,w?.tickCount]);return x.length===0||x.every(n=>n.data.length===0)?e.jsx("div",{className:`nice-forecast-chart ${B??""}`,style:Z,children:e.jsx("div",{className:"nice-forecast-chart__empty",children:V.noData??"No data available"})}):e.jsxs("div",{className:`nice-forecast-chart ${B??""}`,style:{...Z,height:N},children:[e.jsxs("div",{ref:E,className:"nice-forecast-chart__container",children:[e.jsxs("svg",{ref:f,className:"nice-forecast-chart__svg",width:L.width,height:L.height,onMouseMove:k,onMouseLeave:()=>ee(null),children:[p?.showGrid!==!1&&oe.map(n=>e.jsx("line",{className:"nice-forecast-chart__grid-line",x1:l.left,x2:L.width-l.right,y1:H(n),y2:H(n)},n)),d&&be&&e.jsx("rect",{className:"nice-forecast-chart__forecast-region",x:ce(be),y:l.top,width:L.width-l.right-ce(be),height:ne}),_.map(n=>e.jsxs("g",{children:[e.jsx("line",{className:"nice-forecast-chart__reference-line",x1:l.left,x2:L.width-l.right,y1:H(n.value),y2:H(n.value),stroke:n.color??"var(--nice-text-muted, #9ca3af)",strokeDasharray:n.dashArray??"4,2"}),n.label&&e.jsx("text",{className:"nice-forecast-chart__reference-label",x:L.width-l.right-4,y:H(n.value)-4,textAnchor:"end",children:n.label})]},n.id)),ye&&z?.enabled&&e.jsxs("g",{className:"nice-forecast-chart__cash-runway",children:[e.jsx("line",{className:"nice-forecast-chart__cash-runway-line",x1:ce(ye),x2:ce(ye),y1:l.top,y2:L.height-l.bottom,stroke:z.color??"var(--nice-color-error, #ef4444)"}),z.showLabel!==!1&&e.jsxs(e.Fragment,{children:[e.jsx("rect",{className:"nice-forecast-chart__cash-runway-label-bg",x:ce(ye)-60,y:l.top-2,width:120,height:z.showDate!==!1?32:20,fill:z.color??"var(--nice-color-error, #ef4444)",rx:4}),e.jsx("text",{className:"nice-forecast-chart__cash-runway-label",x:ce(ye),y:l.top+12,textAnchor:"middle",fill:"var(--nice-text-on-primary, #fff)",children:z.label??V.cashRunsOut??"Cash runs out"}),z.showDate!==!1&&e.jsx("text",{className:"nice-forecast-chart__cash-runway-label",x:ce(ye),y:l.top+26,textAnchor:"middle",fill:"var(--nice-text-on-primary, #fff)",style:{fontSize:"0.625rem",opacity:.9},children:Ce(ye,X)})]})]}),x.filter(n=>n.visible!==!1&&n.showConfidenceBand).map(n=>e.jsx("path",{className:"nice-forecast-chart__confidence-band",d:ae(n.data),fill:n.color},`band-${n.id}`)),x.filter(n=>n.visible!==!1).map(n=>{const O=be?n.data.filter(C=>pe(C.date)<be):n.data.filter(C=>C.value!=null),W=be?n.data.filter(C=>pe(C.date)>=be):n.data.filter(C=>C.forecast!=null);return e.jsxs("g",{children:[e.jsx("path",{className:"nice-forecast-chart__historical-line",d:q(O,"value"),stroke:n.color,strokeWidth:o}),e.jsx("path",{className:"nice-forecast-chart__forecast-line",d:q(W,be?"value":"forecast"),stroke:n.color,strokeWidth:o}),W.length>0&&n.data.some(C=>C.forecast!=null)&&e.jsx("path",{className:"nice-forecast-chart__forecast-line",d:q(n.data,"forecast"),stroke:n.color,strokeWidth:o}),u&&n.data.map((C,K)=>{const de=C.value??C.forecast;return de==null?null:e.jsx("circle",{className:"nice-forecast-chart__point",cx:ce(pe(C.date)),cy:H(de),r:I,fill:n.color,onClick:()=>T?.(C,n)},K)})]},n.id)}),y.map(n=>{const O=ce(pe(n.date));return e.jsxs("g",{className:"nice-forecast-chart__annotation-marker",onClick:()=>h?.(n),children:[n.showLine!==!1&&e.jsx("line",{className:"nice-forecast-chart__annotation-line",x1:O,x2:O,y1:l.top,y2:L.height-l.bottom,stroke:n.color??"var(--nice-text-muted, #9ca3af)"}),e.jsx("circle",{cx:O,cy:l.top+10,r:8,fill:n.color??"var(--nice-text-muted, #9ca3af)"}),e.jsx("text",{x:O,y:l.top+14,textAnchor:"middle",fill:"white",fontSize:"10",children:n.icon??"!"})]},n.id)}),e.jsx("line",{className:"nice-forecast-chart__axis-line",x1:l.left,x2:l.left,y1:l.top,y2:L.height-l.bottom}),e.jsx("line",{className:"nice-forecast-chart__axis-line",x1:l.left,x2:L.width-l.right,y1:L.height-l.bottom,y2:L.height-l.bottom}),oe.map(n=>e.jsx("text",{className:"nice-forecast-chart__axis-label",x:l.left-8,y:H(n)+4,textAnchor:"end",children:p?.format?p.format(n):Me(n,X)},n)),le.map(n=>e.jsx("text",{className:"nice-forecast-chart__axis-label",x:ce(n),y:L.height-l.bottom+16,textAnchor:"middle",children:w?.format?w.format(n):Ce(n,X)},n.getTime())),p?.title&&e.jsx("text",{className:"nice-forecast-chart__axis-title",x:15,y:L.height/2,textAnchor:"middle",transform:`rotate(-90, 15, ${L.height/2})`,children:p.title})]}),Q&&e.jsxs("div",{className:"nice-forecast-chart__tooltip",style:{left:U.x,top:U.y},children:[e.jsx("div",{className:"nice-forecast-chart__tooltip-date",children:Ce(Q.date,X)}),Q.values.map(n=>{const O=n.value??n.forecast;return O==null?null:e.jsxs("div",{className:"nice-forecast-chart__tooltip-item",children:[e.jsx("span",{className:"nice-forecast-chart__tooltip-color",style:{background:n.scenario.color}}),e.jsx("span",{className:"nice-forecast-chart__tooltip-label",children:n.scenario.name}),e.jsx("span",{className:"nice-forecast-chart__tooltip-value",children:Me(O,X)})]},n.scenario.id)}),Q.values.some(n=>n.lowerBound!=null)&&e.jsxs("div",{className:"nice-forecast-chart__tooltip-confidence",children:[V.confidence??"CI",":"," ",Me(Q.values[0]?.lowerBound??0,X)," –"," ",Me(Q.values[0]?.upperBound??0,X)]})]})]}),J.enabled&&e.jsx("div",{className:"nice-forecast-chart__legend",children:x.map(n=>e.jsxs("div",{className:`nice-forecast-chart__legend-item ${n.visible===!1?"nice-forecast-chart__legend-item--hidden":""}`,onClick:()=>G(n.id),children:[e.jsx("span",{className:`nice-forecast-chart__legend-color ${n.isBase?"":"nice-forecast-chart__legend-color--dashed"}`,style:{background:n.color}}),n.name]},n.id))})]})});function dt(t,s){const m=t?typeof t=="number"?new Date(t):new Date(t):new Date,a=z=>z.toString().padStart(2,"0"),i=a(m.getHours()),y=a(m.getMinutes()),_=a(m.getSeconds()),S=m.getMilliseconds().toString().padStart(3,"0");switch(s){case"HH:mm:ss":return`${i}:${y}:${_}`;case"HH:mm":return`${i}:${y}`;case"mm:ss":return`${y}:${_}`;case"ss.SSS":return`${_}.${S}`;case"ISO":return m.toISOString();default:return`${i}:${y}:${_}`}}function Re(t){if(t.length===0)return null;const s=Math.min(...t),m=Math.max(...t),a=t.reduce((y,_)=>y+_,0)/t.length,i=t[t.length-1];return{min:s,max:m,avg:a,current:i,count:t.length}}const Oe=c.forwardRef(({series:t,maxPoints:s=100,slidingWindow:m=!0,refreshRate:a=16,dataSource:i,width:y=600,height:_=400,title:S,showLegend:z=!0,showGrid:w=!0,yAxisLabel:p,xAxisLabel:j,stacked:D,zoomable:A,crosshair:N,annotations:d=[],legendInteractive:o,onDataPointClick:u,exportable:I,showControls:g=!0,showStatus:$=!0,initialPaused:b=!1,onDataReceived:R,onDataDropped:r,timeFormat:T="HH:mm:ss",showStats:h,thresholds:M=[],className:v,style:P},F)=>{const[V,X]=c.useState(()=>{const q=new Map;for(const ae of t)q.set(ae.name,ae.initialData?.slice()??[]);return q}),[B,Z]=c.useState([]),[Y,J]=c.useState(b),[x,re]=c.useState(!1),Q=c.useRef([]),ee=c.useRef(Date.now()),U=c.useRef(null),se=c.useRef(new Map),E=c.useRef(0),f=JSON.stringify(t.map(q=>q.name)),l=c.useMemo(()=>new Set(JSON.parse(f)),[f]),L=c.useRef(Y),te=c.useRef(R),ce=c.useRef(r);c.useEffect(()=>{L.current=Y,te.current=R,ce.current=r});const H=c.useCallback(()=>{const q=Q.current;if(q.length===0)return;Q.current=[],X(k=>{const G=new Map(k);for(const ne of q){const oe=G.get(ne.series);if(!oe)continue;const le=[...oe,ne.value];if(m&&le.length>s){const n=le.length-s;ce.current?.(n,ne.series),le.splice(0,n)}G.set(ne.series,le)}return G});const ae=[];for(const k of q){if(!l.has(k.series))continue;const G=(se.current.get(k.series)??0)+1;se.current.set(k.series,G),G>E.current&&(E.current=G,ae.push(k.category??dt(k.timestamp,T)))}ae.length>0&&Z(k=>{const G=[...k,...ae];return m&&G.length>s&&G.splice(0,G.length-s),G})},[m,s,T,l]),ie=c.useCallback(()=>{const q=Date.now();q-ee.current>=a&&(H(),ee.current=q),U.current=requestAnimationFrame(ie)},[a,H]);c.useEffect(()=>(Y||(U.current=requestAnimationFrame(ie)),()=>{U.current!==null&&(cancelAnimationFrame(U.current),U.current=null)}),[Y,ie]);const he=c.useCallback(q=>{if(L.current)return;const ae="points"in q?q.points:[q];for(const k of ae)l.has(k.series)&&(Q.current.push(k),te.current?.(k))},[l]);c.useEffect(()=>{if(!i)return;const q=i.subscribe(he);let ae;return i.onStatusChange?ae=i.onStatusChange(re):re(!0),i.fetchHistory&&i.fetchHistory(s).then(k=>{for(const G of k)Q.current.push(G);H()}),()=>{q(),ae?.()}},[i,he,s,H]);const ve=c.useMemo(()=>t.map(q=>({name:q.name,color:q.color,type:q.type,data:V.get(q.name)??[]})),[t,V]),be=c.useMemo(()=>{const q=[...d];for(const ae of M)q.push({type:"line",value:ae.value,color:ae.color,label:ae.label,dash:ae.style==="dashed"?"5,5":ae.style==="dotted"?"2,2":void 0});return q},[d,M]);c.useImperativeHandle(F,()=>({pause(){J(!0)},resume(){J(!1)},isPaused(){return Y},clear(){X(q=>{const ae=new Map(q);for(const k of ae.keys())ae.set(k,[]);return ae}),Z([]),se.current=new Map,E.current=0,Q.current=[]},addPoint(q){he(q)},addPoints(q){he({points:q})},getData(q){return V.get(q)??[]},getCategories(){return B},exportData(){return{series:ve,categories:B}},getStats(q){const ae=V.get(q);return ae?Re(ae):null}}),[Y,V,B,ve,he]);const ye=c.useMemo(()=>{if(!h)return null;const q={};for(const[ae,k]of V)q[ae]=Re(k);return q},[h,V]);return e.jsxs("div",{className:v,style:{position:"relative",...P},children:[$&&e.jsxs("div",{style:{position:"absolute",top:8,right:8,display:"flex",alignItems:"center",gap:4,fontSize:12,color:x?"var(--nice-color-success, #22c55e)":"var(--nice-color-error, #ef4444)",zIndex:10},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:x?"var(--nice-color-success, #22c55e)":"var(--nice-color-error, #ef4444)"}}),x?"Live":"Disconnected"]}),g&&e.jsx("div",{style:{position:"absolute",top:8,left:8,display:"flex",gap:4,zIndex:10},children:e.jsx("button",{onClick:()=>J(q=>!q),style:{padding:"4px 8px",fontSize:12,border:"1px solid var(--nice-border-color, #ddd)",borderRadius:4,background:Y?"var(--nice-warning-bg, #fef3c7)":"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"},title:Y?"Resume":"Pause","aria-label":Y?"Resume":"Pause",children:e.jsx(fe.NiceIcon,{name:Y?"play":"pause",size:14})})}),h&&ye&&e.jsx("div",{style:{position:"absolute",bottom:50,right:8,background:"color-mix(in srgb, var(--nice-bg-elevated, #fff) 92%, transparent)",color:"var(--nice-text-primary, #0f172a)",border:"1px solid var(--nice-border-color, #ddd)",borderRadius:4,padding:8,fontSize:11,zIndex:10},children:Object.entries(ye).map(([q,ae])=>ae?e.jsxs("div",{style:{marginBottom:4},children:[e.jsx("strong",{children:q}),e.jsxs("div",{children:["Min: ",ae.min.toFixed(2)," | Max: ",ae.max.toFixed(2)]}),e.jsxs("div",{children:["Avg: ",ae.avg.toFixed(2)," | Now: ",ae.current.toFixed(2)]})]},q):null)}),e.jsx(ke,{series:ve,categories:B,width:y,height:_,title:S,showLegend:z,showGrid:w,yAxisLabel:p,xAxisLabel:j,stacked:D,zoomable:A,crosshair:N,annotations:be,legendInteractive:o,onDataPointClick:u,exportable:I})]})});Oe.displayName="NiceLiveChart";function ht(t){const{hubConnection:s,eventName:m="DataPoint",subscribeMethod:a="SubscribeToMetrics",historyMethod:i="GetMetricHistory",metricName:y}=t;return{subscribe(_){const S=z=>{_(z)};return s.on(m,S),s.state==="Connected"&&s.invoke(a,y).catch(()=>{}),()=>{s.off(m,S)}},async fetchHistory(_){try{return await s.invoke(i,y,_)}catch{return[]}},onStatusChange(_){const S=()=>_(s.state==="Connected");return s.onclose(()=>_(!1)),s.onreconnected(()=>_(!0)),S(),()=>{}}}}function ut(t){const{url:s,autoReconnect:m=!0,reconnectDelay:a=3e3,parseMessage:i=p=>JSON.parse(p)}=t;let y=null,_=null,S=null,z=null;const w=()=>{y=new WebSocket(s),y.onopen=()=>{_?.(!0)},y.onclose=()=>{_?.(!1),m&&(z=setTimeout(w,a))},y.onerror=()=>{y?.close()},y.onmessage=p=>{try{const j=i(p.data);j&&S&&S(j)}catch{}}};return{subscribe(p){return S=p,w(),()=>{S=null,z&&clearTimeout(z),y?.close(),y=null}},onStatusChange(p){return _=p,()=>{_=null}}}}function ft(t){const{seriesNames:s,interval:m=1e3,generateValue:a=()=>Math.random()*100}=t;let i=null,y=0;return{subscribe(_){return i=setInterval(()=>{for(const S of s)_({series:S,value:a(S,y),timestamp:Date.now()});y++},m),()=>{i&&clearInterval(i)}},onStatusChange(_){return _(!0),()=>{}}}}function xt(t){if(!t.length)return{categories:[],numericFields:[],sampleValues:{}};const s=t[0],m=[],a={};let i=null;for(const[_,S]of Object.entries(s))typeof S=="number"?(m.push(_),a[_]=t.map(z=>Number(z[_])||0)):!i&&(typeof S=="string"||S instanceof Date)&&(i=_);return{categories:i?t.map(_=>String(_[i]||"")):t.map((_,S)=>`Item ${S+1}`),numericFields:m,sampleValues:a}}function mt(t,s){const{categories:m,numericFields:a,sampleValues:i}=xt(t);return{series:a.map((_,S)=>({name:_.replace(/([A-Z])/g," $1").replace(/^./,z=>z.toUpperCase()).trim(),data:i[_],type:s==="area"?"area":s==="line"?"line":"bar"})),categories:m}}const pt=c.forwardRef(function(s,m){const{rawData:a,enableAI:i=!0,aiModel:y,enableAutoType:_=!0,enableInsights:S=!0,dataDescription:z,onChartSuggestion:w,onInsights:p,showAIToolbar:j=!0,showInsightsOnLoad:D=!1,series:A,categories:N,...d}=s,[o,u]=c.useState("bar"),[I,g]=c.useState(null),[$,b]=c.useState([]),[R,r]=c.useState(D),[T,h]=c.useState(null),{t:M}=Ye.useNiceTranslation(),v=fe.useNiceAI(),{suggestChartType:P,generateInsights:F,isLoading:V}=fe.useChartSuggestion(),X=i&&v.isConfigured,{series:B,categories:Z}=a?mt(a,T||o):{series:A||[],categories:N},Y=c.useCallback(async()=>{if(!X||!_)return{type:"bar",reason:"Default",config:{}};const ee=a||(A?.length?A.flatMap(U=>U.data.map((se,E)=>({[U.name]:se,index:E}))):[]);try{const U=await P(ee,z),se={type:U.type,reason:U.reason,config:U.config};return g(se),u(se.type),w?.(se),se}catch{return{type:"bar",reason:"Default fallback",config:{}}}},[X,_,a,A,z,P,w]),J=c.useCallback(async()=>{if(!X||!S)return[];const ee=a||(A?.length?A.flatMap(U=>U.data.map((se,E)=>({[U.name]:se,category:N?.[E]||E}))):[]);try{const U=await F(ee,T||o);return b(U),p?.(U),U}catch{return[]}},[X,S,a,A,N,o,T,F,p]),x=c.useCallback(()=>T||o,[T,o]);c.useEffect(()=>{X&&_&&(a?.length||A?.length)&&Y()},[X,_,a,A]),c.useImperativeHandle(m,()=>({getSuggestion:Y,generateInsights:J,getCurrentType:x}));const re=[{type:"bar",icon:"bar-chart",label:"Bar"},{type:"line",icon:"line-chart",label:"Line"},{type:"area",icon:"area-chart",label:"Area"},{type:"pie",icon:"pie-chart",label:"Pie"},{type:"donut",icon:"donut-chart",label:"Donut"},{type:"scatter",icon:"scatter-chart",label:"Scatter"}],Q=T||o;return e.jsxs("div",{className:"nice-chart-ai","data-testid":s["data-testid"],children:[j&&X&&e.jsxs("div",{className:"nice-chart-ai__toolbar",children:[e.jsxs("div",{className:"nice-chart-ai__toolbar-left",children:[e.jsx("span",{className:"nice-chart-ai__badge",children:"AI"}),I&&e.jsxs("div",{className:"nice-chart-ai__suggestion",children:[e.jsx("span",{className:"nice-chart-ai__suggestion-icon",children:e.jsx(fe.NiceIcon,{name:"lightbulb",size:14})}),e.jsxs("span",{className:"nice-chart-ai__suggestion-text",children:[M("chartAI.suggestedType","Suggested:")," ",I.type]}),e.jsxs("span",{className:"nice-chart-ai__suggestion-reason",title:I.reason,children:["(",I.reason,")"]})]}),V&&e.jsx("span",{className:"nice-chart-ai__loading",children:M("chartAI.analyzing","Analyzing...")})]}),e.jsx("div",{className:"nice-chart-ai__toolbar-center",children:e.jsx("div",{className:"nice-chart-ai__type-selector",children:re.filter(ee=>["bar","line","area"].includes(ee.type)).map(({type:ee,icon:U,label:se})=>e.jsx("button",{type:"button",className:`nice-chart-ai__type-btn ${Q===ee?"nice-chart-ai__type-btn--active":""}`,onClick:()=>h(ee),title:se,children:e.jsx(fe.NiceIcon,{name:U,size:16})},ee))})}),e.jsxs("div",{className:"nice-chart-ai__toolbar-right",children:[e.jsxs("button",{type:"button",className:"nice-chart-ai__auto-btn",onClick:()=>Y(),disabled:V,title:M("chartAI.autoDetect","Auto-detect best chart type"),children:[e.jsx(fe.NiceIcon,{name:"zap",size:14})," ",M("chartAI.auto","Auto")]}),S&&e.jsxs("button",{type:"button",className:"nice-chart-ai__insights-btn",onClick:()=>{$.length||J(),r(!R)},disabled:V,title:M("chartAI.showInsights","Show data insights"),children:[e.jsx(fe.NiceIcon,{name:"lightbulb",size:14})," ",M("chartAI.insights","Insights")]})]})]}),e.jsx("div",{className:"nice-chart-ai__chart-wrapper",children:e.jsx(ke,{series:B,categories:Z,...d})}),R&&$.length>0&&e.jsxs("div",{className:"nice-chart-ai__insights",children:[e.jsxs("div",{className:"nice-chart-ai__insights-header",children:[e.jsxs("h4",{children:[e.jsx(fe.NiceIcon,{name:"lightbulb",size:14})," ",M("chartAI.dataInsights","Data Insights")]}),e.jsx("button",{type:"button",className:"nice-chart-ai__insights-close",onClick:()=>r(!1),"aria-label":M("chartAI.close","Close"),children:e.jsx(fe.NiceIcon,{name:"close",size:14})})]}),e.jsx("ul",{className:"nice-chart-ai__insights-list",children:$.map((ee,U)=>e.jsxs("li",{className:"nice-chart-ai__insight",children:[e.jsx("span",{className:"nice-chart-ai__insight-icon",children:"•"}),ee]},U))}),e.jsx("div",{className:"nice-chart-ai__insights-footer",children:e.jsxs("button",{type:"button",className:"nice-chart-ai__refresh",onClick:()=>J(),disabled:V,children:[e.jsx(fe.NiceIcon,{name:"refresh",size:14})," ",M("chartAI.refresh","Refresh")]})})]}),R&&V&&e.jsx("div",{className:"nice-chart-ai__insights nice-chart-ai__insights--loading",children:e.jsxs("div",{className:"nice-chart-ai__loading-content",children:[e.jsx("span",{className:"nice-chart-ai__spinner"}),M("chartAI.generatingInsights","Generating insights...")]})})]})}),gt=[],Pe=["var(--nice-color-primary, #3b82f6)","var(--nice-color-error, #ef4444)","var(--nice-color-success, #22c55e)","var(--nice-color-warning, #f59e0b)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-accent-pink, #ec4899)","var(--nice-color-info, #06b6d4)","var(--nice-color-success, #10b981)","var(--nice-color-warning, #f59e0b)","var(--nice-color-accent, #6366f1)"],We=c.forwardRef((t,s)=>{const{t:m}=fe.useNiceTranslation(),{levels:a=gt,initialLevelId:i,levelId:y,chartType:_="bar",width:S=600,height:z=400,showBreadcrumbs:w=!0,showBackButton:p=!0,animationDuration:j=300,onLevelChange:D,onItemClick:A,colors:N=Pe,showValues:d=!0,showLegend:o=!0,className:u,style:I,...g}=t,$=y!==void 0,[b,R]=c.useState(i||a[0]?.id),[r,T]=c.useState([i||a[0]?.id]),h=c.useCallback(E=>{const f=[];let l=a.find(L=>L.id===E);for(;l&&!f.includes(l.id);){f.unshift(l.id);const L=l.parentId;l=L?a.find(te=>te.id===L):void 0}return f.length>0?f:[E]},[a]),M=y??b,v=c.useMemo(()=>y!==void 0?h(y):r,[y,r,h]),[P,F]=c.useState(!1),[V,X]=c.useState("in"),B=c.useMemo(()=>a.find(E=>E.id===M),[a,M]),Z=c.useCallback(E=>{a.find(l=>l.id===E)&&(X("in"),F(!0),setTimeout(()=>{$||(R(E),T(l=>[...l,E])),D?.(E,$?h(E):[...v,E]),F(!1)},j/2))},[a,v,j,D,$,h]),Y=c.useCallback(()=>{if(v.length<=1)return;X("out"),F(!0);const E=v.slice(0,-1),f=E[E.length-1];setTimeout(()=>{$||(R(f),T(E)),D?.(f,E),F(!1)},j/2)},[v,j,D,$]),J=c.useCallback(()=>{const E=a[0]?.id;E&&(X("out"),F(!0),setTimeout(()=>{$||(R(E),T([E])),D?.(E,[E]),F(!1)},j/2))},[a,j,D,$]);c.useImperativeHandle(s,()=>({drillDown:Z,drillUp:Y,resetToRoot:J,getCurrentLevel:()=>M,getPath:()=>v}),[Z,Y,J,M,v]);const x=c.useCallback((E,f)=>{A?.(E,M);const l=a.find(L=>L.parentId===M&&L.id===E.metadata?.childLevelId);l&&Z(l.id)},[M,a,Z,A]),re=c.useMemo(()=>B?.data.reduce((E,f)=>E+f.value,0)||0,[B]),Q=c.useMemo(()=>v.map(E=>a.find(f=>f.id===E)?.label||E),[v,a]),ee=()=>{if(!B)return null;const E=B.data,f=Math.max(...E.map(L=>L.value)),l=Math.min(40,(z-100)/E.length-8);return e.jsx("div",{className:"nice-drilldown-bars",children:E.map((L,te)=>{const ce=L.value/f*100;return e.jsxs("div",{className:"nice-drilldown-bar-row",onClick:()=>x(L,te),children:[e.jsx("span",{className:"nice-drilldown-bar-label",children:L.label||`Item ${te+1}`}),e.jsx("div",{className:"nice-drilldown-bar-track",children:e.jsx("div",{className:"nice-drilldown-bar-fill",style:{width:`${ce}%`,backgroundColor:L.color||N[te%N.length],height:l}})}),d&&e.jsx("span",{className:"nice-drilldown-bar-value",children:L.value.toLocaleString()})]},te)})})},U=()=>{if(!B)return null;const E=B.data,f=S/2,l=(z-60)/2+30,L=Math.min(f,l)-40;let te=-90;const ce=E.map((H,ie)=>{const he=H.value/re*360,ve=te+he,be=he>180?1:0,ye=te*Math.PI/180,q=ve*Math.PI/180,ae=f+L*Math.cos(ye),k=l+L*Math.sin(ye),G=f+L*Math.cos(q),ne=l+L*Math.sin(q),oe=(te+he/2)*Math.PI/180,le=f+L*.7*Math.cos(oe),n=l+L*.7*Math.sin(oe),O=`M ${f} ${l} L ${ae} ${k} A ${L} ${L} 0 ${be} 1 ${G} ${ne} Z`;return te=ve,{path:O,color:H.color||N[ie%N.length],label:H.label||`Item ${ie+1}`,value:H.value,percentage:(H.value/re*100).toFixed(1),labelX:le,labelY:n,item:H,index:ie}});return e.jsx("svg",{width:S,height:z-40,className:"nice-drilldown-pie",children:e.jsx("g",{children:ce.map((H,ie)=>e.jsxs("g",{onClick:()=>x(H.item,H.index),children:[e.jsx("path",{d:H.path,fill:H.color,stroke:"white",strokeWidth:2,className:"nice-drilldown-pie-slice"}),d&&parseFloat(H.percentage)>5&&e.jsxs("text",{x:H.labelX,y:H.labelY,textAnchor:"middle",dominantBaseline:"middle",fill:"white",fontSize:"12",fontWeight:"600",children:[H.percentage,"%"]})]},ie))})})},se=()=>{if(!B)return null;const E=B.data,f=Math.max(...E.map(te=>te.value)),l=Math.min(60,(S-100)/E.length-8),L=z-100;return e.jsx("svg",{width:S,height:z-40,className:"nice-drilldown-columns",children:e.jsxs("g",{transform:"translate(50, 20)",children:[[0,.25,.5,.75,1].map((te,ce)=>e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:L*(1-te),x2:S-80,y2:L*(1-te),stroke:"var(--nice-border-color, #e5e7eb)",strokeDasharray:te===0?void 0:"4"}),e.jsx("text",{x:-8,y:L*(1-te),textAnchor:"end",dominantBaseline:"middle",fontSize:"11",fill:"var(--nice-text-secondary, #6b7280)",children:Math.round(f*te).toLocaleString()})]},ce)),E.map((te,ce)=>{const H=te.value/f*L,ie=ce*((S-100)/E.length)+((S-100)/E.length-l)/2;return e.jsxs("g",{onClick:()=>x(te,ce),children:[e.jsx("rect",{x:ie,y:L-H,width:l,height:H,fill:te.color||N[ce%N.length],rx:4,className:"nice-drilldown-column-bar"}),e.jsx("text",{x:ie+l/2,y:L+16,textAnchor:"middle",fontSize:"11",fill:"var(--nice-text-primary, #374151)",children:(te.label||`${ce+1}`).slice(0,10)}),d&&e.jsx("text",{x:ie+l/2,y:L-H-8,textAnchor:"middle",fontSize:"11",fill:"var(--nice-text-primary, #374151)",fontWeight:"500",children:te.value.toLocaleString()})]},ce)})]})})};return e.jsxs("div",{className:`nice-drilldown-chart ${P?`animating ${V}`:""} ${u||""}`,style:{width:S,...I},...g,children:[e.jsxs("div",{className:"nice-drilldown-header",children:[p&&v.length>1&&e.jsxs("button",{className:"nice-drilldown-back",onClick:Y,children:[e.jsx(fe.NiceIcon,{name:"arrow-left",size:14})," ",m("charts.back","Back")]}),w&&e.jsx("div",{className:"nice-drilldown-breadcrumbs",children:Q.map((E,f)=>e.jsxs(c.Fragment,{children:[f>0&&e.jsx("span",{className:"nice-drilldown-separator",children:"/"}),e.jsx("span",{className:`nice-drilldown-crumb ${f===Q.length-1?"active":""}`,onClick:()=>{if(f<Q.length-1){const l=v.slice(0,f+1),L=l[l.length-1];$||(T(l),R(L)),D?.(L,l)}},children:E})]},f))})]}),e.jsxs("div",{className:"nice-drilldown-content",style:{height:z-40},children:[_==="bar"&&ee(),_==="pie"&&U(),_==="column"&&se()]}),o&&B&&e.jsx("div",{className:"nice-drilldown-legend",children:B.data.map((E,f)=>e.jsxs("div",{className:"nice-drilldown-legend-item",children:[e.jsx("span",{className:"nice-drilldown-legend-color",style:{backgroundColor:E.color||N[f%N.length]}}),e.jsx("span",{className:"nice-drilldown-legend-label",children:E.label||`Item ${f+1}`})]},f))}),e.jsx("style",{children:`
|
|
293
|
+
.nice-drilldown-chart {
|
|
294
|
+
font-family: inherit;
|
|
295
|
+
color: var(--nice-text-primary, #111827);
|
|
296
|
+
background: var(--nice-bg-elevated, #ffffff);
|
|
297
|
+
border-radius: 8px;
|
|
298
|
+
overflow: hidden;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.nice-drilldown-header {
|
|
302
|
+
display: flex;
|
|
303
|
+
align-items: center;
|
|
304
|
+
gap: 12px;
|
|
305
|
+
padding: 12px 16px;
|
|
306
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
307
|
+
min-height: 40px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.nice-drilldown-back {
|
|
311
|
+
background: var(--nice-bg-secondary, #f3f4f6);
|
|
312
|
+
border: none;
|
|
313
|
+
padding: 6px 12px;
|
|
314
|
+
border-radius: 6px;
|
|
315
|
+
cursor: pointer;
|
|
316
|
+
font-size: 13px;
|
|
317
|
+
font-family: inherit;
|
|
318
|
+
color: var(--nice-text-primary, #374151);
|
|
319
|
+
transition: background 0.2s;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.nice-drilldown-back:hover {
|
|
323
|
+
background: var(--nice-hover-bg, #e5e7eb);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.nice-drilldown-breadcrumbs {
|
|
327
|
+
display: flex;
|
|
328
|
+
align-items: center;
|
|
329
|
+
gap: 4px;
|
|
330
|
+
font-size: 13px;
|
|
331
|
+
font-family: inherit;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.nice-drilldown-separator {
|
|
335
|
+
color: var(--nice-text-muted, #9ca3af);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.nice-drilldown-crumb {
|
|
339
|
+
color: var(--nice-text-secondary, #6b7280);
|
|
340
|
+
cursor: pointer;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.nice-drilldown-crumb:hover:not(.active) {
|
|
344
|
+
color: var(--nice-color-primary, #3b82f6);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.nice-drilldown-crumb.active {
|
|
348
|
+
color: var(--nice-text-primary, #111827);
|
|
349
|
+
font-weight: 500;
|
|
350
|
+
cursor: default;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.nice-drilldown-content {
|
|
354
|
+
padding: 16px;
|
|
355
|
+
transition: opacity 0.15s, transform 0.15s;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.nice-drilldown-chart.animating .nice-drilldown-content {
|
|
359
|
+
opacity: 0;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.nice-drilldown-chart.animating.in .nice-drilldown-content {
|
|
363
|
+
transform: translateX(20px);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.nice-drilldown-chart.animating.out .nice-drilldown-content {
|
|
367
|
+
transform: translateX(-20px);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.nice-drilldown-bars {
|
|
371
|
+
display: flex;
|
|
372
|
+
flex-direction: column;
|
|
373
|
+
gap: 8px;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.nice-drilldown-bar-row {
|
|
377
|
+
display: flex;
|
|
378
|
+
align-items: center;
|
|
379
|
+
gap: 12px;
|
|
380
|
+
cursor: pointer;
|
|
381
|
+
padding: 4px 8px;
|
|
382
|
+
margin: -4px -8px;
|
|
383
|
+
border-radius: 6px;
|
|
384
|
+
transition: background 0.2s;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.nice-drilldown-bar-row:hover {
|
|
388
|
+
background: var(--nice-hover-bg, #f9fafb);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.nice-drilldown-bar-label {
|
|
392
|
+
width: 120px;
|
|
393
|
+
font-size: 13px;
|
|
394
|
+
font-family: inherit;
|
|
395
|
+
color: var(--nice-text-primary, #374151);
|
|
396
|
+
overflow: hidden;
|
|
397
|
+
text-overflow: ellipsis;
|
|
398
|
+
white-space: nowrap;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.nice-drilldown-bar-track {
|
|
402
|
+
flex: 1;
|
|
403
|
+
background: var(--nice-bg-tertiary, #f3f4f6);
|
|
404
|
+
border-radius: 6px;
|
|
405
|
+
overflow: hidden;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.nice-drilldown-bar-fill {
|
|
409
|
+
transition: width 0.3s ease;
|
|
410
|
+
border-radius: 6px;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.nice-drilldown-bar-value {
|
|
414
|
+
width: 80px;
|
|
415
|
+
text-align: right;
|
|
416
|
+
font-size: 13px;
|
|
417
|
+
font-family: inherit;
|
|
418
|
+
font-weight: 500;
|
|
419
|
+
color: var(--nice-text-primary, #111827);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.nice-drilldown-pie-slice {
|
|
423
|
+
cursor: pointer;
|
|
424
|
+
transition: transform 0.2s, opacity 0.2s;
|
|
425
|
+
transform-origin: center;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.nice-drilldown-pie-slice:hover {
|
|
429
|
+
opacity: 0.85;
|
|
430
|
+
transform: scale(1.02);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.nice-drilldown-column-bar {
|
|
434
|
+
cursor: pointer;
|
|
435
|
+
transition: opacity 0.2s;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.nice-drilldown-column-bar:hover {
|
|
439
|
+
opacity: 0.8;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.nice-drilldown-legend {
|
|
443
|
+
display: flex;
|
|
444
|
+
flex-wrap: wrap;
|
|
445
|
+
gap: 16px;
|
|
446
|
+
padding: 12px 16px;
|
|
447
|
+
border-top: 1px solid var(--nice-border-color, #e5e7eb);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.nice-drilldown-legend-item {
|
|
451
|
+
display: flex;
|
|
452
|
+
align-items: center;
|
|
453
|
+
gap: 6px;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.nice-drilldown-legend-color {
|
|
457
|
+
width: 12px;
|
|
458
|
+
height: 12px;
|
|
459
|
+
border-radius: 3px;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.nice-drilldown-legend-label {
|
|
463
|
+
font-size: 12px;
|
|
464
|
+
font-family: inherit;
|
|
465
|
+
color: var(--nice-text-secondary, #6b7280);
|
|
466
|
+
}
|
|
467
|
+
`})]})});We.displayName="NiceDrillDownChart";const vt=["var(--nice-info-bg, #dbeafe)","var(--nice-color-primary-light, #93c5fd)","var(--nice-color-primary, #3b82f6)","var(--nice-color-primary-active, #1d4ed8)","var(--nice-color-primary, #6366f1)"],yt=({type:t="choropleth",regions:s=[],bubbles:m=[],width:a=800,height:i=500,viewBox:y="0 0 800 500",colorScale:_,colorRange:S,minValue:z,maxValue:w,showTooltip:p=!0,showLegend:j=!0,onRegionClick:D,onBubbleClick:A,onRegionHover:N,title:d,mapSvg:o,zoomable:u=!1,className:I,style:g,...$})=>{const b=_??S??vt,{t:R}=fe.useNiceTranslation(),[r,T]=c.useState(null),[h,M]=c.useState(1),[v,P]=c.useState({x:0,y:0}),F=c.useRef(null),V=c.useRef(!1),X=c.useRef({x:0,y:0}),B=z??Math.min(...s.map(f=>f.value),...m.map(f=>f.value)),Z=w??Math.max(...s.map(f=>f.value),...m.map(f=>f.value)),Y=c.useCallback(f=>{const l=(f-B)/(Z-B),L=Math.min(Math.floor(l*b.length),b.length-1);return b[Math.max(0,L)]},[B,Z,b]),J=c.useCallback(f=>{if(!p||!r)return;const l=F.current?.getBoundingClientRect();l&&T(L=>L?{...L,x:f.clientX-l.left,y:f.clientY-l.top}:null)},[p,r]),x=c.useCallback((f,l)=>{const L=F.current?.getBoundingClientRect();L&&p&&T({x:l.clientX-L.left,y:l.clientY-L.top,content:`${f.name}: ${f.value.toLocaleString()}`}),N?.(f)},[p,N]),re=c.useCallback(()=>{T(null),N?.(null)},[N]),Q=c.useCallback(f=>{if(!u)return;f.preventDefault();const l=f.deltaY>0?.9:1.1;M(L=>Math.min(Math.max(L*l,.5),4))},[u]),ee=c.useCallback(f=>{u&&(V.current=!0,X.current={x:f.clientX-v.x,y:f.clientY-v.y})},[u,v]),U=c.useCallback(()=>{V.current=!1},[]),se=c.useCallback(f=>{V.current&&P({x:f.clientX-X.current.x,y:f.clientY-X.current.y})},[]),E=c.useMemo(()=>s.length>0?s:[{id:"mazowieckie",name:"Mazowieckie",value:100,path:"M400,200 L450,200 L460,250 L420,280 L380,250 Z"},{id:"slaskie",name:"Śląskie",value:80,path:"M350,280 L400,280 L390,330 L340,320 Z"},{id:"wielkopolskie",name:"Wielkopolskie",value:70,path:"M300,200 L350,200 L360,260 L310,270 L280,230 Z"}],[s]);return e.jsxs("div",{className:`nice-map-chart ${I||""}`,style:{width:a,...g},...$,children:[d&&e.jsx("div",{className:"nice-map-title",children:d}),e.jsx("svg",{ref:F,width:a,height:i,viewBox:y,className:"nice-map-svg",onWheel:Q,onMouseDown:ee,onMouseUp:U,onMouseLeave:U,onMouseMove:f=>{J(f),se(f)},children:e.jsxs("g",{transform:`translate(${v.x}, ${v.y}) scale(${h})`,children:[o&&e.jsx("g",{dangerouslySetInnerHTML:{__html:o}}),t==="choropleth"&&E.map(f=>e.jsx("path",{d:f.path,fill:f.color||Y(f.value),stroke:"var(--nice-bg-primary, #ffffff)",strokeWidth:1,className:"nice-map-region",onClick:()=>D?.(f),onMouseEnter:l=>x(f,l),onMouseLeave:re},f.id)),(t==="bubble"||m.length>0)&&m.map(f=>{const l=Math.sqrt((f.value-B)/(Z-B))*30+5;return e.jsx("circle",{cx:f.lng,cy:f.lat,r:l,fill:f.color||"var(--nice-color-primary, #3b82f6)",fillOpacity:.7,stroke:"var(--nice-bg-primary, #ffffff)",strokeWidth:1,className:"nice-map-bubble",onClick:()=>A?.(f),onMouseEnter:L=>{const te=F.current?.getBoundingClientRect();te&&p&&T({x:L.clientX-te.left,y:L.clientY-te.top,content:`${f.label||f.id}: ${f.value.toLocaleString()}`})},onMouseLeave:re,children:f.label&&e.jsxs("title",{children:[f.label,": ",f.value]})},f.id)})]})}),r&&e.jsx("div",{className:"nice-map-tooltip",style:{left:r.x+10,top:r.y-30},children:r.content}),j&&e.jsxs("div",{className:"nice-map-legend",children:[e.jsx("span",{className:"nice-map-legend-title",children:R("charts.value","Value")}),e.jsx("div",{className:"nice-map-legend-scale",children:b.map((f,l)=>e.jsx("div",{className:"nice-map-legend-item",style:{backgroundColor:f}},l))}),e.jsxs("div",{className:"nice-map-legend-labels",children:[e.jsx("span",{children:B.toLocaleString()}),e.jsx("span",{children:Z.toLocaleString()})]})]}),e.jsx("style",{children:`
|
|
468
|
+
.nice-map-chart {
|
|
469
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
470
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
471
|
+
border-radius: var(--nice-radius-lg, 8px);
|
|
472
|
+
overflow: hidden;
|
|
473
|
+
position: relative;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.nice-map-title {
|
|
477
|
+
padding: var(--nice-space-3, 12px) var(--nice-space-4, 16px);
|
|
478
|
+
font-size: 16px;
|
|
479
|
+
font-weight: 600;
|
|
480
|
+
color: var(--nice-text-primary, #0f172a);
|
|
481
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.nice-map-svg {
|
|
485
|
+
display: block;
|
|
486
|
+
cursor: grab;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.nice-map-svg:active {
|
|
490
|
+
cursor: grabbing;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.nice-map-region {
|
|
494
|
+
cursor: pointer;
|
|
495
|
+
transition: opacity 0.2s, stroke-width 0.2s;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.nice-map-region:hover {
|
|
499
|
+
opacity: 0.8;
|
|
500
|
+
stroke-width: 2;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.nice-map-bubble {
|
|
504
|
+
cursor: pointer;
|
|
505
|
+
transition: transform 0.2s, opacity 0.2s;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.nice-map-bubble:hover {
|
|
509
|
+
opacity: 1;
|
|
510
|
+
transform: scale(1.1);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.nice-map-tooltip {
|
|
514
|
+
position: absolute;
|
|
515
|
+
/* audit-allow: token-role — inverted chip like .nice-tooltip: the text colour is the
|
|
516
|
+
fill and the label uses --nice-text-inverse, so the pair flips together. */
|
|
517
|
+
background: var(--nice-text-primary, #0f172a);
|
|
518
|
+
color: var(--nice-text-inverse, #ffffff);
|
|
519
|
+
padding: var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);
|
|
520
|
+
border-radius: var(--nice-radius-sm, 4px);
|
|
521
|
+
font-size: 12px;
|
|
522
|
+
pointer-events: none;
|
|
523
|
+
z-index: 10;
|
|
524
|
+
white-space: nowrap;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.nice-map-legend {
|
|
528
|
+
position: absolute;
|
|
529
|
+
right: 16px;
|
|
530
|
+
bottom: 16px;
|
|
531
|
+
background: var(--nice-bg-elevated, #ffffff);
|
|
532
|
+
padding: var(--nice-space-3, 12px);
|
|
533
|
+
border-radius: var(--nice-radius-md, 6px);
|
|
534
|
+
box-shadow: 0 2px 8px var(--nice-overlay-10, color-mix(in srgb, var(--nice-text-primary, #000) 10%, transparent));
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.nice-map-legend-title {
|
|
538
|
+
display: block;
|
|
539
|
+
font-size: 11px;
|
|
540
|
+
color: var(--nice-text-secondary, #475569);
|
|
541
|
+
margin-bottom: var(--nice-space-1-5, 6px);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.nice-map-legend-scale {
|
|
545
|
+
display: flex;
|
|
546
|
+
height: 12px;
|
|
547
|
+
border-radius: var(--nice-radius-sm, 2px);
|
|
548
|
+
overflow: hidden;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
.nice-map-legend-item {
|
|
552
|
+
flex: 1;
|
|
553
|
+
min-width: 24px;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.nice-map-legend-labels {
|
|
557
|
+
display: flex;
|
|
558
|
+
justify-content: space-between;
|
|
559
|
+
font-size: 10px;
|
|
560
|
+
color: var(--nice-text-secondary, #475569);
|
|
561
|
+
margin-top: var(--nice-space-1, 4px);
|
|
562
|
+
}
|
|
563
|
+
`})]})},bt=({nodes:t,links:s,width:m=800,height:a=500,nodeWidth:i=20,nodePadding:y=10,showValues:_=!0,showTooltip:S=!0,onNodeClick:z,onLinkClick:w,title:p,className:j,style:D,...A})=>{const[N,d]=c.useState(null),o=c.useRef(null),u=c.useMemo(()=>{const g=new Map;t.forEach(x=>g.set(x.id,x));const $=new Set(s.map(x=>x.target)),b=new Set(s.map(x=>x.source)),R=[],r=new Map,T=t.filter(x=>b.has(x.id)&&!$.has(x.id));T.length>0&&(R.push(T.map(x=>x.id)),T.forEach(x=>r.set(x.id,0)));const h=t.filter(x=>b.has(x.id)&&$.has(x.id));h.length>0&&(R.push(h.map(x=>x.id)),h.forEach(x=>r.set(x.id,1)));const M=t.filter(x=>!b.has(x.id)&&$.has(x.id));M.length>0&&(R.push(M.map(x=>x.id)),M.forEach(x=>r.set(x.id,2))),R.length===0&&(R.push(t.map(x=>x.id)),t.forEach(x=>r.set(x.id,0)));const v=new Map;s.forEach(x=>{v.set(x.source,(v.get(x.source)||0)+x.value),v.set(x.target,(v.get(x.target)||0)+x.value)});const P=40,F=m-P*2,V=a-P*2,X=R.length>1?F/(R.length-1):F,B=new Map;Math.max(...Array.from(v.values())),R.forEach((x,re)=>{const Q=x.reduce((se,E)=>se+(v.get(E)||0),0),ee=(V-(x.length-1)*y)/Q;let U=P;x.forEach(se=>{const f=(v.get(se)||0)*ee,l=P+re*X;B.set(se,{x:l,y:U,height:f}),U+=f+y})});const Z=[],Y=new Map,J=new Map;return s.forEach(x=>{const re=B.get(x.source),Q=B.get(x.target);if(!re||!Q)return;const ee=v.get(x.source)||1;v.get(x.target);const U=x.value/ee*re.height,se=re.y+(Y.get(x.source)||0),E=Q.y+(J.get(x.target)||0);Y.set(x.source,(Y.get(x.source)||0)+U),J.set(x.target,(J.get(x.target)||0)+U);const f=re.x+i,l=Q.x,L=(l-f)*.5,te=`
|
|
564
|
+
M ${f} ${se}
|
|
565
|
+
C ${f+L} ${se},
|
|
566
|
+
${l-L} ${E},
|
|
567
|
+
${l} ${E}
|
|
568
|
+
L ${l} ${E+U}
|
|
569
|
+
C ${l-L} ${E+U},
|
|
570
|
+
${f+L} ${se+U},
|
|
571
|
+
${f} ${se+U}
|
|
572
|
+
Z
|
|
573
|
+
`;Z.push({path:te,link:x,sourcePos:re,targetPos:Q})}),{nodePositions:B,linkPaths:Z,nodeMap:g,nodeValues:v}},[t,s,m,a,i,y]),I=c.useCallback((g,$)=>{const b=o.current?.getBoundingClientRect();b&&S&&d({x:$.clientX-b.left,y:$.clientY-b.top,content:g})},[S]);return e.jsxs("div",{className:`nice-sankey-chart ${j||""}`,style:{width:m,...D},...A,children:[p&&e.jsx("div",{className:"nice-sankey-title",children:p}),e.jsxs("svg",{ref:o,width:m,height:a,className:"nice-sankey-svg",children:[e.jsx("defs",{children:u.linkPaths.map((g,$)=>e.jsxs("linearGradient",{id:`sankey-gradient-${$}`,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[e.jsx("stop",{offset:"0%",stopColor:u.nodeMap.get(g.link.source)?.color||"var(--nice-color-primary, #3b82f6)"}),e.jsx("stop",{offset:"100%",stopColor:u.nodeMap.get(g.link.target)?.color||"var(--nice-color-error, #ef4444)"})]},$))}),e.jsx("g",{className:"nice-sankey-links",children:u.linkPaths.map((g,$)=>e.jsx("path",{d:g.path,fill:g.link.color||`url(#sankey-gradient-${$})`,fillOpacity:.4,className:"nice-sankey-link",onClick:()=>w?.(g.link),onMouseEnter:b=>I(`${u.nodeMap.get(g.link.source)?.name} → ${u.nodeMap.get(g.link.target)?.name}: ${g.link.value.toLocaleString()}`,b),onMouseLeave:()=>d(null)},$))}),e.jsx("g",{className:"nice-sankey-nodes",children:Array.from(u.nodePositions.entries()).map(([g,$])=>{const b=u.nodeMap.get(g);return b?e.jsxs("g",{children:[e.jsx("rect",{x:$.x,y:$.y,width:i,height:$.height,fill:b.color||"var(--nice-color-primary, #3b82f6)",rx:2,className:"nice-sankey-node",onClick:()=>z?.(b),onMouseEnter:R=>I(`${b.label??b.name??b.id}: ${u.nodeValues.get(g)?.toLocaleString()||0}`,R),onMouseLeave:()=>d(null)}),e.jsxs("text",{x:$.x+i+6,y:$.y+$.height/2,dominantBaseline:"middle",fontSize:"12",fill:"var(--nice-text-primary, #0f172a)",children:[b.label??b.name??b.id,_&&` (${u.nodeValues.get(g)?.toLocaleString()||0})`]})]},g):null})})]}),N&&e.jsx("div",{className:"nice-sankey-tooltip",style:{left:N.x+10,top:N.y-30},children:N.content}),e.jsx("style",{children:`
|
|
574
|
+
.nice-sankey-chart {
|
|
575
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
576
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
577
|
+
border-radius: var(--nice-radius-lg, 8px);
|
|
578
|
+
position: relative;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.nice-sankey-title {
|
|
582
|
+
padding: var(--nice-space-3, 12px) var(--nice-space-4, 16px);
|
|
583
|
+
font-size: 16px;
|
|
584
|
+
font-weight: 600;
|
|
585
|
+
color: var(--nice-text-primary, #0f172a);
|
|
586
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
.nice-sankey-link {
|
|
590
|
+
cursor: pointer;
|
|
591
|
+
transition: fill-opacity 0.2s;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.nice-sankey-link:hover {
|
|
595
|
+
fill-opacity: 0.7;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
.nice-sankey-node {
|
|
599
|
+
cursor: pointer;
|
|
600
|
+
transition: opacity 0.2s;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.nice-sankey-node:hover {
|
|
604
|
+
opacity: 0.8;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.nice-sankey-tooltip {
|
|
608
|
+
position: absolute;
|
|
609
|
+
/* audit-allow: token-role — inverted chip like .nice-tooltip: the text colour is the
|
|
610
|
+
fill and the label uses --nice-text-inverse, so the pair flips together. */
|
|
611
|
+
background: var(--nice-text-primary, #0f172a);
|
|
612
|
+
color: var(--nice-text-inverse, #ffffff);
|
|
613
|
+
padding: var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);
|
|
614
|
+
border-radius: var(--nice-radius-sm, 4px);
|
|
615
|
+
font-size: 12px;
|
|
616
|
+
pointer-events: none;
|
|
617
|
+
z-index: 10;
|
|
618
|
+
white-space: nowrap;
|
|
619
|
+
}
|
|
620
|
+
`})]})},Fe=c.forwardRef((t,s)=>{const{t:m}=fe.useNiceTranslation(),{initialData:a,data:i,maxPoints:y=60,updateInterval:_=1e3,fetchData:S,width:z=600,height:w=200,chartType:p="line",color:j="var(--nice-color-primary, #3b82f6)",showGrid:D=!0,showTimeAxis:A=!0,showCurrentValue:N=!0,title:d,valueFormatter:o=H=>H.toFixed(2),timeFormatter:u=H=>new Date(H).toLocaleTimeString(),onDataUpdate:I,paused:g,className:$,style:b,...R}=t,[r,T]=c.useState(a??i??[]),[h,M]=c.useState(g||!1),v=c.useRef(void 0);c.useEffect(()=>{g!==void 0&&M(g)},[g]),c.useEffect(()=>{if(h||!S)return;const H=async()=>{try{const ie=await S();T(he=>{const ve=[...he,ie].slice(-y);return I?.(ve),ve})}catch(ie){console.error("Failed to fetch realtime data:",ie)}};return v.current=setInterval(H,_),()=>{v.current&&clearInterval(v.current)}},[h,S,_,y,I]);const P=c.useCallback(H=>{T(ie=>{const he=[...ie,H].slice(-y);return I?.(he),he})},[y,I]),F=c.useCallback(()=>{T([]),I?.([])},[I]),V=c.useCallback(()=>M(!0),[]),X=c.useCallback(()=>M(!1),[]);c.useImperativeHandle(s,()=>({addDataPoint:P,clearData:F,pause:V,resume:X,getData:()=>r}),[P,F,r]);const B={top:20,right:60,bottom:A?40:20,left:50},Z=z-B.left-B.right,Y=w-B.top-B.bottom,J=r.map(H=>H.value),x=J.length?Math.min(...J):0,re=J.length?Math.max(...J):100,ee=(re-x||1)*.1,U=x-ee,E=re+ee-U,f=H=>{const ie=S?y-1:Math.max(1,r.length-1);return B.left+H/ie*Z},l=H=>B.top+Y-(H-U)/E*Y,L=r.map((H,ie)=>`${f(ie)},${l(H.value)}`).join(" "),te=r.length>0?`M ${f(0)},${B.top+Y} L ${L} L ${f(r.length-1)},${B.top+Y} Z`:"",ce=r.length>0?r[r.length-1].value:null;return e.jsxs("div",{className:`nice-realtime-chart ${$||""}`,style:{width:z,...b},...R,children:[e.jsxs("div",{className:"nice-realtime-header",children:[e.jsx("span",{className:"nice-realtime-title",children:d}),e.jsxs("div",{className:"nice-realtime-controls",children:[e.jsxs("span",{className:`nice-realtime-status ${h?"paused":"live"}`,children:[e.jsx("span",{className:"nice-realtime-status-dot"}),e.jsx("span",{children:h?m("charts.paused","Paused"):m("charts.live","Live")})]}),e.jsx("button",{className:`nice-realtime-btn ${h?"paused":""}`,onClick:()=>M(!h),"aria-label":h?m("charts.resume","Resume"):m("charts.pause","Pause"),children:e.jsx(fe.NiceIcon,{name:h?"play":"pause",size:14})}),N&&ce!==null&&e.jsx("span",{className:"nice-realtime-value",children:o(ce)})]})]}),e.jsxs("svg",{width:z,height:w,className:"nice-realtime-svg",children:[D&&e.jsx("g",{className:"nice-realtime-grid",children:[0,.25,.5,.75,1].map((H,ie)=>{const he=B.top+Y*(1-H),ve=U+E*H;return e.jsxs("g",{children:[e.jsx("line",{x1:B.left,y1:he,x2:z-B.right,y2:he,stroke:"var(--nice-border-color, #e5e7eb)",strokeDasharray:H===0?void 0:"3"}),e.jsx("text",{x:B.left-8,y:he,textAnchor:"end",dominantBaseline:"middle",fontSize:"10",fill:"var(--nice-text-secondary, #6b7280)",children:Math.round(ve).toLocaleString()})]},ie)})}),p==="area"&&r.length>0&&e.jsx("path",{d:te,fill:j,fillOpacity:.2}),r.length>1&&e.jsx("polyline",{points:L,fill:"none",stroke:j,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),r.length>0&&e.jsx("circle",{cx:f(r.length-1),cy:l(r[r.length-1].value),r:3,fill:j,className:"nice-realtime-point"}),A&&r.length>0&&e.jsx("g",{className:"nice-realtime-time-axis",children:Array.from(new Set([0,Math.floor(r.length/2),r.length-1].filter(H=>r[H]))).map(H=>e.jsx("text",{x:f(H),y:w-8,textAnchor:"middle",fontSize:"10",fill:"var(--nice-text-secondary, #6b7280)",children:u(r[H].timestamp)},`tx-${H}`))})]}),e.jsx("style",{children:`
|
|
621
|
+
.nice-realtime-chart {
|
|
622
|
+
font-family: inherit;
|
|
623
|
+
color: var(--nice-text-primary, #111827);
|
|
624
|
+
background: var(--nice-bg-elevated, #ffffff);
|
|
625
|
+
border-radius: 8px;
|
|
626
|
+
position: relative;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.nice-realtime-header {
|
|
630
|
+
display: flex;
|
|
631
|
+
justify-content: space-between;
|
|
632
|
+
align-items: center;
|
|
633
|
+
padding: 12px 16px;
|
|
634
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.nice-realtime-title {
|
|
638
|
+
font-size: 14px;
|
|
639
|
+
font-weight: 600;
|
|
640
|
+
color: var(--nice-text-primary, #111827);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
.nice-realtime-controls {
|
|
644
|
+
display: flex;
|
|
645
|
+
align-items: center;
|
|
646
|
+
gap: 12px;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
.nice-realtime-btn {
|
|
650
|
+
background: none;
|
|
651
|
+
border: none;
|
|
652
|
+
cursor: pointer;
|
|
653
|
+
font-size: 16px;
|
|
654
|
+
padding: 4px;
|
|
655
|
+
font-family: inherit;
|
|
656
|
+
color: inherit;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
.nice-realtime-value {
|
|
660
|
+
font-size: 18px;
|
|
661
|
+
font-weight: 600;
|
|
662
|
+
color: ${j};
|
|
663
|
+
font-variant-numeric: tabular-nums;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
/* Static current-value dot — no pulsing animation (was distracting) */
|
|
667
|
+
|
|
668
|
+
.nice-realtime-status {
|
|
669
|
+
display: inline-flex;
|
|
670
|
+
align-items: center;
|
|
671
|
+
gap: 6px;
|
|
672
|
+
font-size: 11px;
|
|
673
|
+
font-family: inherit;
|
|
674
|
+
color: var(--nice-text-secondary, #6b7280);
|
|
675
|
+
background: var(--nice-bg-secondary, #f3f4f6);
|
|
676
|
+
padding: 2px 10px;
|
|
677
|
+
border-radius: 999px;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
.nice-realtime-status-dot {
|
|
681
|
+
width: 8px;
|
|
682
|
+
height: 8px;
|
|
683
|
+
border-radius: 50%;
|
|
684
|
+
background: var(--nice-color-success, #22c55e);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
.nice-realtime-status.paused .nice-realtime-status-dot {
|
|
688
|
+
background: var(--nice-color-warning, #f59e0b);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
.nice-realtime-status.live .nice-realtime-status-dot {
|
|
692
|
+
animation: live-pulse 2s ease-in-out infinite;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
@keyframes live-pulse {
|
|
696
|
+
0%, 100% { opacity: 1; }
|
|
697
|
+
50% { opacity: 0.4; }
|
|
698
|
+
}
|
|
699
|
+
`})]})});Fe.displayName="NiceRealtimeChart";const _t=({data:t,width:s=600,height:m=400,showLabels:a=!0,showValues:i=!0,onNodeClick:y,drilldownEnabled:_=!0,colors:S=Pe,tilePadding:z=2,className:w,style:p,...j})=>{const{t:D}=fe.useNiceTranslation(),A=c.useMemo(()=>Array.isArray(t)?{id:"root",name:"Root",value:t.reduce((M,v)=>M+(v.value||0),0),children:t.map((M,v)=>({id:`${v}`,name:M.label??M.name??`Item ${v+1}`,value:M.value,color:M.color}))}:t,[t]),[N,d]=c.useState(A),[o,u]=c.useState([A.name]),[I,g]=c.useState(null),$=c.useRef(null),b=c.useMemo(()=>{const v=N.children||[];if(v.length===0)return[];const P=v.reduce((x,re)=>x+re.value,0),F=v.map(x=>({node:x,area:x.value/P*s*m}));F.sort((x,re)=>re.area-x.area);const V=[];let X=0,B=0,Z=s,Y=m,J=0;for(;J<F.length;){const x=Z<Y;let re=0,Q=[];const ee=x?Y:Z;for(let E=J;E<F.length;E++){const f=[...Q,F[E]],l=f.reduce((te,ce)=>te+ce.area,0),L=R(f,l,ee);if(Q.length===0)Q=f,re=l;else{const te=R(Q,re,ee);if(L<=te)Q=f,re=l;else break}}const U=re/ee;let se=0;Q.forEach((E,f)=>{const l=E.area/U;V.push({node:E.node,x:x?X:X+se,y:x?B+se:B,w:x?U:l,h:x?l:U,color:E.node.color||S[(J+f)%S.length]}),se+=l}),x?(X+=U,Z-=U):(B+=U,Y-=U),J+=Q.length}return V},[N,s,m,S]);function R(M,v,P){const F=v/P;let V=0;for(const X of M){const B=X.area/F,Z=Math.max(F/B,B/F);V=Math.max(V,Z)}return V}const r=M=>{y?.(M,[...o,M.name]),_&&M.children&&M.children.length>0&&(d(M),u(v=>[...v,M.name]))},T=()=>{if(o.length<=1)return;let M=A;const v=o.slice(0,-1);for(let P=1;P<v.length;P++){const F=M.children?.find(V=>V.name===v[P]);F&&(M=F)}d(M),u(v)},h=(M,v)=>{const P=$.current?.getBoundingClientRect();P&&g({x:v.clientX-P.left,y:v.clientY-P.top,content:M})};return e.jsxs("div",{className:`nice-treemap-chart ${w||""}`,style:{width:s,...p},...j,children:[e.jsxs("div",{className:"nice-treemap-nav",children:[o.length>1&&e.jsxs("button",{className:"nice-treemap-back",onClick:T,children:[e.jsx(fe.NiceIcon,{name:"arrow-left",size:14})," ",D("charts.back","Back")]}),e.jsx("div",{className:"nice-treemap-breadcrumbs",children:o.map((M,v)=>e.jsxs(c.Fragment,{children:[v>0&&e.jsx("span",{className:"nice-treemap-sep",children:"/"}),e.jsx("span",{className:v===o.length-1?"current":"",children:M})]},v))})]}),e.jsx("svg",{ref:$,width:s,height:m,className:"nice-treemap-svg",children:b.map((M,v)=>{const{node:P,x:F,y:V,w:X,h:B,color:Z}=M,Y=Math.min(14,Math.max(10,Math.min(X,B)/6)),J=X>40&&B>30;return e.jsxs("g",{onClick:()=>r(P),onMouseEnter:x=>h(`${P.name}: ${P.value.toLocaleString()}`,x),onMouseLeave:()=>g(null),children:[e.jsx("rect",{x:F+z/2,y:V+z/2,width:Math.max(0,X-z),height:Math.max(0,B-z),fill:Z,rx:4,className:"nice-treemap-tile"}),a&&J&&e.jsx("text",{x:F+X/2,y:V+B/2-(i?6:0),textAnchor:"middle",dominantBaseline:"middle",fontSize:Y,fill:"white",fontWeight:"500",style:{pointerEvents:"none"},children:P.name.length>X/Y+2?P.name.slice(0,Math.floor(X/Y))+"...":P.name}),i&&J&&e.jsx("text",{x:F+X/2,y:V+B/2+10,textAnchor:"middle",dominantBaseline:"middle",fontSize:Y-2,fill:"var(--nice-overlay-light-80, rgba(255, 255, 255, 0.8))",style:{pointerEvents:"none"},children:P.value.toLocaleString()})]},v)})}),I&&e.jsx("div",{className:"nice-treemap-tooltip",style:{left:I.x+10,top:I.y-30},children:I.content}),e.jsx("style",{children:`
|
|
700
|
+
.nice-treemap-chart {
|
|
701
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
702
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
703
|
+
border-radius: var(--nice-radius-lg, 8px);
|
|
704
|
+
position: relative;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
.nice-treemap-nav {
|
|
708
|
+
display: flex;
|
|
709
|
+
align-items: center;
|
|
710
|
+
gap: var(--nice-space-3, 12px);
|
|
711
|
+
padding: var(--nice-space-3, 12px) var(--nice-space-4, 16px);
|
|
712
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
.nice-treemap-back {
|
|
716
|
+
background: var(--nice-bg-secondary, #f8fafc);
|
|
717
|
+
color: var(--nice-text-primary, #0f172a);
|
|
718
|
+
border: none;
|
|
719
|
+
padding: var(--nice-space-1-5, 6px) var(--nice-space-3, 12px);
|
|
720
|
+
border-radius: var(--nice-radius-md, 6px);
|
|
721
|
+
cursor: pointer;
|
|
722
|
+
font-size: 13px;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
.nice-treemap-back:hover {
|
|
726
|
+
background: var(--nice-border-color, #e5e7eb);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
.nice-treemap-breadcrumbs {
|
|
730
|
+
display: flex;
|
|
731
|
+
align-items: center;
|
|
732
|
+
gap: var(--nice-space-1, 4px);
|
|
733
|
+
font-size: 13px;
|
|
734
|
+
color: var(--nice-text-secondary, #475569);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
.nice-treemap-breadcrumbs .current {
|
|
738
|
+
color: var(--nice-text-primary, #0f172a);
|
|
739
|
+
font-weight: 500;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
.nice-treemap-sep {
|
|
743
|
+
color: var(--nice-text-muted, #94a3b8);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
.nice-treemap-tile {
|
|
747
|
+
cursor: pointer;
|
|
748
|
+
transition: opacity 0.2s, transform 0.1s;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
.nice-treemap-tile:hover {
|
|
752
|
+
opacity: 0.85;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
.nice-treemap-tooltip {
|
|
756
|
+
position: absolute;
|
|
757
|
+
/* audit-allow: token-role — inverted chip like .nice-tooltip: the text colour is the
|
|
758
|
+
fill and the label uses --nice-text-inverse, so the pair flips together. */
|
|
759
|
+
background: var(--nice-text-primary, #0f172a);
|
|
760
|
+
color: var(--nice-text-inverse, #ffffff);
|
|
761
|
+
padding: var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);
|
|
762
|
+
border-radius: var(--nice-radius-sm, 4px);
|
|
763
|
+
font-size: 12px;
|
|
764
|
+
pointer-events: none;
|
|
765
|
+
z-index: 10;
|
|
766
|
+
white-space: nowrap;
|
|
767
|
+
}
|
|
768
|
+
`})]})};exports.CHART_COLORS=ge;exports.NiceBarGauge=Ue;exports.NiceBullet=qe;exports.NiceChart=ke;exports.NiceChart$1=Ve;exports.NiceChartAI=pt;exports.NiceCircularGauge=Xe;exports.NiceDrillDownChart=We;exports.NiceForecastChart=lt;exports.NiceFunnel=Ke;exports.NiceHeatMap=Le;exports.NiceLinearGauge=Ze;exports.NiceLiveChart=Oe;exports.NiceMapChart=yt;exports.NiceOrganizationChart=Be;exports.NicePieChart=Je;exports.NicePolarChart=st;exports.NiceRangeSelector=it;exports.NiceRealtimeChart=Fe;exports.NiceSankey=De;exports.NiceSankey$1=et;exports.NiceSankeyChart=bt;exports.NiceSparkline=ct;exports.NiceStockChart=Ee;exports.NiceTreeMap=Ie;exports.NiceTreeMap$1=rt;exports.NiceTreeMapChart=_t;exports.NiceVectorMap=Te;exports.NiceVectorMap$1=at;exports.createMockLiveChartSource=ft;exports.createSignalRLiveChartSource=ht;exports.createWebSocketLiveChartSource=ut;
|