@verifiedinc-public/shared-ui-elements 3.13.0 → 3.15.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/components/chart/ReasonCodesChart/index.d.ts +42 -0
- package/dist/components/chart/index.d.ts +1 -0
- package/dist/components/chart/index.mjs +1 -1
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/CredentialsDisplay.d.ts +1 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/CredentialsDisplayContext.d.ts +36 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/CredentialsDisplayItem.d.ts +15 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/CredentialsDisplayItemContext.d.ts +43 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/hooks.d.ts +7 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/types.d.ts +66 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/extractTypesFromSchema.d.ts +12 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/filterRepeatedCredentials.d.ts +7 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/findCorrectSchemaProperty.d.ts +7 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/findCredentialsByType.d.ts +8 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/getCredentialTypeDisplayInfo.d.ts +8 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/getCredentialValues.d.ts +9 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/getParentPath.d.ts +6 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/getReferencedSchemaNames.d.ts +8 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/index.d.ts +14 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/isNewCredentialAgainstInstance.d.ts +9 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/isNewCredentialValues.d.ts +6 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/isRequiredCredentialDisplayInfo.d.ts +4 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/isValidInputCredential.d.ts +10 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/makeCredentialDisplayInfoList.d.ts +15 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/sortCredentialsBySchema.d.ts +2 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/transformToFormObject.d.ts +6 -0
- package/dist/components/form/OneClickForm/components/CredentialsDisplay/utils/transformToFormSchema.d.ts +8 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldAtomic.d.ts +5 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldCheckbox.d.ts +6 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldClearAdornment.d.ts +5 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldComposite.d.ts +11 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldGroup.d.ts +13 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldHeader/HeaderSelect/index.d.ts +1 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldHeader/HeaderSelect/styles.d.ts +2 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldHeader/HeaderSelect/utils.d.ts +2 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldHeader/index.d.ts +11 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldInputModeHeader.d.ts +10 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldLabel.d.ts +19 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldLabelText.d.ts +10 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldLeftSide.d.ts +6 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldLegend.d.ts +14 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldPaper.d.ts +13 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldStack.d.ts +9 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldToggleButton.d.ts +9 -0
- package/dist/components/form/OneClickForm/components/DataField/DataFieldValue.d.ts +13 -0
- package/dist/components/form/OneClickForm/components/DataField/formats/DataFieldImage.d.ts +9 -0
- package/dist/components/form/OneClickForm/components/DataField/formats/DataFieldInputAddress.d.ts +9 -0
- package/dist/components/form/OneClickForm/components/DataField/formats/DataFieldInputSelect.d.ts +9 -0
- package/dist/components/form/OneClickForm/components/DataField/formats/DataFieldInputText.d.ts +9 -0
- package/dist/components/form/OneClickForm/components/DataField/formats/index.d.ts +3 -0
- package/dist/components/form/OneClickForm/components/DataField/index.d.ts +5 -0
- package/dist/components/form/OneClickForm/components/DataField/inputs/DataFieldDateInput.d.ts +5 -0
- package/dist/components/form/OneClickForm/components/DataField/inputs/DataFieldImageInput.d.ts +5 -0
- package/dist/components/form/OneClickForm/components/DataField/inputs/DataFieldPhoneInput.d.ts +1 -0
- package/dist/components/form/OneClickForm/components/DataField/inputs/DataFieldSSNInput.d.ts +5 -0
- package/dist/components/form/OneClickForm/components/DataField/inputs/DataFieldSelectInput.d.ts +5 -0
- package/dist/components/form/OneClickForm/components/DataField/inputs/DataFieldTextInput.d.ts +5 -0
- package/dist/components/form/OneClickForm/components/DataField/inputs/index.d.ts +6 -0
- package/dist/components/form/OneClickForm/components/DataField/types.d.ts +19 -0
- package/dist/components/form/OneClickForm/components/DataField/utils/defaults.d.ts +4 -0
- package/dist/components/form/OneClickForm/components/DataField/utils/getCredentialSeparator.d.ts +1 -0
- package/dist/components/form/OneClickForm/components/DataField/utils/hasSomeRequiredEmptyCredential.d.ts +2 -0
- package/dist/components/form/OneClickForm/components/DataField/utils/index.d.ts +3 -0
- package/dist/components/form/OneClickForm/components/shared/CountrySelector.d.ts +10 -0
- package/dist/components/form/OneClickForm/components/shared/DateInput.d.ts +19 -0
- package/dist/components/form/OneClickForm/components/shared/DefaultInput.d.ts +6 -0
- package/dist/components/form/OneClickForm/components/shared/IMaskInput.d.ts +15 -0
- package/dist/components/form/OneClickForm/components/shared/Image.d.ts +16 -0
- package/dist/components/form/OneClickForm/components/shared/ImageEncoded.d.ts +14 -0
- package/dist/components/form/OneClickForm/components/shared/InputMask.d.ts +26 -0
- package/dist/components/form/OneClickForm/components/shared/PhoneInput.d.ts +22 -0
- package/dist/components/form/OneClickForm/components/shared/TextInput.d.ts +15 -0
- package/dist/components/form/OneClickForm/components/shared/TextMaskCustom.d.ts +15 -0
- package/dist/components/form/OneClickForm/components/shared/Textarea.d.ts +14 -0
- package/dist/components/form/OneClickForm/components/shared/When.d.ts +17 -0
- package/dist/components/form/OneClickForm/components/validations/fragments/birthDate.d.ts +4 -0
- package/dist/components/form/OneClickForm/components/validations/fragments/credentials.d.ts +6 -0
- package/dist/components/form/OneClickForm/components/validations/fragments/email.d.ts +2 -0
- package/dist/components/form/OneClickForm/components/validations/fragments/otp.d.ts +2 -0
- package/dist/components/form/OneClickForm/components/validations/fragments/phone.d.ts +3 -0
- package/dist/components/form/OneClickForm/components/validations/fragments/uuid.d.ts +2 -0
- package/dist/components/form/OneClickForm/components/validations/schemas/date.schema.d.ts +2 -0
- package/dist/components/form/OneClickForm/contexts/one-click-form-options.context.d.ts +27 -0
- package/dist/components/form/OneClickForm/hooks/useDebounce.d.ts +1 -0
- package/dist/components/form/OneClickForm/hooks/useDebounceCallback.d.ts +46 -0
- package/dist/components/form/OneClickForm/hooks/usePrevious.d.ts +5 -0
- package/dist/components/form/OneClickForm/hooks/useZipCodeLookup.d.ts +11 -0
- package/dist/components/form/OneClickForm/index.d.ts +14 -0
- package/dist/components/form/OneClickForm/styles/input.d.ts +6 -0
- package/dist/components/form/OneClickForm/types/display-format.d.ts +12 -0
- package/dist/components/form/OneClickForm/types/input-format.d.ts +9 -0
- package/dist/components/form/OneClickForm/types/request.d.ts +16 -0
- package/dist/components/form/OneClickForm/utils/addressFormatter.d.ts +12 -0
- package/dist/components/form/OneClickForm/utils/calendarDateFormatter.d.ts +6 -0
- package/dist/components/form/OneClickForm/utils/compareCredentialData.d.ts +1 -0
- package/dist/components/form/OneClickForm/utils/currencyRangeFormatter.d.ts +6 -0
- package/dist/components/form/OneClickForm/utils/date.d.ts +32 -0
- package/dist/components/form/OneClickForm/utils/formatCredentialValue.d.ts +8 -0
- package/dist/components/form/OneClickForm/utils/image.d.ts +2 -0
- package/dist/components/form/OneClickForm/utils/isAtomicBySchema.d.ts +1 -0
- package/dist/components/form/OneClickForm/utils/isCompositeBySchema.d.ts +1 -0
- package/dist/components/form/OneClickForm/utils/masks.d.ts +3 -0
- package/dist/components/form/OneClickForm/utils/observers.d.ts +33 -0
- package/dist/components/form/OneClickForm/utils/phone.d.ts +31 -0
- package/dist/components/form/OneClickForm/utils/phoneNumberFormatter.d.ts +7 -0
- package/dist/components/form/OneClickForm/utils/regex.d.ts +1 -0
- package/dist/components/form/OneClickForm/utils/ssnFormatter.d.ts +7 -0
- package/dist/components/form/OneClickForm/utils/string.d.ts +14 -0
- package/dist/components/form/OneClickForm/utils/when.d.ts +10 -0
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/index.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/index-BMcFWkjH.mjs +107 -0
- package/package.json +4 -1
- package/dist/shared/index-DPBjdrwv.mjs +0 -104
@@ -0,0 +1,42 @@
|
|
1
|
+
import { ReactElement } from 'react';
|
2
|
+
import { SxProps } from '@mui/material';
|
3
|
+
/**
|
4
|
+
* Props for the ReasonCodesChart component
|
5
|
+
*/
|
6
|
+
interface ReasonCodesChartProps {
|
7
|
+
/**
|
8
|
+
* Data object containing reason codes and their occurrence counts.
|
9
|
+
* The data should follow the structure: Record<string, number>
|
10
|
+
* Example: { OCR001: 150, OCR002: 75 }
|
11
|
+
*/
|
12
|
+
data: Record<string, number> | undefined;
|
13
|
+
/**
|
14
|
+
* Threshold value for the reference line
|
15
|
+
*/
|
16
|
+
threshold?: number;
|
17
|
+
/**
|
18
|
+
* MUI System props object for custom styling of the chart container
|
19
|
+
*/
|
20
|
+
sx?: SxProps;
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* A bar chart component that visualizes reason code occurrences.
|
24
|
+
*
|
25
|
+
* The chart displays reason codes on the x-axis and their counts on the y-axis.
|
26
|
+
* It includes a reference line at y=100 to indicate an unhealthy threshold.
|
27
|
+
* Each reason code is represented by a bar with a light warning color from the theme.
|
28
|
+
*
|
29
|
+
* @example
|
30
|
+
* ```tsx
|
31
|
+
* <ReasonCodesChart
|
32
|
+
* data={{
|
33
|
+
* OCR001: 150,
|
34
|
+
* OCR002: 75
|
35
|
+
* }}
|
36
|
+
* threshold={200}
|
37
|
+
* sx={{ width: 800, height: 400 }}
|
38
|
+
* />
|
39
|
+
* ```
|
40
|
+
*/
|
41
|
+
export declare function ReasonCodesChart({ data, threshold, sx, }: ReasonCodesChartProps): ReactElement;
|
42
|
+
export {};
|
@@ -4,6 +4,7 @@ export * from './SeriesPercentageChart';
|
|
4
4
|
export * from './BigNumber';
|
5
5
|
export * from './SimpleBarChart';
|
6
6
|
export * from './ErrorCodesChart';
|
7
|
+
export * from './ReasonCodesChart';
|
7
8
|
export * from './PieChart';
|
8
9
|
export * from './RiskScorePieChart';
|
9
10
|
export * from './RiskScoreBarChart';
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";import{j as i}from"../../shared/jsx-runtime-DHlBLioN.mjs";import*as P from"react";import{useCallback as te,useMemo as re,createElement as Fe,useState as K,useRef as Ie,useEffect as ge}from"react";import{Box as z,Stack as U,Typography as W,useTheme as F,Paper as Pe}from"@mui/material";import{ResponsiveContainer as Z,LineChart as ze,CartesianGrid as ne,XAxis as ae,YAxis as oe,Label as ye,Tooltip as ie,Legend as ve,Line as Ve,AreaChart as Be,Area as We,ComposedChart as qe,ReferenceLine as be,ReferenceArea as we,Bar as Ke,Sector as je,PieChart as Ue,Pie as Ze,Cell as Ye}from"recharts";import{b as ke,c as Oe}from"../../shared/date-Cq0LS2Mr.mjs";import Y,{Decimal as le}from"decimal.js";import{AnimatePresence as He}from"framer-motion";import{u as Xe}from"../../shared/useCopyToClipboard-BALOSYVW.mjs";import"qrcode";import{u as se}from"../../shared/usePrevious-DyvR1iCQ.mjs";import{a as Je,C as Se}from"../../shared/motions-BBPeWBPV.mjs";import{c as $e,i as Qe,_ as H,s as et,a as $,d as tt,e as rt,f as nt,h as at,j as ot,k as it,l as lt,m as st,n as ct,o as ut,p as dt,u as pt}from"../../shared/index-KVVTzcea.mjs";import{u as mt}from"../../shared/useCounter-BV32zXDQ.mjs";const ft=["ownerState"],ht=["variants"],xt=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function gt(e){return Object.keys(e).length===0}function yt(e){return typeof e=="string"&&e.charCodeAt(0)>96}function ce(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const vt=$e(),bt=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function X({defaultTheme:e,theme:t,themeId:r}){return gt(t)?e:t[r]||t}function wt(e){return e?(t,r)=>r[e]:null}function J(e,t){let{ownerState:r}=t,n=H(t,ft);const o=typeof e=="function"?e($({ownerState:r},n)):e;if(Array.isArray(o))return o.flatMap(l=>J(l,$({ownerState:r},n)));if(o&&typeof o=="object"&&Array.isArray(o.variants)){const{variants:l=[]}=o;let a=H(o,ht);return l.forEach(s=>{let c=!0;typeof s.props=="function"?c=s.props($({ownerState:r},n,r)):Object.keys(s.props).forEach(d=>{r?.[d]!==s.props[d]&&n[d]!==s.props[d]&&(c=!1)}),c&&(Array.isArray(a)||(a=[a]),a.push(typeof s.style=="function"?s.style($({ownerState:r},n,r)):s.style))}),a}return o}function jt(e={}){const{themeId:t,defaultTheme:r=vt,rootShouldForwardProp:n=ce,slotShouldForwardProp:o=ce}=e,l=a=>tt($({},a,{theme:X($({},a,{defaultTheme:r,themeId:t}))}));return l.__mui_systemSx=!0,(a,s={})=>{Qe(a,g=>g.filter(k=>!(k!=null&&k.__mui_systemSx)));const{name:c,slot:d,skipVariantsResolver:m,skipSx:x,overridesResolver:p=wt(bt(d))}=s,f=H(s,xt),S=m!==void 0?m:d&&d!=="Root"&&d!=="root"||!1,y=x||!1;let w,v=ce;d==="Root"||d==="root"?v=n:d?v=o:yt(a)&&(v=void 0);const b=et(a,$({shouldForwardProp:v,label:w},f)),j=g=>typeof g=="function"&&g.__emotion_real!==g||rt(g)?k=>J(g,$({},k,{theme:X({theme:k.theme,defaultTheme:r,themeId:t})})):g,A=(g,...k)=>{let L=j(g);const T=k?k.map(j):[];c&&p&&T.push(u=>{const h=X($({},u,{defaultTheme:r,themeId:t}));if(!h.components||!h.components[c]||!h.components[c].styleOverrides)return null;const O=h.components[c].styleOverrides,M={};return Object.entries(O).forEach(([_,C])=>{M[_]=J(C,$({},u,{theme:h}))}),p(u,M)}),c&&!S&&T.push(u=>{var h;const O=X($({},u,{defaultTheme:r,themeId:t})),M=O==null||(h=O.components)==null||(h=h[c])==null?void 0:h.variants;return J({variants:M},$({},u,{theme:O}))}),y||T.push(l);const E=T.length-k.length;if(Array.isArray(g)&&E>0){const u=new Array(E).fill("");L=[...g,...u],L.raw=[...g.raw,...u]}const R=b(L,...T);return a.muiName&&(R.muiName=a.muiName),R};return b.withConfig&&(A.withConfig=b.withConfig),A}}const kt=jt(),Ot=(e,t)=>e.filter(r=>t.includes(r)),V=(e,t,r)=>{const n=e.keys[0];Array.isArray(t)?t.forEach((o,l)=>{r((a,s)=>{l<=e.keys.length-1&&(l===0?Object.assign(a,s):a[e.up(e.keys[l])]=s)},o)}):t&&typeof t=="object"?(Object.keys(t).length>e.keys.length?e.keys:Ot(e.keys,Object.keys(t))).forEach(o=>{if(e.keys.indexOf(o)!==-1){const l=t[o];l!==void 0&&r((a,s)=>{n===o?Object.assign(a,s):a[e.up(o)]=s},l)}}):(typeof t=="number"||typeof t=="string")&&r((o,l)=>{Object.assign(o,l)},t)};function G(e){return e?`Level${e}`:""}function q(e){return e.unstable_level>0&&e.container}function Te(e){return function(t){return`var(--Grid-${t}Spacing${G(e.unstable_level)})`}}function ue(e){return function(t){return e.unstable_level===0?`var(--Grid-${t}Spacing)`:`var(--Grid-${t}Spacing${G(e.unstable_level-1)})`}}function de(e){return e.unstable_level===0?"var(--Grid-columns)":`var(--Grid-columns${G(e.unstable_level-1)})`}const St=({theme:e,ownerState:t})=>{const r=Te(t),n={};return V(e.breakpoints,t.gridSize,(o,l)=>{let a={};l===!0&&(a={flexBasis:0,flexGrow:1,maxWidth:"100%"}),l==="auto"&&(a={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),typeof l=="number"&&(a={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${l} / ${de(t)}${q(t)?` + ${r("column")}`:""})`}),o(n,a)}),n},$t=({theme:e,ownerState:t})=>{const r={};return V(e.breakpoints,t.gridOffset,(n,o)=>{let l={};o==="auto"&&(l={marginLeft:"auto"}),typeof o=="number"&&(l={marginLeft:o===0?"0px":`calc(100% * ${o} / ${de(t)})`}),n(r,l)}),r},Tt=({theme:e,ownerState:t})=>{if(!t.container)return{};const r=q(t)?{[`--Grid-columns${G(t.unstable_level)}`]:de(t)}:{"--Grid-columns":12};return V(e.breakpoints,t.columns,(n,o)=>{n(r,{[`--Grid-columns${G(t.unstable_level)}`]:o})}),r},At=({theme:e,ownerState:t})=>{if(!t.container)return{};const r=ue(t),n=q(t)?{[`--Grid-rowSpacing${G(t.unstable_level)}`]:r("row")}:{};return V(e.breakpoints,t.rowSpacing,(o,l)=>{var a;o(n,{[`--Grid-rowSpacing${G(t.unstable_level)}`]:typeof l=="string"?l:(a=e.spacing)==null?void 0:a.call(e,l)})}),n},Rt=({theme:e,ownerState:t})=>{if(!t.container)return{};const r=ue(t),n=q(t)?{[`--Grid-columnSpacing${G(t.unstable_level)}`]:r("column")}:{};return V(e.breakpoints,t.columnSpacing,(o,l)=>{var a;o(n,{[`--Grid-columnSpacing${G(t.unstable_level)}`]:typeof l=="string"?l:(a=e.spacing)==null?void 0:a.call(e,l)})}),n},Et=({theme:e,ownerState:t})=>{if(!t.container)return{};const r={};return V(e.breakpoints,t.direction,(n,o)=>{n(r,{flexDirection:o})}),r},Ct=({ownerState:e})=>{const t=Te(e),r=ue(e);return $({minWidth:0,boxSizing:"border-box"},e.container&&$({display:"flex",flexWrap:"wrap"},e.wrap&&e.wrap!=="wrap"&&{flexWrap:e.wrap},{margin:`calc(${t("row")} / -2) calc(${t("column")} / -2)`},e.disableEqualOverflow&&{margin:`calc(${t("row")} * -1) 0px 0px calc(${t("column")} * -1)`}),(!e.container||q(e))&&$({padding:`calc(${r("row")} / 2) calc(${r("column")} / 2)`},(e.disableEqualOverflow||e.parentDisableEqualOverflow)&&{padding:`${r("row")} 0px 0px ${r("column")}`}))},Nt=e=>{const t=[];return Object.entries(e).forEach(([r,n])=>{n!==!1&&n!==void 0&&t.push(`grid-${r}-${String(n)}`)}),t},Lt=(e,t="xs")=>{function r(n){return n===void 0?!1:typeof n=="string"&&!Number.isNaN(Number(n))||typeof n=="number"&&n>0}if(r(e))return[`spacing-${t}-${String(e)}`];if(typeof e=="object"&&!Array.isArray(e)){const n=[];return Object.entries(e).forEach(([o,l])=>{r(l)&&n.push(`spacing-${o}-${String(l)}`)}),n}return[]},_t=e=>e===void 0?[]:typeof e=="object"?Object.entries(e).map(([t,r])=>`direction-${t}-${r}`):[`direction-xs-${String(e)}`],Dt=["className","children","columns","container","component","direction","wrap","spacing","rowSpacing","columnSpacing","disableEqualOverflow","unstable_level"],Mt=$e(),Gt=kt("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,t)=>t.root});function Ft(e){return lt({props:e,name:"MuiGrid",defaultTheme:Mt})}function It(e={}){const{createStyledComponent:t=Gt,useThemeProps:r=Ft,componentName:n="MuiGrid"}=e,o=P.createContext(void 0),l=(c,d)=>{const{container:m,direction:x,spacing:p,wrap:f,gridSize:S}=c,y={root:["root",m&&"container",f!=="wrap"&&`wrap-xs-${String(f)}`,..._t(x),...Nt(S),...m?Lt(p,d.breakpoints.keys[0]):[]]};return st(y,w=>ct(n,w),{})},a=t(Tt,Rt,At,St,Et,Ct,$t),s=P.forwardRef(function(c,d){var m,x,p,f,S,y,w,v;const b=nt(),j=r(c),A=at(j),g=P.useContext(o),{className:k,children:L,columns:T=12,container:E=!1,component:R="div",direction:u="row",wrap:h="wrap",spacing:O=0,rowSpacing:M=O,columnSpacing:_=O,disableEqualOverflow:C,unstable_level:N=0}=A,Q=H(A,Dt);let B=C;N&&C!==void 0&&(B=c.disableEqualOverflow);const me={},fe={},he={};Object.entries(Q).forEach(([D,I])=>{b.breakpoints.values[D]!==void 0?me[D]=I:b.breakpoints.values[D.replace("Offset","")]!==void 0?fe[D.replace("Offset","")]=I:he[D]=I});const Le=(m=c.columns)!=null?m:N?void 0:T,_e=(x=c.spacing)!=null?x:N?void 0:O,De=(p=(f=c.rowSpacing)!=null?f:c.spacing)!=null?p:N?void 0:M,Me=(S=(y=c.columnSpacing)!=null?y:c.spacing)!=null?S:N?void 0:_,xe=$({},A,{level:N,columns:Le,container:E,direction:u,wrap:h,spacing:_e,rowSpacing:De,columnSpacing:Me,gridSize:me,gridOffset:fe,disableEqualOverflow:(w=(v=B)!=null?v:g)!=null?w:!1,parentDisableEqualOverflow:g}),Ge=l(xe,b);let ee=i.jsx(a,$({ref:d,as:R,ownerState:xe,className:ot(Ge.root,k)},he,{children:P.Children.map(L,D=>{if(P.isValidElement(D)&&it(D,["Grid"])){var I;return P.cloneElement(D,{unstable_level:(I=D.props.unstable_level)!=null?I:N+1})}return D})}));return B!==void 0&&B!==(g??!1)&&(ee=i.jsx(o.Provider,{value:B,children:ee})),ee});return s.muiName="Grid",s}const Ae=It({createStyledComponent:ut("div",{name:"MuiGrid2",slot:"Root",overridesResolver:(e,t)=>t.root}),componentName:"MuiGrid2",useThemeProps:e=>dt({props:e,name:"MuiGrid2"})});function Pt({entry:e,payload:t}){const r=te(x=>{var p,f,S;return(S=(f=(p=x.payload)==null?void 0:p.data)==null?void 0:f.reduce)==null?void 0:S.call(f,(y,w)=>y+w.value,0)},[]),n=te(x=>{const p=new le(r(x)||0),f=t?.reduce((w,v)=>w+r(v),0)||0,S=new le(f),y=Number(p.div(S).times(100).toFixed(2,le.ROUND_DOWN));return isNaN(y)||!isFinite(y)?0:y},[r,t]),o=re(()=>r(e),[e,r]),l=se(o),a=re(()=>Number(n(e)),[e,n]),s=se(a),c=te(x=>Math.floor(x).toLocaleString(),[]),d=Xe({type:"text/plain"}),m=pt();return i.jsxs(Je,{component:"li",direction:"row",spacing:1,sx:{color:e.color},layout:"position",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[i.jsx(z,{sx:{width:"3px",height:"100%",backgroundColor:e.color,borderRadius:3}}),i.jsxs(U,{children:[i.jsxs(W,{component:"p",variant:"caption",children:[i.jsx(U,{component:"span",display:"inline-flex",mr:.5,children:i.jsx(Se,{from:l??0,to:o,map:c,children:"0"})}),i.jsxs(U,{component:"span",direction:"row",display:"inline-flex",children:["(",i.jsx(Se,{from:s??0,to:a,map:c,children:"0"}),"%)"]})]}),i.jsx(W,{variant:"body1",children:e.value}),e.payload.uuid&&i.jsxs(W,{variant:"body2",sx:{cursor:"pointer","&:hover":{textDecoration:"underline"}},onClick:()=>{d.copy(e.payload.uuid).catch(()=>{}),m.enqueueSnackbar("UUID copied to clipboard","success")},children:[e.payload.uuid.slice(0,5),"..."]})]})]})}function Re(e){const{payload:t}=e;return i.jsx(Ae,{container:!0,direction:"row",component:"ul",gap:2,sx:{mt:2,justifyContent:"flex-start",alignItem:"center",flexWrap:"wrap"},children:i.jsx(He,{children:t?.map(r=>i.jsx(Ae,{children:i.jsx(Pt,{entry:r,payload:t})},`item-${r.value}`))})})}function zt(e){const t=F();return i.jsx(z,{sx:{width:"100%",height:"100%",...e.sx},children:i.jsx(Z,{children:i.jsxs(ze,{width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[i.jsx(ne,{vertical:!1}),i.jsx(ae,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:r=>ke(r,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),i.jsx(oe,{textAnchor:"end",dataKey:"value",tickLine:!1,tickFormatter:r=>Number(r).toLocaleString(),allowDecimals:!1,domain:[1,"dataMax"],children:e.label&&i.jsx(ye,{value:e.label,angle:-90,position:"insideLeft",style:{textAnchor:"middle"}})}),i.jsx(ie,{cursor:{stroke:t.palette.neutral.main,strokeWidth:1},formatter:r=>Number(r).toLocaleString(),labelFormatter:r=>Oe(r,{timeZone:e.filter.timezone,hour12:!1})}),i.jsx(ve,{content:i.jsx(Re,{})}),e.data.map(r=>Fe(Ve,{uuid:r.uuid,key:r.uuid,name:r.name,dataKey:"value",data:r.chartData,type:"monotone",stroke:r.color,strokeWidth:2}))]})})})}const Vt=(e,t)=>{const r=new Map;return e.forEach(n=>{n.chartData.forEach(o=>{const l=new Date(o.date).getTime().toString();if(!r.has(l)){const a={date:l,total:0,diff:0,totalKey:"",originalTotal:0};t.forEach(({key:s})=>{a[s]=0,a[`${s}_absolute`]=0}),r.set(l,a)}t.forEach(({key:a})=>{const s=r.get(l),c=o[a],d=typeof c=="string"?c.trim()===""?0:parseInt(c,10):typeof c=="number"?c:0;s[`${a}_absolute`]=d,s[a]=0})})}),Array.from(r.values()).map(n=>{var o;const l=(o=t.find(c=>c.isTotal))==null?void 0:o.key,a=t.filter(c=>!c.isTotal).map(c=>c.key);if(!l||a.length===0)return n;const s=n[`${l}_absolute`];return n.originalTotal=s,n.total=s,n[l]=100,a.forEach(c=>{const d=n[`${c}_absolute`],m=s>0?new Y(d.toString()).div(s).mul(100).toFixed(2,Y.ROUND_DOWN):"0.00";n[c]=parseFloat(m)}),{...n,totalKey:l}}).sort((n,o)=>parseInt(n.date)-parseInt(o.date))};function Bt(e){const t=F(),r=re(()=>e.data?Vt(e.data,e.keyValues):[],[e.data,e.keyValues]);return i.jsx(z,{sx:{width:"100%",height:"100%",...e.sx},children:i.jsx(Z,{width:"100%",height:"100%",children:i.jsxs(Be,{data:r,width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[i.jsx(ne,{strokeDasharray:"3 3"}),i.jsx(ae,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:n=>ke(n,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),i.jsx(oe,{textAnchor:"end",tickLine:!1,tickFormatter:n=>`${n.toFixed(2)}%`}),i.jsx(ie,{cursor:{stroke:t.palette.neutral.main,strokeWidth:1},labelFormatter:n=>Oe(n,{timeZone:e.filter.timezone,hour12:!1}),formatter:(n,o,l)=>{const a=l.payload.totalKey,s=l.dataKey,c=s===a,d=l.payload[`${s}_absolute`],m=l.payload.originalTotal,x=c?null:m===0?"0.00":new Y(d.toString()).div(m).mul(100).toFixed(2,Y.ROUND_DOWN);return[x?`${d.toLocaleString()} (${x}%)`:`${d.toLocaleString()} (TOTAL)`,o]}}),e.keyValues.sort((n,o)=>n.isTotal?-1:o.isTotal?1:0).map(n=>i.jsx(We,{type:"monotone",dataKey:n.key,name:n.name,stroke:n.color,fill:n.color,strokeWidth:2,fillOpacity:.6},n.key))]})})})}function Wt(e){const t=se(e.value),{ref:r}=mt({from:t??0,to:e.value,duration:1,map:e.map});return i.jsx(Pe,{sx:{p:3,flex:1,...e.sx},children:i.jsxs(U,{spacing:1,alignItems:"center",children:[i.jsx(W,{ref:r,variant:"h4",fontWeight:"bold",children:e.initialValue}),i.jsx(W,{color:"text.secondary",children:e.label})]})})}const Ee={margin:{top:5,right:30,left:20,bottom:5}},qt={tickLine:!1,fontSize:12,tickMargin:12},Kt={textAnchor:"end",tickLine:!1};function pe({data:e,series:t,xAxis:r,yAxis:n,tooltip:o,bar:l,referenceLines:a,referenceAreas:s,sx:c}){const d=F(),m=p=>!p.isFront,x=p=>!!p.isFront;return i.jsx(z,{sx:{width:"100%",height:"100%",...c},children:i.jsx(Z,{children:i.jsxs(qe,{data:e,...Ee,children:[i.jsx(ne,{strokeDasharray:"3 3",vertical:!1}),i.jsx(ae,{...qt,...r}),i.jsx(oe,{...Kt,...n}),i.jsx(ie,{cursor:{stroke:d.palette.neutral.main,strokeWidth:1},...o}),a?.filter(m).map((p,f)=>i.jsx(be,{...p},p.label??f)),s?.filter(m).map((p,f)=>i.jsx(we,{...p},p.label??f)),t.map(p=>i.jsx(Ke,{name:p.key,dataKey:p.dataKey,fill:p.color,stackId:"stack",isAnimationActive:!1,...l},p.key)),a?.filter(x).map((p,f)=>i.jsx(be,{...p},p.label??f)),s?.filter(x).map((p,f)=>i.jsx(we,{...p},p.label??f))]})})})}function Ut({data:e,threshold:t=100,sx:r}){const n=F(),o=Object.entries(e??{}).map(([a,s])=>({key:a,[a]:s})),l=o.map(({key:a})=>({key:a,dataKey:a,color:n.palette.error.light}));return i.jsx(pe,{sx:r,data:o,series:l,xAxis:{tickLine:!1,dataKey:"key"},yAxis:{tickLine:!1,domain:[0,`dataMax + ${t}`]},tooltip:{labelFormatter:a=>"Total"},referenceLines:[{y:t,stroke:n.palette.error.dark,strokeDasharray:"3 3",label:i.jsx(ye,{value:"Unhealthy threshold",position:"insideBottomRight"}),isFront:!0}]})}function Ce({payload:e=[],hiddenItems:t,onToggle:r,legendLabel:n}){return i.jsx(z,{sx:{display:"flex",justifyContent:"center",gap:"20px",paddingTop:"20px"},children:e.map((o,l)=>{const a=t.has(o.payload.name);return i.jsxs("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",opacity:a?.4:1},onClick:()=>{r?.(o.payload)},children:[i.jsx("div",{style:{width:"12px",height:"12px",backgroundColor:o.color,marginRight:"8px",borderRadius:"2px"}}),i.jsx("span",{style:{color:o.color},children:n?`${n}: ${o.value}`:o.value})]},`legend-${l}`)})})}const Zt=e=>{const t=Math.PI/180,{cx:r,cy:n,midAngle:o,innerRadius:l,outerRadius:a,startAngle:s,endAngle:c,fill:d,payload:m,percent:x,value:p,valueText:f,valuePercentage:S,needleVisible:y,customText:w,allActive:v}=e,b=Math.sin(-t*o),j=Math.cos(-t*o),A=r+(a+5)*j,g=n+(a+5)*b,k=r+(a+15)*j,L=n+(a+15)*b,T=k+(j>=0?1:-1)*22,E=L,R=j>=0?"start":"end",u=p.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}),h=()=>y||v?null:i.jsx("text",{x:r,y:n,dy:8,textAnchor:"middle",fill:"#333",fontSize:14,children:m.name});return i.jsxs("g",{children:[h(),i.jsx(je,{cx:r,cy:n,innerRadius:l,outerRadius:a,startAngle:s,endAngle:c,fill:d}),i.jsx(je,{cx:r,cy:n,startAngle:s,endAngle:c,innerRadius:a+2,outerRadius:a+6,fill:d}),i.jsx("path",{d:`M${A},${g}L${k},${L}L${T},${E}`,stroke:d,fill:"none"}),i.jsx("circle",{cx:T,cy:E,r:2,fill:d,stroke:"none"}),i.jsx("text",{x:T+(j>=0?1:-1)*12,y:E,textAnchor:R,fill:"#333",fontSize:12,children:w||(f?`${f} ${u}`:u)}),S&&i.jsxs("text",{x:T+(j>=0?1:-1)*12,y:E,dy:16,textAnchor:R,fill:"#999",fontSize:11,children:[`${(x*100).toFixed(2)}%`," (",u,")"]})]})},Yt=e=>{const{value:t,data:r,color:n,innerRadius:o,outerRadius:l,boxDimensions:a,legendDimensions:s,valueText:c}=e,d=Math.PI/180;let m=0;r.forEach(h=>{m+=h.value});const x=a?a.width/2:150,p=(a?a.height/2:200)-s.height/2,f=180*(1-Math.max(0,Math.min(1,t/m))),S=(Number(o)+2*Number(l))/3,y=Math.sin(-d*f),w=Math.cos(-d*f),v=5,b=x-v,j=p,A=b+v*y,g=j-v*w,k=b-v*y,L=j+v*w,T=b+S*w,E=j+S*y,R=t.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}),u=c??R;return i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:b,cy:j,r:v,fill:n,stroke:"none",style:{pointerEvents:"none"}},"needle-circle"),i.jsx("path",{d:`M${A} ${g}L${k} ${L} L${T} ${E} L${A} ${g}`,stroke:"none",fill:n,style:{pointerEvents:"none"}},"needle-path"),i.jsx("text",{x:b+v,y:j+26,textAnchor:"middle",fill:"#333",fontSize:12,children:u},"needle-value")]})},Ht=(e,t)=>({Allow:t.palette.success.main,Flag:t.palette.warning.main,Block:t.palette.error.main})[e]??t.palette.primary.main;function Ne({data:e,sx:t,legendLabel:r,legendToggle:n=!1,valueText:o="",valuePercentage:l=!0,pie:a,needleVisible:s=!1,needleValue:c,needleColor:d="#aaa",allActive:m=!1}){const{innerRadius:x=60,outerRadius:p=100}=a??{},f=F(),[S,y]=K(void 0),[w,v]=K(new Set),b=Ie(null),[j,A]=K(null),[g,k]=K(null),L=(u,h)=>{m||y(h)},T=()=>{m||y(void 0)},E=u=>{n&&u&&v(h=>{const O=new Set(h);return O.has(u.name)?O.delete(u.name):O.size<e.length-1&&O.add(u.name),O})},R=e.map((u,h)=>({...u,index:h,value:w.has(u.name)?0:u.value}));return ge(()=>{const u=b.current;if(!u)return;const h=new ResizeObserver(M=>{var _;const C=(_=M[0])==null?void 0:_.contentRect;C&&A(C)});h.observe(u);const O=u.getBoundingClientRect();return A(O),()=>{h.disconnect()}},[]),ge(()=>{var u;const h=(u=b.current)==null?void 0:u.querySelector(".recharts-legend-wrapper");if(!h){const _=setInterval(()=>{var C;const N=(C=b.current)==null?void 0:C.querySelector(".recharts-legend-wrapper");if(N){const Q=N.getBoundingClientRect();k(Q),clearInterval(_)}},100);return()=>{clearInterval(_)}}const O=new ResizeObserver(_=>{var C;const N=(C=_[0])==null?void 0:C.contentRect;N&&k(N)});O.observe(h);const M=h.getBoundingClientRect();return k(M),()=>{O.disconnect()}},[]),i.jsx(z,{ref:b,sx:{width:"100%",height:"100%","& g":{outline:"none"},...t},children:i.jsx(Z,{children:i.jsxs(Ue,{...Ee,children:[i.jsx(Ze,{data:R,nameKey:"name",dataKey:"value",innerRadius:x,outerRadius:p,activeIndex:m?R.filter(u=>u.value>0).map(u=>u.index):S,activeShape:u=>Zt({...u,valueText:o,valuePercentage:l,needleVisible:s,allActive:m}),paddingAngle:0,onMouseEnter:L,onMouseLeave:T,...a,children:R.map(u=>i.jsx(Ye,{fill:u.color??Ht(u.name,f),opacity:w.has(u.name)?.5:1,stroke:"none"},u.name))}),i.jsx(ve,{content:i.jsx(Ce,{legendLabel:r,hiddenItems:w,onToggle:E})}),s&&c!==void 0&&j&&g&&Yt({data:R,value:c,color:d,innerRadius:x,outerRadius:p,boxDimensions:j,legendDimensions:g,valueText:o})]})})})}function Xt({sx:e,data:t,score:r=200,legendLabel:n}){const o=F(),l=[{name:"Allow",customText:"0-299",value:t[0].value,color:o.palette.primary.main},{name:"Flag",customText:"300-599",value:t[1].value,color:o.palette.warning.main},{name:"Block",customText:"Over 600",value:t[2].value,color:o.palette.error.main}];return i.jsx(Ne,{data:l,legendToggle:!0,needleValue:r,legendLabel:n,allActive:!0,sx:e})}function Jt({data:e,sx:t}){const r=F(),n=(l=>{const a={};return l.forEach(s=>{Object.entries(s).forEach(([c,d])=>{const m=parseInt(c);m<=1e3&&(a[m]=(a[m]||0)+d)})}),Array.from({length:1001},(s,c)=>({key:c.toString(),value:a[c]||0}))})(e),o=[{key:"Risk Score",dataKey:"value",color:r.palette.error.main}];return i.jsx(pe,{data:n,series:o,sx:t,yAxis:{label:{value:"Count",angle:-90,position:"insideLeft"},domain:[0,"dataMax + 10"]},xAxis:{domain:[0,"dataMax"],interval:"preserveStartEnd"},tooltip:{labelFormatter:()=>"Risk Score",formatter:(l,a,s)=>[l,s.payload.key]},referenceAreas:[{x1:0,x2:299,fill:"#ffffff00",isFront:!1,label:"Allow"},{x1:300,x2:600,fill:r.palette.warning.light,isFront:!1,label:"Flag"},{x1:600,fill:r.palette.error.light,isFront:!1,label:"Block"}]})}export{Wt as BigNumber,Ut as ErrorCodesChart,Ne as PieChart,Jt as RiskScoreBarChart,Xt as RiskScorePieChart,zt as SeriesChart,Re as SeriesChartLegend,Bt as SeriesPercentageChart,pe as SimpleBarChart,Ce as SimpleLegend};
|
1
|
+
"use strict";import{j as i}from"../../shared/jsx-runtime-DHlBLioN.mjs";import*as I from"react";import{useCallback as re,useMemo as ne,createElement as Fe,useState as q,useRef as Pe,useEffect as ye}from"react";import{Box as z,Stack as U,Typography as B,useTheme as F,Paper as Ie}from"@mui/material";import{ResponsiveContainer as Z,LineChart as ze,CartesianGrid as ae,XAxis as oe,YAxis as ie,Label as le,Tooltip as se,Legend as ve,Line as Ke,AreaChart as Ve,Area as Be,ComposedChart as We,ReferenceLine as be,ReferenceArea as je,Bar as qe,Sector as we,PieChart as Ue,Pie as Ze,Cell as Ye}from"recharts";import{b as ke,c as Oe}from"../../shared/date-Cq0LS2Mr.mjs";import Y,{Decimal as ce}from"decimal.js";import{AnimatePresence as He}from"framer-motion";import{u as Xe}from"../../shared/useCopyToClipboard-BALOSYVW.mjs";import"qrcode";import{u as ue}from"../../shared/usePrevious-DyvR1iCQ.mjs";import{a as Je,C as Se}from"../../shared/motions-BBPeWBPV.mjs";import{c as $e,i as Qe,_ as H,s as et,a as $,d as tt,e as rt,f as nt,h as at,j as ot,k as it,l as lt,m as st,n as ct,o as ut,p as dt,u as pt}from"../../shared/index-KVVTzcea.mjs";import{u as mt}from"../../shared/useCounter-BV32zXDQ.mjs";const ft=["ownerState"],ht=["variants"],xt=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function gt(e){return Object.keys(e).length===0}function yt(e){return typeof e=="string"&&e.charCodeAt(0)>96}function de(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const vt=$e(),bt=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function X({defaultTheme:e,theme:t,themeId:r}){return gt(t)?e:t[r]||t}function jt(e){return e?(t,r)=>r[e]:null}function J(e,t){let{ownerState:r}=t,n=H(t,ft);const o=typeof e=="function"?e($({ownerState:r},n)):e;if(Array.isArray(o))return o.flatMap(l=>J(l,$({ownerState:r},n)));if(o&&typeof o=="object"&&Array.isArray(o.variants)){const{variants:l=[]}=o;let a=H(o,ht);return l.forEach(s=>{let c=!0;typeof s.props=="function"?c=s.props($({ownerState:r},n,r)):Object.keys(s.props).forEach(d=>{r?.[d]!==s.props[d]&&n[d]!==s.props[d]&&(c=!1)}),c&&(Array.isArray(a)||(a=[a]),a.push(typeof s.style=="function"?s.style($({ownerState:r},n,r)):s.style))}),a}return o}function wt(e={}){const{themeId:t,defaultTheme:r=vt,rootShouldForwardProp:n=de,slotShouldForwardProp:o=de}=e,l=a=>tt($({},a,{theme:X($({},a,{defaultTheme:r,themeId:t}))}));return l.__mui_systemSx=!0,(a,s={})=>{Qe(a,g=>g.filter(k=>!(k!=null&&k.__mui_systemSx)));const{name:c,slot:d,skipVariantsResolver:m,skipSx:x,overridesResolver:p=jt(bt(d))}=s,f=H(s,xt),S=m!==void 0?m:d&&d!=="Root"&&d!=="root"||!1,y=x||!1;let j,v=de;d==="Root"||d==="root"?v=n:d?v=o:yt(a)&&(v=void 0);const b=et(a,$({shouldForwardProp:v,label:j},f)),w=g=>typeof g=="function"&&g.__emotion_real!==g||rt(g)?k=>J(g,$({},k,{theme:X({theme:k.theme,defaultTheme:r,themeId:t})})):g,A=(g,...k)=>{let N=w(g);const T=k?k.map(w):[];c&&p&&T.push(u=>{const h=X($({},u,{defaultTheme:r,themeId:t}));if(!h.components||!h.components[c]||!h.components[c].styleOverrides)return null;const O=h.components[c].styleOverrides,M={};return Object.entries(O).forEach(([_,E])=>{M[_]=J(E,$({},u,{theme:h}))}),p(u,M)}),c&&!S&&T.push(u=>{var h;const O=X($({},u,{defaultTheme:r,themeId:t})),M=O==null||(h=O.components)==null||(h=h[c])==null?void 0:h.variants;return J({variants:M},$({},u,{theme:O}))}),y||T.push(l);const C=T.length-k.length;if(Array.isArray(g)&&C>0){const u=new Array(C).fill("");N=[...g,...u],N.raw=[...g.raw,...u]}const R=b(N,...T);return a.muiName&&(R.muiName=a.muiName),R};return b.withConfig&&(A.withConfig=b.withConfig),A}}const kt=wt(),Ot=(e,t)=>e.filter(r=>t.includes(r)),K=(e,t,r)=>{const n=e.keys[0];Array.isArray(t)?t.forEach((o,l)=>{r((a,s)=>{l<=e.keys.length-1&&(l===0?Object.assign(a,s):a[e.up(e.keys[l])]=s)},o)}):t&&typeof t=="object"?(Object.keys(t).length>e.keys.length?e.keys:Ot(e.keys,Object.keys(t))).forEach(o=>{if(e.keys.indexOf(o)!==-1){const l=t[o];l!==void 0&&r((a,s)=>{n===o?Object.assign(a,s):a[e.up(o)]=s},l)}}):(typeof t=="number"||typeof t=="string")&&r((o,l)=>{Object.assign(o,l)},t)};function G(e){return e?`Level${e}`:""}function W(e){return e.unstable_level>0&&e.container}function Te(e){return function(t){return`var(--Grid-${t}Spacing${G(e.unstable_level)})`}}function pe(e){return function(t){return e.unstable_level===0?`var(--Grid-${t}Spacing)`:`var(--Grid-${t}Spacing${G(e.unstable_level-1)})`}}function me(e){return e.unstable_level===0?"var(--Grid-columns)":`var(--Grid-columns${G(e.unstable_level-1)})`}const St=({theme:e,ownerState:t})=>{const r=Te(t),n={};return K(e.breakpoints,t.gridSize,(o,l)=>{let a={};l===!0&&(a={flexBasis:0,flexGrow:1,maxWidth:"100%"}),l==="auto"&&(a={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),typeof l=="number"&&(a={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${l} / ${me(t)}${W(t)?` + ${r("column")}`:""})`}),o(n,a)}),n},$t=({theme:e,ownerState:t})=>{const r={};return K(e.breakpoints,t.gridOffset,(n,o)=>{let l={};o==="auto"&&(l={marginLeft:"auto"}),typeof o=="number"&&(l={marginLeft:o===0?"0px":`calc(100% * ${o} / ${me(t)})`}),n(r,l)}),r},Tt=({theme:e,ownerState:t})=>{if(!t.container)return{};const r=W(t)?{[`--Grid-columns${G(t.unstable_level)}`]:me(t)}:{"--Grid-columns":12};return K(e.breakpoints,t.columns,(n,o)=>{n(r,{[`--Grid-columns${G(t.unstable_level)}`]:o})}),r},At=({theme:e,ownerState:t})=>{if(!t.container)return{};const r=pe(t),n=W(t)?{[`--Grid-rowSpacing${G(t.unstable_level)}`]:r("row")}:{};return K(e.breakpoints,t.rowSpacing,(o,l)=>{var a;o(n,{[`--Grid-rowSpacing${G(t.unstable_level)}`]:typeof l=="string"?l:(a=e.spacing)==null?void 0:a.call(e,l)})}),n},Rt=({theme:e,ownerState:t})=>{if(!t.container)return{};const r=pe(t),n=W(t)?{[`--Grid-columnSpacing${G(t.unstable_level)}`]:r("column")}:{};return K(e.breakpoints,t.columnSpacing,(o,l)=>{var a;o(n,{[`--Grid-columnSpacing${G(t.unstable_level)}`]:typeof l=="string"?l:(a=e.spacing)==null?void 0:a.call(e,l)})}),n},Ct=({theme:e,ownerState:t})=>{if(!t.container)return{};const r={};return K(e.breakpoints,t.direction,(n,o)=>{n(r,{flexDirection:o})}),r},Et=({ownerState:e})=>{const t=Te(e),r=pe(e);return $({minWidth:0,boxSizing:"border-box"},e.container&&$({display:"flex",flexWrap:"wrap"},e.wrap&&e.wrap!=="wrap"&&{flexWrap:e.wrap},{margin:`calc(${t("row")} / -2) calc(${t("column")} / -2)`},e.disableEqualOverflow&&{margin:`calc(${t("row")} * -1) 0px 0px calc(${t("column")} * -1)`}),(!e.container||W(e))&&$({padding:`calc(${r("row")} / 2) calc(${r("column")} / 2)`},(e.disableEqualOverflow||e.parentDisableEqualOverflow)&&{padding:`${r("row")} 0px 0px ${r("column")}`}))},Lt=e=>{const t=[];return Object.entries(e).forEach(([r,n])=>{n!==!1&&n!==void 0&&t.push(`grid-${r}-${String(n)}`)}),t},Nt=(e,t="xs")=>{function r(n){return n===void 0?!1:typeof n=="string"&&!Number.isNaN(Number(n))||typeof n=="number"&&n>0}if(r(e))return[`spacing-${t}-${String(e)}`];if(typeof e=="object"&&!Array.isArray(e)){const n=[];return Object.entries(e).forEach(([o,l])=>{r(l)&&n.push(`spacing-${o}-${String(l)}`)}),n}return[]},_t=e=>e===void 0?[]:typeof e=="object"?Object.entries(e).map(([t,r])=>`direction-${t}-${r}`):[`direction-xs-${String(e)}`],Dt=["className","children","columns","container","component","direction","wrap","spacing","rowSpacing","columnSpacing","disableEqualOverflow","unstable_level"],Mt=$e(),Gt=kt("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,t)=>t.root});function Ft(e){return lt({props:e,name:"MuiGrid",defaultTheme:Mt})}function Pt(e={}){const{createStyledComponent:t=Gt,useThemeProps:r=Ft,componentName:n="MuiGrid"}=e,o=I.createContext(void 0),l=(c,d)=>{const{container:m,direction:x,spacing:p,wrap:f,gridSize:S}=c,y={root:["root",m&&"container",f!=="wrap"&&`wrap-xs-${String(f)}`,..._t(x),...Lt(S),...m?Nt(p,d.breakpoints.keys[0]):[]]};return st(y,j=>ct(n,j),{})},a=t(Tt,Rt,At,St,Ct,Et,$t),s=I.forwardRef(function(c,d){var m,x,p,f,S,y,j,v;const b=nt(),w=r(c),A=at(w),g=I.useContext(o),{className:k,children:N,columns:T=12,container:C=!1,component:R="div",direction:u="row",wrap:h="wrap",spacing:O=0,rowSpacing:M=O,columnSpacing:_=O,disableEqualOverflow:E,unstable_level:L=0}=A,ee=H(A,Dt);let V=E;L&&E!==void 0&&(V=c.disableEqualOverflow);const fe={},he={},xe={};Object.entries(ee).forEach(([D,P])=>{b.breakpoints.values[D]!==void 0?fe[D]=P:b.breakpoints.values[D.replace("Offset","")]!==void 0?he[D.replace("Offset","")]=P:xe[D]=P});const Ne=(m=c.columns)!=null?m:L?void 0:T,_e=(x=c.spacing)!=null?x:L?void 0:O,De=(p=(f=c.rowSpacing)!=null?f:c.spacing)!=null?p:L?void 0:M,Me=(S=(y=c.columnSpacing)!=null?y:c.spacing)!=null?S:L?void 0:_,ge=$({},A,{level:L,columns:Ne,container:C,direction:u,wrap:h,spacing:_e,rowSpacing:De,columnSpacing:Me,gridSize:fe,gridOffset:he,disableEqualOverflow:(j=(v=V)!=null?v:g)!=null?j:!1,parentDisableEqualOverflow:g}),Ge=l(ge,b);let te=i.jsx(a,$({ref:d,as:R,ownerState:ge,className:ot(Ge.root,k)},xe,{children:I.Children.map(N,D=>{if(I.isValidElement(D)&&it(D,["Grid"])){var P;return I.cloneElement(D,{unstable_level:(P=D.props.unstable_level)!=null?P:L+1})}return D})}));return V!==void 0&&V!==(g??!1)&&(te=i.jsx(o.Provider,{value:V,children:te})),te});return s.muiName="Grid",s}const Ae=Pt({createStyledComponent:ut("div",{name:"MuiGrid2",slot:"Root",overridesResolver:(e,t)=>t.root}),componentName:"MuiGrid2",useThemeProps:e=>dt({props:e,name:"MuiGrid2"})});function It({entry:e,payload:t}){const r=re(x=>{var p,f,S;return(S=(f=(p=x.payload)==null?void 0:p.data)==null?void 0:f.reduce)==null?void 0:S.call(f,(y,j)=>y+j.value,0)},[]),n=re(x=>{const p=new ce(r(x)||0),f=t?.reduce((j,v)=>j+r(v),0)||0,S=new ce(f),y=Number(p.div(S).times(100).toFixed(2,ce.ROUND_DOWN));return isNaN(y)||!isFinite(y)?0:y},[r,t]),o=ne(()=>r(e),[e,r]),l=ue(o),a=ne(()=>Number(n(e)),[e,n]),s=ue(a),c=re(x=>Math.floor(x).toLocaleString(),[]),d=Xe({type:"text/plain"}),m=pt();return i.jsxs(Je,{component:"li",direction:"row",spacing:1,sx:{color:e.color},layout:"position",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[i.jsx(z,{sx:{width:"3px",height:"100%",backgroundColor:e.color,borderRadius:3}}),i.jsxs(U,{children:[i.jsxs(B,{component:"p",variant:"caption",children:[i.jsx(U,{component:"span",display:"inline-flex",mr:.5,children:i.jsx(Se,{from:l??0,to:o,map:c,children:"0"})}),i.jsxs(U,{component:"span",direction:"row",display:"inline-flex",children:["(",i.jsx(Se,{from:s??0,to:a,map:c,children:"0"}),"%)"]})]}),i.jsx(B,{variant:"body1",children:e.value}),e.payload.uuid&&i.jsxs(B,{variant:"body2",sx:{cursor:"pointer","&:hover":{textDecoration:"underline"}},onClick:()=>{d.copy(e.payload.uuid).catch(()=>{}),m.enqueueSnackbar("UUID copied to clipboard","success")},children:[e.payload.uuid.slice(0,5),"..."]})]})]})}function Re(e){const{payload:t}=e;return i.jsx(Ae,{container:!0,direction:"row",component:"ul",gap:2,sx:{mt:2,justifyContent:"flex-start",alignItem:"center",flexWrap:"wrap"},children:i.jsx(He,{children:t?.map(r=>i.jsx(Ae,{children:i.jsx(It,{entry:r,payload:t})},`item-${r.value}`))})})}function zt(e){const t=F();return i.jsx(z,{sx:{width:"100%",height:"100%",...e.sx},children:i.jsx(Z,{children:i.jsxs(ze,{width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[i.jsx(ae,{vertical:!1}),i.jsx(oe,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:r=>ke(r,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),i.jsx(ie,{textAnchor:"end",dataKey:"value",tickLine:!1,tickFormatter:r=>Number(r).toLocaleString(),allowDecimals:!1,domain:[1,"dataMax"],children:e.label&&i.jsx(le,{value:e.label,angle:-90,position:"insideLeft",style:{textAnchor:"middle"}})}),i.jsx(se,{cursor:{stroke:t.palette.neutral.main,strokeWidth:1},formatter:r=>Number(r).toLocaleString(),labelFormatter:r=>Oe(r,{timeZone:e.filter.timezone,hour12:!1})}),i.jsx(ve,{content:i.jsx(Re,{})}),e.data.map(r=>Fe(Ke,{uuid:r.uuid,key:r.uuid,name:r.name,dataKey:"value",data:r.chartData,type:"monotone",stroke:r.color,strokeWidth:2}))]})})})}const Kt=(e,t)=>{const r=new Map;return e.forEach(n=>{n.chartData.forEach(o=>{const l=new Date(o.date).getTime().toString();if(!r.has(l)){const a={date:l,total:0,diff:0,totalKey:"",originalTotal:0};t.forEach(({key:s})=>{a[s]=0,a[`${s}_absolute`]=0}),r.set(l,a)}t.forEach(({key:a})=>{const s=r.get(l),c=o[a],d=typeof c=="string"?c.trim()===""?0:parseInt(c,10):typeof c=="number"?c:0;s[`${a}_absolute`]=d,s[a]=0})})}),Array.from(r.values()).map(n=>{var o;const l=(o=t.find(c=>c.isTotal))==null?void 0:o.key,a=t.filter(c=>!c.isTotal).map(c=>c.key);if(!l||a.length===0)return n;const s=n[`${l}_absolute`];return n.originalTotal=s,n.total=s,n[l]=100,a.forEach(c=>{const d=n[`${c}_absolute`],m=s>0?new Y(d.toString()).div(s).mul(100).toFixed(2,Y.ROUND_DOWN):"0.00";n[c]=parseFloat(m)}),{...n,totalKey:l}}).sort((n,o)=>parseInt(n.date)-parseInt(o.date))};function Vt(e){const t=F(),r=ne(()=>e.data?Kt(e.data,e.keyValues):[],[e.data,e.keyValues]);return i.jsx(z,{sx:{width:"100%",height:"100%",...e.sx},children:i.jsx(Z,{width:"100%",height:"100%",children:i.jsxs(Ve,{data:r,width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[i.jsx(ae,{strokeDasharray:"3 3"}),i.jsx(oe,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:n=>ke(n,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),i.jsx(ie,{textAnchor:"end",tickLine:!1,tickFormatter:n=>`${n.toFixed(2)}%`}),i.jsx(se,{cursor:{stroke:t.palette.neutral.main,strokeWidth:1},labelFormatter:n=>Oe(n,{timeZone:e.filter.timezone,hour12:!1}),formatter:(n,o,l)=>{const a=l.payload.totalKey,s=l.dataKey,c=s===a,d=l.payload[`${s}_absolute`],m=l.payload.originalTotal,x=c?null:m===0?"0.00":new Y(d.toString()).div(m).mul(100).toFixed(2,Y.ROUND_DOWN);return[x?`${d.toLocaleString()} (${x}%)`:`${d.toLocaleString()} (TOTAL)`,o]}}),e.keyValues.sort((n,o)=>n.isTotal?-1:o.isTotal?1:0).map(n=>i.jsx(Be,{type:"monotone",dataKey:n.key,name:n.name,stroke:n.color,fill:n.color,strokeWidth:2,fillOpacity:.6},n.key))]})})})}function Bt(e){const t=ue(e.value),{ref:r}=mt({from:t??0,to:e.value,duration:1,map:e.map});return i.jsx(Ie,{sx:{p:3,flex:1,...e.sx},children:i.jsxs(U,{spacing:1,alignItems:"center",children:[i.jsx(B,{ref:r,variant:"h4",fontWeight:"bold",children:e.initialValue}),i.jsx(B,{color:"text.secondary",children:e.label})]})})}const Ce={margin:{top:5,right:30,left:20,bottom:5}},Wt={tickLine:!1,fontSize:12,tickMargin:12},qt={textAnchor:"end",tickLine:!1};function Q({data:e,series:t,xAxis:r,yAxis:n,tooltip:o,bar:l,referenceLines:a,referenceAreas:s,sx:c}){const d=F(),m=p=>!p.isFront,x=p=>!!p.isFront;return i.jsx(z,{sx:{width:"100%",height:"100%",...c},children:i.jsx(Z,{children:i.jsxs(We,{data:e,...Ce,children:[i.jsx(ae,{strokeDasharray:"3 3",vertical:!1}),i.jsx(oe,{...Wt,...r}),i.jsx(ie,{...qt,...n}),i.jsx(se,{cursor:{stroke:d.palette.neutral.main,strokeWidth:1},...o}),a?.filter(m).map((p,f)=>i.jsx(be,{...p},p.label??f)),s?.filter(m).map((p,f)=>i.jsx(je,{...p},p.label??f)),t.map(p=>i.jsx(qe,{name:p.key,dataKey:p.dataKey,fill:p.color,stackId:"stack",isAnimationActive:!1,...l},p.key)),a?.filter(x).map((p,f)=>i.jsx(be,{...p},p.label??f)),s?.filter(x).map((p,f)=>i.jsx(je,{...p},p.label??f))]})})})}function Ut({data:e,threshold:t=100,sx:r}){const n=F(),o=Object.entries(e??{}).map(([a,s])=>({key:a,[a]:s})),l=o.map(({key:a})=>({key:a,dataKey:a,color:n.palette.error.light}));return i.jsx(Q,{sx:r,data:o,series:l,xAxis:{tickLine:!1,dataKey:"key"},yAxis:{tickLine:!1,domain:[0,`dataMax + ${t}`]},tooltip:{labelFormatter:a=>"Total"},referenceLines:[{y:t,stroke:n.palette.error.dark,strokeDasharray:"3 3",label:i.jsx(le,{value:"Unhealthy threshold",position:"insideBottomRight"}),isFront:!0}]})}function Zt({data:e,threshold:t=100,sx:r}){const n=F(),o=Object.entries(e??{}).map(([a,s])=>({key:a,[a]:s})),l=o.map(({key:a})=>({key:a,dataKey:a,color:n.palette.warning.light}));return i.jsx(Q,{sx:r,data:o,series:l,xAxis:{tickLine:!1,dataKey:"key"},yAxis:{tickLine:!1,domain:[0,`dataMax + ${t}`]},tooltip:{labelFormatter:a=>"Total"},referenceLines:[{y:t,stroke:n.palette.error.dark,strokeDasharray:"3 3",label:i.jsx(le,{value:"Unhealthy threshold",position:"insideBottomRight"}),isFront:!0}]})}function Ee({payload:e=[],hiddenItems:t,onToggle:r,legendLabel:n}){return i.jsx(z,{sx:{display:"flex",justifyContent:"center",gap:"20px",paddingTop:"20px"},children:e.map((o,l)=>{const a=t.has(o.payload.name);return i.jsxs("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",opacity:a?.4:1},onClick:()=>{r?.(o.payload)},children:[i.jsx("div",{style:{width:"12px",height:"12px",backgroundColor:o.color,marginRight:"8px",borderRadius:"2px"}}),i.jsx("span",{style:{color:o.color},children:n?`${n}: ${o.value}`:o.value})]},`legend-${l}`)})})}const Yt=e=>{const t=Math.PI/180,{cx:r,cy:n,midAngle:o,innerRadius:l,outerRadius:a,startAngle:s,endAngle:c,fill:d,payload:m,percent:x,value:p,valueText:f,valuePercentage:S,needleVisible:y,customText:j,allActive:v}=e,b=Math.sin(-t*o),w=Math.cos(-t*o),A=r+(a+5)*w,g=n+(a+5)*b,k=r+(a+15)*w,N=n+(a+15)*b,T=k+(w>=0?1:-1)*22,C=N,R=w>=0?"start":"end",u=p.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}),h=()=>y||v?null:i.jsx("text",{x:r,y:n,dy:8,textAnchor:"middle",fill:"#333",fontSize:14,children:m.name});return i.jsxs("g",{children:[h(),i.jsx(we,{cx:r,cy:n,innerRadius:l,outerRadius:a,startAngle:s,endAngle:c,fill:d}),i.jsx(we,{cx:r,cy:n,startAngle:s,endAngle:c,innerRadius:a+2,outerRadius:a+6,fill:d}),i.jsx("path",{d:`M${A},${g}L${k},${N}L${T},${C}`,stroke:d,fill:"none"}),i.jsx("circle",{cx:T,cy:C,r:2,fill:d,stroke:"none"}),i.jsx("text",{x:T+(w>=0?1:-1)*12,y:C,textAnchor:R,fill:"#333",fontSize:12,children:j||(f?`${f} ${u}`:u)}),S&&i.jsxs("text",{x:T+(w>=0?1:-1)*12,y:C,dy:16,textAnchor:R,fill:"#999",fontSize:11,children:[`${(x*100).toFixed(2)}%`," (",u,")"]})]})},Ht=e=>{const{value:t,data:r,color:n,innerRadius:o,outerRadius:l,boxDimensions:a,legendDimensions:s,valueText:c}=e,d=Math.PI/180;let m=0;r.forEach(h=>{m+=h.value});const x=a?a.width/2:150,p=(a?a.height/2:200)-s.height/2,f=180*(1-Math.max(0,Math.min(1,t/m))),S=(Number(o)+2*Number(l))/3,y=Math.sin(-d*f),j=Math.cos(-d*f),v=5,b=x-v,w=p,A=b+v*y,g=w-v*j,k=b-v*y,N=w+v*j,T=b+S*j,C=w+S*y,R=t.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}),u=c??R;return i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:b,cy:w,r:v,fill:n,stroke:"none",style:{pointerEvents:"none"}},"needle-circle"),i.jsx("path",{d:`M${A} ${g}L${k} ${N} L${T} ${C} L${A} ${g}`,stroke:"none",fill:n,style:{pointerEvents:"none"}},"needle-path"),i.jsx("text",{x:b+v,y:w+26,textAnchor:"middle",fill:"#333",fontSize:12,children:u},"needle-value")]})},Xt=(e,t)=>({Allow:t.palette.success.main,Flag:t.palette.warning.main,Block:t.palette.error.main})[e]??t.palette.primary.main;function Le({data:e,sx:t,legendLabel:r,legendToggle:n=!1,valueText:o="",valuePercentage:l=!0,pie:a,needleVisible:s=!1,needleValue:c,needleColor:d="#aaa",allActive:m=!1}){const{innerRadius:x=60,outerRadius:p=100}=a??{},f=F(),[S,y]=q(void 0),[j,v]=q(new Set),b=Pe(null),[w,A]=q(null),[g,k]=q(null),N=(u,h)=>{m||y(h)},T=()=>{m||y(void 0)},C=u=>{n&&u&&v(h=>{const O=new Set(h);return O.has(u.name)?O.delete(u.name):O.size<e.length-1&&O.add(u.name),O})},R=e.map((u,h)=>({...u,index:h,value:j.has(u.name)?0:u.value}));return ye(()=>{const u=b.current;if(!u)return;const h=new ResizeObserver(M=>{var _;const E=(_=M[0])==null?void 0:_.contentRect;E&&A(E)});h.observe(u);const O=u.getBoundingClientRect();return A(O),()=>{h.disconnect()}},[]),ye(()=>{var u;const h=(u=b.current)==null?void 0:u.querySelector(".recharts-legend-wrapper");if(!h){const _=setInterval(()=>{var E;const L=(E=b.current)==null?void 0:E.querySelector(".recharts-legend-wrapper");if(L){const ee=L.getBoundingClientRect();k(ee),clearInterval(_)}},100);return()=>{clearInterval(_)}}const O=new ResizeObserver(_=>{var E;const L=(E=_[0])==null?void 0:E.contentRect;L&&k(L)});O.observe(h);const M=h.getBoundingClientRect();return k(M),()=>{O.disconnect()}},[]),i.jsx(z,{ref:b,sx:{width:"100%",height:"100%","& g":{outline:"none"},...t},children:i.jsx(Z,{children:i.jsxs(Ue,{...Ce,children:[i.jsx(Ze,{data:R,nameKey:"name",dataKey:"value",innerRadius:x,outerRadius:p,activeIndex:m?R.filter(u=>u.value>0).map(u=>u.index):S,activeShape:u=>Yt({...u,valueText:o,valuePercentage:l,needleVisible:s,allActive:m}),paddingAngle:0,onMouseEnter:N,onMouseLeave:T,...a,children:R.map(u=>i.jsx(Ye,{fill:u.color??Xt(u.name,f),opacity:j.has(u.name)?.5:1,stroke:"none"},u.name))}),i.jsx(ve,{content:i.jsx(Ee,{legendLabel:r,hiddenItems:j,onToggle:C})}),s&&c!==void 0&&w&&g&&Ht({data:R,value:c,color:d,innerRadius:x,outerRadius:p,boxDimensions:w,legendDimensions:g,valueText:o})]})})})}function Jt({sx:e,data:t,score:r=200,legendLabel:n}){const o=F(),l=[{name:"Allow",customText:"0-299",value:t[0].value,color:o.palette.primary.main},{name:"Flag",customText:"300-599",value:t[1].value,color:o.palette.warning.main},{name:"Block",customText:"Over 600",value:t[2].value,color:o.palette.error.main}];return i.jsx(Le,{data:l,legendToggle:!0,needleValue:r,legendLabel:n,allActive:!0,sx:e})}function Qt({data:e,sx:t}){const r=F(),n=(l=>{const a={};return l.forEach(s=>{Object.entries(s).forEach(([c,d])=>{const m=parseInt(c);m<=1e3&&(a[m]=(a[m]||0)+d)})}),Array.from({length:1001},(s,c)=>({key:c.toString(),value:a[c]||0}))})(e),o=[{key:"Risk Score",dataKey:"value",color:r.palette.error.main}];return i.jsx(Q,{data:n,series:o,sx:t,yAxis:{label:{value:"Count",angle:-90,position:"insideLeft"},domain:[0,"dataMax + 10"]},xAxis:{domain:[0,"dataMax"],interval:"preserveStartEnd"},tooltip:{labelFormatter:()=>"Risk Score",formatter:(l,a,s)=>[l,s.payload.key]},referenceAreas:[{x1:0,x2:299,fill:"#ffffff00",isFront:!1,label:"Allow"},{x1:300,x2:600,fill:r.palette.warning.light,isFront:!1,label:"Flag"},{x1:600,fill:r.palette.error.light,isFront:!1,label:"Block"}]})}export{Bt as BigNumber,Ut as ErrorCodesChart,Le as PieChart,Zt as ReasonCodesChart,Qt as RiskScoreBarChart,Jt as RiskScorePieChart,zt as SeriesChart,Re as SeriesChartLegend,Vt as SeriesPercentageChart,Q as SimpleBarChart,Ee as SimpleLegend};
|
package/dist/components/form/OneClickForm/components/CredentialsDisplay/CredentialsDisplay.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export default function CredentialsDisplay(): import("react").JSX.Element;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { CredentialDisplayInfo, CredentialRequests, Credentials } from './types';
|
3
|
+
export type CredentialsDisplayContext = {
|
4
|
+
credentialRequests: any[];
|
5
|
+
credentials: any[];
|
6
|
+
displayInfoList: CredentialDisplayInfo[];
|
7
|
+
schema: any;
|
8
|
+
handleChangeCredentialInstance(path: string, credentialId: string): void;
|
9
|
+
handleChangeValueCredential(path: string, value: unknown, options?: {
|
10
|
+
shouldValidate?: boolean;
|
11
|
+
}): void;
|
12
|
+
handleClearValueCredential(path: string): void;
|
13
|
+
handleChangeValidationCredential(path: string, valid: boolean, message?: string): void;
|
14
|
+
handleSelectCredential(path: string, checked: boolean, shouldCascade: boolean): void;
|
15
|
+
handleToggleEditModeCredential(path: string, editMode: boolean): void;
|
16
|
+
};
|
17
|
+
type CredentialValue = {
|
18
|
+
credentials: Credentials[];
|
19
|
+
credentialRequests: CredentialRequests[];
|
20
|
+
schema: any;
|
21
|
+
};
|
22
|
+
/**
|
23
|
+
* Hook that hold the context value, should be used in nested components to avoid props drilling.
|
24
|
+
*/
|
25
|
+
export declare function useCredentialsDisplay(): CredentialsDisplayContext;
|
26
|
+
/**
|
27
|
+
* Credentials display context, on it we have all the business logic to control the display info state by handlers.
|
28
|
+
* @param value
|
29
|
+
* @param children
|
30
|
+
* @constructor
|
31
|
+
*/
|
32
|
+
export default function CredentialsDisplayProvider({ value, children, }: {
|
33
|
+
value: CredentialValue;
|
34
|
+
children: ReactNode | ReactNode[];
|
35
|
+
}): import("react").JSX.Element;
|
36
|
+
export {};
|
package/dist/components/form/OneClickForm/components/CredentialsDisplay/CredentialsDisplayItem.d.ts
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { SxProps } from '@mui/material';
|
3
|
+
type CredentialsDisplayItemProps = {
|
4
|
+
providerProps: any;
|
5
|
+
sx?: SxProps;
|
6
|
+
children?: ReactNode;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* Render DataFieldPaper to root level only components, and bind the credential display item context to it.
|
10
|
+
* @param providerProps
|
11
|
+
* @param props
|
12
|
+
* @constructor
|
13
|
+
*/
|
14
|
+
export declare function CredentialsDisplayItem({ providerProps, ...props }: CredentialsDisplayItemProps): import("react").JSX.Element;
|
15
|
+
export {};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { FieldValues, UseControllerReturn } from 'react-hook-form';
|
3
|
+
import { CredentialDisplayInfo, CredentialFieldSet } from './types';
|
4
|
+
export type CredentialsDisplayItemContext = {
|
5
|
+
path: string;
|
6
|
+
objectController: UseControllerReturn<FieldValues, string>;
|
7
|
+
parentFieldSet?: CredentialFieldSet;
|
8
|
+
credentialDisplayInfo: CredentialDisplayInfo;
|
9
|
+
isChecked: boolean;
|
10
|
+
isAllChecked: boolean;
|
11
|
+
isSelectable: boolean;
|
12
|
+
isRoot: boolean;
|
13
|
+
handleSelectCredential(checked: boolean, shouldCascade?: boolean): void;
|
14
|
+
handleChangeValueCredential(value: unknown, options?: {
|
15
|
+
shouldValidate?: boolean;
|
16
|
+
}): void;
|
17
|
+
handleChangeDebouncedValueCredential(value: unknown, options?: {
|
18
|
+
shouldValidate?: boolean;
|
19
|
+
}): void;
|
20
|
+
handleClearValueCredential(): void;
|
21
|
+
handleChangeValidationCredential(valid: boolean, message?: string): void;
|
22
|
+
handleChangeCredentialInstance(credentialId: string): void;
|
23
|
+
handleToggleEditModeCredential(editMode: boolean): void;
|
24
|
+
};
|
25
|
+
/**
|
26
|
+
* This hook will give access to the credential in the level that it is being called.
|
27
|
+
*/
|
28
|
+
export declare function useCredentialsDisplayItem(): CredentialsDisplayItemContext;
|
29
|
+
type CredentialsDisplayItemProviderProps = {
|
30
|
+
path: string;
|
31
|
+
children: ReactNode | ReactNode[];
|
32
|
+
credentialDisplayInfo: CredentialDisplayInfo;
|
33
|
+
isSelectable: boolean;
|
34
|
+
isRoot: boolean;
|
35
|
+
};
|
36
|
+
/**
|
37
|
+
* This is a context for the usage of rendered display items and its data field components
|
38
|
+
* for a more manageable state.
|
39
|
+
* @param props
|
40
|
+
* @constructor
|
41
|
+
*/
|
42
|
+
export default function CredentialsDisplayItemProvider(props: CredentialsDisplayItemProviderProps): import("react").JSX.Element;
|
43
|
+
export {};
|
@@ -0,0 +1,66 @@
|
|
1
|
+
/**
|
2
|
+
* Represents the information to display for a single credential.
|
3
|
+
*/
|
4
|
+
export interface CredentialDisplayInfo {
|
5
|
+
id: string;
|
6
|
+
label?: string | undefined;
|
7
|
+
value: string;
|
8
|
+
displayFormat?: string | undefined;
|
9
|
+
isNewCredential: boolean;
|
10
|
+
children?: CredentialDisplayInfo[] | undefined;
|
11
|
+
credential: Credentials;
|
12
|
+
credentialRequest: Omit<any, 'children' | 'issuers'>;
|
13
|
+
schema?: any;
|
14
|
+
instances: CredentialDisplayInfo[];
|
15
|
+
originalInstance: CredentialDisplayInfo | null;
|
16
|
+
uiState: CredentialDisplayInfoUIState;
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* Represents the state to manage a single credential behavior on UI.
|
20
|
+
*/
|
21
|
+
export interface CredentialDisplayInfoUIState {
|
22
|
+
isEditMode: boolean;
|
23
|
+
isChecked: boolean;
|
24
|
+
isValid: boolean;
|
25
|
+
isDirty: boolean;
|
26
|
+
errorMessage: string | null;
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Represents the information needed to display credential(s) of a specific type.
|
30
|
+
*/
|
31
|
+
export interface CredentialTypeDisplayInfo {
|
32
|
+
displayFormat?: string;
|
33
|
+
label: string;
|
34
|
+
type: string;
|
35
|
+
schema: any;
|
36
|
+
}
|
37
|
+
export declare enum MandatoryEnum {
|
38
|
+
YES = "yes",
|
39
|
+
NO = "no",
|
40
|
+
IF_AVAILABLE = "if_available"
|
41
|
+
}
|
42
|
+
export interface CredentialRequests {
|
43
|
+
type: string;
|
44
|
+
mandatory?: MandatoryEnum | undefined;
|
45
|
+
description?: string | undefined;
|
46
|
+
allowUserInput?: boolean | undefined;
|
47
|
+
children?: CredentialRequests[] | undefined;
|
48
|
+
multi?: boolean | undefined;
|
49
|
+
}
|
50
|
+
export interface Credentials {
|
51
|
+
uuid: string;
|
52
|
+
id: string;
|
53
|
+
type: string;
|
54
|
+
data: Record<string, any> | Array<Record<string, any>>;
|
55
|
+
createdAt: number;
|
56
|
+
updatedAt: number;
|
57
|
+
verificationMethod?: string;
|
58
|
+
}
|
59
|
+
export interface CredentialField {
|
60
|
+
id: string;
|
61
|
+
value: string;
|
62
|
+
credentialDisplayInfo: CredentialDisplayInfo;
|
63
|
+
}
|
64
|
+
export type CredentialFieldSet = CredentialField & {
|
65
|
+
[key: string]: CredentialFieldSet;
|
66
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/**
|
2
|
+
* This function extracts all the types from a given schema.
|
3
|
+
* It traverses the schema object and collects all the values of '$ref' and '$id' keys.
|
4
|
+
* If the '$id' key is found within 'allOf', 'anyOf', or 'oneOf' keys, its value is also collected.
|
5
|
+
* The function uses recursion to handle nested objects and arrays within the schema.
|
6
|
+
*
|
7
|
+
* @param {object} record - The schema object to extract types from.
|
8
|
+
* @param {string[]} [result=[]] - An array to store the extracted types. Default is an empty array.
|
9
|
+
* @param {string[]} [parentKeys=[]] - An array to store the keys of parent objects during recursion. Default is an empty array.
|
10
|
+
* @returns {string[]} - An array of extracted types.
|
11
|
+
*/
|
12
|
+
export declare function extractTypesFromSchema(record: any, result?: string[], parentKeys?: string[]): string[];
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { CredentialDisplayInfo } from '../types';
|
2
|
+
/**
|
3
|
+
* Filter out repeated credentials by looking at the credential's values,
|
4
|
+
* when a composite it extracts each of child values in a O(n^n) and compare with the others from the list.
|
5
|
+
* @param credentialDisplayInfoList
|
6
|
+
*/
|
7
|
+
export declare function filterRepeatedCredentials(credentialDisplayInfoList: CredentialDisplayInfo[]): CredentialDisplayInfo[];
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { CredentialFieldSet } from '../types';
|
2
|
+
/**
|
3
|
+
* Returns the correct schema property based on the values for the related credential.
|
4
|
+
* @param schema
|
5
|
+
* @param credentialDisplayInfo
|
6
|
+
*/
|
7
|
+
export declare const findCorrectSchemaProperty: (schema: any | undefined, schemas: any, fieldSet?: CredentialFieldSet) => any | undefined;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { CredentialDisplayInfo } from '../types';
|
2
|
+
/**
|
3
|
+
* Find credentials by type.
|
4
|
+
* @param types
|
5
|
+
* @param credentialDisplayInfo
|
6
|
+
* @returns
|
7
|
+
*/
|
8
|
+
export declare function findCredentialsByType(types: string[], credentialDisplayInfo: CredentialDisplayInfo): Record<string, CredentialDisplayInfo | undefined>;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { CredentialTypeDisplayInfo } from '../types';
|
2
|
+
/**
|
3
|
+
* Gets credential type display info from the schema, it will tell the behavior for the given credential type.
|
4
|
+
* @param {any} schema the schema to get the display info from
|
5
|
+
* @param {string} type the credential type to get the display info for
|
6
|
+
* @returns {CredentialTypeDisplayInfo} the display info for the credential type
|
7
|
+
*/
|
8
|
+
export declare const getCredentialTypeDisplayInfo: (schema: any, type: string) => CredentialTypeDisplayInfo;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { CredentialDisplayInfo } from '../types';
|
2
|
+
/**
|
3
|
+
* Retrieves credential values from a list of CredentialDisplayInfo objects.
|
4
|
+
*
|
5
|
+
* @param {CredentialDisplayInfo | CredentialDisplayInfo[]} credentialDisplayInfo - The list or object of CredentialDisplayInfo objects to extract values from.
|
6
|
+
* @param {string[]} [initialValue] - An optional initial array of values to concatenate the extracted values to.
|
7
|
+
* @returns {string[]} An array of extracted credential values.
|
8
|
+
*/
|
9
|
+
export declare function getCredentialValues(credentialDisplayInfo: CredentialDisplayInfo | CredentialDisplayInfo[], initialValue?: string[]): string[];
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* Extracts and returns schema names (i.e., $id or $ref properties) from a given input schema.
|
3
|
+
*
|
4
|
+
* @param {Object} schema - The input schema object.
|
5
|
+
* @param {number} [desiredDepth=1] - The maximum depth to search within the schema.
|
6
|
+
* @returns {string[]} An array of schema names.
|
7
|
+
*/
|
8
|
+
export declare const getReferencedSchemaNames: (schema: any, desiredDepth?: number) => string[];
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export * from './getCredentialTypeDisplayInfo';
|
2
|
+
export * from './isRequiredCredentialDisplayInfo';
|
3
|
+
export * from './isValidInputCredential';
|
4
|
+
export * from './makeCredentialDisplayInfoList';
|
5
|
+
export * from './findCorrectSchemaProperty';
|
6
|
+
export * from './getReferencedSchemaNames';
|
7
|
+
export * from './getCredentialValues';
|
8
|
+
export * from './isNewCredentialAgainstInstance';
|
9
|
+
export * from './filterRepeatedCredentials';
|
10
|
+
export * from './findCredentialsByType';
|
11
|
+
export * from './extractTypesFromSchema';
|
12
|
+
export * from './sortCredentialsBySchema';
|
13
|
+
export * from './transformToFormObject';
|
14
|
+
export * from './transformToFormSchema';
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { CredentialDisplayInfo } from '../types';
|
2
|
+
/**
|
3
|
+
* Checks if a `CredentialDisplayInfo` is a new credential instance.
|
4
|
+
*
|
5
|
+
* @param {CredentialDisplayInfo} credentialDisplayInfo - The `CredentialDisplayInfo` to check.
|
6
|
+
* @returns {boolean} `true` if it's a new instance, `false` otherwise.
|
7
|
+
* @throws {Error} Throws an error if `credentialDisplayInfo.originalInstance` is `null`.
|
8
|
+
*/
|
9
|
+
export declare function isNewCredentialAgainstInstance(credentialDisplayInfo: CredentialDisplayInfo): boolean;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { CredentialDisplayInfo } from '../types';
|
2
|
+
/**
|
3
|
+
* Returns true if all the values in the credential display info are empty.
|
4
|
+
* @param credentialDisplayInfo
|
5
|
+
*/
|
6
|
+
export declare function isNewCredentialValues(credentialDisplayInfo: CredentialDisplayInfo): boolean;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { CredentialDisplayInfo } from '../types';
|
2
|
+
type Options = {
|
3
|
+
phoneCredentialWhitelist?: string[];
|
4
|
+
phoneCredentialRegexWhitelist?: string;
|
5
|
+
};
|
6
|
+
/**
|
7
|
+
* Checks the validity of the credential based on the schema input pattern.
|
8
|
+
*/
|
9
|
+
export declare const isValidInputCredential: (value: string, schemaProperty: any | undefined, credentialDisplayInfo: CredentialDisplayInfo, options?: Options) => boolean | undefined;
|
10
|
+
export {};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { MandatoryEnum } from '../../../types/request';
|
2
|
+
import { CredentialDisplayInfo, CredentialRequests, Credentials } from '../types';
|
3
|
+
/**
|
4
|
+
* Orders credentials by the order from the list of credential requests.
|
5
|
+
* Used for displaying credentials on the Request page
|
6
|
+
* @param {Credentials[]} credentials the credentials to order
|
7
|
+
* @param {CredentialRequests[]} credentialRequests the credential requests to order by
|
8
|
+
* @param {any} schema the schema to use to get the display info for each credential
|
9
|
+
* @param options Attributes or properties to cascade down to children
|
10
|
+
* @returns {CredentialDisplayInfo[]} the ordered credential display info
|
11
|
+
*/
|
12
|
+
export declare const makeCredentialDisplayInfoList: (credentials: Credentials[], credentialRequests: CredentialRequests[], schema: any, options?: {
|
13
|
+
allowUserInput?: boolean;
|
14
|
+
mandatory?: MandatoryEnum;
|
15
|
+
}) => CredentialDisplayInfo[];
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { OneClickFormOptions } from '../../../contexts/one-click-form-options.context';
|
2
|
+
import { CredentialDisplayInfo } from '../types';
|
3
|
+
import * as zod from 'zod';
|
4
|
+
/**
|
5
|
+
* Transforms the display info list into a form schema.
|
6
|
+
* @param displayInfoList
|
7
|
+
*/
|
8
|
+
export declare function transformToFormSchema(displayInfoList: CredentialDisplayInfo[], oneClickFormOptions: OneClickFormOptions): zod.ZodObject<any>;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
type DataFieldCompositeProps = {
|
3
|
+
children?: ReactNode | ReactNode[] | undefined;
|
4
|
+
};
|
5
|
+
/**
|
6
|
+
* This component renders a composite level credential, followed by child of atomic/composite credentials.
|
7
|
+
* @param props
|
8
|
+
* @constructor
|
9
|
+
*/
|
10
|
+
export declare function DataFieldComposite(props: DataFieldCompositeProps): import("react").JSX.Element;
|
11
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
2
|
+
import { SxProps } from '@mui/material';
|
3
|
+
type DataFieldGroupProps = PropsWithChildren & {
|
4
|
+
sx?: SxProps;
|
5
|
+
};
|
6
|
+
/**
|
7
|
+
* Component used to group the other data field elements, should not use other than this.
|
8
|
+
* @param children
|
9
|
+
* @param sx
|
10
|
+
* @constructor
|
11
|
+
*/
|
12
|
+
export declare function DataFieldGroup({ children, sx }: DataFieldGroupProps): import("react").JSX.Element;
|
13
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function HeaderSelect(): import("react").JSX.Element;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
type DataFieldHeaderProps = Readonly<{
|
2
|
+
block?: boolean;
|
3
|
+
onFocus?: () => void;
|
4
|
+
}>;
|
5
|
+
/**
|
6
|
+
* This component renders the select for the composite level credential, it manages the selection
|
7
|
+
* of desired credential to be used.
|
8
|
+
* @constructor
|
9
|
+
*/
|
10
|
+
export declare function DataFieldHeader(props: DataFieldHeaderProps): import("react").JSX.Element;
|
11
|
+
export {};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { SxProps } from '@mui/material';
|
2
|
+
type DataFieldInputModeHeaderProps = {
|
3
|
+
sx?: SxProps;
|
4
|
+
};
|
5
|
+
/**
|
6
|
+
* Component that displays the header on input mode for a data field.
|
7
|
+
* @constructor
|
8
|
+
*/
|
9
|
+
export declare function DataFieldInputModeHeader(props: Readonly<DataFieldInputModeHeaderProps>): import("react").JSX.Element | null;
|
10
|
+
export {};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
2
|
+
import { OverridableStringUnion } from '@mui/types';
|
3
|
+
import { Variant } from '@mui/material/styles/createTypography';
|
4
|
+
import { SxProps } from '@mui/material';
|
5
|
+
import { TypographyPropsVariantOverrides } from '@mui/material/Typography/Typography';
|
6
|
+
type DataFieldLabelProps = PropsWithChildren & {
|
7
|
+
label?: ReactNode;
|
8
|
+
variant?: OverridableStringUnion<'inherit' | Variant, TypographyPropsVariantOverrides>;
|
9
|
+
sx?: SxProps;
|
10
|
+
};
|
11
|
+
/**
|
12
|
+
* Component to display a credential label.
|
13
|
+
* @param variant
|
14
|
+
* @param label
|
15
|
+
* @param sx
|
16
|
+
* @constructor
|
17
|
+
*/
|
18
|
+
export declare function DataFieldLabel({ variant, label, sx }: DataFieldLabelProps): import("react").JSX.Element;
|
19
|
+
export {};
|