@kubit-ui-web/react-charts 1.2.0 → 1.3.0
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/README.md +96 -0
- package/dist/cjs/components/zoomArea/hooks/useResponsiveCanvas.d.ts.map +1 -1
- package/dist/cjs/components/zoomArea/hooks/useResponsiveCanvas.js +6 -1
- package/dist/cjs/utils/cssGradientToSvg/cssGradientToSvg.d.ts.map +1 -1
- package/dist/cjs/utils/cssGradientToSvg/cssGradientToSvg.js +2 -2
- package/dist/cjs/utils/getCanvasDimensions/getCanvasDimensions.d.ts.map +1 -1
- package/dist/cjs/utils/getCanvasDimensions/getCanvasDimensions.js +13 -2
- package/dist/cjs/utils/index.d.ts +2 -0
- package/dist/cjs/utils/index.d.ts.map +1 -1
- package/dist/cjs/utils/index.js +2 -0
- package/dist/cjs/utils/logger/index.d.ts +2 -0
- package/dist/cjs/utils/logger/index.d.ts.map +1 -0
- package/dist/cjs/utils/logger/index.js +1 -0
- package/dist/cjs/utils/logger/logger.d.ts +45 -0
- package/dist/cjs/utils/logger/logger.d.ts.map +1 -0
- package/dist/cjs/utils/logger/logger.js +140 -0
- package/dist/cjs/utils/ssr/index.d.ts +2 -0
- package/dist/cjs/utils/ssr/index.d.ts.map +1 -0
- package/dist/cjs/utils/ssr/index.js +1 -0
- package/dist/cjs/utils/ssr/ssr.d.ts +80 -0
- package/dist/cjs/utils/ssr/ssr.d.ts.map +1 -0
- package/dist/cjs/utils/ssr/ssr.js +117 -0
- package/dist/cjs/utils/textBound/textBound.d.ts.map +1 -1
- package/dist/cjs/utils/textBound/textBound.js +17 -5
- package/dist/esm/components/zoomArea/hooks/useResponsiveCanvas.d.ts.map +1 -1
- package/dist/esm/components/zoomArea/hooks/useResponsiveCanvas.js +6 -1
- package/dist/esm/utils/cssGradientToSvg/cssGradientToSvg.d.ts.map +1 -1
- package/dist/esm/utils/cssGradientToSvg/cssGradientToSvg.js +2 -2
- package/dist/esm/utils/getCanvasDimensions/getCanvasDimensions.d.ts.map +1 -1
- package/dist/esm/utils/getCanvasDimensions/getCanvasDimensions.js +13 -2
- package/dist/esm/utils/index.d.ts +2 -0
- package/dist/esm/utils/index.d.ts.map +1 -1
- package/dist/esm/utils/index.js +2 -0
- package/dist/esm/utils/logger/index.d.ts +2 -0
- package/dist/esm/utils/logger/index.d.ts.map +1 -0
- package/dist/esm/utils/logger/index.js +1 -0
- package/dist/esm/utils/logger/logger.d.ts +45 -0
- package/dist/esm/utils/logger/logger.d.ts.map +1 -0
- package/dist/esm/utils/logger/logger.js +140 -0
- package/dist/esm/utils/ssr/index.d.ts +2 -0
- package/dist/esm/utils/ssr/index.d.ts.map +1 -0
- package/dist/esm/utils/ssr/index.js +1 -0
- package/dist/esm/utils/ssr/ssr.d.ts +80 -0
- package/dist/esm/utils/ssr/ssr.d.ts.map +1 -0
- package/dist/esm/utils/ssr/ssr.js +117 -0
- package/dist/esm/utils/textBound/textBound.d.ts.map +1 -1
- package/dist/esm/utils/textBound/textBound.js +17 -5
- package/dist/kubit-ui-web-react-charts.cjs.js +1 -1
- package/dist/kubit-ui-web-react-charts.es.js +1 -1
- package/dist/kubit-ui-web-react-charts.umd.js +1 -1
- package/dist/types/components/zoomArea/hooks/useResponsiveCanvas.d.ts.map +1 -1
- package/dist/types/utils/cssGradientToSvg/cssGradientToSvg.d.ts.map +1 -1
- package/dist/types/utils/getCanvasDimensions/getCanvasDimensions.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/logger/index.d.ts +2 -0
- package/dist/types/utils/logger/index.d.ts.map +1 -0
- package/dist/types/utils/logger/logger.d.ts +45 -0
- package/dist/types/utils/logger/logger.d.ts.map +1 -0
- package/dist/types/utils/ssr/index.d.ts +2 -0
- package/dist/types/utils/ssr/index.d.ts.map +1 -0
- package/dist/types/utils/ssr/ssr.d.ts +80 -0
- package/dist/types/utils/ssr/ssr.d.ts.map +1 -0
- package/dist/types/utils/textBound/textBound.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t,a,r,n={exports:{}},i={},o={exports:{}},s={};function c(){return t||(t=1,o.exports=function(){if(e)return s;e=1;var t=Symbol.for("react.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator,x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},f=Object.assign,R={};function g(e,t,a){this.props=e,this.context=t,this.refs=R,this.updater=a||x}function A(){}function _(e,t,a){this.props=e,this.context=t,this.refs=R,this.updater=a||x}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},A.prototype=g.prototype;var T=_.prototype=new A;T.constructor=_,f(T,g.prototype),T.isPureReactComponent=!0;var E=Array.isArray,y=Object.prototype.hasOwnProperty,v={current:null},m={key:!0,ref:!0,__self:!0,__source:!0};function C(e,a,r){var n,i={},o=null,s=null;if(null!=a)for(n in void 0!==a.ref&&(s=a.ref),void 0!==a.key&&(o=""+a.key),a)y.call(a,n)&&!m.hasOwnProperty(n)&&(i[n]=a[n]);var c=arguments.length-2;if(1===c)i.children=r;else if(1<c){for(var d=Array(c),l=0;l<c;l++)d[l]=arguments[l+2];i.children=d}if(e&&e.defaultProps)for(n in c=e.defaultProps)void 0===i[n]&&(i[n]=c[n]);return{$$typeof:t,type:e,key:o,ref:s,props:i,_owner:v.current}}function S(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var I=/\/+/g;function $(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function k(e,r,n,i,o){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var c=!1;if(null===e)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case t:case a:c=!0}}if(c)return o=o(c=e),e=""===i?"."+$(c,0):i,E(o)?(n="",null!=e&&(n=e.replace(I,"$&/")+"/"),k(o,r,n,"",function(e){return e})):null!=o&&(S(o)&&(o=function(e,a){return{$$typeof:t,type:e.type,key:a,ref:e.ref,props:e.props,_owner:e._owner}}(o,n+(!o.key||c&&c.key===o.key?"":(""+o.key).replace(I,"$&/")+"/")+e)),r.push(o)),1;if(c=0,i=""===i?".":i+":",E(e))for(var d=0;d<e.length;d++){var l=i+$(s=e[d],d);c+=k(s,r,n,l,o)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),d=0;!(s=e.next()).done;)c+=k(s=s.value,r,n,l=i+$(s,d++),o);else if("object"===s)throw r=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===r?"object with keys {"+Object.keys(e).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.");return c}function N(e,t,a){if(null==e)return e;var r=[],n=0;return k(e,r,"","",function(e){return t.call(a,e,n++)}),r}function L(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var b={current:null},O={transition:null},H={ReactCurrentDispatcher:b,ReactCurrentBatchConfig:O,ReactCurrentOwner:v};function w(){throw Error("act(...) is not supported in production builds of React.")}return s.Children={map:N,forEach:function(e,t,a){N(e,function(){t.apply(this,arguments)},a)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){return N(e,function(e){return e})||[]},only:function(e){if(!S(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},s.Component=g,s.Fragment=r,s.Profiler=i,s.PureComponent=_,s.StrictMode=n,s.Suspense=l,s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,s.act=w,s.cloneElement=function(e,a,r){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=f({},e.props),i=e.key,o=e.ref,s=e._owner;if(null!=a){if(void 0!==a.ref&&(o=a.ref,s=v.current),void 0!==a.key&&(i=""+a.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(d in a)y.call(a,d)&&!m.hasOwnProperty(d)&&(n[d]=void 0===a[d]&&void 0!==c?c[d]:a[d])}var d=arguments.length-2;if(1===d)n.children=r;else if(1<d){c=Array(d);for(var l=0;l<d;l++)c[l]=arguments[l+2];n.children=c}return{$$typeof:t,type:e.type,key:i,ref:o,props:n,_owner:s}},s.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},s.createElement=C,s.createFactory=function(e){var t=C.bind(null,e);return t.type=e,t},s.createRef=function(){return{current:null}},s.forwardRef=function(e){return{$$typeof:d,render:e}},s.isValidElement=S,s.lazy=function(e){return{$$typeof:h,_payload:{_status:-1,_result:e},_init:L}},s.memo=function(e,t){return{$$typeof:u,type:e,compare:void 0===t?null:t}},s.startTransition=function(e){var t=O.transition;O.transition={};try{e()}finally{O.transition=t}},s.unstable_act=w,s.useCallback=function(e,t){return b.current.useCallback(e,t)},s.useContext=function(e){return b.current.useContext(e)},s.useDebugValue=function(){},s.useDeferredValue=function(e){return b.current.useDeferredValue(e)},s.useEffect=function(e,t){return b.current.useEffect(e,t)},s.useId=function(){return b.current.useId()},s.useImperativeHandle=function(e,t,a){return b.current.useImperativeHandle(e,t,a)},s.useInsertionEffect=function(e,t){return b.current.useInsertionEffect(e,t)},s.useLayoutEffect=function(e,t){return b.current.useLayoutEffect(e,t)},s.useMemo=function(e,t){return b.current.useMemo(e,t)},s.useReducer=function(e,t,a){return b.current.useReducer(e,t,a)},s.useRef=function(e){return b.current.useRef(e)},s.useState=function(e){return b.current.useState(e)},s.useSyncExternalStore=function(e,t,a){return b.current.useSyncExternalStore(e,t,a)},s.useTransition=function(){return b.current.useTransition()},s.version="18.3.1",s}()),o.exports}var d=(r||(r=1,n.exports=function(){if(a)return i;a=1;var e=c(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function d(e,a,r){var i,c={},d=null,l=null;for(i in void 0!==r&&(d=""+r),void 0!==a.key&&(d=""+a.key),void 0!==a.ref&&(l=a.ref),a)n.call(a,i)&&!s.hasOwnProperty(i)&&(c[i]=a[i]);if(e&&e.defaultProps)for(i in a=e.defaultProps)void 0===c[i]&&(c[i]=a[i]);return{$$typeof:t,type:e,key:d,ref:l,props:c,_owner:o.current}}return i.Fragment=r,i.jsx=d,i.jsxs=d,i}()),n.exports),l=c();const u=l.forwardRef(({ariaHidden:e,ariaLabel:t,backgroundColor:a,caption:r,children:n,className:i,dataTestId:o,height:s,imageSrc:c,overflow:l,radius:u="0px",role:h,tabIndex:p,viewBox:x,width:f,...R},g)=>d.jsxs("svg",{ref:g,"aria-hidden":e,"aria-label":t,className:i,"data-testid":o,height:s,role:h,style:{backgroundColor:a,borderRadius:u,overflow:l},tabIndex:p,viewBox:x,width:f,onMouseDown:e=>e.preventDefault(),...R,children:[r&&d.jsx("title",{children:r}),c&&d.jsx("image",{height:s,href:c,width:f,x:"0",y:"0"}),n]})),h=(e,t,a=0)=>`${-a} ${-a} ${e} ${t}`,p={extraSpace:0,height:80,width:100},x=e=>{const t=new Map,a=()=>{const e={};return t.forEach((t,a)=>{e[a]=t}),e};return{addError:(r,n)=>{if(!n)return;const i={...n,type:r},o=t.get(r)||[];if(o.push(i),t.set(r,o),e){const t=a(),r={};Object.entries(t).forEach(([e,t])=>{const a=e;Array.isArray(t)&&t.length,r[a]=t}),e(r)}},clearErrors:()=>{t.clear(),e&&e({})},getAccumulatedErrors:a}},f=e=>JSON.stringify(e),R="%",g="rem",A=/^(\d+(\.\d+)?)(px|rem|%)?$/,_=e=>{if("number"==typeof e)return e;const t=e.match(A);if(!t)throw new Error(`Invalid string format: "${e}"`);const a=t[1];return t[3]===g?16*parseFloat(a):parseFloat(a)},T=l.createContext({}),E={HORIZONTAL:"HORIZONTAL",VERTICAL:"VERTICAL"},y={BAR_CHART_CONTEXT_ERROR:"BAR_CHART_CONTEXT_ERROR",BAR_CHART_PATH_ERROR:"BAR_CHART_PATH_ERROR",BAR_CHART_SEPARATOR_ERROR:"BAR_CHART_SEPARATOR_ERROR",BAR_CHART_X_AXIS_ERROR:"BAR_CHART_X_AXIS_ERROR",BAR_CHART_Y_AXIS_ERROR:"BAR_CHART_Y_AXIS_ERROR",GENERIC:"GENERIC",LINE_CHART_CONTEXT_ERROR:"LINE_CHART_CONTEXT_ERROR",LINE_CHART_PATH_ERROR:"LINE_CHART_PATH_ERROR",LINE_CHART_PROJECTION_ERROR:"LINE_CHART_PROJECTION_ERROR",LINE_CHART_SEPARATOR_ERROR:"LINE_CHART_SEPARATOR_ERROR",LINE_CHART_X_AXIS_ERROR:"LINE_CHART_X_AXIS_ERROR",LINE_CHART_Y_AXIS_ERROR:"LINE_CHART_Y_AXIS_ERROR"},v=e=>Array.isArray(e)?e:[e],m={BOTTOM:"BOTTOM",CENTER:"CENTER",CUSTOM:"CUSTOM",LEFT:"LEFT",RIGHT:"RIGHT",TOP:"TOP"},C=Object.entries({BAR_CHART_AXIS_INSUFFICIENT_TICKS:"Axis requires at least two ticks for proper bar scaling",BAR_CHART_AXIS_INVALID_SCALE:"Invalid axis scale for current bar values",BAR_CHART_DISTRIBUTION_INSUFFICIENT_SPACE:"Insufficient space for bar distribution with current configuration",BAR_CHART_DISTRIBUTION_INVALID_GAP:"Invalid gap between bars - must be >= 0 and allow bar rendering",BAR_CHART_DISTRIBUTION_OVERLAP:"Bar distribution results in overlapping bars",BAR_CHART_EMPTY_DATA:"No valid data entries found for bar chart rendering",BAR_CHART_INSUFFICIENT_SPACE_HEIGHT:"Insufficient height to render bars. Consider reducing bar count or increasing chart height",BAR_CHART_INSUFFICIENT_SPACE_WIDTH:"Insufficient width to render bars. Consider reducing bar width or increasing chart width",BAR_CHART_INVALID_VALUE:"Bar value must be a valid number for rendering",BAR_CHART_NEGATIVE_VALUE:"Negative values are not supported in this bar configuration",BAR_CHART_NO_DATA:"Data validation failed: no data provided for bar chart rendering",BAR_CHART_OVERLAP:"Bars are overlapping due to insufficient spacing",BAR_CHART_SEPARATOR_X_OUT_OF_RANGE:"Separator X position is outside valid bar range",BAR_CHART_SEPARATOR_Y_OUT_OF_RANGE:"Separator Y position is outside valid bar range",BAR_CHART_STACK_INVALID:"Invalid stacking configuration - all bars in stack must have consistent configuration",BAR_CHART_STACK_MISSING_VALUES:"Stack is incomplete - all bars in stack must have valid values"}).reduce((e,[t,a])=>(e[t]=new Error(a),e),{}),S=Object.entries({LINE_CHART_INVALID_CANVAS:"Canvas dimensions validation failed: both width and height must be > 0",LINE_CHART_NO_DATA:"Data validation failed: no data provided for chart rendering",LINE_CHART_PATH_ALL_VALUES_NULL:"Path data cannot be generated - all Y values are null or undefined",LINE_CHART_PATH_INSUFFICIENT_POINTS:"Unable to calculate curved path with insufficient points (minimum 2 required)",LINE_CHART_PATH_INVALID_DATAKEY:"DataKey must be a valid string",LINE_CHART_PROJECTION_INVALID_BOUNDS:"Invalid projection bounds - upper projection must be below lower projection",LINE_CHART_PROJECTION_LOWER_X_OUT_OF_RANGE:"Lower projection X coordinate is outside valid range (0-100)",LINE_CHART_PROJECTION_LOWER_Y_OUT_OF_RANGE:"Lower projection Y coordinate is outside chart area",LINE_CHART_PROJECTION_UPPER_X_OUT_OF_RANGE:"Upper projection X coordinate is outside valid range (0-100)",LINE_CHART_PROJECTION_UPPER_Y_OUT_OF_RANGE:"Upper projection Y coordinate is outside chart area",LINE_CHART_SEPARATOR_INVALID_COORDINATES:"Invalid separator position - coordinates overlap, cannot render separator",LINE_CHART_SEPARATOR_INVALID_X_BREAK_AXIS:"Invalid xBreakAxis value: cannot be parsed as number",LINE_CHART_SEPARATOR_INVALID_Y_BREAK_AXIS:"Invalid yBreakAxis value: cannot be parsed as number",LINE_CHART_SEPARATOR_X_OUT_OF_RANGE:"xBreakAxis value is outside data range",LINE_CHART_SEPARATOR_Y_OUT_OF_RANGE:"yBreakAxis value is outside data range",LINE_CHART_SINGLE_POINT:"Data validation failed: single data point provided, minimum 2 required for line chart",LINE_CHART_X_AXIS_IDENTICAL_VALUES:"X-axis range validation failed: minimum and maximum values are identical, cannot render chart line",LINE_CHART_X_AXIS_INSUFFICIENT_TICKS:"X-axis tick calculation: insufficient data points (1/2 minimum required)",LINE_CHART_X_AXIS_ZERO_LENGTH:"X-axis geometry validation failed: start and end X coordinates are identical (x1=x2), axis has zero length",LINE_CHART_Y_AXIS_IDENTICAL_VALUES:"Y-axis range validation failed: minimum and maximum values are identical, cannot render chart line",LINE_CHART_Y_AXIS_INSUFFICIENT_TICKS:"Y-axis tick calculation: insufficient data points (1/2 minimum required)",LINE_CHART_Y_AXIS_ZERO_LENGTH:"Y-axis geometry validation failed: start and end Y coordinates are identical (y1=y2), axis has zero length"}).reduce((e,[t,a])=>(e[t]=new Error(a),e),{}),I=(e,t)=>new Error(`Invalid value "${e}" for bar with dataKey "${t}". Must be a valid number.`),$=(e,t)=>new Error(`Negative value ${e} not allowed for bar with dataKey "${t}" in current configuration`),k="INVALID_X_TICK",N="BAR_CHART_NO_DATA",L="LINE_CHART_NO_DATA",b="LINE_CHART_PATH_ALL_VALUES_NULL",O="LINE_CHART_PATH_INSUFFICIENT_POINTS",H="LINE_CHART_PATH_INVALID_DATAKEY",w="LINE_CHART_SEPARATOR_INVALID_COORDINATES",j="LINE_CHART_SINGLE_POINT",B="LINE_CHART_X_AXIS_IDENTICAL_VALUES",D="LINE_CHART_X_AXIS_INSUFFICIENT_TICKS",M="LINE_CHART_X_AXIS_ZERO_LENGTH",P="LINE_CHART_Y_AXIS_IDENTICAL_VALUES",X="LINE_CHART_Y_AXIS_INSUFFICIENT_TICKS",F="LINE_CHART_Y_AXIS_ZERO_LENGTH",W={...C,...S,INVALID_X_TICK:new Error("[getXTicks] Invalid X tick values calculated")},V=e=>W[e],Y=e=>new Error(`DataKey "${e}" not found in dataset`),K=(e,t)=>new Error(`Canvas dimensions validation failed: width=${e}, height=${t} (both must be > 0)`),U=e=>new Error(`Invalid xBreakAxis value: '${e}' cannot be parsed as number`),z=e=>new Error(`Invalid yBreakAxis value: '${e}' cannot be parsed as number`),G=(e,t,a)=>new Error(`xBreakAxis value ${e} is outside data range (${t} - ${a})`),Z=(e,t,a)=>new Error(`yBreakAxis value ${e} is outside data range (${t} - ${a})`),q=({canvasHeight:e,canvasWidth:t,customBreakAxis:a,extraSpaceBottomY:r,extraSpaceLeftX:n,extraSpaceRightX:i,extraSpaceTopY:o,position:s})=>s===m.TOP?{x1:n,x2:t-i,y1:o,y2:o}:s===m.CENTER?{x1:n,x2:t-i,y1:e/2,y2:e/2}:s===m.CUSTOM?{x1:n,x2:t-i,y1:a,y2:a}:{x1:n,x2:t-i,y1:e-r,y2:e-r},J=({canvasHeight:e,canvasWidth:t,customBreakAxis:a,extraSpaceBottomY:r,extraSpaceLeftX:n,extraSpaceRightX:i,extraSpaceTopY:o,position:s})=>s===m.RIGHT?{x1:t-i,x2:t-i,y1:o,y2:e-r}:s===m.CENTER?{x1:t/2,x2:t/2,y1:o,y2:e-r}:s===m.CUSTOM?{x1:a,x2:a,y1:o,y2:e-r}:{x1:n,x2:n,y1:o,y2:e-r},Q=(e,t,a)=>t.map(t=>{if(isNaN(Number(t))){const a=e.find(e=>String(e.value)===String(t));return a?a.position:0}const{index:r,tick:n}=e.reduce((e,a,r)=>Math.abs(Number(a.value)-Number(t))<=Math.abs(Number(e.tick.value)-Number(t))?{index:r,tick:a}:e,{index:0,tick:e[0]}),i=Number(t),o=Number(n.value);if(i!==o){const t=e.map(e=>Number(e.value)),s=Math.min(...t),c=Math.max(...t);if(i<s)return e.at(0)?.position;if(i>c)return e.at(-1)?.position;const d=Math.abs(o-i),l=i>o,u=l?e[r+1]:e[r-1],h=100*d/Math.abs(Number(u.value)-o),p=Math.abs(n.position-u.position)*h/100;return a?l?n.position+p:n.position-p:l?n.position-p:n.position+p}return n.position}),ee=({initPos:e,maxSpaceAvailable:t,otherAxisSpace:a,securitySpace:r,tickValues:n})=>{const i=n.length-1,o=(t-a-r)/i;return n.map((t,a)=>({position:e+a*o+r/2,value:t}))},te=({initPos:e,maxSpaceAvailable:t,needAjusted:a,otherAxisSpace:r,securitySpace:n,tickValues:i})=>{const o=(t-r-n)/(i.length-1),s=a?n/2:0;return i.map((t,a)=>({position:e-a*o-s,value:t}))},ae="0",re="1",ne="fallbackData",ie=e=>e?Object.entries(e).reduce((e,[t,a])=>((t.startsWith("aria-")||t.startsWith("data-"))&&null!=a&&(e[t]=String(a)),e),{}):{},oe=({height:e="140%",width:t="140%",x:a="-20%",y:r="-20%",...n})=>d.jsx("defs",{children:d.jsx("filter",{height:e,id:n.id,width:t,x:a,y:r,children:d.jsx("feDropShadow",{...n.shadowSvgConfig})})}),se=-1/0,ce=l.forwardRef(({dataTestId:e,position:t,size:a=1,...r},n)=>d.jsx("circle",{...r,ref:n,cx:t?.x,cy:t?.y,"data-testid":`${e}-circle`,r:a/2})),de=(e,t,a,r,n)=>{let i="";const o=r===n,s=o?a:2*a;for(let a=0;a<s;a++){const c=o||a%2==0?r:n,d=2*Math.PI/s*a-Math.PI/2;i+=`${e+Math.cos(d)*c},${t+Math.sin(d)*c} `}return i.trim()},le=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:a=1,...r},n)=>{const i=de(t.x,t.y,6,a/2,a/2);return d.jsx("polygon",{...r,ref:n,"data-testid":`${e}-hexagon`,points:i})}),ue=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:a=1,...r},n)=>{const i=de(t.x,t.y,5,a/2,a/2);return d.jsx("polygon",{...r,ref:n,"data-testid":`${e}-pentagon`,points:i})}),he=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:a=1,...r},n)=>d.jsx("rect",{...r,ref:n,"data-testid":`${e}-square`,height:a,width:a,x:t.x-a/2,y:t.y-a/2})),pe=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:a=1,...r},n)=>{const i=a/2,o=i/2,s=de(t.x,t.y,5,i,o);return d.jsx("polygon",{...r,ref:n,"data-testid":`${e}-star`,points:s})}),xe=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:a=1,...r},n)=>{const i=`M ${t.x-a/2} ${t.y} H ${t.x+a/2} M ${t.x} ${t.y-a/2} V ${t.y+a/2}`;return d.jsx("path",{...r,ref:n,d:i,"data-testid":`${e}-straight`,strokeWidth:2})}),fe=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:a=1,...r},n)=>{const i=[`${t.x},${t.y-a/2}`,`${t.x-a/2},${t.y+a/2}`,`${t.x+a/2},${t.y+a/2}`].join(" ");return d.jsx("polygon",{...r,ref:n,"data-testid":`${e}-triangle`,points:i})}),Re={Circle:"circle",Hexagon:"hexagon",Pentagon:"pentagon",Square:"square",Star:"star",Straight:"straight",Triangle:"triangle"},ge={[Re.Circle]:ce,[Re.Hexagon]:le,[Re.Pentagon]:ue,[Re.Square]:he,[Re.Star]:pe,[Re.Straight]:xe,[Re.Triangle]:fe},Ae=l.forwardRef(({dataTestId:e="node",haloConfig:t,hasHalo:a=!1,onBlur:r,onClick:n,onDoubleClick:i,onFocus:o,onKeyDown:s,onMouseEnter:c,onMouseLeave:u,position:h={x:0,y:0},size:p=1,type:x=Re.Circle,...f},R)=>{const[g,A]=(e=>{const t=l.useRef(!1),a=l.useRef(null);l.useImperativeHandle(e,()=>a.current,[]);const r=e=>{t.current=!!e.autoClick};return l.useEffect(()=>{if(!a.current)return;const e=a.current;return e.addEventListener("click",r),()=>e.removeEventListener("click",r)},[]),[a,t]})(R),_={...f,className:`node ${f.className}`,onBlur:e=>{r?.(e)},onClick:e=>{n?.(e,{...f.data,nodePosition:h},A.current)},onDoubleClick:e=>{i?.(e,f.data)},onFocus:e=>{o?.(e,f.data)},onKeyDown:e=>{"Enter"===e.key&&s?.(e,f.data)},onMouseEnter:e=>{c?.(e,f.data)},onMouseLeave:e=>{u?.(e)}},T={className:f.className,fill:t?.fill||f.fill,fillOpacity:t?.fillOpacity||.25,opacity:t?.opacity||.3,stroke:t?.stroke||f.stroke,strokeWidth:t?.strokeWidth||f.strokeWidth},E=ge[x];return d.jsxs(d.Fragment,{children:[a&&d.jsx(E,{...T,"aria-hidden":"true",dataTestId:`${e}-halo`,position:h,size:p+p/2,tabIndex:-1}),d.jsx(E,{..._,ref:g,dataTestId:e,position:h,size:p})]})}),_e=l.forwardRef(({data:e,nodeConfig:t,tabIndex:a=0,x:r,y:n},i)=>{const o=t?ie(t):{};if(o["aria-label"]&&e&&"string"==typeof o["aria-label"]){const t=o["aria-label"];if(t.includes("{{")){const a=((e,t,a)=>{if(!e)return;const r=a??t.dataValue,n=Array.isArray(r)?r[t.index]:void 0,{xValue:i,yValue:o}=((e,t)=>({xValue:e&&t.xKey?e[t.xKey]?.toString()??"":"",yValue:e&&t.dataKey?e[t.dataKey]?.toString()??"":""}))(n,t);return((e,t,a,r)=>{let n=e;return void 0!==t.dataKey&&(n=n.replace(new RegExp("{{dataKey}}","g"),t.dataKey)),n=n.replace(new RegExp("{{xValue}}","g"),a),n=n.replace(new RegExp("{{yValue}}","g"),r),void 0!==t.index&&(n=n.replace(new RegExp("{{index}}","g"),(t.index+1).toString())),n})(e,t,i,o)})(t,{dataKey:e.dataKey,dataValue:e.dataValue,index:e.index??0,xKey:e.xKey},e.dataValue);a&&(o["aria-label"]=a)}}return d.jsx(d.Fragment,{children:t&&d.jsx(Ae,{...t,ref:i,...o,className:"node-path-focus-border",data:e,hasHalo:t.hasHalo,position:{x:r,y:n},tabIndex:a})})}),Te=l.forwardRef(({classNames:e="",fill:t="transparent",stroke:a="#0000FF",strokeWidth:r="1",focusConfig:n={stroke:"#0000FF",strokeWidth:"0.5"},hoverConfig:i={stroke:"#0000FF",strokeWidth:"0.5"},role:o="img",...s},c)=>{const{handleBlur:u,handleFocus:h,isFocused:p}=((e,t)=>{const[a,r]=l.useState(!1),n=l.useCallback(t=>{r(!0),e?.(t)},[e]);return{handleBlur:l.useCallback(e=>{r(!1),t?.(e)},[t]),handleFocus:n,isFocused:a}})(s.onFocus,s.onBlur),{handleMouseEnter:x,handleMouseLeave:f,isHovered:R}=((e,t)=>{const[a,r]=l.useState(!1);return{handleMouseEnter:l.useCallback(t=>{r(!0),e?.(t)},[e]),handleMouseLeave:l.useCallback(e=>{r(!1),t?.(e)},[t]),isHovered:a}})(s.onMouseEnter,s.onMouseLeave),g=l.useRef(null),A=l.useRef([]),_=l.useRef(null);l.useImperativeHandle(c,()=>({get main(){return _.current},get node(){return A.current},get path(){return g.current}}));const T=s.gradient&&((e,t="gradientePath")=>{const a=e.split(",").map(e=>e.trim()),r=parseInt(a[0],10),n=a.slice(1).map(e=>{const[t,a]=e.split(" ");return{color:t,offset:a}});let i="0%",o="0%",s="0%";switch(r){case 180:s="100%";break;case 90:o="100%";break;case 270:i="100%";break;default:return d.jsx(d.Fragment,{})}return d.jsx("defs",{children:d.jsx("linearGradient",{id:t,x1:i,x2:o,y1:"0%",y2:s,children:n.map((e,t)=>d.jsx("stop",{offset:e.offset,stopColor:e.color},`${t}-${e.offset}`.toString()))})})})(s.gradient),E=ie(s),y={...{...s,classNames:`path ${e}`,fill:T?"url(#gradientePath)":t,filter:"url(#shadow)",role:o,stroke:a,strokeWidth:r},...p&&n,...R&&i};return d.jsxs("g",{ref:_,tabIndex:-1,children:[T&&T,y.shadowSvgConfig&&d.jsx(oe,{id:"shadow",shadowSvgConfig:y.shadowSvgConfig}),d.jsxs("g",{"aria-label":y.ariaLabel,className:y.classNames,"data-draw":!0,filter:y.shadowSvgConfig&&y.filter,opacity:y.opacity,orientation:y.orientation,role:y.role,rotate:y.rotate,tabIndex:y.tabIndex,transform:y.transform,visibility:y.visibility,...E,onBlur:u,onClick:()=>{s.onClick?.(s.dataValue)},onDoubleClick:e=>{s.onDoubleClick?.(e,s.dataValue)},onFocus:h,onKeyDown:e=>{"Enter"===e.key&&s.onKeyDown?.(s.dataValue)},onMouseDown:e=>{e.preventDefault()},onMouseEnter:x,onMouseLeave:f,children:[d.jsx("path",{ref:g,d:y.d,"data-testid":y.dataTestId,fill:y.dFill?"transparent":y.fill,fillOpacity:y.fillOpacity,fillRule:y.fillRule,stroke:y.stroke,strokeDasharray:y.strokeDasharray,strokeDashoffset:y.strokeDashoffset,strokeLinecap:y.strokeLinecap,strokeLinejoin:y.strokeLinejoin,strokeMiterlimit:y.strokeMiterlimit,strokeOpacity:y.strokeOpacity,strokeWidth:y.strokeWidth,children:y.title&&d.jsx("title",{children:y.title})}),y.dFill&&d.jsx("path",{d:y.dFill,fill:y.fill,fillOpacity:y.fillOpacity,fillRule:y.fillRule})]}),y.points&&y.nodeConfig&&y.points.map(([e,t],a)=>{const r={dataKey:y.dataKey,dataValue:y.dataValue,index:a,xKey:y?.xKey};return d.jsx(_e,{ref:e=>A.current[a]=e,data:r,nodeConfig:y.nodeConfig,tabIndex:-1,x:e,y:t},`${a.toString()}`)})]})}),Ee=(e,t,a)=>e?t+a/2:t-a/2,ye=({barConfig:e,currentBars:t,endRounded:a,extraSpacing:r=0,order:n=1,orientation:i,startRounded:o,x1:s,x2:c,y1:l,y2:u})=>{const{barWidth:h,singleConfig:p}=e,x=(({barConfig:e,orientation:t,x1:a,x2:r,y1:n,y2:i})=>{const{gap:o=0,singleConfig:s}=e,c=t===E.HORIZONTAL,d=c?a:n,l=c?r:i,u={end:l<d,start:l>d};return s.reduce((e,t,a)=>{const{coverage:r}=t,n=((e,t)=>e/100*t)(r,l-d),i=0===a?d:Ee(u.start,e[a-1][1],o),c=a+1===s.length?l:Ee(u.end,i+n,o);return e.push([i,c]),e},[])})({barConfig:e,orientation:i,x1:s,x2:c,y1:l,y2:u});return d.jsx("g",{children:p.map((e,f)=>{const[R,g]="HORIZONTAL"===i?x[f]:[s,c],[A,_]="VERTICAL"===i?x[f]:[l,u],T=(({barWidth:e,currentBars:t,endRounded:a=0,extraSpacing:r,order:n,orientation:i,startRounded:o=0,x1:s,x2:c,y1:d,y2:l})=>{let u,h,p,x,f="Z";const R=(({barWidth:e,currentBars:t,extraSpacing:a,order:r,orientation:n})=>{const i=e/2,o=a/2,s=t%2==0,c=s?o:o+i,d=r-Math.ceil(t/2);let l=0;return 0===d?l=s?-o:i:d<0?l=n===E.HORIZONTAL?d*-c+e:d*c:d>0&&(l=n===E.HORIZONTAL?d*-c:d*c+e),l})({barWidth:e,currentBars:t,extraSpacing:r,order:n,orientation:i});if(i===E.HORIZONTAL){const t=s+o,r=c-a;o&&a?(u=`M ${t},${d+R}`,h=`L${r},${l+R}`,p=`Q${c+a} ${l+R-e/2}, ${r} ${l+R-e}`,x=`L${t},${d+R-e}`,f=`Q${s-o} ${d+R-e/2}, ${t} ${d+R}`):o?(u=`M ${t},${d+R}`,h=`L${c},${l+R}`,p=`L${c},${l+R-e}`,x=`L${t},${d+R-e}`,f=`Q${s-o} ${d+R-e/2}, ${t} ${d+R}`):a?(u=`M${s},${d+R}`,h=`L${r},${l+R}`,p=`Q${c+a} ${l+R-e/2}, ${r} ${l+R-e}`,x=`L${s},${d+R-e}`):(u=`M${s},${d+R}`,h=`L${c},${l+R}`,p=`L${c},${l+R-e}`,x=`L${s},${d+R-e}`)}else{const t=d-o,r=l+a;o&&a?(u=`M${s+R}, ${t}`,h=`L${c+R},${r}`,p=`Q${c+R-e/2} ${l-a}, ${c+R-e} ${r}`,x=`L${s+R-e},${t}`,f=`Q${s+R-e/2} ${d+o}, ${s+R} ${t}`):o?(u=`M${s+R}, ${t}`,h=`L${c+R},${l}`,p=`L${c+R-e},${l}`,x=`L${s+R-e},${t}`,f=`Q${s+R-e/2} ${d+o}, ${s+R} ${t}`):a?(u=`M${s+R},${d}`,h=`L${c+R},${r}`,p=`Q${c+R-e/2} ${l-a}, ${c+R-e} ${r}`,x=`L${c+R-e},${d}`):(u=`M${s+R},${d}`,h=`L${c+R},${l}`,p=`L${c+R-e},${l}`,x=`L${s+R-e},${d}`)}return`${u} ${h} ${p} ${x} ${f}`})({barWidth:h,currentBars:t,endRounded:f===p.length-1&&a?a:void 0,extraSpacing:r,order:n,orientation:i,startRounded:0===f&&o?o:void 0,x1:R,x2:g,y1:A,y2:_});return d.jsx(Te,{d:T,fill:e.color,hoverConfig:{stroke:"transparent",strokeWidth:"0"},stroke:"transparent",tabIndex:0,title:e.title},`${e.title}-${f.toString()}`)})})},ve=({barConfig:e,dataIdx:t,dataKey:a,order:r,...n})=>{const{addError:i,xAxisCoordinates:o,yAxisCoordinates:s,...c}=l.useContext(T),{coordinates:u,tickValues:h}=o,{coordinates:p,tickValues:x}=s,f=c.orientation===E.VERTICAL,R=f?c.pKey:a,g=f?a:c.pKey,A=c.data[t],_=A?.[R],y=A?.[g];l.useEffect(()=>{if(c.data.length>0&&!Object.prototype.hasOwnProperty.call(c.data[0],a))return void i?.("BAR_CHART_PATH_ERROR",{error:Y(a)});const e=Number(y);isNaN(e)?i?.("BAR_CHART_PATH_ERROR",{error:I(y,a)}):e<0&&i?.("BAR_CHART_PATH_ERROR",{error:$(e,a)})},[i,c.data,a,y]);const v=Q(h,[String(_)],!0)[0],m=Q(x,[String(y)])[0],C=f?{x1:v,x2:v,y1:u.y1,y2:m}:{x1:p.x1,x2:v,y1:m,y2:m};return d.jsx(ye,{barConfig:e,currentBars:c.barChildrenCount,extraSpacing:c.gapBetweenBars,order:r,orientation:c.orientation,...C,...n})},me=e=>{let t=0;return l.Children.toArray(e).forEach(e=>{l.isValidElement(e)&&e.type===ve&&e.props.order>t&&(t=e.props.order)}),t},Ce=e=>{if(0===e.length)return{numeric:{max:2,min:0,step:1}};const t=Math.min(...e.map(e=>parseFloat(e))),a=Math.max(...e.map(e=>parseFloat(e)));return{numeric:{max:a,min:t,step:Math.abs(a-t)/2}}},Se=({bound:e,data:t,fontSize:a,svgHeight:r,svgWidth:n,viewBox:i})=>{if(!window||!document||!t.length)return 0;const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("style","position: absolute; visibility: hidden; top: -9999px; left: -9999px;"),o.setAttribute("viewBox",i),o.setAttribute("width",n),o.setAttribute("height",r),document.body.appendChild(o);const s=t.map(t=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");r.setAttribute("font-size",a),r.textContent=t,o.appendChild(r);const n=r.getBBox()[e];return r.remove(),n});return o.remove(),Math.max(...s)},Ie=({ariaLabel:e="",className:t="line",dataTestId:a,tabIndex:r=-1,...n})=>d.jsx("line",{...n,"aria-label":e,className:t,"data-testid":a,tabIndex:r}),$e=({children:e,className:t="circle",tabIndex:a=-1,...r})=>d.jsx("text",{className:t,tabIndex:a,...r,children:e}),ke=({showTickLines:e,tick:t,tickLine:a,tickText:r})=>d.jsxs("g",{children:[e&&d.jsx(Ie,{...a}),r&&d.jsx($e,{...r,children:t.value})]}),Ne=(e,t,a=1)=>e>=t-a&&e<=t+a,Le=e=>{const{ariaLabel:t,className:a,dataTestId:r,opacity:n,stroke:i,strokeDasharray:o,strokeDashoffset:s,strokeLinecap:c,strokeLinejoin:d,strokeOpacity:l,strokeWidth:u,style:h,tabIndex:p,transform:x,x1:f,x2:R,y1:g,y2:A}=e;return{ariaLabel:t,className:a,dataTestId:r,opacity:n,stroke:i,strokeDasharray:o,strokeDashoffset:s,strokeLinecap:c,strokeLinejoin:d,strokeOpacity:l,strokeWidth:u,style:h,tabIndex:p,transform:x,x1:f,x2:R,y1:g,y2:A}},be=({canvasHeight:e=p.height,canvasWidth:t=p.width,cursor:a=0,extraSpace:r={bottom:0,left:0,right:0,top:0},position:n=m.BOTTOM,showTickLines:i=!1,tickLine:o,tickLineHover:s,tickText:c,tickValues:l=[],...u})=>{const h=ie(u);return d.jsxs("g",{...h,children:[d.jsx(Ie,{...Le(u)}),l&&l.length>0&&l.map((e,t)=>{const r=Ne(a,e.position)&&s?{...o,...s}:o,n="rotate"===c?.transform?`rotate(-30, ${e.position}, ${c.y})`:void 0;return d.jsx(ke,{showTickLines:i,tick:e,tickLine:{...r,x1:e.position,x2:e.position},tickText:{...c,transform:n,x:e.position}},`${t.toString()}`)})]})},Oe=(e,t,a)=>e===m.RIGHT?t+a:t-a,He=(e,t,a,r)=>e===m.TOP?a:t+a+r,we=({position:e=m.BOTTOM,tickLine:t,tickText:a,...r})=>{const{xAxisCoordinates:{coordinates:n,tickValues:i},...o}=l.useContext(T),s=He(e,n.y1,Number(a?.fontSize),a?.top??0),c=o.extraSpaceTopY,u=Number(o.canvasHeight)-o.extraSpaceBottomY;return d.jsx(be,{...n,...r,canvasHeight:Number(o.canvasHeight),canvasWidth:Number(o.canvasWidth),dataTestId:`${o.dataTestId}xAxis`,extraSpace:{left:o.extraSpaceLeftX,right:o.extraSpaceRightX},tickLine:{...t,y1:c,y2:u},tickText:{...a,y:s},tickValues:a?i:void 0})},je=({canvasWidth:e,cursor:t=0,extraSpace:a={bottom:0,left:0,right:0,top:0},position:r=m.LEFT,showTickLines:n=!0,tickLine:i,tickLineHover:o,tickText:s,tickValues:c=[],...l})=>{const u=ie(l);return d.jsxs("g",{...u,children:[d.jsx(Ie,{...Le(l)}),c&&c.length>0&&c.map((e,a)=>{const r=Ne(t,e.position)&&o?{...i,...o}:i,c="rotate"===s?.transform?`rotate(-30, ${s.x}, ${e.position})`:void 0;return d.jsx(ke,{showTickLines:n,tick:e,tickLine:{...r,y1:e.position,y2:e.position},tickText:{...s,transform:c,y:e.position}},`${a.toString()}`)})]})},Be=(e,t,a)=>{let r=0;switch(e){case"middle":r=t/2+a;break;case"end":r=t+a;break;default:r=0}return r},De=({position:e=m.LEFT,tickLine:t,tickText:a,...r})=>{const{yAxisCoordinates:{coordinates:n,tickValues:i},...o}=l.useContext(T),s=a?.textAnchor||"middle",c=(e===m.RIGHT?a?.right:a?.left)??0,u=Be(s,o.yAxisText,c),h=Oe(e,n.x1,u);return d.jsx(je,{...n,...r,canvasHeight:Number(o.canvasHeight),canvasWidth:Number(o.canvasWidth),dataTestId:`${o.dataTestId}yAxis`,tickLine:{...t,x1:o.extraSpaceLeftX,x2:Number(o.canvasWidth)-o.extraSpaceRightX},tickText:{...a,x:h},tickValues:a?i:void 0})},Me=e=>{if(e.custom)return e.custom?.values;if(e.numeric){const{max:t,min:a=0,step:r}=e.numeric;if(r>=Math.abs(t-a)||r<=0)return[a.toString()];const n=[];for(let e=a;e<=t;e+=r)n.push(e.toString());return n}},Pe=(e,t)=>e.flatMap(e=>Object.keys(e).filter(a=>a!==t&&"number"==typeof e[a]).map(t=>Number(e[t]))),Xe=(e,t,a,r,n,i,o,s)=>{const{position:c,tickText:d,tickValues:l}=e.props,u=d?.fontSize??0,h=u*r,p=l?Me(l):t.map(e=>e[a]),x=Se({bound:"width",data:p,fontSize:u,svgHeight:`${o}`,svgWidth:`${s}`,viewBox:i}),f=n>x?n:x;return{barChartXPosition:c||m.BOTTOM,extraSpaceBottomY:c===m.BOTTOM?h+(d?.top??0):0,extraSpaceTopY:c===m.TOP?h+(d?.bottom??0):0,securityXSpace:f,xBreakAxis:l?.numeric?l.numeric.breakAxis??0:d?.custom?.breakAxis??0,xData:p}},Fe=(e,t,a,r,n,i,o,s)=>{const{position:c,tickText:d,tickValues:l}=e.props,u=d?.fontSize??0,h=u*r,p=l||Ce([...new Set(Pe(t,a))]),x=Me(p),f=n>h?n:h,R=Se({bound:"width",data:x,fontSize:u,svgHeight:`${o}`,svgWidth:`${s}`,viewBox:i});return{barChartYPosition:c||m.LEFT,extraSpaceLeftX:c===m.LEFT?R+(d?.right??0):0,extraSpaceRightX:c===m.RIGHT?R+(d?.left??0):0,securityYSpace:f,yAxisText:R,yBreakAxis:l?.numeric?l.numeric.breakAxis??0:d?.custom?.breakAxis??0,yData:x}},We=({addError:e,ajustedX:t,ajustedY:a,canvasHeight:r,canvasWidth:n,children:i,data:o,gapBetweenBars:s,orientation:c,pKey:d,viewBox:u})=>{let h;if(!o||0===o.length){const t={error:V(N)};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}if(n<=0||r<=0){const t={error:K(n,r)};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}const p=me(i),x=20*p,f=(p-1)*s,R=c===E.VERTICAL?n:r;if(x+f>R){const t={error:(g=`Insufficient space: requires ${x+f}px but only ${R}px available`,new Error(`Invalid bar distribution for "all": ${g}`))};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}var g;const A=o&&o.length>0?o:[{[ne]:0,[d]:ae},{[ne]:0,[d]:re}],_=n>0?n:100,T=r>0?r:100,{barChartXPosition:v,barChartYPosition:C,extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:$,extraSpaceTopY:L,securityXSpace:b,securityYSpace:O,xAxisText:H,xBreakAxis:w,xData:j,yAxisText:W,yBreakAxis:Y,yData:U}=(({ajustedX:e,ajustedY:t,canvasHeight:a,canvasWidth:r,children:n,data:i,gapBetweenBars:o,orientation:s,pKey:c,viewBox:d})=>{let u={barChartXPosition:m.BOTTOM,barChartYPosition:m.LEFT,extraSpaceBottomY:0,extraSpaceLeftX:0,extraSpaceRightX:0,extraSpaceTopY:0,securityXSpace:0,securityYSpace:0,xAxisText:0,xBreakAxis:0,xData:[],yAxisText:0,yBreakAxis:0,yData:[]},h=o;const p=[];return l.Children.forEach(n,n=>{if(l.isValidElement(n))if(n.type!==ve||p.includes(n.props.order)||(p.push(n.props.order),h+=n.props.barConfig.barWidth??0),n.type===we){const t=s===E.VERTICAL?h:0;u={...u,...Xe(n,i,c,e,t,d,a,r)}}else if(n.type===De){const e=s===E.HORIZONTAL?h:0;u={...u,...Fe(n,i,c,t,e,d,a,r)}}}),u})({ajustedX:t,ajustedY:a,canvasHeight:T,canvasWidth:_,children:i,data:A,gapBetweenBars:s,orientation:c,pKey:d,viewBox:u}),z=v!==m.TOP&&v!==m.BOTTOM,G=ee({initPos:I,maxSpaceAvailable:_,otherAxisSpace:I+$,securitySpace:b,tickValues:j});if((G??[]).some(({position:e})=>isNaN(e))){const t={error:V(k)};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}if(G){const t=G.length<2,a=G.length>=2&&1===new Set(G.map(e=>e.value)).size;if(t){const t={error:V(D)};e?.("BAR_CHART_X_AXIS_ERROR",t),h||(h=t)}if(a){const t={error:V(B)};e?.("BAR_CHART_X_AXIS_ERROR",t),h||(h=t)}}const Z=C!==m.LEFT&&C!==m.RIGHT,ie=te({initPos:T-S,maxSpaceAvailable:T,needAjusted:c===E.HORIZONTAL,otherAxisSpace:L+S,securitySpace:O,tickValues:U});if(ie){const t=ie.length<2,a=ie.length>=2&&1===new Set(ie.map(e=>e.value)).size;if(t){const t={error:V(X)};e?.("BAR_CHART_Y_AXIS_ERROR",t),h||(h=t)}if(a){const t={error:V(P)};e?.("BAR_CHART_Y_AXIS_ERROR",t),h||(h=t)}}const oe=z?Q(ie||[],[String(w)])[0]:0,se=Z?Q(G||[],[String(Y)])[0]:0,ce=q({canvasHeight:T,canvasWidth:_,customBreakAxis:Number(oe),extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:$,extraSpaceTopY:L,position:v}),de=J({canvasHeight:T,canvasWidth:_,customBreakAxis:Number(se),extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:$,extraSpaceTopY:L,position:C});if(ce.x1===ce.x2){const t={error:V(M)};e?.("BAR_CHART_X_AXIS_ERROR",t),h||(h=t)}if(de.y1===de.y2){const t={error:V(F)};e?.("BAR_CHART_Y_AXIS_ERROR",t),h||(h=t)}const le={addError:e,crossXAxis:z,crossYAxis:Z,data:A,extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:$,extraSpaceTopY:L,securityXSpace:b,securityYSpace:O,xAxisCoordinates:{coordinates:ce,tickValues:G||(h?[{position:0,value:ae},{position:_,value:re}]:[])},xAxisText:H,yAxisCoordinates:{coordinates:de,tickValues:ie||(h?[{position:T,value:ae},{position:0,value:re}]:[])},yAxisText:W};return h?{...le,error:{...h,type:y.BAR_CHART_CONTEXT_ERROR}}:le},Ve=Object.assign(({canvasConfig:e=p,caption:t,children:a,classNames:r,data:n,dataTestId:i,gapBetweenBars:o=0,height:s="100%",onErrors:c,orientation:R,pKey:g,role:A,tabIndex:E,width:y="100%",...v})=>{const{extraSpace:m,height:C,width:S}=e,I=_(S),$=_(C),k=m?_(m):void 0,N=h(I,$,k),L=me(a),b=2*o,O=[d.jsx(we,{},"default-x-axis"),d.jsx(De,{},"default-y-axis")],H=l.Children.toArray(a)||[],w=O.concat(H),j=Math.max(I,$,k??0),B=I/j,D=$/j,M=l.useMemo(()=>x(c),[c]),P=f(n),X=l.useMemo(()=>(M.clearErrors(),We({addError:(e,t)=>{M.addError(e,t)},ajustedX:B,ajustedY:D,canvasHeight:$,canvasWidth:I,children:w,data:n,gapBetweenBars:b,orientation:R,pKey:g,viewBox:N})),[C,S,P,g,R,M.addError]);return d.jsx(u,{caption:t,className:r,dataTestId:i,height:s,role:A,tabIndex:E,viewBox:N,width:y,...v,children:d.jsx(T.Provider,{value:{...X,barChildrenCount:L,canvasExtraSpace:k,canvasHeight:$,canvasWidth:I,data:n,dataTestId:i,gapBetweenBars:o,orientation:R,pKey:g},children:a})})},{Path:ve,Separator:({areaSeparator:e,dataTestId:t,rightSeparator:a,topSeparator:r,xBreakAxis:n,yBreakAxis:i})=>{const{addError:o,crossXAxis:s,crossYAxis:c,xAxisCoordinates:u,yAxisCoordinates:h}=l.useContext(T);if(l.useEffect(()=>{if(void 0!==n){const e=u.tickValues.map(e=>e.value),t="string"==typeof n?parseFloat(n):n;if(isNaN(t))o?.("BAR_CHART_SEPARATOR_ERROR",{error:U(n)});else{const a=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(t<a||t>r)&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:G(t,a,r)})}}if(void 0!==i){const e=h.tickValues.map(e=>e.value),t="string"==typeof i?parseFloat(i):i;if(isNaN(t))o?.("BAR_CHART_SEPARATOR_ERROR",{error:z(i)});else{const a=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(t<a||t>r)&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:Z(t,a,r)})}}},[n,i,u.tickValues,h.tickValues,o]),!r&&!a&&!e)return d.jsx(d.Fragment,{});const p=n&&Q(u.tickValues,[n],!0)[0],x=i&&Q(h.tickValues,[i])[0],f=c?h.coordinates.x1:u.coordinates.x2,R=s?u.coordinates.y1:h.coordinates.y1,g=u.coordinates.x1,A=p??f,_=h.coordinates.y2,E=x??R;l.useEffect(()=>{g===A&&_===E&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:V(w)})},[g,A,_,E,o]);const y=`M${g} ${_} H ${A} V ${E} H ${g} Z`,v=`M${g} ${E} H ${A}`,m=`M${A} ${_} V ${E}`;return d.jsxs("g",{children:[d.jsx("path",{d:y,"data-testid":`${t}Area`,...e}),d.jsx("path",{d:v,"data-testid":`${t}Top`,...r}),d.jsx("path",{d:m,"data-testid":`${t}Right`,...a})]})},XAxis:we,YAxis:De}),Ye=l.createContext({}),Ke=({curved:e=!1,extendToBottom:t=!1,points:a,svgHeight:r})=>{if(0===a.length)return"";const[n,...i]=a;let o=`M ${n[0]} ${n[1]}`;return o+=e?i.reduce((e,t,r)=>{const[n,i]=a[r],[o,s]=t,c=.3*(o-n),d=[n+c,i],l=[o-c,s];return`${e} C ${d[0]} ${d[1]}, ${l[0]} ${l[1]}, ${o} ${s}`},""):i.reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,""),t&&(o+=` L ${i[i.length-1][0]} ${r} L ${n[0]} ${r} Z`),o},Ue=(e,t)=>new Error(`Invalid projection bounds - upper projection (${e}) must be below lower projection (${t})`),ze=(e,t)=>new Error(`${t?"Upper":"Lower"} projection X coordinate (${e}) is outside valid range (0-100)`),Ge=(e,t,a)=>new Error(`${a?"Upper":"Lower"} projection Y coordinate (${e}) is outside chart area (0-${t})`),Ze=(e,t)=>{if(!t)return e;const a=t<0,r=e*Math.abs(t)/100;return a?e-r:e+r},qe=(e,t,a)=>{if(!a)return e;const r=a<0,n=(0===e?t:e)*Math.abs(a)/100;return r?e+n:e-n},Je=({curved:e,lineProjection:t,points:a,svgHeight:r})=>{const{addError:n}=l.useContext(Ye),{lower:i,shapeColor:o,upper:s}=t,{xProjection:c,yProjection:u,...h}=s||{},{xProjection:p,yProjection:x,...f}=i||{},R=c||u?{x:c,y:u}:void 0,g=p||x?{x:p,y:x}:void 0;l.useEffect(()=>{if(R&&g){const e=R.y||0,t=g.y||0;e>=t&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Ue(e,t)})}if(R){const{x:e,y:t}=R;void 0!==e&&(e<0||e>100)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:ze(e,!0)}),void 0!==t&&(t<0||t>r)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Ge(t,r,!0)})}if(g){const{x:e,y:t}=g;void 0!==e&&(e<0||e>100)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:ze(e,!1)}),void 0!==t&&(t<0||t>r)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Ge(t,r,!1)})}},[R,g,r,n]);const{downPath:A,shapePath:_,upPath:T}=(({curved:e,lowerProjection:t,points:a,svgHeight:r,upperProjection:n})=>{const i=n||t;if(0===a.length&&!i)return{shapePath:""};const[o,...s]=a,c=`M ${o[0]} ${o[1]}`;let d=c,l=n?c:void 0,u=t?c:void 0;const h=[],p=[];s.forEach(([e,a])=>{const i=n?[Ze(e,n.x),qe(a,r,n.y)]:[e,a],o=t?[Ze(e,-(t.x??0)),qe(a,r,-(t.y??0))]:[e,a];h.push(i),p.push(o)});const x=n&&t?[...h,s.at(-1),...p.reverse(),o]:[...h,...p.reverse(),o];return e?(d+=x.reduce((e,t,a)=>{const r=0===a?o:x[a-1],[n,i]=r,[s,c]=t,d=.3*(s-n),l=[n+d,i],u=[s-d,c];return`${e} C ${l[0]} ${l[1]}, ${u[0]} ${u[1]}, ${s} ${c}`},""),l&&(l+=h.reduce((e,t,a)=>{const r=0===a?o:h[a-1],[n,i]=r,[s,c]=t,d=.3*(s-n),l=[n+d,i],u=[s-d,c];return`${e} C ${l[0]} ${l[1]}, ${u[0]} ${u[1]}, ${s} ${c}`},"")),u&&(u+=p.reverse().reduce((e,t,a)=>{const r=0===a?o:p[a-1],[n,i]=r,[s,c]=t,d=.3*(s-n),l=[n+d,i],u=[s-d,c];return`${e} C ${l[0]} ${l[1]}, ${u[0]} ${u[1]}, ${s} ${c}`},""))):(d+=x.reduce((e,t)=>`${e} L ${t?.[0]} ${t?.[1]}`,""),l&&(l+=h.reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,"")),u&&(u+=p.reverse().reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,""))),{downPath:u,shapePath:d,upPath:l}})({curved:e,lowerProjection:g,points:a,svgHeight:r,upperProjection:R});return d.jsxs("g",{className:"pointer-events-none",children:[d.jsx("path",{d:_,fill:o,stroke:"transparent",strokeWidth:"0.1"}),";",T&&d.jsx("path",{d:T,...h}),A&&d.jsx("path",{d:A,...f})]})},Qe=(e,t)=>e.map(e=>e[t]),et={formatTicksValues:(e,t)=>e.map(e=>({...e,value:t(e.value)}))},tt=({ariaLabel:e,position:t=m.BOTTOM,tickLine:a,tickText:r,valueFormatter:n=e=>e,...i})=>{const{xAxisCoordinates:{coordinates:o,tickValues:s},xCursor:c,...u}=l.useContext(Ye),h=He(t,o.y1,Number(r?.fontSize),r?.top??0),p=u.extraSpaceTopY,x=Number(u.canvasHeight)-u.extraSpaceBottomY,f=r?et.formatTicksValues(s,n):void 0,R=ie(i),g=e||i["aria-label"],A={...i,...R,...g&&{"aria-label":g}};return d.jsx(be,{...o,...A,canvasHeight:Number(u.canvasHeight),canvasWidth:Number(u.canvasWidth),cursor:c,dataTestId:`${u.dataTestId}xAxis`,extraSpace:{left:u.extraSpaceLeftX,right:u.extraSpaceRightX},tickLine:{...a,y1:p,y2:x},tickText:{...r,y:h},tickValues:f})},at=({ariaLabel:e,position:t=m.LEFT,tickLine:a,tickText:r,valueFormatter:n=e=>e,...i})=>{const{yAxisCoordinates:{coordinates:o,tickValues:s},yCursor:c,...u}=l.useContext(Ye),h=r?.textAnchor||"middle",p=(t===m.RIGHT?r?.right:r?.left)??0,x=Be(h,u.yAxisText,p),f=Oe(t,o.x1,x),R=r?et.formatTicksValues(s,n):void 0,g=ie(i),A=e||i["aria-label"],_={...i,...g,...A&&{"aria-label":A}};return d.jsx(je,{...o,..._,canvasHeight:Number(u.canvasHeight),canvasWidth:Number(u.canvasWidth),cursor:c,dataTestId:`${u.dataTestId}yAxis`,tickLine:{...a,x1:u.extraSpaceLeftX,x2:Number(u.canvasWidth)-u.extraSpaceRightX},tickText:{...r,x:f},tickValues:R})},rt={[R]:R,[g]:g},nt="WIDTH",it=/^(\d+(\.\d+)?)(px|rem|%)?$/,ot=e=>{if("number"==typeof e)return{unit:void 0,value:e};const t=e.match(it);if(!t)throw new Error(`Invalid string format: "${e}"`);const a=parseFloat(t[1]),r=t[3];return{unit:rt[r],value:a}},st=(e,t,a)=>{const r=a.parentElement;return r?e/100*(t===nt?r.clientWidth:r.clientHeight):0},ct=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),dt=({canvasHeight:e,canvasWidth:t,svgElement:a})=>{const{unit:r,value:n}=ot(t),i=r===R?st(n,nt,a):r===g?ct(n):n,{unit:o,value:s}=ot(e);return{parsedCanvasHeight:o===R?st(s,"HEIGHT",a):o===g?ct(s):s,parsedCanvasWidth:i}},lt=e=>{if(e.custom)return e.custom?.values;if(e.numeric){const{max:t,min:a=0,step:r}=e.numeric;if(r>=Math.abs(t-a)||r<=0)return[a.toString(),t.toString()];const n=[];for(let e=a;e<=t;e+=r)n.push(e.toString());return n}},ut=(e,t)=>e.flatMap(e=>Object.keys(e).filter(a=>a!==t&&"number"==typeof e[a]).map(t=>e[t])),ht=(e,t,a,r,n,i,o)=>{const{position:s,tickText:c,tickValues:d,valueFormatter:l}=e.props,u=c?.fontSize??0,h=u*r,p=d?lt(d):t.map(e=>e[a]),x=l?p.map(l):p,f=Se({bound:"width",data:x,fontSize:u,svgHeight:`${i}`,svgWidth:`${o}`,viewBox:n}),R=s===m.TOP;return{extraSpaceBottomY:s===m.BOTTOM?h+(c?.top??0):0,extraSpaceTopY:R?h+(c?.bottom??0):0,lineChartXPosition:s||m.BOTTOM,securityXSpace:f,xBreakAxis:d?.numeric?d.numeric.breakAxis??0:c?.custom?.breakAxis??0,xData:p}},pt=(e,t,a,r,n,i,o)=>{const{position:s,tickText:c,tickValues:d,valueFormatter:l}=e.props,u=c?.fontSize??"0",h=u*r,p=d||Ce([...new Set(ut(t,a))]),x=lt(p),f=l?x.map(l):x,R=Se({bound:"width",data:f,fontSize:u,svgHeight:`${i}`,svgWidth:`${o}`,viewBox:n}),g=h,A=s===m.RIGHT;return{extraSpaceLeftX:s===m.LEFT?R+(c?.right??0):0,extraSpaceRightX:A?R+(c?.left??0):0,lineChartYPosition:s||m.LEFT,securityYSpace:g,yAxisText:R,yBreakAxis:d?.numeric?d.numeric.breakAxis??0:c?.custom?.breakAxis??0,yData:x}},xt=({addError:e,ajustedX:t,ajustedY:a,canvasHeight:r,canvasWidth:n,children:i,data:o,viewBox:s,xKey:c})=>{let d;if(!o||0===o.length){const t={error:V(L)};e?.("LINE_CHART_CONTEXT_ERROR",t),d=t}if(o&&1===o.length){const t={error:V(j)};e?.("LINE_CHART_CONTEXT_ERROR",t),d=t}if(n<=0||r<=0){const t={error:K(n,r)};e?.("LINE_CHART_CONTEXT_ERROR",t),d=t}const u=o&&o.length>0?o:[{[c]:"0",y:0},{[c]:"1",y:1}],h=n>0?n:100,p=r>0?r:100,{extraSpaceBottomY:x,extraSpaceLeftX:f,extraSpaceRightX:R,extraSpaceTopY:g,lineChartXPosition:A,lineChartYPosition:_,securityXSpace:T,securityYSpace:E,xAxisText:v,xBreakAxis:C,xData:S,yAxisText:I,yBreakAxis:$,yData:N}=(({ajustedX:e,ajustedY:t,canvasHeight:a,canvasWidth:r,children:n,data:i,viewBox:o,xKey:s})=>{let c={extraSpaceBottomY:0,extraSpaceLeftX:0,extraSpaceRightX:0,extraSpaceTopY:0,lineChartXPosition:m.BOTTOM,lineChartYPosition:m.LEFT,securityXSpace:0,securityYSpace:0,xAxisText:0,xBreakAxis:0,xData:[],yAxisText:0,yBreakAxis:0,yData:[]};return l.Children.forEach(n,n=>{l.isValidElement(n)&&(n.type===tt?c={...c,...ht(n,i,s,e,o,a,r)}:n.type===at&&(c={...c,...pt(n,i,s,t,o,a,r)}))}),c})({ajustedX:t,ajustedY:a,canvasHeight:p,canvasWidth:h,children:i,data:u,viewBox:s,xKey:c}),b=A!==m.TOP&&A!==m.BOTTOM,O=ee({initPos:f,maxSpaceAvailable:h,otherAxisSpace:f+R,securitySpace:T,tickValues:S});if((O??[]).some(({position:e})=>isNaN(e))){const t={error:V(k)};e?.("LINE_CHART_CONTEXT_ERROR",t),d=t}if(O){const t=O.length<2,a=O.length>=2&&1===new Set(O.map(e=>e.value)).size;if(t){const t={error:V(D)};e?.("LINE_CHART_X_AXIS_ERROR",t),d||(d=t)}if(a){const t={error:V(B)};e?.("LINE_CHART_X_AXIS_ERROR",t),d||(d=t)}}const H=_!==m.LEFT&&_!==m.RIGHT,w=te({initPos:p-x,maxSpaceAvailable:p,otherAxisSpace:g+x,securitySpace:E,tickValues:N});if(w){const t=w.length<2,a=w.length>=2&&1===new Set(w.map(e=>e.value)).size;if(t){const t={error:V(X)};e?.("LINE_CHART_Y_AXIS_ERROR",t),d||(d=t)}if(a){const t={error:V(P)};e?.("LINE_CHART_Y_AXIS_ERROR",t),d||(d=t)}}const W=b?Q(w||[],[String(C)])[0]:0,Y=H?Q(O||[],[String($)])[0]:0,U=q({canvasHeight:p,canvasWidth:h,customBreakAxis:Number(W),extraSpaceBottomY:x,extraSpaceLeftX:f,extraSpaceRightX:R,extraSpaceTopY:g,position:A}),z=J({canvasHeight:p,canvasWidth:h,customBreakAxis:Number(Y),extraSpaceBottomY:x,extraSpaceLeftX:f,extraSpaceRightX:R,extraSpaceTopY:g,position:_});if(U.x1===U.x2){const t={error:V(M)};e?.("LINE_CHART_X_AXIS_ERROR",t),d||(d=t)}if(z.y1===z.y2){const t={error:V(F)};e?.("LINE_CHART_Y_AXIS_ERROR",t),d||(d=t)}const G={addError:e,crossXAxis:b,crossYAxis:H,extraSpaceBottomY:x,extraSpaceLeftX:f,extraSpaceRightX:R,extraSpaceTopY:g,securityXSpace:T,securityYSpace:E,xAxisCoordinates:{coordinates:U,tickValues:O||(d?[{position:0,value:"0"},{position:h,value:"1"}]:[])},xAxisText:v,yAxisCoordinates:{coordinates:z,tickValues:w||(d?[{position:p,value:ae},{position:0,value:re}]:[])},yAxisText:I};return d?{...G,error:{...d,type:y.LINE_CHART_CONTEXT_ERROR}}:G},ft=Object.assign(({ariaHidden:e,ariaLabel:t,canvasConfig:a=p,caption:r,children:n,classNames:i,data:o,dataTestId:s="line-chart",getPathArea:c,height:R="100%",onErrors:g,role:A,tabIndex:T,width:E="100%",xKey:y,...v})=>{const{extraSpace:m,height:C,width:S}=a,[I,$]=l.useState(""),[k,N]=l.useState({height:0,width:0}),L=m?_(m):void 0,b=h(k.width,k.height,L),O=[d.jsx(tt,{},"default-x-axis"),d.jsx(at,{},"default-y-axis")],H=l.Children.toArray(n)||[],w=O.concat(H),j=Math.max(k.width,k.height,L??0),B=isNaN(k.width/j)?0:k.width/j,D=isNaN(k.height/j)?0:k.height/j;(({attrName:e,children:t,originalValue:a,updateValue:r})=>{let n="";l.Children.toArray(t).forEach(t=>{if(l.isValidElement(t)){const a=t.props[e];a&&(n+=a)}}),n!==a&&r(n)})({attrName:"dataKey",children:w,originalValue:I,updateValue:$});const M=l.useMemo(()=>x(g),[g]),P=f(o),X=l.useMemo(()=>(M.clearErrors(),xt({addError:(e,t)=>{M.addError(e,t)},ajustedX:B,ajustedY:D,canvasHeight:k.height,canvasWidth:k.width,children:w,data:o,viewBox:b,xKey:y})),[k.width,k.height,P,y,I,M.addError]),{svgRef:F,xCursor:W,yCursor:V}=(({canvasHeight:e,canvasWidth:t})=>{const[[a,r],n]=l.useState([se,se]),i=l.useCallback((a,r)=>{const{height:i,left:o,top:s,width:c}=r.getBoundingClientRect(),d=a.clientX-o,l=a.clientY-s;n([d*t/c,l*e/i])},[t,e]),o=e=>{e.preventDefault()};return{svgRef:l.useCallback(e=>{e&&(e.addEventListener("touchstart",o),e.addEventListener("touchmove",t=>i(t.touches[0],e)),e.addEventListener("mousemove",t=>i(t,e))),e?.removeEventListener("touchstart",o),e?.removeEventListener("touchmove",t=>i(t.touches[0],e)),e?.removeEventListener("mousemove",t=>i(t,e))},[e,t]),xCursor:a,yCursor:r}})({canvasHeight:k.height,canvasWidth:k.width});return l.useEffect(()=>{const e=document.querySelector("[data-kbt-svg]");if(!e)return;const{parsedCanvasHeight:t,parsedCanvasWidth:a}=dt({canvasHeight:C,canvasWidth:S,svgElement:e});N({height:t,width:a})},[S,C]),l.useEffect(()=>{c?.({x1:X.extraSpaceLeftX,x2:k.width-X.extraSpaceRightX,y1:X.extraSpaceTopY,y2:k.height-X.extraSpaceBottomY})},[k.width,k.height]),d.jsx(u,{ref:F,ariaHidden:e,ariaLabel:t,caption:r,className:i,"data-kbt-svg":!0,dataTestId:s,height:R,role:A,tabIndex:T,viewBox:b,width:E,...v,children:d.jsx(Ye.Provider,{value:{...X,canvasExtraSpace:L,canvasHeight:k.height,canvasWidth:k.width,data:o,dataTestId:s,xCursor:W,xKey:y,yCursor:V},children:n})})},{Path:({ariaLabel:e,closestClick:t,curved:a,getNodeFocusInfo:r,getNodesCoords:n,indicatorConfig:i,lineProjection:o,onClick:s,...c})=>{const{addError:u,xAxisCoordinates:h,yAxisCoordinates:p,...x}=l.useContext(Ye);l.useEffect(()=>{if(!c.dataKey||"string"!=typeof c.dataKey)return void u?.("LINE_CHART_PATH_ERROR",{error:V(H)});if(x.data.length>0&&!Object.prototype.hasOwnProperty.call(x.data[0],c.dataKey))return void u?.("LINE_CHART_PATH_ERROR",{error:Y(c.dataKey)});if(a&&x.data.length<2)return void u?.("LINE_CHART_PATH_ERROR",{error:V(O)});const e=Qe(x.data,c.dataKey);e.length>0&&e.every(e=>null==e)&&u?.("LINE_CHART_PATH_ERROR",{error:V(b)})},[c.dataKey,a,x.data,u]);const{indicatorRef:f,pathRef:R}=((e,t)=>{const a=l.useRef(null),r=l.useRef(null);return l.useEffect(()=>{if(!t||!a.current||!r.current)return;const n=a.current,i=r.current;let o,s,c=0,d=n.getTotalLength();for(;d-c>.01;)o=(c+d)/2,s=n.getPointAtLength(o),s.x<e?c=o:d=o;const l=n.getPointAtLength(d);i.setAttribute("transform",`translate(${l.x}, ${l.y})`),i.setAttribute("pointer-events","none")},[e]),{indicatorRef:r,pathRef:a}})(x.xCursor,!!i),g=!!i&&x.xCursor!==-1/0,A=l.useRef(null),_=l.useRef(null),{autoClick:T,lineIndicator:E,...y}=i||{},v=x.extraSpaceTopY,m=Number(x.canvasHeight)-x.extraSpaceBottomY,{tickValues:C}=h,{tickValues:S}=p,I=Qe(x.data,x.xKey),$=Qe(x.data,c.dataKey),k=Q(C,I,!0),N=Q(S,$),L=k.map((e,t)=>[e,N[t]]),w=Ke({curved:a,extendToBottom:!1,points:L,svgHeight:Number(x.canvasHeight)-x.extraSpaceBottomY}),j=Ke({curved:a,extendToBottom:!!c.fill||!!c.gradient,points:L,svgHeight:Number(x.canvasHeight)-x.extraSpaceBottomY});l.useEffect(()=>{if(!A.current?.path)return;R.current=A.current.path;const e=A.current.main,t=A.current.node,a=I.map((e,t)=>({x:e,y:$[t]})),{mount:n,unmount:i}=(({data:e,getNodeFocusInfo:t,nodes:a,ref:r})=>{let n,i=!1;const o=r.querySelector("[data-draw]"),s=r=>{i&&("ArrowRight"===r.key?(n=void 0===n||n===a.length-1?0:n+1,a[n].focus(),t?.(e[n])):"ArrowLeft"===r.key&&(n=void 0===n||0===n?a.length-1:n-1,a[n].focus(),t?.(e[n])))},c=()=>{i=!0},d=()=>{i=!1},l=()=>{n=void 0};return{mount:()=>{r.addEventListener("focusin",c),r.addEventListener("focusout",d),o?.addEventListener("focus",l),window.addEventListener("keydown",e=>s(e))},unmount:()=>{r.removeEventListener("focusin",c),r.removeEventListener("focusout",d),o?.removeEventListener("focus",l),window.removeEventListener("keydown",e=>s(e))}}})({data:a,getNodeFocusInfo:r,nodes:t,ref:e});return n(),()=>i()},[]),l.useEffect(()=>{if(c.nodeConfig&&g&&T){const{idx:e,match:t}=((e,t)=>{let a=0,r=!1;for(let n=0;n<e.length;n++)if(Math.round(e[n])===Math.round(t)){r=!0,a=n;break}return{idx:a,match:r}})(k,x.xCursor);if(t&&e!==_.current){_.current=e;const t=new MouseEvent("click",{bubbles:!0});t.autoClick=!0,A.current?.node?.[e]?.dispatchEvent(t),navigator?.vibrate?.(200)}else _.current=null}},[x.xCursor]),l.useEffect(()=>{n?.(L)},[L]);const B=ie(c),D={...c,...B,...e&&{"aria-label":e}};return d.jsxs(d.Fragment,{children:[d.jsx(Te,{ref:A,d:w,dFill:j,dataTestId:`${x.dataTestId}path`,dataValue:x.data,points:L,xKey:x.xKey,onClick:e=>{if(s?.(e),t){const e=((e,t)=>{let a=0,r=Math.abs(e[0]-t);for(let n=1;n<e.length;n++){const i=Math.abs(e[n]-t);i<r&&(a=n,r=i)}return a})(k,x.xCursor),t=new MouseEvent("click",{bubbles:!0});t.autoClick=!1,A.current?.node?.[e]?.dispatchEvent(t)}},...D}),o&&d.jsx(Je,{curved:a,dataKey:c.dataKey,lineProjection:o,points:L,svgHeight:Number(x.canvasHeight)-x.extraSpaceBottomY}),g&&d.jsxs(d.Fragment,{children:[!!E&&d.jsx(Ie,{...E,className:"pointer-events-none",x1:x.xCursor,x2:x.xCursor,y1:v,y2:m}),d.jsx("g",{ref:f,className:"pointer-events-none",children:d.jsx(Ae,{...y})})]})]})},Separator:({areaSeparator:e,dataTestId:t,rightSeparator:a,topSeparator:r,xBreakAxis:n,yBreakAxis:i})=>{const{addError:o,crossXAxis:s,crossYAxis:c,xAxisCoordinates:u,yAxisCoordinates:h}=l.useContext(Ye);if(l.useEffect(()=>{if(void 0!==n){const e=u.tickValues.map(e=>e.value),t="string"==typeof n?parseFloat(n):n;if(isNaN(t))o?.("LINE_CHART_SEPARATOR_ERROR",{error:U(n)});else{const a=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(t<a||t>r)&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:G(t,a,r)})}}if(void 0!==i){const e=h.tickValues.map(e=>e.value),t="string"==typeof i?parseFloat(i):i;if(isNaN(t))o?.("LINE_CHART_SEPARATOR_ERROR",{error:z(i)});else{const a=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(t<a||t>r)&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:Z(t,a,r)})}}},[n,i,u.tickValues,h.tickValues,o]),!r&&!a&&!e)return d.jsx(d.Fragment,{});const p=n&&Q(u.tickValues,[n],!0)[0],x=i&&Q(h.tickValues,[i])[0],f=c?h.coordinates.x1:u.coordinates.x2,R=s?u.coordinates.y1:h.coordinates.y1,g=u.coordinates.x1,A=p??f,_=h.coordinates.y2,T=x??R;l.useEffect(()=>{g===A&&_===T&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:V(w)})},[g,A,_,T,o]);const E=`M${g} ${_} H ${A} V ${T} H ${g} Z`,y=`M${g} ${T} H ${A}`,v=`M${A} ${_} V ${T}`;return d.jsxs("g",{children:[d.jsx("path",{d:E,"data-testid":`${t}Area`,...e}),d.jsx("path",{d:y,"data-testid":`${t}Top`,...r}),d.jsx("path",{d:v,"data-testid":`${t}Right`,...a})]})},XAxis:tt,YAxis:at}),Rt=({children:e,dataTestId:t,height:a,width:r,x:n,y:i})=>d.jsx("foreignObject",{"data-testid":t,height:a,width:r,x:n,y:i,children:e}),gt=l.createContext({}),At=(e,t,a)=>({x:e.x+t*Math.cos(a),y:e.y+t*Math.sin(a)}),_t=({center:e,innerEnd:t,innerRadius:a,singleStroke:r})=>{if(!r)return a>0?`L ${t.x},${t.y}`:`L ${e.x},${e.y}`},Tt="CLOCKWISE",Et=({canvasHeight:e,canvasWidth:t,color:a="blue",gap:r,halfChart:n,innerRadius:i,radius:o,singleStroke:s,startAngle:c,total:l,value:u,...h})=>{const p=(({canvasHeight:e,canvasWidth:t,customRadius:a,gap:r,halfChart:n,innerRadius:i,rotateDirection:o,singleStroke:s,startAngle:c,total:d,value:l})=>{const u=n?2*e:e,h=Math.min(t,u)/2,p=a&&a<h?a:h,x=n?Math.PI:2*Math.PI,f={x:t/2,y:n?e:e/2},R=s?2*d:d,g=100*l/R*x/100,A=r/p,{carryAngle:_,finalAngle:T,initialAngle:E}=(({angleEquivalent:e,direction:t,gapAngle:a,startAngle:r})=>{const n=t===Tt;return{carryAngle:n?r+e:r-e,finalAngle:n?r+e-a/2:r-e+a/2,initialAngle:n?r+a/2:r-a/2}})({angleEquivalent:g,direction:o,gapAngle:A,startAngle:c.current});c.current=_;const y=x*l/R-A<=Math.PI?"0":"1",v=At(f,i,E),m=At(f,i,T),C=At(f,p,E);return(({center:e,innerEnd:t,innerRadius:a,innerStart:r,largeArcFlag:n,outerEnd:i,outerStart:o,radius:s,rotateDirection:c,singleStroke:d})=>{let l,u,h,p,x,f,R,g,A,_;return c===Tt?(l=`M ${o.x},${o.y}`,u=`A ${s},${s} 0 ${n} 1 ${i.x}, ${i.y}`,h=_t({center:e,innerEnd:t,innerRadius:a,singleStroke:d}),p=d?`M ${t.x},${t.y}`:void 0,x=a>0?`A ${a},${a} 0 ${n} 0 ${r.x},${r.y}`:void 0,f=`M ${o.x},${o.y}`,g=`M ${t.x},${t.y}`,R=`A ${s},${s} 0 ${n} 0 ${i.x},${i.y}`,A=`A ${a},${a} 0 ${n} 1 ${r.x},${r.y}`,_=d?void 0:"Z"):(l=`M ${o.x} ${o.y}`,u=`A ${s},${s} 0 ${n},0 ${i.x}, ${i.y}`,h=_t({center:e,innerEnd:t,innerRadius:a,singleStroke:d}),p=d?`M ${t.x},${t.y}`:void 0,x=a>0?`A ${a}, ${a} 0 ${n},1 ${r.x},${r.y}`:void 0,f=`M ${o.x},${o.y}`,g=`M ${t.x},${t.y}`,R=`A ${s},${s} 0 ${n} 1 ${i.x},${i.y}`,A=`A ${a},${a} 0 ${n} 0 ${r.x},${r.y}`,_=d?void 0:"Z"),[l,u,h,p,x,_].concat(d?[f,R,g,A]:[]).filter(Boolean).join(" ")})({center:f,innerEnd:m,innerRadius:i,innerStart:v,largeArcFlag:y,outerEnd:At(f,p,T),outerStart:C,radius:p,rotateDirection:o,singleStroke:s})})({canvasHeight:e,canvasWidth:t,customRadius:o,gap:r,halfChart:n,innerRadius:i,singleStroke:s,startAngle:c,total:l,value:u});return d.jsx(Te,{...h,d:p,dataValue:u,fill:a})},yt=({dataKey:e,fill:t,gap:a,innerRadius:r,radius:n,...i})=>{const o=String(e),{canvasHeight:s,canvasWidth:c,data:u,dataTestId:h,halfChart:p}=l.useContext(gt),x=p?0:-Math.PI/2,f=l.useRef(x),R=u[o]?.reduce((e,t)=>e+t.value,0),g=1===u[o]?.length,A=r?_(r):void 0,T=n?_(n):void 0;return u[o]?.length?d.jsx("g",{children:u[o].map((e,r)=>l.createElement(Et,{...i,...e,key:`${r.toString()}`,canvasHeight:s,canvasWidth:c,color:e.color||t,dataTestId:`${h}path-${r}`,gap:a,halfChart:p,innerRadius:A,radius:T,singleStroke:g,startAngle:f,total:R}))}):d.jsx(d.Fragment,{})},vt=Object.assign(({ariaHidden:e,ariaLabel:t,canvasConfig:a=p,caption:r,children:n,classNames:i,data:o,dataTestId:s="pie-chart",halfChart:c,height:x="100%",radius:f="50%",role:R,tabIndex:g,width:A="100%",...T})=>{const{extraSpace:E,height:y,width:v}=a,m=_(v),C=_(y),S=E?_(E):void 0,I=h(m,C,S),$=l.useMemo(()=>(({canvasHeight:e,canvasWidth:t,children:a,halfChart:r})=>{let n,i;l.Children.forEach(a,e=>{if(l.isValidElement(e)&&e.type===yt){const{innerRadius:t}=e.props;if(!t)return;const a=_(t);(!n||a<n)&&(n=a)}}),n&&(i=2*n);const o=i??0,s=r?o/2:o,c=r?e:e/2;return{foreignObject:{height:s,width:o,x:t/2-o/2,y:r?c-s:c-s/2}}})({canvasHeight:C,canvasWidth:m,children:n,halfChart:c}),[y,v,c]);return d.jsx(u,{ariaHidden:e,ariaLabel:t,caption:r,className:i,dataTestId:s,height:x,radius:f,role:R,tabIndex:g,viewBox:I,width:A,...T,children:d.jsx(gt.Provider,{value:{...$,canvasHeight:C,canvasWidth:m,data:o,dataTestId:s,halfChart:c},children:n})})},{Foreign:({children:e,dataTestId:t,height:a,width:r,x:n,y:i,...o})=>{const{dataTestId:s,foreignObject:c}=l.useContext(gt),u=!r&&c?.width?c.width:r,h=!a&&c?.height?c.height:a,p=!n&&c?.x?c.x:n,x=!i&&c?.y?c.y:i,f=!t&&s?`${s}-foreign-object`:t;return d.jsx(Rt,{...o,dataTestId:f,height:h,width:u,x:p,y:x,children:e})},Path:yt}),mt=({fill:e="#8f8f8f",x:t,y:a})=>d.jsxs("g",{fill:e,pointerEvents:"none",transform:`translate(${t-5}, ${a-5})`,children:[d.jsx("path",{d:"M4.99948 9.99802C4.47168 9.99802 4.04419 9.64335 4.04419 9.20547V0.79255C4.04419 0.354666 4.47168 0 4.99948 0C5.52728 0 5.95477 0.354666 5.95477 0.79255V9.20745C5.95477 9.64533 5.52728 10 4.99948 10V9.99802Z"}),d.jsx("path",{d:"M0.955289 8.78839C0.427492 8.78839 0 8.43372 0 7.99584V2.00416C0 1.56628 0.427492 1.21161 0.955289 1.21161C1.48309 1.21161 1.91058 1.56628 1.91058 2.00416V7.99584C1.91058 8.43372 1.48309 8.78839 0.955289 8.78839Z"}),d.jsx("path",{d:"M8.08936 7.99584C8.08936 8.43372 8.51685 8.78839 9.04464 8.78839C9.57244 8.78839 9.99993 8.43372 9.99993 7.99584V2.00416C9.99993 1.56628 9.57244 1.21161 9.04464 1.21161C8.51685 1.21161 8.08936 1.56628 8.08936 2.00416V7.99584Z"})]}),Ct=({linesData:e})=>d.jsx(d.Fragment,{children:e.map((e,t)=>d.jsxs("g",{children:[e.config.fill&&e.fillPath&&d.jsx("path",{d:e.fillPath,fill:e.config.fill,fillOpacity:e.config.fillOpacity||.2,stroke:"none"}),d.jsx("path",{d:e.linePath,fill:"none",stroke:e.config.stroke||"#0078D4",strokeWidth:e.config.strokeWidth||1})]},e.config.dataKey||e.config.yKey||t))}),St={FOCUS_COLOR:"#0078D4",FOCUS_INNER:"#ffffff",INNER_FOCUS_STROKE_WIDTH:2,OUTER_FOCUS_STROKE_WIDTH:2,OUTLINES_GAP:0},It=({elementHeight:e,elementPosition:t,elementStrokeWidth:a=0,elementType:r,elementWidth:n,gap:i=0,innerStrokeWidth:o=2,outlineStrokeWidth:s=2})=>{if("circle"===r){const e=n/2+a/2+o/2+i,r=e+o/2+s/2;return{inner:{cx:t.x,cy:t.y,r:e},outer:{cx:t.x,cy:t.y,r:r},type:"circle"}}const c=n+a+o+2*i,d=e+a+o+2*i,l=c+o+s,u=d+o+s;return{inner:{height:d,width:c,x:t.x-c/2,y:t.y-d/2},outer:{height:u,width:l,x:t.x-l/2,y:t.y-u/2},type:"rectangle"}},$t=(e,t,a)=>{const r=e.start/Math.max(1,t-1)*a;return{endX:e.end/Math.max(1,t-1)*a,startX:r}},kt=(e,t,a)=>{const r=Math.max(0,Math.min(t,e))/t;return Math.round(r*(a-1))},Nt=(e,t,a=.1)=>{const r=Math.max(0,Math.min(e.start,t-1-a));return{end:Math.min(t-1,Math.max(e.end,r+a)),start:r}},Lt=e=>({end:Math.max(0,e-1),start:0}),bt=(e,t)=>0===e.start&&e.end===t-1,Ot=({endX:e,focusConfig:t,height:a,isFocused:r,startX:n})=>{if(!r)return null;const i=e-n,o=It({elementHeight:a,elementPosition:{x:n+i/2,y:a/2},elementStrokeWidth:0,elementType:"rectangle",elementWidth:i,gap:t.gap,innerStrokeWidth:t.innerStrokeWidth,outlineStrokeWidth:t.outlineStrokeWidth}),s=t.outlineColor,c=t.innerColor,l=t.outlineStrokeWidth,u=t.innerStrokeWidth;return"rectangle"!==o.type?null:d.jsxs("g",{pointerEvents:"none",children:[d.jsx("rect",{fill:"none",height:o.outer.height,stroke:s,strokeWidth:l,width:o.outer.width,x:o.outer.x,y:o.outer.y}),d.jsx("rect",{fill:"none",height:o.inner.height,stroke:c,strokeWidth:u,width:o.inner.width,x:o.inner.x,y:o.inner.y})]})},Ht=({currentRange:e,dataLength:t,dataTestId:a,endX:r,height:n,onBlur:i,onFocus:o,onKeyDown:s,onMouseDown:c,onTouchStart:l,screenReaderText:u,selectionConfig:h,startX:p})=>{const x=h.hideOverlayOnFullRange&&bt(e,t);return d.jsx(d.Fragment,{children:d.jsx("rect",{"aria-label":u,"aria-valuemax":t-1,"aria-valuemin":0,"aria-valuetext":u,cursor:"grab","data-testid":a,fill:h.fill,fillOpacity:h.fillOpacity,height:n,role:"slider",stroke:h.stroke,strokeWidth:h.strokeWidth,style:{outline:"none",visibility:x?"hidden":"visible"},tabIndex:0,width:r-p,x:p,y:0,onBlur:i,onFocus:o,onKeyDown:s,onMouseDown:c,onTouchStart:l})})},wt="#8f8f8f",jt=({dataTestId:e,focusConfig:t,handlerConfig:a,height:r,isFocused:n,max:i,min:o,onBlur:s,onFocus:c,onKeyDown:l,onMouseDown:u,onTouchStart:h,screenReaderText:p,x:x})=>{const f=r/2,R=(e=>({fill:e?.fill||"#ffffff",iconColor:e?.iconColor||wt,radius:e?.radius||17,stroke:e?.stroke||wt,strokeWidth:e?.strokeWidth||1,verticalLineStroke:e?.verticalLineStroke||wt,verticalLineStrokeWidth:e?.verticalLineStrokeWidth||2}))(a),g=It({elementHeight:2*R.radius,elementPosition:{x:x,y:f},elementStrokeWidth:"number"==typeof R.strokeWidth?R.strokeWidth:parseFloat(R.strokeWidth.toString()),elementType:"circle",elementWidth:2*R.radius,gap:t.gap,innerStrokeWidth:t.innerStrokeWidth,outlineStrokeWidth:t.outlineStrokeWidth});return d.jsxs("g",{"data-testid":`${e}-group`,children:[d.jsx("line",{pointerEvents:"none",stroke:R.verticalLineStroke,strokeWidth:R.verticalLineStrokeWidth,x1:x,x2:x,y1:0,y2:r}),d.jsx("circle",{"aria-label":p,"aria-valuemax":i,"aria-valuemin":o,"aria-valuetext":p,cursor:"ew-resize",cx:x,cy:f,"data-testid":e,fill:R.fill,r:R.radius,role:"slider",stroke:R.stroke,strokeWidth:R.strokeWidth,style:{outline:"none"},tabIndex:0,onBlur:s,onFocus:c,onKeyDown:l,onMouseDown:u,onTouchStart:h}),d.jsx(mt,{fill:R.iconColor,x:x,y:f}),n&&"circle"===g.type&&d.jsxs("g",{pointerEvents:"none",children:[d.jsx("circle",{cx:g.outer.cx,cy:g.outer.cy,fill:"none",r:g.outer.r,stroke:t.outlineColor,strokeWidth:t.outlineStrokeWidth}),d.jsx("circle",{cx:g.inner.cx,cy:g.inner.cy,fill:"none",r:g.inner.r,stroke:t.innerColor,strokeWidth:t.innerStrokeWidth})]})]})},Bt={END_HANDLER:"END_HANDLER",SELECTION_AREA:"SELECTION_AREA",START_HANDLER:"START_HANDLER"},Dt=e=>{const{currentRange:t,dataLength:a,interactionConfig:r,onRangeChange:n,width:i}=e,o=l.useRef(null),[s,c]=l.useState(null),d=l.useCallback(e=>()=>{c(e)},[]),u=l.useCallback(e=>()=>{c(e)},[]),h=l.useCallback(e=>{if(!s||!o.current)return;const c=o.current;if(!c)return;const d=e-c.getBoundingClientRect().left,l=kt(d,i,a),u=((e,t,a,r,n)=>{const i={...t};if(e===Bt.START_HANDLER)i.start=Math.max(0,Math.min(a,t.end-n.minHandlerDistance));else if(e===Bt.END_HANDLER)i.end=Math.min(r-1,Math.max(a,t.start+n.minHandlerDistance));else if(e===Bt.SELECTION_AREA){const e=t.end-t.start,n=Math.max(0,Math.min(r-1-e,a-e/2));i.start=n,i.end=n+e}return i})(s,t,l,a,r),h=Nt(u,a,r.minHandlerDistance);n(h)},[s,i,a,t,n,r]),p=l.useCallback(e=>{h(e.clientX)},[h]),x=l.useCallback(e=>{0!==e.touches.length&&(e.preventDefault(),h(e.touches[0].clientX))},[h]),f=l.useCallback(()=>{c(null)},[]),R=l.useCallback(()=>{c(null)},[]);return l.useEffect(()=>{if(s)return document.addEventListener("mousemove",p),document.addEventListener("mouseup",f),document.addEventListener("touchmove",x,{passive:!1}),document.addEventListener("touchend",R),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",f),document.removeEventListener("touchmove",x),document.removeEventListener("touchend",R)}},[s,p,f,x,R]),{groupRef:o,handleMouseDown:d,handleTouchStart:u,isDragging:s}},Mt=e=>{const{currentRange:t,dataLength:a,interactionConfig:r,onRangeChange:n}=e;return{handleKeyDown:l.useCallback(e=>i=>{const o=i.shiftKey?r.keyboardFastStep:r.keyboardStep;let s={...t};switch(i.key){case"ArrowLeft":case"ArrowDown":i.preventDefault(),s=((e,t,a,r)=>{const n={...t};if(e===Bt.START_HANDLER)n.start=Math.max(0,t.start-a);else if(e===Bt.END_HANDLER)n.end=Math.max(t.start+r.minHandlerDistance,t.end-a);else if(e===Bt.SELECTION_AREA){const e=t.end-t.start,r=Math.max(0,t.start-a);n.start=r,n.end=r+e}return n})(e,t,o,r);break;case"ArrowRight":case"ArrowUp":i.preventDefault(),s=((e,t,a,r,n)=>{const i={...t};if(e===Bt.START_HANDLER)i.start=Math.min(t.end-n.minHandlerDistance,t.start+a);else if(e===Bt.END_HANDLER)i.end=Math.min(r-1,t.end+a);else if(e===Bt.SELECTION_AREA){const e=t.end-t.start,n=Math.min(r-1-e,t.start+a);i.start=n,i.end=n+e}return i})(e,t,o,a,r);break;case"Home":i.preventDefault(),s=((e,t,a)=>{const r={...t};if(e===Bt.START_HANDLER)r.start=0;else if(e===Bt.END_HANDLER)r.end=a-1;else if(e===Bt.SELECTION_AREA){const e=t.end-t.start;r.start=0,r.end=e}return r})(e,t,a);break;case"End":i.preventDefault(),s=((e,t,a,r)=>{const n={...t};if(e===Bt.START_HANDLER)n.start=t.end-r.minHandlerDistance;else if(e===Bt.END_HANDLER)n.end=a-1;else if(e===Bt.SELECTION_AREA){const e=t.end-t.start;n.start=a-1-e,n.end=a-1}return n})(e,t,a,r);break;default:return}const c=Nt(s,a,r.minHandlerDistance);n(c)},[t,a,n,r])}},Pt=({canvasConfig:e,dataTestId:t,extraSpace:a=0,height:r,width:n})=>{const[i,o]=l.useState({height:0,width:0}),s=l.useMemo(()=>e||{extraSpace:a,height:r,width:n},[e,n,r,a]),{extraSpace:c,height:d,width:u}=s,p=c?_(c):void 0;l.useEffect(()=>{const e=document.querySelector(`[data-testid="${t}"]`);if(!e)return;const a=()=>{const{parsedCanvasHeight:t,parsedCanvasWidth:a}=dt({canvasHeight:d,canvasWidth:u,svgElement:e});o({height:t,width:a})};a();const r=new ResizeObserver(()=>{a()});return r.observe(e),()=>{r.disconnect()}},[u,d,t]);const x=l.useMemo(()=>h(i.width,i.height,p),[i.width,i.height,p]);return{parsedCanvas:i,viewBox:x}},Xt=()=>{const[e,t]=l.useState(null),a=l.useCallback(e=>()=>t(e),[]);return{handleBlur:l.useCallback(()=>{t(null)},[]),handleFocus:a,isFocused:l.useCallback(t=>e===t,[e])}},Ft=(e,t)=>{const a=Math.floor(e);return Math.max(0,Math.min(t,a))},Wt=(e,t)=>{const a=Math.ceil(e);return Math.max(0,Math.min(t,a))},Vt=(e,t)=>{const a=Math.max(0,t-1);return{endIndex:Wt(e.end,a),startIndex:Ft(e.start,a)}},Yt=({data:e,initialRange:t,onDataChange:a})=>{const r=t||Lt(e.length),[n,i]=l.useState(r),o=t=>{if(!a||0===e.length)return;const{endIndex:r,startIndex:n}=Vt(t,e.length),i=e.slice(n,r+1);a(i)};return l.useEffect(()=>{o(n)},[]),{currentRange:n,handleRangeChange:e=>{i(e),o(e)}}},Kt=e=>({keyboardFastStep:e?.keyboardFastStep??2,keyboardStep:e?.keyboardStep??1,minHandlerDistance:e?.minHandlerDistance??1}),Ut=e=>{if(0===e.length)return"";if(1===e.length)return`M ${e[0][0]} ${e[0][1]}`;const[t,...a]=e;let r=`M ${t[0]} ${t[1]}`;return a.forEach((e,n)=>{const i=0===n?t:a[n-1],[o,s]=i,[c,d]=e,l=.3*(c-o),u=[o+l,s],h=[c-l,d];r+=` C ${u[0]} ${u[1]}, ${h[0]} ${h[1]}, ${c} ${d}`}),r},zt=(e,t,a,r)=>{if(0===e.length||0===t.length)return[];const n=.05*r,i=r-2*n,o=t.flatMap(t=>e.map(e=>Number(e[t.yKey]))),s=Math.min(...o),c=Math.max(...o)-s||1;return t.map(t=>{const o=e.map((r,o)=>[o/Math.max(1,e.length-1)*a,n+i-(Number(r[t.yKey])-s)/c*i]),d=t.curved?Ut(o):`M ${o.map(([e,t])=>`${e},${t}`).join(" L ")}`;let l="";return t.fill&&(l=t.curved?`${Ut(o)} L ${a} ${r} L 0 ${r} Z`:`${d} L ${a},${r} L 0,${r} Z`),{config:t,fillPath:l,linePath:d}})},Gt=(e,t,a)=>e[a]?.[t]?.toString()||`${a}`,Zt=(e,t,a)=>{if(!e)return e;const r=new RegExp("{{startValue}}","g"),n=new RegExp("{{endValue}}","g");return e.replace(r,t).replace(n,a)},qt=({ariaHidden:e,ariaLabel:t,backgroundColor:a,canvasConfig:r,caption:n,classNames:i,data:o,focusConfig:s,handlerConfig:c,height:h="40px",initialRange:p,interactionConfig:x,lines:R,onDataChange:g,role:A,screenReaderTextConfig:_,selectionConfig:T,width:E="100%",xKey:y,...v})=>{const m="zoom-area",C=Kt(x),S=(I=T,{fill:I?.fill??"#0078d4",fillOpacity:I?.fillOpacity??.5,hideOverlayOnFullRange:I?.hideOverlayOnFullRange??true,stroke:I?.stroke??"#0078d4",strokeWidth:I?.strokeWidth??0});var I;const $=(e=>({gap:e?.gap??St.OUTLINES_GAP,innerColor:e?.innerColor??St.FOCUS_INNER,innerStrokeWidth:e?.innerStrokeWidth??St.INNER_FOCUS_STROKE_WIDTH,outlineColor:e?.outlineColor??St.FOCUS_COLOR,outlineStrokeWidth:e?.outlineStrokeWidth??St.OUTER_FOCUS_STROKE_WIDTH}))(s),{currentRange:k,handleRangeChange:N}=Yt({data:o,initialRange:p,onDataChange:g}),{parsedCanvas:L,viewBox:b}=Pt({canvasConfig:r,dataTestId:m,height:h,width:E}),O=f(o),H=JSON.stringify(R),w=((e,t,a,r)=>{const{endIndex:n,startIndex:i}=Vt(a,e.length),o=Gt(e,t,i),s=Gt(e,t,n),c=Zt(r?.startHandler,o,s)??o;return{endHandler:Zt(r?.endHandler,o,s)??s,selectionArea:Zt(r?.selectionArea,o,s)??`${o} - ${s}`,startHandler:c}})(o,y,k,_),j=l.useMemo(()=>zt(o,R,L.width,L.height),[O,H,L.width,L.height]),{endX:B,startX:D}=l.useMemo(()=>$t(k,o.length,L.width),[k,O,L.width]),{handleBlur:M,handleFocus:P,isFocused:X}=Xt(),{handleKeyDown:F}=Mt({currentRange:k,dataLength:o.length,interactionConfig:C,onRangeChange:N}),{groupRef:W,handleMouseDown:V,handleTouchStart:Y}=Dt({currentRange:k,dataLength:o.length,interactionConfig:C,onRangeChange:N,width:L.width});return d.jsxs(u,{ref:W,ariaHidden:e,ariaLabel:t,backgroundColor:a,caption:n,className:i,"data-testid":m,height:h,overflow:"visible",role:A,viewBox:b,width:E,...v,children:[d.jsx(Ct,{linesData:j}),d.jsx(Ht,{currentRange:k,dataLength:o.length,dataTestId:`${m}-selection-area`,endX:B,height:L.height,screenReaderText:w.selectionArea,selectionConfig:S,startX:D,onBlur:M,onFocus:P(Bt.SELECTION_AREA),onKeyDown:F(Bt.SELECTION_AREA),onMouseDown:V(Bt.SELECTION_AREA),onTouchStart:Y(Bt.SELECTION_AREA)}),d.jsx(jt,{dataTestId:`${m}-start-handler`,focusConfig:$,handlerConfig:c,height:L.height,isFocused:X(Bt.START_HANDLER),max:k.end-C.minHandlerDistance,min:0,screenReaderText:w.startHandler,type:Bt.START_HANDLER,value:k.start,x:D,onBlur:M,onFocus:P(Bt.START_HANDLER),onKeyDown:F(Bt.START_HANDLER),onMouseDown:V(Bt.START_HANDLER),onTouchStart:Y(Bt.START_HANDLER)}),d.jsx(jt,{dataTestId:`${m}-end-handler`,focusConfig:$,handlerConfig:c,height:L.height,isFocused:X(Bt.END_HANDLER),max:o.length-1,min:k.start+C.minHandlerDistance,screenReaderText:w.endHandler,type:Bt.END_HANDLER,value:k.end,x:B,onBlur:M,onFocus:P(Bt.END_HANDLER),onKeyDown:F(Bt.END_HANDLER),onMouseDown:V(Bt.END_HANDLER),onTouchStart:Y(Bt.END_HANDLER)}),d.jsx(Ot,{endX:B,focusConfig:$,height:L.height,isFocused:X(Bt.SELECTION_AREA),startX:D})]})};export{ye as Bar,Ve as BarChart,E as BarOrientation,$e as ChartText,p as DefaultCanvasConfig,y as ErrorType,St as FOCUS_DEFAULT,Rt as ForeignObject,mt as HandlerIcon,Ie as Line,ft as LineChart,Ct as LineRenderer,Ae as Node,Re as NodeType,Te as Path,vt as PieChart,m as Positions,Ht as SelectionArea,Ot as SelectionAreaFocusRing,u as SvgContainer,ke as Tick,et as TickDataUtils,be as XAxis,je as YAxis,qt as ZoomArea,Bt as ZoomAreaElements,jt as ZoomHandler,$t as calculateHandlerPositions,zt as calculateLinesPathData,Nt as clampRange,Lt as createDefaultRange,Ut as generateCurvedPath,Kt as getInteractionConfig,bt as isFullRange,kt as mouseToDataIndex,v as normalizeToArray,Dt as useDragInteraction,Mt as useKeyboardNavigation,Pt as useResponsiveCanvas,Xt as useZoomAreaFocus,Yt as useZoomData};
|
|
1
|
+
var e,t,a,r,n={exports:{}},i={},o={exports:{}},s={};function c(){return t||(t=1,o.exports=function(){if(e)return s;e=1;var t=Symbol.for("react.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator,f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,R={};function g(e,t,a){this.props=e,this.context=t,this.refs=R,this.updater=a||f}function A(){}function _(e,t,a){this.props=e,this.context=t,this.refs=R,this.updater=a||f}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},A.prototype=g.prototype;var T=_.prototype=new A;T.constructor=_,x(T,g.prototype),T.isPureReactComponent=!0;var E=Array.isArray,y=Object.prototype.hasOwnProperty,v={current:null},m={key:!0,ref:!0,__self:!0,__source:!0};function C(e,a,r){var n,i={},o=null,s=null;if(null!=a)for(n in void 0!==a.ref&&(s=a.ref),void 0!==a.key&&(o=""+a.key),a)y.call(a,n)&&!m.hasOwnProperty(n)&&(i[n]=a[n]);var c=arguments.length-2;if(1===c)i.children=r;else if(1<c){for(var d=Array(c),l=0;l<c;l++)d[l]=arguments[l+2];i.children=d}if(e&&e.defaultProps)for(n in c=e.defaultProps)void 0===i[n]&&(i[n]=c[n]);return{$$typeof:t,type:e,key:o,ref:s,props:i,_owner:v.current}}function S(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var I=/\/+/g;function $(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function N(e,r,n,i,o){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var c=!1;if(null===e)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case t:case a:c=!0}}if(c)return o=o(c=e),e=""===i?"."+$(c,0):i,E(o)?(n="",null!=e&&(n=e.replace(I,"$&/")+"/"),N(o,r,n,"",function(e){return e})):null!=o&&(S(o)&&(o=function(e,a){return{$$typeof:t,type:e.type,key:a,ref:e.ref,props:e.props,_owner:e._owner}}(o,n+(!o.key||c&&c.key===o.key?"":(""+o.key).replace(I,"$&/")+"/")+e)),r.push(o)),1;if(c=0,i=""===i?".":i+":",E(e))for(var d=0;d<e.length;d++){var l=i+$(s=e[d],d);c+=N(s,r,n,l,o)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),d=0;!(s=e.next()).done;)c+=N(s=s.value,r,n,l=i+$(s,d++),o);else if("object"===s)throw r=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===r?"object with keys {"+Object.keys(e).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.");return c}function k(e,t,a){if(null==e)return e;var r=[],n=0;return N(e,r,"","",function(e){return t.call(a,e,n++)}),r}function L(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var b={current:null},O={transition:null},H={ReactCurrentDispatcher:b,ReactCurrentBatchConfig:O,ReactCurrentOwner:v};function w(){throw Error("act(...) is not supported in production builds of React.")}return s.Children={map:k,forEach:function(e,t,a){k(e,function(){t.apply(this,arguments)},a)},count:function(e){var t=0;return k(e,function(){t++}),t},toArray:function(e){return k(e,function(e){return e})||[]},only:function(e){if(!S(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},s.Component=g,s.Fragment=r,s.Profiler=i,s.PureComponent=_,s.StrictMode=n,s.Suspense=l,s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,s.act=w,s.cloneElement=function(e,a,r){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=x({},e.props),i=e.key,o=e.ref,s=e._owner;if(null!=a){if(void 0!==a.ref&&(o=a.ref,s=v.current),void 0!==a.key&&(i=""+a.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(d in a)y.call(a,d)&&!m.hasOwnProperty(d)&&(n[d]=void 0===a[d]&&void 0!==c?c[d]:a[d])}var d=arguments.length-2;if(1===d)n.children=r;else if(1<d){c=Array(d);for(var l=0;l<d;l++)c[l]=arguments[l+2];n.children=c}return{$$typeof:t,type:e.type,key:i,ref:o,props:n,_owner:s}},s.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},s.createElement=C,s.createFactory=function(e){var t=C.bind(null,e);return t.type=e,t},s.createRef=function(){return{current:null}},s.forwardRef=function(e){return{$$typeof:d,render:e}},s.isValidElement=S,s.lazy=function(e){return{$$typeof:h,_payload:{_status:-1,_result:e},_init:L}},s.memo=function(e,t){return{$$typeof:u,type:e,compare:void 0===t?null:t}},s.startTransition=function(e){var t=O.transition;O.transition={};try{e()}finally{O.transition=t}},s.unstable_act=w,s.useCallback=function(e,t){return b.current.useCallback(e,t)},s.useContext=function(e){return b.current.useContext(e)},s.useDebugValue=function(){},s.useDeferredValue=function(e){return b.current.useDeferredValue(e)},s.useEffect=function(e,t){return b.current.useEffect(e,t)},s.useId=function(){return b.current.useId()},s.useImperativeHandle=function(e,t,a){return b.current.useImperativeHandle(e,t,a)},s.useInsertionEffect=function(e,t){return b.current.useInsertionEffect(e,t)},s.useLayoutEffect=function(e,t){return b.current.useLayoutEffect(e,t)},s.useMemo=function(e,t){return b.current.useMemo(e,t)},s.useReducer=function(e,t,a){return b.current.useReducer(e,t,a)},s.useRef=function(e){return b.current.useRef(e)},s.useState=function(e){return b.current.useState(e)},s.useSyncExternalStore=function(e,t,a){return b.current.useSyncExternalStore(e,t,a)},s.useTransition=function(){return b.current.useTransition()},s.version="18.3.1",s}()),o.exports}var d=(r||(r=1,n.exports=function(){if(a)return i;a=1;var e=c(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function d(e,a,r){var i,c={},d=null,l=null;for(i in void 0!==r&&(d=""+r),void 0!==a.key&&(d=""+a.key),void 0!==a.ref&&(l=a.ref),a)n.call(a,i)&&!s.hasOwnProperty(i)&&(c[i]=a[i]);if(e&&e.defaultProps)for(i in a=e.defaultProps)void 0===c[i]&&(c[i]=a[i]);return{$$typeof:t,type:e,key:d,ref:l,props:c,_owner:o.current}}return i.Fragment=r,i.jsx=d,i.jsxs=d,i}()),n.exports),l=c();const u=l.forwardRef(({ariaHidden:e,ariaLabel:t,backgroundColor:a,caption:r,children:n,className:i,dataTestId:o,height:s,imageSrc:c,overflow:l,radius:u="0px",role:h,tabIndex:p,viewBox:f,width:x,...R},g)=>d.jsxs("svg",{ref:g,"aria-hidden":e,"aria-label":t,className:i,"data-testid":o,height:s,role:h,style:{backgroundColor:a,borderRadius:u,overflow:l},tabIndex:p,viewBox:f,width:x,onMouseDown:e=>e.preventDefault(),...R,children:[r&&d.jsx("title",{children:r}),c&&d.jsx("image",{height:s,href:c,width:x,x:"0",y:"0"}),n]})),h=(e,t,a=0)=>`${-a} ${-a} ${e} ${t}`,p={extraSpace:0,height:80,width:100},f=e=>{const t=new Map,a=()=>{const e={};return t.forEach((t,a)=>{e[a]=t}),e};return{addError:(r,n)=>{if(!n)return;const i={...n,type:r},o=t.get(r)||[];if(o.push(i),t.set(r,o),e){const t=a(),r={};Object.entries(t).forEach(([e,t])=>{const a=e;Array.isArray(t)&&t.length,r[a]=t}),e(r)}},clearErrors:()=>{t.clear(),e&&e({})},getAccumulatedErrors:a}},x=e=>JSON.stringify(e),R="%",g="rem",A=/^(\d+(\.\d+)?)(px|rem|%)?$/,_=e=>{if("number"==typeof e)return e;const t=e.match(A);if(!t)throw new Error(`Invalid string format: "${e}"`);const a=t[1];return t[3]===g?16*parseFloat(a):parseFloat(a)},T=l.createContext({}),E={HORIZONTAL:"HORIZONTAL",VERTICAL:"VERTICAL"},y={BAR_CHART_CONTEXT_ERROR:"BAR_CHART_CONTEXT_ERROR",BAR_CHART_PATH_ERROR:"BAR_CHART_PATH_ERROR",BAR_CHART_SEPARATOR_ERROR:"BAR_CHART_SEPARATOR_ERROR",BAR_CHART_X_AXIS_ERROR:"BAR_CHART_X_AXIS_ERROR",BAR_CHART_Y_AXIS_ERROR:"BAR_CHART_Y_AXIS_ERROR",GENERIC:"GENERIC",LINE_CHART_CONTEXT_ERROR:"LINE_CHART_CONTEXT_ERROR",LINE_CHART_PATH_ERROR:"LINE_CHART_PATH_ERROR",LINE_CHART_PROJECTION_ERROR:"LINE_CHART_PROJECTION_ERROR",LINE_CHART_SEPARATOR_ERROR:"LINE_CHART_SEPARATOR_ERROR",LINE_CHART_X_AXIS_ERROR:"LINE_CHART_X_AXIS_ERROR",LINE_CHART_Y_AXIS_ERROR:"LINE_CHART_Y_AXIS_ERROR"},v=e=>Array.isArray(e)?e:[e],m={BOTTOM:"BOTTOM",CENTER:"CENTER",CUSTOM:"CUSTOM",LEFT:"LEFT",RIGHT:"RIGHT",TOP:"TOP"},C=Object.entries({BAR_CHART_AXIS_INSUFFICIENT_TICKS:"Axis requires at least two ticks for proper bar scaling",BAR_CHART_AXIS_INVALID_SCALE:"Invalid axis scale for current bar values",BAR_CHART_DISTRIBUTION_INSUFFICIENT_SPACE:"Insufficient space for bar distribution with current configuration",BAR_CHART_DISTRIBUTION_INVALID_GAP:"Invalid gap between bars - must be >= 0 and allow bar rendering",BAR_CHART_DISTRIBUTION_OVERLAP:"Bar distribution results in overlapping bars",BAR_CHART_EMPTY_DATA:"No valid data entries found for bar chart rendering",BAR_CHART_INSUFFICIENT_SPACE_HEIGHT:"Insufficient height to render bars. Consider reducing bar count or increasing chart height",BAR_CHART_INSUFFICIENT_SPACE_WIDTH:"Insufficient width to render bars. Consider reducing bar width or increasing chart width",BAR_CHART_INVALID_VALUE:"Bar value must be a valid number for rendering",BAR_CHART_NEGATIVE_VALUE:"Negative values are not supported in this bar configuration",BAR_CHART_NO_DATA:"Data validation failed: no data provided for bar chart rendering",BAR_CHART_OVERLAP:"Bars are overlapping due to insufficient spacing",BAR_CHART_SEPARATOR_X_OUT_OF_RANGE:"Separator X position is outside valid bar range",BAR_CHART_SEPARATOR_Y_OUT_OF_RANGE:"Separator Y position is outside valid bar range",BAR_CHART_STACK_INVALID:"Invalid stacking configuration - all bars in stack must have consistent configuration",BAR_CHART_STACK_MISSING_VALUES:"Stack is incomplete - all bars in stack must have valid values"}).reduce((e,[t,a])=>(e[t]=new Error(a),e),{}),S=Object.entries({LINE_CHART_INVALID_CANVAS:"Canvas dimensions validation failed: both width and height must be > 0",LINE_CHART_NO_DATA:"Data validation failed: no data provided for chart rendering",LINE_CHART_PATH_ALL_VALUES_NULL:"Path data cannot be generated - all Y values are null or undefined",LINE_CHART_PATH_INSUFFICIENT_POINTS:"Unable to calculate curved path with insufficient points (minimum 2 required)",LINE_CHART_PATH_INVALID_DATAKEY:"DataKey must be a valid string",LINE_CHART_PROJECTION_INVALID_BOUNDS:"Invalid projection bounds - upper projection must be below lower projection",LINE_CHART_PROJECTION_LOWER_X_OUT_OF_RANGE:"Lower projection X coordinate is outside valid range (0-100)",LINE_CHART_PROJECTION_LOWER_Y_OUT_OF_RANGE:"Lower projection Y coordinate is outside chart area",LINE_CHART_PROJECTION_UPPER_X_OUT_OF_RANGE:"Upper projection X coordinate is outside valid range (0-100)",LINE_CHART_PROJECTION_UPPER_Y_OUT_OF_RANGE:"Upper projection Y coordinate is outside chart area",LINE_CHART_SEPARATOR_INVALID_COORDINATES:"Invalid separator position - coordinates overlap, cannot render separator",LINE_CHART_SEPARATOR_INVALID_X_BREAK_AXIS:"Invalid xBreakAxis value: cannot be parsed as number",LINE_CHART_SEPARATOR_INVALID_Y_BREAK_AXIS:"Invalid yBreakAxis value: cannot be parsed as number",LINE_CHART_SEPARATOR_X_OUT_OF_RANGE:"xBreakAxis value is outside data range",LINE_CHART_SEPARATOR_Y_OUT_OF_RANGE:"yBreakAxis value is outside data range",LINE_CHART_SINGLE_POINT:"Data validation failed: single data point provided, minimum 2 required for line chart",LINE_CHART_X_AXIS_IDENTICAL_VALUES:"X-axis range validation failed: minimum and maximum values are identical, cannot render chart line",LINE_CHART_X_AXIS_INSUFFICIENT_TICKS:"X-axis tick calculation: insufficient data points (1/2 minimum required)",LINE_CHART_X_AXIS_ZERO_LENGTH:"X-axis geometry validation failed: start and end X coordinates are identical (x1=x2), axis has zero length",LINE_CHART_Y_AXIS_IDENTICAL_VALUES:"Y-axis range validation failed: minimum and maximum values are identical, cannot render chart line",LINE_CHART_Y_AXIS_INSUFFICIENT_TICKS:"Y-axis tick calculation: insufficient data points (1/2 minimum required)",LINE_CHART_Y_AXIS_ZERO_LENGTH:"Y-axis geometry validation failed: start and end Y coordinates are identical (y1=y2), axis has zero length"}).reduce((e,[t,a])=>(e[t]=new Error(a),e),{}),I=(e,t)=>new Error(`Invalid value "${e}" for bar with dataKey "${t}". Must be a valid number.`),$=(e,t)=>new Error(`Negative value ${e} not allowed for bar with dataKey "${t}" in current configuration`),N="INVALID_X_TICK",k="BAR_CHART_NO_DATA",L="LINE_CHART_NO_DATA",b="LINE_CHART_PATH_ALL_VALUES_NULL",O="LINE_CHART_PATH_INSUFFICIENT_POINTS",H="LINE_CHART_PATH_INVALID_DATAKEY",w="LINE_CHART_SEPARATOR_INVALID_COORDINATES",j="LINE_CHART_SINGLE_POINT",B="LINE_CHART_X_AXIS_IDENTICAL_VALUES",D="LINE_CHART_X_AXIS_INSUFFICIENT_TICKS",M="LINE_CHART_X_AXIS_ZERO_LENGTH",P="LINE_CHART_Y_AXIS_IDENTICAL_VALUES",X="LINE_CHART_Y_AXIS_INSUFFICIENT_TICKS",F="LINE_CHART_Y_AXIS_ZERO_LENGTH",W={...C,...S,INVALID_X_TICK:new Error("[getXTicks] Invalid X tick values calculated")},V=e=>W[e],Y=e=>new Error(`DataKey "${e}" not found in dataset`),K=(e,t)=>new Error(`Canvas dimensions validation failed: width=${e}, height=${t} (both must be > 0)`),U=e=>new Error(`Invalid xBreakAxis value: '${e}' cannot be parsed as number`),z=e=>new Error(`Invalid yBreakAxis value: '${e}' cannot be parsed as number`),G=(e,t,a)=>new Error(`xBreakAxis value ${e} is outside data range (${t} - ${a})`),Z=(e,t,a)=>new Error(`yBreakAxis value ${e} is outside data range (${t} - ${a})`),q=({canvasHeight:e,canvasWidth:t,customBreakAxis:a,extraSpaceBottomY:r,extraSpaceLeftX:n,extraSpaceRightX:i,extraSpaceTopY:o,position:s})=>s===m.TOP?{x1:n,x2:t-i,y1:o,y2:o}:s===m.CENTER?{x1:n,x2:t-i,y1:e/2,y2:e/2}:s===m.CUSTOM?{x1:n,x2:t-i,y1:a,y2:a}:{x1:n,x2:t-i,y1:e-r,y2:e-r},J=({canvasHeight:e,canvasWidth:t,customBreakAxis:a,extraSpaceBottomY:r,extraSpaceLeftX:n,extraSpaceRightX:i,extraSpaceTopY:o,position:s})=>s===m.RIGHT?{x1:t-i,x2:t-i,y1:o,y2:e-r}:s===m.CENTER?{x1:t/2,x2:t/2,y1:o,y2:e-r}:s===m.CUSTOM?{x1:a,x2:a,y1:o,y2:e-r}:{x1:n,x2:n,y1:o,y2:e-r},Q=(e,t,a)=>t.map(t=>{if(isNaN(Number(t))){const a=e.find(e=>String(e.value)===String(t));return a?a.position:0}const{index:r,tick:n}=e.reduce((e,a,r)=>Math.abs(Number(a.value)-Number(t))<=Math.abs(Number(e.tick.value)-Number(t))?{index:r,tick:a}:e,{index:0,tick:e[0]}),i=Number(t),o=Number(n.value);if(i!==o){const t=e.map(e=>Number(e.value)),s=Math.min(...t),c=Math.max(...t);if(i<s)return e.at(0)?.position;if(i>c)return e.at(-1)?.position;const d=Math.abs(o-i),l=i>o,u=l?e[r+1]:e[r-1],h=100*d/Math.abs(Number(u.value)-o),p=Math.abs(n.position-u.position)*h/100;return a?l?n.position+p:n.position-p:l?n.position-p:n.position+p}return n.position}),ee=({initPos:e,maxSpaceAvailable:t,otherAxisSpace:a,securitySpace:r,tickValues:n})=>{const i=n.length-1,o=(t-a-r)/i;return n.map((t,a)=>({position:e+a*o+r/2,value:t}))},te=({initPos:e,maxSpaceAvailable:t,needAjusted:a,otherAxisSpace:r,securitySpace:n,tickValues:i})=>{const o=(t-r-n)/(i.length-1),s=a?n/2:0;return i.map((t,a)=>({position:e-a*o-s,value:t}))},ae="0",re="1",ne="fallbackData";(()=>{if("undefined"!=typeof globalThis&&"process"in globalThis){const e=globalThis.process;return"production"===e?.env?.NODE_ENV}})();const ie=e=>e?Object.entries(e).reduce((e,[t,a])=>((t.startsWith("aria-")||t.startsWith("data-"))&&null!=a&&(e[t]=String(a)),e),{}):{},oe=({height:e="140%",width:t="140%",x:a="-20%",y:r="-20%",...n})=>d.jsx("defs",{children:d.jsx("filter",{height:e,id:n.id,width:t,x:a,y:r,children:d.jsx("feDropShadow",{...n.shadowSvgConfig})})}),se=-1/0,ce=l.forwardRef(({dataTestId:e,position:t,size:a=1,...r},n)=>d.jsx("circle",{...r,ref:n,cx:t?.x,cy:t?.y,"data-testid":`${e}-circle`,r:a/2})),de=(e,t,a,r,n)=>{let i="";const o=r===n,s=o?a:2*a;for(let a=0;a<s;a++){const c=o||a%2==0?r:n,d=2*Math.PI/s*a-Math.PI/2;i+=`${e+Math.cos(d)*c},${t+Math.sin(d)*c} `}return i.trim()},le=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:a=1,...r},n)=>{const i=de(t.x,t.y,6,a/2,a/2);return d.jsx("polygon",{...r,ref:n,"data-testid":`${e}-hexagon`,points:i})}),ue=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:a=1,...r},n)=>{const i=de(t.x,t.y,5,a/2,a/2);return d.jsx("polygon",{...r,ref:n,"data-testid":`${e}-pentagon`,points:i})}),he=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:a=1,...r},n)=>d.jsx("rect",{...r,ref:n,"data-testid":`${e}-square`,height:a,width:a,x:t.x-a/2,y:t.y-a/2})),pe=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:a=1,...r},n)=>{const i=a/2,o=i/2,s=de(t.x,t.y,5,i,o);return d.jsx("polygon",{...r,ref:n,"data-testid":`${e}-star`,points:s})}),fe=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:a=1,...r},n)=>{const i=`M ${t.x-a/2} ${t.y} H ${t.x+a/2} M ${t.x} ${t.y-a/2} V ${t.y+a/2}`;return d.jsx("path",{...r,ref:n,d:i,"data-testid":`${e}-straight`,strokeWidth:2})}),xe=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:a=1,...r},n)=>{const i=[`${t.x},${t.y-a/2}`,`${t.x-a/2},${t.y+a/2}`,`${t.x+a/2},${t.y+a/2}`].join(" ");return d.jsx("polygon",{...r,ref:n,"data-testid":`${e}-triangle`,points:i})}),Re={Circle:"circle",Hexagon:"hexagon",Pentagon:"pentagon",Square:"square",Star:"star",Straight:"straight",Triangle:"triangle"},ge={[Re.Circle]:ce,[Re.Hexagon]:le,[Re.Pentagon]:ue,[Re.Square]:he,[Re.Star]:pe,[Re.Straight]:fe,[Re.Triangle]:xe},Ae=l.forwardRef(({dataTestId:e="node",haloConfig:t,hasHalo:a=!1,onBlur:r,onClick:n,onDoubleClick:i,onFocus:o,onKeyDown:s,onMouseEnter:c,onMouseLeave:u,position:h={x:0,y:0},size:p=1,type:f=Re.Circle,...x},R)=>{const[g,A]=(e=>{const t=l.useRef(!1),a=l.useRef(null);l.useImperativeHandle(e,()=>a.current,[]);const r=e=>{t.current=!!e.autoClick};return l.useEffect(()=>{if(!a.current)return;const e=a.current;return e.addEventListener("click",r),()=>e.removeEventListener("click",r)},[]),[a,t]})(R),_={...x,className:`node ${x.className}`,onBlur:e=>{r?.(e)},onClick:e=>{n?.(e,{...x.data,nodePosition:h},A.current)},onDoubleClick:e=>{i?.(e,x.data)},onFocus:e=>{o?.(e,x.data)},onKeyDown:e=>{"Enter"===e.key&&s?.(e,x.data)},onMouseEnter:e=>{c?.(e,x.data)},onMouseLeave:e=>{u?.(e)}},T={className:x.className,fill:t?.fill||x.fill,fillOpacity:t?.fillOpacity||.25,opacity:t?.opacity||.3,stroke:t?.stroke||x.stroke,strokeWidth:t?.strokeWidth||x.strokeWidth},E=ge[f];return d.jsxs(d.Fragment,{children:[a&&d.jsx(E,{...T,"aria-hidden":"true",dataTestId:`${e}-halo`,position:h,size:p+p/2,tabIndex:-1}),d.jsx(E,{..._,ref:g,dataTestId:e,position:h,size:p})]})}),_e=l.forwardRef(({data:e,nodeConfig:t,tabIndex:a=0,x:r,y:n},i)=>{const o=t?ie(t):{};if(o["aria-label"]&&e&&"string"==typeof o["aria-label"]){const t=o["aria-label"];if(t.includes("{{")){const a=((e,t,a)=>{if(!e)return;const r=a??t.dataValue,n=Array.isArray(r)?r[t.index]:void 0,{xValue:i,yValue:o}=((e,t)=>({xValue:e&&t.xKey?e[t.xKey]?.toString()??"":"",yValue:e&&t.dataKey?e[t.dataKey]?.toString()??"":""}))(n,t);return((e,t,a,r)=>{let n=e;return void 0!==t.dataKey&&(n=n.replace(new RegExp("{{dataKey}}","g"),t.dataKey)),n=n.replace(new RegExp("{{xValue}}","g"),a),n=n.replace(new RegExp("{{yValue}}","g"),r),void 0!==t.index&&(n=n.replace(new RegExp("{{index}}","g"),(t.index+1).toString())),n})(e,t,i,o)})(t,{dataKey:e.dataKey,dataValue:e.dataValue,index:e.index??0,xKey:e.xKey},e.dataValue);a&&(o["aria-label"]=a)}}return d.jsx(d.Fragment,{children:t&&d.jsx(Ae,{...t,ref:i,...o,className:"node-path-focus-border",data:e,hasHalo:t.hasHalo,position:{x:r,y:n},tabIndex:a})})}),Te=l.forwardRef(({classNames:e="",fill:t="transparent",stroke:a="#0000FF",strokeWidth:r="1",focusConfig:n={stroke:"#0000FF",strokeWidth:"0.5"},hoverConfig:i={stroke:"#0000FF",strokeWidth:"0.5"},role:o="img",...s},c)=>{const{handleBlur:u,handleFocus:h,isFocused:p}=((e,t)=>{const[a,r]=l.useState(!1),n=l.useCallback(t=>{r(!0),e?.(t)},[e]);return{handleBlur:l.useCallback(e=>{r(!1),t?.(e)},[t]),handleFocus:n,isFocused:a}})(s.onFocus,s.onBlur),{handleMouseEnter:f,handleMouseLeave:x,isHovered:R}=((e,t)=>{const[a,r]=l.useState(!1);return{handleMouseEnter:l.useCallback(t=>{r(!0),e?.(t)},[e]),handleMouseLeave:l.useCallback(e=>{r(!1),t?.(e)},[t]),isHovered:a}})(s.onMouseEnter,s.onMouseLeave),g=l.useRef(null),A=l.useRef([]),_=l.useRef(null);l.useImperativeHandle(c,()=>({get main(){return _.current},get node(){return A.current},get path(){return g.current}}));const T=s.gradient&&((e,t="gradientePath")=>{const a=e.split(",").map(e=>e.trim()),r=parseInt(a[0],10),n=a.slice(1).map(e=>{const[t,a]=e.split(" ");return{color:t,offset:a}});let i="0%",o="0%",s="0%";switch(r){case 180:s="100%";break;case 90:o="100%";break;case 270:i="100%";break;default:return d.jsx(d.Fragment,{})}return d.jsx("defs",{children:d.jsx("linearGradient",{id:t,x1:i,x2:o,y1:"0%",y2:s,children:n.map((e,t)=>d.jsx("stop",{offset:e.offset,stopColor:e.color},`${t}-${e.offset}`.toString()))})})})(s.gradient),E=ie(s),y={...{...s,classNames:`path ${e}`,fill:T?"url(#gradientePath)":t,filter:"url(#shadow)",role:o,stroke:a,strokeWidth:r},...p&&n,...R&&i};return d.jsxs("g",{ref:_,tabIndex:-1,children:[T&&T,y.shadowSvgConfig&&d.jsx(oe,{id:"shadow",shadowSvgConfig:y.shadowSvgConfig}),d.jsxs("g",{"aria-label":y.ariaLabel,className:y.classNames,"data-draw":!0,filter:y.shadowSvgConfig&&y.filter,opacity:y.opacity,orientation:y.orientation,role:y.role,rotate:y.rotate,tabIndex:y.tabIndex,transform:y.transform,visibility:y.visibility,...E,onBlur:u,onClick:()=>{s.onClick?.(s.dataValue)},onDoubleClick:e=>{s.onDoubleClick?.(e,s.dataValue)},onFocus:h,onKeyDown:e=>{"Enter"===e.key&&s.onKeyDown?.(s.dataValue)},onMouseDown:e=>{e.preventDefault()},onMouseEnter:f,onMouseLeave:x,children:[d.jsx("path",{ref:g,d:y.d,"data-testid":y.dataTestId,fill:y.dFill?"transparent":y.fill,fillOpacity:y.fillOpacity,fillRule:y.fillRule,stroke:y.stroke,strokeDasharray:y.strokeDasharray,strokeDashoffset:y.strokeDashoffset,strokeLinecap:y.strokeLinecap,strokeLinejoin:y.strokeLinejoin,strokeMiterlimit:y.strokeMiterlimit,strokeOpacity:y.strokeOpacity,strokeWidth:y.strokeWidth,children:y.title&&d.jsx("title",{children:y.title})}),y.dFill&&d.jsx("path",{d:y.dFill,fill:y.fill,fillOpacity:y.fillOpacity,fillRule:y.fillRule})]}),y.points&&y.nodeConfig&&y.points.map(([e,t],a)=>{const r={dataKey:y.dataKey,dataValue:y.dataValue,index:a,xKey:y?.xKey};return d.jsx(_e,{ref:e=>A.current[a]=e,data:r,nodeConfig:y.nodeConfig,tabIndex:-1,x:e,y:t},`${a.toString()}`)})]})}),Ee=(e,t,a)=>e?t+a/2:t-a/2,ye=({barConfig:e,currentBars:t,endRounded:a,extraSpacing:r=0,order:n=1,orientation:i,startRounded:o,x1:s,x2:c,y1:l,y2:u})=>{const{barWidth:h,singleConfig:p}=e,f=(({barConfig:e,orientation:t,x1:a,x2:r,y1:n,y2:i})=>{const{gap:o=0,singleConfig:s}=e,c=t===E.HORIZONTAL,d=c?a:n,l=c?r:i,u={end:l<d,start:l>d};return s.reduce((e,t,a)=>{const{coverage:r}=t,n=((e,t)=>e/100*t)(r,l-d),i=0===a?d:Ee(u.start,e[a-1][1],o),c=a+1===s.length?l:Ee(u.end,i+n,o);return e.push([i,c]),e},[])})({barConfig:e,orientation:i,x1:s,x2:c,y1:l,y2:u});return d.jsx("g",{children:p.map((e,x)=>{const[R,g]="HORIZONTAL"===i?f[x]:[s,c],[A,_]="VERTICAL"===i?f[x]:[l,u],T=(({barWidth:e,currentBars:t,endRounded:a=0,extraSpacing:r,order:n,orientation:i,startRounded:o=0,x1:s,x2:c,y1:d,y2:l})=>{let u,h,p,f,x="Z";const R=(({barWidth:e,currentBars:t,extraSpacing:a,order:r,orientation:n})=>{const i=e/2,o=a/2,s=t%2==0,c=s?o:o+i,d=r-Math.ceil(t/2);let l=0;return 0===d?l=s?-o:i:d<0?l=n===E.HORIZONTAL?d*-c+e:d*c:d>0&&(l=n===E.HORIZONTAL?d*-c:d*c+e),l})({barWidth:e,currentBars:t,extraSpacing:r,order:n,orientation:i});if(i===E.HORIZONTAL){const t=s+o,r=c-a;o&&a?(u=`M ${t},${d+R}`,h=`L${r},${l+R}`,p=`Q${c+a} ${l+R-e/2}, ${r} ${l+R-e}`,f=`L${t},${d+R-e}`,x=`Q${s-o} ${d+R-e/2}, ${t} ${d+R}`):o?(u=`M ${t},${d+R}`,h=`L${c},${l+R}`,p=`L${c},${l+R-e}`,f=`L${t},${d+R-e}`,x=`Q${s-o} ${d+R-e/2}, ${t} ${d+R}`):a?(u=`M${s},${d+R}`,h=`L${r},${l+R}`,p=`Q${c+a} ${l+R-e/2}, ${r} ${l+R-e}`,f=`L${s},${d+R-e}`):(u=`M${s},${d+R}`,h=`L${c},${l+R}`,p=`L${c},${l+R-e}`,f=`L${s},${d+R-e}`)}else{const t=d-o,r=l+a;o&&a?(u=`M${s+R}, ${t}`,h=`L${c+R},${r}`,p=`Q${c+R-e/2} ${l-a}, ${c+R-e} ${r}`,f=`L${s+R-e},${t}`,x=`Q${s+R-e/2} ${d+o}, ${s+R} ${t}`):o?(u=`M${s+R}, ${t}`,h=`L${c+R},${l}`,p=`L${c+R-e},${l}`,f=`L${s+R-e},${t}`,x=`Q${s+R-e/2} ${d+o}, ${s+R} ${t}`):a?(u=`M${s+R},${d}`,h=`L${c+R},${r}`,p=`Q${c+R-e/2} ${l-a}, ${c+R-e} ${r}`,f=`L${c+R-e},${d}`):(u=`M${s+R},${d}`,h=`L${c+R},${l}`,p=`L${c+R-e},${l}`,f=`L${s+R-e},${d}`)}return`${u} ${h} ${p} ${f} ${x}`})({barWidth:h,currentBars:t,endRounded:x===p.length-1&&a?a:void 0,extraSpacing:r,order:n,orientation:i,startRounded:0===x&&o?o:void 0,x1:R,x2:g,y1:A,y2:_});return d.jsx(Te,{d:T,fill:e.color,hoverConfig:{stroke:"transparent",strokeWidth:"0"},stroke:"transparent",tabIndex:0,title:e.title},`${e.title}-${x.toString()}`)})})},ve=({barConfig:e,dataIdx:t,dataKey:a,order:r,...n})=>{const{addError:i,xAxisCoordinates:o,yAxisCoordinates:s,...c}=l.useContext(T),{coordinates:u,tickValues:h}=o,{coordinates:p,tickValues:f}=s,x=c.orientation===E.VERTICAL,R=x?c.pKey:a,g=x?a:c.pKey,A=c.data[t],_=A?.[R],y=A?.[g];l.useEffect(()=>{if(c.data.length>0&&!Object.prototype.hasOwnProperty.call(c.data[0],a))return void i?.("BAR_CHART_PATH_ERROR",{error:Y(a)});const e=Number(y);isNaN(e)?i?.("BAR_CHART_PATH_ERROR",{error:I(y,a)}):e<0&&i?.("BAR_CHART_PATH_ERROR",{error:$(e,a)})},[i,c.data,a,y]);const v=Q(h,[String(_)],!0)[0],m=Q(f,[String(y)])[0],C=x?{x1:v,x2:v,y1:u.y1,y2:m}:{x1:p.x1,x2:v,y1:m,y2:m};return d.jsx(ye,{barConfig:e,currentBars:c.barChildrenCount,extraSpacing:c.gapBetweenBars,order:r,orientation:c.orientation,...C,...n})},me=e=>{let t=0;return l.Children.toArray(e).forEach(e=>{l.isValidElement(e)&&e.type===ve&&e.props.order>t&&(t=e.props.order)}),t},Ce=e=>{if(0===e.length)return{numeric:{max:2,min:0,step:1}};const t=Math.min(...e.map(e=>parseFloat(e))),a=Math.max(...e.map(e=>parseFloat(e)));return{numeric:{max:a,min:t,step:Math.abs(a-t)/2}}},Se=()=>"undefined"!=typeof window&&"undefined"!=typeof document,Ie=()=>Se()?document:void 0,$e=e=>{const t=Ie();if(t)return t.createElementNS("http://www.w3.org/2000/svg",e)},Ne=({bound:e,data:t,fontSize:a,svgHeight:r,svgWidth:n,viewBox:i})=>{if(!Se()||!t.length)return 0;const o=Ie();if(!o)return 0;const s=$e("svg");if(!s)return 0;s.setAttribute("style","position: absolute; visibility: hidden; top: -9999px; left: -9999px;"),s.setAttribute("viewBox",i),s.setAttribute("width",n),s.setAttribute("height",r),o.body.appendChild(s);const c=t.map(t=>{const r=$e("text");if(!r)return 0;r.setAttribute("font-size",a),r.textContent=t,s.appendChild(r);const n=r.getBBox()[e];return r.remove(),n});return s.remove(),Math.max(...c,0)},ke=({ariaLabel:e="",className:t="line",dataTestId:a,tabIndex:r=-1,...n})=>d.jsx("line",{...n,"aria-label":e,className:t,"data-testid":a,tabIndex:r}),Le=({children:e,className:t="circle",tabIndex:a=-1,...r})=>d.jsx("text",{className:t,tabIndex:a,...r,children:e}),be=({showTickLines:e,tick:t,tickLine:a,tickText:r})=>d.jsxs("g",{children:[e&&d.jsx(ke,{...a}),r&&d.jsx(Le,{...r,children:t.value})]}),Oe=(e,t,a=1)=>e>=t-a&&e<=t+a,He=e=>{const{ariaLabel:t,className:a,dataTestId:r,opacity:n,stroke:i,strokeDasharray:o,strokeDashoffset:s,strokeLinecap:c,strokeLinejoin:d,strokeOpacity:l,strokeWidth:u,style:h,tabIndex:p,transform:f,x1:x,x2:R,y1:g,y2:A}=e;return{ariaLabel:t,className:a,dataTestId:r,opacity:n,stroke:i,strokeDasharray:o,strokeDashoffset:s,strokeLinecap:c,strokeLinejoin:d,strokeOpacity:l,strokeWidth:u,style:h,tabIndex:p,transform:f,x1:x,x2:R,y1:g,y2:A}},we=({canvasHeight:e=p.height,canvasWidth:t=p.width,cursor:a=0,extraSpace:r={bottom:0,left:0,right:0,top:0},position:n=m.BOTTOM,showTickLines:i=!1,tickLine:o,tickLineHover:s,tickText:c,tickValues:l=[],...u})=>{const h=ie(u);return d.jsxs("g",{...h,children:[d.jsx(ke,{...He(u)}),l&&l.length>0&&l.map((e,t)=>{const r=Oe(a,e.position)&&s?{...o,...s}:o,n="rotate"===c?.transform?`rotate(-30, ${e.position}, ${c.y})`:void 0;return d.jsx(be,{showTickLines:i,tick:e,tickLine:{...r,x1:e.position,x2:e.position},tickText:{...c,transform:n,x:e.position}},`${t.toString()}`)})]})},je=(e,t,a)=>e===m.RIGHT?t+a:t-a,Be=(e,t,a,r)=>e===m.TOP?a:t+a+r,De=({position:e=m.BOTTOM,tickLine:t,tickText:a,...r})=>{const{xAxisCoordinates:{coordinates:n,tickValues:i},...o}=l.useContext(T),s=Be(e,n.y1,Number(a?.fontSize),a?.top??0),c=o.extraSpaceTopY,u=Number(o.canvasHeight)-o.extraSpaceBottomY;return d.jsx(we,{...n,...r,canvasHeight:Number(o.canvasHeight),canvasWidth:Number(o.canvasWidth),dataTestId:`${o.dataTestId}xAxis`,extraSpace:{left:o.extraSpaceLeftX,right:o.extraSpaceRightX},tickLine:{...t,y1:c,y2:u},tickText:{...a,y:s},tickValues:a?i:void 0})},Me=({canvasWidth:e,cursor:t=0,extraSpace:a={bottom:0,left:0,right:0,top:0},position:r=m.LEFT,showTickLines:n=!0,tickLine:i,tickLineHover:o,tickText:s,tickValues:c=[],...l})=>{const u=ie(l);return d.jsxs("g",{...u,children:[d.jsx(ke,{...He(l)}),c&&c.length>0&&c.map((e,a)=>{const r=Oe(t,e.position)&&o?{...i,...o}:i,c="rotate"===s?.transform?`rotate(-30, ${s.x}, ${e.position})`:void 0;return d.jsx(be,{showTickLines:n,tick:e,tickLine:{...r,y1:e.position,y2:e.position},tickText:{...s,transform:c,y:e.position}},`${a.toString()}`)})]})},Pe=(e,t,a)=>{let r=0;switch(e){case"middle":r=t/2+a;break;case"end":r=t+a;break;default:r=0}return r},Xe=({position:e=m.LEFT,tickLine:t,tickText:a,...r})=>{const{yAxisCoordinates:{coordinates:n,tickValues:i},...o}=l.useContext(T),s=a?.textAnchor||"middle",c=(e===m.RIGHT?a?.right:a?.left)??0,u=Pe(s,o.yAxisText,c),h=je(e,n.x1,u);return d.jsx(Me,{...n,...r,canvasHeight:Number(o.canvasHeight),canvasWidth:Number(o.canvasWidth),dataTestId:`${o.dataTestId}yAxis`,tickLine:{...t,x1:o.extraSpaceLeftX,x2:Number(o.canvasWidth)-o.extraSpaceRightX},tickText:{...a,x:h},tickValues:a?i:void 0})},Fe=e=>{if(e.custom)return e.custom?.values;if(e.numeric){const{max:t,min:a=0,step:r}=e.numeric;if(r>=Math.abs(t-a)||r<=0)return[a.toString()];const n=[];for(let e=a;e<=t;e+=r)n.push(e.toString());return n}},We=(e,t)=>e.flatMap(e=>Object.keys(e).filter(a=>a!==t&&"number"==typeof e[a]).map(t=>Number(e[t]))),Ve=(e,t,a,r,n,i,o,s)=>{const{position:c,tickText:d,tickValues:l}=e.props,u=d?.fontSize??0,h=u*r,p=l?Fe(l):t.map(e=>e[a]),f=Ne({bound:"width",data:p,fontSize:u,svgHeight:`${o}`,svgWidth:`${s}`,viewBox:i}),x=n>f?n:f;return{barChartXPosition:c||m.BOTTOM,extraSpaceBottomY:c===m.BOTTOM?h+(d?.top??0):0,extraSpaceTopY:c===m.TOP?h+(d?.bottom??0):0,securityXSpace:x,xBreakAxis:l?.numeric?l.numeric.breakAxis??0:d?.custom?.breakAxis??0,xData:p}},Ye=(e,t,a,r,n,i,o,s)=>{const{position:c,tickText:d,tickValues:l}=e.props,u=d?.fontSize??0,h=u*r,p=l||Ce([...new Set(We(t,a))]),f=Fe(p),x=n>h?n:h,R=Ne({bound:"width",data:f,fontSize:u,svgHeight:`${o}`,svgWidth:`${s}`,viewBox:i});return{barChartYPosition:c||m.LEFT,extraSpaceLeftX:c===m.LEFT?R+(d?.right??0):0,extraSpaceRightX:c===m.RIGHT?R+(d?.left??0):0,securityYSpace:x,yAxisText:R,yBreakAxis:l?.numeric?l.numeric.breakAxis??0:d?.custom?.breakAxis??0,yData:f}},Ke=({addError:e,ajustedX:t,ajustedY:a,canvasHeight:r,canvasWidth:n,children:i,data:o,gapBetweenBars:s,orientation:c,pKey:d,viewBox:u})=>{let h;if(!o||0===o.length){const t={error:V(k)};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}if(n<=0||r<=0){const t={error:K(n,r)};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}const p=me(i),f=20*p,x=(p-1)*s,R=c===E.VERTICAL?n:r;if(f+x>R){const t={error:(g=`Insufficient space: requires ${f+x}px but only ${R}px available`,new Error(`Invalid bar distribution for "all": ${g}`))};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}var g;const A=o&&o.length>0?o:[{[ne]:0,[d]:ae},{[ne]:0,[d]:re}],_=n>0?n:100,T=r>0?r:100,{barChartXPosition:v,barChartYPosition:C,extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:$,extraSpaceTopY:L,securityXSpace:b,securityYSpace:O,xAxisText:H,xBreakAxis:w,xData:j,yAxisText:W,yBreakAxis:Y,yData:U}=(({ajustedX:e,ajustedY:t,canvasHeight:a,canvasWidth:r,children:n,data:i,gapBetweenBars:o,orientation:s,pKey:c,viewBox:d})=>{let u={barChartXPosition:m.BOTTOM,barChartYPosition:m.LEFT,extraSpaceBottomY:0,extraSpaceLeftX:0,extraSpaceRightX:0,extraSpaceTopY:0,securityXSpace:0,securityYSpace:0,xAxisText:0,xBreakAxis:0,xData:[],yAxisText:0,yBreakAxis:0,yData:[]},h=o;const p=[];return l.Children.forEach(n,n=>{if(l.isValidElement(n))if(n.type!==ve||p.includes(n.props.order)||(p.push(n.props.order),h+=n.props.barConfig.barWidth??0),n.type===De){const t=s===E.VERTICAL?h:0;u={...u,...Ve(n,i,c,e,t,d,a,r)}}else if(n.type===Xe){const e=s===E.HORIZONTAL?h:0;u={...u,...Ye(n,i,c,t,e,d,a,r)}}}),u})({ajustedX:t,ajustedY:a,canvasHeight:T,canvasWidth:_,children:i,data:A,gapBetweenBars:s,orientation:c,pKey:d,viewBox:u}),z=v!==m.TOP&&v!==m.BOTTOM,G=ee({initPos:I,maxSpaceAvailable:_,otherAxisSpace:I+$,securitySpace:b,tickValues:j});if((G??[]).some(({position:e})=>isNaN(e))){const t={error:V(N)};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}if(G){const t=G.length<2,a=G.length>=2&&1===new Set(G.map(e=>e.value)).size;if(t){const t={error:V(D)};e?.("BAR_CHART_X_AXIS_ERROR",t),h||(h=t)}if(a){const t={error:V(B)};e?.("BAR_CHART_X_AXIS_ERROR",t),h||(h=t)}}const Z=C!==m.LEFT&&C!==m.RIGHT,ie=te({initPos:T-S,maxSpaceAvailable:T,needAjusted:c===E.HORIZONTAL,otherAxisSpace:L+S,securitySpace:O,tickValues:U});if(ie){const t=ie.length<2,a=ie.length>=2&&1===new Set(ie.map(e=>e.value)).size;if(t){const t={error:V(X)};e?.("BAR_CHART_Y_AXIS_ERROR",t),h||(h=t)}if(a){const t={error:V(P)};e?.("BAR_CHART_Y_AXIS_ERROR",t),h||(h=t)}}const oe=z?Q(ie||[],[String(w)])[0]:0,se=Z?Q(G||[],[String(Y)])[0]:0,ce=q({canvasHeight:T,canvasWidth:_,customBreakAxis:Number(oe),extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:$,extraSpaceTopY:L,position:v}),de=J({canvasHeight:T,canvasWidth:_,customBreakAxis:Number(se),extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:$,extraSpaceTopY:L,position:C});if(ce.x1===ce.x2){const t={error:V(M)};e?.("BAR_CHART_X_AXIS_ERROR",t),h||(h=t)}if(de.y1===de.y2){const t={error:V(F)};e?.("BAR_CHART_Y_AXIS_ERROR",t),h||(h=t)}const le={addError:e,crossXAxis:z,crossYAxis:Z,data:A,extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:$,extraSpaceTopY:L,securityXSpace:b,securityYSpace:O,xAxisCoordinates:{coordinates:ce,tickValues:G||(h?[{position:0,value:ae},{position:_,value:re}]:[])},xAxisText:H,yAxisCoordinates:{coordinates:de,tickValues:ie||(h?[{position:T,value:ae},{position:0,value:re}]:[])},yAxisText:W};return h?{...le,error:{...h,type:y.BAR_CHART_CONTEXT_ERROR}}:le},Ue=Object.assign(({canvasConfig:e=p,caption:t,children:a,classNames:r,data:n,dataTestId:i,gapBetweenBars:o=0,height:s="100%",onErrors:c,orientation:R,pKey:g,role:A,tabIndex:E,width:y="100%",...v})=>{const{extraSpace:m,height:C,width:S}=e,I=_(S),$=_(C),N=m?_(m):void 0,k=h(I,$,N),L=me(a),b=2*o,O=[d.jsx(De,{},"default-x-axis"),d.jsx(Xe,{},"default-y-axis")],H=l.Children.toArray(a)||[],w=O.concat(H),j=Math.max(I,$,N??0),B=I/j,D=$/j,M=l.useMemo(()=>f(c),[c]),P=x(n),X=l.useMemo(()=>(M.clearErrors(),Ke({addError:(e,t)=>{M.addError(e,t)},ajustedX:B,ajustedY:D,canvasHeight:$,canvasWidth:I,children:w,data:n,gapBetweenBars:b,orientation:R,pKey:g,viewBox:k})),[C,S,P,g,R,M.addError]);return d.jsx(u,{caption:t,className:r,dataTestId:i,height:s,role:A,tabIndex:E,viewBox:k,width:y,...v,children:d.jsx(T.Provider,{value:{...X,barChildrenCount:L,canvasExtraSpace:N,canvasHeight:$,canvasWidth:I,data:n,dataTestId:i,gapBetweenBars:o,orientation:R,pKey:g},children:a})})},{Path:ve,Separator:({areaSeparator:e,dataTestId:t,rightSeparator:a,topSeparator:r,xBreakAxis:n,yBreakAxis:i})=>{const{addError:o,crossXAxis:s,crossYAxis:c,xAxisCoordinates:u,yAxisCoordinates:h}=l.useContext(T);if(l.useEffect(()=>{if(void 0!==n){const e=u.tickValues.map(e=>e.value),t="string"==typeof n?parseFloat(n):n;if(isNaN(t))o?.("BAR_CHART_SEPARATOR_ERROR",{error:U(n)});else{const a=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(t<a||t>r)&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:G(t,a,r)})}}if(void 0!==i){const e=h.tickValues.map(e=>e.value),t="string"==typeof i?parseFloat(i):i;if(isNaN(t))o?.("BAR_CHART_SEPARATOR_ERROR",{error:z(i)});else{const a=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(t<a||t>r)&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:Z(t,a,r)})}}},[n,i,u.tickValues,h.tickValues,o]),!r&&!a&&!e)return d.jsx(d.Fragment,{});const p=n&&Q(u.tickValues,[n],!0)[0],f=i&&Q(h.tickValues,[i])[0],x=c?h.coordinates.x1:u.coordinates.x2,R=s?u.coordinates.y1:h.coordinates.y1,g=u.coordinates.x1,A=p??x,_=h.coordinates.y2,E=f??R;l.useEffect(()=>{g===A&&_===E&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:V(w)})},[g,A,_,E,o]);const y=`M${g} ${_} H ${A} V ${E} H ${g} Z`,v=`M${g} ${E} H ${A}`,m=`M${A} ${_} V ${E}`;return d.jsxs("g",{children:[d.jsx("path",{d:y,"data-testid":`${t}Area`,...e}),d.jsx("path",{d:v,"data-testid":`${t}Top`,...r}),d.jsx("path",{d:m,"data-testid":`${t}Right`,...a})]})},XAxis:De,YAxis:Xe}),ze=l.createContext({}),Ge=({curved:e=!1,extendToBottom:t=!1,points:a,svgHeight:r})=>{if(0===a.length)return"";const[n,...i]=a;let o=`M ${n[0]} ${n[1]}`;return o+=e?i.reduce((e,t,r)=>{const[n,i]=a[r],[o,s]=t,c=.3*(o-n),d=[n+c,i],l=[o-c,s];return`${e} C ${d[0]} ${d[1]}, ${l[0]} ${l[1]}, ${o} ${s}`},""):i.reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,""),t&&(o+=` L ${i[i.length-1][0]} ${r} L ${n[0]} ${r} Z`),o},Ze=(e,t)=>new Error(`Invalid projection bounds - upper projection (${e}) must be below lower projection (${t})`),qe=(e,t)=>new Error(`${t?"Upper":"Lower"} projection X coordinate (${e}) is outside valid range (0-100)`),Je=(e,t,a)=>new Error(`${a?"Upper":"Lower"} projection Y coordinate (${e}) is outside chart area (0-${t})`),Qe=(e,t)=>{if(!t)return e;const a=t<0,r=e*Math.abs(t)/100;return a?e-r:e+r},et=(e,t,a)=>{if(!a)return e;const r=a<0,n=(0===e?t:e)*Math.abs(a)/100;return r?e+n:e-n},tt=({curved:e,lineProjection:t,points:a,svgHeight:r})=>{const{addError:n}=l.useContext(ze),{lower:i,shapeColor:o,upper:s}=t,{xProjection:c,yProjection:u,...h}=s||{},{xProjection:p,yProjection:f,...x}=i||{},R=c||u?{x:c,y:u}:void 0,g=p||f?{x:p,y:f}:void 0;l.useEffect(()=>{if(R&&g){const e=R.y||0,t=g.y||0;e>=t&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Ze(e,t)})}if(R){const{x:e,y:t}=R;void 0!==e&&(e<0||e>100)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:qe(e,!0)}),void 0!==t&&(t<0||t>r)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Je(t,r,!0)})}if(g){const{x:e,y:t}=g;void 0!==e&&(e<0||e>100)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:qe(e,!1)}),void 0!==t&&(t<0||t>r)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:Je(t,r,!1)})}},[R,g,r,n]);const{downPath:A,shapePath:_,upPath:T}=(({curved:e,lowerProjection:t,points:a,svgHeight:r,upperProjection:n})=>{const i=n||t;if(0===a.length&&!i)return{shapePath:""};const[o,...s]=a,c=`M ${o[0]} ${o[1]}`;let d=c,l=n?c:void 0,u=t?c:void 0;const h=[],p=[];s.forEach(([e,a])=>{const i=n?[Qe(e,n.x),et(a,r,n.y)]:[e,a],o=t?[Qe(e,-(t.x??0)),et(a,r,-(t.y??0))]:[e,a];h.push(i),p.push(o)});const f=n&&t?[...h,s.at(-1),...p.reverse(),o]:[...h,...p.reverse(),o];return e?(d+=f.reduce((e,t,a)=>{const r=0===a?o:f[a-1],[n,i]=r,[s,c]=t,d=.3*(s-n),l=[n+d,i],u=[s-d,c];return`${e} C ${l[0]} ${l[1]}, ${u[0]} ${u[1]}, ${s} ${c}`},""),l&&(l+=h.reduce((e,t,a)=>{const r=0===a?o:h[a-1],[n,i]=r,[s,c]=t,d=.3*(s-n),l=[n+d,i],u=[s-d,c];return`${e} C ${l[0]} ${l[1]}, ${u[0]} ${u[1]}, ${s} ${c}`},"")),u&&(u+=p.reverse().reduce((e,t,a)=>{const r=0===a?o:p[a-1],[n,i]=r,[s,c]=t,d=.3*(s-n),l=[n+d,i],u=[s-d,c];return`${e} C ${l[0]} ${l[1]}, ${u[0]} ${u[1]}, ${s} ${c}`},""))):(d+=f.reduce((e,t)=>`${e} L ${t?.[0]} ${t?.[1]}`,""),l&&(l+=h.reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,"")),u&&(u+=p.reverse().reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,""))),{downPath:u,shapePath:d,upPath:l}})({curved:e,lowerProjection:g,points:a,svgHeight:r,upperProjection:R});return d.jsxs("g",{className:"pointer-events-none",children:[d.jsx("path",{d:_,fill:o,stroke:"transparent",strokeWidth:"0.1"}),";",T&&d.jsx("path",{d:T,...h}),A&&d.jsx("path",{d:A,...x})]})},at=(e,t)=>e.map(e=>e[t]),rt={formatTicksValues:(e,t)=>e.map(e=>({...e,value:t(e.value)}))},nt=({ariaLabel:e,position:t=m.BOTTOM,tickLine:a,tickText:r,valueFormatter:n=e=>e,...i})=>{const{xAxisCoordinates:{coordinates:o,tickValues:s},xCursor:c,...u}=l.useContext(ze),h=Be(t,o.y1,Number(r?.fontSize),r?.top??0),p=u.extraSpaceTopY,f=Number(u.canvasHeight)-u.extraSpaceBottomY,x=r?rt.formatTicksValues(s,n):void 0,R=ie(i),g=e||i["aria-label"],A={...i,...R,...g&&{"aria-label":g}};return d.jsx(we,{...o,...A,canvasHeight:Number(u.canvasHeight),canvasWidth:Number(u.canvasWidth),cursor:c,dataTestId:`${u.dataTestId}xAxis`,extraSpace:{left:u.extraSpaceLeftX,right:u.extraSpaceRightX},tickLine:{...a,y1:p,y2:f},tickText:{...r,y:h},tickValues:x})},it=({ariaLabel:e,position:t=m.LEFT,tickLine:a,tickText:r,valueFormatter:n=e=>e,...i})=>{const{yAxisCoordinates:{coordinates:o,tickValues:s},yCursor:c,...u}=l.useContext(ze),h=r?.textAnchor||"middle",p=(t===m.RIGHT?r?.right:r?.left)??0,f=Pe(h,u.yAxisText,p),x=je(t,o.x1,f),R=r?rt.formatTicksValues(s,n):void 0,g=ie(i),A=e||i["aria-label"],_={...i,...g,...A&&{"aria-label":A}};return d.jsx(Me,{...o,..._,canvasHeight:Number(u.canvasHeight),canvasWidth:Number(u.canvasWidth),cursor:c,dataTestId:`${u.dataTestId}yAxis`,tickLine:{...a,x1:u.extraSpaceLeftX,x2:Number(u.canvasWidth)-u.extraSpaceRightX},tickText:{...r,x:x},tickValues:R})},ot={[R]:R,[g]:g},st="WIDTH",ct=/^(\d+(\.\d+)?)(px|rem|%)?$/,dt=e=>{if("number"==typeof e)return{unit:void 0,value:e};const t=e.match(ct);if(!t)throw new Error(`Invalid string format: "${e}"`);const a=parseFloat(t[1]),r=t[3];return{unit:ot[r],value:a}},lt=(e,t,a)=>{const r=a.parentElement;return r?e/100*(t===st?r.clientWidth:r.clientHeight):0},ut=e=>{const t=Ie();if(!t)return 16*e;const a=(e=>{const t=Se()?window:void 0;if(t)return t.getComputedStyle(e)})(t.documentElement);return a?e*(parseFloat(a.fontSize)||16):16*e},ht=({canvasHeight:e,canvasWidth:t,svgElement:a})=>{const{unit:r,value:n}=dt(t),i=r===R?lt(n,st,a):r===g?ut(n):n,{unit:o,value:s}=dt(e);return{parsedCanvasHeight:o===R?lt(s,"HEIGHT",a):o===g?ut(s):s,parsedCanvasWidth:i}},pt=e=>{if(e.custom)return e.custom?.values;if(e.numeric){const{max:t,min:a=0,step:r}=e.numeric;if(r>=Math.abs(t-a)||r<=0)return[a.toString(),t.toString()];const n=[];for(let e=a;e<=t;e+=r)n.push(e.toString());return n}},ft=(e,t)=>e.flatMap(e=>Object.keys(e).filter(a=>a!==t&&"number"==typeof e[a]).map(t=>e[t])),xt=(e,t,a,r,n,i,o)=>{const{position:s,tickText:c,tickValues:d,valueFormatter:l}=e.props,u=c?.fontSize??0,h=u*r,p=d?pt(d):t.map(e=>e[a]),f=l?p.map(l):p,x=Ne({bound:"width",data:f,fontSize:u,svgHeight:`${i}`,svgWidth:`${o}`,viewBox:n}),R=s===m.TOP;return{extraSpaceBottomY:s===m.BOTTOM?h+(c?.top??0):0,extraSpaceTopY:R?h+(c?.bottom??0):0,lineChartXPosition:s||m.BOTTOM,securityXSpace:x,xBreakAxis:d?.numeric?d.numeric.breakAxis??0:c?.custom?.breakAxis??0,xData:p}},Rt=(e,t,a,r,n,i,o)=>{const{position:s,tickText:c,tickValues:d,valueFormatter:l}=e.props,u=c?.fontSize??"0",h=u*r,p=d||Ce([...new Set(ft(t,a))]),f=pt(p),x=l?f.map(l):f,R=Ne({bound:"width",data:x,fontSize:u,svgHeight:`${i}`,svgWidth:`${o}`,viewBox:n}),g=h,A=s===m.RIGHT;return{extraSpaceLeftX:s===m.LEFT?R+(c?.right??0):0,extraSpaceRightX:A?R+(c?.left??0):0,lineChartYPosition:s||m.LEFT,securityYSpace:g,yAxisText:R,yBreakAxis:d?.numeric?d.numeric.breakAxis??0:c?.custom?.breakAxis??0,yData:f}},gt=({addError:e,ajustedX:t,ajustedY:a,canvasHeight:r,canvasWidth:n,children:i,data:o,viewBox:s,xKey:c})=>{let d;if(!o||0===o.length){const t={error:V(L)};e?.("LINE_CHART_CONTEXT_ERROR",t),d=t}if(o&&1===o.length){const t={error:V(j)};e?.("LINE_CHART_CONTEXT_ERROR",t),d=t}if(n<=0||r<=0){const t={error:K(n,r)};e?.("LINE_CHART_CONTEXT_ERROR",t),d=t}const u=o&&o.length>0?o:[{[c]:"0",y:0},{[c]:"1",y:1}],h=n>0?n:100,p=r>0?r:100,{extraSpaceBottomY:f,extraSpaceLeftX:x,extraSpaceRightX:R,extraSpaceTopY:g,lineChartXPosition:A,lineChartYPosition:_,securityXSpace:T,securityYSpace:E,xAxisText:v,xBreakAxis:C,xData:S,yAxisText:I,yBreakAxis:$,yData:k}=(({ajustedX:e,ajustedY:t,canvasHeight:a,canvasWidth:r,children:n,data:i,viewBox:o,xKey:s})=>{let c={extraSpaceBottomY:0,extraSpaceLeftX:0,extraSpaceRightX:0,extraSpaceTopY:0,lineChartXPosition:m.BOTTOM,lineChartYPosition:m.LEFT,securityXSpace:0,securityYSpace:0,xAxisText:0,xBreakAxis:0,xData:[],yAxisText:0,yBreakAxis:0,yData:[]};return l.Children.forEach(n,n=>{l.isValidElement(n)&&(n.type===nt?c={...c,...xt(n,i,s,e,o,a,r)}:n.type===it&&(c={...c,...Rt(n,i,s,t,o,a,r)}))}),c})({ajustedX:t,ajustedY:a,canvasHeight:p,canvasWidth:h,children:i,data:u,viewBox:s,xKey:c}),b=A!==m.TOP&&A!==m.BOTTOM,O=ee({initPos:x,maxSpaceAvailable:h,otherAxisSpace:x+R,securitySpace:T,tickValues:S});if((O??[]).some(({position:e})=>isNaN(e))){const t={error:V(N)};e?.("LINE_CHART_CONTEXT_ERROR",t),d=t}if(O){const t=O.length<2,a=O.length>=2&&1===new Set(O.map(e=>e.value)).size;if(t){const t={error:V(D)};e?.("LINE_CHART_X_AXIS_ERROR",t),d||(d=t)}if(a){const t={error:V(B)};e?.("LINE_CHART_X_AXIS_ERROR",t),d||(d=t)}}const H=_!==m.LEFT&&_!==m.RIGHT,w=te({initPos:p-f,maxSpaceAvailable:p,otherAxisSpace:g+f,securitySpace:E,tickValues:k});if(w){const t=w.length<2,a=w.length>=2&&1===new Set(w.map(e=>e.value)).size;if(t){const t={error:V(X)};e?.("LINE_CHART_Y_AXIS_ERROR",t),d||(d=t)}if(a){const t={error:V(P)};e?.("LINE_CHART_Y_AXIS_ERROR",t),d||(d=t)}}const W=b?Q(w||[],[String(C)])[0]:0,Y=H?Q(O||[],[String($)])[0]:0,U=q({canvasHeight:p,canvasWidth:h,customBreakAxis:Number(W),extraSpaceBottomY:f,extraSpaceLeftX:x,extraSpaceRightX:R,extraSpaceTopY:g,position:A}),z=J({canvasHeight:p,canvasWidth:h,customBreakAxis:Number(Y),extraSpaceBottomY:f,extraSpaceLeftX:x,extraSpaceRightX:R,extraSpaceTopY:g,position:_});if(U.x1===U.x2){const t={error:V(M)};e?.("LINE_CHART_X_AXIS_ERROR",t),d||(d=t)}if(z.y1===z.y2){const t={error:V(F)};e?.("LINE_CHART_Y_AXIS_ERROR",t),d||(d=t)}const G={addError:e,crossXAxis:b,crossYAxis:H,extraSpaceBottomY:f,extraSpaceLeftX:x,extraSpaceRightX:R,extraSpaceTopY:g,securityXSpace:T,securityYSpace:E,xAxisCoordinates:{coordinates:U,tickValues:O||(d?[{position:0,value:"0"},{position:h,value:"1"}]:[])},xAxisText:v,yAxisCoordinates:{coordinates:z,tickValues:w||(d?[{position:p,value:ae},{position:0,value:re}]:[])},yAxisText:I};return d?{...G,error:{...d,type:y.LINE_CHART_CONTEXT_ERROR}}:G},At=Object.assign(({ariaHidden:e,ariaLabel:t,canvasConfig:a=p,caption:r,children:n,classNames:i,data:o,dataTestId:s="line-chart",getPathArea:c,height:R="100%",onErrors:g,role:A,tabIndex:T,width:E="100%",xKey:y,...v})=>{const{extraSpace:m,height:C,width:S}=a,[I,$]=l.useState(""),[N,k]=l.useState({height:0,width:0}),L=m?_(m):void 0,b=h(N.width,N.height,L),O=[d.jsx(nt,{},"default-x-axis"),d.jsx(it,{},"default-y-axis")],H=l.Children.toArray(n)||[],w=O.concat(H),j=Math.max(N.width,N.height,L??0),B=isNaN(N.width/j)?0:N.width/j,D=isNaN(N.height/j)?0:N.height/j;(({attrName:e,children:t,originalValue:a,updateValue:r})=>{let n="";l.Children.toArray(t).forEach(t=>{if(l.isValidElement(t)){const a=t.props[e];a&&(n+=a)}}),n!==a&&r(n)})({attrName:"dataKey",children:w,originalValue:I,updateValue:$});const M=l.useMemo(()=>f(g),[g]),P=x(o),X=l.useMemo(()=>(M.clearErrors(),gt({addError:(e,t)=>{M.addError(e,t)},ajustedX:B,ajustedY:D,canvasHeight:N.height,canvasWidth:N.width,children:w,data:o,viewBox:b,xKey:y})),[N.width,N.height,P,y,I,M.addError]),{svgRef:F,xCursor:W,yCursor:V}=(({canvasHeight:e,canvasWidth:t})=>{const[[a,r],n]=l.useState([se,se]),i=l.useCallback((a,r)=>{const{height:i,left:o,top:s,width:c}=r.getBoundingClientRect(),d=a.clientX-o,l=a.clientY-s;n([d*t/c,l*e/i])},[t,e]),o=e=>{e.preventDefault()};return{svgRef:l.useCallback(e=>{e&&(e.addEventListener("touchstart",o),e.addEventListener("touchmove",t=>i(t.touches[0],e)),e.addEventListener("mousemove",t=>i(t,e))),e?.removeEventListener("touchstart",o),e?.removeEventListener("touchmove",t=>i(t.touches[0],e)),e?.removeEventListener("mousemove",t=>i(t,e))},[e,t]),xCursor:a,yCursor:r}})({canvasHeight:N.height,canvasWidth:N.width});return l.useEffect(()=>{const e=document.querySelector("[data-kbt-svg]");if(!e)return;const{parsedCanvasHeight:t,parsedCanvasWidth:a}=ht({canvasHeight:C,canvasWidth:S,svgElement:e});k({height:t,width:a})},[S,C]),l.useEffect(()=>{c?.({x1:X.extraSpaceLeftX,x2:N.width-X.extraSpaceRightX,y1:X.extraSpaceTopY,y2:N.height-X.extraSpaceBottomY})},[N.width,N.height]),d.jsx(u,{ref:F,ariaHidden:e,ariaLabel:t,caption:r,className:i,"data-kbt-svg":!0,dataTestId:s,height:R,role:A,tabIndex:T,viewBox:b,width:E,...v,children:d.jsx(ze.Provider,{value:{...X,canvasExtraSpace:L,canvasHeight:N.height,canvasWidth:N.width,data:o,dataTestId:s,xCursor:W,xKey:y,yCursor:V},children:n})})},{Path:({ariaLabel:e,closestClick:t,curved:a,getNodeFocusInfo:r,getNodesCoords:n,indicatorConfig:i,lineProjection:o,onClick:s,...c})=>{const{addError:u,xAxisCoordinates:h,yAxisCoordinates:p,...f}=l.useContext(ze);l.useEffect(()=>{if(!c.dataKey||"string"!=typeof c.dataKey)return void u?.("LINE_CHART_PATH_ERROR",{error:V(H)});if(f.data.length>0&&!Object.prototype.hasOwnProperty.call(f.data[0],c.dataKey))return void u?.("LINE_CHART_PATH_ERROR",{error:Y(c.dataKey)});if(a&&f.data.length<2)return void u?.("LINE_CHART_PATH_ERROR",{error:V(O)});const e=at(f.data,c.dataKey);e.length>0&&e.every(e=>null==e)&&u?.("LINE_CHART_PATH_ERROR",{error:V(b)})},[c.dataKey,a,f.data,u]);const{indicatorRef:x,pathRef:R}=((e,t)=>{const a=l.useRef(null),r=l.useRef(null);return l.useEffect(()=>{if(!t||!a.current||!r.current)return;const n=a.current,i=r.current;let o,s,c=0,d=n.getTotalLength();for(;d-c>.01;)o=(c+d)/2,s=n.getPointAtLength(o),s.x<e?c=o:d=o;const l=n.getPointAtLength(d);i.setAttribute("transform",`translate(${l.x}, ${l.y})`),i.setAttribute("pointer-events","none")},[e]),{indicatorRef:r,pathRef:a}})(f.xCursor,!!i),g=!!i&&f.xCursor!==-1/0,A=l.useRef(null),_=l.useRef(null),{autoClick:T,lineIndicator:E,...y}=i||{},v=f.extraSpaceTopY,m=Number(f.canvasHeight)-f.extraSpaceBottomY,{tickValues:C}=h,{tickValues:S}=p,I=at(f.data,f.xKey),$=at(f.data,c.dataKey),N=Q(C,I,!0),k=Q(S,$),L=N.map((e,t)=>[e,k[t]]),w=Ge({curved:a,extendToBottom:!1,points:L,svgHeight:Number(f.canvasHeight)-f.extraSpaceBottomY}),j=Ge({curved:a,extendToBottom:!!c.fill||!!c.gradient,points:L,svgHeight:Number(f.canvasHeight)-f.extraSpaceBottomY});l.useEffect(()=>{if(!A.current?.path)return;R.current=A.current.path;const e=A.current.main,t=A.current.node,a=I.map((e,t)=>({x:e,y:$[t]})),{mount:n,unmount:i}=(({data:e,getNodeFocusInfo:t,nodes:a,ref:r})=>{let n,i=!1;const o=r.querySelector("[data-draw]"),s=r=>{i&&("ArrowRight"===r.key?(n=void 0===n||n===a.length-1?0:n+1,a[n].focus(),t?.(e[n])):"ArrowLeft"===r.key&&(n=void 0===n||0===n?a.length-1:n-1,a[n].focus(),t?.(e[n])))},c=()=>{i=!0},d=()=>{i=!1},l=()=>{n=void 0};return{mount:()=>{r.addEventListener("focusin",c),r.addEventListener("focusout",d),o?.addEventListener("focus",l),window.addEventListener("keydown",e=>s(e))},unmount:()=>{r.removeEventListener("focusin",c),r.removeEventListener("focusout",d),o?.removeEventListener("focus",l),window.removeEventListener("keydown",e=>s(e))}}})({data:a,getNodeFocusInfo:r,nodes:t,ref:e});return n(),()=>i()},[]),l.useEffect(()=>{if(c.nodeConfig&&g&&T){const{idx:e,match:t}=((e,t)=>{let a=0,r=!1;for(let n=0;n<e.length;n++)if(Math.round(e[n])===Math.round(t)){r=!0,a=n;break}return{idx:a,match:r}})(N,f.xCursor);if(t&&e!==_.current){_.current=e;const t=new MouseEvent("click",{bubbles:!0});t.autoClick=!0,A.current?.node?.[e]?.dispatchEvent(t),navigator?.vibrate?.(200)}else _.current=null}},[f.xCursor]),l.useEffect(()=>{n?.(L)},[L]);const B=ie(c),D={...c,...B,...e&&{"aria-label":e}};return d.jsxs(d.Fragment,{children:[d.jsx(Te,{ref:A,d:w,dFill:j,dataTestId:`${f.dataTestId}path`,dataValue:f.data,points:L,xKey:f.xKey,onClick:e=>{if(s?.(e),t){const e=((e,t)=>{let a=0,r=Math.abs(e[0]-t);for(let n=1;n<e.length;n++){const i=Math.abs(e[n]-t);i<r&&(a=n,r=i)}return a})(N,f.xCursor),t=new MouseEvent("click",{bubbles:!0});t.autoClick=!1,A.current?.node?.[e]?.dispatchEvent(t)}},...D}),o&&d.jsx(tt,{curved:a,dataKey:c.dataKey,lineProjection:o,points:L,svgHeight:Number(f.canvasHeight)-f.extraSpaceBottomY}),g&&d.jsxs(d.Fragment,{children:[!!E&&d.jsx(ke,{...E,className:"pointer-events-none",x1:f.xCursor,x2:f.xCursor,y1:v,y2:m}),d.jsx("g",{ref:x,className:"pointer-events-none",children:d.jsx(Ae,{...y})})]})]})},Separator:({areaSeparator:e,dataTestId:t,rightSeparator:a,topSeparator:r,xBreakAxis:n,yBreakAxis:i})=>{const{addError:o,crossXAxis:s,crossYAxis:c,xAxisCoordinates:u,yAxisCoordinates:h}=l.useContext(ze);if(l.useEffect(()=>{if(void 0!==n){const e=u.tickValues.map(e=>e.value),t="string"==typeof n?parseFloat(n):n;if(isNaN(t))o?.("LINE_CHART_SEPARATOR_ERROR",{error:U(n)});else{const a=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(t<a||t>r)&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:G(t,a,r)})}}if(void 0!==i){const e=h.tickValues.map(e=>e.value),t="string"==typeof i?parseFloat(i):i;if(isNaN(t))o?.("LINE_CHART_SEPARATOR_ERROR",{error:z(i)});else{const a=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(t<a||t>r)&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:Z(t,a,r)})}}},[n,i,u.tickValues,h.tickValues,o]),!r&&!a&&!e)return d.jsx(d.Fragment,{});const p=n&&Q(u.tickValues,[n],!0)[0],f=i&&Q(h.tickValues,[i])[0],x=c?h.coordinates.x1:u.coordinates.x2,R=s?u.coordinates.y1:h.coordinates.y1,g=u.coordinates.x1,A=p??x,_=h.coordinates.y2,T=f??R;l.useEffect(()=>{g===A&&_===T&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:V(w)})},[g,A,_,T,o]);const E=`M${g} ${_} H ${A} V ${T} H ${g} Z`,y=`M${g} ${T} H ${A}`,v=`M${A} ${_} V ${T}`;return d.jsxs("g",{children:[d.jsx("path",{d:E,"data-testid":`${t}Area`,...e}),d.jsx("path",{d:y,"data-testid":`${t}Top`,...r}),d.jsx("path",{d:v,"data-testid":`${t}Right`,...a})]})},XAxis:nt,YAxis:it}),_t=({children:e,dataTestId:t,height:a,width:r,x:n,y:i})=>d.jsx("foreignObject",{"data-testid":t,height:a,width:r,x:n,y:i,children:e}),Tt=l.createContext({}),Et=(e,t,a)=>({x:e.x+t*Math.cos(a),y:e.y+t*Math.sin(a)}),yt=({center:e,innerEnd:t,innerRadius:a,singleStroke:r})=>{if(!r)return a>0?`L ${t.x},${t.y}`:`L ${e.x},${e.y}`},vt="CLOCKWISE",mt=({canvasHeight:e,canvasWidth:t,color:a="blue",gap:r,halfChart:n,innerRadius:i,radius:o,singleStroke:s,startAngle:c,total:l,value:u,...h})=>{const p=(({canvasHeight:e,canvasWidth:t,customRadius:a,gap:r,halfChart:n,innerRadius:i,rotateDirection:o,singleStroke:s,startAngle:c,total:d,value:l})=>{const u=n?2*e:e,h=Math.min(t,u)/2,p=a&&a<h?a:h,f=n?Math.PI:2*Math.PI,x={x:t/2,y:n?e:e/2},R=s?2*d:d,g=100*l/R*f/100,A=r/p,{carryAngle:_,finalAngle:T,initialAngle:E}=(({angleEquivalent:e,direction:t,gapAngle:a,startAngle:r})=>{const n=t===vt;return{carryAngle:n?r+e:r-e,finalAngle:n?r+e-a/2:r-e+a/2,initialAngle:n?r+a/2:r-a/2}})({angleEquivalent:g,direction:o,gapAngle:A,startAngle:c.current});c.current=_;const y=f*l/R-A<=Math.PI?"0":"1",v=Et(x,i,E),m=Et(x,i,T),C=Et(x,p,E);return(({center:e,innerEnd:t,innerRadius:a,innerStart:r,largeArcFlag:n,outerEnd:i,outerStart:o,radius:s,rotateDirection:c,singleStroke:d})=>{let l,u,h,p,f,x,R,g,A,_;return c===vt?(l=`M ${o.x},${o.y}`,u=`A ${s},${s} 0 ${n} 1 ${i.x}, ${i.y}`,h=yt({center:e,innerEnd:t,innerRadius:a,singleStroke:d}),p=d?`M ${t.x},${t.y}`:void 0,f=a>0?`A ${a},${a} 0 ${n} 0 ${r.x},${r.y}`:void 0,x=`M ${o.x},${o.y}`,g=`M ${t.x},${t.y}`,R=`A ${s},${s} 0 ${n} 0 ${i.x},${i.y}`,A=`A ${a},${a} 0 ${n} 1 ${r.x},${r.y}`,_=d?void 0:"Z"):(l=`M ${o.x} ${o.y}`,u=`A ${s},${s} 0 ${n},0 ${i.x}, ${i.y}`,h=yt({center:e,innerEnd:t,innerRadius:a,singleStroke:d}),p=d?`M ${t.x},${t.y}`:void 0,f=a>0?`A ${a}, ${a} 0 ${n},1 ${r.x},${r.y}`:void 0,x=`M ${o.x},${o.y}`,g=`M ${t.x},${t.y}`,R=`A ${s},${s} 0 ${n} 1 ${i.x},${i.y}`,A=`A ${a},${a} 0 ${n} 0 ${r.x},${r.y}`,_=d?void 0:"Z"),[l,u,h,p,f,_].concat(d?[x,R,g,A]:[]).filter(Boolean).join(" ")})({center:x,innerEnd:m,innerRadius:i,innerStart:v,largeArcFlag:y,outerEnd:Et(x,p,T),outerStart:C,radius:p,rotateDirection:o,singleStroke:s})})({canvasHeight:e,canvasWidth:t,customRadius:o,gap:r,halfChart:n,innerRadius:i,singleStroke:s,startAngle:c,total:l,value:u});return d.jsx(Te,{...h,d:p,dataValue:u,fill:a})},Ct=({dataKey:e,fill:t,gap:a,innerRadius:r,radius:n,...i})=>{const o=String(e),{canvasHeight:s,canvasWidth:c,data:u,dataTestId:h,halfChart:p}=l.useContext(Tt),f=p?0:-Math.PI/2,x=l.useRef(f),R=u[o]?.reduce((e,t)=>e+t.value,0),g=1===u[o]?.length,A=r?_(r):void 0,T=n?_(n):void 0;return u[o]?.length?d.jsx("g",{children:u[o].map((e,r)=>l.createElement(mt,{...i,...e,key:`${r.toString()}`,canvasHeight:s,canvasWidth:c,color:e.color||t,dataTestId:`${h}path-${r}`,gap:a,halfChart:p,innerRadius:A,radius:T,singleStroke:g,startAngle:x,total:R}))}):d.jsx(d.Fragment,{})},St=Object.assign(({ariaHidden:e,ariaLabel:t,canvasConfig:a=p,caption:r,children:n,classNames:i,data:o,dataTestId:s="pie-chart",halfChart:c,height:f="100%",radius:x="50%",role:R,tabIndex:g,width:A="100%",...T})=>{const{extraSpace:E,height:y,width:v}=a,m=_(v),C=_(y),S=E?_(E):void 0,I=h(m,C,S),$=l.useMemo(()=>(({canvasHeight:e,canvasWidth:t,children:a,halfChart:r})=>{let n,i;l.Children.forEach(a,e=>{if(l.isValidElement(e)&&e.type===Ct){const{innerRadius:t}=e.props;if(!t)return;const a=_(t);(!n||a<n)&&(n=a)}}),n&&(i=2*n);const o=i??0,s=r?o/2:o,c=r?e:e/2;return{foreignObject:{height:s,width:o,x:t/2-o/2,y:r?c-s:c-s/2}}})({canvasHeight:C,canvasWidth:m,children:n,halfChart:c}),[y,v,c]);return d.jsx(u,{ariaHidden:e,ariaLabel:t,caption:r,className:i,dataTestId:s,height:f,radius:x,role:R,tabIndex:g,viewBox:I,width:A,...T,children:d.jsx(Tt.Provider,{value:{...$,canvasHeight:C,canvasWidth:m,data:o,dataTestId:s,halfChart:c},children:n})})},{Foreign:({children:e,dataTestId:t,height:a,width:r,x:n,y:i,...o})=>{const{dataTestId:s,foreignObject:c}=l.useContext(Tt),u=!r&&c?.width?c.width:r,h=!a&&c?.height?c.height:a,p=!n&&c?.x?c.x:n,f=!i&&c?.y?c.y:i,x=!t&&s?`${s}-foreign-object`:t;return d.jsx(_t,{...o,dataTestId:x,height:h,width:u,x:p,y:f,children:e})},Path:Ct}),It=({fill:e="#8f8f8f",x:t,y:a})=>d.jsxs("g",{fill:e,pointerEvents:"none",transform:`translate(${t-5}, ${a-5})`,children:[d.jsx("path",{d:"M4.99948 9.99802C4.47168 9.99802 4.04419 9.64335 4.04419 9.20547V0.79255C4.04419 0.354666 4.47168 0 4.99948 0C5.52728 0 5.95477 0.354666 5.95477 0.79255V9.20745C5.95477 9.64533 5.52728 10 4.99948 10V9.99802Z"}),d.jsx("path",{d:"M0.955289 8.78839C0.427492 8.78839 0 8.43372 0 7.99584V2.00416C0 1.56628 0.427492 1.21161 0.955289 1.21161C1.48309 1.21161 1.91058 1.56628 1.91058 2.00416V7.99584C1.91058 8.43372 1.48309 8.78839 0.955289 8.78839Z"}),d.jsx("path",{d:"M8.08936 7.99584C8.08936 8.43372 8.51685 8.78839 9.04464 8.78839C9.57244 8.78839 9.99993 8.43372 9.99993 7.99584V2.00416C9.99993 1.56628 9.57244 1.21161 9.04464 1.21161C8.51685 1.21161 8.08936 1.56628 8.08936 2.00416V7.99584Z"})]}),$t=({linesData:e})=>d.jsx(d.Fragment,{children:e.map((e,t)=>d.jsxs("g",{children:[e.config.fill&&e.fillPath&&d.jsx("path",{d:e.fillPath,fill:e.config.fill,fillOpacity:e.config.fillOpacity||.2,stroke:"none"}),d.jsx("path",{d:e.linePath,fill:"none",stroke:e.config.stroke||"#0078D4",strokeWidth:e.config.strokeWidth||1})]},e.config.dataKey||e.config.yKey||t))}),Nt={FOCUS_COLOR:"#0078D4",FOCUS_INNER:"#ffffff",INNER_FOCUS_STROKE_WIDTH:2,OUTER_FOCUS_STROKE_WIDTH:2,OUTLINES_GAP:0},kt=({elementHeight:e,elementPosition:t,elementStrokeWidth:a=0,elementType:r,elementWidth:n,gap:i=0,innerStrokeWidth:o=2,outlineStrokeWidth:s=2})=>{if("circle"===r){const e=n/2+a/2+o/2+i,r=e+o/2+s/2;return{inner:{cx:t.x,cy:t.y,r:e},outer:{cx:t.x,cy:t.y,r:r},type:"circle"}}const c=n+a+o+2*i,d=e+a+o+2*i,l=c+o+s,u=d+o+s;return{inner:{height:d,width:c,x:t.x-c/2,y:t.y-d/2},outer:{height:u,width:l,x:t.x-l/2,y:t.y-u/2},type:"rectangle"}},Lt=(e,t,a)=>{const r=e.start/Math.max(1,t-1)*a;return{endX:e.end/Math.max(1,t-1)*a,startX:r}},bt=(e,t,a)=>{const r=Math.max(0,Math.min(t,e))/t;return Math.round(r*(a-1))},Ot=(e,t,a=.1)=>{const r=Math.max(0,Math.min(e.start,t-1-a));return{end:Math.min(t-1,Math.max(e.end,r+a)),start:r}},Ht=e=>({end:Math.max(0,e-1),start:0}),wt=(e,t)=>0===e.start&&e.end===t-1,jt=({endX:e,focusConfig:t,height:a,isFocused:r,startX:n})=>{if(!r)return null;const i=e-n,o=kt({elementHeight:a,elementPosition:{x:n+i/2,y:a/2},elementStrokeWidth:0,elementType:"rectangle",elementWidth:i,gap:t.gap,innerStrokeWidth:t.innerStrokeWidth,outlineStrokeWidth:t.outlineStrokeWidth}),s=t.outlineColor,c=t.innerColor,l=t.outlineStrokeWidth,u=t.innerStrokeWidth;return"rectangle"!==o.type?null:d.jsxs("g",{pointerEvents:"none",children:[d.jsx("rect",{fill:"none",height:o.outer.height,stroke:s,strokeWidth:l,width:o.outer.width,x:o.outer.x,y:o.outer.y}),d.jsx("rect",{fill:"none",height:o.inner.height,stroke:c,strokeWidth:u,width:o.inner.width,x:o.inner.x,y:o.inner.y})]})},Bt=({currentRange:e,dataLength:t,dataTestId:a,endX:r,height:n,onBlur:i,onFocus:o,onKeyDown:s,onMouseDown:c,onTouchStart:l,screenReaderText:u,selectionConfig:h,startX:p})=>{const f=h.hideOverlayOnFullRange&&wt(e,t);return d.jsx(d.Fragment,{children:d.jsx("rect",{"aria-label":u,"aria-valuemax":t-1,"aria-valuemin":0,"aria-valuetext":u,cursor:"grab","data-testid":a,fill:h.fill,fillOpacity:h.fillOpacity,height:n,role:"slider",stroke:h.stroke,strokeWidth:h.strokeWidth,style:{outline:"none",visibility:f?"hidden":"visible"},tabIndex:0,width:r-p,x:p,y:0,onBlur:i,onFocus:o,onKeyDown:s,onMouseDown:c,onTouchStart:l})})},Dt="#8f8f8f",Mt=({dataTestId:e,focusConfig:t,handlerConfig:a,height:r,isFocused:n,max:i,min:o,onBlur:s,onFocus:c,onKeyDown:l,onMouseDown:u,onTouchStart:h,screenReaderText:p,x:f})=>{const x=r/2,R=(e=>({fill:e?.fill||"#ffffff",iconColor:e?.iconColor||Dt,radius:e?.radius||17,stroke:e?.stroke||Dt,strokeWidth:e?.strokeWidth||1,verticalLineStroke:e?.verticalLineStroke||Dt,verticalLineStrokeWidth:e?.verticalLineStrokeWidth||2}))(a),g=kt({elementHeight:2*R.radius,elementPosition:{x:f,y:x},elementStrokeWidth:"number"==typeof R.strokeWidth?R.strokeWidth:parseFloat(R.strokeWidth.toString()),elementType:"circle",elementWidth:2*R.radius,gap:t.gap,innerStrokeWidth:t.innerStrokeWidth,outlineStrokeWidth:t.outlineStrokeWidth});return d.jsxs("g",{"data-testid":`${e}-group`,children:[d.jsx("line",{pointerEvents:"none",stroke:R.verticalLineStroke,strokeWidth:R.verticalLineStrokeWidth,x1:f,x2:f,y1:0,y2:r}),d.jsx("circle",{"aria-label":p,"aria-valuemax":i,"aria-valuemin":o,"aria-valuetext":p,cursor:"ew-resize",cx:f,cy:x,"data-testid":e,fill:R.fill,r:R.radius,role:"slider",stroke:R.stroke,strokeWidth:R.strokeWidth,style:{outline:"none"},tabIndex:0,onBlur:s,onFocus:c,onKeyDown:l,onMouseDown:u,onTouchStart:h}),d.jsx(It,{fill:R.iconColor,x:f,y:x}),n&&"circle"===g.type&&d.jsxs("g",{pointerEvents:"none",children:[d.jsx("circle",{cx:g.outer.cx,cy:g.outer.cy,fill:"none",r:g.outer.r,stroke:t.outlineColor,strokeWidth:t.outlineStrokeWidth}),d.jsx("circle",{cx:g.inner.cx,cy:g.inner.cy,fill:"none",r:g.inner.r,stroke:t.innerColor,strokeWidth:t.innerStrokeWidth})]})]})},Pt={END_HANDLER:"END_HANDLER",SELECTION_AREA:"SELECTION_AREA",START_HANDLER:"START_HANDLER"},Xt=e=>{const{currentRange:t,dataLength:a,interactionConfig:r,onRangeChange:n,width:i}=e,o=l.useRef(null),[s,c]=l.useState(null),d=l.useCallback(e=>()=>{c(e)},[]),u=l.useCallback(e=>()=>{c(e)},[]),h=l.useCallback(e=>{if(!s||!o.current)return;const c=o.current;if(!c)return;const d=e-c.getBoundingClientRect().left,l=bt(d,i,a),u=((e,t,a,r,n)=>{const i={...t};if(e===Pt.START_HANDLER)i.start=Math.max(0,Math.min(a,t.end-n.minHandlerDistance));else if(e===Pt.END_HANDLER)i.end=Math.min(r-1,Math.max(a,t.start+n.minHandlerDistance));else if(e===Pt.SELECTION_AREA){const e=t.end-t.start,n=Math.max(0,Math.min(r-1-e,a-e/2));i.start=n,i.end=n+e}return i})(s,t,l,a,r),h=Ot(u,a,r.minHandlerDistance);n(h)},[s,i,a,t,n,r]),p=l.useCallback(e=>{h(e.clientX)},[h]),f=l.useCallback(e=>{0!==e.touches.length&&(e.preventDefault(),h(e.touches[0].clientX))},[h]),x=l.useCallback(()=>{c(null)},[]),R=l.useCallback(()=>{c(null)},[]);return l.useEffect(()=>{if(s)return document.addEventListener("mousemove",p),document.addEventListener("mouseup",x),document.addEventListener("touchmove",f,{passive:!1}),document.addEventListener("touchend",R),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",x),document.removeEventListener("touchmove",f),document.removeEventListener("touchend",R)}},[s,p,x,f,R]),{groupRef:o,handleMouseDown:d,handleTouchStart:u,isDragging:s}},Ft=e=>{const{currentRange:t,dataLength:a,interactionConfig:r,onRangeChange:n}=e;return{handleKeyDown:l.useCallback(e=>i=>{const o=i.shiftKey?r.keyboardFastStep:r.keyboardStep;let s={...t};switch(i.key){case"ArrowLeft":case"ArrowDown":i.preventDefault(),s=((e,t,a,r)=>{const n={...t};if(e===Pt.START_HANDLER)n.start=Math.max(0,t.start-a);else if(e===Pt.END_HANDLER)n.end=Math.max(t.start+r.minHandlerDistance,t.end-a);else if(e===Pt.SELECTION_AREA){const e=t.end-t.start,r=Math.max(0,t.start-a);n.start=r,n.end=r+e}return n})(e,t,o,r);break;case"ArrowRight":case"ArrowUp":i.preventDefault(),s=((e,t,a,r,n)=>{const i={...t};if(e===Pt.START_HANDLER)i.start=Math.min(t.end-n.minHandlerDistance,t.start+a);else if(e===Pt.END_HANDLER)i.end=Math.min(r-1,t.end+a);else if(e===Pt.SELECTION_AREA){const e=t.end-t.start,n=Math.min(r-1-e,t.start+a);i.start=n,i.end=n+e}return i})(e,t,o,a,r);break;case"Home":i.preventDefault(),s=((e,t,a)=>{const r={...t};if(e===Pt.START_HANDLER)r.start=0;else if(e===Pt.END_HANDLER)r.end=a-1;else if(e===Pt.SELECTION_AREA){const e=t.end-t.start;r.start=0,r.end=e}return r})(e,t,a);break;case"End":i.preventDefault(),s=((e,t,a,r)=>{const n={...t};if(e===Pt.START_HANDLER)n.start=t.end-r.minHandlerDistance;else if(e===Pt.END_HANDLER)n.end=a-1;else if(e===Pt.SELECTION_AREA){const e=t.end-t.start;n.start=a-1-e,n.end=a-1}return n})(e,t,a,r);break;default:return}const c=Ot(s,a,r.minHandlerDistance);n(c)},[t,a,n,r])}},Wt=({canvasConfig:e,dataTestId:t,extraSpace:a=0,height:r,width:n})=>{const[i,o]=l.useState({height:0,width:0}),s=l.useMemo(()=>e||{extraSpace:a,height:r,width:n},[e,n,r,a]),{extraSpace:c,height:d,width:u}=s,p=c?_(c):void 0;l.useEffect(()=>{if(!Se())return;const e=(e=>{const t=Ie();return t?t.querySelector(e):null})(`[data-testid="${t}"]`);if(!e)return;const a=()=>{const{parsedCanvasHeight:t,parsedCanvasWidth:a}=ht({canvasHeight:d,canvasWidth:u,svgElement:e});o({height:t,width:a})};a();const r=new ResizeObserver(()=>{a()});return r.observe(e),()=>{r.disconnect()}},[u,d,t]);const f=l.useMemo(()=>h(i.width,i.height,p),[i.width,i.height,p]);return{parsedCanvas:i,viewBox:f}},Vt=()=>{const[e,t]=l.useState(null),a=l.useCallback(e=>()=>t(e),[]);return{handleBlur:l.useCallback(()=>{t(null)},[]),handleFocus:a,isFocused:l.useCallback(t=>e===t,[e])}},Yt=(e,t)=>{const a=Math.floor(e);return Math.max(0,Math.min(t,a))},Kt=(e,t)=>{const a=Math.ceil(e);return Math.max(0,Math.min(t,a))},Ut=(e,t)=>{const a=Math.max(0,t-1);return{endIndex:Kt(e.end,a),startIndex:Yt(e.start,a)}},zt=({data:e,initialRange:t,onDataChange:a})=>{const r=t||Ht(e.length),[n,i]=l.useState(r),o=t=>{if(!a||0===e.length)return;const{endIndex:r,startIndex:n}=Ut(t,e.length),i=e.slice(n,r+1);a(i)};return l.useEffect(()=>{o(n)},[]),{currentRange:n,handleRangeChange:e=>{i(e),o(e)}}},Gt=e=>({keyboardFastStep:e?.keyboardFastStep??2,keyboardStep:e?.keyboardStep??1,minHandlerDistance:e?.minHandlerDistance??1}),Zt=e=>{if(0===e.length)return"";if(1===e.length)return`M ${e[0][0]} ${e[0][1]}`;const[t,...a]=e;let r=`M ${t[0]} ${t[1]}`;return a.forEach((e,n)=>{const i=0===n?t:a[n-1],[o,s]=i,[c,d]=e,l=.3*(c-o),u=[o+l,s],h=[c-l,d];r+=` C ${u[0]} ${u[1]}, ${h[0]} ${h[1]}, ${c} ${d}`}),r},qt=(e,t,a,r)=>{if(0===e.length||0===t.length)return[];const n=.05*r,i=r-2*n,o=t.flatMap(t=>e.map(e=>Number(e[t.yKey]))),s=Math.min(...o),c=Math.max(...o)-s||1;return t.map(t=>{const o=e.map((r,o)=>[o/Math.max(1,e.length-1)*a,n+i-(Number(r[t.yKey])-s)/c*i]),d=t.curved?Zt(o):`M ${o.map(([e,t])=>`${e},${t}`).join(" L ")}`;let l="";return t.fill&&(l=t.curved?`${Zt(o)} L ${a} ${r} L 0 ${r} Z`:`${d} L ${a},${r} L 0,${r} Z`),{config:t,fillPath:l,linePath:d}})},Jt=(e,t,a)=>e[a]?.[t]?.toString()||`${a}`,Qt=(e,t,a)=>{if(!e)return e;const r=new RegExp("{{startValue}}","g"),n=new RegExp("{{endValue}}","g");return e.replace(r,t).replace(n,a)},ea=({ariaHidden:e,ariaLabel:t,backgroundColor:a,canvasConfig:r,caption:n,classNames:i,data:o,focusConfig:s,handlerConfig:c,height:h="40px",initialRange:p,interactionConfig:f,lines:R,onDataChange:g,role:A,screenReaderTextConfig:_,selectionConfig:T,width:E="100%",xKey:y,...v})=>{const m="zoom-area",C=Gt(f),S=(I=T,{fill:I?.fill??"#0078d4",fillOpacity:I?.fillOpacity??.5,hideOverlayOnFullRange:I?.hideOverlayOnFullRange??true,stroke:I?.stroke??"#0078d4",strokeWidth:I?.strokeWidth??0});var I;const $=(e=>({gap:e?.gap??Nt.OUTLINES_GAP,innerColor:e?.innerColor??Nt.FOCUS_INNER,innerStrokeWidth:e?.innerStrokeWidth??Nt.INNER_FOCUS_STROKE_WIDTH,outlineColor:e?.outlineColor??Nt.FOCUS_COLOR,outlineStrokeWidth:e?.outlineStrokeWidth??Nt.OUTER_FOCUS_STROKE_WIDTH}))(s),{currentRange:N,handleRangeChange:k}=zt({data:o,initialRange:p,onDataChange:g}),{parsedCanvas:L,viewBox:b}=Wt({canvasConfig:r,dataTestId:m,height:h,width:E}),O=x(o),H=JSON.stringify(R),w=((e,t,a,r)=>{const{endIndex:n,startIndex:i}=Ut(a,e.length),o=Jt(e,t,i),s=Jt(e,t,n),c=Qt(r?.startHandler,o,s)??o;return{endHandler:Qt(r?.endHandler,o,s)??s,selectionArea:Qt(r?.selectionArea,o,s)??`${o} - ${s}`,startHandler:c}})(o,y,N,_),j=l.useMemo(()=>qt(o,R,L.width,L.height),[O,H,L.width,L.height]),{endX:B,startX:D}=l.useMemo(()=>Lt(N,o.length,L.width),[N,O,L.width]),{handleBlur:M,handleFocus:P,isFocused:X}=Vt(),{handleKeyDown:F}=Ft({currentRange:N,dataLength:o.length,interactionConfig:C,onRangeChange:k}),{groupRef:W,handleMouseDown:V,handleTouchStart:Y}=Xt({currentRange:N,dataLength:o.length,interactionConfig:C,onRangeChange:k,width:L.width});return d.jsxs(u,{ref:W,ariaHidden:e,ariaLabel:t,backgroundColor:a,caption:n,className:i,"data-testid":m,height:h,overflow:"visible",role:A,viewBox:b,width:E,...v,children:[d.jsx($t,{linesData:j}),d.jsx(Bt,{currentRange:N,dataLength:o.length,dataTestId:`${m}-selection-area`,endX:B,height:L.height,screenReaderText:w.selectionArea,selectionConfig:S,startX:D,onBlur:M,onFocus:P(Pt.SELECTION_AREA),onKeyDown:F(Pt.SELECTION_AREA),onMouseDown:V(Pt.SELECTION_AREA),onTouchStart:Y(Pt.SELECTION_AREA)}),d.jsx(Mt,{dataTestId:`${m}-start-handler`,focusConfig:$,handlerConfig:c,height:L.height,isFocused:X(Pt.START_HANDLER),max:N.end-C.minHandlerDistance,min:0,screenReaderText:w.startHandler,type:Pt.START_HANDLER,value:N.start,x:D,onBlur:M,onFocus:P(Pt.START_HANDLER),onKeyDown:F(Pt.START_HANDLER),onMouseDown:V(Pt.START_HANDLER),onTouchStart:Y(Pt.START_HANDLER)}),d.jsx(Mt,{dataTestId:`${m}-end-handler`,focusConfig:$,handlerConfig:c,height:L.height,isFocused:X(Pt.END_HANDLER),max:o.length-1,min:N.start+C.minHandlerDistance,screenReaderText:w.endHandler,type:Pt.END_HANDLER,value:N.end,x:B,onBlur:M,onFocus:P(Pt.END_HANDLER),onKeyDown:F(Pt.END_HANDLER),onMouseDown:V(Pt.END_HANDLER),onTouchStart:Y(Pt.END_HANDLER)}),d.jsx(jt,{endX:B,focusConfig:$,height:L.height,isFocused:X(Pt.SELECTION_AREA),startX:D})]})};export{ye as Bar,Ue as BarChart,E as BarOrientation,Le as ChartText,p as DefaultCanvasConfig,y as ErrorType,Nt as FOCUS_DEFAULT,_t as ForeignObject,It as HandlerIcon,ke as Line,At as LineChart,$t as LineRenderer,Ae as Node,Re as NodeType,Te as Path,St as PieChart,m as Positions,Bt as SelectionArea,jt as SelectionAreaFocusRing,u as SvgContainer,be as Tick,rt as TickDataUtils,we as XAxis,Me as YAxis,ea as ZoomArea,Pt as ZoomAreaElements,Mt as ZoomHandler,Lt as calculateHandlerPositions,qt as calculateLinesPathData,Ot as clampRange,Ht as createDefaultRange,Zt as generateCurvedPath,Gt as getInteractionConfig,wt as isFullRange,bt as mouseToDataIndex,v as normalizeToArray,Xt as useDragInteraction,Ft as useKeyboardNavigation,Wt as useResponsiveCanvas,Vt as useZoomAreaFocus,zt as useZoomData};
|