@kubit-ui-web/react-charts 1.6.0 → 1.7.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/dist/cjs/charts/lineChart/context/buildLineContextValue.d.ts +1 -3
- package/dist/cjs/charts/lineChart/context/buildLineContextValue.d.ts.map +1 -1
- package/dist/cjs/charts/lineChart/context/buildLineContextValue.js +64 -128
- package/dist/cjs/charts/lineChart/fragments/fixture/contextData.d.ts +2 -43
- package/dist/cjs/charts/lineChart/fragments/fixture/contextData.d.ts.map +1 -1
- package/dist/cjs/charts/lineChart/fragments/fixture/contextData.js +8 -6
- package/dist/cjs/charts/lineChart/fragments/lineChartPath.js +3 -3
- package/dist/cjs/charts/lineChart/fragments/lineChartXAxis.d.ts.map +1 -1
- package/dist/cjs/charts/lineChart/fragments/lineChartXAxis.js +3 -8
- package/dist/cjs/charts/lineChart/fragments/lineChartYAxis.d.ts.map +1 -1
- package/dist/cjs/charts/lineChart/fragments/lineChartYAxis.js +9 -9
- package/dist/cjs/charts/lineChart/lineChart.type.d.ts +12 -7
- package/dist/cjs/charts/lineChart/lineChart.type.d.ts.map +1 -1
- package/dist/cjs/charts/lineChart/lineChartStructure.js +11 -10
- package/dist/cjs/charts/lineChart/utils/getCoordinates.d.ts +25 -0
- package/dist/cjs/charts/lineChart/utils/getCoordinates.d.ts.map +1 -0
- package/dist/cjs/charts/lineChart/utils/getCoordinates.js +55 -0
- package/dist/cjs/charts/lineChart/utils/getExtraSpacing.d.ts +1 -3
- package/dist/cjs/charts/lineChart/utils/getExtraSpacing.d.ts.map +1 -1
- package/dist/cjs/charts/lineChart/utils/getExtraSpacing.js +68 -51
- package/dist/cjs/charts/lineChart/utils/getTicks.d.ts +21 -0
- package/dist/cjs/charts/lineChart/utils/getTicks.d.ts.map +1 -0
- package/dist/cjs/charts/lineChart/utils/getTicks.js +36 -0
- package/dist/cjs/charts/lineChart/utils/handleNodesFocus.d.ts.map +1 -1
- package/dist/cjs/charts/lineChart/utils/handleNodesFocus.js +14 -25
- package/dist/cjs/charts/lineChart/utils/tickTextPosition.d.ts +33 -0
- package/dist/cjs/charts/lineChart/utils/tickTextPosition.d.ts.map +1 -0
- package/dist/cjs/charts/lineChart/utils/tickTextPosition.js +109 -0
- package/dist/cjs/charts/lineChart/utils/validations.d.ts +54 -0
- package/dist/cjs/charts/lineChart/utils/validations.d.ts.map +1 -0
- package/dist/cjs/charts/lineChart/utils/validations.js +117 -0
- package/dist/cjs/components/chartText/chartText.d.ts.map +1 -1
- package/dist/cjs/components/chartText/chartText.js +2 -2
- package/dist/cjs/components/line/line.d.ts.map +1 -1
- package/dist/cjs/components/line/line.js +2 -2
- package/dist/cjs/components/line/line.types.d.ts +2 -0
- package/dist/cjs/components/line/line.types.d.ts.map +1 -1
- package/dist/cjs/components/node/node.d.ts.map +1 -1
- package/dist/cjs/components/node/node.js +1 -1
- package/dist/cjs/components/node/node.types.d.ts +2 -0
- package/dist/cjs/components/node/node.types.d.ts.map +1 -1
- package/dist/cjs/components/path/path.js +1 -1
- package/dist/cjs/utils/pickCustomAttributes/pickCustomAttributes.d.ts +7 -6
- package/dist/cjs/utils/pickCustomAttributes/pickCustomAttributes.d.ts.map +1 -1
- package/dist/cjs/utils/pickCustomAttributes/pickCustomAttributes.js +8 -7
- package/dist/esm/charts/lineChart/context/buildLineContextValue.d.ts +1 -3
- package/dist/esm/charts/lineChart/context/buildLineContextValue.d.ts.map +1 -1
- package/dist/esm/charts/lineChart/context/buildLineContextValue.js +64 -128
- package/dist/esm/charts/lineChart/fragments/fixture/contextData.d.ts +2 -43
- package/dist/esm/charts/lineChart/fragments/fixture/contextData.d.ts.map +1 -1
- package/dist/esm/charts/lineChart/fragments/fixture/contextData.js +8 -6
- package/dist/esm/charts/lineChart/fragments/lineChartPath.js +3 -3
- package/dist/esm/charts/lineChart/fragments/lineChartXAxis.d.ts.map +1 -1
- package/dist/esm/charts/lineChart/fragments/lineChartXAxis.js +3 -8
- package/dist/esm/charts/lineChart/fragments/lineChartYAxis.d.ts.map +1 -1
- package/dist/esm/charts/lineChart/fragments/lineChartYAxis.js +9 -9
- package/dist/esm/charts/lineChart/lineChart.type.d.ts +12 -7
- package/dist/esm/charts/lineChart/lineChart.type.d.ts.map +1 -1
- package/dist/esm/charts/lineChart/lineChartStructure.js +11 -10
- package/dist/esm/charts/lineChart/utils/getCoordinates.d.ts +25 -0
- package/dist/esm/charts/lineChart/utils/getCoordinates.d.ts.map +1 -0
- package/dist/esm/charts/lineChart/utils/getCoordinates.js +55 -0
- package/dist/esm/charts/lineChart/utils/getExtraSpacing.d.ts +1 -3
- package/dist/esm/charts/lineChart/utils/getExtraSpacing.d.ts.map +1 -1
- package/dist/esm/charts/lineChart/utils/getExtraSpacing.js +68 -51
- package/dist/esm/charts/lineChart/utils/getTicks.d.ts +21 -0
- package/dist/esm/charts/lineChart/utils/getTicks.d.ts.map +1 -0
- package/dist/esm/charts/lineChart/utils/getTicks.js +36 -0
- package/dist/esm/charts/lineChart/utils/handleNodesFocus.d.ts.map +1 -1
- package/dist/esm/charts/lineChart/utils/handleNodesFocus.js +14 -25
- package/dist/esm/charts/lineChart/utils/tickTextPosition.d.ts +33 -0
- package/dist/esm/charts/lineChart/utils/tickTextPosition.d.ts.map +1 -0
- package/dist/esm/charts/lineChart/utils/tickTextPosition.js +109 -0
- package/dist/esm/charts/lineChart/utils/validations.d.ts +54 -0
- package/dist/esm/charts/lineChart/utils/validations.d.ts.map +1 -0
- package/dist/esm/charts/lineChart/utils/validations.js +117 -0
- package/dist/esm/components/chartText/chartText.d.ts.map +1 -1
- package/dist/esm/components/chartText/chartText.js +2 -2
- package/dist/esm/components/line/line.d.ts.map +1 -1
- package/dist/esm/components/line/line.js +2 -2
- package/dist/esm/components/line/line.types.d.ts +2 -0
- package/dist/esm/components/line/line.types.d.ts.map +1 -1
- package/dist/esm/components/node/node.d.ts.map +1 -1
- package/dist/esm/components/node/node.js +1 -1
- package/dist/esm/components/node/node.types.d.ts +2 -0
- package/dist/esm/components/node/node.types.d.ts.map +1 -1
- package/dist/esm/components/path/path.js +1 -1
- package/dist/esm/utils/pickCustomAttributes/pickCustomAttributes.d.ts +7 -6
- package/dist/esm/utils/pickCustomAttributes/pickCustomAttributes.d.ts.map +1 -1
- package/dist/esm/utils/pickCustomAttributes/pickCustomAttributes.js +8 -7
- 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/charts/lineChart/context/buildLineContextValue.d.ts +1 -3
- package/dist/types/charts/lineChart/context/buildLineContextValue.d.ts.map +1 -1
- package/dist/types/charts/lineChart/fragments/fixture/contextData.d.ts +2 -43
- package/dist/types/charts/lineChart/fragments/fixture/contextData.d.ts.map +1 -1
- package/dist/types/charts/lineChart/fragments/lineChartXAxis.d.ts.map +1 -1
- package/dist/types/charts/lineChart/fragments/lineChartYAxis.d.ts.map +1 -1
- package/dist/types/charts/lineChart/lineChart.type.d.ts +12 -7
- package/dist/types/charts/lineChart/lineChart.type.d.ts.map +1 -1
- package/dist/types/charts/lineChart/utils/getCoordinates.d.ts +25 -0
- package/dist/types/charts/lineChart/utils/getCoordinates.d.ts.map +1 -0
- package/dist/types/charts/lineChart/utils/getExtraSpacing.d.ts +1 -3
- package/dist/types/charts/lineChart/utils/getExtraSpacing.d.ts.map +1 -1
- package/dist/types/charts/lineChart/utils/getTicks.d.ts +21 -0
- package/dist/types/charts/lineChart/utils/getTicks.d.ts.map +1 -0
- package/dist/types/charts/lineChart/utils/handleNodesFocus.d.ts.map +1 -1
- package/dist/types/charts/lineChart/utils/tickTextPosition.d.ts +33 -0
- package/dist/types/charts/lineChart/utils/tickTextPosition.d.ts.map +1 -0
- package/dist/types/charts/lineChart/utils/validations.d.ts +54 -0
- package/dist/types/charts/lineChart/utils/validations.d.ts.map +1 -0
- package/dist/types/components/chartText/chartText.d.ts.map +1 -1
- package/dist/types/components/line/line.d.ts.map +1 -1
- package/dist/types/components/line/line.types.d.ts +2 -0
- package/dist/types/components/line/line.types.d.ts.map +1 -1
- package/dist/types/components/node/node.d.ts.map +1 -1
- package/dist/types/components/node/node.types.d.ts +2 -0
- package/dist/types/components/node/node.types.d.ts.map +1 -1
- package/dist/types/utils/pickCustomAttributes/pickCustomAttributes.d.ts +7 -6
- package/dist/types/utils/pickCustomAttributes/pickCustomAttributes.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e,t,r,a,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"),r=Symbol.for("react.portal"),a=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"),u=Symbol.for("react.suspense"),l=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,r){this.props=e,this.context=t,this.refs=R,this.updater=r||f}function _(){}function A(e,t,r){this.props=e,this.context=t,this.refs=R,this.updater=r||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")},_.prototype=g.prototype;var E=A.prototype=new _;E.constructor=A,x(E,g.prototype),E.isPureReactComponent=!0;var T=Array.isArray,v=Object.prototype.hasOwnProperty,y={current:null},m={key:!0,ref:!0,__self:!0,__source:!0};function C(e,r,a){var n,i={},o=null,s=null;if(null!=r)for(n in void 0!==r.ref&&(s=r.ref),void 0!==r.key&&(o=""+r.key),r)v.call(r,n)&&!m.hasOwnProperty(n)&&(i[n]=r[n]);var c=arguments.length-2;if(1===c)i.children=a;else if(1<c){for(var d=Array(c),u=0;u<c;u++)d[u]=arguments[u+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:y.current}}function S(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}var I=/\/+/g;function N(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 $(e,a,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 r:c=!0}}if(c)return o=o(c=e),e=""===i?"."+N(c,0):i,T(o)?(n="",null!=e&&(n=e.replace(I,"$&/")+"/"),$(o,a,n,"",function(e){return e})):null!=o&&(S(o)&&(o=function(e,r){return{$$typeof:t,type:e.type,key:r,ref:e.ref,props:e.props,_owner:e._owner}}(o,n+(!o.key||c&&c.key===o.key?"":(""+o.key).replace(I,"$&/")+"/")+e)),a.push(o)),1;if(c=0,i=""===i?".":i+":",T(e))for(var d=0;d<e.length;d++){var u=i+N(s=e[d],d);c+=$(s,a,n,u,o)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),d=0;!(s=e.next()).done;)c+=$(s=s.value,a,n,u=i+N(s,d++),o);else if("object"===s)throw a=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===a?"object with keys {"+Object.keys(e).join(", ")+"}":a)+"). If you meant to render a collection of children, use an array instead.");return c}function b(e,t,r){if(null==e)return e;var a=[],n=0;return $(e,a,"","",function(e){return t.call(r,e,n++)}),a}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 k={current:null},O={transition:null},H={ReactCurrentDispatcher:k,ReactCurrentBatchConfig:O,ReactCurrentOwner:y};function w(){throw Error("act(...) is not supported in production builds of React.")}return s.Children={map:b,forEach:function(e,t,r){b(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return b(e,function(){t++}),t},toArray:function(e){return b(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=a,s.Profiler=i,s.PureComponent=A,s.StrictMode=n,s.Suspense=u,s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=H,s.act=w,s.cloneElement=function(e,r,a){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!=r){if(void 0!==r.ref&&(o=r.ref,s=y.current),void 0!==r.key&&(i=""+r.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(d in r)v.call(r,d)&&!m.hasOwnProperty(d)&&(n[d]=void 0===r[d]&&void 0!==c?c[d]:r[d])}var d=arguments.length-2;if(1===d)n.children=a;else if(1<d){c=Array(d);for(var u=0;u<d;u++)c[u]=arguments[u+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:l,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 k.current.useCallback(e,t)},s.useContext=function(e){return k.current.useContext(e)},s.useDebugValue=function(){},s.useDeferredValue=function(e){return k.current.useDeferredValue(e)},s.useEffect=function(e,t){return k.current.useEffect(e,t)},s.useId=function(){return k.current.useId()},s.useImperativeHandle=function(e,t,r){return k.current.useImperativeHandle(e,t,r)},s.useInsertionEffect=function(e,t){return k.current.useInsertionEffect(e,t)},s.useLayoutEffect=function(e,t){return k.current.useLayoutEffect(e,t)},s.useMemo=function(e,t){return k.current.useMemo(e,t)},s.useReducer=function(e,t,r){return k.current.useReducer(e,t,r)},s.useRef=function(e){return k.current.useRef(e)},s.useState=function(e){return k.current.useState(e)},s.useSyncExternalStore=function(e,t,r){return k.current.useSyncExternalStore(e,t,r)},s.useTransition=function(){return k.current.useTransition()},s.version="18.3.1",s}()),o.exports}var d=(a||(a=1,n.exports=function(){if(r)return i;r=1;var e=c(),t=Symbol.for("react.element"),a=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,r,a){var i,c={},d=null,u=null;for(i in void 0!==a&&(d=""+a),void 0!==r.key&&(d=""+r.key),void 0!==r.ref&&(u=r.ref),r)n.call(r,i)&&!s.hasOwnProperty(i)&&(c[i]=r[i]);if(e&&e.defaultProps)for(i in r=e.defaultProps)void 0===c[i]&&(c[i]=r[i]);return{$$typeof:t,type:e,key:d,ref:u,props:c,_owner:o.current}}return i.Fragment=a,i.jsx=d,i.jsxs=d,i}()),n.exports),u=c();const l=u.forwardRef(({ariaHidden:e,ariaLabel:t,backgroundColor:r,caption:a,children:n,className:i,dataTestId:o,height:s,imageSrc:c,overflow:u,radius:l="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:r,borderRadius:l,overflow:u},tabIndex:p,viewBox:f,width:x,onMouseDown:e=>e.preventDefault(),...R,children:[a&&d.jsx("title",{children:a}),c&&d.jsx("image",{height:s,href:c,width:x,x:"0",y:"0"}),n]})),h=(e,t,r=0)=>`${-r} ${-r} ${e} ${t}`,p={extraSpace:0,height:80,width:100},f=e=>{const t=new Map,r=()=>{const e={};return t.forEach((t,r)=>{e[r]=t}),e};return{addError:(a,n)=>{if(!n)return;const i={...n,type:a},o=t.get(a)||[];if(o.push(i),t.set(a,o),e){const t=r(),a={};Object.entries(t).forEach(([e,t])=>{const r=e;Array.isArray(t)&&t.length,a[r]=t}),e(a)}},clearErrors:()=>{t.clear(),e&&e({})},getAccumulatedErrors:r}},x=e=>JSON.stringify(e),R="%",g="rem",_=/^(\d+(\.\d+)?)(px|rem|%)?$/,A=e=>{if("number"==typeof e)return e;const t=e.match(_);if(!t)throw new Error(`Invalid string format: "${e}"`);const r=t[1];return t[3]===g?16*parseFloat(r):parseFloat(r)},E=u.createContext({}),T={HORIZONTAL:"HORIZONTAL",VERTICAL:"VERTICAL"},v={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",PIE_CHART_CONTEXT_ERROR:"PIE_CHART_CONTEXT_ERROR",PIE_CHART_PATH_ERROR:"PIE_CHART_PATH_ERROR",PIE_CHART_SEGMENT_ERROR:"PIE_CHART_SEGMENT_ERROR"},y={BOTTOM:"BOTTOM",CENTER:"CENTER",CUSTOM:"CUSTOM",LEFT:"LEFT",RIGHT:"RIGHT",TOP:"TOP"},m=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,r])=>(e[t]=new Error(r),e),{}),C=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,r])=>(e[t]=new Error(r),e),{}),S=Object.entries({PIE_CHART_EMPTY_DATA:"PieChart data is empty or undefined",PIE_CHART_INNER_RADIUS_OUT_OF_RANGE:"Inner radius must be less than radius",PIE_CHART_INVALID_CANVAS_DIMENSIONS:"Invalid canvas dimensions for PieChart",PIE_CHART_INVALID_DATA_KEY:"Invalid or missing dataKey in PieChart data",PIE_CHART_INVALID_INNER_RADIUS:"Invalid innerRadius value",PIE_CHART_INVALID_RADIUS:"Invalid radius value",PIE_CHART_INVALID_SEGMENT_VALUE:"Invalid segment value (non-numeric)",PIE_CHART_INVALID_TOTAL:"PieChart total value is zero or invalid",PIE_CHART_MISSING_SEGMENT_NAME:"Segment is missing required name property",PIE_CHART_NEGATIVE_SEGMENT_VALUE:"Segment value cannot be negative"}).reduce((e,[t,r])=>(e[t]=new Error(r),e),{}),I=(e,t)=>new Error(`Invalid value "${e}" for bar with dataKey "${t}". Must be a valid number.`),N=(e,t)=>new Error(`Negative value ${e} not allowed for bar with dataKey "${t}" in current configuration`),$=(e,t)=>new Error(`Invalid segment value for "${t}": "${e}" is not a valid number`),b=(e,t)=>new Error(`Negative segment value for "${t}": ${e} (values must be >= 0)`),L=e=>new Error(`DataKey "${e}" not found in PieChart dataset`),k=e=>new Error(`Data array for key "${e}" is empty`),O=(e,t)=>new Error(`Invalid total value for "${e}": ${t} (must be > 0)`),H=(e,t,r)=>new Error(`Invalid group at index ${t} in "${e}": missing required property "${r}"`),w=e=>new Error(`Invalid radius value: "${e}" (must be a positive number)`),P=e=>new Error(`Invalid innerRadius value: "${e}" (must be a positive number or zero)`),j=(e,t)=>new Error(`innerRadius (${e}) must be less than radius (${t}) for donut chart rendering`),D="INVALID_X_TICK",B="BAR_CHART_NO_DATA",M="LINE_CHART_NO_DATA",X="LINE_CHART_PATH_ALL_VALUES_NULL",F="LINE_CHART_PATH_INSUFFICIENT_POINTS",V="LINE_CHART_PATH_INVALID_DATAKEY",W="LINE_CHART_SEPARATOR_INVALID_COORDINATES",Y="LINE_CHART_SINGLE_POINT",K="LINE_CHART_X_AXIS_IDENTICAL_VALUES",U="LINE_CHART_X_AXIS_INSUFFICIENT_TICKS",G="LINE_CHART_X_AXIS_ZERO_LENGTH",z="LINE_CHART_Y_AXIS_IDENTICAL_VALUES",Z="LINE_CHART_Y_AXIS_INSUFFICIENT_TICKS",q="LINE_CHART_Y_AXIS_ZERO_LENGTH",J={...m,...C,...S,INVALID_X_TICK:new Error("[getXTicks] Invalid X tick values calculated")},Q=e=>J[e],ee=e=>new Error(`DataKey "${e}" not found in dataset`),te=(e,t)=>new Error(`Canvas dimensions validation failed: width=${e}, height=${t} (both must be > 0)`),re=e=>new Error(`Invalid xBreakAxis value: '${e}' cannot be parsed as number`),ae=e=>new Error(`Invalid yBreakAxis value: '${e}' cannot be parsed as number`),ne=(e,t,r)=>new Error(`xBreakAxis value ${e} is outside data range (${t} - ${r})`),ie=(e,t,r)=>new Error(`yBreakAxis value ${e} is outside data range (${t} - ${r})`),oe=({canvasHeight:e,canvasWidth:t,customBreakAxis:r,extraSpaceBottomY:a,extraSpaceLeftX:n,extraSpaceRightX:i,extraSpaceTopY:o,position:s})=>s===y.TOP?{x1:n,x2:t-i,y1:o,y2:o}:s===y.CENTER?{x1:n,x2:t-i,y1:e/2,y2:e/2}:s===y.CUSTOM?{x1:n,x2:t-i,y1:r,y2:r}:{x1:n,x2:t-i,y1:e-a,y2:e-a},se=({canvasHeight:e,canvasWidth:t,customBreakAxis:r,extraSpaceBottomY:a,extraSpaceLeftX:n,extraSpaceRightX:i,extraSpaceTopY:o,position:s})=>s===y.RIGHT?{x1:t-i,x2:t-i,y1:o,y2:e-a}:s===y.CENTER?{x1:t/2,x2:t/2,y1:o,y2:e-a}:s===y.CUSTOM?{x1:r,x2:r,y1:o,y2:e-a}:{x1:n,x2:n,y1:o,y2:e-a},ce=(e,t,r)=>t.map(t=>{if(isNaN(Number(t))){const r=e.find(e=>String(e.value)===String(t));return r?r.position:0}const{index:a,tick:n}=e.reduce((e,r,a)=>Math.abs(Number(r.value)-Number(t))<=Math.abs(Number(e.tick.value)-Number(t))?{index:a,tick:r}: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),u=i>o,l=u?e[a+1]:e[a-1],h=100*d/Math.abs(Number(l.value)-o),p=Math.abs(n.position-l.position)*h/100;return r?u?n.position+p:n.position-p:u?n.position-p:n.position+p}return n.position}),de=({initPos:e,maxSpaceAvailable:t,otherAxisSpace:r,securitySpace:a,tickValues:n})=>{const i=n.length-1,o=(t-r-a)/i;return n.map((t,r)=>({position:e+r*o+a/2,value:t}))},ue=({initPos:e,maxSpaceAvailable:t,needAjusted:r,otherAxisSpace:a,securitySpace:n,tickValues:i})=>{const o=(t-a-n)/(i.length-1),s=r?n/2:0;return i.map((t,r)=>({position:e-r*o-s,value:t}))},le="0",he="1",pe="fallbackData";(()=>{if("undefined"!=typeof globalThis&&"process"in globalThis){const e=globalThis.process;return"production"===e?.env?.NODE_ENV}})();const fe=e=>e?Object.entries(e).reduce((e,[t,r])=>((t.startsWith("aria-")||t.startsWith("data-"))&&null!=r&&(e[t]=String(r)),e),{}):{},xe=({height:e="140%",width:t="140%",x:r="-20%",y:a="-20%",...n})=>d.jsx("defs",{children:d.jsx("filter",{height:e,id:n.id,width:t,x:r,y:a,children:d.jsx("feDropShadow",{...n.shadowSvgConfig})})}),Re=-1/0,ge=u.forwardRef(({dataTestId:e,position:t,size:r=1,...a},n)=>d.jsx("circle",{...a,ref:n,cx:t?.x,cy:t?.y,"data-testid":`${e}-circle`,r:r/2})),_e=(e,t,r,a,n)=>{let i="";const o=a===n,s=o?r:2*r;for(let r=0;r<s;r++){const c=o||r%2==0?a:n,d=2*Math.PI/s*r-Math.PI/2;i+=`${e+Math.cos(d)*c},${t+Math.sin(d)*c} `}return i.trim()},Ae=u.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=_e(t.x,t.y,6,r/2,r/2);return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-hexagon`,points:i})}),Ee=u.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=_e(t.x,t.y,5,r/2,r/2);return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-pentagon`,points:i})}),Te=u.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>d.jsx("rect",{...a,ref:n,"data-testid":`${e}-square`,height:r,width:r,x:t.x-r/2,y:t.y-r/2})),ve=u.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=r/2,o=i/2,s=_e(t.x,t.y,5,i,o);return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-star`,points:s})}),ye=u.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=`M ${t.x-r/2} ${t.y} H ${t.x+r/2} M ${t.x} ${t.y-r/2} V ${t.y+r/2}`;return d.jsx("path",{...a,ref:n,d:i,"data-testid":`${e}-straight`,strokeWidth:2})}),me=u.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=[`${t.x},${t.y-r/2}`,`${t.x-r/2},${t.y+r/2}`,`${t.x+r/2},${t.y+r/2}`].join(" ");return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-triangle`,points:i})}),Ce={Circle:"circle",Hexagon:"hexagon",Pentagon:"pentagon",Square:"square",Star:"star",Straight:"straight",Triangle:"triangle"},Se={[Ce.Circle]:ge,[Ce.Hexagon]:Ae,[Ce.Pentagon]:Ee,[Ce.Square]:Te,[Ce.Star]:ve,[Ce.Straight]:ye,[Ce.Triangle]:me},Ie=u.forwardRef(({dataTestId:e="node",haloConfig:t,hasHalo:r=!1,onBlur:a,onClick:n,onDoubleClick:i,onFocus:o,onKeyDown:s,onMouseEnter:c,onMouseLeave:l,position:h={x:0,y:0},size:p=1,type:f=Ce.Circle,...x},R)=>{const[g,_]=(e=>{const t=u.useRef(!1),r=u.useRef(null);u.useImperativeHandle(e,()=>r.current,[]);const a=e=>{t.current=!!e.autoClick};return u.useEffect(()=>{if(!r.current)return;const e=r.current;return e.addEventListener("click",a),()=>e.removeEventListener("click",a)},[]),[r,t]})(R),A={...x,className:`node ${x.className}`,onBlur:e=>{a?.(e)},onClick:e=>{n?.(e,{...x.data,nodePosition:h},_.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=>{l?.(e)}},E={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},T=Se[f];return d.jsxs(d.Fragment,{children:[r&&d.jsx(T,{...E,"aria-hidden":"true",dataTestId:`${e}-halo`,position:h,size:p+p/2,tabIndex:-1}),d.jsx(T,{...A,ref:g,dataTestId:e,position:h,size:p})]})}),Ne=u.forwardRef(({data:e,nodeConfig:t,tabIndex:r=0,x:a,y:n},i)=>{const o=t?fe(t):{};if(o["aria-label"]&&e&&"string"==typeof o["aria-label"]){const t=o["aria-label"];if(t.includes("{{")){const r=((e,t,r)=>{if(!e)return;const a=r??t.dataValue,n=Array.isArray(a)?a[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,r,a)=>{let n=e;return void 0!==t.dataKey&&(n=n.replace(new RegExp("{{dataKey}}","g"),t.dataKey)),n=n.replace(new RegExp("{{xValue}}","g"),r),n=n.replace(new RegExp("{{yValue}}","g"),a),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);r&&(o["aria-label"]=r)}}return d.jsx(d.Fragment,{children:t&&d.jsx(Ie,{...t,ref:i,...o,className:"node-path-focus-border",data:e,hasHalo:t.hasHalo,position:{x:a,y:n},tabIndex:r})})}),$e=u.forwardRef(({classNames:e="",fill:t="transparent",stroke:r="#0000FF",strokeWidth:a="1",focusConfig:n={stroke:"#0000FF",strokeWidth:"0.5"},hoverConfig:i={stroke:"#0000FF",strokeWidth:"0.5"},role:o="img",...s},c)=>{const{handleBlur:l,handleFocus:h,isFocused:p}=((e,t)=>{const[r,a]=u.useState(!1),n=u.useCallback(t=>{a(!0),e?.(t)},[e]);return{handleBlur:u.useCallback(e=>{a(!1),t?.(e)},[t]),handleFocus:n,isFocused:r}})(s.onFocus,s.onBlur),{handleMouseEnter:f,handleMouseLeave:x,isHovered:R}=((e,t)=>{const[r,a]=u.useState(!1);return{handleMouseEnter:u.useCallback(t=>{a(!0),e?.(t)},[e]),handleMouseLeave:u.useCallback(e=>{a(!1),t?.(e)},[t]),isHovered:r}})(s.onMouseEnter,s.onMouseLeave),g=u.useRef(null),_=u.useRef([]),A=u.useRef(null);u.useImperativeHandle(c,()=>({get main(){return A.current},get node(){return _.current},get path(){return g.current}}));const E=s.gradient&&((e,t="gradientePath")=>{const r=e.split(",").map(e=>e.trim()),a=parseInt(r[0],10),n=r.slice(1).map(e=>{const[t,r]=e.split(" ");return{color:t,offset:r}});let i="0%",o="0%",s="0%";switch(a){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),T=fe(s),v={...{...s,classNames:`path ${e}`,fill:E?"url(#gradientePath)":t,filter:"url(#shadow)",role:o,stroke:r,strokeWidth:a},...p&&n,...R&&i};return d.jsxs("g",{ref:A,tabIndex:-1,children:[E&&E,v.shadowSvgConfig&&d.jsx(xe,{id:"shadow",shadowSvgConfig:v.shadowSvgConfig}),d.jsxs("g",{"aria-label":v.ariaLabel,className:v.classNames,"data-draw":!0,filter:v.shadowSvgConfig&&v.filter,opacity:v.opacity,orientation:v.orientation,role:v.role,rotate:v.rotate,tabIndex:v.tabIndex,transform:v.transform,visibility:v.visibility,...T,onBlur:l,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:v.d,"data-testid":v.dataTestId,fill:v.dFill?"transparent":v.fill,fillOpacity:v.fillOpacity,fillRule:v.fillRule,stroke:v.stroke,strokeDasharray:v.strokeDasharray,strokeDashoffset:v.strokeDashoffset,strokeLinecap:v.strokeLinecap,strokeLinejoin:v.strokeLinejoin,strokeMiterlimit:v.strokeMiterlimit,strokeOpacity:v.strokeOpacity,strokeWidth:v.strokeWidth,children:v.title&&d.jsx("title",{children:v.title})}),v.dFill&&d.jsx("path",{d:v.dFill,fill:v.fill,fillOpacity:v.fillOpacity,fillRule:v.fillRule})]}),v.points&&v.nodeConfig&&v.points.map(([e,t],r)=>{const a={dataKey:v.dataKey,dataValue:v.dataValue,index:r,xKey:v?.xKey};return d.jsx(Ne,{ref:e=>_.current[r]=e,data:a,nodeConfig:v.nodeConfig,tabIndex:-1,x:e,y:t},`${r.toString()}`)})]})}),be=(e,t,r)=>e?t+r/2:t-r/2,Le=({barConfig:e,currentBars:t,endRounded:r,extraSpacing:a=0,order:n=1,orientation:i,startRounded:o,x1:s,x2:c,y1:u,y2:l})=>{const{barWidth:h,singleConfig:p}=e,f=(({barConfig:e,orientation:t,x1:r,x2:a,y1:n,y2:i})=>{const{gap:o=0,singleConfig:s}=e,c=t===T.HORIZONTAL,d=c?r:n,u=c?a:i,l={end:u<d,start:u>d};return s.reduce((e,t,r)=>{const{coverage:a}=t,n=((e,t)=>e/100*t)(a,u-d),i=0===r?d:be(l.start,e[r-1][1],o),c=r+1===s.length?u:be(l.end,i+n,o);return e.push([i,c]),e},[])})({barConfig:e,orientation:i,x1:s,x2:c,y1:u,y2:l});return d.jsx("g",{children:p.map((e,x)=>{const[R,g]="HORIZONTAL"===i?f[x]:[s,c],[_,A]="VERTICAL"===i?f[x]:[u,l],E=(({barWidth:e,currentBars:t,endRounded:r=0,extraSpacing:a,order:n,orientation:i,startRounded:o=0,x1:s,x2:c,y1:d,y2:u})=>{let l,h,p,f,x="Z";const R=(({barWidth:e,currentBars:t,extraSpacing:r,order:a,orientation:n})=>{const i=e/2,o=r/2,s=t%2==0,c=s?o:o+i,d=a-Math.ceil(t/2);let u=0;return 0===d?u=s?-o:i:d<0?u=n===T.HORIZONTAL?d*-c+e:d*c:d>0&&(u=n===T.HORIZONTAL?d*-c:d*c+e),u})({barWidth:e,currentBars:t,extraSpacing:a,order:n,orientation:i});if(i===T.HORIZONTAL){const t=s+o,a=c-r;o&&r?(l=`M ${t},${d+R}`,h=`L${a},${u+R}`,p=`Q${c+r} ${u+R-e/2}, ${a} ${u+R-e}`,f=`L${t},${d+R-e}`,x=`Q${s-o} ${d+R-e/2}, ${t} ${d+R}`):o?(l=`M ${t},${d+R}`,h=`L${c},${u+R}`,p=`L${c},${u+R-e}`,f=`L${t},${d+R-e}`,x=`Q${s-o} ${d+R-e/2}, ${t} ${d+R}`):r?(l=`M${s},${d+R}`,h=`L${a},${u+R}`,p=`Q${c+r} ${u+R-e/2}, ${a} ${u+R-e}`,f=`L${s},${d+R-e}`):(l=`M${s},${d+R}`,h=`L${c},${u+R}`,p=`L${c},${u+R-e}`,f=`L${s},${d+R-e}`)}else{const t=d-o,a=u+r;o&&r?(l=`M${s+R}, ${t}`,h=`L${c+R},${a}`,p=`Q${c+R-e/2} ${u-r}, ${c+R-e} ${a}`,f=`L${s+R-e},${t}`,x=`Q${s+R-e/2} ${d+o}, ${s+R} ${t}`):o?(l=`M${s+R}, ${t}`,h=`L${c+R},${u}`,p=`L${c+R-e},${u}`,f=`L${s+R-e},${t}`,x=`Q${s+R-e/2} ${d+o}, ${s+R} ${t}`):r?(l=`M${s+R},${d}`,h=`L${c+R},${a}`,p=`Q${c+R-e/2} ${u-r}, ${c+R-e} ${a}`,f=`L${c+R-e},${d}`):(l=`M${s+R},${d}`,h=`L${c+R},${u}`,p=`L${c+R-e},${u}`,f=`L${s+R-e},${d}`)}return`${l} ${h} ${p} ${f} ${x}`})({barWidth:h,currentBars:t,endRounded:x===p.length-1&&r?r:void 0,extraSpacing:a,order:n,orientation:i,startRounded:0===x&&o?o:void 0,x1:R,x2:g,y1:_,y2:A});return d.jsx($e,{d:E,fill:e.color,hoverConfig:{stroke:"transparent",strokeWidth:"0"},stroke:"transparent",tabIndex:0,title:e.title},`${e.title}-${x.toString()}`)})})},ke=({barConfig:e,dataIdx:t,dataKey:r,order:a,...n})=>{const{addError:i,xAxisCoordinates:o,yAxisCoordinates:s,...c}=u.useContext(E),{coordinates:l,tickValues:h}=o,{coordinates:p,tickValues:f}=s,x=c.orientation===T.VERTICAL,R=x?c.pKey:r,g=x?r:c.pKey,_=c.data[t],A=_?.[R],v=_?.[g],y=c.data[0],m=!!y&&Object.prototype.hasOwnProperty.call(y,r),C=c.data.length>0,S=Number(v);u.useEffect(()=>{!C||m?isNaN(S)?i?.("BAR_CHART_PATH_ERROR",{error:I(v,r)}):S<0&&i?.("BAR_CHART_PATH_ERROR",{error:N(S,r)}):i?.("BAR_CHART_PATH_ERROR",{error:ee(r)})},[r,C,m,S,v]);const $=ce(h,[String(A)],!0)[0],b=ce(f,[String(v)])[0],L=x?{x1:$,x2:$,y1:l.y1,y2:b}:{x1:p.x1,x2:$,y1:b,y2:b};return d.jsx(Le,{barConfig:e,currentBars:c.barChildrenCount,extraSpacing:c.gapBetweenBars,order:a,orientation:c.orientation,...L,...n})},Oe=e=>{let t=0;return u.Children.toArray(e).forEach(e=>{u.isValidElement(e)&&e.type===ke&&e.props.order>t&&(t=e.props.order)}),t},He=e=>{if(0===e.length)return{numeric:{max:2,min:0,step:1}};const t=Math.min(...e.map(e=>parseFloat(e))),r=Math.max(...e.map(e=>parseFloat(e)));return{numeric:{max:r,min:t,step:Math.abs(r-t)/2}}},we=()=>"undefined"!=typeof window&&"undefined"!=typeof document,Pe=()=>we()?document:void 0,je=e=>{const t=Pe();if(t)return t.createElementNS("http://www.w3.org/2000/svg",e)},De=({bound:e,data:t,fontSize:r,svgHeight:a,svgWidth:n,viewBox:i})=>{if(!we()||!t.length)return 0;const o=Pe();if(!o)return 0;const s=je("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",a),o.body.appendChild(s);const c=t.map(t=>{const a=je("text");if(!a)return 0;a.setAttribute("font-size",r),a.textContent=t,s.appendChild(a);const n=a.getBBox()[e];return a.remove(),n});return s.remove(),Math.max(...c,0)},Be=({ariaLabel:e="",className:t="line",dataTestId:r,tabIndex:a=-1,...n})=>d.jsx("line",{...n,"aria-label":e,className:t,"data-testid":r,tabIndex:a}),Me=({children:e,className:t="circle",tabIndex:r=-1,...a})=>d.jsx("text",{className:t,tabIndex:r,...a,children:e}),Xe=({showTickLines:e,tick:t,tickLine:r,tickText:a})=>d.jsxs("g",{children:[e&&d.jsx(Be,{...r}),a&&d.jsx(Me,{...a,children:t.value})]}),Fe=(e,t,r=1)=>e>=t-r&&e<=t+r,Ve=e=>{const{ariaLabel:t,className:r,dataTestId:a,opacity:n,stroke:i,strokeDasharray:o,strokeDashoffset:s,strokeLinecap:c,strokeLinejoin:d,strokeOpacity:u,strokeWidth:l,style:h,tabIndex:p,transform:f,x1:x,x2:R,y1:g,y2:_}=e;return{ariaLabel:t,className:r,dataTestId:a,opacity:n,stroke:i,strokeDasharray:o,strokeDashoffset:s,strokeLinecap:c,strokeLinejoin:d,strokeOpacity:u,strokeWidth:l,style:h,tabIndex:p,transform:f,x1:x,x2:R,y1:g,y2:_}},We=({canvasHeight:e=p.height,canvasWidth:t=p.width,cursor:r=0,extraSpace:a={bottom:0,left:0,right:0,top:0},position:n=y.BOTTOM,showTickLines:i=!1,tickLine:o,tickLineHover:s,tickText:c,tickValues:u=[],...l})=>{const h=fe(l);return d.jsxs("g",{...h,children:[d.jsx(Be,{...Ve(l)}),u&&u.length>0&&u.map((e,t)=>{const a=Fe(r,e.position)&&s?{...o,...s}:o,n="rotate"===c?.transform?`rotate(-30, ${e.position}, ${c.y})`:void 0;return d.jsx(Xe,{showTickLines:i,tick:e,tickLine:{...a,x1:e.position,x2:e.position},tickText:{...c,transform:n,x:e.position}},`${t.toString()}`)})]})},Ye=(e,t,r)=>e===y.RIGHT?t+r:t-r,Ke=(e,t,r,a)=>e===y.TOP?r:t+r+a,Ue=({position:e=y.BOTTOM,tickLine:t,tickText:r,...a})=>{const{xAxisCoordinates:{coordinates:n,tickValues:i},...o}=u.useContext(E),s=Ke(e,n.y1,Number(r?.fontSize),r?.top??0),c=o.extraSpaceTopY,l=Number(o.canvasHeight)-o.extraSpaceBottomY;return d.jsx(We,{...n,...a,canvasHeight:Number(o.canvasHeight),canvasWidth:Number(o.canvasWidth),dataTestId:`${o.dataTestId}xAxis`,extraSpace:{left:o.extraSpaceLeftX,right:o.extraSpaceRightX},tickLine:{...t,y1:c,y2:l},tickText:{...r,y:s},tickValues:r?i:void 0})},Ge=({canvasWidth:e,cursor:t=0,extraSpace:r={bottom:0,left:0,right:0,top:0},position:a=y.LEFT,showTickLines:n=!0,tickLine:i,tickLineHover:o,tickText:s,tickValues:c=[],...u})=>{const l=fe(u);return d.jsxs("g",{...l,children:[d.jsx(Be,{...Ve(u)}),c&&c.length>0&&c.map((e,r)=>{const a=Fe(t,e.position)&&o?{...i,...o}:i,c="rotate"===s?.transform?`rotate(-30, ${s.x}, ${e.position})`:void 0;return d.jsx(Xe,{showTickLines:n,tick:e,tickLine:{...a,y1:e.position,y2:e.position},tickText:{...s,transform:c,y:e.position}},`${r.toString()}`)})]})},ze=(e,t,r)=>{let a=0;switch(e){case"middle":a=t/2+r;break;case"end":a=t+r;break;default:a=0}return a},Ze=({position:e=y.LEFT,tickLine:t,tickText:r,...a})=>{const{yAxisCoordinates:{coordinates:n,tickValues:i},...o}=u.useContext(E),s=r?.textAnchor||"middle",c=(e===y.RIGHT?r?.right:r?.left)??0,l=ze(s,o.yAxisText,c),h=Ye(e,n.x1,l);return d.jsx(Ge,{...n,...a,canvasHeight:Number(o.canvasHeight),canvasWidth:Number(o.canvasWidth),dataTestId:`${o.dataTestId}yAxis`,tickLine:{...t,x1:o.extraSpaceLeftX,x2:Number(o.canvasWidth)-o.extraSpaceRightX},tickText:{...r,x:h},tickValues:r?i:void 0})},qe=e=>{if(e.custom)return e.custom?.values;if(e.numeric){const{max:t,min:r=0,step:a}=e.numeric;if(a>=Math.abs(t-r)||a<=0)return[r.toString()];const n=[];for(let e=r;e<=t;e+=a)n.push(e.toString());return n}},Je=(e,t)=>e.flatMap(e=>Object.keys(e).filter(r=>r!==t&&"number"==typeof e[r]).map(t=>Number(e[t]))),Qe=(e,t,r,a,n,i,o,s)=>{const{position:c,tickText:d,tickValues:u}=e.props,l=d?.fontSize??0,h=l*a,p=u?qe(u):t.map(e=>e[r]),f=De({bound:"width",data:p,fontSize:l,svgHeight:`${o}`,svgWidth:`${s}`,viewBox:i}),x=n>f?n:f;return{barChartXPosition:c||y.BOTTOM,extraSpaceBottomY:c===y.BOTTOM?h+(d?.top??0):0,extraSpaceTopY:c===y.TOP?h+(d?.bottom??0):0,securityXSpace:x,xBreakAxis:u?.numeric?u.numeric.breakAxis??0:d?.custom?.breakAxis??0,xData:p}},et=(e,t,r,a,n,i,o,s)=>{const{position:c,tickText:d,tickValues:u}=e.props,l=d?.fontSize??0,h=l*a,p=u||He([...new Set(Je(t,r))]),f=qe(p),x=n>h?n:h,R=De({bound:"width",data:f,fontSize:l,svgHeight:`${o}`,svgWidth:`${s}`,viewBox:i});return{barChartYPosition:c||y.LEFT,extraSpaceLeftX:c===y.LEFT?R+(d?.right??0):0,extraSpaceRightX:c===y.RIGHT?R+(d?.left??0):0,securityYSpace:x,yAxisText:R,yBreakAxis:u?.numeric?u.numeric.breakAxis??0:d?.custom?.breakAxis??0,yData:f}},tt=({addError:e,ajustedX:t,ajustedY:r,canvasHeight:a,canvasWidth:n,children:i,data:o,gapBetweenBars:s,orientation:c,pKey:d,viewBox:l})=>{let h;if(!o||0===o.length){const t={error:Q(B)};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}if(n<=0||a<=0){const t={error:te(n,a)};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}const p=Oe(i),f=20*p,x=(p-1)*s,R=c===T.VERTICAL?n:a;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 _=o&&o.length>0?o:[{[pe]:0,[d]:le},{[pe]:0,[d]:he}],A=n>0?n:100,E=a>0?a:100,{barChartXPosition:m,barChartYPosition:C,extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:N,extraSpaceTopY:$,securityXSpace:b,securityYSpace:L,xAxisText:k,xBreakAxis:O,xData:H,yAxisText:w,yBreakAxis:P,yData:j}=(({ajustedX:e,ajustedY:t,canvasHeight:r,canvasWidth:a,children:n,data:i,gapBetweenBars:o,orientation:s,pKey:c,viewBox:d})=>{let l={barChartXPosition:y.BOTTOM,barChartYPosition:y.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 u.Children.forEach(n,n=>{if(u.isValidElement(n))if(n.type!==ke||p.includes(n.props.order)||(p.push(n.props.order),h+=n.props.barConfig.barWidth??0),n.type===Ue){const t=s===T.VERTICAL?h:0;l={...l,...Qe(n,i,c,e,t,d,r,a)}}else if(n.type===Ze){const e=s===T.HORIZONTAL?h:0;l={...l,...et(n,i,c,t,e,d,r,a)}}}),l})({ajustedX:t,ajustedY:r,canvasHeight:E,canvasWidth:A,children:i,data:_,gapBetweenBars:s,orientation:c,pKey:d,viewBox:l}),M=m!==y.TOP&&m!==y.BOTTOM,X=de({initPos:I,maxSpaceAvailable:A,otherAxisSpace:I+N,securitySpace:b,tickValues:H});if((X??[]).some(({position:e})=>isNaN(e))){const t={error:Q(D)};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}if(X){const t=X.length<2,r=X.length>=2&&1===new Set(X.map(e=>e.value)).size;if(t){const t={error:Q(U)};e?.("BAR_CHART_X_AXIS_ERROR",t),h||(h=t)}if(r){const t={error:Q(K)};e?.("BAR_CHART_X_AXIS_ERROR",t),h||(h=t)}}const F=C!==y.LEFT&&C!==y.RIGHT,V=ue({initPos:E-S,maxSpaceAvailable:E,needAjusted:c===T.HORIZONTAL,otherAxisSpace:$+S,securitySpace:L,tickValues:j});if(V){const t=V.length<2,r=V.length>=2&&1===new Set(V.map(e=>e.value)).size;if(t){const t={error:Q(Z)};e?.("BAR_CHART_Y_AXIS_ERROR",t),h||(h=t)}if(r){const t={error:Q(z)};e?.("BAR_CHART_Y_AXIS_ERROR",t),h||(h=t)}}const W=M?ce(V||[],[String(O)])[0]:0,Y=F?ce(X||[],[String(P)])[0]:0,J=oe({canvasHeight:E,canvasWidth:A,customBreakAxis:Number(W),extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:N,extraSpaceTopY:$,position:m}),ee=se({canvasHeight:E,canvasWidth:A,customBreakAxis:Number(Y),extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:N,extraSpaceTopY:$,position:C});if(J.x1===J.x2){const t={error:Q(G)};e?.("BAR_CHART_X_AXIS_ERROR",t),h||(h=t)}if(ee.y1===ee.y2){const t={error:Q(q)};e?.("BAR_CHART_Y_AXIS_ERROR",t),h||(h=t)}const re={addError:e,crossXAxis:M,crossYAxis:F,data:_,extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:N,extraSpaceTopY:$,securityXSpace:b,securityYSpace:L,xAxisCoordinates:{coordinates:J,tickValues:X||(h?[{position:0,value:le},{position:A,value:he}]:[])},xAxisText:k,yAxisCoordinates:{coordinates:ee,tickValues:V||(h?[{position:E,value:le},{position:0,value:he}]:[])},yAxisText:w};return h?{...re,error:{...h,type:v.BAR_CHART_CONTEXT_ERROR}}:re},rt=Object.assign(({canvasConfig:e=p,caption:t,children:r,classNames:a,data:n,dataTestId:i,gapBetweenBars:o=0,height:s="100%",onErrors:c,orientation:R,pKey:g,role:_,tabIndex:T,width:v="100%",...y})=>{const{extraSpace:m,height:C,width:S}=e,I=A(S),N=A(C),$=m?A(m):void 0,b=h(I,N,$),L=Oe(r),k=2*o,O=[d.jsx(Ue,{},"default-x-axis"),d.jsx(Ze,{},"default-y-axis")],H=u.Children.toArray(r)||[],w=O.concat(H),P=Math.max(I,N,$??0),j=I/P,D=N/P,B=u.useMemo(()=>f(c),[c]),M=x(n),X=u.useMemo(()=>(B.clearErrors(),tt({addError:(e,t)=>{B.addError(e,t)},ajustedX:j,ajustedY:D,canvasHeight:N,canvasWidth:I,children:w,data:n,gapBetweenBars:k,orientation:R,pKey:g,viewBox:b})),[C,S,M,g,R,B.addError]);return d.jsx(l,{caption:t,className:a,dataTestId:i,height:s,role:_,tabIndex:T,viewBox:b,width:v,...y,children:d.jsx(E.Provider,{value:{...X,barChildrenCount:L,canvasExtraSpace:$,canvasHeight:N,canvasWidth:I,data:n,dataTestId:i,gapBetweenBars:o,orientation:R,pKey:g},children:r})})},{Path:ke,Separator:({areaSeparator:e,dataTestId:t,rightSeparator:r,topSeparator:a,xBreakAxis:n,yBreakAxis:i})=>{const{addError:o,crossXAxis:s,crossYAxis:c,xAxisCoordinates:l,yAxisCoordinates:h}=u.useContext(E),p=l.tickValues,f=h.tickValues,x=void 0!==n?"string"==typeof n?parseFloat(n):n:void 0,R=void 0!==i?"string"==typeof i?parseFloat(i):i:void 0;if(u.useEffect(()=>{if(void 0!==n){const e=p.map(e=>e.value);if(void 0===x||isNaN(x))o?.("BAR_CHART_SEPARATOR_ERROR",{error:re(n)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(x<t||x>r)&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:ne(x,t,r)})}}if(void 0!==i){const e=f.map(e=>e.value);if(void 0===R||isNaN(R))o?.("BAR_CHART_SEPARATOR_ERROR",{error:ae(i)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(R<t||R>r)&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:ie(R,t,r)})}}},[n,x,p,i,R,f]),!a&&!r&&!e)return d.jsx(d.Fragment,{});const g=n&&ce(l.tickValues,[n],!0)[0],_=i&&ce(h.tickValues,[i])[0],A=c?h.coordinates.x1:l.coordinates.x2,T=s?l.coordinates.y1:h.coordinates.y1,v=l.coordinates.x1,y=g??A,m=h.coordinates.y2,C=_??T;u.useEffect(()=>{v===y&&m===C&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:Q(W)})},[v,y,m,C]);const S=`M${v} ${m} H ${y} V ${C} H ${v} Z`,I=`M${v} ${C} H ${y}`,N=`M${y} ${m} V ${C}`;return d.jsxs("g",{children:[d.jsx("path",{d:S,"data-testid":`${t}Area`,...e}),d.jsx("path",{d:I,"data-testid":`${t}Top`,...a}),d.jsx("path",{d:N,"data-testid":`${t}Right`,...r})]})},XAxis:Ue,YAxis:Ze}),at=u.createContext({}),nt=({curved:e=!1,extendToBottom:t=!1,points:r,svgHeight:a})=>{if(0===r.length)return"";const[n,...i]=r;let o=`M ${n[0]} ${n[1]}`;return o+=e?i.reduce((e,t,a)=>{const[n,i]=r[a],[o,s]=t,c=.3*(o-n),d=[n+c,i],u=[o-c,s];return`${e} C ${d[0]} ${d[1]}, ${u[0]} ${u[1]}, ${o} ${s}`},""):i.reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,""),t&&(o+=` L ${i[i.length-1][0]} ${a} L ${n[0]} ${a} Z`),o},it=(e,t)=>new Error(`Invalid projection bounds - upper projection (${e}) must be below lower projection (${t})`),ot=(e,t)=>new Error(`${t?"Upper":"Lower"} projection X coordinate (${e}) is outside valid range (0-100)`),st=(e,t,r)=>new Error(`${r?"Upper":"Lower"} projection Y coordinate (${e}) is outside chart area (0-${t})`),ct=(e,t)=>{if(!t)return e;const r=t<0,a=e*Math.abs(t)/100;return r?e-a:e+a},dt=(e,t,r)=>{if(!r)return e;const a=r<0,n=(0===e?t:e)*Math.abs(r)/100;return a?e+n:e-n},ut=({curved:e,lineProjection:t,points:r,svgHeight:a})=>{const{addError:n}=u.useContext(at),{lower:i,shapeColor:o,upper:s}=t,{xProjection:c,yProjection:l,...h}=s||{},{xProjection:p,yProjection:f,...x}=i||{},R=c||l?{x:c,y:l}:void 0,g=p||f?{x:p,y:f}:void 0,_=R?.y,A=g?.y,E=R?.x,T=g?.x;u.useEffect(()=>{if(R&&g){const e=_||0,t=A||0;e>=t&&n?.("LINE_CHART_PROJECTION_ERROR",{error:it(e,t)})}R&&(void 0!==E&&(E<0||E>100)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:ot(E,!0)}),void 0!==_&&(_<0||_>a)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:st(_,a,!0)})),g&&(void 0!==T&&(T<0||T>100)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:ot(T,!1)}),void 0!==A&&(A<0||A>a)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:st(A,a,!1)}))},[g,T,A,a,R,E,_]);const{downPath:v,shapePath:y,upPath:m}=(({curved:e,lowerProjection:t,points:r,svgHeight:a,upperProjection:n})=>{const i=n||t;if(0===r.length&&!i)return{shapePath:""};const[o,...s]=r,c=`M ${o[0]} ${o[1]}`;let d=c,u=n?c:void 0,l=t?c:void 0;const h=[],p=[];s.forEach(([e,r])=>{const i=n?[ct(e,n.x),dt(r,a,n.y)]:[e,r],o=t?[ct(e,-(t.x??0)),dt(r,a,-(t.y??0))]:[e,r];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,r)=>{const a=0===r?o:f[r-1],[n,i]=a,[s,c]=t,d=.3*(s-n),u=[n+d,i],l=[s-d,c];return`${e} C ${u[0]} ${u[1]}, ${l[0]} ${l[1]}, ${s} ${c}`},""),u&&(u+=h.reduce((e,t,r)=>{const a=0===r?o:h[r-1],[n,i]=a,[s,c]=t,d=.3*(s-n),u=[n+d,i],l=[s-d,c];return`${e} C ${u[0]} ${u[1]}, ${l[0]} ${l[1]}, ${s} ${c}`},"")),l&&(l+=p.reverse().reduce((e,t,r)=>{const a=0===r?o:p[r-1],[n,i]=a,[s,c]=t,d=.3*(s-n),u=[n+d,i],l=[s-d,c];return`${e} C ${u[0]} ${u[1]}, ${l[0]} ${l[1]}, ${s} ${c}`},""))):(d+=f.reduce((e,t)=>`${e} L ${t?.[0]} ${t?.[1]}`,""),u&&(u+=h.reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,"")),l&&(l+=p.reverse().reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,""))),{downPath:l,shapePath:d,upPath:u}})({curved:e,lowerProjection:g,points:r,svgHeight:a,upperProjection:R});return d.jsxs("g",{className:"pointer-events-none",children:[d.jsx("path",{d:y,fill:o,stroke:"transparent",strokeWidth:"0.1"}),";",m&&d.jsx("path",{d:m,...h}),v&&d.jsx("path",{d:v,...x})]})},lt=(e,t)=>e.map(e=>e[t]),ht={formatTicksValues:(e,t)=>e.map(e=>({...e,value:t(e.value)}))},pt=({ariaLabel:e,position:t=y.BOTTOM,tickLine:r,tickText:a,valueFormatter:n=e=>e,...i})=>{const{xAxisCoordinates:{coordinates:o,tickValues:s},xCursor:c,...l}=u.useContext(at),h=Ke(t,o.y1,Number(a?.fontSize),a?.top??0),p=l.extraSpaceTopY,f=Number(l.canvasHeight)-l.extraSpaceBottomY,x=a?ht.formatTicksValues(s,n):void 0,R=fe(i),g=e||i["aria-label"],_={...i,...R,...g&&{"aria-label":g}};return d.jsx(We,{...o,..._,canvasHeight:Number(l.canvasHeight),canvasWidth:Number(l.canvasWidth),cursor:c,dataTestId:`${l.dataTestId}xAxis`,extraSpace:{left:l.extraSpaceLeftX,right:l.extraSpaceRightX},tickLine:{...r,y1:p,y2:f},tickText:{...a,y:h},tickValues:x})},ft=({ariaLabel:e,position:t=y.LEFT,tickLine:r,tickText:a,valueFormatter:n=e=>e,...i})=>{const{yAxisCoordinates:{coordinates:o,tickValues:s},yCursor:c,...l}=u.useContext(at),h=a?.textAnchor||"middle",p=(t===y.RIGHT?a?.right:a?.left)??0,f=ze(h,l.yAxisText,p),x=Ye(t,o.x1,f),R=a?ht.formatTicksValues(s,n):void 0,g=fe(i),_=e||i["aria-label"],A={...i,...g,..._&&{"aria-label":_}};return d.jsx(Ge,{...o,...A,canvasHeight:Number(l.canvasHeight),canvasWidth:Number(l.canvasWidth),cursor:c,dataTestId:`${l.dataTestId}yAxis`,tickLine:{...r,x1:l.extraSpaceLeftX,x2:Number(l.canvasWidth)-l.extraSpaceRightX},tickText:{...a,x:x},tickValues:R})},xt={[R]:R,[g]:g},Rt="WIDTH",gt=/^(\d+(\.\d+)?)(px|rem|%)?$/,_t=e=>{if("number"==typeof e)return{unit:void 0,value:e};const t=e.match(gt);if(!t)throw new Error(`Invalid string format: "${e}"`);const r=parseFloat(t[1]),a=t[3];return{unit:xt[a],value:r}},At=(e,t,r)=>{const a=r.parentElement;return a?e/100*(t===Rt?a.clientWidth:a.clientHeight):0},Et=e=>{const t=Pe();if(!t)return 16*e;const r=(e=>{const t=we()?window:void 0;if(t)return t.getComputedStyle(e)})(t.documentElement);return r?e*(parseFloat(r.fontSize)||16):16*e},Tt=({canvasHeight:e,canvasWidth:t,svgElement:r})=>{const{unit:a,value:n}=_t(t),i=a===R?At(n,Rt,r):a===g?Et(n):n,{unit:o,value:s}=_t(e);return{parsedCanvasHeight:o===R?At(s,"HEIGHT",r):o===g?Et(s):s,parsedCanvasWidth:i}},vt=e=>{if(e.custom)return e.custom?.values;if(e.numeric){const{max:t,min:r=0,step:a}=e.numeric;if(a>=Math.abs(t-r)||a<=0)return[r.toString(),t.toString()];const n=[];for(let e=r;e<=t;e+=a)n.push(e.toString());return n}},yt=(e,t)=>e.flatMap(e=>Object.keys(e).filter(r=>r!==t&&"number"==typeof e[r]).map(t=>e[t])),mt=(e,t,r,a,n,i,o)=>{const{position:s,tickText:c,tickValues:d,valueFormatter:u}=e.props,l=c?.fontSize??0,h=l*a,p=d?vt(d):t.map(e=>e[r]),f=u?p.map(u):p,x=De({bound:"width",data:f,fontSize:l,svgHeight:`${i}`,svgWidth:`${o}`,viewBox:n}),R=s===y.TOP;return{extraSpaceBottomY:s===y.BOTTOM?h+(c?.top??0):0,extraSpaceTopY:R?h+(c?.bottom??0):0,lineChartXPosition:s||y.BOTTOM,securityXSpace:x,xBreakAxis:d?.numeric?d.numeric.breakAxis??0:c?.custom?.breakAxis??0,xData:p}},Ct=(e,t,r,a,n,i,o)=>{const{position:s,tickText:c,tickValues:d,valueFormatter:u}=e.props,l=c?.fontSize??"0",h=l*a,p=d||He([...new Set(yt(t,r))]),f=vt(p),x=u?f.map(u):f,R=De({bound:"width",data:x,fontSize:l,svgHeight:`${i}`,svgWidth:`${o}`,viewBox:n}),g=h,_=s===y.RIGHT;return{extraSpaceLeftX:s===y.LEFT?R+(c?.right??0):0,extraSpaceRightX:_?R+(c?.left??0):0,lineChartYPosition:s||y.LEFT,securityYSpace:g,yAxisText:R,yBreakAxis:d?.numeric?d.numeric.breakAxis??0:c?.custom?.breakAxis??0,yData:f}},St=({addError:e,ajustedX:t,ajustedY:r,canvasHeight:a,canvasWidth:n,children:i,data:o,viewBox:s,xKey:c})=>{let d;if(!o||0===o.length){const t={error:Q(M)};e?.("LINE_CHART_CONTEXT_ERROR",t),d=t}if(o&&1===o.length){const t={error:Q(Y)};e?.("LINE_CHART_CONTEXT_ERROR",t),d=t}if(n<=0||a<=0){const t={error:te(n,a)};e?.("LINE_CHART_CONTEXT_ERROR",t),d=t}const l=o&&o.length>0?o:[{[c]:"0",y:0},{[c]:"1",y:1}],h=n>0?n:100,p=a>0?a:100,{extraSpaceBottomY:f,extraSpaceLeftX:x,extraSpaceRightX:R,extraSpaceTopY:g,lineChartXPosition:_,lineChartYPosition:A,securityXSpace:E,securityYSpace:T,xAxisText:m,xBreakAxis:C,xData:S,yAxisText:I,yBreakAxis:N,yData:$}=(({ajustedX:e,ajustedY:t,canvasHeight:r,canvasWidth:a,children:n,data:i,viewBox:o,xKey:s})=>{let c={extraSpaceBottomY:0,extraSpaceLeftX:0,extraSpaceRightX:0,extraSpaceTopY:0,lineChartXPosition:y.BOTTOM,lineChartYPosition:y.LEFT,securityXSpace:0,securityYSpace:0,xAxisText:0,xBreakAxis:0,xData:[],yAxisText:0,yBreakAxis:0,yData:[]};return u.Children.forEach(n,n=>{u.isValidElement(n)&&(n.type===pt?c={...c,...mt(n,i,s,e,o,r,a)}:n.type===ft&&(c={...c,...Ct(n,i,s,t,o,r,a)}))}),c})({ajustedX:t,ajustedY:r,canvasHeight:p,canvasWidth:h,children:i,data:l,viewBox:s,xKey:c}),b=_!==y.TOP&&_!==y.BOTTOM,L=de({initPos:x,maxSpaceAvailable:h,otherAxisSpace:x+R,securitySpace:E,tickValues:S});if((L??[]).some(({position:e})=>isNaN(e))){const t={error:Q(D)};e?.("LINE_CHART_CONTEXT_ERROR",t),d=t}if(L){const t=L.length<2,r=L.length>=2&&1===new Set(L.map(e=>e.value)).size;if(t){const t={error:Q(U)};e?.("LINE_CHART_X_AXIS_ERROR",t),d||(d=t)}if(r){const t={error:Q(K)};e?.("LINE_CHART_X_AXIS_ERROR",t),d||(d=t)}}const k=A!==y.LEFT&&A!==y.RIGHT,O=ue({initPos:p-f,maxSpaceAvailable:p,otherAxisSpace:g+f,securitySpace:T,tickValues:$});if(O){const t=O.length<2,r=O.length>=2&&1===new Set(O.map(e=>e.value)).size;if(t){const t={error:Q(Z)};e?.("LINE_CHART_Y_AXIS_ERROR",t),d||(d=t)}if(r){const t={error:Q(z)};e?.("LINE_CHART_Y_AXIS_ERROR",t),d||(d=t)}}const H=b?ce(O||[],[String(C)])[0]:0,w=k?ce(L||[],[String(N)])[0]:0,P=oe({canvasHeight:p,canvasWidth:h,customBreakAxis:Number(H),extraSpaceBottomY:f,extraSpaceLeftX:x,extraSpaceRightX:R,extraSpaceTopY:g,position:_}),j=se({canvasHeight:p,canvasWidth:h,customBreakAxis:Number(w),extraSpaceBottomY:f,extraSpaceLeftX:x,extraSpaceRightX:R,extraSpaceTopY:g,position:A});if(P.x1===P.x2){const t={error:Q(G)};e?.("LINE_CHART_X_AXIS_ERROR",t),d||(d=t)}if(j.y1===j.y2){const t={error:Q(q)};e?.("LINE_CHART_Y_AXIS_ERROR",t),d||(d=t)}const B={addError:e,crossXAxis:b,crossYAxis:k,extraSpaceBottomY:f,extraSpaceLeftX:x,extraSpaceRightX:R,extraSpaceTopY:g,securityXSpace:E,securityYSpace:T,xAxisCoordinates:{coordinates:P,tickValues:L||(d?[{position:0,value:"0"},{position:h,value:"1"}]:[])},xAxisText:m,yAxisCoordinates:{coordinates:j,tickValues:O||(d?[{position:p,value:le},{position:0,value:he}]:[])},yAxisText:I};return d?{...B,error:{...d,type:v.LINE_CHART_CONTEXT_ERROR}}:B},It=Object.assign(({ariaHidden:e,ariaLabel:t,canvasConfig:r=p,caption:a,children:n,classNames:i,data:o,dataTestId:s="line-chart",getPathArea:c,height:R="100%",onErrors:g,role:_,tabIndex:E,width:T="100%",xKey:v,...y})=>{const{extraSpace:m,height:C,width:S}=r,[I,N]=u.useState(""),[$,b]=u.useState({height:0,width:0}),L=m?A(m):void 0,k=h($.width,$.height,L),O=[d.jsx(pt,{},"default-x-axis"),d.jsx(ft,{},"default-y-axis")],H=u.Children.toArray(n)||[],w=O.concat(H),P=Math.max($.width,$.height,L??0),j=isNaN($.width/P)?0:$.width/P,D=isNaN($.height/P)?0:$.height/P;(({attrName:e,children:t,originalValue:r,updateValue:a})=>{let n="";u.Children.toArray(t).forEach(t=>{if(u.isValidElement(t)){const r=t.props[e];r&&(n+=r)}}),n!==r&&a(n)})({attrName:"dataKey",children:w,originalValue:I,updateValue:N});const B=u.useMemo(()=>f(g),[g]),M=x(o),X=u.useMemo(()=>(B.clearErrors(),St({addError:(e,t)=>{B.addError(e,t)},ajustedX:j,ajustedY:D,canvasHeight:$.height,canvasWidth:$.width,children:w,data:o,viewBox:k,xKey:v})),[$.width,$.height,M,v,I,B.addError]),{svgRef:F,xCursor:V,yCursor:W}=(({canvasHeight:e,canvasWidth:t})=>{const[[r,a],n]=u.useState([Re,Re]),i=u.useCallback((r,a)=>{const{height:i,left:o,top:s,width:c}=a.getBoundingClientRect(),d=r.clientX-o,u=r.clientY-s;n([d*t/c,u*e/i])},[t,e]),o=e=>{e.preventDefault()};return{svgRef:u.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:r,yCursor:a}})({canvasHeight:$.height,canvasWidth:$.width});return u.useEffect(()=>{const e=document.querySelector("[data-kbt-svg]");if(!e)return;const{parsedCanvasHeight:t,parsedCanvasWidth:r}=Tt({canvasHeight:C,canvasWidth:S,svgElement:e});b({height:t,width:r})},[S,C]),u.useEffect(()=>{c?.({x1:X.extraSpaceLeftX,x2:$.width-X.extraSpaceRightX,y1:X.extraSpaceTopY,y2:$.height-X.extraSpaceBottomY})},[$.width,$.height]),d.jsx(l,{ref:F,ariaHidden:e,ariaLabel:t,caption:a,className:i,"data-kbt-svg":!0,dataTestId:s,height:R,role:_,tabIndex:E,viewBox:k,width:T,...y,children:d.jsx(at.Provider,{value:{...X,canvasExtraSpace:L,canvasHeight:$.height,canvasWidth:$.width,data:o,dataTestId:s,xCursor:V,xKey:v,yCursor:W},children:n})})},{Path:({ariaLabel:e,closestClick:t,curved:r,getNodeFocusInfo:a,getNodesCoords:n,indicatorConfig:i,lineProjection:o,onClick:s,...c})=>{const{addError:l,xAxisCoordinates:h,yAxisCoordinates:p,...f}=u.useContext(at),x=c.dataKey,R=f.data.length>0,g=f.data[0],_=!!g&&Object.prototype.hasOwnProperty.call(g,x),A=f.data.length;u.useEffect(()=>{if(!x||"string"!=typeof x)return void l?.("LINE_CHART_PATH_ERROR",{error:Q(V)});if(R&&!_)return void l?.("LINE_CHART_PATH_ERROR",{error:ee(x)});if(r&&A<2)return void l?.("LINE_CHART_PATH_ERROR",{error:Q(F)});const e=lt(f.data,x);e.length>0&&e.every(e=>null==e)&&l?.("LINE_CHART_PATH_ERROR",{error:Q(X)})},[l,r,x,A,R,_,f.data]);const{indicatorRef:E,pathRef:T}=((e,t)=>{const r=u.useRef(null),a=u.useRef(null);return u.useEffect(()=>{if(!t||!r.current||!a.current)return;const n=r.current,i=a.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 u=n.getPointAtLength(d);i.setAttribute("transform",`translate(${u.x}, ${u.y})`),i.setAttribute("pointer-events","none")},[e]),{indicatorRef:a,pathRef:r}})(f.xCursor,!!i),v=!!i&&f.xCursor!==-1/0,y=u.useRef(null),m=u.useRef(null),{autoClick:C,lineIndicator:S,...I}=i||{},{y1:N,y2:$}=p.coordinates,{x1:b,x2:L}=h.coordinates,k=f.xCursor>=b&&f.xCursor<=L,{tickValues:O}=h,{tickValues:H}=p,w=lt(f.data,f.xKey),P=lt(f.data,x),j=ce(O,w,!0),D=ce(H,P),B=j.map((e,t)=>[e,D[t]]),M=nt({curved:r,extendToBottom:!1,points:B,svgHeight:Number(f.canvasHeight)-f.extraSpaceBottomY}),W=nt({curved:r,extendToBottom:!!c.fill||!!c.gradient,points:B,svgHeight:Number(f.canvasHeight)-f.extraSpaceBottomY});u.useEffect(()=>{if(!y.current?.path)return;T.current=y.current.path;const e=y.current.main,t=y.current.node,r=w.map((e,t)=>({x:e,y:P[t]})),{mount:n,unmount:i}=(({data:e,getNodeFocusInfo:t,nodes:r,ref:a})=>{let n,i=!1;const o=a.querySelector("[data-draw]"),s=a=>{i&&("ArrowRight"===a.key?(n=void 0===n||n===r.length-1?0:n+1,r[n].focus(),t?.(e[n])):"ArrowLeft"===a.key&&(n=void 0===n||0===n?r.length-1:n-1,r[n].focus(),t?.(e[n])))},c=()=>{i=!0},d=()=>{i=!1},u=()=>{n=void 0};return{mount:()=>{a.addEventListener("focusin",c),a.addEventListener("focusout",d),o?.addEventListener("focus",u),window.addEventListener("keydown",e=>s(e))},unmount:()=>{a.removeEventListener("focusin",c),a.removeEventListener("focusout",d),o?.removeEventListener("focus",u),window.removeEventListener("keydown",e=>s(e))}}})({data:r,getNodeFocusInfo:a,nodes:t,ref:e});return n(),()=>i()},[]),u.useEffect(()=>{if(c.nodeConfig&&v&&C){const{idx:e,match:t}=((e,t)=>{let r=0,a=!1;for(let n=0;n<e.length;n++)if(Math.round(e[n])===Math.round(t)){a=!0,r=n;break}return{idx:r,match:a}})(j,f.xCursor);if(t&&e!==m.current){m.current=e;const t=new MouseEvent("click",{bubbles:!0});t.autoClick=!0,y.current?.node?.[e]?.dispatchEvent(t),navigator?.vibrate?.(200)}else m.current=null}},[f.xCursor]),u.useEffect(()=>{n?.(B)},[B]);const Y=fe(c),K={...c,...Y,...e&&{"aria-label":e}};return d.jsxs(d.Fragment,{children:[d.jsx($e,{ref:y,d:M,dFill:W,dataTestId:`${f.dataTestId}path`,dataValue:f.data,points:B,xKey:f.xKey,onClick:e=>{if(s?.(e),t){const e=((e,t)=>{let r=0,a=Math.abs(e[0]-t);for(let n=1;n<e.length;n++){const i=Math.abs(e[n]-t);i<a&&(r=n,a=i)}return r})(j,f.xCursor),t=new MouseEvent("click",{bubbles:!0});t.autoClick=!1,y.current?.node?.[e]?.dispatchEvent(t)}},...K}),o&&d.jsx(ut,{curved:r,dataKey:c.dataKey,lineProjection:o,points:B,svgHeight:Number(f.canvasHeight)-f.extraSpaceBottomY}),v&&d.jsxs(d.Fragment,{children:[!!S&&k&&d.jsx(Be,{...S,className:"pointer-events-none",x1:f.xCursor,x2:f.xCursor,y1:N,y2:$}),d.jsx("g",{ref:E,className:"pointer-events-none",children:d.jsx(Ie,{...I})})]})]})},Separator:({areaSeparator:e,dataTestId:t,rightSeparator:r,topSeparator:a,xBreakAxis:n,yBreakAxis:i})=>{const{addError:o,crossXAxis:s,crossYAxis:c,xAxisCoordinates:l,yAxisCoordinates:h}=u.useContext(at),p=l.tickValues,f=h.tickValues,x=void 0!==n?"string"==typeof n?parseFloat(n):n:void 0,R=void 0!==i?"string"==typeof i?parseFloat(i):i:void 0;if(u.useEffect(()=>{if(void 0!==n){const e=p.map(e=>e.value);if(void 0===x||isNaN(x))o?.("LINE_CHART_SEPARATOR_ERROR",{error:re(n)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(x<t||x>r)&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:ne(x,t,r)})}}if(void 0!==i){const e=f.map(e=>e.value);if(void 0===R||isNaN(R))o?.("LINE_CHART_SEPARATOR_ERROR",{error:ae(i)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(R<t||R>r)&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:ie(R,t,r)})}}},[n,x,p,i,R,f]),!a&&!r&&!e)return d.jsx(d.Fragment,{});const g=n&&ce(l.tickValues,[n],!0)[0],_=i&&ce(h.tickValues,[i])[0],A=c?h.coordinates.x1:l.coordinates.x2,E=s?l.coordinates.y1:h.coordinates.y1,T=l.coordinates.x1,v=g??A,y=h.coordinates.y2,m=_??E;u.useEffect(()=>{T===v&&y===m&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:Q(W)})},[T,v,y,m]);const C=`M${T} ${y} H ${v} V ${m} H ${T} Z`,S=`M${T} ${m} H ${v}`,I=`M${v} ${y} V ${m}`;return d.jsxs("g",{children:[d.jsx("path",{d:C,"data-testid":`${t}Area`,...e}),d.jsx("path",{d:S,"data-testid":`${t}Top`,...a}),d.jsx("path",{d:I,"data-testid":`${t}Right`,...r})]})},XAxis:pt,YAxis:ft}),Nt=({children:e,dataTestId:t,height:r,width:a,x:n,y:i})=>d.jsx("foreignObject",{"data-testid":t,height:r,width:a,x:n,y:i,children:e}),$t=u.createContext({}),bt=(e,t,r)=>({x:e.x+t*Math.cos(r),y:e.y+t*Math.sin(r)}),Lt=({center:e,innerEnd:t,innerRadius:r,singleStroke:a})=>{if(!a)return r>0?`L ${t.x},${t.y}`:`L ${e.x},${e.y}`},kt="CLOCKWISE",Ot=({canvasHeight:e,canvasWidth:t,color:r="blue",dataKey:a,gap:n,halfChart:i,index:o,innerRadius:s,name:c,radius:l,singleStroke:h,startAngle:p,total:f,value:x,...R})=>{const{addError:g}=u.useContext($t),_=Number(x),A=void 0!==l?Number(l):void 0,E=void 0!==s?Number(s):void 0,T=c?.trim()||"";u.useEffect(()=>{T||g?.("PIE_CHART_SEGMENT_ERROR",{error:H(a||"unknown",o||0,"name")}),isNaN(_)?g?.("PIE_CHART_SEGMENT_ERROR",{error:$(x,T||`segment-${o}`)}):(_<0&&g?.("PIE_CHART_SEGMENT_ERROR",{error:b(_,T||`segment-${o}`)}),void 0!==A&&(isNaN(A)||A<=0)&&g?.("PIE_CHART_SEGMENT_ERROR",{error:w(l)}),void 0!==E&&((isNaN(E)||E<0)&&g?.("PIE_CHART_SEGMENT_ERROR",{error:P(s)}),void 0!==A&&(isNaN(A)||isNaN(E)||E>=A&&g?.("PIE_CHART_SEGMENT_ERROR",{error:j(E,A)}))))},[a,o,E,A,_,T]);const v=(({canvasHeight:e,canvasWidth:t,customRadius:r,gap:a,halfChart:n,innerRadius:i,rotateDirection:o,singleStroke:s,startAngle:c,total:d,value:u})=>{const l=n?2*e:e,h=Math.min(t,l)/2,p=r&&r<h?r:h,f=n?Math.PI:2*Math.PI,x={x:t/2,y:n?e:e/2},R=s?2*d:d,g=100*u/R*f/100,_=a/p,{carryAngle:A,finalAngle:E,initialAngle:T}=(({angleEquivalent:e,direction:t,gapAngle:r,startAngle:a})=>{const n=t===kt;return{carryAngle:n?a+e:a-e,finalAngle:n?a+e-r/2:a-e+r/2,initialAngle:n?a+r/2:a-r/2}})({angleEquivalent:g,direction:o,gapAngle:_,startAngle:c.current});c.current=A;const v=f*u/R-_<=Math.PI?"0":"1",y=bt(x,i,T),m=bt(x,i,E),C=bt(x,p,T);return(({center:e,innerEnd:t,innerRadius:r,innerStart:a,largeArcFlag:n,outerEnd:i,outerStart:o,radius:s,rotateDirection:c,singleStroke:d})=>{let u,l,h,p,f,x,R,g,_,A;return c===kt?(u=`M ${o.x},${o.y}`,l=`A ${s},${s} 0 ${n} 1 ${i.x}, ${i.y}`,h=Lt({center:e,innerEnd:t,innerRadius:r,singleStroke:d}),p=d?`M ${t.x},${t.y}`:void 0,f=r>0?`A ${r},${r} 0 ${n} 0 ${a.x},${a.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 ${r},${r} 0 ${n} 1 ${a.x},${a.y}`,A=d?void 0:"Z"):(u=`M ${o.x} ${o.y}`,l=`A ${s},${s} 0 ${n},0 ${i.x}, ${i.y}`,h=Lt({center:e,innerEnd:t,innerRadius:r,singleStroke:d}),p=d?`M ${t.x},${t.y}`:void 0,f=r>0?`A ${r}, ${r} 0 ${n},1 ${a.x},${a.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 ${r},${r} 0 ${n} 0 ${a.x},${a.y}`,A=d?void 0:"Z"),[u,l,h,p,f,A].concat(d?[x,R,g,_]:[]).filter(Boolean).join(" ")})({center:x,innerEnd:m,innerRadius:i,innerStart:y,largeArcFlag:v,outerEnd:bt(x,p,E),outerStart:C,radius:p,rotateDirection:o,singleStroke:s})})({canvasHeight:e,canvasWidth:t,customRadius:l,gap:n,halfChart:i,innerRadius:s,singleStroke:h,startAngle:p,total:f,value:x});return d.jsx($e,{...R,d:v,dataValue:x,fill:r})},Ht=({dataKey:e,fill:t,gap:r,innerRadius:a,radius:n,...i})=>{const o=String(e),{addError:s,canvasHeight:c,canvasWidth:l,data:h,dataTestId:p,halfChart:f}=u.useContext($t),x=f?0:-Math.PI/2,R=u.useRef(x),g=h[o],_=Object.prototype.hasOwnProperty.call(h,o);u.useEffect(()=>{if(!_)return void s?.("PIE_CHART_PATH_ERROR",{error:L(o)});if(!g||0===g.length)return void s?.("PIE_CHART_PATH_ERROR",{error:k(o)});const e=g.reduce((e,t)=>e+t.value,0);(e<=0||isNaN(e))&&s?.("PIE_CHART_PATH_ERROR",{error:O(o,e)})},[g,_,o]);const E=h[o]?.reduce((e,t)=>e+t.value,0),T=1===h[o]?.length,v=a?A(a):void 0,y=n?A(n):void 0;return h[o]?.length?d.jsx("g",{children:h[o].map((e,a)=>u.createElement(Ot,{...i,...e,key:`${a.toString()}`,canvasHeight:c,canvasWidth:l,color:e.color||t,dataKey:o,dataTestId:`${p}path-${a}`,gap:r,halfChart:f,index:a,innerRadius:v,radius:y,singleStroke:T,startAngle:R,total:E}))}):d.jsx(d.Fragment,{})},wt=Object.assign(({ariaHidden:e,ariaLabel:t,canvasConfig:r=p,caption:a,children:n,classNames:i,data:o,dataTestId:s="pie-chart",halfChart:c,height:R="100%",onErrors:g,radius:_="50%",role:E,tabIndex:T,width:v="100%",...y})=>{const{extraSpace:m,height:C,width:S}=r,I=A(S),N=A(C),$=m?A(m):void 0,b=h(I,N,$),L=u.useMemo(()=>f(g),[g]),k=x(o),O=u.useMemo(()=>(L.clearErrors(),(({addError:e,canvasHeight:t,canvasWidth:r,children:a,halfChart:n})=>{(r<=0||t<=0)&&e?.("PIE_CHART_CONTEXT_ERROR",{error:te(r,t)});const i=r>0?r:100,o=t>0?t:100;let s,c;u.Children.forEach(a,e=>{if(u.isValidElement(e)&&e.type===Ht){const{innerRadius:t}=e.props;if(!t)return;const r=A(t);(!s||r<s)&&(s=r)}}),s&&(c=2*s);const d=c??0,l=n?d/2:d,h=n?o:o/2;return{addError:e,foreignObject:{height:l,width:d,x:i/2-d/2,y:n?h-l:h-l/2}}})({addError:(e,t)=>{L.addError(e,t)},canvasHeight:N,canvasWidth:I,children:n,halfChart:c})),[C,S,c,k,L]);return d.jsx(l,{ariaHidden:e,ariaLabel:t,caption:a,className:i,dataTestId:s,height:R,radius:_,role:E,tabIndex:T,viewBox:b,width:v,...y,children:d.jsx($t.Provider,{value:{...O,canvasHeight:N,canvasWidth:I,data:o,dataTestId:s,halfChart:c},children:n})})},{Foreign:({children:e,dataTestId:t,height:r,width:a,x:n,y:i,...o})=>{const{dataTestId:s,foreignObject:c}=u.useContext($t),l=!a&&c?.width?c.width:a,h=!r&&c?.height?c.height:r,p=!n&&c?.x?c.x:n,f=!i&&c?.y?c.y:i,x=!t&&s?`${s}-foreign-object`:t;return d.jsx(Nt,{...o,dataTestId:x,height:h,width:l,x:p,y:f,children:e})},Path:Ht}),Pt={FOCUS_COLOR:"#0078D4",FOCUS_INNER:"#ffffff",INNER_FOCUS_STROKE_WIDTH:2,OUTER_FOCUS_STROKE_WIDTH:2,OUTLINES_GAP:0,VARIANT:"adaptive"},jt=e=>({gap:e?.gap??Pt.OUTLINES_GAP,innerColor:e?.innerColor??Pt.FOCUS_INNER,innerStrokeWidth:e?.innerStrokeWidth??Pt.INNER_FOCUS_STROKE_WIDTH,outlineColor:e?.outlineColor??Pt.FOCUS_COLOR,outlineStrokeWidth:e?.outlineStrokeWidth??Pt.OUTER_FOCUS_STROKE_WIDTH,variant:e?.variant??Pt.VARIANT}),Dt=["cx","cy","r","x","y","width","height","rx","ry","d","points","x1","y1","x2","y2"],Bt=["stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity"],Mt=["circle","rect","ellipse","path","polygon","polyline","line"];function Xt({elementRef:e,focusConfig:t,isFocused:r}){const a=u.useMemo(()=>jt(t),[t]),[n,i]=u.useState(void 0);return u.useEffect(()=>{if(!e?.current||!r)return void i(void 0);const t=e.current,n=()=>{if("adaptive"===a.variant){const e=function(e,t){const r=e.tagName.toLowerCase();if(!Mt.includes(r))return;const a=e.getAttribute("stroke-width")||e.getAttribute("strokeWidth"),n=parseFloat(a||"0"),i=e.getAttribute("fill"),o="line"===r||"polyline"===r||"path"===r&&"none"===i,s=n+2*(t.outlineStrokeWidth+t.innerStrokeWidth),c=n+2*t.innerStrokeWidth,d=o?e.getAttribute("stroke-linecap")||"round":void 0,u=o?e.getAttribute("stroke-linejoin")||"round":"miter",l=o?void 0:"10",h=function(e){const t={},r=new Set([...Dt,...Bt]);for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];r.has(n.name)&&(t[n.name]=n.value)}return t}(e);return{innerRing:{props:{...h,className:"focus-ring-inner",fill:"none",stroke:t.innerColor,strokeLinecap:d,strokeLinejoin:u,strokeMiterlimit:l,strokeWidth:c},type:r},outerRing:{props:{...h,className:"focus-ring-outer",fill:"none",stroke:t.outlineColor,strokeLinecap:d,strokeLinejoin:u,strokeMiterlimit:l,strokeWidth:s},type:r}}}(t,a);i(e)}if("bounding-box"===a.variant){const e=function(e,t){const r=function(e){try{const t=e.getBBox();if(t.width<=0||t.height<=0)return null;const r=window.getComputedStyle(e),a=parseFloat(r.strokeWidth||"0");return{elementHeight:t.height,elementPosition:{x:t.x+t.width/2,y:t.y+t.height/2},elementStrokeWidth:a,elementWidth:t.width}}catch{return null}}(e);if(!r)return;const a=((e,t)=>{const{elementHeight:r,elementPosition:a,elementStrokeWidth:n,elementWidth:i}=e,{gap:o,innerStrokeWidth:s,outlineStrokeWidth:c}=t,d=i+n+s+2*o,u=r+n+s+2*o,l=d+s+c,h=u+s+c;return{inner:{height:u,width:d,x:a.x-d/2,y:a.y-u/2},outer:{height:h,width:l,x:a.x-l/2,y:a.y-h/2}}})(r,{gap:t.gap,innerStrokeWidth:t.innerStrokeWidth,outlineStrokeWidth:t.outlineStrokeWidth});return{innerRing:{props:{className:"focus-ring-inner",fill:"none",height:a.inner.height,stroke:t.innerColor,strokeWidth:t.innerStrokeWidth,width:a.inner.width,x:a.inner.x,y:a.inner.y},type:"rect"},outerRing:{props:{className:"focus-ring-outer",fill:"none",height:a.outer.height,stroke:t.outlineColor,strokeWidth:t.outlineStrokeWidth,width:a.outer.width,x:a.outer.x,y:a.outer.y},type:"rect"}}}(t,a);i(e)}};n();const o=new MutationObserver(e=>{e.some(e=>"attributes"===e.type&&Dt.includes(e.attributeName??""))&&n()});return o.observe(t,{attributeFilter:[...Dt],attributes:!0}),()=>o.disconnect()},[r,a]),{layers:n,resolvedConfig:a}}const Ft=({dataTestId:e,layers:t})=>t?d.jsxs("g",{className:"focus-ring-container",pointerEvents:"none",children:[u.createElement(t.outerRing.type,{...t.outerRing.props,"data-testid":`${e}-focus-outer`}),u.createElement(t.innerRing.type,{...t.innerRing.props,"data-testid":`${e}-focus-inner`})]}):null,Vt=({children:e,dataTestId:t="focus-ring",disabled:r=!1,focusConfig:a,isFocused:n})=>{const i=u.useRef(null),{layers:o}=Xt({elementRef:i,focusConfig:a,isFocused:n}),s=function(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})}}(i,e.ref),c=u.cloneElement(e,{ref:s});return d.jsxs(d.Fragment,{children:[n&&!r&&d.jsx(Ft,{dataTestId:t,layers:o??void 0}),c]})},Wt=({dataTestId:e="focus-ring",disabled:t=!1,focusConfig:r,isFocused:a,targetRef:n})=>{const{layers:i}=Xt({elementRef:n,focusConfig:r,isFocused:a});return!a||t?null:d.jsx(Ft,{dataTestId:e,layers:i})},Yt=({children:e,dataTestId:t="focus-ring",disabled:r=!1,focusConfig:a,isFocused:n,targetRef:i})=>e?d.jsx(Vt,{dataTestId:t,disabled:r,focusConfig:a,isFocused:n,children:e}):i?d.jsx(Wt,{dataTestId:t,disabled:r,focusConfig:a,isFocused:n,targetRef:i}):null,Kt=({fill:e="#8f8f8f",x:t,y:r})=>d.jsxs("g",{fill:e,pointerEvents:"none",transform:`translate(${t-5}, ${r-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"})]}),Ut=({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))}),Gt=(e,t,r)=>{const a=e.start/Math.max(1,t-1)*r;return{endX:e.end/Math.max(1,t-1)*r,startX:a}},zt=(e,t,r)=>{const a=Math.max(0,Math.min(t,e))/t;return Math.round(a*(r-1))},Zt=(e,t,r=.1)=>{const a=Math.max(0,Math.min(e.start,t-1-r));return{end:Math.min(t-1,Math.max(e.end,a+r)),start:a}},qt=e=>({end:Math.max(0,e-1),start:0}),Jt=(e,t)=>0===e.start&&e.end===t-1,Qt=u.forwardRef(({currentRange:e,dataLength:t,dataTestId:r,endX:a,height:n,onBlur:i,onFocus:o,onKeyDown:s,onMouseDown:c,onTouchStart:u,screenReaderText:l,selectionConfig:h,startX:p},f)=>{const x=h.hideOverlayOnFullRange&&Jt(e,t);return d.jsx(d.Fragment,{children:d.jsx("rect",{ref:f,"aria-label":l,"aria-valuemax":t-1,"aria-valuemin":0,"aria-valuetext":l,cursor:"grab","data-testid":r,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:a-p,x:p,y:0,onBlur:i,onFocus:o,onKeyDown:s,onMouseDown:c,onTouchStart:u})})});Qt.displayName="SelectionArea";const er="#8f8f8f",tr=({dataTestId:e,focusConfig:t,handlerConfig:r,height:a,isFocused:n,max:i,min:o,onBlur:s,onFocus:c,onKeyDown:u,onMouseDown:l,onTouchStart:h,screenReaderText:p,x:f})=>{const x=a/2,R=(e=>({fill:e?.fill||"#ffffff",iconColor:e?.iconColor||er,radius:e?.radius||17,stroke:e?.stroke||er,strokeWidth:e?.strokeWidth||1,verticalLineStroke:e?.verticalLineStroke||er,verticalLineStrokeWidth:e?.verticalLineStrokeWidth||2}))(r);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:a}),d.jsx(Yt,{dataTestId:e,focusConfig:t,isFocused:n,children: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:u,onMouseDown:l,onTouchStart:h})}),d.jsx(Kt,{fill:R.iconColor,x:f,y:x})]})},rr={END_HANDLER:"END_HANDLER",SELECTION_AREA:"SELECTION_AREA",START_HANDLER:"START_HANDLER"},ar=e=>{const{currentRange:t,dataLength:r,interactionConfig:a,onRangeChange:n,width:i}=e,o=u.useRef(null),[s,c]=u.useState(null),d=u.useCallback(e=>()=>{c(e)},[]),l=u.useCallback(e=>()=>{c(e)},[]),h=u.useCallback(e=>{if(!s||!o.current)return;const c=o.current;if(!c)return;const d=e-c.getBoundingClientRect().left,u=zt(d,i,r),l=((e,t,r,a,n)=>{const i={...t};if(e===rr.START_HANDLER)i.start=Math.max(0,Math.min(r,t.end-n.minHandlerDistance));else if(e===rr.END_HANDLER)i.end=Math.min(a-1,Math.max(r,t.start+n.minHandlerDistance));else if(e===rr.SELECTION_AREA){const e=t.end-t.start,n=Math.max(0,Math.min(a-1-e,r-e/2));i.start=n,i.end=n+e}return i})(s,t,u,r,a),h=Zt(l,r,a.minHandlerDistance);n(h)},[s,i,r,t,n,a]),p=u.useCallback(e=>{h(e.clientX)},[h]),f=u.useCallback(e=>{0!==e.touches.length&&(e.preventDefault(),h(e.touches[0].clientX))},[h]),x=u.useCallback(()=>{c(null)},[]),R=u.useCallback(()=>{c(null)},[]);return u.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:l,isDragging:s}},nr=e=>{const{currentRange:t,dataLength:r,interactionConfig:a,onRangeChange:n}=e;return{handleKeyDown:u.useCallback(e=>i=>{const o=i.shiftKey?a.keyboardFastStep:a.keyboardStep;let s={...t};switch(i.key){case"ArrowLeft":case"ArrowDown":i.preventDefault(),s=((e,t,r,a)=>{const n={...t};if(e===rr.START_HANDLER)n.start=Math.max(0,t.start-r);else if(e===rr.END_HANDLER)n.end=Math.max(t.start+a.minHandlerDistance,t.end-r);else if(e===rr.SELECTION_AREA){const e=t.end-t.start,a=Math.max(0,t.start-r);n.start=a,n.end=a+e}return n})(e,t,o,a);break;case"ArrowRight":case"ArrowUp":i.preventDefault(),s=((e,t,r,a,n)=>{const i={...t};if(e===rr.START_HANDLER)i.start=Math.min(t.end-n.minHandlerDistance,t.start+r);else if(e===rr.END_HANDLER)i.end=Math.min(a-1,t.end+r);else if(e===rr.SELECTION_AREA){const e=t.end-t.start,n=Math.min(a-1-e,t.start+r);i.start=n,i.end=n+e}return i})(e,t,o,r,a);break;case"Home":i.preventDefault(),s=((e,t,r)=>{const a={...t};if(e===rr.START_HANDLER)a.start=0;else if(e===rr.END_HANDLER)a.end=r-1;else if(e===rr.SELECTION_AREA){const e=t.end-t.start;a.start=0,a.end=e}return a})(e,t,r);break;case"End":i.preventDefault(),s=((e,t,r,a)=>{const n={...t};if(e===rr.START_HANDLER)n.start=t.end-a.minHandlerDistance;else if(e===rr.END_HANDLER)n.end=r-1;else if(e===rr.SELECTION_AREA){const e=t.end-t.start;n.start=r-1-e,n.end=r-1}return n})(e,t,r,a);break;default:return}const c=Zt(s,r,a.minHandlerDistance);n(c)},[t,r,n,a])}},ir=({canvasConfig:e,dataTestId:t,extraSpace:r=0,height:a,width:n})=>{const[i,o]=u.useState({height:0,width:0}),s=u.useMemo(()=>e||{extraSpace:r,height:a,width:n},[e,n,a,r]),{extraSpace:c,height:d,width:l}=s,p=c?A(c):void 0;u.useEffect(()=>{if(!we())return;const e=(e=>{const t=Pe();return t?t.querySelector(e):null})(`[data-testid="${t}"]`);if(!e)return;const r=()=>{const{parsedCanvasHeight:t,parsedCanvasWidth:r}=Tt({canvasHeight:d,canvasWidth:l,svgElement:e});o({height:t,width:r})};r();const a=new ResizeObserver(()=>{r()});return a.observe(e),()=>{a.disconnect()}},[l,d,t]);const f=u.useMemo(()=>h(i.width,i.height,p),[i.width,i.height,p]);return{parsedCanvas:i,viewBox:f}},or=()=>{const[e,t]=u.useState(null),r=u.useCallback(e=>()=>t(e),[]);return{handleBlur:u.useCallback(()=>{t(null)},[]),handleFocus:r,isFocused:u.useCallback(t=>e===t,[e])}},sr=(e,t)=>{const r=Math.floor(e);return Math.max(0,Math.min(t,r))},cr=(e,t)=>{const r=Math.ceil(e);return Math.max(0,Math.min(t,r))},dr=(e,t)=>{const r=Math.max(0,t-1);return{endIndex:cr(e.end,r),startIndex:sr(e.start,r)}},ur=({data:e,initialRange:t,onDataChange:r})=>{const a=t||qt(e.length),[n,i]=u.useState(a),o=t=>{if(!r||0===e.length)return;const{endIndex:a,startIndex:n}=dr(t,e.length),i=e.slice(n,a+1);r(i)};return u.useEffect(()=>{o(n)},[]),{currentRange:n,handleRangeChange:e=>{i(e),o(e)}}},lr=e=>({keyboardFastStep:e?.keyboardFastStep??2,keyboardStep:e?.keyboardStep??1,minHandlerDistance:e?.minHandlerDistance??1}),hr=e=>{if(0===e.length)return"";if(1===e.length)return`M ${e[0][0]} ${e[0][1]}`;const[t,...r]=e;let a=`M ${t[0]} ${t[1]}`;return r.forEach((e,n)=>{const i=0===n?t:r[n-1],[o,s]=i,[c,d]=e,u=.3*(c-o),l=[o+u,s],h=[c-u,d];a+=` C ${l[0]} ${l[1]}, ${h[0]} ${h[1]}, ${c} ${d}`}),a},pr=(e,t,r,a)=>{if(0===e.length||0===t.length)return[];const n=.05*a,i=a-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((a,o)=>[o/Math.max(1,e.length-1)*r,n+i-(Number(a[t.yKey])-s)/c*i]),d=t.curved?hr(o):`M ${o.map(([e,t])=>`${e},${t}`).join(" L ")}`;let u="";return t.fill&&(u=t.curved?`${hr(o)} L ${r} ${a} L 0 ${a} Z`:`${d} L ${r},${a} L 0,${a} Z`),{config:t,fillPath:u,linePath:d}})},fr=(e,t,r)=>e[r]?.[t]?.toString()||`${r}`,xr=(e,t,r)=>{if(!e)return e;const a=new RegExp("{{startValue}}","g"),n=new RegExp("{{endValue}}","g");return e.replace(a,t).replace(n,r)};exports.Bar=Le,exports.BarChart=rt,exports.BarOrientation=T,exports.ChartText=Me,exports.DefaultCanvasConfig=p,exports.ErrorType=v,exports.FOCUS_DEFAULT=Pt,exports.FocusRing=Yt,exports.ForeignObject=Nt,exports.HandlerIcon=Kt,exports.Line=Be,exports.LineChart=It,exports.LineRenderer=Ut,exports.Node=Ie,exports.NodeType=Ce,exports.Path=$e,exports.PieChart=wt,exports.Positions=y,exports.SelectionArea=Qt,exports.SvgContainer=l,exports.Tick=Xe,exports.TickDataUtils=ht,exports.XAxis=We,exports.YAxis=Ge,exports.ZoomArea=({ariaHidden:e,ariaLabel:t,backgroundColor:r,canvasConfig:a,caption:n,classNames:i,data:o,focusConfig:s,handlerConfig:c,height:h="40px",initialRange:p,interactionConfig:f,lines:R,onDataChange:g,role:_,screenReaderTextConfig:A,selectionConfig:E,width:T="100%",xKey:v,...y})=>{const m="zoom-area",C=lr(f),S=(I=E,{fill:I?.fill??"#0078d4",fillOpacity:I?.fillOpacity??.5,hideOverlayOnFullRange:I?.hideOverlayOnFullRange??true,stroke:I?.stroke??"#0078d4",strokeWidth:I?.strokeWidth??0});var I;const{currentRange:N,handleRangeChange:$}=ur({data:o,initialRange:p,onDataChange:g}),{parsedCanvas:b,viewBox:L}=ir({canvasConfig:a,dataTestId:m,height:h,width:T}),k=x(o),O=JSON.stringify(R),H=u.useRef(null),w=((e,t,r,a)=>{const{endIndex:n,startIndex:i}=dr(r,e.length),o=fr(e,t,i),s=fr(e,t,n),c=xr(a?.startHandler,o,s)??o;return{endHandler:xr(a?.endHandler,o,s)??s,selectionArea:xr(a?.selectionArea,o,s)??`${o} - ${s}`,startHandler:c}})(o,v,N,A),P=u.useMemo(()=>pr(o,R,b.width,b.height),[k,O,b.width,b.height]),{endX:j,startX:D}=u.useMemo(()=>Gt(N,o.length,b.width),[N,k,b.width]),{handleBlur:B,handleFocus:M,isFocused:X}=or(),{handleKeyDown:F}=nr({currentRange:N,dataLength:o.length,interactionConfig:C,onRangeChange:$}),{groupRef:V,handleMouseDown:W,handleTouchStart:Y}=ar({currentRange:N,dataLength:o.length,interactionConfig:C,onRangeChange:$,width:b.width});return d.jsxs(l,{ref:V,ariaHidden:e,ariaLabel:t,backgroundColor:r,caption:n,className:i,"data-testid":m,height:h,overflow:"visible",role:_,viewBox:L,width:T,...y,children:[d.jsx(Ut,{linesData:P}),d.jsx(Qt,{ref:H,currentRange:N,dataLength:o.length,dataTestId:`${m}-selection-area`,endX:j,height:b.height,screenReaderText:w.selectionArea,selectionConfig:S,startX:D,onBlur:B,onFocus:M(rr.SELECTION_AREA),onKeyDown:F(rr.SELECTION_AREA),onMouseDown:W(rr.SELECTION_AREA),onTouchStart:Y(rr.SELECTION_AREA)}),d.jsx(tr,{dataTestId:`${m}-start-handler`,focusConfig:s,handlerConfig:c,height:b.height,isFocused:X(rr.START_HANDLER),max:N.end-C.minHandlerDistance,min:0,screenReaderText:w.startHandler,type:rr.START_HANDLER,value:N.start,x:D,onBlur:B,onFocus:M(rr.START_HANDLER),onKeyDown:F(rr.START_HANDLER),onMouseDown:W(rr.START_HANDLER),onTouchStart:Y(rr.START_HANDLER)}),d.jsx(tr,{dataTestId:`${m}-end-handler`,focusConfig:s,handlerConfig:c,height:b.height,isFocused:X(rr.END_HANDLER),max:o.length-1,min:N.start+C.minHandlerDistance,screenReaderText:w.endHandler,type:rr.END_HANDLER,value:N.end,x:j,onBlur:B,onFocus:M(rr.END_HANDLER),onKeyDown:F(rr.END_HANDLER),onMouseDown:W(rr.END_HANDLER),onTouchStart:Y(rr.END_HANDLER)}),d.jsx(Yt,{dataTestId:"selection-area-focus",focusConfig:{...s,variant:"bounding-box"},isFocused:X(rr.SELECTION_AREA),targetRef:H})]})},exports.ZoomAreaElements=rr,exports.ZoomHandler=tr,exports.calculateHandlerPositions=Gt,exports.calculateLinesPathData=pr,exports.clampRange=Zt,exports.createDefaultRange=qt,exports.generateCurvedPath=hr,exports.getFocusConfig=jt,exports.getInteractionConfig=lr,exports.isFullRange=Jt,exports.mouseToDataIndex=zt,exports.normalizeToArray=e=>Array.isArray(e)?e:[e],exports.useDragInteraction=ar,exports.useKeyboardNavigation=nr,exports.useResponsiveCanvas=ir,exports.useZoomAreaFocus=or,exports.useZoomData=ur;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e,t,r,a,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"),r=Symbol.for("react.portal"),a=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"),x=Symbol.iterator,p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},f=Object.assign,R={};function g(e,t,r){this.props=e,this.context=t,this.refs=R,this.updater=r||p}function A(){}function _(e,t,r){this.props=e,this.context=t,this.refs=R,this.updater=r||p}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 E=_.prototype=new A;E.constructor=_,f(E,g.prototype),E.isPureReactComponent=!0;var T=Array.isArray,y=Object.prototype.hasOwnProperty,v={current:null},m={key:!0,ref:!0,__self:!0,__source:!0};function C(e,r,a){var n,i={},o=null,s=null;if(null!=r)for(n in void 0!==r.ref&&(s=r.ref),void 0!==r.key&&(o=""+r.key),r)y.call(r,n)&&!m.hasOwnProperty(n)&&(i[n]=r[n]);var c=arguments.length-2;if(1===c)i.children=a;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 N(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 $(e,a,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 r:c=!0}}if(c)return o=o(c=e),e=""===i?"."+N(c,0):i,T(o)?(n="",null!=e&&(n=e.replace(I,"$&/")+"/"),$(o,a,n,"",function(e){return e})):null!=o&&(S(o)&&(o=function(e,r){return{$$typeof:t,type:e.type,key:r,ref:e.ref,props:e.props,_owner:e._owner}}(o,n+(!o.key||c&&c.key===o.key?"":(""+o.key).replace(I,"$&/")+"/")+e)),a.push(o)),1;if(c=0,i=""===i?".":i+":",T(e))for(var d=0;d<e.length;d++){var l=i+N(s=e[d],d);c+=$(s,a,n,l,o)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=x&&e[x]||e["@@iterator"])?e:null}(e),"function"==typeof l)for(e=l.call(e),d=0;!(s=e.next()).done;)c+=$(s=s.value,a,n,l=i+N(s,d++),o);else if("object"===s)throw a=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===a?"object with keys {"+Object.keys(e).join(", ")+"}":a)+"). If you meant to render a collection of children, use an array instead.");return c}function k(e,t,r){if(null==e)return e;var a=[],n=0;return $(e,a,"","",function(e){return t.call(r,e,n++)}),a}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,r){k(e,function(){t.apply(this,arguments)},r)},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=a,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,r,a){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!=r){if(void 0!==r.ref&&(o=r.ref,s=v.current),void 0!==r.key&&(i=""+r.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(d in r)y.call(r,d)&&!m.hasOwnProperty(d)&&(n[d]=void 0===r[d]&&void 0!==c?c[d]:r[d])}var d=arguments.length-2;if(1===d)n.children=a;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,r){return b.current.useImperativeHandle(e,t,r)},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,r){return b.current.useReducer(e,t,r)},s.useRef=function(e){return b.current.useRef(e)},s.useState=function(e){return b.current.useState(e)},s.useSyncExternalStore=function(e,t,r){return b.current.useSyncExternalStore(e,t,r)},s.useTransition=function(){return b.current.useTransition()},s.version="18.3.1",s}()),o.exports}var d=(a||(a=1,n.exports=function(){if(r)return i;r=1;var e=c(),t=Symbol.for("react.element"),a=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,r,a){var i,c={},d=null,l=null;for(i in void 0!==a&&(d=""+a),void 0!==r.key&&(d=""+r.key),void 0!==r.ref&&(l=r.ref),r)n.call(r,i)&&!s.hasOwnProperty(i)&&(c[i]=r[i]);if(e&&e.defaultProps)for(i in r=e.defaultProps)void 0===c[i]&&(c[i]=r[i]);return{$$typeof:t,type:e,key:d,ref:l,props:c,_owner:o.current}}return i.Fragment=a,i.jsx=d,i.jsxs=d,i}()),n.exports),l=c();const u=l.forwardRef(({ariaHidden:e,ariaLabel:t,backgroundColor:r,caption:a,children:n,className:i,dataTestId:o,height:s,imageSrc:c,overflow:l,radius:u="0px",role:h,tabIndex:x,viewBox:p,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:r,borderRadius:u,overflow:l},tabIndex:x,viewBox:p,width:f,onMouseDown:e=>e.preventDefault(),...R,children:[a&&d.jsx("title",{children:a}),c&&d.jsx("image",{height:s,href:c,width:f,x:"0",y:"0"}),n]})),h=(e,t,r=0)=>`${-r} ${-r} ${e} ${t}`,x={extraSpace:0,height:80,width:100},p=e=>{const t=new Map,r=()=>{const e={};return t.forEach((t,r)=>{e[r]=t}),e};return{addError:(a,n)=>{if(!n)return;const i={...n,type:a},o=t.get(a)||[];if(o.push(i),t.set(a,o),e){const t=r(),a={};Object.entries(t).forEach(([e,t])=>{const r=e;Array.isArray(t)&&t.length,a[r]=t}),e(a)}},clearErrors:()=>{t.clear(),e&&e({})},getAccumulatedErrors:r}},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 r=t[1];return t[3]===g?16*parseFloat(r):parseFloat(r)},E=l.createContext({}),T={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",PIE_CHART_CONTEXT_ERROR:"PIE_CHART_CONTEXT_ERROR",PIE_CHART_PATH_ERROR:"PIE_CHART_PATH_ERROR",PIE_CHART_SEGMENT_ERROR:"PIE_CHART_SEGMENT_ERROR"},v={BOTTOM:"BOTTOM",CENTER:"CENTER",CUSTOM:"CUSTOM",LEFT:"LEFT",RIGHT:"RIGHT",TOP:"TOP"},m=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,r])=>(e[t]=new Error(r),e),{}),C=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,r])=>(e[t]=new Error(r),e),{}),S=Object.entries({PIE_CHART_EMPTY_DATA:"PieChart data is empty or undefined",PIE_CHART_INNER_RADIUS_OUT_OF_RANGE:"Inner radius must be less than radius",PIE_CHART_INVALID_CANVAS_DIMENSIONS:"Invalid canvas dimensions for PieChart",PIE_CHART_INVALID_DATA_KEY:"Invalid or missing dataKey in PieChart data",PIE_CHART_INVALID_INNER_RADIUS:"Invalid innerRadius value",PIE_CHART_INVALID_RADIUS:"Invalid radius value",PIE_CHART_INVALID_SEGMENT_VALUE:"Invalid segment value (non-numeric)",PIE_CHART_INVALID_TOTAL:"PieChart total value is zero or invalid",PIE_CHART_MISSING_SEGMENT_NAME:"Segment is missing required name property",PIE_CHART_NEGATIVE_SEGMENT_VALUE:"Segment value cannot be negative"}).reduce((e,[t,r])=>(e[t]=new Error(r),e),{}),I=(e,t)=>new Error(`Invalid value "${e}" for bar with dataKey "${t}". Must be a valid number.`),N=(e,t)=>new Error(`Negative value ${e} not allowed for bar with dataKey "${t}" in current configuration`),$=(e,t)=>new Error(`Invalid segment value for "${t}": "${e}" is not a valid number`),k=(e,t)=>new Error(`Negative segment value for "${t}": ${e} (values must be >= 0)`),L=e=>new Error(`DataKey "${e}" not found in PieChart dataset`),b=e=>new Error(`Data array for key "${e}" is empty`),O=(e,t)=>new Error(`Invalid total value for "${e}": ${t} (must be > 0)`),H=(e,t,r)=>new Error(`Invalid group at index ${t} in "${e}": missing required property "${r}"`),w=e=>new Error(`Invalid radius value: "${e}" (must be a positive number)`),P=e=>new Error(`Invalid innerRadius value: "${e}" (must be a positive number or zero)`),M=(e,t)=>new Error(`innerRadius (${e}) must be less than radius (${t}) for donut chart rendering`),B="INVALID_X_TICK",D="BAR_CHART_NO_DATA",j="LINE_CHART_NO_DATA",F="LINE_CHART_PATH_ALL_VALUES_NULL",X="LINE_CHART_PATH_INSUFFICIENT_POINTS",V="LINE_CHART_PATH_INVALID_DATAKEY",W="LINE_CHART_SEPARATOR_INVALID_COORDINATES",K="LINE_CHART_SINGLE_POINT",Y="LINE_CHART_X_AXIS_IDENTICAL_VALUES",U="LINE_CHART_X_AXIS_INSUFFICIENT_TICKS",G="LINE_CHART_X_AXIS_ZERO_LENGTH",z="LINE_CHART_Y_AXIS_IDENTICAL_VALUES",Z="LINE_CHART_Y_AXIS_INSUFFICIENT_TICKS",q="LINE_CHART_Y_AXIS_ZERO_LENGTH",J={...m,...C,...S,INVALID_X_TICK:new Error("[getXTicks] Invalid X tick values calculated")},Q=e=>J[e],ee=e=>new Error(`DataKey "${e}" not found in dataset`),te=(e,t)=>new Error(`Canvas dimensions validation failed: width=${e}, height=${t} (both must be > 0)`),re=e=>new Error(`Invalid xBreakAxis value: '${e}' cannot be parsed as number`),ae=e=>new Error(`Invalid yBreakAxis value: '${e}' cannot be parsed as number`),ne=(e,t,r)=>new Error(`xBreakAxis value ${e} is outside data range (${t} - ${r})`),ie=(e,t,r)=>new Error(`yBreakAxis value ${e} is outside data range (${t} - ${r})`),oe=(e,t,r)=>t.map(t=>{if(isNaN(Number(t))){const r=e.find(e=>String(e.value)===String(t));return r?r.position:0}const{index:a,tick:n}=e.reduce((e,r,a)=>Math.abs(Number(r.value)-Number(t))<=Math.abs(Number(e.tick.value)-Number(t))?{index:a,tick:r}: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[a+1]:e[a-1],h=100*d/Math.abs(Number(u.value)-o),x=Math.abs(n.position-u.position)*h/100;return r?l?n.position+x:n.position-x:l?n.position-x:n.position+x}return n.position}),se="0",ce="1",de="fallbackData";(()=>{if("undefined"!=typeof globalThis&&"process"in globalThis){const e=globalThis.process;return"production"===e?.env?.NODE_ENV}})();const le=e=>e?Object.entries(e).reduce((e,[t,r])=>((t.startsWith("aria-")||t.startsWith("data-")||"role"===t)&&null!=r&&(e[t]=String(r)),e),{}):{},ue=({height:e="140%",width:t="140%",x:r="-20%",y:a="-20%",...n})=>d.jsx("defs",{children:d.jsx("filter",{height:e,id:n.id,width:t,x:r,y:a,children:d.jsx("feDropShadow",{...n.shadowSvgConfig})})}),he=-1/0,xe=l.forwardRef(({dataTestId:e,position:t,size:r=1,...a},n)=>d.jsx("circle",{...a,ref:n,cx:t?.x,cy:t?.y,"data-testid":`${e}-circle`,r:r/2})),pe=(e,t,r,a,n)=>{let i="";const o=a===n,s=o?r:2*r;for(let r=0;r<s;r++){const c=o||r%2==0?a:n,d=2*Math.PI/s*r-Math.PI/2;i+=`${e+Math.cos(d)*c},${t+Math.sin(d)*c} `}return i.trim()},fe=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=pe(t.x,t.y,6,r/2,r/2);return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-hexagon`,points:i})}),Re=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=pe(t.x,t.y,5,r/2,r/2);return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-pentagon`,points:i})}),ge=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>d.jsx("rect",{...a,ref:n,"data-testid":`${e}-square`,height:r,width:r,x:t.x-r/2,y:t.y-r/2})),Ae=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=r/2,o=i/2,s=pe(t.x,t.y,5,i,o);return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-star`,points:s})}),_e=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=`M ${t.x-r/2} ${t.y} H ${t.x+r/2} M ${t.x} ${t.y-r/2} V ${t.y+r/2}`;return d.jsx("path",{...a,ref:n,d:i,"data-testid":`${e}-straight`,strokeWidth:2})}),Ee=l.forwardRef(({dataTestId:e,position:t={x:0,y:0},size:r=1,...a},n)=>{const i=[`${t.x},${t.y-r/2}`,`${t.x-r/2},${t.y+r/2}`,`${t.x+r/2},${t.y+r/2}`].join(" ");return d.jsx("polygon",{...a,ref:n,"data-testid":`${e}-triangle`,points:i})}),Te={Circle:"circle",Hexagon:"hexagon",Pentagon:"pentagon",Square:"square",Star:"star",Straight:"straight",Triangle:"triangle"},ye={[Te.Circle]:xe,[Te.Hexagon]:fe,[Te.Pentagon]:Re,[Te.Square]:ge,[Te.Star]:Ae,[Te.Straight]:_e,[Te.Triangle]:Ee},ve=l.forwardRef(({dataTestId:e="node",haloConfig:t,hasHalo:r=!1,onBlur:a,onClick:n,onDoubleClick:i,onFocus:o,onKeyDown:s,onMouseEnter:c,onMouseLeave:u,position:h={x:0,y:0},size:x=1,type:p=Te.Circle,...f},R)=>{const[g,A]=(e=>{const t=l.useRef(!1),r=l.useRef(null);l.useImperativeHandle(e,()=>r.current,[]);const a=e=>{t.current=!!e.autoClick};return l.useEffect(()=>{if(!r.current)return;const e=r.current;return e.addEventListener("click",a),()=>e.removeEventListener("click",a)},[]),[r,t]})(R),_={...f,className:`node ${f.className}`,onBlur:e=>{a?.(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)}},E={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},T=ye[p];return d.jsxs(d.Fragment,{children:[r&&d.jsx(T,{...E,"aria-hidden":"true",dataTestId:`${e}-halo`,position:h,size:x+x/2}),d.jsx(T,{..._,ref:g,dataTestId:e,position:h,size:x})]})}),me=l.forwardRef(({data:e,nodeConfig:t,tabIndex:r=0,x:a,y:n},i)=>{const o=t?le(t):{};if(o["aria-label"]&&e&&"string"==typeof o["aria-label"]){const t=o["aria-label"];if(t.includes("{{")){const r=((e,t,r)=>{if(!e)return;const a=r??t.dataValue,n=Array.isArray(a)?a[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,r,a)=>{let n=e;return void 0!==t.dataKey&&(n=n.replace(new RegExp("{{dataKey}}","g"),t.dataKey)),n=n.replace(new RegExp("{{xValue}}","g"),r),n=n.replace(new RegExp("{{yValue}}","g"),a),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);r&&(o["aria-label"]=r)}}return d.jsx(d.Fragment,{children:t&&d.jsx(ve,{...t,ref:i,...o,className:"node-path-focus-border",data:e,hasHalo:t.hasHalo,position:{x:a,y:n},tabIndex:r})})}),Ce=l.forwardRef(({classNames:e="",fill:t="transparent",stroke:r="#0000FF",strokeWidth:a="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:x}=((e,t)=>{const[r,a]=l.useState(!1),n=l.useCallback(t=>{a(!0),e?.(t)},[e]);return{handleBlur:l.useCallback(e=>{a(!1),t?.(e)},[t]),handleFocus:n,isFocused:r}})(s.onFocus,s.onBlur),{handleMouseEnter:p,handleMouseLeave:f,isHovered:R}=((e,t)=>{const[r,a]=l.useState(!1);return{handleMouseEnter:l.useCallback(t=>{a(!0),e?.(t)},[e]),handleMouseLeave:l.useCallback(e=>{a(!1),t?.(e)},[t]),isHovered:r}})(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 E=s.gradient&&((e,t="gradientePath")=>{const r=e.split(",").map(e=>e.trim()),a=parseInt(r[0],10),n=r.slice(1).map(e=>{const[t,r]=e.split(" ");return{color:t,offset:r}});let i="0%",o="0%",s="0%";switch(a){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),T=le(s),y={...{...s,classNames:`path ${e}`,fill:E?"url(#gradientePath)":t,filter:"url(#shadow)",role:o,stroke:r,strokeWidth:a},...x&&n,...R&&i};return d.jsxs("g",{ref:_,children:[E&&E,y.shadowSvgConfig&&d.jsx(ue,{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,...T,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:p,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],r)=>{const a={dataKey:y.dataKey,dataValue:y.dataValue,index:r,xKey:y?.xKey};return d.jsx(me,{ref:e=>A.current[r]=e,data:a,nodeConfig:y.nodeConfig,tabIndex:-1,x:e,y:t},`${r.toString()}`)})]})}),Se=(e,t,r)=>e?t+r/2:t-r/2,Ie=({barConfig:e,currentBars:t,endRounded:r,extraSpacing:a=0,order:n=1,orientation:i,startRounded:o,x1:s,x2:c,y1:l,y2:u})=>{const{barWidth:h,singleConfig:x}=e,p=(({barConfig:e,orientation:t,x1:r,x2:a,y1:n,y2:i})=>{const{gap:o=0,singleConfig:s}=e,c=t===T.HORIZONTAL,d=c?r:n,l=c?a:i,u={end:l<d,start:l>d};return s.reduce((e,t,r)=>{const{coverage:a}=t,n=((e,t)=>e/100*t)(a,l-d),i=0===r?d:Se(u.start,e[r-1][1],o),c=r+1===s.length?l:Se(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:x.map((e,f)=>{const[R,g]="HORIZONTAL"===i?p[f]:[s,c],[A,_]="VERTICAL"===i?p[f]:[l,u],E=(({barWidth:e,currentBars:t,endRounded:r=0,extraSpacing:a,order:n,orientation:i,startRounded:o=0,x1:s,x2:c,y1:d,y2:l})=>{let u,h,x,p,f="Z";const R=(({barWidth:e,currentBars:t,extraSpacing:r,order:a,orientation:n})=>{const i=e/2,o=r/2,s=t%2==0,c=s?o:o+i,d=a-Math.ceil(t/2);let l=0;return 0===d?l=s?-o:i:d<0?l=n===T.HORIZONTAL?d*-c+e:d*c:d>0&&(l=n===T.HORIZONTAL?d*-c:d*c+e),l})({barWidth:e,currentBars:t,extraSpacing:a,order:n,orientation:i});if(i===T.HORIZONTAL){const t=s+o,a=c-r;o&&r?(u=`M ${t},${d+R}`,h=`L${a},${l+R}`,x=`Q${c+r} ${l+R-e/2}, ${a} ${l+R-e}`,p=`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}`,x=`L${c},${l+R-e}`,p=`L${t},${d+R-e}`,f=`Q${s-o} ${d+R-e/2}, ${t} ${d+R}`):r?(u=`M${s},${d+R}`,h=`L${a},${l+R}`,x=`Q${c+r} ${l+R-e/2}, ${a} ${l+R-e}`,p=`L${s},${d+R-e}`):(u=`M${s},${d+R}`,h=`L${c},${l+R}`,x=`L${c},${l+R-e}`,p=`L${s},${d+R-e}`)}else{const t=d-o,a=l+r;o&&r?(u=`M${s+R}, ${t}`,h=`L${c+R},${a}`,x=`Q${c+R-e/2} ${l-r}, ${c+R-e} ${a}`,p=`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}`,x=`L${c+R-e},${l}`,p=`L${s+R-e},${t}`,f=`Q${s+R-e/2} ${d+o}, ${s+R} ${t}`):r?(u=`M${s+R},${d}`,h=`L${c+R},${a}`,x=`Q${c+R-e/2} ${l-r}, ${c+R-e} ${a}`,p=`L${c+R-e},${d}`):(u=`M${s+R},${d}`,h=`L${c+R},${l}`,x=`L${c+R-e},${l}`,p=`L${s+R-e},${d}`)}return`${u} ${h} ${x} ${p} ${f}`})({barWidth:h,currentBars:t,endRounded:f===x.length-1&&r?r:void 0,extraSpacing:a,order:n,orientation:i,startRounded:0===f&&o?o:void 0,x1:R,x2:g,y1:A,y2:_});return d.jsx(Ce,{d:E,fill:e.color,hoverConfig:{stroke:"transparent",strokeWidth:"0"},stroke:"transparent",tabIndex:0,title:e.title},`${e.title}-${f.toString()}`)})})},Ne=({barConfig:e,dataIdx:t,dataKey:r,order:a,...n})=>{const{addError:i,xAxisCoordinates:o,yAxisCoordinates:s,...c}=l.useContext(E),{coordinates:u,tickValues:h}=o,{coordinates:x,tickValues:p}=s,f=c.orientation===T.VERTICAL,R=f?c.pKey:r,g=f?r:c.pKey,A=c.data[t],_=A?.[R],y=A?.[g],v=c.data[0],m=!!v&&Object.prototype.hasOwnProperty.call(v,r),C=c.data.length>0,S=Number(y);l.useEffect(()=>{!C||m?isNaN(S)?i?.("BAR_CHART_PATH_ERROR",{error:I(y,r)}):S<0&&i?.("BAR_CHART_PATH_ERROR",{error:N(S,r)}):i?.("BAR_CHART_PATH_ERROR",{error:ee(r)})},[r,C,m,S,y]);const $=oe(h,[String(_)],!0)[0],k=oe(p,[String(y)])[0],L=f?{x1:$,x2:$,y1:u.y1,y2:k}:{x1:x.x1,x2:$,y1:k,y2:k};return d.jsx(Ie,{barConfig:e,currentBars:c.barChildrenCount,extraSpacing:c.gapBetweenBars,order:a,orientation:c.orientation,...L,...n})},$e=e=>{let t=0;return l.Children.toArray(e).forEach(e=>{l.isValidElement(e)&&e.type===Ne&&e.props.order>t&&(t=e.props.order)}),t},ke=e=>{if(0===e.length)return{numeric:{max:2,min:0,step:1}};const t=Math.min(...e.map(e=>parseFloat(e))),r=Math.max(...e.map(e=>parseFloat(e)));return{numeric:{max:r,min:t,step:Math.abs(r-t)/2}}},Le=()=>"undefined"!=typeof window&&"undefined"!=typeof document,be=()=>Le()?document:void 0,Oe=e=>{const t=be();if(t)return t.createElementNS("http://www.w3.org/2000/svg",e)},He=({bound:e,data:t,fontSize:r,svgHeight:a,svgWidth:n,viewBox:i})=>{if(!Le()||!t.length)return 0;const o=be();if(!o)return 0;const s=Oe("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",a),o.body.appendChild(s);const c=t.map(t=>{const a=Oe("text");if(!a)return 0;a.setAttribute("font-size",r),a.textContent=t,s.appendChild(a);const n=a.getBBox()[e];return a.remove(),n});return s.remove(),Math.max(...c,0)},we=({ariaLabel:e,className:t="line",dataTestId:r,...a})=>d.jsx("line",{...a,"aria-label":e,className:t,"data-testid":r}),Pe=({children:e,className:t="circle",...r})=>d.jsx("text",{className:t,...r,children:e}),Me=({showTickLines:e,tick:t,tickLine:r,tickText:a})=>d.jsxs("g",{children:[e&&d.jsx(we,{...r}),a&&d.jsx(Pe,{...a,children:t.value})]}),Be=(e,t,r=1)=>e>=t-r&&e<=t+r,De=e=>{const{ariaLabel:t,className:r,dataTestId:a,opacity:n,stroke:i,strokeDasharray:o,strokeDashoffset:s,strokeLinecap:c,strokeLinejoin:d,strokeOpacity:l,strokeWidth:u,style:h,tabIndex:x,transform:p,x1:f,x2:R,y1:g,y2:A}=e;return{ariaLabel:t,className:r,dataTestId:a,opacity:n,stroke:i,strokeDasharray:o,strokeDashoffset:s,strokeLinecap:c,strokeLinejoin:d,strokeOpacity:l,strokeWidth:u,style:h,tabIndex:x,transform:p,x1:f,x2:R,y1:g,y2:A}},je=({canvasHeight:e=x.height,canvasWidth:t=x.width,cursor:r=0,extraSpace:a={bottom:0,left:0,right:0,top:0},position:n=v.BOTTOM,showTickLines:i=!1,tickLine:o,tickLineHover:s,tickText:c,tickValues:l=[],...u})=>{const h=le(u);return d.jsxs("g",{...h,children:[d.jsx(we,{...De(u)}),l&&l.length>0&&l.map((e,t)=>{const a=Be(r,e.position)&&s?{...o,...s}:o,n="rotate"===c?.transform?`rotate(-30, ${e.position}, ${c.y})`:void 0;return d.jsx(Me,{showTickLines:i,tick:e,tickLine:{...a,x1:e.position,x2:e.position},tickText:{...c,transform:n,x:e.position}},`${t.toString()}`)})]})},Fe=(e,t,r)=>e===v.RIGHT?t+r:t-r,Xe=(e,t,r,a)=>e===v.TOP?r:t+r+a,Ve=({position:e=v.BOTTOM,tickLine:t,tickText:r,...a})=>{const{xAxisCoordinates:{coordinates:n,tickValues:i},...o}=l.useContext(E),s=Xe(e,n.y1,Number(r?.fontSize),r?.top??0),c=o.extraSpaceTopY,u=Number(o.canvasHeight)-o.extraSpaceBottomY;return d.jsx(je,{...n,...a,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:{...r,y:s},tickValues:r?i:void 0})},We=({canvasWidth:e,cursor:t=0,extraSpace:r={bottom:0,left:0,right:0,top:0},position:a=v.LEFT,showTickLines:n=!0,tickLine:i,tickLineHover:o,tickText:s,tickValues:c=[],...l})=>{const u=le(l);return d.jsxs("g",{...u,children:[d.jsx(we,{...De(l)}),c&&c.length>0&&c.map((e,r)=>{const a=Be(t,e.position)&&o?{...i,...o}:i,c="rotate"===s?.transform?`rotate(-30, ${s.x}, ${e.position})`:void 0;return d.jsx(Me,{showTickLines:n,tick:e,tickLine:{...a,y1:e.position,y2:e.position},tickText:{...s,transform:c,y:e.position}},`${r.toString()}`)})]})},Ke=(e,t,r)=>{let a=0;switch(e){case"middle":a=t/2+r;break;case"end":a=t+r;break;default:a=0}return a},Ye=({position:e=v.LEFT,tickLine:t,tickText:r,...a})=>{const{yAxisCoordinates:{coordinates:n,tickValues:i},...o}=l.useContext(E),s=r?.textAnchor||"middle",c=(e===v.RIGHT?r?.right:r?.left)??0,u=Ke(s,o.yAxisText,c),h=Fe(e,n.x1,u);return d.jsx(We,{...n,...a,canvasHeight:Number(o.canvasHeight),canvasWidth:Number(o.canvasWidth),dataTestId:`${o.dataTestId}yAxis`,tickLine:{...t,x1:o.extraSpaceLeftX,x2:Number(o.canvasWidth)-o.extraSpaceRightX},tickText:{...r,x:h},tickValues:r?i:void 0})},Ue=e=>{if(e.custom)return e.custom?.values;if(e.numeric){const{max:t,min:r=0,step:a}=e.numeric;if(a>=Math.abs(t-r)||a<=0)return[r.toString()];const n=[];for(let e=r;e<=t;e+=a)n.push(e.toString());return n}},Ge=(e,t)=>e.flatMap(e=>Object.keys(e).filter(r=>r!==t&&"number"==typeof e[r]).map(t=>Number(e[t]))),ze=(e,t,r,a,n,i,o,s)=>{const{position:c,tickText:d,tickValues:l}=e.props,u=d?.fontSize??0,h=u*a,x=l?Ue(l):t.map(e=>e[r]),p=He({bound:"width",data:x,fontSize:u,svgHeight:`${o}`,svgWidth:`${s}`,viewBox:i}),f=n>p?n:p,R=c===v.BOTTOM?h+(d?.top??0):0,g=c===v.TOP?h+(d?.bottom??0):0;return{barChartXPosition:c||v.BOTTOM,extraSpaceBottomY:R,extraSpaceTopY:g,securityXSpace:f,xBreakAxis:l?.numeric?l.numeric.breakAxis??0:d?.custom?.breakAxis??0,xData:x}},Ze=(e,t,r,a,n,i,o,s)=>{const{position:c,tickText:d,tickValues:l}=e.props,u=d?.fontSize??0,h=u*a,x=l||ke([...new Set(Ge(t,r))]),p=Ue(x),f=n>h?n:h,R=He({bound:"width",data:p,fontSize:u,svgHeight:`${o}`,svgWidth:`${s}`,viewBox:i}),g=c===v.LEFT?R+(d?.right??0):0,A=c===v.RIGHT?R+(d?.left??0):0;return{barChartYPosition:c||v.LEFT,extraSpaceLeftX:g,extraSpaceRightX:A,securityYSpace:f,yAxisText:R,yBreakAxis:l?.numeric?l.numeric.breakAxis??0:d?.custom?.breakAxis??0,yData:p}},qe=({addError:e,ajustedX:t,ajustedY:r,canvasHeight:a,canvasWidth:n,children:i,data:o,gapBetweenBars:s,orientation:c,pKey:d,viewBox:u})=>{let h;if(!o||0===o.length){const t={error:Q(D)};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}if(n<=0||a<=0){const t={error:te(n,a)};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}const x=$e(i),p=20*x,f=(x-1)*s,R=c===T.VERTICAL?n:a;if(p+f>R){const t={error:(g=`Insufficient space: requires ${p+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:[{[de]:0,[d]:se},{[de]:0,[d]:ce}],_=n>0?n:100,E=a>0?a:100,{barChartXPosition:m,barChartYPosition:C,extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:N,extraSpaceTopY:$,securityXSpace:k,securityYSpace:L,xAxisText:b,xBreakAxis:O,xData:H,yAxisText:w,yBreakAxis:P,yData:M}=(({ajustedX:e,ajustedY:t,canvasHeight:r,canvasWidth:a,children:n,data:i,gapBetweenBars:o,orientation:s,pKey:c,viewBox:d})=>{let u={barChartXPosition:v.BOTTOM,barChartYPosition:v.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 x=[];return l.Children.forEach(n,n=>{if(l.isValidElement(n))if(n.type!==Ne||x.includes(n.props.order)||(x.push(n.props.order),h+=n.props.barConfig.barWidth??0),n.type===Ve){const t=s===T.VERTICAL?h:0;u={...u,...ze(n,i,c,e,t,d,r,a)}}else if(n.type===Ye){const e=s===T.HORIZONTAL?h:0;u={...u,...Ze(n,i,c,t,e,d,r,a)}}}),u})({ajustedX:t,ajustedY:r,canvasHeight:E,canvasWidth:_,children:i,data:A,gapBetweenBars:s,orientation:c,pKey:d,viewBox:u}),j=m!==v.TOP&&m!==v.BOTTOM,F=(({initPos:e,maxSpaceAvailable:t,otherAxisSpace:r,securitySpace:a,tickValues:n})=>{const i=n.length-1,o=(t-r-a)/i;return n.map((t,r)=>({position:e+r*o+a/2,value:t}))})({initPos:I,maxSpaceAvailable:_,otherAxisSpace:I+N,securitySpace:k,tickValues:H});if((F??[]).some(({position:e})=>isNaN(e))){const t={error:Q(B)};e?.("BAR_CHART_CONTEXT_ERROR",t),h=t}if(F){const t=F.length<2,r=F.length>=2&&1===new Set(F.map(e=>e.value)).size;if(t){const t={error:Q(U)};e?.("BAR_CHART_X_AXIS_ERROR",t),h||(h=t)}if(r){const t={error:Q(Y)};e?.("BAR_CHART_X_AXIS_ERROR",t),h||(h=t)}}const X=C!==v.LEFT&&C!==v.RIGHT,V=(({initPos:e,maxSpaceAvailable:t,needAjusted:r,otherAxisSpace:a,securitySpace:n,tickValues:i})=>{const o=(t-a-n)/(i.length-1),s=r?n/2:0;return i.map((t,r)=>({position:e-r*o-s,value:t}))})({initPos:E-S,maxSpaceAvailable:E,needAjusted:c===T.HORIZONTAL,otherAxisSpace:$+S,securitySpace:L,tickValues:M});if(V){const t=V.length<2,r=V.length>=2&&1===new Set(V.map(e=>e.value)).size;if(t){const t={error:Q(Z)};e?.("BAR_CHART_Y_AXIS_ERROR",t),h||(h=t)}if(r){const t={error:Q(z)};e?.("BAR_CHART_Y_AXIS_ERROR",t),h||(h=t)}}const W=j?oe(V||[],[String(O)])[0]:0,K=X?oe(F||[],[String(P)])[0]:0,J=(({canvasHeight:e,canvasWidth:t,customBreakAxis:r,extraSpaceBottomY:a,extraSpaceLeftX:n,extraSpaceRightX:i,extraSpaceTopY:o,position:s})=>s===v.TOP?{x1:n,x2:t-i,y1:o,y2:o}:s===v.CENTER?{x1:n,x2:t-i,y1:e/2,y2:e/2}:s===v.CUSTOM?{x1:n,x2:t-i,y1:r,y2:r}:{x1:n,x2:t-i,y1:e-a,y2:e-a})({canvasHeight:E,canvasWidth:_,customBreakAxis:Number(W),extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:N,extraSpaceTopY:$,position:m}),ee=(({canvasHeight:e,canvasWidth:t,customBreakAxis:r,extraSpaceBottomY:a,extraSpaceLeftX:n,extraSpaceRightX:i,extraSpaceTopY:o,position:s})=>s===v.RIGHT?{x1:t-i,x2:t-i,y1:o,y2:e-a}:s===v.CENTER?{x1:t/2,x2:t/2,y1:o,y2:e-a}:s===v.CUSTOM?{x1:r,x2:r,y1:o,y2:e-a}:{x1:n,x2:n,y1:o,y2:e-a})({canvasHeight:E,canvasWidth:_,customBreakAxis:Number(K),extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:N,extraSpaceTopY:$,position:C});if(J.x1===J.x2){const t={error:Q(G)};e?.("BAR_CHART_X_AXIS_ERROR",t),h||(h=t)}if(ee.y1===ee.y2){const t={error:Q(q)};e?.("BAR_CHART_Y_AXIS_ERROR",t),h||(h=t)}const re={addError:e,crossXAxis:j,crossYAxis:X,data:A,extraSpaceBottomY:S,extraSpaceLeftX:I,extraSpaceRightX:N,extraSpaceTopY:$,securityXSpace:k,securityYSpace:L,xAxisCoordinates:{coordinates:J,tickValues:F||(h?[{position:0,value:se},{position:_,value:ce}]:[])},xAxisText:b,yAxisCoordinates:{coordinates:ee,tickValues:V||(h?[{position:E,value:se},{position:0,value:ce}]:[])},yAxisText:w};return h?{...re,error:{...h,type:y.BAR_CHART_CONTEXT_ERROR}}:re},Je=Object.assign(({canvasConfig:e=x,caption:t,children:r,classNames:a,data:n,dataTestId:i,gapBetweenBars:o=0,height:s="100%",onErrors:c,orientation:R,pKey:g,role:A,tabIndex:T,width:y="100%",...v})=>{const{extraSpace:m,height:C,width:S}=e,I=_(S),N=_(C),$=m?_(m):void 0,k=h(I,N,$),L=$e(r),b=2*o,O=[d.jsx(Ve,{},"default-x-axis"),d.jsx(Ye,{},"default-y-axis")],H=l.Children.toArray(r)||[],w=O.concat(H),P=Math.max(I,N,$??0),M=I/P,B=N/P,D=l.useMemo(()=>p(c),[c]),j=f(n),F=l.useMemo(()=>(D.clearErrors(),qe({addError:(e,t)=>{D.addError(e,t)},ajustedX:M,ajustedY:B,canvasHeight:N,canvasWidth:I,children:w,data:n,gapBetweenBars:b,orientation:R,pKey:g,viewBox:k})),[C,S,j,g,R,D.addError]);return d.jsx(u,{caption:t,className:a,dataTestId:i,height:s,role:A,tabIndex:T,viewBox:k,width:y,...v,children:d.jsx(E.Provider,{value:{...F,barChildrenCount:L,canvasExtraSpace:$,canvasHeight:N,canvasWidth:I,data:n,dataTestId:i,gapBetweenBars:o,orientation:R,pKey:g},children:r})})},{Path:Ne,Separator:({areaSeparator:e,dataTestId:t,rightSeparator:r,topSeparator:a,xBreakAxis:n,yBreakAxis:i})=>{const{addError:o,crossXAxis:s,crossYAxis:c,xAxisCoordinates:u,yAxisCoordinates:h}=l.useContext(E),x=u.tickValues,p=h.tickValues,f=void 0!==n?"string"==typeof n?parseFloat(n):n:void 0,R=void 0!==i?"string"==typeof i?parseFloat(i):i:void 0;if(l.useEffect(()=>{if(void 0!==n){const e=x.map(e=>e.value);if(void 0===f||isNaN(f))o?.("BAR_CHART_SEPARATOR_ERROR",{error:re(n)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(f<t||f>r)&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:ne(f,t,r)})}}if(void 0!==i){const e=p.map(e=>e.value);if(void 0===R||isNaN(R))o?.("BAR_CHART_SEPARATOR_ERROR",{error:ae(i)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(R<t||R>r)&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:ie(R,t,r)})}}},[n,f,x,i,R,p]),!a&&!r&&!e)return d.jsx(d.Fragment,{});const g=n&&oe(u.tickValues,[n],!0)[0],A=i&&oe(h.tickValues,[i])[0],_=c?h.coordinates.x1:u.coordinates.x2,T=s?u.coordinates.y1:h.coordinates.y1,y=u.coordinates.x1,v=g??_,m=h.coordinates.y2,C=A??T;l.useEffect(()=>{y===v&&m===C&&o?.("BAR_CHART_SEPARATOR_ERROR",{error:Q(W)})},[y,v,m,C]);const S=`M${y} ${m} H ${v} V ${C} H ${y} Z`,I=`M${y} ${C} H ${v}`,N=`M${v} ${m} V ${C}`;return d.jsxs("g",{children:[d.jsx("path",{d:S,"data-testid":`${t}Area`,...e}),d.jsx("path",{d:I,"data-testid":`${t}Top`,...a}),d.jsx("path",{d:N,"data-testid":`${t}Right`,...r})]})},XAxis:Ve,YAxis:Ye}),Qe=l.createContext({}),et=({curved:e=!1,extendToBottom:t=!1,points:r,svgHeight:a})=>{if(0===r.length)return"";const[n,...i]=r;let o=`M ${n[0]} ${n[1]}`;return o+=e?i.reduce((e,t,a)=>{const[n,i]=r[a],[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]} ${a} L ${n[0]} ${a} Z`),o},tt=(e,t)=>new Error(`Invalid projection bounds - upper projection (${e}) must be below lower projection (${t})`),rt=(e,t)=>new Error(`${t?"Upper":"Lower"} projection X coordinate (${e}) is outside valid range (0-100)`),at=(e,t,r)=>new Error(`${r?"Upper":"Lower"} projection Y coordinate (${e}) is outside chart area (0-${t})`),nt=(e,t)=>{if(!t)return e;const r=t<0,a=e*Math.abs(t)/100;return r?e-a:e+a},it=(e,t,r)=>{if(!r)return e;const a=r<0,n=(0===e?t:e)*Math.abs(r)/100;return a?e+n:e-n},ot=({curved:e,lineProjection:t,points:r,svgHeight:a})=>{const{addError:n}=l.useContext(Qe),{lower:i,shapeColor:o,upper:s}=t,{xProjection:c,yProjection:u,...h}=s||{},{xProjection:x,yProjection:p,...f}=i||{},R=c||u?{x:c,y:u}:void 0,g=x||p?{x:x,y:p}:void 0,A=R?.y,_=g?.y,E=R?.x,T=g?.x;l.useEffect(()=>{if(R&&g){const e=A||0,t=_||0;e>=t&&n?.("LINE_CHART_PROJECTION_ERROR",{error:tt(e,t)})}R&&(void 0!==E&&(E<0||E>100)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:rt(E,!0)}),void 0!==A&&(A<0||A>a)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:at(A,a,!0)})),g&&(void 0!==T&&(T<0||T>100)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:rt(T,!1)}),void 0!==_&&(_<0||_>a)&&n?.("LINE_CHART_PROJECTION_ERROR",{error:at(_,a,!1)}))},[g,T,_,a,R,E,A]);const{downPath:y,shapePath:v,upPath:m}=(({curved:e,lowerProjection:t,points:r,svgHeight:a,upperProjection:n})=>{const i=n||t;if(0===r.length&&!i)return{shapePath:""};const[o,...s]=r,c=`M ${o[0]} ${o[1]}`;let d=c,l=n?c:void 0,u=t?c:void 0;const h=[],x=[];s.forEach(([e,r])=>{const i=n?[nt(e,n.x),it(r,a,n.y)]:[e,r],o=t?[nt(e,-(t.x??0)),it(r,a,-(t.y??0))]:[e,r];h.push(i),x.push(o)});const p=n&&t?[...h,s.at(-1),...x.reverse(),o]:[...h,...x.reverse(),o];return e?(d+=p.reduce((e,t,r)=>{const a=0===r?o:p[r-1],[n,i]=a,[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,r)=>{const a=0===r?o:h[r-1],[n,i]=a,[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+=x.reverse().reduce((e,t,r)=>{const a=0===r?o:x[r-1],[n,i]=a,[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+=p.reduce((e,t)=>`${e} L ${t?.[0]} ${t?.[1]}`,""),l&&(l+=h.reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,"")),u&&(u+=x.reverse().reduce((e,t)=>`${e} L ${t[0]} ${t[1]}`,""))),{downPath:u,shapePath:d,upPath:l}})({curved:e,lowerProjection:g,points:r,svgHeight:a,upperProjection:R});return d.jsxs("g",{className:"pointer-events-none",children:[d.jsx("path",{d:v,fill:o,stroke:"transparent",strokeWidth:"0.1"}),";",m&&d.jsx("path",{d:m,...h}),y&&d.jsx("path",{d:y,...f})]})},st=(e,t)=>e.map(e=>e[t]),ct={formatTicksValues:(e,t)=>e.map(e=>({...e,value:t(e.value)}))},dt=({ariaLabel:e,position:t=v.BOTTOM,tickLine:r,tickText:a,valueFormatter:n=e=>e,...i})=>{const{xAxisCoordinates:{coordinates:o,tickValues:s},xCursor:c,...u}=l.useContext(Qe),h=Xe(t,o.y1,Number(a?.fontSize),a?.top??0),x=a?ct.formatTicksValues(s,n):void 0,p=le(i),f=e||i["aria-label"],R={...i,...p,...f&&{"aria-label":f}};return d.jsx(je,{...o,...R,canvasHeight:Number(u.canvasHeight),canvasWidth:Number(u.canvasWidth),cursor:c,dataTestId:`${u.dataTestId}xAxis`,tickLine:{...r,y1:u.yAxisCoordinates.coordinates.y1,y2:u.yAxisCoordinates.coordinates.y2},tickText:{...a,y:h},tickValues:x})},lt=({tickText:e,textWidth:t,yAxisPosition:r})=>{if(r!==v.LEFT)return 0;if(e?.useAxisAsOrigin){const{textAnchor:r="start"}=e;let a=0;return"end"===r&&(a=t),"middle"===r&&(a=t/2),a+=e.left??0,a-=e.right??0,Math.max(0,a)}const a=e?.textAnchor,n=e?.left??0;return"start"===a?0:"middle"===a?t+n:"end"===a?2*t+n:t/2+n},ut=({tickText:e,textWidth:t,yAxisPosition:r})=>{if(r!==v.RIGHT)return 0;if(e?.useAxisAsOrigin){const{textAnchor:r="start"}=e;let a=t;return"end"===r&&(a=0),"middle"===r&&(a=t/2),a-=e.left??0,a+=e.right??0,Math.max(0,a)}const a=e?.textAnchor,n=e?.right??0;return"start"===a?t:"middle"===a||"end"===a?t+n:2*t-t/2+n},ht=({tickText:e,textWidth:t})=>{const r=e?.textAnchor??"start";return"start"===r?0:"middle"===r?t/2:t},xt=({tickText:e,textWidth:t})=>{const r=e?.textAnchor??"start";return"end"===r?0:"middle"===r?t/2:t},pt=({ariaLabel:e,position:t=v.LEFT,tickLine:r,tickText:a,valueFormatter:n=e=>e,...i})=>{const{yAxisCoordinates:{coordinates:o,tickValues:s},yCursor:c,...u}=l.useContext(Qe),h=(({tickText:e,yAxisPosition:t,textWidth:r,yAxisX1:a})=>{if(e?.useAxisAsOrigin){let t=a;return t+=e.right??0,t-=e.left??0,t}const n=e?.textAnchor||"middle";let i=0;t===v.RIGHT?i=e?.right??0:t===v.LEFT&&(i=e?.left??0);const o=Ke(n,r,i);return Fe(t,a,o)})({tickText:a,yAxisPosition:t,textWidth:u.yAxisText,yAxisX1:o.x1}),x=a?ct.formatTicksValues(s,n):void 0,p=le(i),f=e||i["aria-label"],R={...i,...p,...f&&{"aria-label":f}};return d.jsx(We,{...o,...R,canvasHeight:Number(u.canvasHeight),canvasWidth:Number(u.canvasWidth),cursor:c,dataTestId:`${u.dataTestId}yAxis`,tickLine:{...r,x1:u.xAxisCoordinates.coordinates.x1,x2:u.xAxisCoordinates.coordinates.x2},tickText:{...a,x:h},tickValues:x})},ft={[R]:R,[g]:g},Rt="WIDTH",gt=/^(\d+(\.\d+)?)(px|rem|%)?$/,At=e=>{if("number"==typeof e)return{unit:void 0,value:e};const t=e.match(gt);if(!t)throw new Error(`Invalid string format: "${e}"`);const r=parseFloat(t[1]),a=t[3];return{unit:ft[a],value:r}},_t=(e,t,r)=>{const a=r.parentElement;return a?e/100*(t===Rt?a.clientWidth:a.clientHeight):0},Et=e=>{const t=be();if(!t)return 16*e;const r=(e=>{const t=Le()?window:void 0;if(t)return t.getComputedStyle(e)})(t.documentElement);return r?e*(parseFloat(r.fontSize)||16):16*e},Tt=({canvasHeight:e,canvasWidth:t,svgElement:r})=>{const{unit:a,value:n}=At(t),i=a===R?_t(n,Rt,r):a===g?Et(n):n,{unit:o,value:s}=At(e);return{parsedCanvasHeight:o===R?_t(s,"HEIGHT",r):o===g?Et(s):s,parsedCanvasWidth:i}},yt=e=>{if(e.custom)return e.custom?.values;if(e.numeric){const{max:t,min:r=0,step:a}=e.numeric;if(a>=Math.abs(t-r)||a<=0)return[r.toString(),t.toString()];const n=[];for(let e=r;e<=t;e+=a)n.push(e.toString());return n}},vt=(e,t)=>e.flatMap(e=>Object.keys(e).filter(r=>r!==t&&"number"==typeof e[r]).map(t=>e[t])),mt=({tickValues:e,tickText:t})=>e?.numeric?e.numeric.breakAxis??0:t?.custom?.breakAxis??0,Ct=(e,t,r,a,n,i)=>{const{position:o=v.BOTTOM,tickText:s,tickValues:c,valueFormatter:d}=e.props,l=s?.fontSize??0,u=c?yt(c):t.map(e=>e[r]),h=d?u.map(d):u,x=He({bound:"width",data:h,fontSize:l,svgHeight:`${n}`,svgWidth:`${i}`,viewBox:a}),p=He({bound:"height",data:h,fontSize:l,svgHeight:`${n}`,svgWidth:`${i}`,viewBox:a}),f=o===v.BOTTOM?p+(s?.top??0):0,R=o===v.TOP?p+(s?.bottom??0):0,g=mt({tickValues:c,tickText:s});return{xAxisLeftSpacing:ht({textWidth:x,tickText:s}),xAxisTopSpacing:R,xAxisRightSpacing:xt({textWidth:x,tickText:s}),xAxisBottomSpacing:f,lineChartXPosition:o,xBreakAxis:g,xData:u}},St=(e,t,r,a,n,i)=>{const{position:o=v.LEFT,tickText:s,tickValues:c,valueFormatter:d}=e.props,l=s?.fontSize??0,u=c||ke([...new Set(vt(t,r))]),h=yt(u),x=d?h.map(d):h,p=He({bound:"width",data:x,fontSize:l,svgHeight:`${n}`,svgWidth:`${i}`,viewBox:a}),f=He({bound:"height",data:x,fontSize:l,svgHeight:`${n}`,svgWidth:`${i}`,viewBox:a});return{yAxisLeftSpacing:lt({tickText:s,textWidth:p,yAxisPosition:o}),yAxisTopSpacing:f,yAxisRightSpacing:ut({tickText:s,textWidth:p,yAxisPosition:o}),yAxisBottomSpacing:0,lineChartYPosition:o,yAxisText:p,yBreakAxis:mt({tickValues:c,tickText:s}),yData:h}},It=({addError:e,canvasHeight:t,canvasWidth:r,children:a,data:n,viewBox:i,xKey:o})=>{let s;const{error:c}=(({data:e,addError:t})=>{let r;if(!e||0===e.length){const e={error:Q(j)};t?.("LINE_CHART_CONTEXT_ERROR",e),r=e}if(e&&1===e.length){const e={error:Q(K)};t?.("LINE_CHART_CONTEXT_ERROR",e),r=e}return{error:r}})({data:n,addError:e});c&&(s=c);const{error:d}=(({canvasWidth:e,canvasHeight:t,addError:r})=>{let a;if(e<=0||t<=0){const n={error:te(e,t)};r?.("LINE_CHART_CONTEXT_ERROR",n),a=n}return{error:a}})({canvasWidth:r,canvasHeight:t,addError:e});d&&(s=d);const u=n&&n.length>0?n:[{[o]:"0",y:0},{[o]:"1",y:1}],h=r>0?r:100,x=t>0?t:100,{xAxisLeftSpacing:p,xAxisTopSpacing:f,xAxisRightSpacing:R,xAxisBottomSpacing:g,yAxisLeftSpacing:A,yAxisTopSpacing:_,yAxisRightSpacing:E,yAxisBottomSpacing:T,lineChartXPosition:m,lineChartYPosition:C,xAxisText:S,xBreakAxis:I,xData:N,yAxisText:$,yBreakAxis:k,yData:L}=(({canvasHeight:e,canvasWidth:t,children:r,data:a,viewBox:n,xKey:i})=>{let o={xAxisLeftSpacing:0,xAxisTopSpacing:0,xAxisRightSpacing:0,xAxisBottomSpacing:0,yAxisLeftSpacing:0,yAxisTopSpacing:0,yAxisRightSpacing:0,yAxisBottomSpacing:0,lineChartXPosition:v.BOTTOM,lineChartYPosition:v.LEFT,xAxisText:0,xBreakAxis:0,xData:[],yAxisText:0,yBreakAxis:0,yData:[]};return l.Children.forEach(r,r=>{l.isValidElement(r)&&(r.type===dt?o={...o,...Ct(r,a,i,n,e,t)}:r.type===pt&&(o={...o,...St(r,a,i,n,e,t)}))}),o})({canvasHeight:x,canvasWidth:h,children:a,data:u,viewBox:i,xKey:o}),b=(({tickValues:e,maxSpaceAvailable:t,xAxisLeftSpacing:r,xAxisRightSpacing:a,yAxisLeftSpacing:n,yAxisRightSpacing:i})=>{const o=Math.max(n,r),s=t-Math.max(a,i);if(e.length<=1)return[{position:o,value:e[0]}];const c=(s-o)/(e.length-1);return e.map((e,t)=>({position:o+c*t,value:e}))})({tickValues:N,maxSpaceAvailable:h,xAxisLeftSpacing:p,xAxisRightSpacing:R,yAxisLeftSpacing:A,yAxisRightSpacing:E}),{error:O}=(({xTickValues:e,addError:t})=>{let r;if(e){if((e??[]).some(({position:e})=>isNaN(e))){const e={error:Q(B)};t?.("LINE_CHART_CONTEXT_ERROR",e),r=e}const a=e.length<2,n=e.length>=2&&1===new Set(e.map(e=>e.value)).size;if(a){const e={error:Q(U)};t?.("LINE_CHART_X_AXIS_ERROR",e),r||(r=e)}if(n){const e={error:Q(Y)};t?.("LINE_CHART_X_AXIS_ERROR",e),r||(r=e)}}return{error:r}})({xTickValues:b,addError:e});!s&&O&&(s=O);const H=(({maxSpaceAvailable:e,tickValues:t,xAxisTopSpacing:r,xAxisBottomSpacing:a,yAxisTopSpacing:n,yAxisBottomSpacing:i})=>{const o=e-Math.max(a,i),s=Math.max(n,r);if(t.length<=1)return[{position:o,value:t[0]}];const c=(o-s)/(t.length-1);return t.map((e,t)=>({position:o-c*t,value:e}))})({maxSpaceAvailable:x,tickValues:L,xAxisTopSpacing:f,xAxisBottomSpacing:g,yAxisTopSpacing:_,yAxisBottomSpacing:T}),{error:w}=(({yTickValues:e,addError:t})=>{let r;if(e){const a=e.length<2,n=e.length>=2&&1===new Set(e.map(e=>e.value)).size;if(a){const e={error:Q(Z)};t?.("LINE_CHART_Y_AXIS_ERROR",e),r||(r=e)}if(n){const e={error:Q(z)};t?.("LINE_CHART_Y_AXIS_ERROR",e),r||(r=e)}}return{error:r}})({yTickValues:H,addError:e});!s&&w&&(s=w);const P=m!==v.TOP&&m!==v.BOTTOM,M=C!==v.LEFT&&C!==v.RIGHT,D=P?oe(H||[],[String(I)])[0]:0,F=M?oe(b||[],[String(k)])[0]:0,X=(({lineChartXPosition:e,lineChartYPosition:t,canvasHeight:r,canvasWidth:a,customBreakAxis:n,xAxisLeftSpacing:i,xAxisTopSpacing:o,xAxisRightSpacing:s,xAxisBottomSpacing:c,yAxisLeftSpacing:d,yAxisTopSpacing:l,yAxisRightSpacing:u,yAxisBottomSpacing:h})=>{const x=t===v.LEFT?Math.max(d,i):0,p=t===v.RIGHT?a-Math.max(u,s):a;return e===v.TOP?{x1:x,x2:p,y1:Math.max(l,o),y2:Math.max(l,o)}:e===v.CENTER?{x1:x,x2:p,y1:r/2,y2:r/2}:e===v.CUSTOM?{x1:x,x2:p,y1:n,y2:n}:{x1:x,x2:p,y1:r-Math.max(h,c),y2:r-Math.max(h,c)}})({canvasHeight:x,canvasWidth:h,customBreakAxis:Number(D),lineChartXPosition:m,lineChartYPosition:C,xAxisLeftSpacing:p,xAxisTopSpacing:f,xAxisRightSpacing:R,xAxisBottomSpacing:g,yAxisLeftSpacing:A,yAxisTopSpacing:_,yAxisRightSpacing:E,yAxisBottomSpacing:T}),V=(({lineChartXPosition:e,lineChartYPosition:t,canvasHeight:r,canvasWidth:a,customBreakAxis:n,xAxisLeftSpacing:i,xAxisTopSpacing:o,xAxisRightSpacing:s,xAxisBottomSpacing:c,yAxisLeftSpacing:d,yAxisTopSpacing:l,yAxisRightSpacing:u,yAxisBottomSpacing:h})=>{const x=e===v.TOP?Math.max(l,o):0,p=e===v.BOTTOM?r-Math.max(h,c):r;return t===v.RIGHT?{x1:a-Math.max(u,s),x2:a-Math.max(u,s),y1:x,y2:p}:t===v.CENTER?{x1:a/2,x2:a/2,y1:x,y2:p}:t===v.CUSTOM?{x1:n,x2:n,y1:x,y2:p}:{x1:Math.max(d,i),x2:Math.max(d,i),y1:x,y2:p}})({canvasHeight:x,canvasWidth:h,customBreakAxis:Number(F),lineChartXPosition:m,lineChartYPosition:C,xAxisLeftSpacing:p,xAxisTopSpacing:f,xAxisRightSpacing:R,xAxisBottomSpacing:g,yAxisLeftSpacing:A,yAxisTopSpacing:_,yAxisRightSpacing:E,yAxisBottomSpacing:T}),{error:W}=(({xCoordinates:e,addError:t})=>{let r;if(e.x1===e.x2){const e={error:Q(G)};t?.("LINE_CHART_X_AXIS_ERROR",e),r=e}return{error:r}})({xCoordinates:X,addError:e});!s&&W&&(s=W);const{error:J}=(({yCoordinates:e,addError:t})=>{let r;if(e.y1===e.y2){const e={error:Q(q)};t?.("LINE_CHART_Y_AXIS_ERROR",e),r||(r=e)}return{error:r}})({yCoordinates:V,addError:e});!s&&J&&(s=J);const ee={addError:e,crossXAxis:P,crossYAxis:M,xAxisLeftSpacing:p,xAxisTopSpacing:f,xAxisRightSpacing:R,xAxisBottomSpacing:g,yAxisLeftSpacing:A,yAxisTopSpacing:_,yAxisRightSpacing:E,yAxisBottomSpacing:T,xAxisCoordinates:{coordinates:X,tickValues:b||(s?[{position:0,value:"0"},{position:h,value:"1"}]:[])},xAxisText:S,yAxisCoordinates:{coordinates:V,tickValues:H||(s?[{position:x,value:se},{position:0,value:ce}]:[])},yAxisText:$};return s?{...ee,error:{...s,type:y.LINE_CHART_CONTEXT_ERROR}}:ee},Nt=Object.assign(({ariaHidden:e,ariaLabel:t,canvasConfig:r=x,caption:a,children:n,classNames:i,data:o,dataTestId:s="line-chart",getPathArea:c,height:R="100%",onErrors:g,role:A,tabIndex:E,width:T="100%",xKey:y,...v})=>{const{extraSpace:m,height:C,width:S}=r,[I,N]=l.useState(""),[$,k]=l.useState({height:0,width:0}),L=m?_(m):void 0,b=h($.width,$.height,L),O=[d.jsx(dt,{},"default-x-axis"),d.jsx(pt,{},"default-y-axis")],H=l.Children.toArray(n)||[],w=O.concat(H);(({attrName:e,children:t,originalValue:r,updateValue:a})=>{let n="";l.Children.toArray(t).forEach(t=>{if(l.isValidElement(t)){const r=t.props[e];r&&(n+=r)}}),n!==r&&a(n)})({attrName:"dataKey",children:w,originalValue:I,updateValue:N});const P=l.useMemo(()=>p(g),[g]),M=f(o),B=l.useMemo(()=>(P.clearErrors(),It({addError:(e,t)=>{P.addError(e,t)},canvasHeight:$.height,canvasWidth:$.width,children:w,data:o,viewBox:b,xKey:y})),[$.width,$.height,M,y,I,P.addError]),{svgRef:D,xCursor:j,yCursor:F}=(({canvasHeight:e,canvasWidth:t})=>{const[[r,a],n]=l.useState([he,he]),i=l.useCallback((r,a)=>{const{height:i,left:o,top:s,width:c}=a.getBoundingClientRect(),d=r.clientX-o,l=r.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:r,yCursor:a}})({canvasHeight:$.height,canvasWidth:$.width});return l.useEffect(()=>{const e=document.querySelector("[data-kbt-svg]");if(!e)return;const{parsedCanvasHeight:t,parsedCanvasWidth:r}=Tt({canvasHeight:C,canvasWidth:S,svgElement:e});k({height:t,width:r})},[S,C]),l.useEffect(()=>{c?.({x1:B.xAxisCoordinates.coordinates.x1,y1:B.yAxisCoordinates.coordinates.y1,x2:B.xAxisCoordinates.coordinates.x2,y2:B.yAxisCoordinates.coordinates.y2})},[B.xAxisCoordinates.coordinates.x1,B.yAxisCoordinates.coordinates.y1,B.xAxisCoordinates.coordinates.x2,B.yAxisCoordinates.coordinates.y2,c]),d.jsx(u,{ref:D,ariaHidden:e,ariaLabel:t,caption:a,className:i,"data-kbt-svg":!0,dataTestId:s,height:R,role:A,tabIndex:E,viewBox:b,width:T,...v,children:d.jsx(Qe.Provider,{value:{...B,canvasExtraSpace:L,canvasHeight:$.height,canvasWidth:$.width,data:o,dataTestId:s,xCursor:j,xKey:y,yCursor:F},children:n})})},{Path:({ariaLabel:e,closestClick:t,curved:r,getNodeFocusInfo:a,getNodesCoords:n,indicatorConfig:i,lineProjection:o,onClick:s,...c})=>{const{addError:u,xAxisCoordinates:h,yAxisCoordinates:x,...p}=l.useContext(Qe),f=c.dataKey,R=p.data.length>0,g=p.data[0],A=!!g&&Object.prototype.hasOwnProperty.call(g,f),_=p.data.length;l.useEffect(()=>{if(!f||"string"!=typeof f)return void u?.("LINE_CHART_PATH_ERROR",{error:Q(V)});if(R&&!A)return void u?.("LINE_CHART_PATH_ERROR",{error:ee(f)});if(r&&_<2)return void u?.("LINE_CHART_PATH_ERROR",{error:Q(X)});const e=st(p.data,f);e.length>0&&e.every(e=>null==e)&&u?.("LINE_CHART_PATH_ERROR",{error:Q(F)})},[u,r,f,_,R,A,p.data]);const{indicatorRef:E,pathRef:T}=((e,t)=>{const r=l.useRef(null),a=l.useRef(null);return l.useEffect(()=>{if(!t||!r.current||!a.current)return;const n=r.current,i=a.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:a,pathRef:r}})(p.xCursor,!!i),y=!!i&&p.xCursor!==-1/0,v=l.useRef(null),m=l.useRef(null),{autoClick:C,lineIndicator:S,...I}=i||{},{y1:N,y2:$}=x.coordinates,{x1:k,x2:L}=h.coordinates,b=p.xCursor>=k&&p.xCursor<=L,{tickValues:O}=h,{tickValues:H}=x,w=st(p.data,p.xKey),P=st(p.data,f),M=oe(O,w,!0),B=oe(H,P),D=M.map((e,t)=>[e,B[t]]),j=et({curved:r,extendToBottom:!1,points:D,svgHeight:x.coordinates.y2}),W=et({curved:r,extendToBottom:!!c.fill||!!c.gradient,points:D,svgHeight:x.coordinates.y2});l.useEffect(()=>{if(!v.current?.path)return;T.current=v.current.path;const e=v.current.main,t=v.current.node,r=w.map((e,t)=>({x:e,y:P[t]})),{mount:n,unmount:i}=(({data:e,getNodeFocusInfo:t,nodes:r,ref:a})=>{let n;const i=a.querySelector("[data-draw]"),o=a=>{let i;"ArrowRight"===a.key?i=void 0===n||n===r.length-1?0:n+1:"ArrowLeft"===a.key&&(i=void 0===n||0===n?r.length-1:n-1),void 0!==i&&(n=i,r[n]&&(r[n].focus(),t?.(e[n])))},s=()=>{n=void 0};return{mount:()=>{i?.addEventListener("focus",s),a.addEventListener("keydown",e=>o(e))},unmount:()=>{i?.removeEventListener("focus",s),a.removeEventListener("keydown",e=>o(e))}}})({data:r,getNodeFocusInfo:a,nodes:t,ref:e});return n(),()=>i()},[]),l.useEffect(()=>{if(c.nodeConfig&&y&&C){const{idx:e,match:t}=((e,t)=>{let r=0,a=!1;for(let n=0;n<e.length;n++)if(Math.round(e[n])===Math.round(t)){a=!0,r=n;break}return{idx:r,match:a}})(M,p.xCursor);if(t&&e!==m.current){m.current=e;const t=new MouseEvent("click",{bubbles:!0});t.autoClick=!0,v.current?.node?.[e]?.dispatchEvent(t),navigator?.vibrate?.(200)}else m.current=null}},[p.xCursor]),l.useEffect(()=>{n?.(D)},[D]);const K=le(c),Y={...c,...K,...e&&{"aria-label":e}};return d.jsxs(d.Fragment,{children:[d.jsx(Ce,{ref:v,d:j,dFill:W,dataTestId:`${p.dataTestId}path`,dataValue:p.data,points:D,xKey:p.xKey,onClick:e=>{if(s?.(e),t){const e=((e,t)=>{let r=0,a=Math.abs(e[0]-t);for(let n=1;n<e.length;n++){const i=Math.abs(e[n]-t);i<a&&(r=n,a=i)}return r})(M,p.xCursor),t=new MouseEvent("click",{bubbles:!0});t.autoClick=!1,v.current?.node?.[e]?.dispatchEvent(t)}},...Y}),o&&d.jsx(ot,{curved:r,dataKey:c.dataKey,lineProjection:o,points:D,svgHeight:x.coordinates.y2}),y&&d.jsxs(d.Fragment,{children:[!!S&&b&&d.jsx(we,{...S,className:"pointer-events-none",x1:p.xCursor,x2:p.xCursor,y1:N,y2:$}),d.jsx("g",{ref:E,className:"pointer-events-none",children:d.jsx(ve,{...I})})]})]})},Separator:({areaSeparator:e,dataTestId:t,rightSeparator:r,topSeparator:a,xBreakAxis:n,yBreakAxis:i})=>{const{addError:o,crossXAxis:s,crossYAxis:c,xAxisCoordinates:u,yAxisCoordinates:h}=l.useContext(Qe),x=u.tickValues,p=h.tickValues,f=void 0!==n?"string"==typeof n?parseFloat(n):n:void 0,R=void 0!==i?"string"==typeof i?parseFloat(i):i:void 0;if(l.useEffect(()=>{if(void 0!==n){const e=x.map(e=>e.value);if(void 0===f||isNaN(f))o?.("LINE_CHART_SEPARATOR_ERROR",{error:re(n)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(f<t||f>r)&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:ne(f,t,r)})}}if(void 0!==i){const e=p.map(e=>e.value);if(void 0===R||isNaN(R))o?.("LINE_CHART_SEPARATOR_ERROR",{error:ae(i)});else{const t=Math.min(...e.map(e=>"string"==typeof e?parseFloat(e):e)),r=Math.max(...e.map(e=>"string"==typeof e?parseFloat(e):e));(R<t||R>r)&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:ie(R,t,r)})}}},[n,f,x,i,R,p]),!a&&!r&&!e)return d.jsx(d.Fragment,{});const g=n&&oe(u.tickValues,[n],!0)[0],A=i&&oe(h.tickValues,[i])[0],_=c?h.coordinates.x1:u.coordinates.x2,E=s?u.coordinates.y1:h.coordinates.y1,T=u.coordinates.x1,y=g??_,v=h.coordinates.y2,m=A??E;l.useEffect(()=>{T===y&&v===m&&o?.("LINE_CHART_SEPARATOR_ERROR",{error:Q(W)})},[T,y,v,m]);const C=`M${T} ${v} H ${y} V ${m} H ${T} Z`,S=`M${T} ${m} H ${y}`,I=`M${y} ${v} V ${m}`;return d.jsxs("g",{children:[d.jsx("path",{d:C,"data-testid":`${t}Area`,...e}),d.jsx("path",{d:S,"data-testid":`${t}Top`,...a}),d.jsx("path",{d:I,"data-testid":`${t}Right`,...r})]})},XAxis:dt,YAxis:pt}),$t=({children:e,dataTestId:t,height:r,width:a,x:n,y:i})=>d.jsx("foreignObject",{"data-testid":t,height:r,width:a,x:n,y:i,children:e}),kt=l.createContext({}),Lt=(e,t,r)=>({x:e.x+t*Math.cos(r),y:e.y+t*Math.sin(r)}),bt=({center:e,innerEnd:t,innerRadius:r,singleStroke:a})=>{if(!a)return r>0?`L ${t.x},${t.y}`:`L ${e.x},${e.y}`},Ot="CLOCKWISE",Ht=({canvasHeight:e,canvasWidth:t,color:r="blue",dataKey:a,gap:n,halfChart:i,index:o,innerRadius:s,name:c,radius:u,singleStroke:h,startAngle:x,total:p,value:f,...R})=>{const{addError:g}=l.useContext(kt),A=Number(f),_=void 0!==u?Number(u):void 0,E=void 0!==s?Number(s):void 0,T=c?.trim()||"";l.useEffect(()=>{T||g?.("PIE_CHART_SEGMENT_ERROR",{error:H(a||"unknown",o||0,"name")}),isNaN(A)?g?.("PIE_CHART_SEGMENT_ERROR",{error:$(f,T||`segment-${o}`)}):(A<0&&g?.("PIE_CHART_SEGMENT_ERROR",{error:k(A,T||`segment-${o}`)}),void 0!==_&&(isNaN(_)||_<=0)&&g?.("PIE_CHART_SEGMENT_ERROR",{error:w(u)}),void 0!==E&&((isNaN(E)||E<0)&&g?.("PIE_CHART_SEGMENT_ERROR",{error:P(s)}),void 0!==_&&(isNaN(_)||isNaN(E)||E>=_&&g?.("PIE_CHART_SEGMENT_ERROR",{error:M(E,_)}))))},[a,o,E,_,A,T]);const y=(({canvasHeight:e,canvasWidth:t,customRadius:r,gap:a,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,x=r&&r<h?r:h,p=n?Math.PI:2*Math.PI,f={x:t/2,y:n?e:e/2},R=s?2*d:d,g=100*l/R*p/100,A=a/x,{carryAngle:_,finalAngle:E,initialAngle:T}=(({angleEquivalent:e,direction:t,gapAngle:r,startAngle:a})=>{const n=t===Ot;return{carryAngle:n?a+e:a-e,finalAngle:n?a+e-r/2:a-e+r/2,initialAngle:n?a+r/2:a-r/2}})({angleEquivalent:g,direction:o,gapAngle:A,startAngle:c.current});c.current=_;const y=p*l/R-A<=Math.PI?"0":"1",v=Lt(f,i,T),m=Lt(f,i,E),C=Lt(f,x,T);return(({center:e,innerEnd:t,innerRadius:r,innerStart:a,largeArcFlag:n,outerEnd:i,outerStart:o,radius:s,rotateDirection:c,singleStroke:d})=>{let l,u,h,x,p,f,R,g,A,_;return c===Ot?(l=`M ${o.x},${o.y}`,u=`A ${s},${s} 0 ${n} 1 ${i.x}, ${i.y}`,h=bt({center:e,innerEnd:t,innerRadius:r,singleStroke:d}),x=d?`M ${t.x},${t.y}`:void 0,p=r>0?`A ${r},${r} 0 ${n} 0 ${a.x},${a.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 ${r},${r} 0 ${n} 1 ${a.x},${a.y}`,_=d?void 0:"Z"):(l=`M ${o.x} ${o.y}`,u=`A ${s},${s} 0 ${n},0 ${i.x}, ${i.y}`,h=bt({center:e,innerEnd:t,innerRadius:r,singleStroke:d}),x=d?`M ${t.x},${t.y}`:void 0,p=r>0?`A ${r}, ${r} 0 ${n},1 ${a.x},${a.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 ${r},${r} 0 ${n} 0 ${a.x},${a.y}`,_=d?void 0:"Z"),[l,u,h,x,p,_].concat(d?[f,R,g,A]:[]).filter(Boolean).join(" ")})({center:f,innerEnd:m,innerRadius:i,innerStart:v,largeArcFlag:y,outerEnd:Lt(f,x,E),outerStart:C,radius:x,rotateDirection:o,singleStroke:s})})({canvasHeight:e,canvasWidth:t,customRadius:u,gap:n,halfChart:i,innerRadius:s,singleStroke:h,startAngle:x,total:p,value:f});return d.jsx(Ce,{...R,d:y,dataValue:f,fill:r})},wt=({dataKey:e,fill:t,gap:r,innerRadius:a,radius:n,...i})=>{const o=String(e),{addError:s,canvasHeight:c,canvasWidth:u,data:h,dataTestId:x,halfChart:p}=l.useContext(kt),f=p?0:-Math.PI/2,R=l.useRef(f),g=h[o],A=Object.prototype.hasOwnProperty.call(h,o);l.useEffect(()=>{if(!A)return void s?.("PIE_CHART_PATH_ERROR",{error:L(o)});if(!g||0===g.length)return void s?.("PIE_CHART_PATH_ERROR",{error:b(o)});const e=g.reduce((e,t)=>e+t.value,0);(e<=0||isNaN(e))&&s?.("PIE_CHART_PATH_ERROR",{error:O(o,e)})},[g,A,o]);const E=h[o]?.reduce((e,t)=>e+t.value,0),T=1===h[o]?.length,y=a?_(a):void 0,v=n?_(n):void 0;return h[o]?.length?d.jsx("g",{children:h[o].map((e,a)=>l.createElement(Ht,{...i,...e,key:`${a.toString()}`,canvasHeight:c,canvasWidth:u,color:e.color||t,dataKey:o,dataTestId:`${x}path-${a}`,gap:r,halfChart:p,index:a,innerRadius:y,radius:v,singleStroke:T,startAngle:R,total:E}))}):d.jsx(d.Fragment,{})},Pt=Object.assign(({ariaHidden:e,ariaLabel:t,canvasConfig:r=x,caption:a,children:n,classNames:i,data:o,dataTestId:s="pie-chart",halfChart:c,height:R="100%",onErrors:g,radius:A="50%",role:E,tabIndex:T,width:y="100%",...v})=>{const{extraSpace:m,height:C,width:S}=r,I=_(S),N=_(C),$=m?_(m):void 0,k=h(I,N,$),L=l.useMemo(()=>p(g),[g]),b=f(o),O=l.useMemo(()=>(L.clearErrors(),(({addError:e,canvasHeight:t,canvasWidth:r,children:a,halfChart:n})=>{(r<=0||t<=0)&&e?.("PIE_CHART_CONTEXT_ERROR",{error:te(r,t)});const i=r>0?r:100,o=t>0?t:100;let s,c;l.Children.forEach(a,e=>{if(l.isValidElement(e)&&e.type===wt){const{innerRadius:t}=e.props;if(!t)return;const r=_(t);(!s||r<s)&&(s=r)}}),s&&(c=2*s);const d=c??0,u=n?d/2:d,h=n?o:o/2;return{addError:e,foreignObject:{height:u,width:d,x:i/2-d/2,y:n?h-u:h-u/2}}})({addError:(e,t)=>{L.addError(e,t)},canvasHeight:N,canvasWidth:I,children:n,halfChart:c})),[C,S,c,b,L]);return d.jsx(u,{ariaHidden:e,ariaLabel:t,caption:a,className:i,dataTestId:s,height:R,radius:A,role:E,tabIndex:T,viewBox:k,width:y,...v,children:d.jsx(kt.Provider,{value:{...O,canvasHeight:N,canvasWidth:I,data:o,dataTestId:s,halfChart:c},children:n})})},{Foreign:({children:e,dataTestId:t,height:r,width:a,x:n,y:i,...o})=>{const{dataTestId:s,foreignObject:c}=l.useContext(kt),u=!a&&c?.width?c.width:a,h=!r&&c?.height?c.height:r,x=!n&&c?.x?c.x:n,p=!i&&c?.y?c.y:i,f=!t&&s?`${s}-foreign-object`:t;return d.jsx($t,{...o,dataTestId:f,height:h,width:u,x:x,y:p,children:e})},Path:wt}),Mt={FOCUS_COLOR:"#0078D4",FOCUS_INNER:"#ffffff",INNER_FOCUS_STROKE_WIDTH:2,OUTER_FOCUS_STROKE_WIDTH:2,OUTLINES_GAP:0,VARIANT:"adaptive"},Bt=e=>({gap:e?.gap??Mt.OUTLINES_GAP,innerColor:e?.innerColor??Mt.FOCUS_INNER,innerStrokeWidth:e?.innerStrokeWidth??Mt.INNER_FOCUS_STROKE_WIDTH,outlineColor:e?.outlineColor??Mt.FOCUS_COLOR,outlineStrokeWidth:e?.outlineStrokeWidth??Mt.OUTER_FOCUS_STROKE_WIDTH,variant:e?.variant??Mt.VARIANT}),Dt=["cx","cy","r","x","y","width","height","rx","ry","d","points","x1","y1","x2","y2"],jt=["stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity"],Ft=["circle","rect","ellipse","path","polygon","polyline","line"];function Xt({elementRef:e,focusConfig:t,isFocused:r}){const a=l.useMemo(()=>Bt(t),[t]),[n,i]=l.useState(void 0);return l.useEffect(()=>{if(!e?.current||!r)return void i(void 0);const t=e.current,n=()=>{if("adaptive"===a.variant){const e=function(e,t){const r=e.tagName.toLowerCase();if(!Ft.includes(r))return;const a=e.getAttribute("stroke-width")||e.getAttribute("strokeWidth"),n=parseFloat(a||"0"),i=e.getAttribute("fill"),o="line"===r||"polyline"===r||"path"===r&&"none"===i,s=n+2*(t.outlineStrokeWidth+t.innerStrokeWidth),c=n+2*t.innerStrokeWidth,d=o?e.getAttribute("stroke-linecap")||"round":void 0,l=o?e.getAttribute("stroke-linejoin")||"round":"miter",u=o?void 0:"10",h=function(e){const t={},r=new Set([...Dt,...jt]);for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];r.has(n.name)&&(t[n.name]=n.value)}return t}(e);return{innerRing:{props:{...h,className:"focus-ring-inner",fill:"none",stroke:t.innerColor,strokeLinecap:d,strokeLinejoin:l,strokeMiterlimit:u,strokeWidth:c},type:r},outerRing:{props:{...h,className:"focus-ring-outer",fill:"none",stroke:t.outlineColor,strokeLinecap:d,strokeLinejoin:l,strokeMiterlimit:u,strokeWidth:s},type:r}}}(t,a);i(e)}if("bounding-box"===a.variant){const e=function(e,t){const r=function(e){try{const t=e.getBBox();if(t.width<=0||t.height<=0)return null;const r=window.getComputedStyle(e),a=parseFloat(r.strokeWidth||"0");return{elementHeight:t.height,elementPosition:{x:t.x+t.width/2,y:t.y+t.height/2},elementStrokeWidth:a,elementWidth:t.width}}catch{return null}}(e);if(!r)return;const a=((e,t)=>{const{elementHeight:r,elementPosition:a,elementStrokeWidth:n,elementWidth:i}=e,{gap:o,innerStrokeWidth:s,outlineStrokeWidth:c}=t,d=i+n+s+2*o,l=r+n+s+2*o,u=d+s+c,h=l+s+c;return{inner:{height:l,width:d,x:a.x-d/2,y:a.y-l/2},outer:{height:h,width:u,x:a.x-u/2,y:a.y-h/2}}})(r,{gap:t.gap,innerStrokeWidth:t.innerStrokeWidth,outlineStrokeWidth:t.outlineStrokeWidth});return{innerRing:{props:{className:"focus-ring-inner",fill:"none",height:a.inner.height,stroke:t.innerColor,strokeWidth:t.innerStrokeWidth,width:a.inner.width,x:a.inner.x,y:a.inner.y},type:"rect"},outerRing:{props:{className:"focus-ring-outer",fill:"none",height:a.outer.height,stroke:t.outlineColor,strokeWidth:t.outlineStrokeWidth,width:a.outer.width,x:a.outer.x,y:a.outer.y},type:"rect"}}}(t,a);i(e)}};n();const o=new MutationObserver(e=>{e.some(e=>"attributes"===e.type&&Dt.includes(e.attributeName??""))&&n()});return o.observe(t,{attributeFilter:[...Dt],attributes:!0}),()=>o.disconnect()},[r,a]),{layers:n,resolvedConfig:a}}const Vt=({dataTestId:e,layers:t})=>t?d.jsxs("g",{className:"focus-ring-container",pointerEvents:"none",children:[l.createElement(t.outerRing.type,{...t.outerRing.props,"data-testid":`${e}-focus-outer`}),l.createElement(t.innerRing.type,{...t.innerRing.props,"data-testid":`${e}-focus-inner`})]}):null,Wt=({children:e,dataTestId:t="focus-ring",disabled:r=!1,focusConfig:a,isFocused:n})=>{const i=l.useRef(null),{layers:o}=Xt({elementRef:i,focusConfig:a,isFocused:n}),s=function(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})}}(i,e.ref),c=l.cloneElement(e,{ref:s});return d.jsxs(d.Fragment,{children:[n&&!r&&d.jsx(Vt,{dataTestId:t,layers:o??void 0}),c]})},Kt=({dataTestId:e="focus-ring",disabled:t=!1,focusConfig:r,isFocused:a,targetRef:n})=>{const{layers:i}=Xt({elementRef:n,focusConfig:r,isFocused:a});return!a||t?null:d.jsx(Vt,{dataTestId:e,layers:i})},Yt=({children:e,dataTestId:t="focus-ring",disabled:r=!1,focusConfig:a,isFocused:n,targetRef:i})=>e?d.jsx(Wt,{dataTestId:t,disabled:r,focusConfig:a,isFocused:n,children:e}):i?d.jsx(Kt,{dataTestId:t,disabled:r,focusConfig:a,isFocused:n,targetRef:i}):null,Ut=({fill:e="#8f8f8f",x:t,y:r})=>d.jsxs("g",{fill:e,pointerEvents:"none",transform:`translate(${t-5}, ${r-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"})]}),Gt=({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))}),zt=(e,t,r)=>{const a=e.start/Math.max(1,t-1)*r;return{endX:e.end/Math.max(1,t-1)*r,startX:a}},Zt=(e,t,r)=>{const a=Math.max(0,Math.min(t,e))/t;return Math.round(a*(r-1))},qt=(e,t,r=.1)=>{const a=Math.max(0,Math.min(e.start,t-1-r));return{end:Math.min(t-1,Math.max(e.end,a+r)),start:a}},Jt=e=>({end:Math.max(0,e-1),start:0}),Qt=(e,t)=>0===e.start&&e.end===t-1,er=l.forwardRef(({currentRange:e,dataLength:t,dataTestId:r,endX:a,height:n,onBlur:i,onFocus:o,onKeyDown:s,onMouseDown:c,onTouchStart:l,screenReaderText:u,selectionConfig:h,startX:x},p)=>{const f=h.hideOverlayOnFullRange&&Qt(e,t);return d.jsx(d.Fragment,{children:d.jsx("rect",{ref:p,"aria-label":u,"aria-valuemax":t-1,"aria-valuemin":0,"aria-valuetext":u,cursor:"grab","data-testid":r,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:a-x,x:x,y:0,onBlur:i,onFocus:o,onKeyDown:s,onMouseDown:c,onTouchStart:l})})});er.displayName="SelectionArea";const tr="#8f8f8f",rr=({dataTestId:e,focusConfig:t,handlerConfig:r,height:a,isFocused:n,max:i,min:o,onBlur:s,onFocus:c,onKeyDown:l,onMouseDown:u,onTouchStart:h,screenReaderText:x,x:p})=>{const f=a/2,R=(e=>({fill:e?.fill||"#ffffff",iconColor:e?.iconColor||tr,radius:e?.radius||17,stroke:e?.stroke||tr,strokeWidth:e?.strokeWidth||1,verticalLineStroke:e?.verticalLineStroke||tr,verticalLineStrokeWidth:e?.verticalLineStrokeWidth||2}))(r);return d.jsxs("g",{"data-testid":`${e}-group`,children:[d.jsx("line",{pointerEvents:"none",stroke:R.verticalLineStroke,strokeWidth:R.verticalLineStrokeWidth,x1:p,x2:p,y1:0,y2:a}),d.jsx(Yt,{dataTestId:e,focusConfig:t,isFocused:n,children:d.jsx("circle",{"aria-label":x,"aria-valuemax":i,"aria-valuemin":o,"aria-valuetext":x,cursor:"ew-resize",cx:p,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(Ut,{fill:R.iconColor,x:p,y:f})]})},ar={END_HANDLER:"END_HANDLER",SELECTION_AREA:"SELECTION_AREA",START_HANDLER:"START_HANDLER"},nr=e=>{const{currentRange:t,dataLength:r,interactionConfig:a,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=Zt(d,i,r),u=((e,t,r,a,n)=>{const i={...t};if(e===ar.START_HANDLER)i.start=Math.max(0,Math.min(r,t.end-n.minHandlerDistance));else if(e===ar.END_HANDLER)i.end=Math.min(a-1,Math.max(r,t.start+n.minHandlerDistance));else if(e===ar.SELECTION_AREA){const e=t.end-t.start,n=Math.max(0,Math.min(a-1-e,r-e/2));i.start=n,i.end=n+e}return i})(s,t,l,r,a),h=qt(u,r,a.minHandlerDistance);n(h)},[s,i,r,t,n,a]),x=l.useCallback(e=>{h(e.clientX)},[h]),p=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",x),document.addEventListener("mouseup",f),document.addEventListener("touchmove",p,{passive:!1}),document.addEventListener("touchend",R),()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",f),document.removeEventListener("touchmove",p),document.removeEventListener("touchend",R)}},[s,x,f,p,R]),{groupRef:o,handleMouseDown:d,handleTouchStart:u,isDragging:s}},ir=e=>{const{currentRange:t,dataLength:r,interactionConfig:a,onRangeChange:n}=e;return{handleKeyDown:l.useCallback(e=>i=>{const o=i.shiftKey?a.keyboardFastStep:a.keyboardStep;let s={...t};switch(i.key){case"ArrowLeft":case"ArrowDown":i.preventDefault(),s=((e,t,r,a)=>{const n={...t};if(e===ar.START_HANDLER)n.start=Math.max(0,t.start-r);else if(e===ar.END_HANDLER)n.end=Math.max(t.start+a.minHandlerDistance,t.end-r);else if(e===ar.SELECTION_AREA){const e=t.end-t.start,a=Math.max(0,t.start-r);n.start=a,n.end=a+e}return n})(e,t,o,a);break;case"ArrowRight":case"ArrowUp":i.preventDefault(),s=((e,t,r,a,n)=>{const i={...t};if(e===ar.START_HANDLER)i.start=Math.min(t.end-n.minHandlerDistance,t.start+r);else if(e===ar.END_HANDLER)i.end=Math.min(a-1,t.end+r);else if(e===ar.SELECTION_AREA){const e=t.end-t.start,n=Math.min(a-1-e,t.start+r);i.start=n,i.end=n+e}return i})(e,t,o,r,a);break;case"Home":i.preventDefault(),s=((e,t,r)=>{const a={...t};if(e===ar.START_HANDLER)a.start=0;else if(e===ar.END_HANDLER)a.end=r-1;else if(e===ar.SELECTION_AREA){const e=t.end-t.start;a.start=0,a.end=e}return a})(e,t,r);break;case"End":i.preventDefault(),s=((e,t,r,a)=>{const n={...t};if(e===ar.START_HANDLER)n.start=t.end-a.minHandlerDistance;else if(e===ar.END_HANDLER)n.end=r-1;else if(e===ar.SELECTION_AREA){const e=t.end-t.start;n.start=r-1-e,n.end=r-1}return n})(e,t,r,a);break;default:return}const c=qt(s,r,a.minHandlerDistance);n(c)},[t,r,n,a])}},or=({canvasConfig:e,dataTestId:t,extraSpace:r=0,height:a,width:n})=>{const[i,o]=l.useState({height:0,width:0}),s=l.useMemo(()=>e||{extraSpace:r,height:a,width:n},[e,n,a,r]),{extraSpace:c,height:d,width:u}=s,x=c?_(c):void 0;l.useEffect(()=>{if(!Le())return;const e=(e=>{const t=be();return t?t.querySelector(e):null})(`[data-testid="${t}"]`);if(!e)return;const r=()=>{const{parsedCanvasHeight:t,parsedCanvasWidth:r}=Tt({canvasHeight:d,canvasWidth:u,svgElement:e});o({height:t,width:r})};r();const a=new ResizeObserver(()=>{r()});return a.observe(e),()=>{a.disconnect()}},[u,d,t]);const p=l.useMemo(()=>h(i.width,i.height,x),[i.width,i.height,x]);return{parsedCanvas:i,viewBox:p}},sr=()=>{const[e,t]=l.useState(null),r=l.useCallback(e=>()=>t(e),[]);return{handleBlur:l.useCallback(()=>{t(null)},[]),handleFocus:r,isFocused:l.useCallback(t=>e===t,[e])}},cr=(e,t)=>{const r=Math.floor(e);return Math.max(0,Math.min(t,r))},dr=(e,t)=>{const r=Math.ceil(e);return Math.max(0,Math.min(t,r))},lr=(e,t)=>{const r=Math.max(0,t-1);return{endIndex:dr(e.end,r),startIndex:cr(e.start,r)}},ur=({data:e,initialRange:t,onDataChange:r})=>{const a=t||Jt(e.length),[n,i]=l.useState(a),o=t=>{if(!r||0===e.length)return;const{endIndex:a,startIndex:n}=lr(t,e.length),i=e.slice(n,a+1);r(i)};return l.useEffect(()=>{o(n)},[]),{currentRange:n,handleRangeChange:e=>{i(e),o(e)}}},hr=e=>({keyboardFastStep:e?.keyboardFastStep??2,keyboardStep:e?.keyboardStep??1,minHandlerDistance:e?.minHandlerDistance??1}),xr=e=>{if(0===e.length)return"";if(1===e.length)return`M ${e[0][0]} ${e[0][1]}`;const[t,...r]=e;let a=`M ${t[0]} ${t[1]}`;return r.forEach((e,n)=>{const i=0===n?t:r[n-1],[o,s]=i,[c,d]=e,l=.3*(c-o),u=[o+l,s],h=[c-l,d];a+=` C ${u[0]} ${u[1]}, ${h[0]} ${h[1]}, ${c} ${d}`}),a},pr=(e,t,r,a)=>{if(0===e.length||0===t.length)return[];const n=.05*a,i=a-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((a,o)=>[o/Math.max(1,e.length-1)*r,n+i-(Number(a[t.yKey])-s)/c*i]),d=t.curved?xr(o):`M ${o.map(([e,t])=>`${e},${t}`).join(" L ")}`;let l="";return t.fill&&(l=t.curved?`${xr(o)} L ${r} ${a} L 0 ${a} Z`:`${d} L ${r},${a} L 0,${a} Z`),{config:t,fillPath:l,linePath:d}})},fr=(e,t,r)=>e[r]?.[t]?.toString()||`${r}`,Rr=(e,t,r)=>{if(!e)return e;const a=new RegExp("{{startValue}}","g"),n=new RegExp("{{endValue}}","g");return e.replace(a,t).replace(n,r)};exports.Bar=Ie,exports.BarChart=Je,exports.BarOrientation=T,exports.ChartText=Pe,exports.DefaultCanvasConfig=x,exports.ErrorType=y,exports.FOCUS_DEFAULT=Mt,exports.FocusRing=Yt,exports.ForeignObject=$t,exports.HandlerIcon=Ut,exports.Line=we,exports.LineChart=Nt,exports.LineRenderer=Gt,exports.Node=ve,exports.NodeType=Te,exports.Path=Ce,exports.PieChart=Pt,exports.Positions=v,exports.SelectionArea=er,exports.SvgContainer=u,exports.Tick=Me,exports.TickDataUtils=ct,exports.XAxis=je,exports.YAxis=We,exports.ZoomArea=({ariaHidden:e,ariaLabel:t,backgroundColor:r,canvasConfig:a,caption:n,classNames:i,data:o,focusConfig:s,handlerConfig:c,height:h="40px",initialRange:x,interactionConfig:p,lines:R,onDataChange:g,role:A,screenReaderTextConfig:_,selectionConfig:E,width:T="100%",xKey:y,...v})=>{const m="zoom-area",C=hr(p),S=(I=E,{fill:I?.fill??"#0078d4",fillOpacity:I?.fillOpacity??.5,hideOverlayOnFullRange:I?.hideOverlayOnFullRange??true,stroke:I?.stroke??"#0078d4",strokeWidth:I?.strokeWidth??0});var I;const{currentRange:N,handleRangeChange:$}=ur({data:o,initialRange:x,onDataChange:g}),{parsedCanvas:k,viewBox:L}=or({canvasConfig:a,dataTestId:m,height:h,width:T}),b=f(o),O=JSON.stringify(R),H=l.useRef(null),w=((e,t,r,a)=>{const{endIndex:n,startIndex:i}=lr(r,e.length),o=fr(e,t,i),s=fr(e,t,n),c=Rr(a?.startHandler,o,s)??o;return{endHandler:Rr(a?.endHandler,o,s)??s,selectionArea:Rr(a?.selectionArea,o,s)??`${o} - ${s}`,startHandler:c}})(o,y,N,_),P=l.useMemo(()=>pr(o,R,k.width,k.height),[b,O,k.width,k.height]),{endX:M,startX:B}=l.useMemo(()=>zt(N,o.length,k.width),[N,b,k.width]),{handleBlur:D,handleFocus:j,isFocused:F}=sr(),{handleKeyDown:X}=ir({currentRange:N,dataLength:o.length,interactionConfig:C,onRangeChange:$}),{groupRef:V,handleMouseDown:W,handleTouchStart:K}=nr({currentRange:N,dataLength:o.length,interactionConfig:C,onRangeChange:$,width:k.width});return d.jsxs(u,{ref:V,ariaHidden:e,ariaLabel:t,backgroundColor:r,caption:n,className:i,"data-testid":m,height:h,overflow:"visible",role:A,viewBox:L,width:T,...v,children:[d.jsx(Gt,{linesData:P}),d.jsx(er,{ref:H,currentRange:N,dataLength:o.length,dataTestId:`${m}-selection-area`,endX:M,height:k.height,screenReaderText:w.selectionArea,selectionConfig:S,startX:B,onBlur:D,onFocus:j(ar.SELECTION_AREA),onKeyDown:X(ar.SELECTION_AREA),onMouseDown:W(ar.SELECTION_AREA),onTouchStart:K(ar.SELECTION_AREA)}),d.jsx(rr,{dataTestId:`${m}-start-handler`,focusConfig:s,handlerConfig:c,height:k.height,isFocused:F(ar.START_HANDLER),max:N.end-C.minHandlerDistance,min:0,screenReaderText:w.startHandler,type:ar.START_HANDLER,value:N.start,x:B,onBlur:D,onFocus:j(ar.START_HANDLER),onKeyDown:X(ar.START_HANDLER),onMouseDown:W(ar.START_HANDLER),onTouchStart:K(ar.START_HANDLER)}),d.jsx(rr,{dataTestId:`${m}-end-handler`,focusConfig:s,handlerConfig:c,height:k.height,isFocused:F(ar.END_HANDLER),max:o.length-1,min:N.start+C.minHandlerDistance,screenReaderText:w.endHandler,type:ar.END_HANDLER,value:N.end,x:M,onBlur:D,onFocus:j(ar.END_HANDLER),onKeyDown:X(ar.END_HANDLER),onMouseDown:W(ar.END_HANDLER),onTouchStart:K(ar.END_HANDLER)}),d.jsx(Yt,{dataTestId:"selection-area-focus",focusConfig:{...s,variant:"bounding-box"},isFocused:F(ar.SELECTION_AREA),targetRef:H})]})},exports.ZoomAreaElements=ar,exports.ZoomHandler=rr,exports.calculateHandlerPositions=zt,exports.calculateLinesPathData=pr,exports.clampRange=qt,exports.createDefaultRange=Jt,exports.generateCurvedPath=xr,exports.getFocusConfig=Bt,exports.getInteractionConfig=hr,exports.isFullRange=Qt,exports.mouseToDataIndex=Zt,exports.normalizeToArray=e=>Array.isArray(e)?e:[e],exports.useDragInteraction=nr,exports.useKeyboardNavigation=ir,exports.useResponsiveCanvas=or,exports.useZoomAreaFocus=sr,exports.useZoomData=ur;
|