@carto/meridian-ds 1.4.4-alpha-others.1 → 1.4.4-alpha-others.2

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/Alert-D8jI1sG4.js +134 -0
  3. package/dist/Alert-zqtoWsBL.cjs +133 -0
  4. package/dist/ArrowDown-8fLj23Ge.cjs +31 -0
  5. package/dist/ArrowDown-CY_wMVJT.js +32 -0
  6. package/dist/MenuItem-Br2jY2lt.cjs +164 -0
  7. package/dist/MenuItem-CXnnE5lK.js +165 -0
  8. package/dist/OpenDiagonallyRight-5HZXh46V.js +59 -0
  9. package/dist/OpenDiagonallyRight-BrRyCV4Q.cjs +58 -0
  10. package/dist/SwatchSquare-DDi0beUM.js +51 -0
  11. package/dist/SwatchSquare-w-U8-O-P.cjs +50 -0
  12. package/dist/TablePaginationActions-CFGXm44W.cjs +5661 -0
  13. package/dist/{TablePaginationActions-WZ3P4O35.js → TablePaginationActions-KpTvhN4Y.js} +1086 -656
  14. package/dist/components/index.cjs +4403 -1
  15. package/dist/components/index.js +3235 -1857
  16. package/dist/custom-icons/index.cjs +5857 -1
  17. package/dist/custom-icons/index.js +2658 -2326
  18. package/dist/paletteUtils-B9ybmwiI.cjs +304 -0
  19. package/dist/paletteUtils-BHqJlHm9.js +288 -0
  20. package/dist/theme/index.cjs +3135 -1
  21. package/dist/theme/index.js +1050 -1011
  22. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialog.d.ts +16 -0
  23. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialog.d.ts.map +1 -0
  24. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogConfirmation.d.ts +16 -0
  25. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogConfirmation.d.ts.map +1 -0
  26. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogContent.d.ts +10 -0
  27. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogContent.d.ts.map +1 -0
  28. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogError.d.ts +8 -0
  29. package/dist/types/components/organisms/CodeArea/CodeAreaDialog/CodeAreaDialogError.d.ts.map +1 -0
  30. package/dist/types/components/organisms/CodeArea/CodeAreaField.d.ts +4 -0
  31. package/dist/types/components/organisms/CodeArea/CodeAreaField.d.ts.map +1 -0
  32. package/dist/types/components/organisms/CodeArea/CodeAreaFooter.d.ts +12 -0
  33. package/dist/types/components/organisms/CodeArea/CodeAreaFooter.d.ts.map +1 -0
  34. package/dist/types/components/organisms/CodeArea/CodeAreaHeader.d.ts +9 -0
  35. package/dist/types/components/organisms/CodeArea/CodeAreaHeader.d.ts.map +1 -0
  36. package/dist/types/components/organisms/CodeArea/CodeAreaInput.d.ts +28 -0
  37. package/dist/types/components/organisms/CodeArea/CodeAreaInput.d.ts.map +1 -0
  38. package/dist/types/components/organisms/CodeArea/CodeAreaTheme.d.ts +7 -0
  39. package/dist/types/components/organisms/CodeArea/CodeAreaTheme.d.ts.map +1 -0
  40. package/dist/types/components/organisms/CodeArea/index.d.ts +9 -0
  41. package/dist/types/components/organisms/CodeArea/index.d.ts.map +1 -0
  42. package/dist/types/components/organisms/CodeArea/types.d.ts +38 -0
  43. package/dist/types/components/organisms/CodeArea/types.d.ts.map +1 -0
  44. package/dist/types/components/organisms/CodeArea/utils.d.ts +5 -0
  45. package/dist/types/components/organisms/CodeArea/utils.d.ts.map +1 -0
  46. package/dist/types/components/organisms/index.d.ts +2 -0
  47. package/dist/types/components/organisms/index.d.ts.map +1 -1
  48. package/dist/types/localization/en.d.ts +6 -0
  49. package/dist/types/localization/en.d.ts.map +1 -1
  50. package/dist/types/localization/es.d.ts +6 -0
  51. package/dist/types/localization/es.d.ts.map +1 -1
  52. package/dist/types/localization/id.d.ts +6 -0
  53. package/dist/types/localization/id.d.ts.map +1 -1
  54. package/dist/types/localization/index.d.ts +18 -0
  55. package/dist/types/localization/index.d.ts.map +1 -1
  56. package/dist/types/utils/chartConstants.d.ts +3 -3
  57. package/dist/types/utils/chartConstants.d.ts.map +1 -1
  58. package/dist/types/widgets/CategoryWidgetUI/CategoryWidgetUI.d.ts +2 -2
  59. package/dist/types/widgets/CategoryWidgetUI/CategoryWidgetUI.d.ts.map +1 -1
  60. package/dist/types/widgets/PieWidgetUI/PieWidgetUI.d.ts +2 -2
  61. package/dist/types/widgets/PieWidgetUI/PieWidgetUI.d.ts.map +1 -1
  62. package/dist/types/widgets/PieWidgetUI/usePieCategories.d.ts +2 -2
  63. package/dist/types/widgets/PieWidgetUI/usePieCategories.d.ts.map +1 -1
  64. package/dist/types/widgets/TimeSeriesWidgetUI/TimeSeriesWidgetUI.d.ts.map +1 -1
  65. package/dist/types/widgets/TimeSeriesWidgetUI/components/TimeSeriesChart.d.ts +2 -5
  66. package/dist/types/widgets/TimeSeriesWidgetUI/components/TimeSeriesChart.d.ts.map +1 -1
  67. package/dist/types/widgets/TimeSeriesWidgetUI/timeSeriesUtils.d.ts +7 -0
  68. package/dist/types/widgets/TimeSeriesWidgetUI/timeSeriesUtils.d.ts.map +1 -1
  69. package/dist/types/widgets/TimeSeriesWidgetUI/types.d.ts +6 -0
  70. package/dist/types/widgets/TimeSeriesWidgetUI/types.d.ts.map +1 -0
  71. package/dist/types/widgets/comparative/ComparativeCategoryWidgetUI/ComparativeCategoryWidgetUI.d.ts +2 -2
  72. package/dist/types/widgets/comparative/ComparativeCategoryWidgetUI/ComparativeCategoryWidgetUI.d.ts.map +1 -1
  73. package/dist/types/widgets/comparative/ComparativeCategoryWidgetUI/transposeCategoryData.d.ts +2 -2
  74. package/dist/types/widgets/comparative/ComparativeCategoryWidgetUI/transposeCategoryData.d.ts.map +1 -1
  75. package/dist/types/widgets/index.d.ts +1 -0
  76. package/dist/types/widgets/index.d.ts.map +1 -1
  77. package/dist/widgets/index.cjs +7192 -21
  78. package/dist/widgets/index.js +5182 -3806
  79. package/package.json +6 -1
  80. package/dist/Alert-BAvr1f31.js +0 -130
  81. package/dist/Alert-DPGMxifE.cjs +0 -4
  82. package/dist/ArrowDown-BD0WmQR3.cjs +0 -1
  83. package/dist/ArrowDown-CMhYkZ2p.js +0 -31
  84. package/dist/MenuItem-Cd34y6F3.js +0 -165
  85. package/dist/MenuItem-Dbss-WG1.cjs +0 -1
  86. package/dist/SwatchSquare-C34ayL4L.cjs +0 -1
  87. package/dist/SwatchSquare-CVpwEFFV.js +0 -48
  88. package/dist/TablePaginationActions-Bp1DCaIE.cjs +0 -9
  89. package/dist/paletteUtils-BEwZhrLg.js +0 -262
  90. package/dist/paletteUtils-DLQVT9qo.cjs +0 -1
@@ -1 +1,4403 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),h=require("react"),a=require("@mui/material"),y=require("../TablePaginationActions-Bp1DCaIE.cjs"),k=require("react-intl"),A=require("@mui/icons-material"),H=require("../Alert-DPGMxifE.cjs");require("cartocolor");const _=require("../MenuItem-Dbss-WG1.cjs"),P=require("../ArrowDown-BD0WmQR3.cjs"),xt=require("@mui/x-date-pickers/DatePicker"),ft=require("@mui/x-date-pickers"),mt=require("@mui/x-date-pickers/TimePicker"),ht=require("@mui/x-date-pickers/DateTimePicker"),bt=require("@mui/material/ClickAwayListener"),yt=a.styled(a.Box)({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"}),jt=a.styled(a.Box)({visibility:"hidden",pointerEvents:"none"});function Mt({children:t,loading:e,disabled:o,startIcon:i,endIcon:r,loadingPosition:l,...s},d){const c=n.jsx(a.CircularProgress,{size:18,color:"inherit"}),g=e&&l===void 0,m=()=>g?n.jsxs(a.Box,{sx:{position:"relative"},children:[n.jsx(yt,{children:c}),n.jsx(jt,{children:t})]}):t,u=f=>{if(!g)return e&&l!==void 0?l===f?c:void 0:f==="start"?i:r};return n.jsx(a.Button,{disabled:e||o,startIcon:u("start"),endIcon:u("end"),...s,role:s.href?"link":"button",ref:d,children:n.jsx(y.Typography,{variant:"inherit",color:"inherit",noWrap:!0,component:"span",children:m()})})}const It=h.forwardRef(Mt),Ct=a.styled(a.Box)(({theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(.5)})),vt=a.styled(y.Typography)(({theme:t})=>({".Mui-disabled &":{color:t.palette.text.disabled}})),Bt=a.styled(a.Box)(({theme:t})=>({display:"flex",svg:{width:y.ICON_SIZE_SMALL,height:y.ICON_SIZE_SMALL,fontSize:y.ICON_SIZE_SMALL,path:{fill:t.palette.text.secondary,".Mui-disabled &":{fill:t.palette.text.disabled}}}}));function O({label:t,type:e,icon:o,inheritSize:i}){return n.jsxs(Ct,{children:[t,e&&n.jsx(vt,{component:"span",variant:i?"inherit":"caption",color:"textSecondary",weight:"regular",children:e==="required"?"(required)":"(optional)"}),o&&n.jsx(Bt,{children:o})]})}function Dt({InputProps:t,size:e="small",...o},i){const r=k.useIntl(),l=y.useImperativeIntl(r),[s,d]=h.useState(!1),c=()=>d(!s);return n.jsx(a.TextField,{...o,ref:i,type:s?"text":"password",size:e,InputProps:{...t,endAdornment:n.jsx(a.InputAdornment,{position:"end",children:n.jsx(a.IconButton,{size:e,onClick:c,children:n.jsx(a.Tooltip,{title:l.formatMessage({id:`c4r.form.${s?"hidePassword":"showPassword"}`}),children:s?n.jsx(A.VisibilityOffOutlined,{}):n.jsx(A.VisibilityOutlined,{})})})})}})}const St=h.forwardRef(Dt),$={};function Tt(t="$lodash$"){$[t]||($[t]=0);const e=++$[t];return t==="$lodash$"?`${e}`:`${t}${e}`}const At=a.styled(a.Select)(({theme:t})=>({"& .MuiInputAdornment-positionStart":{paddingLeft:t.spacing(2),"&.MuiInputAdornment-sizeSmall":{paddingLeft:t.spacing(1.5)}},"& .MuiInputBase-inputAdornedStart":{paddingLeft:"0px !important"},"& .MuiSelect-select .MuiMenuItem-root:hover":{backgroundColor:"transparent"},"&.MuiInputBase-root .MuiSelect-select.MuiSelect-multiple":{paddingRight:t.spacing(7)}})),kt=a.styled(a.MenuItem)(()=>({display:"none"}));function wt({children:t,placeholder:e,size:o="small",displayEmpty:i,menuProps:r,inputProps:l,labelId:s,label:d,labelSecondary:c,helperText:g,name:m,error:u,focused:f,disabled:p,fullWidth:x,required:M,"aria-label":b,...B},C){const v=o==="small",[j]=h.useState(()=>Tt("select-label-")),I=d?s??j:void 0;return n.jsxs(a.FormControl,{size:o,error:u,focused:f,disabled:p,fullWidth:x,required:M,"data-name":"select-field","data-size":o,children:[n.jsxs(a.Box,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[d&&n.jsx(a.InputLabel,{shrink:!0,id:I,children:d}),c&&n.jsx(a.Box,{display:"flex",alignItems:"center",ml:2,mb:.5,children:c})]}),n.jsxs(At,{...B,labelId:I,name:m,ref:C,size:o,fullWidth:x,displayEmpty:i??!!e,inputProps:{...l,"aria-label":b},MenuProps:{...r,PopoverClasses:{paper:v?"MuiMenu-paper-sizeSmall":void 0},anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:0,horizontal:"left"}},children:[e&&n.jsx(kt,{disabled:!0,value:"",children:n.jsx(y.Typography,{variant:v?"body2":"body1",color:"text.hint",component:"span",children:e})}),t]}),g&&n.jsx(a.FormHelperText,{"aria-label":`${m}-helper`,children:g})]})}const tt=h.forwardRef(wt),Rt=a.styled(a.ToggleButtonGroup,{shouldForwardProp:t=>t!=="variant"&&t!=="backgroundColor"})(({variant:t,backgroundColor:e,theme:o})=>({...t==="contained"&&{boxShadow:"none"},...t==="unbounded"&&{boxShadow:"none",borderRadius:o.spacing(.5),"& .MuiDivider-root":{height:o.spacing(4),"&.MuiToggleButtonGroup-groupedHorizontal":{height:o.spacing(4)},"&.MuiToggleButtonGroup-groupedVertical":{height:"auto",width:o.spacing(4),margin:`${o.spacing(.5,0,1)} !important`,borderRadius:"0 !important"}},"& .MuiToggleButton-sizeSmall":{margin:0,"&.MuiToggleButtonGroup-grouped:not(.MuiDivider-root)":{margin:0},"& + .MuiDivider-root.MuiToggleButtonGroup-groupedHorizontal":{height:o.spacing(3)},"& + .MuiDivider-root.MuiToggleButtonGroup-groupedVertical":{height:"auto",width:o.spacing(3)}},".MuiToggleButtonGroup-grouped:not(.MuiDivider-root)":{margin:0,"&:first-of-type":{marginLeft:0},"&:not(:last-of-type)":{marginRight:o.spacing(.5)}},"&.MuiToggleButtonGroup-horizontal:not(.MuiDivider-root)":{".MuiToggleButtonGroup-grouped":{margin:o.spacing(0,.5)}},"&.MuiToggleButtonGroup-vertical:not(.MuiDivider-root)":{".MuiToggleButtonGroup-grouped":{margin:o.spacing(0,0,.5),"&:not(:last-of-type)":{marginRight:0},"&:last-of-type":{marginBottom:0}}}},...e==="primary"&&{backgroundColor:o.palette.background.paper},...e==="secondary"&&{backgroundColor:o.palette.background.default},...e==="transparent"&&{backgroundColor:"transparent"}}));function Ft({children:t,variant:e="floating",backgroundColor:o,...i}){const l=e==="unbounded"?"transparent":"primary";return n.jsx(Rt,{...i,variant:e,backgroundColor:o??l,children:t})}const Ot=a.styled("div")(({theme:t})=>({position:"relative",display:"inline-flex","& + &, & + .optionIconButton":{marginLeft:t.spacing(.5)}})),$t=a.styled(a.IconButton,{shouldForwardProp:t=>!["active"].includes(t)})(({active:t,theme:e})=>({...t&&{color:e.palette.primary.main,backgroundColor:e.palette.primary.background,"& svg:not(.doNotFillIcon) path":{fill:e.palette.primary.main}}}));function Lt({tooltip:t,tooltipPlacement:e="top",icon:o,size:i="medium",variant:r="icon",color:l="default",sx:s,className:d,loading:c,disabled:g,active:m,...u},f){return n.jsx(a.Tooltip,{placement:e,title:t??"",children:n.jsx(Ot,{className:`optionIconButton ${d??""}`,sx:s,"data-testid":"icon-button",children:n.jsx($t,{...u,ref:f,size:i,variant:r,color:l,active:m,disabled:g||c,role:"button",children:c?n.jsx(a.CircularProgress,{size:18,color:"inherit"}):o})})})}const N=h.forwardRef(Lt),Et=a.styled(a.Menu,{shouldForwardProp:t=>!["extended","width","height"].includes(t)})(({theme:t,extended:e,width:o,height:i})=>({...e&&{".MuiMenuItem-root":{minHeight:t.spacing(6)}},...o&&{".MuiList-root":{width:o,minWidth:o}},...i&&{".MuiMenu-paper":{overflow:"hidden"},".MuiList-root":{maxHeight:i}}}));function Wt({extended:t,width:e,height:o,MenuListProps:i,...r},l){return n.jsx(Et,{...r,ref:l,"data-name":"menu",width:e,height:o,extended:t,MenuListProps:{...i,"data-width":e,"data-height":o,"data-extended":t}})}const Ht=h.forwardRef(Wt),_t=a.styled(a.MenuList,{shouldForwardProp:t=>!["extended","width","height"].includes(t)})(({theme:t,extended:e,width:o,height:i})=>({...e&&{".MuiMenuItem-root":{minHeight:t.spacing(6)}},"&.MuiList-root":{...o&&{width:o,minWidth:o},...i&&{maxHeight:i}}}));function Pt({extended:t,width:e,height:o,...i},r){return n.jsx(_t,{...i,ref:r,width:e,height:o,extended:t,"data-name":"menu-list","data-width":e,"data-height":o,"data-extended":t})}const Nt=h.forwardRef(Pt),qt=a.styled(_.MenuItem)(()=>({marginTop:"0 !important"})),Gt=a.styled(a.Link)(({disabled:t,theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),width:"100%",textAlign:"initial",...t&&{pointerEvents:"none",color:e.palette.text.disabled}}));function Vt({areAllSelected:t,areAnySelected:e,selectAll:o,selectAllDisabled:i,"aria-label":r,"data-testid":l},s){const d=k.useIntl(),c=y.useImperativeIntl(d);return n.jsx(qt,{ref:s,fixed:!0,"data-name":"menu-filter","aria-label":r,"data-testid":l,children:n.jsxs(Gt,{variant:"body2",color:"textPrimary",component:"button",underline:"none",disabled:!!i,onClick:o,tabIndex:0,children:[n.jsx(a.Checkbox,{checked:t,indeterminate:e&&!t,disabled:i}),c.formatMessage({id:"c4r.form.selectAll"})]})})}const q=h.forwardRef(Vt);function Ut({selectedOptions:t,options:e,onChange:o}){const[i,r]=h.useState(t??[]),l=e.length===i.length,s=i.length>0;return h.useEffect(()=>{i!==t&&r(i)},[t]),{areAllSelected:l,areAnySelected:s,currentOptions:i,handleChange:m=>{const{target:{value:u}}=m,f=typeof u=="string"?u.split(","):u.filter(p=>p!==void 0);r(f),o(f)},selectAll:()=>{const m=e==null?void 0:e.filter(({disabled:u})=>!u).map(({value:u})=>u);m&&(m.every(f=>i.includes(f))?(r([]),o([])):(r(m),o(m)))},unselectAll:()=>{r([]),o([])}}}const zt=a.styled(a.MenuItem)(({theme:t})=>({"&.Mui-disabled":{pointerEvents:"auto","&:hover":{backgroundColor:`${t.palette.background.default} !important`}}})),Yt=a.styled(a.InputAdornment,{shouldForwardProp:t=>t!=="size"})(({theme:t,size:e})=>({display:"none",position:"absolute",top:t.spacing(2),right:t.spacing(3.5),".MuiInputBase-root:hover &, .MuiInputBase-root.Mui-focused &":{display:"flex"},".MuiSvgIcon-root":{color:t.palette.text.hint},...e==="medium"&&{top:t.spacing(3),right:t.spacing(5)}})),Zt=[],Jt=()=>{};function Xt({options:t=Zt,selectedOptions:e,size:o="small",placeholder:i,showCounter:r,showFilters:l=!0,onChange:s=Jt,selectAllDisabled:d,tooltipPlacement:c,variant:g,...m},u){const{areAllSelected:f,areAnySelected:p,currentOptions:x,handleChange:M,selectAll:b,unselectAll:B}=Ut({options:t,selectedOptions:e,onChange:s}),C=o==="small",v=C||g==="standard"?0:2,j=k.useIntl(),I=y.useImperativeIntl(j),T=`${x.length} ${I.formatMessage({id:"c4r.form.selected"})}`,w=h.useMemo(()=>f?n.jsx(y.Typography,{component:"span",variant:C?"body2":"body1",color:"textPrimary",ml:v,children:I.formatMessage({id:"c4r.form.allSelected"})}):p?n.jsx(y.Typography,{component:"span",variant:C?"body2":"body1",color:"textPrimary",ml:v,children:r&&x.length>1?T:x.join(", ")}):n.jsx(y.Typography,{component:"span",variant:C?"body2":"body1",color:"text.hint",ml:v,children:i??I.formatMessage({id:"c4r.form.noneSelected"})}),[f,p,T,x,I,C,v,i,r]);return n.jsxs(tt,{...m,ref:u,multiple:!0,displayEmpty:!0,placeholder:i,value:x,renderValue:()=>w,onChange:M,size:o,variant:g,endAdornment:l&&p&&n.jsx(Yt,{position:"end",size:o,children:n.jsx(a.IconButton,{onClick:B,size:o,children:n.jsx(A.Cancel,{})})}),menuProps:{PaperProps:{sx:{".MuiList-root":{paddingTop:0}}}},children:[l&&n.jsx(q,{areAllSelected:f,areAnySelected:p,selectAll:b,selectAllDisabled:d}),t==null?void 0:t.map(S=>{const F=n.jsxs(zt,{value:S.value,disabled:S.disabled,tabIndex:0,children:[n.jsx(a.Checkbox,{disabled:S.disabled,checked:x.includes(S.value)}),n.jsx(a.ListItemText,{primary:S.label})]},S.value);return S.tooltip?n.jsx(a.Tooltip,{title:S.tooltip,placement:c,children:F},S.value):F})]})}const Kt=h.forwardRef(Xt),Qt=a.styled(a.TextField,{shouldForwardProp:t=>t!=="cursor"})(({cursor:t,theme:e})=>({"&.MuiTextField-root .MuiInputBase-root":{cursor:t,paddingRight:e.spacing(1),"& input":{cursor:t},"&.Mui-disabled":{pointerEvents:"none","& .MuiButtonBase-root":{color:e.palette.text.disabled}},"&.MuiInputBase-sizeSmall":{paddingRight:e.spacing(.5)}},"& .MuiFormLabel-root":{cursor:t,"&.Mui-disabled":{pointerEvents:"none"}}}));function te({buttonText:t,hasFiles:e,size:o,error:i,disabled:r,handleReset:l,handleOpen:s,inProgress:d}){return n.jsx(a.InputAdornment,{position:"end",children:d?n.jsx(a.IconButton,{"aria-label":"Loading",disabled:!0,size:o,children:n.jsx(a.CircularProgress,{size:18})}):e?n.jsx(a.IconButton,{onClick:l,size:o,"aria-label":"Delete",disabled:r,children:n.jsx(A.Cancel,{})}):n.jsx(a.Button,{onClick:s,size:o,variant:"text",color:i?"default":"primary",disabled:r,children:t})})}function et({name:t,multiple:e,handleReset:o,handleOpen:i,dragOver:r,error:l,placeholder:s,focused:d,buttonText:c="Browse",inProgress:g,InputProps:m,size:u="small",hasFiles:f,cursor:p="pointer",...x}){return n.jsx(Qt,{...x,size:u,error:l,placeholder:s,focused:d??r,cursor:p,InputProps:{...m,name:t,readOnly:!0,endAdornment:n.jsx(te,{buttonText:c,hasFiles:f,size:u,error:l,disabled:!!r,handleReset:o,handleOpen:i,inProgress:g})}})}function ee({onChange:t,files:e,multiple:o,placeholder:i,uploadInputRef:r}){const l=k.useIntl(),s=y.useImperativeIntl(l),[d,c]=h.useState(""),[g,m]=h.useState(!1);h.useEffect(()=>{!e||e.length===0?c(""):e.length===1?c(e[0].name):c(s.formatMessage({id:"c4r.form.filesSelected"},{count:e.length}))},[e,s]);const u=()=>{var j;(j=r.current)==null||j.click()},f=j=>{j.preventDefault(),m(!0)},p=j=>{j.preventDefault(),m(!1)},x=j=>{j.preventDefault(),m(!1);const I=j.dataTransfer.items,T=M(I);t==null||t(T)},M=j=>{const I=[];for(const T of Array.from(j))if(T.kind==="file"){const w=T.getAsFile();I.push(w)}return I},b=j=>{const I=Array.from(j.target.files);t==null||t(I)},B=j=>{j.stopPropagation(),c("")},C=h.useMemo(()=>{const j=s.formatMessage({id:"c4r.form.dragPlaceholder"},{count:o?0:1}),I=s.formatMessage({id:"c4r.form.dragActivePlaceholder"},{count:o?0:1});let T="";return g?T=I:T=i??j,T},[g,o,i,s]);return{filesText:d,getPlaceholder:C,dragOver:g,inputEvents:{onDragOver:f,onDragLeave:p,onDrop:x,onClick:u},handleFiles:b,handleReset:B}}const ne=["application/JSON"];function oe({name:t,buttonText:e,accept:o,files:i,inProgress:r,onChange:l,multiple:s,placeholder:d,error:c,focused:g,nativeInputProps:m,...u}){const f=o??ne,p=h.useRef(null),{filesText:x,getPlaceholder:M,dragOver:b,inputEvents:B,handleFiles:C,handleReset:v}=ee({uploadInputRef:p,files:i,onChange:l,multiple:s,placeholder:d});return n.jsxs(n.Fragment,{children:[n.jsx(et,{...u,placeholder:M,value:x,error:c,focused:g??b,handleReset:v,dragOver:b,inProgress:r,hasFiles:!!x,InputProps:B,buttonText:e}),n.jsx("input",{...m,ref:p,style:{display:"none"},type:"file","aria-label":t,name:t,accept:String(f),multiple:s,onChange:C})]})}function ie({disabled:t,loading:e,...o},i){return n.jsx(a.Autocomplete,{...o,ref:i,disabled:t||e,popupIcon:e?n.jsx(a.CircularProgress,{size:18,color:"inherit"}):n.jsx(P.ArrowDown,{}),"data-name":"autocomplete",ListboxProps:{"aria-multiselectable":!1,...o.ListboxProps}})}const ae=h.forwardRef(ie),nt=t=>t&&typeof t=="object"?t.title??String(t):String(t),ot=(t,e)=>typeof t!="object"||t===null?{value:t,multiple:e}:{...t,multiple:e},it=t=>n.jsx("span",{"data-testid":"more-options-tag",children:`+${t}`});function at(){return{renderOption:(e,o,i,r,l)=>{const{title:s,inputValue:d,divider:c,fixed:g,extended:m,dense:u,destructive:f,disabled:p,subtitle:x,iconColor:M,startAdornment:b,endAdornment:B,alternativeTitle:C,secondaryText:v,multiple:j}=o,{key:I,...T}=e,w=typeof o=="string"||typeof o=="number",S=(F,D,R,Y)=>R||Y||(D&&typeof D=="object"&&"value"in D?String(D.value):F(D));return n.jsx(h.Fragment,{children:c?n.jsx(a.Divider,{}):n.jsxs(n.Fragment,{children:[d&&n.jsx(a.Divider,{}),n.jsxs(_.MenuItem,{...T,...!w&&{fixed:g,extended:m,dense:u,destructive:f,disabled:p,subtitle:x,iconColor:M},"aria-disabled":x||p,"aria-selected":i.selected,children:[!x&&(b||j||l)&&n.jsxs(a.ListItemIcon,{children:[l||j&&n.jsx(a.Checkbox,{checked:i.selected}),b]}),n.jsxs(a.ListItemText,{children:[S(r??nt,o,C,s),v&&n.jsx(y.Typography,{component:"p",variant:"caption",color:"text.secondary",children:v})]}),!x&&B]})]})},I)}}}function re({getOptionLabel:t,newItemLabel:e,newItemIcon:o,multiple:i}){const r=k.useIntl(),l=y.useImperativeIntl(r),s=a.createFilterOptions(),{renderOption:d}=at();return{creatableFilterOptions:(u,f)=>{const p=s(u,f),{inputValue:x}=f,M=u.some(b=>x===t(b));if(x.length>1&&x!==""&&!M){let b;typeof e=="function"?b=e(x):e?b=`${e} "${x}"`:b=`${l.formatMessage({id:"c4r.form.add"})} "${x}"`,p.push({inputValue:x,title:b})}return p},creatableOptionLabel:u=>typeof u=="string"?u:u.inputValue?u.inputValue:t(u),creatableRenderOption:(u,f,p)=>{const x=f.inputValue?o??n.jsx(A.AddCircleOutlineOutlined,{}):void 0,M=ot(f,!!i);return d(u,M,p,t,x)}}}function rt({options:t,value:e,onChange:o,getOptionLabel:i}){const[r,l]=h.useState(Array.isArray(e)?e:e?[e]:[]),{renderOption:s}=at();h.useEffect(()=>{const f=Array.isArray(e)?e:e?[e]:[];l(f)},[e]);const d=r.length===t.length,c=r.length>0&&r.length<t.length;return{multipleValue:r,allSelected:d,someSelected:c,handleSelectAll:f=>{const p=d?[]:[...t];l(p),o==null||o(f,p,"selectOption")},handleChange:(f,p,x)=>{l(p===null?[]:p),o==null||o(f,p,x)},multipleRenderOption:(f,p,x)=>{const M=ot(p,!0);return s(f,M,x,i)}}}function le({children:t,showFilters:e,allSelected:o,someSelected:i,handleSelectAll:r=()=>{},multiple:l,...s},d){return n.jsxs("ul",{ref:d,...s,role:"listbox","aria-multiselectable":l,children:[e&&l&&n.jsx(q,{areAllSelected:!!o,areAnySelected:!!i,selectAll:r}),t]})}const lt=h.forwardRef(le);function se({newItemLabel:t,newItemIcon:e,getOptionLabel:o=nt,multiple:i,disableCloseOnSelect:r,disabled:l,loading:s,showFilters:d,options:c=[],value:g,onChange:m,getLimitTagsText:u,...f},p){const{freeSolo:x=!0,...M}=f,{multipleValue:b,allSelected:B,someSelected:C,handleSelectAll:v,handleChange:j}=rt({options:c,value:g,onChange:m}),{creatableFilterOptions:I,creatableOptionLabel:T,creatableRenderOption:w}=re({getOptionLabel:o,newItemLabel:t,newItemIcon:e,multiple:i});return n.jsx(a.Autocomplete,{...M,ref:p,options:c,value:i?b:g,onChange:j,filterOptions:I,getOptionLabel:T,renderOption:w,freeSolo:x,forcePopupIcon:!0,multiple:i,disableCloseOnSelect:r??i,ListboxComponent:lt,ListboxProps:{showFilters:d,allSelected:B,someSelected:C,handleSelectAll:v,multiple:i},getLimitTagsText:u??it,disabled:l||s,popupIcon:s?n.jsx(a.CircularProgress,{size:18,color:"inherit"}):n.jsx(P.ArrowDown,{}),"data-name":"creatable-autocomplete"})}const ce=h.forwardRef(se);function de({renderOption:t,disableCloseOnSelect:e=!0,disabled:o,loading:i,showFilters:r,options:l,value:s,onChange:d,getOptionLabel:c,getLimitTagsText:g,...m},u){const{multipleValue:f,allSelected:p,someSelected:x,handleSelectAll:M,handleChange:b,multipleRenderOption:B}=rt({options:l,value:s,onChange:d,getOptionLabel:c});return n.jsx(a.Autocomplete,{...m,ref:u,options:l,value:f,onChange:b,getOptionLabel:c,renderOption:t??B,ListboxComponent:lt,ListboxProps:{showFilters:r,allSelected:p,someSelected:x,handleSelectAll:M,multiple:!0},multiple:!0,getLimitTagsText:g??it,disableCloseOnSelect:e,disabled:o||i,popupIcon:i?n.jsx(a.CircularProgress,{size:18,color:"inherit"}):n.jsx(P.ArrowDown,{}),"data-name":"multiple-autocomplete"})}const ue=h.forwardRef(de),pe=({children:t,disabled:e,value:o,onCopied:i,copyText:r="c4r.button.copy",copiedText:l="c4r.notifications.copiedToClipboard",button:s,buttonLabel:d,buttonProps:c,ariaLabel:g,dataTestId:m,tooltipPlacement:u="top",...f},p)=>{const x=k.useIntl(),M=y.useImperativeIntl(x),[b,B]=h.useState(!1),{copy:C}=ct(r,l),v=j=>{j.preventDefault(),C(o).then(()=>{i==null||i(),B(!0)}).catch(console.error)};return n.jsxs(n.Fragment,{children:[n.jsx(a.Tooltip,{title:M.formatMessage({id:r}),leaveDelay:0,placement:u,children:n.jsxs(a.Box,{...f,sx:{cursor:e?void 0:"pointer"},onClick:v,"data-name":"copiable",ref:p,children:[t,s&&n.jsx(N,{...c,disabled:e,icon:n.jsx(A.ContentCopyOutlined,{}),"data-testid":m,"aria-label":g||d,sx:{display:"flex"}})]})}),n.jsx(ut,{open:b,autoWidth:!0,closeable:!1,autoHideDuration:4e3,onClose:()=>B(!1),children:M.formatMessage({id:l})})]})},ge=h.forwardRef(pe);async function st(t){return await navigator.clipboard.writeText(t)}const ct=(t="c4r.button.copy",e="c4r.notifications.copiedToClipboard")=>{const[o,i]=h.useState(t);return{message:o,copy:async l=>{await st(l),i(e),setTimeout(()=>i(t),1e3)}}},xe=a.styled("div",{shouldForwardProp:t=>t!=="variant"})(({variant:t,theme:e})=>({width:"100%",borderRadius:e.spacing(.5),...t==="outlined"&&{backgroundColor:e.palette.background.paper,boxShadow:`inset 0 0 0 1px ${e.palette.divider}`}}));function fe({variant:t="standard",items:e,...o}){return n.jsx(xe,{...o,variant:t,children:e.map((i,r)=>n.jsxs(a.Accordion,{disabled:i.disabled,defaultExpanded:i.defaultExpanded,onChange:i.onChange,children:[n.jsx(a.AccordionSummary,{"aria-controls":`${r}-content`,id:`${r}-header`,children:i.summary}),n.jsx(a.AccordionDetails,{children:i.content})]},r))})}const Z={large:5,medium:4,small:3,xsmall:2.25},me=a.styled(a.Avatar,{shouldForwardProp:t=>t!=="size"&&t!=="disabled"})(({theme:t,size:e="medium",disabled:o=!1})=>({width:t.spacing(Z[e]),height:t.spacing(Z[e]),...t.typography.subtitle1,...e==="large"&&{...t.typography.h6},...e==="small"&&{...t.typography.caption,fontWeight:500},...e==="xsmall"&&{...t.typography.caption,fontWeight:500,svg:{width:y.ICON_SIZE_SMALL,height:y.ICON_SIZE_SMALL}},...o&&{opacity:.6}}));function he(t){return n.jsx(me,{...t})}const dt=480,be=a.styled(a.Snackbar)(({theme:t})=>({bottom:t.spacing(2),right:t.spacing(2),left:t.spacing(2),[t.breakpoints.up("sm")]:{bottom:t.spacing(4),right:"auto",left:"50%",width:"100%",maxWidth:`${dt}px`}})),ye=a.styled(a.Box,{shouldForwardProp:t=>t!=="autoWidth"})(({autoWidth:t,theme:e})=>({minWidth:"100%",maxWidth:`${dt}px`,margin:e.spacing(0,1),...t&&{minWidth:"auto"},[e.breakpoints.up("sm")]:{minWidth:e.spacing(40),...t&&{minWidth:"auto"}}})),je=a.styled(H.Alert,{shouldForwardProp:t=>!["hasActions","closeable"].includes(t)})(({hasActions:t,closeable:e,icon:o,theme:i})=>({position:"relative",display:"flex",flexWrap:"wrap",columnGap:i.spacing(1),rowGap:i.spacing(.25),padding:i.spacing(1),paddingLeft:i.spacing(2),color:i.palette.common.white,backgroundColor:i.palette.common.black,".MuiAlert-message":{padding:i.spacing(.75,0)},".MuiAlert-message .MuiTypography-root, .MuiAlert-icon":{color:i.palette.common.white},".MuiAlert-message .MuiTypography-root:not(.MuiAlertTitle-root)":{...i.typography.body2},".MuiAlert-message .MuiCircularProgress-circle":{color:i.palette.common.white},".MuiAlert-icon":{position:"absolute",top:i.spacing(1),left:i.spacing(1.5),display:"flex",alignItems:"center",justifyContent:"center",width:i.spacing(3),marginTop:i.spacing(.5)},"&.MuiAlert-standardError":{backgroundColor:i.palette.error.main},...o!==!1&&{paddingLeft:i.spacing(5.5)},...e&&{paddingRight:i.spacing(6)},...!e&&!t&&{paddingRight:i.spacing(1.5)},...t&&{".MuiAlert-message":{minWidth:"fit-content",padding:i.spacing(.75,0)}}})),Me=a.styled(a.Box)(({theme:t})=>({position:"absolute",top:t.spacing(1),right:t.spacing(1),"& button:hover, & button:focus-visible":{backgroundColor:t.palette.white[8]},svg:{color:t.palette.white[60]}}));function ut({severity:t="neutral",autoHideDuration:e=y.NOTIFICATION_DURATION_IN_MS,closeable:o=!0,children:i,title:r,action:l,open:s,onClose:d=()=>{},autoWidth:c,icon:g,...m}){const u=k.useIntl(),f=y.useImperativeIntl(u),x=g===!1||t==="neutral"&&!g,b=e===null?null:e||y.NOTIFICATION_DURATION_IN_MS;return n.jsx(a.Portal,{children:n.jsx(be,{...m,open:s,autoHideDuration:b,onClose:d,TransitionComponent:c?a.Fade:a.Slide,"data-auto-width":c,children:n.jsxs(ye,{sx:{position:"relative"},autoWidth:c,children:[n.jsx(je,{severity:t,action:l,icon:x?!1:g,elevation:6,hasActions:!!l,closeable:o,title:r,children:i}),o&&n.jsx(Me,{children:n.jsx(N,{color:"default",onClick:B=>d(B,"timeout"),icon:n.jsx(A.CloseOutlined,{}),tooltip:f.formatMessage({id:"c4r.button.close"})})})]})})})}const Ie=a.styled("div")(({theme:t})=>({display:"flex",alignItems:"center",height:y.APPBAR_SIZE,marginRight:t.spacing(1.5)})),Ce=a.styled(a.IconButton)(({theme:t})=>({marginRight:t.spacing(1),"&.MuiButtonBase-root svg path":{fill:t.palette.brand.appBarContrastText}})),ve=a.styled(a.Divider)(({theme:t})=>({borderColor:a.alpha(t.palette.brand.appBarContrastText,.12)}));function Be({onClickMenu:t}){return n.jsx(a.Box,{sx:{display:{md:"none",xs:"block"}},children:n.jsxs(Ie,{children:[n.jsx(Ce,{onClick:t,children:n.jsx(A.MenuOutlined,{})}),n.jsx(ve,{orientation:"vertical",flexItem:!0})]})})}const De=a.styled("div")(({theme:t})=>({display:"flex",marginRight:t.spacing(1.5),"& a":{display:"flex"},"& svg, & img":{width:t.spacing(4),height:t.spacing(4)}}));function Se({logo:t}){return n.jsx(De,{children:t})}const Te=a.styled(y.Typography)({display:"flex",alignItems:"center",whiteSpace:"nowrap"});function Ae({text:t}){const e=a.useTheme();return n.jsx(Te,{component:"span",variant:"subtitle1",color:e.palette.brand.appBarContrastText,children:t})}const ke=a.styled(y.Typography)(({theme:t})=>({display:"flex",alignItems:"center","&::before":{content:'"/"',margin:t.spacing(0,1),opacity:.6,color:t.palette.brand.appBarContrastText}}));function we({text:t}){const e=a.useTheme();return n.jsx(ke,{component:"span",variant:"body2",weight:"strong",color:e.palette.brand.appBarContrastText,children:t})}const Re=a.styled(a.AppBar)(({theme:t})=>({backgroundColor:t.palette.brand.appBarMain,"& .MuiTypography-root":{color:t.palette.brand.appBarContrastText},"& .MuiIconButton-root path":{fill:t.palette.brand.appBarContrastText}})),Fe=a.styled("div")(({theme:t})=>({display:"flex",alignItems:"center",maxWidth:"calc(100% - 300px)",overflow:"hidden",[t.breakpoints.down("sm")]:{minWidth:"192px"}})),Oe=a.styled("div")(({theme:t})=>({display:"flex",alignItems:"center",justifyContent:"space-between",flex:1,marginLeft:t.spacing(1)}));function $e({children:t,brandLogo:e,brandText:o,secondaryText:i,showBurgerMenu:r=!1,onClickMenu:l,...s}){return n.jsx(Re,{...s,children:n.jsxs(a.Toolbar,{children:[n.jsxs(Fe,{children:[r&&n.jsx(Be,{onClickMenu:l}),e&&n.jsx(Se,{logo:e}),o&&n.jsx(Ae,{text:o}),i&&n.jsx(we,{text:i})]}),n.jsx(Oe,{children:t})]})})}const Le=a.styled(a.Box,{shouldForwardProp:t=>!["size","variant"].includes(t)})(({size:t,variant:e,theme:o})=>({position:"absolute",right:o.spacing(5.75),...t==="small"&&{right:o.spacing(4),top:"3px"},...e==="standard"&&{right:o.spacing(4.75),...t==="small"&&{right:o.spacing(3.5)}}}));function G({size:t,variant:e,...o}){const i=k.useIntl(),r=y.useImperativeIntl(i);return n.jsx(Le,{size:t,variant:e,children:n.jsx(a.IconButton,{...o,size:t,"aria-label":r.formatMessage({id:"c4r.form.clearSelection"})})})}const Ee=a.styled(a.Box,{shouldForwardProp:t=>!["size","variant","readOnly"].includes(t)})(({size:t,variant:e,readOnly:o,theme:i})=>({".MuiInputBase-root":{"& .clearButton svg":{color:i.palette.text.hint},...t==="small"&&{paddingRight:`${i.spacing(1)} !important`},...t==="medium"&&{"& .MuiInputAdornment-root":{"& .MuiIconButton-edgeEnd":{marginRight:i.spacing(-1)}}},...e==="standard"&&{paddingRight:`${i.spacing(1)} !important`,...t==="small"&&{paddingRight:`${i.spacing(.5)} !important`}},...o&&{"& .MuiInputAdornment-root":{"& svg":{color:i.palette.text.disabled}}}}}));function V({children:t,size:e,variant:o,readOnly:i,...r}){return n.jsx(Ee,{...r,size:e,variant:o,readOnly:i,children:t})}function L({handleClear:t,variant:e="outlined",size:o="small",label:i,labelHelpTooltip:r,type:l,helperText:s,placeholder:d,slotProps:c,slots:g,error:m,showCalendar:u=!0,readOnly:f,"aria-label":p,"data-testid":x,...M}){const b=k.useIntl(),B=y.useImperativeIntl(b);return n.jsx(a.Box,{className:"CartoDatePicker-root","data-testid":"date-picker",children:n.jsx(V,{size:o,variant:e,readOnly:f,"data-name":"date-picker","aria-label":p,"data-testid":x,children:n.jsx(xt.DatePicker,{...M,label:i&&n.jsx(O,{label:i,type:l,icon:r&&n.jsx(a.Tooltip,{title:r,children:n.jsx(A.HelpOutline,{htmlColor:"text.secondary"})})}),slotProps:{textField:{variant:e,helperText:s,placeholder:d,size:o,error:m??void 0,inputProps:{"data-testid":"date-picker-input"}},field:{clearable:!!t,onClear:t},...c},slots:{clearButton:C=>n.jsx(G,{...C,size:o,variant:e}),openPickerButton:C=>n.jsx(a.IconButton,{...C,size:o,"aria-label":B.formatMessage({id:"c4r.form.chooseDate"})}),...g},disableOpenPicker:!u,readOnly:f})})})}const We=a.styled(a.Box,{shouldForwardProp:t=>!["isSelected","isStartDate","isEndDate","isSelectedMonth","isLastDay","isFirstDay"].includes(t)})(({theme:t,isSelected:e,isStartDate:o,isEndDate:i,isSelectedMonth:r,isLastDay:l,isFirstDay:s})=>({position:"relative",margin:t.spacing(.25),"& .MuiPickersDay-root":{margin:0},...e&&r&&{"&::before":{content:'""',position:"absolute",top:0,right:"-2px",bottom:0,left:"-2px",backgroundColor:t.palette.primary.background,...(o||s)&&{left:0,borderRadius:`${t.shape.borderRadius}px 0 0 ${t.shape.borderRadius}px`},...(i||l)&&{right:0,borderRadius:`0 ${t.shape.borderRadius}px ${t.shape.borderRadius}px 0`}},"&:first-of-type::before":{left:0,borderRadius:`${t.shape.borderRadius}px 0 0 ${t.shape.borderRadius}px`},"&:last-of-type::before":{right:0,borderRadius:`0 ${t.shape.borderRadius}px ${t.shape.borderRadius}px 0`},...s&&{"&:last-of-type::before":{left:0,right:0,borderRadius:t.shape.borderRadius}},...l&&{"&:first-of-type::before":{left:0,right:0,borderRadius:t.shape.borderRadius}},"& .MuiPickersDay-today":{borderColor:`${t.palette.default.outlinedBorder} !important`,...(o||i)&&{boxShadow:`0 0 0 1px inset ${t.palette.background.paper}`}},"&::after":{content:'""',position:"absolute",top:0,right:0,bottom:0,left:0,backgroundColor:t.palette.background.paper,borderRadius:t.shape.borderRadius,transition:"background-color 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"},"&:hover::after":{backgroundColor:t.palette.primary.relatedLight}}})),He=a.styled(ft.PickersDay,{shouldForwardProp:t=>t!=="isDateRangeLimit"})(({theme:t,isDateRangeLimit:e})=>({"&.MuiPickersDay-root":{position:"relative",zIndex:1,"&.Mui-selected":{color:t.palette.text.primary},...e&&{"&.Mui-selected":{backgroundColor:`${t.palette.primary.main} !important`,color:t.palette.primary.contrastText,"&:hover":{backgroundColor:`${t.palette.primary.dark} !important`}}}}})),J=(t,e)=>!t||!e?!1:t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate();function X({day:t,startDate:e,endDate:o,selectedMonth:i,...r}){const l=!!(e&&J(e,t)),s=!!(o&&J(o,t)),d=!!(e&&o&&t.getTime()>=e.getTime()&&t.getTime()<=o.getTime()),c=t.getDate()===1,g=t.getDate()===new Date(t.getFullYear(),t.getMonth()+1,0).getDate(),m=!!(i&&t.getMonth()===i.getMonth());return n.jsx(We,{isSelected:d,isStartDate:l,isEndDate:s,isSelectedMonth:m,isLastDay:g,isFirstDay:c,children:n.jsx(He,{...r,day:t,selected:d||l||s,isDateRangeLimit:l||s,"data-name":"pickers-day"})})}const _e=a.styled(a.Box,{shouldForwardProp:t=>!["variant"].includes(t)})(({variant:t,theme:e})=>({display:"flex",gap:t==="standard"?e.spacing(1):"1px","& .CartoDatePicker-root":{"&:first-of-type":{".MuiInputBase-root":{borderRadius:e.spacing(.5,0,0,.5),boxShadow:`1px 0 0 0 ${e.palette.default.outlinedBorder}`,...t==="outlined"&&{"&:not(:hover):not(.Mui-focused):not(.Mui-error) .MuiOutlinedInput-notchedOutline":{borderRightColor:"transparent"}},...t==="filled"&&{"&::before, &::after":{borderRadius:e.spacing(.5,0,0,.5)}},...t==="standard"&&{boxShadow:"none",borderRadius:0}}},"&:last-of-type":{".MuiInputBase-root":{borderRadius:e.spacing(0,.5,.5,0),...t==="outlined"&&{"&:not(:hover):not(.Mui-focused):not(.Mui-error) .MuiOutlinedInput-notchedOutline":{borderLeftColor:"transparent"}},...t==="filled"&&{"&::before, &::after":{borderRadius:e.spacing(0,.5,.5,0)}},...t==="standard"&&{borderRadius:0}}}}}));function Pe({globalHelperText:t,error:e,variant:o="outlined",startProps:i,endProps:r,"aria-label":l,"data-testid":s,...d}){const c=k.useIntl(),g=y.useImperativeIntl(c),[m,u]=h.useState(!1),[f,p]=h.useState(!1),[x,M]=h.useState((i==null?void 0:i.value)||null),[b,B]=h.useState((r==null?void 0:r.value)||null),[C,v]=h.useState((r==null?void 0:r.value)??(i==null?void 0:i.value)??new Date),j=e??(i==null?void 0:i.error)??(r==null?void 0:r.error),I=(D,R)=>{M(D),i!=null&&i.onChange&&i.onChange(D,R),D&&R.validationError===null&&!f&&R.trigger===null&&(p(!1),u(!0))},T=(D,R)=>{B(D),r!=null&&r.onChange&&r.onChange(D,R)},w=()=>{p(!0),u(!1),setTimeout(()=>{v(x??new Date)},120)},S=()=>{p(!1),u(!0),setTimeout(()=>{v(b??x??new Date)},120)},F=()=>{p(!1),u(!0),setTimeout(()=>{v(b??x??new Date)},120)};return n.jsxs(a.Box,{children:[n.jsxs(_e,{variant:o,"data-name":"date-range-picker","aria-label":l,"data-testid":s,children:[n.jsx(L,{...d,...i,value:(i==null?void 0:i.value)??x,maxDate:b??void 0,label:(i==null?void 0:i.label)??g.formatMessage({id:"c4r.form.startDate"}),slotProps:{popper:{placement:"bottom-start","aria-label":g.formatMessage({id:"c4r.form.startDateCalendar"})},...i==null?void 0:i.slotProps},slots:{openPickerIcon:A.TodayOutlined,day:D=>n.jsx(X,{...D,startDate:x,endDate:b,selectedMonth:C}),...i==null?void 0:i.slots},error:(i==null?void 0:i.error)??e,open:f,onChange:I,onOpen:w,onClose:S,onMonthChange:D=>v(D),variant:o}),n.jsx(L,{...d,...r,value:(r==null?void 0:r.value)??b,minDate:x??void 0,slotProps:{popper:{"aria-label":g.formatMessage({id:"c4r.form.endDateCalendar"})},...r==null?void 0:r.slotProps},slots:{day:D=>n.jsx(X,{...D,startDate:x,endDate:b,selectedMonth:C}),...r==null?void 0:r.slots},label:(r==null?void 0:r.label)??g.formatMessage({id:"c4r.form.endDate"}),error:(r==null?void 0:r.error)??e,open:m,onOpen:F,onClose:()=>u(!1),onChange:T,onMonthChange:D=>v(D),variant:o})]}),t&&n.jsx(a.FormHelperText,{error:j,children:t})]})}const pt=(t,e,o,i)=>{const r=t==null?void 0:t.includes("hours"),l=t==null?void 0:t.includes("seconds"),s=t==null?void 0:t.includes("minutes"),d=(t==null?void 0:t.length)===1&&t[0]==="hours";if(i)return i;const c=[];return e&&c.push("MM/dd/yyyy "),r&&c.push(o?"hh":"HH"),d||c.push(":"),s&&c.push("mm"),l&&c.push(":ss"),o&&c.push(" a"),c.join("")};function Ne({handleClear:t,variant:e="outlined",size:o="small",label:i,labelHelpTooltip:r,type:l,helperText:s,placeholder:d,error:c,showClock:g=!0,readOnly:m,slotProps:u,slots:f,ampm:p=!0,views:x=["hours","minutes"],format:M,"data-testid":b,"aria-label":B,...C}){const v=k.useIntl(),j=y.useImperativeIntl(v),I=h.useRef(null),[T,w]=h.useState(0);return h.useEffect(()=>{if(!I.current)return;const S=new ResizeObserver(F=>{var R;const D=(R=F[0])==null?void 0:R.contentRect.width;D&&w(D)});return S.observe(I.current),()=>{S.disconnect()}},[]),n.jsx(V,{size:o,variant:e,readOnly:m,"data-name":"time-picker","data-testid":b??"time-picker","aria-label":B,children:n.jsx(mt.TimePicker,{...C,ref:I,label:n.jsx(O,{label:i??j.formatMessage({id:"c4r.form.time"}),type:l,icon:r&&n.jsx(a.Tooltip,{title:r,children:n.jsx(A.HelpOutline,{htmlColor:"text.secondary"})})}),views:["hours"],format:pt(x,!1,p,M),slotProps:{textField:{variant:e,helperText:s,placeholder:d,size:o,error:c??void 0,inputProps:{"data-testid":"time-picker-input"}},field:{clearable:!!t,onClear:t},popper:{placement:"bottom-end"},layout:{sx:{width:T}},...u},slots:{clearButton:S=>n.jsx(G,{...S,size:o,variant:e}),openPickerButton:S=>n.jsx(a.IconButton,{...S,size:o,"aria-label":j.formatMessage({id:"c4r.form.chooseDate"})}),...f},disableOpenPicker:!g,readOnly:m,ampm:p})})}function qe({handleClear:t,variant:e="outlined",size:o="small",label:i,labelHelpTooltip:r,type:l,helperText:s,placeholder:d,error:c,showCalendar:g=!0,readOnly:m,slotProps:u,slots:f,ampm:p=!0,views:x=["hours","minutes"],format:M,"data-testid":b,"aria-label":B,...C}){const v=k.useIntl(),j=y.useImperativeIntl(v);return n.jsx(V,{size:o,variant:e,readOnly:m,"data-name":"date-time-picker","data-testid":b??"date-time-picker","aria-label":B,children:n.jsx(ht.DateTimePicker,{...C,label:n.jsx(O,{label:i??j.formatMessage({id:"c4r.form.time"}),type:l,icon:r&&n.jsx(a.Tooltip,{title:r,children:n.jsx(A.HelpOutline,{htmlColor:"text.secondary"})})}),views:["year","month","day","hours"],format:pt(x,!0,p,M),slotProps:{textField:{variant:e,helperText:s,placeholder:d,size:o,error:c??void 0,inputProps:{"data-testid":"date-time-picker-input"}},field:{clearable:!!t,onClear:t},...u},slots:{clearButton:I=>n.jsx(G,{...I,size:o,variant:e}),openPickerButton:I=>n.jsx(a.IconButton,{...I,size:o,"aria-label":j.formatMessage({id:"c4r.form.chooseDate"})}),...f},disableOpenPicker:!g,readOnly:m,ampm:p})})}const Ge=[{outlinedBullet:!1,value:""}],Ve=a.styled("ul")(({theme:t})=>({listStyle:"none",paddingLeft:0,margin:t.spacing(.5,0,0,0)})),Ue=a.styled("li")(({theme:t})=>({display:"flex",alignItems:"center",justifyContent:"space-between","&:not(:last-child)":{marginBottom:t.spacing(.5)}})),ze=a.styled("span")(({theme:t})=>({width:t.spacing(1),height:t.spacing(1),marginRight:t.spacing(.5),border:`2px solid ${t.palette.qualitative.bold[1]}`,borderRadius:"50%",backgroundColor:t.palette.qualitative.bold[1]})),Ye=a.styled(y.Typography)(({theme:t})=>({minWidth:t.spacing(10),marginRight:t.spacing(1.5)}));function Ze({items:t=Ge,title:e}){return n.jsxs(n.Fragment,{children:[e&&n.jsx(y.Typography,{color:"inherit",variant:"caption",weight:"medium",children:e}),n.jsx(Ve,{children:t.map((o,i)=>n.jsxs(Ue,{children:[n.jsx(ze,{style:{backgroundColor:`${o.outlinedBullet?"transparent":o.color}`,borderColor:o.color}}),o.category&&n.jsx(Ye,{color:"inherit",variant:"caption",children:o.category}),n.jsx(y.Typography,{color:"inherit",variant:"caption",weight:"medium",children:o.value})]},i))})]})}const K={small:"480px",medium:"640px",large:"640px",xlarge:"720px"},E={small:{width:"432px",maxWidth:"432px"},medium:{width:"592px",maxWidth:"592px"},large:{width:"768px",maxWidth:"768px",minHeight:"576px"},xlarge:{width:"calc(100vw - 80px)",height:"calc(100vh - 80px)",maxWidth:"960px"}},W=a.styled(a.Paper,{shouldForwardProp:t=>!["fullScreen","height","width","hasForm"].includes(t)})(({fullScreen:t,height:e,width:o,hasForm:i,size:r="small",theme:l})=>({"&.MuiPaper-root":{position:"relative",display:"flex",flexDirection:"column",margin:l.spacing(5),borderRadius:l.spacing(1),...E[r],maxHeight:K[r],[`@media (max-height:${K[r]})`]:{maxHeight:"calc(100vh - 80px)",...r==="large"&&{minHeight:e!=="auto"?"calc(100vh - 80px)":"auto"}},...t&&{width:"100vw",maxWidth:`calc(100vw - ${l.spacing(10)})`,height:"100vh",maxHeight:`calc(100vh - ${l.spacing(10)})`,margin:l.spacing(5),borderRadius:l.spacing(1)},...e&&{height:e,minHeight:e},...o&&{width:o},[l.breakpoints.down("sm")]:{position:"absolute",width:"100%",maxWidth:"100%",height:"100vh",maxHeight:"100vh",top:0,bottom:0,left:0,right:0,margin:0,borderRadius:0,...e&&{top:"auto",borderRadius:l.spacing(1,1,0,0),height:e,minHeight:e}},...i&&{maxHeight:`calc(100vh - ${l.spacing(10)})`,form:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between",overflow:"hidden",...E[r],maxWidth:"100%",...t&&{width:"100%",maxWidth:"100%",height:"100%",maxHeight:"100%"},...e&&{height:e,minHeight:e},...o&&{width:o},[l.breakpoints.down("sm")]:{width:"100%",maxWidth:"100%",height:"100vh",maxHeight:"100vh",...e&&{top:"auto",borderRadius:l.spacing(1,1,0,0),height:e,minHeight:e}}}}}}));function Je({nonModal:t,children:e,size:o="small",PaperProps:i,fullScreen:r,height:l,width:s,hasForm:d,"aria-label":c,"data-testid":g,...m},u){return t?n.jsx(W,{size:o,fullScreen:r,height:l,width:s,hasForm:d,"aria-label":c,"data-testid":g,"data-name":"dialog",...m,ref:u,children:e}):n.jsx(a.Dialog,{PaperComponent:W,PaperProps:{...i,size:o,fullScreen:r,height:l,width:s,hasForm:d},fullScreen:r,role:"section","aria-label":c,"data-testid":g,"data-size":o,"data-width":s,"data-height":l,"data-name":"dialog",...m,ref:u,children:e})}const Xe=h.forwardRef(Je),Ke=a.styled(a.DialogTitle)(()=>({padding:0,zIndex:10})),Qe=a.styled(a.Box)(({theme:t})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:t.spacing(2),minHeight:t.spacing(8)})),Q=a.styled(a.Box)(({theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(1),overflow:"hidden"})),tn=a.styled(A.CloseOutlined)(({theme:t})=>({color:t.palette.text.secondary})),en=a.styled(a.Divider)(()=>({"+ .MuiDialogContent-root":{borderTop:"none !important"}}));function nn({title:t,chipLabel:e,chipProps:o,children:i,onClose:r,secondaryActions:l,"aria-label":s,closeIcon:d,...c}){const g=k.useIntl(),m=y.useImperativeIntl(g);return n.jsxs(n.Fragment,{children:[n.jsxs(Ke,{component:"div","data-name":"dialog-header",...c,children:[n.jsxs(Qe,{children:[n.jsxs(Q,{flex:1,maxWidth:.8,children:[n.jsx(y.Typography,{component:"h2",variant:"inherit",noWrap:!0,"aria-label":s,role:"heading",children:t}),e&&n.jsx(a.Chip,{color:"default",label:e,...o})]}),n.jsxs(Q,{children:[l,r&&n.jsx(a.Tooltip,{title:m.formatMessage({id:"c4r.button.close"}),placement:"left",children:n.jsx(a.IconButton,{onClick:r,children:d||n.jsx(tn,{"data-testid":"CloseIcon"})})})]})]}),i]}),i&&n.jsx(en,{})]})}const on=a.styled(a.DialogContent,{shouldForwardProp:t=>!["scrollableContent","withGutter","withBottomGutter"].includes(t)})(({theme:t,scrollableContent:e,withGutter:o,withBottomGutter:i})=>({display:"flex",flexDirection:"column",gap:t.spacing(3),padding:0,...t.typography.body2,color:t.palette.text.secondary,".MuiAlert-root":{minHeight:"auto"},...e&&{borderBottom:`1px solid ${t.palette.divider}`,"+ .MuiDivider-root":{display:"none"}},...o&&{padding:` ${t.spacing(1,2,0)} !important`,".MuiDialog-paperFullScreen &":{padding:`${t.spacing(2,2,0)} !important`}},...i&&{paddingBottom:`${t.spacing(3)} !important`,".MuiDialog-paperFullScreen &":{paddingBottom:`${t.spacing(3)} !important`}}}));function an({children:t,scrollableContent:e,hasFooterAlert:o,withGutter:i=!0,withBottomGutter:r=!0,onScroll:l,...s},d){const c=a.useTheme(),[g,m]=h.useState(null);h.useImperativeHandle(d,()=>g,[g]);const u=h.useCallback(p=>{const x=Math.abs(p.scrollHeight-p.clientHeight-p.scrollTop)<1,M=p.scrollTop===0,b=`1px solid ${c.palette.divider}`;p.style.borderTop=M?"none":b,p.style.borderBottom=x&&!o?"none":b},[c.palette.divider,o]),f=h.useCallback(p=>{u(p.target),l==null||l(p)},[u,l]);return h.useEffect(()=>{g&&u(g)},[g,u]),h.useEffect(()=>{if(!g||typeof ResizeObserver>"u")return;const p=new ResizeObserver(()=>{u(g)});return p.observe(g),()=>p.disconnect()},[g,u]),n.jsx(on,{ref:m,onScroll:f,scrollableContent:e,withGutter:i,withBottomGutter:r&&i,"data-name":"dialog-content",...s,children:t})}const gt=h.forwardRef(an),rn=a.styled(gt,{shouldForwardProp:t=>t!=="withAlert"})(({withAlert:t,theme:e})=>({padding:`${e.spacing(0,2)} !important`,...t&&{paddingBottom:`${e.spacing(3)} !important`}})),ln=a.styled(H.Alert)(({theme:t})=>({minHeight:"auto",padding:0,backgroundColor:"transparent","& .MuiTypography-root":{color:t.palette.text.secondary,a:{color:t.palette.primary.main}},"& .MuiAlertTitle-root":{color:t.palette.text.primary}}));function U({children:t,severity:e="neutral",...o}){return n.jsx(ln,{severity:e,...o,"data-name":"dialog-alert",children:t})}const sn=a.styled(a.Box,{shouldForwardProp:t=>!["dark","hasChildren"].includes(t)})(({dark:t,hasChildren:e,theme:o})=>({flex:"0 0 auto",display:"block",minHeight:e?o.spacing(8):"auto",zIndex:10,...t&&{backgroundColor:o.palette.common.black,color:o.palette.white[60],".MuiAlert-root":{".MuiTypography-root, .MuiAlert-message :not(.MuiAlertTitle-root)":{color:o.palette.white[60],a:{color:`${o.palette.secondary.main} !important`}},".MuiAlert-icon":{color:o.palette.white[60]}}}})),cn=a.styled(a.Box)(()=>({display:"flex",alignItems:"center",justifyContent:"space-between","& > div:empty":{padding:0}})),dn=a.styled(a.Box,{shouldForwardProp:t=>t!=="hasAlert"})(({hasAlert:t,theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),padding:e.spacing(2),paddingTop:t?0:e.spacing(2)})),z=a.styled(a.DialogActions,{shouldForwardProp:t=>t!=="hasAlert"})(({hasAlert:t,theme:e})=>({gap:e.spacing(1),padding:e.spacing(2),paddingTop:t?0:e.spacing(2),margin:0,".MuiButton-root + .MuiButton-root":{marginLeft:0}})),un=a.styled(a.Divider)(()=>({marginTop:"-1px"}));function pn({children:t,secondaryActions:e,alertContent:o,alertProps:i,dark:r,topContent:l,...s}){return n.jsxs(n.Fragment,{children:[l,!!o&&n.jsx(un,{}),n.jsxs(sn,{...s,dark:r,"data-theme":r?"dark":"light","data-name":"dialog-footer",hasChildren:!!t,children:[!!o&&n.jsx(a.Box,{sx:{p:2,pt:1.5,pb:1},children:n.jsx(U,{...i,children:o})}),n.jsxs(cn,{children:[n.jsx(dn,{hasAlert:!!o,children:e}),n.jsx(z,{hasAlert:!!o,children:t})]})]})]})}const gn=a.styled(a.Box)(({theme:t})=>({position:"absolute",width:"100%",zIndex:100,top:0,bottom:0,left:0,right:0,overflow:"hidden",display:"flex",boxSizing:"border-box",alignItems:"flex-end",background:t.palette.white[60]})),xn=a.styled("div")(()=>({width:"100%"})),fn=a.styled(a.Box)(({theme:t})=>({width:"100%",padding:t.spacing(1.5,2,2),backgroundColor:t.palette.background.paper,borderTop:`1px solid ${t.palette.divider}`,".MuiDialogActions-root":{padding:0,marginTop:t.spacing(1)}}));function mn({children:t,onClickAway:e,actions:o,severity:i="warning",opened:r,"data-testid":l,"aria-label":s,...d}){const c=h.useRef(null),g=a.useTheme(),m=()=>{e&&e()};return n.jsx(gn,{ref:c,"data-testid":l,"aria-label":s,role:"presentation","data-name":"dialog-confirmation",children:n.jsx(bt,{onClickAway:m,children:n.jsx(a.Slide,{direction:"up",in:r,container:c.current,mountOnEnter:!0,unmountOnExit:!0,easing:g.transitions.easing.easeOut,timeout:350,children:n.jsx(xn,{children:n.jsxs(fn,{children:[n.jsx(U,{severity:i,...d,children:t}),n.jsx(z,{children:o})]})})})})})}const hn=a.styled(a.Box)(({theme:t})=>({display:"flex",alignItems:"center",justifyContent:"center",height:t.spacing(8),marginBottom:t.spacing(2),"& > div":{flex:1}})),bn=a.styled(a.Box)(({theme:t})=>({display:"flex",flex:1,flexDirection:"column",justifyContent:"center",alignItems:"center",position:"relative","&:before, &:after":{content:'""',background:t.palette.divider,position:"absolute",top:t.spacing(1.25),height:t.spacing(.25),width:`calc(50% - ${t.spacing(2.5)})`},"&:before":{left:0},"&:after":{right:0},"&:first-of-type:before":{content:"none"},"&:last-of-type:after":{content:"none"}}));function yn({theme:t,completed:e,current:o}){return e?{background:t.palette.success.main,borderColor:t.palette.success.main,color:t.palette.common.white}:o?{background:t.palette.text.primary,borderColor:t.palette.text.primary,color:t.palette.common.white}:{borderColor:t.palette.text.secondary,color:t.palette.text.secondary}}const jn=a.styled("span",{shouldForwardProp:t=>t!=="completed"&&t!=="current"})(({theme:t,completed:e,current:o})=>({display:"flex",justifyContent:"center",alignItems:"center",height:t.spacing(3),width:t.spacing(3),marginBottom:t.spacing(1),borderRadius:"50%",border:`${t.spacing(.25)} solid currentColor`,...t.typography.caption,...yn({theme:t,completed:e,current:o})}));function Mn({currentStep:t,stepsLabels:e,...o}){return n.jsx(hn,{...o,"data-name":"dialog-stepper",children:n.jsx(a.Box,{sx:{display:"flex"},children:e.map((i,r)=>{const l=r+1,s=l===t,d=l<t,c=d?"success.main":s?"textPrimary":"textSecondary";return n.jsxs(bn,{"data-state":d?"completed":s?"current":"uncompleted",children:[n.jsx(jn,{completed:d,current:s,children:d?n.jsx(A.Check,{fontSize:"small","aria-label":"Completed step"}):l}),n.jsx(y.Typography,{variant:"caption",component:"div",color:c,children:i})]},r)})})})}exports.TablePaginationActions=y.TablePaginationActions;exports.Typography=y.Typography;exports.Alert=H.Alert;exports.MenuItem=_.MenuItem;exports.AccordionGroup=fe;exports.AppBar=$e;exports.Autocomplete=ae;exports.Avatar=he;exports.Button=It;exports.CopiableComponent=ge;exports.CreatableAutocomplete=ce;exports.DatePicker=L;exports.DateRangePicker=Pe;exports.DateTimePicker=qe;exports.Dialog=Xe;exports.DialogActions=z;exports.DialogAlert=U;exports.DialogConfirmation=mn;exports.DialogContent=gt;exports.DialogContentPadded=rn;exports.DialogFooter=pn;exports.DialogHeader=nn;exports.DialogPaper=W;exports.DialogStepper=Mn;exports.IconButton=N;exports.LabelWithIndicator=O;exports.Menu=Ht;exports.MenuItemFilter=q;exports.MenuList=Nt;exports.MultipleAutocomplete=ue;exports.MultipleSelectField=Kt;exports.PasswordField=St;exports.SelectField=tt;exports.Snackbar=ut;exports.TimePicker=Ne;exports.ToggleButtonGroup=Ft;exports.TooltipData=Ze;exports.UploadField=oe;exports.UploadFieldBase=et;exports.copyString=st;exports.dialogDimensionsBySize=E;exports.useCopyValue=ct;
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const material = require("@mui/material");
6
+ const TablePaginationActions = require("../TablePaginationActions-CFGXm44W.cjs");
7
+ const reactIntl = require("react-intl");
8
+ const iconsMaterial = require("@mui/icons-material");
9
+ const Alert$1 = require("../Alert-zqtoWsBL.cjs");
10
+ require("cartocolor");
11
+ const MenuItem = require("../MenuItem-Br2jY2lt.cjs");
12
+ const ArrowDown = require("../ArrowDown-8fLj23Ge.cjs");
13
+ const DatePicker$1 = require("@mui/x-date-pickers/DatePicker");
14
+ const xDatePickers = require("@mui/x-date-pickers");
15
+ const TimePicker$1 = require("@mui/x-date-pickers/TimePicker");
16
+ const DateTimePicker$1 = require("@mui/x-date-pickers/DateTimePicker");
17
+ const OpenDiagonallyRight = require("../OpenDiagonallyRight-BrRyCV4Q.cjs");
18
+ const reactCodemirror2 = require("react-codemirror2");
19
+ const colors = require("@mui/material/colors");
20
+ require("codemirror/lib/codemirror.css");
21
+ require("codemirror/lib/codemirror.js");
22
+ require("codemirror/mode/sql/sql.js");
23
+ require("codemirror/mode/javascript/javascript.js");
24
+ require("codemirror/mode/htmlmixed/htmlmixed.js");
25
+ require("codemirror/mode/markdown/markdown.js");
26
+ require("codemirror/mode/shell/shell.js");
27
+ require("codemirror/mode/python/python.js");
28
+ require("codemirror/addon/display/placeholder");
29
+ require("codemirror/addon/hint/sql-hint.js");
30
+ require("codemirror/addon/hint/show-hint.css");
31
+ require("codemirror/addon/hint/show-hint.js");
32
+ require("codemirror/addon/selection/active-line.js");
33
+ require("codemirror/addon/edit/matchbrackets.js");
34
+ require("codemirror/addon/fold/foldcode.js");
35
+ require("codemirror/addon/fold/foldgutter.js");
36
+ require("codemirror/addon/fold/foldgutter.css");
37
+ require("codemirror/addon/fold/brace-fold.js");
38
+ require("codemirror/addon/fold/xml-fold.js");
39
+ require("codemirror/addon/fold/indent-fold.js");
40
+ require("codemirror/addon/fold/markdown-fold.js");
41
+ require("codemirror/addon/fold/comment-fold.js");
42
+ const ClickAwayListener = require("@mui/material/ClickAwayListener");
43
+ const IndicatorIcon = material.styled(material.Box)({
44
+ position: "absolute",
45
+ top: 0,
46
+ left: 0,
47
+ right: 0,
48
+ bottom: 0,
49
+ display: "flex",
50
+ alignItems: "center",
51
+ justifyContent: "center"
52
+ });
53
+ const HiddenText = material.styled(material.Box)({
54
+ visibility: "hidden",
55
+ pointerEvents: "none"
56
+ });
57
+ function _Button({
58
+ children,
59
+ loading,
60
+ disabled,
61
+ startIcon,
62
+ endIcon,
63
+ loadingPosition,
64
+ ...otherProps
65
+ }, ref) {
66
+ const defaultIconLoader = /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" });
67
+ const isDefaultLoading = loading && loadingPosition === void 0;
68
+ const renderContent = () => {
69
+ if (isDefaultLoading) {
70
+ return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { position: "relative" }, children: [
71
+ /* @__PURE__ */ jsxRuntime.jsx(IndicatorIcon, { children: defaultIconLoader }),
72
+ /* @__PURE__ */ jsxRuntime.jsx(HiddenText, { children })
73
+ ] });
74
+ }
75
+ return children;
76
+ };
77
+ const getIconForPosition = (position) => {
78
+ if (isDefaultLoading) {
79
+ return void 0;
80
+ }
81
+ if (loading && loadingPosition !== void 0) {
82
+ if (loadingPosition === position) {
83
+ return defaultIconLoader;
84
+ }
85
+ return void 0;
86
+ }
87
+ return position === "start" ? startIcon : endIcon;
88
+ };
89
+ return /* @__PURE__ */ jsxRuntime.jsx(
90
+ material.Button,
91
+ {
92
+ disabled: loading || disabled,
93
+ startIcon: getIconForPosition("start"),
94
+ endIcon: getIconForPosition("end"),
95
+ ...otherProps,
96
+ role: otherProps.href ? "link" : "button",
97
+ ref,
98
+ children: /* @__PURE__ */ jsxRuntime.jsx(TablePaginationActions.Typography, { variant: "inherit", color: "inherit", noWrap: true, component: "span", children: renderContent() })
99
+ }
100
+ );
101
+ }
102
+ const Button = React.forwardRef(_Button);
103
+ const Root$5 = material.styled(material.Box)(({ theme }) => ({
104
+ display: "flex",
105
+ alignItems: "center",
106
+ gap: theme.spacing(0.5)
107
+ }));
108
+ const Indicator = material.styled(TablePaginationActions.Typography)(({ theme }) => ({
109
+ ".Mui-disabled &": {
110
+ color: theme.palette.text.disabled
111
+ }
112
+ }));
113
+ const Icon = material.styled(material.Box)(({ theme }) => ({
114
+ display: "flex",
115
+ svg: {
116
+ width: TablePaginationActions.ICON_SIZE_SMALL,
117
+ height: TablePaginationActions.ICON_SIZE_SMALL,
118
+ fontSize: TablePaginationActions.ICON_SIZE_SMALL,
119
+ path: {
120
+ fill: theme.palette.text.secondary,
121
+ ".Mui-disabled &": {
122
+ fill: theme.palette.text.disabled
123
+ }
124
+ }
125
+ }
126
+ }));
127
+ function LabelWithIndicator({
128
+ label,
129
+ type,
130
+ icon,
131
+ inheritSize
132
+ }) {
133
+ return /* @__PURE__ */ jsxRuntime.jsxs(Root$5, { children: [
134
+ label,
135
+ type && /* @__PURE__ */ jsxRuntime.jsx(
136
+ Indicator,
137
+ {
138
+ component: "span",
139
+ variant: inheritSize ? "inherit" : "caption",
140
+ color: "textSecondary",
141
+ weight: "regular",
142
+ children: type === "required" ? "(required)" : "(optional)"
143
+ }
144
+ ),
145
+ icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { children: icon })
146
+ ] });
147
+ }
148
+ function _PasswordField({ InputProps, size = "small", ...otherProps }, ref) {
149
+ const intl = reactIntl.useIntl();
150
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
151
+ const [showPassword, setShowPassword] = React.useState(false);
152
+ const handleClickShowPassword = () => setShowPassword(!showPassword);
153
+ return /* @__PURE__ */ jsxRuntime.jsx(
154
+ material.TextField,
155
+ {
156
+ ...otherProps,
157
+ ref,
158
+ type: showPassword ? "text" : "password",
159
+ size,
160
+ InputProps: {
161
+ ...InputProps,
162
+ endAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { size, onClick: handleClickShowPassword, children: /* @__PURE__ */ jsxRuntime.jsx(
163
+ material.Tooltip,
164
+ {
165
+ title: intlConfig.formatMessage({
166
+ id: `c4r.form.${showPassword ? "hidePassword" : "showPassword"}`
167
+ }),
168
+ children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.VisibilityOffOutlined, {}) : /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.VisibilityOutlined, {})
169
+ }
170
+ ) }) })
171
+ }
172
+ }
173
+ );
174
+ }
175
+ const PasswordField = React.forwardRef(_PasswordField);
176
+ const idCounter = {};
177
+ function uniqueId(prefix = "$lodash$") {
178
+ if (!idCounter[prefix]) {
179
+ idCounter[prefix] = 0;
180
+ }
181
+ const id = ++idCounter[prefix];
182
+ if (prefix === "$lodash$") {
183
+ return `${id}`;
184
+ }
185
+ return `${prefix}${id}`;
186
+ }
187
+ const StyledSelect = material.styled(material.Select)(({ theme }) => ({
188
+ "& .MuiInputAdornment-positionStart": {
189
+ paddingLeft: theme.spacing(2),
190
+ "&.MuiInputAdornment-sizeSmall": {
191
+ paddingLeft: theme.spacing(1.5)
192
+ }
193
+ },
194
+ "& .MuiInputBase-inputAdornedStart": {
195
+ paddingLeft: "0px !important"
196
+ },
197
+ "& .MuiSelect-select .MuiMenuItem-root:hover": {
198
+ backgroundColor: "transparent"
199
+ },
200
+ "&.MuiInputBase-root .MuiSelect-select.MuiSelect-multiple": {
201
+ paddingRight: theme.spacing(7)
202
+ }
203
+ }));
204
+ const PlaceholderItem = material.styled(material.MenuItem)(() => ({
205
+ display: "none"
206
+ }));
207
+ function _SelectField({
208
+ children,
209
+ placeholder,
210
+ size = "small",
211
+ displayEmpty,
212
+ menuProps,
213
+ inputProps,
214
+ labelId,
215
+ label,
216
+ labelSecondary,
217
+ helperText,
218
+ name,
219
+ error,
220
+ focused,
221
+ disabled,
222
+ fullWidth,
223
+ required,
224
+ "aria-label": ariaLabel,
225
+ ...otherProps
226
+ }, ref) {
227
+ const isSmall = size === "small";
228
+ const [defaultId] = React.useState(() => uniqueId("select-label-"));
229
+ const ariaLabelledBy = label ? labelId ?? defaultId : void 0;
230
+ return /* @__PURE__ */ jsxRuntime.jsxs(
231
+ material.FormControl,
232
+ {
233
+ size,
234
+ error,
235
+ focused,
236
+ disabled,
237
+ fullWidth,
238
+ required,
239
+ "data-name": "select-field",
240
+ "data-size": size,
241
+ children: [
242
+ /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { display: "flex", alignItems: "center", justifyContent: "space-between", children: [
243
+ label && /* @__PURE__ */ jsxRuntime.jsx(material.InputLabel, { shrink: true, id: ariaLabelledBy, children: label }),
244
+ labelSecondary && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { display: "flex", alignItems: "center", ml: 2, mb: 0.5, children: labelSecondary })
245
+ ] }),
246
+ /* @__PURE__ */ jsxRuntime.jsxs(
247
+ StyledSelect,
248
+ {
249
+ ...otherProps,
250
+ labelId: ariaLabelledBy,
251
+ name,
252
+ ref,
253
+ size,
254
+ fullWidth,
255
+ displayEmpty: displayEmpty ?? !!placeholder,
256
+ inputProps: {
257
+ ...inputProps,
258
+ "aria-label": ariaLabel
259
+ },
260
+ MenuProps: {
261
+ ...menuProps,
262
+ PopoverClasses: {
263
+ paper: isSmall ? "MuiMenu-paper-sizeSmall" : void 0
264
+ },
265
+ anchorOrigin: {
266
+ vertical: "bottom",
267
+ horizontal: "left"
268
+ },
269
+ transformOrigin: {
270
+ vertical: 0,
271
+ horizontal: "left"
272
+ }
273
+ },
274
+ children: [
275
+ placeholder && /* @__PURE__ */ jsxRuntime.jsx(PlaceholderItem, { disabled: true, value: "", children: /* @__PURE__ */ jsxRuntime.jsx(
276
+ TablePaginationActions.Typography,
277
+ {
278
+ variant: isSmall ? "body2" : "body1",
279
+ color: "text.hint",
280
+ component: "span",
281
+ children: placeholder
282
+ }
283
+ ) }),
284
+ children
285
+ ]
286
+ }
287
+ ),
288
+ helperText && /* @__PURE__ */ jsxRuntime.jsx(material.FormHelperText, { "aria-label": `${name}-helper`, children: helperText })
289
+ ]
290
+ }
291
+ );
292
+ }
293
+ const SelectField = React.forwardRef(_SelectField);
294
+ const StyledToggleButtonGroup = material.styled(material.ToggleButtonGroup, {
295
+ shouldForwardProp: (prop) => prop !== "variant" && prop !== "backgroundColor"
296
+ })(({ variant, backgroundColor, theme }) => ({
297
+ // Variants
298
+ ...variant === "contained" && {
299
+ boxShadow: "none"
300
+ },
301
+ ...variant === "unbounded" && {
302
+ boxShadow: "none",
303
+ borderRadius: theme.spacing(0.5),
304
+ "& .MuiDivider-root": {
305
+ height: theme.spacing(4),
306
+ "&.MuiToggleButtonGroup-groupedHorizontal": {
307
+ height: theme.spacing(4)
308
+ },
309
+ "&.MuiToggleButtonGroup-groupedVertical": {
310
+ height: "auto",
311
+ width: theme.spacing(4),
312
+ margin: `${theme.spacing(0.5, 0, 1)} !important`,
313
+ borderRadius: "0 !important"
314
+ }
315
+ },
316
+ "& .MuiToggleButton-sizeSmall": {
317
+ margin: 0,
318
+ "&.MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
319
+ margin: 0
320
+ },
321
+ "& + .MuiDivider-root.MuiToggleButtonGroup-groupedHorizontal": {
322
+ height: theme.spacing(3)
323
+ },
324
+ "& + .MuiDivider-root.MuiToggleButtonGroup-groupedVertical": {
325
+ height: "auto",
326
+ width: theme.spacing(3)
327
+ }
328
+ },
329
+ ".MuiToggleButtonGroup-grouped:not(.MuiDivider-root)": {
330
+ margin: 0,
331
+ "&:first-of-type": {
332
+ marginLeft: 0
333
+ },
334
+ "&:not(:last-of-type)": {
335
+ marginRight: theme.spacing(0.5)
336
+ }
337
+ },
338
+ "&.MuiToggleButtonGroup-horizontal:not(.MuiDivider-root)": {
339
+ ".MuiToggleButtonGroup-grouped": {
340
+ margin: theme.spacing(0, 0.5)
341
+ }
342
+ },
343
+ "&.MuiToggleButtonGroup-vertical:not(.MuiDivider-root)": {
344
+ ".MuiToggleButtonGroup-grouped": {
345
+ margin: theme.spacing(0, 0, 0.5),
346
+ "&:not(:last-of-type)": {
347
+ marginRight: 0
348
+ },
349
+ "&:last-of-type": {
350
+ marginBottom: 0
351
+ }
352
+ }
353
+ }
354
+ },
355
+ // Colors
356
+ ...backgroundColor === "primary" && {
357
+ backgroundColor: theme.palette.background.paper
358
+ },
359
+ ...backgroundColor === "secondary" && {
360
+ backgroundColor: theme.palette.background.default
361
+ },
362
+ ...backgroundColor === "transparent" && {
363
+ backgroundColor: "transparent"
364
+ }
365
+ }));
366
+ function ToggleButtonGroup({
367
+ children,
368
+ variant = "floating",
369
+ backgroundColor,
370
+ ...rest
371
+ }) {
372
+ const isUnbounded = variant === "unbounded";
373
+ const defaultColor = isUnbounded ? "transparent" : "primary";
374
+ return /* @__PURE__ */ jsxRuntime.jsx(
375
+ StyledToggleButtonGroup,
376
+ {
377
+ ...rest,
378
+ variant,
379
+ backgroundColor: backgroundColor ?? defaultColor,
380
+ children
381
+ }
382
+ );
383
+ }
384
+ const Option = material.styled("div")(({ theme }) => ({
385
+ position: "relative",
386
+ display: "inline-flex",
387
+ // TODO: Remove this once we have a better way to handle the spacing between icon buttons:
388
+ // https://app.shortcut.com/cartoteam/story/471284/create-iconbuttongroup-component-to-properly-group-several-icons
389
+ "& + &, & + .optionIconButton": {
390
+ marginLeft: theme.spacing(0.5)
391
+ }
392
+ }));
393
+ const StyledIconButton = material.styled(material.IconButton, {
394
+ shouldForwardProp: (prop) => !["active"].includes(prop)
395
+ })(({ active, theme }) => ({
396
+ ...active && {
397
+ color: theme.palette.primary.main,
398
+ backgroundColor: theme.palette.primary.background,
399
+ "& svg:not(.doNotFillIcon) path": {
400
+ fill: theme.palette.primary.main
401
+ }
402
+ }
403
+ }));
404
+ function _IconButton({
405
+ tooltip,
406
+ tooltipPlacement = "top",
407
+ icon,
408
+ size = "medium",
409
+ variant = "icon",
410
+ color = "default",
411
+ sx,
412
+ className,
413
+ loading,
414
+ disabled,
415
+ active,
416
+ ...props
417
+ }, ref) {
418
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { placement: tooltipPlacement, title: tooltip ?? "", children: /* @__PURE__ */ jsxRuntime.jsx(
419
+ Option,
420
+ {
421
+ className: `optionIconButton ${className ?? ""}`,
422
+ sx,
423
+ "data-testid": "icon-button",
424
+ children: /* @__PURE__ */ jsxRuntime.jsx(
425
+ StyledIconButton,
426
+ {
427
+ ...props,
428
+ ref,
429
+ size,
430
+ variant,
431
+ color,
432
+ active,
433
+ disabled: disabled || loading,
434
+ role: "button",
435
+ children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" }) : icon
436
+ }
437
+ )
438
+ }
439
+ ) });
440
+ }
441
+ const IconButton = React.forwardRef(_IconButton);
442
+ const StyledMenu = material.styled(material.Menu, {
443
+ shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
444
+ })(({ theme, extended, width, height }) => ({
445
+ ...extended && {
446
+ ".MuiMenuItem-root": {
447
+ minHeight: theme.spacing(6)
448
+ }
449
+ },
450
+ ...width && {
451
+ ".MuiList-root": {
452
+ width,
453
+ minWidth: width
454
+ }
455
+ },
456
+ ...height && {
457
+ ".MuiMenu-paper": {
458
+ overflow: "hidden"
459
+ },
460
+ ".MuiList-root": {
461
+ maxHeight: height
462
+ }
463
+ }
464
+ }));
465
+ function _Menu({ extended, width, height, MenuListProps, ...otherProps }, ref) {
466
+ return /* @__PURE__ */ jsxRuntime.jsx(
467
+ StyledMenu,
468
+ {
469
+ ...otherProps,
470
+ ref,
471
+ "data-name": "menu",
472
+ width,
473
+ height,
474
+ extended,
475
+ MenuListProps: {
476
+ ...MenuListProps,
477
+ "data-width": width,
478
+ "data-height": height,
479
+ "data-extended": extended
480
+ }
481
+ }
482
+ );
483
+ }
484
+ const Menu$1 = React.forwardRef(_Menu);
485
+ const StyledMenuList = material.styled(material.MenuList, {
486
+ shouldForwardProp: (prop) => !["extended", "width", "height"].includes(prop)
487
+ })(({ theme, extended, width, height }) => ({
488
+ ...extended && {
489
+ ".MuiMenuItem-root": {
490
+ minHeight: theme.spacing(6)
491
+ }
492
+ },
493
+ "&.MuiList-root": {
494
+ ...width && {
495
+ width,
496
+ minWidth: width
497
+ },
498
+ ...height && {
499
+ maxHeight: height
500
+ }
501
+ }
502
+ }));
503
+ function _MenuList({ extended, width, height, ...otherProps }, ref) {
504
+ return /* @__PURE__ */ jsxRuntime.jsx(
505
+ StyledMenuList,
506
+ {
507
+ ...otherProps,
508
+ ref,
509
+ width,
510
+ height,
511
+ extended,
512
+ "data-name": "menu-list",
513
+ "data-width": width,
514
+ "data-height": height,
515
+ "data-extended": extended
516
+ }
517
+ );
518
+ }
519
+ const MenuList = React.forwardRef(_MenuList);
520
+ const StyledMenuItem$1 = material.styled(MenuItem.MenuItem)(() => ({
521
+ marginTop: "0 !important"
522
+ }));
523
+ const LinkFilter = material.styled(material.Link)(
524
+ ({ disabled, theme }) => ({
525
+ display: "flex",
526
+ alignItems: "center",
527
+ gap: theme.spacing(1),
528
+ width: "100%",
529
+ textAlign: "initial",
530
+ ...disabled && {
531
+ pointerEvents: "none",
532
+ color: theme.palette.text.disabled
533
+ }
534
+ })
535
+ );
536
+ function _MenuItemFilter({
537
+ areAllSelected,
538
+ areAnySelected,
539
+ selectAll,
540
+ selectAllDisabled,
541
+ "aria-label": ariaLabel,
542
+ "data-testid": dataTestId
543
+ }, ref) {
544
+ const intl = reactIntl.useIntl();
545
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
546
+ return /* @__PURE__ */ jsxRuntime.jsx(
547
+ StyledMenuItem$1,
548
+ {
549
+ ref,
550
+ fixed: true,
551
+ "data-name": "menu-filter",
552
+ "aria-label": ariaLabel,
553
+ "data-testid": dataTestId,
554
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
555
+ LinkFilter,
556
+ {
557
+ variant: "body2",
558
+ color: "textPrimary",
559
+ component: "button",
560
+ underline: "none",
561
+ disabled: !!selectAllDisabled,
562
+ onClick: selectAll,
563
+ tabIndex: 0,
564
+ children: [
565
+ /* @__PURE__ */ jsxRuntime.jsx(
566
+ material.Checkbox,
567
+ {
568
+ checked: areAllSelected,
569
+ indeterminate: areAnySelected && !areAllSelected,
570
+ disabled: selectAllDisabled
571
+ }
572
+ ),
573
+ intlConfig.formatMessage({ id: "c4r.form.selectAll" })
574
+ ]
575
+ }
576
+ )
577
+ }
578
+ );
579
+ }
580
+ const MenuItemFilter = React.forwardRef(_MenuItemFilter);
581
+ function useMultipleSelectField({
582
+ selectedOptions,
583
+ options,
584
+ onChange
585
+ }) {
586
+ const [currentOptions, setCurrentOptions] = React.useState(selectedOptions ?? []);
587
+ const areAllSelected = options.length === currentOptions.length;
588
+ const areAnySelected = currentOptions.length > 0;
589
+ React.useEffect(() => {
590
+ if (currentOptions !== selectedOptions) {
591
+ setCurrentOptions(currentOptions);
592
+ }
593
+ }, [selectedOptions]);
594
+ const handleChange = (event) => {
595
+ const {
596
+ target: { value }
597
+ } = event;
598
+ const options2 = typeof value === "string" ? value.split(",") : value.filter((v) => v !== void 0);
599
+ setCurrentOptions(options2);
600
+ onChange(options2);
601
+ };
602
+ const selectAll = () => {
603
+ const optionsValues = options == null ? void 0 : options.filter(({ disabled }) => !disabled).map(({ value }) => value);
604
+ if (optionsValues) {
605
+ const allSelected = optionsValues.every(
606
+ (value) => currentOptions.includes(value)
607
+ );
608
+ if (allSelected) {
609
+ setCurrentOptions([]);
610
+ onChange([]);
611
+ } else {
612
+ setCurrentOptions(optionsValues);
613
+ onChange(optionsValues);
614
+ }
615
+ }
616
+ };
617
+ const unselectAll = () => {
618
+ setCurrentOptions([]);
619
+ onChange([]);
620
+ };
621
+ return {
622
+ areAllSelected,
623
+ areAnySelected,
624
+ currentOptions,
625
+ handleChange,
626
+ selectAll,
627
+ unselectAll
628
+ };
629
+ }
630
+ const StyledMenuItem = material.styled(material.MenuItem)(({ theme }) => ({
631
+ "&.Mui-disabled": {
632
+ pointerEvents: "auto",
633
+ "&:hover": {
634
+ backgroundColor: `${theme.palette.background.default} !important`
635
+ }
636
+ }
637
+ }));
638
+ const UnselectButton = material.styled(material.InputAdornment, {
639
+ shouldForwardProp: (prop) => prop !== "size"
640
+ })(({ theme, size }) => ({
641
+ display: "none",
642
+ position: "absolute",
643
+ top: theme.spacing(2),
644
+ right: theme.spacing(3.5),
645
+ ".MuiInputBase-root:hover &, .MuiInputBase-root.Mui-focused &": {
646
+ display: "flex"
647
+ },
648
+ ".MuiSvgIcon-root": {
649
+ color: theme.palette.text.hint
650
+ },
651
+ ...size === "medium" && {
652
+ top: theme.spacing(3),
653
+ right: theme.spacing(5)
654
+ }
655
+ }));
656
+ const EMPTY_ARRAY = [];
657
+ const EMPTY_FN = () => void 0;
658
+ function _MultipleSelectField({
659
+ options = EMPTY_ARRAY,
660
+ selectedOptions,
661
+ size = "small",
662
+ placeholder,
663
+ showCounter,
664
+ showFilters = true,
665
+ onChange = EMPTY_FN,
666
+ selectAllDisabled,
667
+ tooltipPlacement,
668
+ variant,
669
+ ...props
670
+ }, ref) {
671
+ const {
672
+ areAllSelected,
673
+ areAnySelected,
674
+ currentOptions,
675
+ handleChange,
676
+ selectAll,
677
+ unselectAll
678
+ } = useMultipleSelectField({
679
+ options,
680
+ selectedOptions,
681
+ onChange
682
+ });
683
+ const isSmall = size === "small";
684
+ const paddingSize = isSmall || variant === "standard" ? 0 : 2;
685
+ const intl = reactIntl.useIntl();
686
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
687
+ const counterText = `${currentOptions.length} ${intlConfig.formatMessage({
688
+ id: "c4r.form.selected"
689
+ })}`;
690
+ const renderValue = React.useMemo(() => {
691
+ if (areAllSelected) {
692
+ return /* @__PURE__ */ jsxRuntime.jsx(
693
+ TablePaginationActions.Typography,
694
+ {
695
+ component: "span",
696
+ variant: isSmall ? "body2" : "body1",
697
+ color: "textPrimary",
698
+ ml: paddingSize,
699
+ children: intlConfig.formatMessage({ id: "c4r.form.allSelected" })
700
+ }
701
+ );
702
+ }
703
+ if (areAnySelected) {
704
+ return /* @__PURE__ */ jsxRuntime.jsx(
705
+ TablePaginationActions.Typography,
706
+ {
707
+ component: "span",
708
+ variant: isSmall ? "body2" : "body1",
709
+ color: "textPrimary",
710
+ ml: paddingSize,
711
+ children: showCounter && currentOptions.length > 1 ? counterText : currentOptions.join(", ")
712
+ }
713
+ );
714
+ }
715
+ return /* @__PURE__ */ jsxRuntime.jsx(
716
+ TablePaginationActions.Typography,
717
+ {
718
+ component: "span",
719
+ variant: isSmall ? "body2" : "body1",
720
+ color: "text.hint",
721
+ ml: paddingSize,
722
+ children: placeholder ?? intlConfig.formatMessage({ id: "c4r.form.noneSelected" })
723
+ }
724
+ );
725
+ }, [
726
+ areAllSelected,
727
+ areAnySelected,
728
+ counterText,
729
+ currentOptions,
730
+ intlConfig,
731
+ isSmall,
732
+ paddingSize,
733
+ placeholder,
734
+ showCounter
735
+ ]);
736
+ return /* @__PURE__ */ jsxRuntime.jsxs(
737
+ SelectField,
738
+ {
739
+ ...props,
740
+ ref,
741
+ multiple: true,
742
+ displayEmpty: true,
743
+ placeholder,
744
+ value: currentOptions,
745
+ renderValue: () => renderValue,
746
+ onChange: handleChange,
747
+ size,
748
+ variant,
749
+ endAdornment: showFilters && areAnySelected && /* @__PURE__ */ jsxRuntime.jsx(UnselectButton, { position: "end", size, children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { onClick: unselectAll, size, children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Cancel, {}) }) }),
750
+ menuProps: {
751
+ PaperProps: {
752
+ sx: {
753
+ ".MuiList-root": {
754
+ paddingTop: 0
755
+ }
756
+ }
757
+ }
758
+ },
759
+ children: [
760
+ showFilters && /* @__PURE__ */ jsxRuntime.jsx(
761
+ MenuItemFilter,
762
+ {
763
+ areAllSelected,
764
+ areAnySelected,
765
+ selectAll,
766
+ selectAllDisabled
767
+ }
768
+ ),
769
+ options == null ? void 0 : options.map((option) => {
770
+ const item = /* @__PURE__ */ jsxRuntime.jsxs(
771
+ StyledMenuItem,
772
+ {
773
+ value: option.value,
774
+ disabled: option.disabled,
775
+ tabIndex: 0,
776
+ children: [
777
+ /* @__PURE__ */ jsxRuntime.jsx(
778
+ material.Checkbox,
779
+ {
780
+ disabled: option.disabled,
781
+ checked: currentOptions.includes(option.value)
782
+ }
783
+ ),
784
+ /* @__PURE__ */ jsxRuntime.jsx(material.ListItemText, { primary: option.label })
785
+ ]
786
+ },
787
+ option.value
788
+ );
789
+ const content = option.tooltip ? /* @__PURE__ */ jsxRuntime.jsx(
790
+ material.Tooltip,
791
+ {
792
+ title: option.tooltip,
793
+ placement: tooltipPlacement,
794
+ children: item
795
+ },
796
+ option.value
797
+ ) : item;
798
+ return content;
799
+ })
800
+ ]
801
+ }
802
+ );
803
+ }
804
+ const MultipleSelectField = React.forwardRef(_MultipleSelectField);
805
+ const StyledUploadField = material.styled(material.TextField, {
806
+ shouldForwardProp: (prop) => prop !== "cursor"
807
+ })(
808
+ ({ cursor, theme }) => ({
809
+ "&.MuiTextField-root .MuiInputBase-root": {
810
+ cursor,
811
+ paddingRight: theme.spacing(1),
812
+ "& input": {
813
+ cursor
814
+ },
815
+ "&.Mui-disabled": {
816
+ pointerEvents: "none",
817
+ "& .MuiButtonBase-root": {
818
+ color: theme.palette.text.disabled
819
+ }
820
+ },
821
+ "&.MuiInputBase-sizeSmall": {
822
+ paddingRight: theme.spacing(0.5)
823
+ }
824
+ },
825
+ "& .MuiFormLabel-root": {
826
+ cursor,
827
+ "&.Mui-disabled": {
828
+ pointerEvents: "none"
829
+ }
830
+ }
831
+ })
832
+ );
833
+ function FilesAction({
834
+ buttonText,
835
+ hasFiles,
836
+ size,
837
+ error,
838
+ disabled,
839
+ handleReset,
840
+ handleOpen,
841
+ inProgress
842
+ }) {
843
+ return /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: inProgress ? /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { "aria-label": "Loading", disabled: true, size, children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18 }) }) : !hasFiles ? /* @__PURE__ */ jsxRuntime.jsx(
844
+ material.Button,
845
+ {
846
+ onClick: handleOpen,
847
+ size,
848
+ variant: "text",
849
+ color: error ? "default" : "primary",
850
+ disabled,
851
+ children: buttonText
852
+ }
853
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
854
+ material.IconButton,
855
+ {
856
+ onClick: handleReset,
857
+ size,
858
+ "aria-label": "Delete",
859
+ disabled,
860
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Cancel, {})
861
+ }
862
+ ) });
863
+ }
864
+ function UploadFieldBase({
865
+ name,
866
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
867
+ multiple,
868
+ // multiple prop defined here for compatibility with cloud-native but not used in the component
869
+ handleReset,
870
+ handleOpen,
871
+ dragOver,
872
+ error,
873
+ placeholder,
874
+ focused,
875
+ buttonText = "Browse",
876
+ inProgress,
877
+ InputProps,
878
+ size = "small",
879
+ hasFiles,
880
+ cursor = "pointer",
881
+ ...props
882
+ }) {
883
+ return /* @__PURE__ */ jsxRuntime.jsx(
884
+ StyledUploadField,
885
+ {
886
+ ...props,
887
+ size,
888
+ error,
889
+ placeholder,
890
+ focused: focused ?? dragOver,
891
+ cursor,
892
+ InputProps: {
893
+ ...InputProps,
894
+ name,
895
+ // multiple prop cannot be used here because it is not a valid prop for TextField InputProps
896
+ // not used for any UI logic
897
+ readOnly: true,
898
+ endAdornment: /* @__PURE__ */ jsxRuntime.jsx(
899
+ FilesAction,
900
+ {
901
+ buttonText,
902
+ hasFiles,
903
+ size,
904
+ error,
905
+ disabled: !!dragOver,
906
+ handleReset,
907
+ handleOpen,
908
+ inProgress
909
+ }
910
+ )
911
+ }
912
+ }
913
+ );
914
+ }
915
+ function useFileUpload({
916
+ onChange,
917
+ files,
918
+ multiple,
919
+ placeholder,
920
+ uploadInputRef
921
+ }) {
922
+ const intl = reactIntl.useIntl();
923
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
924
+ const [filesText, setFilesText] = React.useState("");
925
+ const [dragOver, setDragOver] = React.useState(false);
926
+ React.useEffect(() => {
927
+ if (!files || files.length === 0) {
928
+ setFilesText("");
929
+ } else if (files.length === 1) {
930
+ setFilesText(files[0].name);
931
+ } else {
932
+ setFilesText(
933
+ intlConfig.formatMessage(
934
+ { id: "c4r.form.filesSelected" },
935
+ { count: files.length }
936
+ )
937
+ );
938
+ }
939
+ }, [files, intlConfig]);
940
+ const handleBrowse = () => {
941
+ var _a;
942
+ (_a = uploadInputRef.current) == null ? void 0 : _a.click();
943
+ };
944
+ const handleDragOver = (event) => {
945
+ event.preventDefault();
946
+ setDragOver(true);
947
+ };
948
+ const handleDragLeave = (event) => {
949
+ event.preventDefault();
950
+ setDragOver(false);
951
+ };
952
+ const handleDrop = (event) => {
953
+ event.preventDefault();
954
+ setDragOver(false);
955
+ const items = event.dataTransfer.items;
956
+ const newFiles = getAllFiles(items);
957
+ onChange == null ? void 0 : onChange(newFiles);
958
+ };
959
+ const getAllFiles = (items) => {
960
+ const newFiles = [];
961
+ for (const item of Array.from(items)) {
962
+ if (item.kind === "file") {
963
+ const file = item.getAsFile();
964
+ newFiles.push(file);
965
+ }
966
+ }
967
+ return newFiles;
968
+ };
969
+ const handleFiles = (event) => {
970
+ const newFiles = Array.from(event.target.files);
971
+ onChange == null ? void 0 : onChange(newFiles);
972
+ };
973
+ const handleReset = (event) => {
974
+ event.stopPropagation();
975
+ setFilesText("");
976
+ };
977
+ const getPlaceholder = React.useMemo(() => {
978
+ const defaultPlaceholder = intlConfig.formatMessage(
979
+ { id: `c4r.form.dragPlaceholder` },
980
+ { count: multiple ? 0 : 1 }
981
+ );
982
+ const dragPlaceholder = intlConfig.formatMessage(
983
+ { id: `c4r.form.dragActivePlaceholder` },
984
+ { count: multiple ? 0 : 1 }
985
+ );
986
+ let placeholderText = "";
987
+ if (dragOver) {
988
+ placeholderText = dragPlaceholder;
989
+ } else {
990
+ placeholderText = placeholder ?? defaultPlaceholder;
991
+ }
992
+ return placeholderText;
993
+ }, [dragOver, multiple, placeholder, intlConfig]);
994
+ const inputEvents = {
995
+ onDragOver: handleDragOver,
996
+ onDragLeave: handleDragLeave,
997
+ onDrop: handleDrop,
998
+ onClick: handleBrowse
999
+ };
1000
+ return {
1001
+ filesText,
1002
+ getPlaceholder,
1003
+ dragOver,
1004
+ inputEvents,
1005
+ handleFiles,
1006
+ handleReset
1007
+ };
1008
+ }
1009
+ const DEFAULT_ACCEPT = ["application/JSON"];
1010
+ function UploadField({
1011
+ name,
1012
+ buttonText,
1013
+ accept: _accept,
1014
+ files,
1015
+ inProgress,
1016
+ onChange,
1017
+ multiple,
1018
+ placeholder,
1019
+ error,
1020
+ focused,
1021
+ nativeInputProps,
1022
+ ...props
1023
+ }) {
1024
+ const accept = _accept ?? DEFAULT_ACCEPT;
1025
+ const uploadInputRef = React.useRef(null);
1026
+ const {
1027
+ filesText,
1028
+ getPlaceholder,
1029
+ dragOver,
1030
+ inputEvents,
1031
+ handleFiles,
1032
+ handleReset
1033
+ } = useFileUpload({
1034
+ uploadInputRef,
1035
+ files,
1036
+ onChange,
1037
+ multiple,
1038
+ placeholder
1039
+ });
1040
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1041
+ /* @__PURE__ */ jsxRuntime.jsx(
1042
+ UploadFieldBase,
1043
+ {
1044
+ ...props,
1045
+ placeholder: getPlaceholder,
1046
+ value: filesText,
1047
+ error,
1048
+ focused: focused ?? dragOver,
1049
+ handleReset,
1050
+ dragOver,
1051
+ inProgress,
1052
+ hasFiles: Boolean(filesText),
1053
+ InputProps: inputEvents,
1054
+ buttonText
1055
+ }
1056
+ ),
1057
+ /* @__PURE__ */ jsxRuntime.jsx(
1058
+ "input",
1059
+ {
1060
+ ...nativeInputProps,
1061
+ ref: uploadInputRef,
1062
+ style: { display: "none" },
1063
+ type: "file",
1064
+ "aria-label": name,
1065
+ name,
1066
+ accept: String(accept),
1067
+ multiple,
1068
+ onChange: handleFiles
1069
+ }
1070
+ )
1071
+ ] });
1072
+ }
1073
+ function _Autocomplete({
1074
+ disabled,
1075
+ loading,
1076
+ ...props
1077
+ }, ref) {
1078
+ return /* @__PURE__ */ jsxRuntime.jsx(
1079
+ material.Autocomplete,
1080
+ {
1081
+ ...props,
1082
+ ref,
1083
+ disabled: disabled || loading,
1084
+ popupIcon: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" }) : /* @__PURE__ */ jsxRuntime.jsx(ArrowDown.ArrowDown, {}),
1085
+ "data-name": "autocomplete",
1086
+ ListboxProps: {
1087
+ "aria-multiselectable": false,
1088
+ ...props.ListboxProps
1089
+ }
1090
+ }
1091
+ );
1092
+ }
1093
+ const Autocomplete = React.forwardRef(_Autocomplete);
1094
+ const getDefaultOptionLabel = (option) => {
1095
+ return option && typeof option === "object" ? option.title ?? String(option) : String(option);
1096
+ };
1097
+ const createOptionWithMultiple = (option, multiple) => {
1098
+ return typeof option !== "object" || option === null ? { value: option, multiple } : { ...option, multiple };
1099
+ };
1100
+ const getDefaultLimitTagsText = (more) => /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": "more-options-tag", children: `+${more}` });
1101
+ function useAutocompleteRenderOption() {
1102
+ const renderOption = (props, option, state, getOptionLabel, customIcon) => {
1103
+ const {
1104
+ title,
1105
+ inputValue,
1106
+ divider,
1107
+ fixed,
1108
+ extended,
1109
+ dense,
1110
+ destructive,
1111
+ disabled,
1112
+ subtitle,
1113
+ iconColor,
1114
+ startAdornment,
1115
+ endAdornment,
1116
+ alternativeTitle,
1117
+ secondaryText,
1118
+ multiple
1119
+ } = option;
1120
+ const { key, ...otherProps } = props;
1121
+ const isPrimitiveOptionType = typeof option === "string" || typeof option === "number";
1122
+ const getOptionLabelText = (getOptionLabel2, option2, alternativeTitle2, title2) => {
1123
+ if (alternativeTitle2) return alternativeTitle2;
1124
+ if (title2) return title2;
1125
+ if (option2 && typeof option2 === "object" && "value" in option2) {
1126
+ return String(option2.value);
1127
+ }
1128
+ return getOptionLabel2(option2);
1129
+ };
1130
+ return /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: divider ? /* @__PURE__ */ jsxRuntime.jsx(material.Divider, {}) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1131
+ inputValue && /* @__PURE__ */ jsxRuntime.jsx(material.Divider, {}),
1132
+ /* @__PURE__ */ jsxRuntime.jsxs(
1133
+ MenuItem.MenuItem,
1134
+ {
1135
+ ...otherProps,
1136
+ ...!isPrimitiveOptionType && {
1137
+ fixed,
1138
+ extended,
1139
+ dense,
1140
+ destructive,
1141
+ disabled,
1142
+ subtitle,
1143
+ iconColor
1144
+ },
1145
+ ...{ "aria-disabled": subtitle || disabled },
1146
+ ...{ "aria-selected": state.selected },
1147
+ children: [
1148
+ !subtitle && (startAdornment || multiple || customIcon) && /* @__PURE__ */ jsxRuntime.jsxs(material.ListItemIcon, { children: [
1149
+ customIcon || multiple && /* @__PURE__ */ jsxRuntime.jsx(material.Checkbox, { checked: state.selected }),
1150
+ startAdornment
1151
+ ] }),
1152
+ /* @__PURE__ */ jsxRuntime.jsxs(material.ListItemText, { children: [
1153
+ getOptionLabelText(
1154
+ getOptionLabel ?? getDefaultOptionLabel,
1155
+ option,
1156
+ alternativeTitle,
1157
+ title
1158
+ ),
1159
+ secondaryText && /* @__PURE__ */ jsxRuntime.jsx(
1160
+ TablePaginationActions.Typography,
1161
+ {
1162
+ component: "p",
1163
+ variant: "caption",
1164
+ color: "text.secondary",
1165
+ children: secondaryText
1166
+ }
1167
+ )
1168
+ ] }),
1169
+ !subtitle && endAdornment
1170
+ ]
1171
+ }
1172
+ )
1173
+ ] }) }, key);
1174
+ };
1175
+ return { renderOption };
1176
+ }
1177
+ function useCreatableAutocomplete({
1178
+ getOptionLabel,
1179
+ newItemLabel,
1180
+ newItemIcon,
1181
+ multiple
1182
+ }) {
1183
+ const intl = reactIntl.useIntl();
1184
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
1185
+ const filter = material.createFilterOptions();
1186
+ const { renderOption: autocompleteRenderOption } = useAutocompleteRenderOption();
1187
+ const creatableFilterOptions = (options, params) => {
1188
+ const filtered = filter(
1189
+ options,
1190
+ params
1191
+ );
1192
+ const { inputValue } = params;
1193
+ const isExisting = options.some(
1194
+ (option) => inputValue === getOptionLabel(option)
1195
+ );
1196
+ if (inputValue.length > 1 && inputValue !== "" && !isExisting) {
1197
+ let newItemText;
1198
+ if (typeof newItemLabel === "function") {
1199
+ newItemText = newItemLabel(inputValue);
1200
+ } else if (newItemLabel) {
1201
+ newItemText = `${newItemLabel} "${inputValue}"`;
1202
+ } else {
1203
+ newItemText = `${intlConfig.formatMessage({ id: "c4r.form.add" })} "${inputValue}"`;
1204
+ }
1205
+ filtered.push({
1206
+ inputValue,
1207
+ title: newItemText
1208
+ });
1209
+ }
1210
+ return filtered;
1211
+ };
1212
+ const creatableOptionLabel = (option) => {
1213
+ if (typeof option === "string") {
1214
+ return option;
1215
+ }
1216
+ if (option.inputValue) {
1217
+ return option.inputValue;
1218
+ }
1219
+ return getOptionLabel(option);
1220
+ };
1221
+ const creatableRenderOption = (props, option, state) => {
1222
+ const customIcon = option.inputValue ? newItemIcon ?? /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.AddCircleOutlineOutlined, {}) : void 0;
1223
+ const optionWithMultiple = createOptionWithMultiple(option, !!multiple);
1224
+ return autocompleteRenderOption(
1225
+ props,
1226
+ optionWithMultiple,
1227
+ state,
1228
+ getOptionLabel,
1229
+ customIcon
1230
+ );
1231
+ };
1232
+ return {
1233
+ creatableFilterOptions,
1234
+ creatableOptionLabel,
1235
+ creatableRenderOption
1236
+ };
1237
+ }
1238
+ function useMultipleAutocomplete({
1239
+ options,
1240
+ value,
1241
+ onChange,
1242
+ getOptionLabel
1243
+ }) {
1244
+ const [multipleValue, setMultipleValue] = React.useState(
1245
+ Array.isArray(value) ? value : value ? [value] : []
1246
+ );
1247
+ const { renderOption: autocompleteRenderOption } = useAutocompleteRenderOption();
1248
+ React.useEffect(() => {
1249
+ const newValue = Array.isArray(value) ? value : value ? [value] : [];
1250
+ setMultipleValue(newValue);
1251
+ }, [value]);
1252
+ const allSelected = multipleValue.length === options.length;
1253
+ const someSelected = multipleValue.length > 0 && multipleValue.length < options.length;
1254
+ const handleSelectAll = (event) => {
1255
+ const newValue = allSelected ? [] : [...options];
1256
+ setMultipleValue(newValue);
1257
+ onChange == null ? void 0 : onChange(
1258
+ event,
1259
+ newValue,
1260
+ "selectOption"
1261
+ );
1262
+ };
1263
+ const handleChange = (event, newValue, reason) => {
1264
+ const multipleNewValue = newValue === null ? [] : newValue;
1265
+ setMultipleValue(multipleNewValue);
1266
+ onChange == null ? void 0 : onChange(event, newValue, reason);
1267
+ };
1268
+ const multipleRenderOption = (props, option, state) => {
1269
+ const optionWithMultiple = createOptionWithMultiple(option, true);
1270
+ return autocompleteRenderOption(
1271
+ props,
1272
+ optionWithMultiple,
1273
+ state,
1274
+ getOptionLabel
1275
+ );
1276
+ };
1277
+ return {
1278
+ multipleValue,
1279
+ allSelected,
1280
+ someSelected,
1281
+ handleSelectAll,
1282
+ handleChange,
1283
+ multipleRenderOption
1284
+ };
1285
+ }
1286
+ function _ListboxWithFilter({
1287
+ children,
1288
+ showFilters,
1289
+ allSelected,
1290
+ someSelected,
1291
+ handleSelectAll = () => void 0,
1292
+ multiple,
1293
+ ...otherProps
1294
+ }, ref) {
1295
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1296
+ "ul",
1297
+ {
1298
+ ref,
1299
+ ...otherProps,
1300
+ role: "listbox",
1301
+ "aria-multiselectable": multiple,
1302
+ children: [
1303
+ showFilters && multiple && /* @__PURE__ */ jsxRuntime.jsx(
1304
+ MenuItemFilter,
1305
+ {
1306
+ areAllSelected: !!allSelected,
1307
+ areAnySelected: !!someSelected,
1308
+ selectAll: handleSelectAll
1309
+ }
1310
+ ),
1311
+ children
1312
+ ]
1313
+ }
1314
+ );
1315
+ }
1316
+ const ListboxWithFilter = React.forwardRef(_ListboxWithFilter);
1317
+ function _CreatableAutocomplete({
1318
+ newItemLabel,
1319
+ newItemIcon,
1320
+ getOptionLabel = getDefaultOptionLabel,
1321
+ multiple,
1322
+ disableCloseOnSelect,
1323
+ disabled,
1324
+ loading,
1325
+ showFilters,
1326
+ options = [],
1327
+ value,
1328
+ onChange,
1329
+ getLimitTagsText,
1330
+ ...props
1331
+ }, ref) {
1332
+ const { freeSolo = true, ...otherProps } = props;
1333
+ const {
1334
+ multipleValue,
1335
+ allSelected,
1336
+ someSelected,
1337
+ handleSelectAll,
1338
+ handleChange
1339
+ } = useMultipleAutocomplete({
1340
+ options,
1341
+ value,
1342
+ onChange
1343
+ });
1344
+ const {
1345
+ creatableFilterOptions,
1346
+ creatableOptionLabel,
1347
+ creatableRenderOption
1348
+ } = useCreatableAutocomplete({
1349
+ getOptionLabel,
1350
+ newItemLabel,
1351
+ newItemIcon,
1352
+ multiple
1353
+ });
1354
+ return /* @__PURE__ */ jsxRuntime.jsx(
1355
+ material.Autocomplete,
1356
+ {
1357
+ ...otherProps,
1358
+ ref,
1359
+ options,
1360
+ value: multiple ? multipleValue : value,
1361
+ onChange: handleChange,
1362
+ filterOptions: creatableFilterOptions,
1363
+ getOptionLabel: creatableOptionLabel,
1364
+ renderOption: creatableRenderOption,
1365
+ freeSolo,
1366
+ forcePopupIcon: true,
1367
+ multiple,
1368
+ disableCloseOnSelect: disableCloseOnSelect ?? multiple,
1369
+ ListboxComponent: ListboxWithFilter,
1370
+ ListboxProps: {
1371
+ showFilters,
1372
+ allSelected,
1373
+ someSelected,
1374
+ handleSelectAll,
1375
+ multiple
1376
+ },
1377
+ getLimitTagsText: getLimitTagsText ?? getDefaultLimitTagsText,
1378
+ disabled: disabled || loading,
1379
+ popupIcon: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" }) : /* @__PURE__ */ jsxRuntime.jsx(ArrowDown.ArrowDown, {}),
1380
+ "data-name": "creatable-autocomplete"
1381
+ }
1382
+ );
1383
+ }
1384
+ const CreatableAutocomplete = React.forwardRef(_CreatableAutocomplete);
1385
+ function _MultipleAutocomplete({
1386
+ renderOption,
1387
+ disableCloseOnSelect = true,
1388
+ disabled,
1389
+ loading,
1390
+ showFilters,
1391
+ options,
1392
+ value,
1393
+ onChange,
1394
+ getOptionLabel,
1395
+ getLimitTagsText,
1396
+ ...props
1397
+ }, ref) {
1398
+ const {
1399
+ multipleValue,
1400
+ allSelected,
1401
+ someSelected,
1402
+ handleSelectAll,
1403
+ handleChange,
1404
+ multipleRenderOption
1405
+ } = useMultipleAutocomplete({
1406
+ options,
1407
+ value,
1408
+ onChange,
1409
+ getOptionLabel
1410
+ });
1411
+ return /* @__PURE__ */ jsxRuntime.jsx(
1412
+ material.Autocomplete,
1413
+ {
1414
+ ...props,
1415
+ ref,
1416
+ options,
1417
+ value: multipleValue,
1418
+ onChange: handleChange,
1419
+ getOptionLabel,
1420
+ renderOption: renderOption ?? multipleRenderOption,
1421
+ ListboxComponent: ListboxWithFilter,
1422
+ ListboxProps: {
1423
+ showFilters,
1424
+ allSelected,
1425
+ someSelected,
1426
+ handleSelectAll,
1427
+ multiple: true
1428
+ },
1429
+ multiple: true,
1430
+ getLimitTagsText: getLimitTagsText ?? getDefaultLimitTagsText,
1431
+ disableCloseOnSelect,
1432
+ disabled: disabled || loading,
1433
+ popupIcon: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 18, color: "inherit" }) : /* @__PURE__ */ jsxRuntime.jsx(ArrowDown.ArrowDown, {}),
1434
+ "data-name": "multiple-autocomplete"
1435
+ }
1436
+ );
1437
+ }
1438
+ const MultipleAutocomplete = React.forwardRef(_MultipleAutocomplete);
1439
+ const _CopiableComponent = ({
1440
+ children,
1441
+ disabled,
1442
+ value,
1443
+ onCopied,
1444
+ copyText = "c4r.button.copy",
1445
+ copiedText = "c4r.notifications.copiedToClipboard",
1446
+ button,
1447
+ buttonLabel,
1448
+ buttonProps,
1449
+ ariaLabel,
1450
+ dataTestId,
1451
+ tooltipPlacement = "top",
1452
+ ...props
1453
+ }, ref) => {
1454
+ const intl = reactIntl.useIntl();
1455
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
1456
+ const [open, setOpen] = React.useState(false);
1457
+ const { copy } = useCopyValue(copyText, copiedText);
1458
+ const handleClick = (e) => {
1459
+ e.preventDefault();
1460
+ copy(value).then(() => {
1461
+ onCopied == null ? void 0 : onCopied();
1462
+ setOpen(true);
1463
+ }).catch(console.error);
1464
+ };
1465
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1466
+ /* @__PURE__ */ jsxRuntime.jsx(
1467
+ material.Tooltip,
1468
+ {
1469
+ title: intlConfig.formatMessage({ id: copyText }),
1470
+ leaveDelay: 0,
1471
+ placement: tooltipPlacement,
1472
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
1473
+ material.Box,
1474
+ {
1475
+ ...props,
1476
+ sx: { cursor: disabled ? void 0 : "pointer" },
1477
+ onClick: handleClick,
1478
+ "data-name": "copiable",
1479
+ ref,
1480
+ children: [
1481
+ children,
1482
+ button && /* @__PURE__ */ jsxRuntime.jsx(
1483
+ IconButton,
1484
+ {
1485
+ ...buttonProps,
1486
+ disabled,
1487
+ icon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopyOutlined, {}),
1488
+ "data-testid": dataTestId,
1489
+ "aria-label": ariaLabel || buttonLabel,
1490
+ sx: {
1491
+ display: "flex"
1492
+ }
1493
+ }
1494
+ )
1495
+ ]
1496
+ }
1497
+ )
1498
+ }
1499
+ ),
1500
+ /* @__PURE__ */ jsxRuntime.jsx(
1501
+ Snackbar,
1502
+ {
1503
+ open,
1504
+ autoWidth: true,
1505
+ closeable: false,
1506
+ autoHideDuration: 4e3,
1507
+ onClose: () => setOpen(false),
1508
+ children: intlConfig.formatMessage({ id: copiedText })
1509
+ }
1510
+ )
1511
+ ] });
1512
+ };
1513
+ const CopiableComponent = React.forwardRef(_CopiableComponent);
1514
+ async function copyString(value) {
1515
+ return await navigator.clipboard.writeText(value);
1516
+ }
1517
+ const useCopyValue = (msg = "c4r.button.copy", copiedMsg = "c4r.notifications.copiedToClipboard") => {
1518
+ const [message, setMessage] = React.useState(msg);
1519
+ const copy = async (text) => {
1520
+ await copyString(text);
1521
+ setMessage(copiedMsg);
1522
+ setTimeout(() => setMessage(msg), 1e3);
1523
+ };
1524
+ return {
1525
+ message,
1526
+ copy
1527
+ };
1528
+ };
1529
+ const AccordionContainer = material.styled("div", {
1530
+ shouldForwardProp: (prop) => prop !== "variant"
1531
+ })(({ variant, theme }) => ({
1532
+ width: "100%",
1533
+ borderRadius: theme.spacing(0.5),
1534
+ ...variant === "outlined" && {
1535
+ backgroundColor: theme.palette.background.paper,
1536
+ boxShadow: `inset 0 0 0 1px ${theme.palette.divider}`
1537
+ }
1538
+ }));
1539
+ function AccordionGroup({
1540
+ variant = "standard",
1541
+ items,
1542
+ ...otherProps
1543
+ }) {
1544
+ return /* @__PURE__ */ jsxRuntime.jsx(AccordionContainer, { ...otherProps, variant, children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
1545
+ material.Accordion,
1546
+ {
1547
+ disabled: item.disabled,
1548
+ defaultExpanded: item.defaultExpanded,
1549
+ onChange: item.onChange,
1550
+ children: [
1551
+ /* @__PURE__ */ jsxRuntime.jsx(
1552
+ material.AccordionSummary,
1553
+ {
1554
+ "aria-controls": `${index}-content`,
1555
+ id: `${index}-header`,
1556
+ children: item.summary
1557
+ }
1558
+ ),
1559
+ /* @__PURE__ */ jsxRuntime.jsx(material.AccordionDetails, { children: item.content })
1560
+ ]
1561
+ },
1562
+ index
1563
+ )) });
1564
+ }
1565
+ const sizes = {
1566
+ large: 5,
1567
+ medium: 4,
1568
+ small: 3,
1569
+ xsmall: 2.25
1570
+ };
1571
+ const StyledAvatar = material.styled(material.Avatar, {
1572
+ shouldForwardProp: (prop) => prop !== "size" && prop !== "disabled"
1573
+ })(({ theme, size = "medium", disabled = false }) => ({
1574
+ width: theme.spacing(sizes[size]),
1575
+ height: theme.spacing(sizes[size]),
1576
+ ...theme.typography.subtitle1,
1577
+ ...size === "large" && {
1578
+ ...theme.typography.h6
1579
+ },
1580
+ ...size === "small" && {
1581
+ ...theme.typography.caption,
1582
+ fontWeight: 500
1583
+ },
1584
+ ...size === "xsmall" && {
1585
+ ...theme.typography.caption,
1586
+ fontWeight: 500,
1587
+ svg: {
1588
+ width: TablePaginationActions.ICON_SIZE_SMALL,
1589
+ height: TablePaginationActions.ICON_SIZE_SMALL
1590
+ }
1591
+ },
1592
+ ...disabled && {
1593
+ opacity: 0.6
1594
+ }
1595
+ }));
1596
+ function Avatar(props) {
1597
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledAvatar, { ...props });
1598
+ }
1599
+ const MAX_WIDTH = 480;
1600
+ const SnackbarRoot = material.styled(material.Snackbar)(({ theme }) => ({
1601
+ bottom: theme.spacing(2),
1602
+ right: theme.spacing(2),
1603
+ left: theme.spacing(2),
1604
+ [theme.breakpoints.up("sm")]: {
1605
+ bottom: theme.spacing(4),
1606
+ right: "auto",
1607
+ left: "50%",
1608
+ width: "100%",
1609
+ maxWidth: `${MAX_WIDTH}px`
1610
+ }
1611
+ }));
1612
+ const Content$4 = material.styled(material.Box, {
1613
+ shouldForwardProp: (prop) => prop !== "autoWidth"
1614
+ })(({ autoWidth, theme }) => ({
1615
+ minWidth: "100%",
1616
+ maxWidth: `${MAX_WIDTH}px`,
1617
+ margin: theme.spacing(0, 1),
1618
+ ...autoWidth && {
1619
+ minWidth: "auto"
1620
+ },
1621
+ [theme.breakpoints.up("sm")]: {
1622
+ minWidth: theme.spacing(40),
1623
+ ...autoWidth && {
1624
+ minWidth: "auto"
1625
+ }
1626
+ }
1627
+ }));
1628
+ const Alert = material.styled(Alert$1.Alert, {
1629
+ shouldForwardProp: (prop) => !["hasActions", "closeable"].includes(prop)
1630
+ })(({ hasActions, closeable, icon, theme }) => ({
1631
+ position: "relative",
1632
+ display: "flex",
1633
+ flexWrap: "wrap",
1634
+ columnGap: theme.spacing(1),
1635
+ rowGap: theme.spacing(0.25),
1636
+ padding: theme.spacing(1),
1637
+ paddingLeft: theme.spacing(2),
1638
+ color: theme.palette.common.white,
1639
+ backgroundColor: theme.palette.common.black,
1640
+ ".MuiAlert-message": {
1641
+ padding: theme.spacing(0.75, 0)
1642
+ },
1643
+ ".MuiAlert-message .MuiTypography-root, .MuiAlert-icon": {
1644
+ color: theme.palette.common.white
1645
+ },
1646
+ ".MuiAlert-message .MuiTypography-root:not(.MuiAlertTitle-root)": {
1647
+ ...theme.typography.body2
1648
+ },
1649
+ ".MuiAlert-message .MuiCircularProgress-circle": {
1650
+ color: theme.palette.common.white
1651
+ },
1652
+ ".MuiAlert-icon": {
1653
+ position: "absolute",
1654
+ top: theme.spacing(1),
1655
+ left: theme.spacing(1.5),
1656
+ display: "flex",
1657
+ alignItems: "center",
1658
+ justifyContent: "center",
1659
+ width: theme.spacing(3),
1660
+ marginTop: theme.spacing(0.5)
1661
+ },
1662
+ "&.MuiAlert-standardError": {
1663
+ backgroundColor: theme.palette.error.main
1664
+ },
1665
+ ...icon !== false && {
1666
+ paddingLeft: theme.spacing(5.5)
1667
+ },
1668
+ ...closeable && {
1669
+ paddingRight: theme.spacing(6)
1670
+ },
1671
+ ...!closeable && !hasActions && {
1672
+ paddingRight: theme.spacing(1.5)
1673
+ },
1674
+ ...hasActions && {
1675
+ ".MuiAlert-message": {
1676
+ minWidth: "fit-content",
1677
+ padding: theme.spacing(0.75, 0)
1678
+ }
1679
+ }
1680
+ }));
1681
+ const CloseButtonWrapper = material.styled(material.Box)(({ theme }) => ({
1682
+ position: "absolute",
1683
+ top: theme.spacing(1),
1684
+ right: theme.spacing(1),
1685
+ "& button:hover, & button:focus-visible": {
1686
+ backgroundColor: theme.palette.white[8]
1687
+ },
1688
+ svg: {
1689
+ color: theme.palette.white[60]
1690
+ }
1691
+ }));
1692
+ function Snackbar({
1693
+ severity = "neutral",
1694
+ autoHideDuration = TablePaginationActions.NOTIFICATION_DURATION_IN_MS,
1695
+ closeable = true,
1696
+ children,
1697
+ title,
1698
+ action,
1699
+ open,
1700
+ onClose = () => void 0,
1701
+ autoWidth,
1702
+ icon,
1703
+ ...rest
1704
+ }) {
1705
+ const intl = reactIntl.useIntl();
1706
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
1707
+ const isNeutral = severity === "neutral";
1708
+ const disabledIcon = icon === false || isNeutral && !icon;
1709
+ const disabledAutoHide = autoHideDuration === null;
1710
+ const duration = disabledAutoHide ? null : autoHideDuration || TablePaginationActions.NOTIFICATION_DURATION_IN_MS;
1711
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
1712
+ SnackbarRoot,
1713
+ {
1714
+ ...rest,
1715
+ open,
1716
+ autoHideDuration: duration,
1717
+ onClose,
1718
+ TransitionComponent: autoWidth ? material.Fade : material.Slide,
1719
+ "data-auto-width": autoWidth,
1720
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
1721
+ Content$4,
1722
+ {
1723
+ sx: {
1724
+ position: "relative"
1725
+ },
1726
+ autoWidth,
1727
+ children: [
1728
+ /* @__PURE__ */ jsxRuntime.jsx(
1729
+ Alert,
1730
+ {
1731
+ severity,
1732
+ action,
1733
+ icon: disabledIcon ? false : icon,
1734
+ elevation: 6,
1735
+ hasActions: !!action,
1736
+ closeable,
1737
+ title,
1738
+ children
1739
+ }
1740
+ ),
1741
+ closeable && /* @__PURE__ */ jsxRuntime.jsx(CloseButtonWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(
1742
+ IconButton,
1743
+ {
1744
+ color: "default",
1745
+ onClick: (e) => onClose(e, "timeout"),
1746
+ icon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.CloseOutlined, {}),
1747
+ tooltip: intlConfig.formatMessage({
1748
+ id: "c4r.button.close"
1749
+ })
1750
+ }
1751
+ ) })
1752
+ ]
1753
+ }
1754
+ )
1755
+ }
1756
+ ) });
1757
+ }
1758
+ const Menu = material.styled("div")(({ theme }) => ({
1759
+ display: "flex",
1760
+ alignItems: "center",
1761
+ height: TablePaginationActions.APPBAR_SIZE,
1762
+ marginRight: theme.spacing(1.5)
1763
+ }));
1764
+ const MenuButton = material.styled(material.IconButton)(({ theme }) => ({
1765
+ marginRight: theme.spacing(1),
1766
+ "&.MuiButtonBase-root svg path": {
1767
+ fill: theme.palette.brand.appBarContrastText
1768
+ }
1769
+ }));
1770
+ const MenuDivider = material.styled(material.Divider)(({ theme }) => ({
1771
+ borderColor: material.alpha(theme.palette.brand.appBarContrastText, 0.12)
1772
+ }));
1773
+ function BurgerMenu({
1774
+ onClickMenu
1775
+ }) {
1776
+ return (
1777
+ // replacing deprecated `<Hidden />` with sx following this MUI5 guide:
1778
+ // https://mui.com/material-ui/migration/v5-component-changes/#hidden
1779
+ /* @__PURE__ */ jsxRuntime.jsx(
1780
+ material.Box,
1781
+ {
1782
+ sx: {
1783
+ display: { md: "none", xs: "block" }
1784
+ },
1785
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Menu, { children: [
1786
+ /* @__PURE__ */ jsxRuntime.jsx(MenuButton, { onClick: onClickMenu, children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.MenuOutlined, {}) }),
1787
+ /* @__PURE__ */ jsxRuntime.jsx(MenuDivider, { orientation: "vertical", flexItem: true })
1788
+ ] })
1789
+ }
1790
+ )
1791
+ );
1792
+ }
1793
+ const Logo = material.styled("div")(({ theme }) => ({
1794
+ display: "flex",
1795
+ marginRight: theme.spacing(1.5),
1796
+ "& a": {
1797
+ display: "flex"
1798
+ },
1799
+ "& svg, & img": {
1800
+ width: theme.spacing(4),
1801
+ height: theme.spacing(4)
1802
+ }
1803
+ }));
1804
+ function BrandLogo({ logo }) {
1805
+ return /* @__PURE__ */ jsxRuntime.jsx(Logo, { children: logo });
1806
+ }
1807
+ const Text$1 = material.styled(TablePaginationActions.Typography)({
1808
+ display: "flex",
1809
+ alignItems: "center",
1810
+ whiteSpace: "nowrap"
1811
+ });
1812
+ function BrandText({ text }) {
1813
+ const theme = material.useTheme();
1814
+ return /* @__PURE__ */ jsxRuntime.jsx(
1815
+ Text$1,
1816
+ {
1817
+ component: "span",
1818
+ variant: "subtitle1",
1819
+ color: theme.palette.brand.appBarContrastText,
1820
+ children: text
1821
+ }
1822
+ );
1823
+ }
1824
+ const Text = material.styled(TablePaginationActions.Typography)(({ theme }) => ({
1825
+ display: "flex",
1826
+ alignItems: "center",
1827
+ "&::before": {
1828
+ content: '"/"',
1829
+ margin: theme.spacing(0, 1),
1830
+ opacity: 0.6,
1831
+ color: theme.palette.brand.appBarContrastText
1832
+ }
1833
+ }));
1834
+ function SecondaryText({ text }) {
1835
+ const theme = material.useTheme();
1836
+ return /* @__PURE__ */ jsxRuntime.jsx(
1837
+ Text,
1838
+ {
1839
+ component: "span",
1840
+ variant: "body2",
1841
+ weight: "strong",
1842
+ color: theme.palette.brand.appBarContrastText,
1843
+ children: text
1844
+ }
1845
+ );
1846
+ }
1847
+ const Root$4 = material.styled(material.AppBar)(({ theme }) => ({
1848
+ backgroundColor: theme.palette.brand.appBarMain,
1849
+ "& .MuiTypography-root": {
1850
+ color: theme.palette.brand.appBarContrastText
1851
+ },
1852
+ "& .MuiIconButton-root path": {
1853
+ fill: theme.palette.brand.appBarContrastText
1854
+ }
1855
+ }));
1856
+ const BrandElements = material.styled("div")(({ theme }) => ({
1857
+ display: "flex",
1858
+ alignItems: "center",
1859
+ maxWidth: "calc(100% - 300px)",
1860
+ overflow: "hidden",
1861
+ [theme.breakpoints.down("sm")]: {
1862
+ minWidth: "192px"
1863
+ }
1864
+ }));
1865
+ const Content$3 = material.styled("div")(({ theme }) => ({
1866
+ display: "flex",
1867
+ alignItems: "center",
1868
+ justifyContent: "space-between",
1869
+ flex: 1,
1870
+ marginLeft: theme.spacing(1)
1871
+ }));
1872
+ function AppBar({
1873
+ children,
1874
+ brandLogo,
1875
+ brandText,
1876
+ secondaryText,
1877
+ showBurgerMenu = false,
1878
+ onClickMenu,
1879
+ ...otherProps
1880
+ }) {
1881
+ return /* @__PURE__ */ jsxRuntime.jsx(Root$4, { ...otherProps, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Toolbar, { children: [
1882
+ /* @__PURE__ */ jsxRuntime.jsxs(BrandElements, { children: [
1883
+ showBurgerMenu && /* @__PURE__ */ jsxRuntime.jsx(BurgerMenu, { onClickMenu }),
1884
+ brandLogo && /* @__PURE__ */ jsxRuntime.jsx(BrandLogo, { logo: brandLogo }),
1885
+ brandText && /* @__PURE__ */ jsxRuntime.jsx(BrandText, { text: brandText }),
1886
+ secondaryText && /* @__PURE__ */ jsxRuntime.jsx(SecondaryText, { text: secondaryText })
1887
+ ] }),
1888
+ /* @__PURE__ */ jsxRuntime.jsx(Content$3, { children })
1889
+ ] }) });
1890
+ }
1891
+ const Container = material.styled(material.Box, {
1892
+ shouldForwardProp: (prop) => !["size", "variant"].includes(prop)
1893
+ })(({ size, variant, theme }) => ({
1894
+ position: "absolute",
1895
+ right: theme.spacing(5.75),
1896
+ ...size === "small" && {
1897
+ right: theme.spacing(4),
1898
+ top: "3px"
1899
+ // to align with design specs
1900
+ },
1901
+ ...variant === "standard" && {
1902
+ right: theme.spacing(4.75),
1903
+ ...size === "small" && {
1904
+ right: theme.spacing(3.5)
1905
+ }
1906
+ }
1907
+ }));
1908
+ function ClearButton({
1909
+ size,
1910
+ variant,
1911
+ ...props
1912
+ }) {
1913
+ const intl = reactIntl.useIntl();
1914
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
1915
+ return /* @__PURE__ */ jsxRuntime.jsx(Container, { size, variant, children: /* @__PURE__ */ jsxRuntime.jsx(
1916
+ material.IconButton,
1917
+ {
1918
+ ...props,
1919
+ size,
1920
+ "aria-label": intlConfig.formatMessage({
1921
+ id: "c4r.form.clearSelection"
1922
+ })
1923
+ }
1924
+ ) });
1925
+ }
1926
+ const Root$3 = material.styled(material.Box, {
1927
+ shouldForwardProp: (prop) => !["size", "variant", "readOnly"].includes(prop)
1928
+ })(({ size, variant, readOnly, theme }) => ({
1929
+ // There is no specific slot to change TextField styles at DatePicker level, so we need to wrap our component to isolate this override. https://mui.com/x/react-date-pickers/date-picker/#customization
1930
+ ".MuiInputBase-root": {
1931
+ "& .clearButton svg": {
1932
+ color: theme.palette.text.hint
1933
+ },
1934
+ ...size === "small" && {
1935
+ paddingRight: `${theme.spacing(1)} !important`
1936
+ },
1937
+ ...size === "medium" && {
1938
+ "& .MuiInputAdornment-root": {
1939
+ "& .MuiIconButton-edgeEnd": {
1940
+ marginRight: theme.spacing(-1)
1941
+ }
1942
+ }
1943
+ },
1944
+ ...variant === "standard" && {
1945
+ paddingRight: `${theme.spacing(1)} !important`,
1946
+ ...size === "small" && {
1947
+ paddingRight: `${theme.spacing(0.5)} !important`
1948
+ }
1949
+ },
1950
+ ...readOnly && {
1951
+ "& .MuiInputAdornment-root": {
1952
+ "& svg": {
1953
+ color: theme.palette.text.disabled
1954
+ }
1955
+ }
1956
+ }
1957
+ }
1958
+ }));
1959
+ function DateFieldContainer({
1960
+ children,
1961
+ size,
1962
+ variant,
1963
+ readOnly,
1964
+ ...props
1965
+ }) {
1966
+ return /* @__PURE__ */ jsxRuntime.jsx(Root$3, { ...props, size, variant, readOnly, children });
1967
+ }
1968
+ function DatePicker({
1969
+ handleClear,
1970
+ variant = "outlined",
1971
+ size = "small",
1972
+ label,
1973
+ labelHelpTooltip,
1974
+ type,
1975
+ helperText,
1976
+ placeholder,
1977
+ slotProps,
1978
+ slots,
1979
+ error,
1980
+ showCalendar = true,
1981
+ readOnly,
1982
+ "aria-label": ariaLabel,
1983
+ "data-testid": dataTestId,
1984
+ ...props
1985
+ }) {
1986
+ const intl = reactIntl.useIntl();
1987
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
1988
+ return (
1989
+ // Don't remove className, it's used for styling
1990
+ /* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "CartoDatePicker-root", "data-testid": "date-picker", children: /* @__PURE__ */ jsxRuntime.jsx(
1991
+ DateFieldContainer,
1992
+ {
1993
+ size,
1994
+ variant,
1995
+ readOnly,
1996
+ "data-name": "date-picker",
1997
+ "aria-label": ariaLabel,
1998
+ "data-testid": dataTestId,
1999
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2000
+ DatePicker$1.DatePicker,
2001
+ {
2002
+ ...props,
2003
+ label: label && /* @__PURE__ */ jsxRuntime.jsx(
2004
+ LabelWithIndicator,
2005
+ {
2006
+ label,
2007
+ type,
2008
+ icon: labelHelpTooltip && /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: labelHelpTooltip, children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.HelpOutline, { htmlColor: "text.secondary" }) })
2009
+ }
2010
+ ),
2011
+ slotProps: {
2012
+ // https://mui.com/x/api/date-pickers/date-picker/#slots
2013
+ textField: {
2014
+ variant,
2015
+ helperText,
2016
+ placeholder,
2017
+ size,
2018
+ error: error ?? void 0,
2019
+ // undefined is needed to allow the component to control the error state for the default validation
2020
+ inputProps: {
2021
+ "data-testid": "date-picker-input"
2022
+ }
2023
+ },
2024
+ field: {
2025
+ clearable: !!handleClear,
2026
+ onClear: handleClear
2027
+ },
2028
+ ...slotProps
2029
+ },
2030
+ slots: {
2031
+ clearButton: (props2) => /* @__PURE__ */ jsxRuntime.jsx(ClearButton, { ...props2, size, variant }),
2032
+ openPickerButton: (props2) => /* @__PURE__ */ jsxRuntime.jsx(
2033
+ material.IconButton,
2034
+ {
2035
+ ...props2,
2036
+ size,
2037
+ "aria-label": intlConfig.formatMessage({
2038
+ id: "c4r.form.chooseDate"
2039
+ })
2040
+ }
2041
+ ),
2042
+ ...slots
2043
+ },
2044
+ disableOpenPicker: !showCalendar,
2045
+ readOnly
2046
+ }
2047
+ )
2048
+ }
2049
+ ) })
2050
+ );
2051
+ }
2052
+ const PickersDayWrapper = material.styled(material.Box, {
2053
+ shouldForwardProp: (prop) => ![
2054
+ "isSelected",
2055
+ "isStartDate",
2056
+ "isEndDate",
2057
+ "isSelectedMonth",
2058
+ "isLastDay",
2059
+ "isFirstDay"
2060
+ ].includes(prop)
2061
+ })(
2062
+ ({
2063
+ theme,
2064
+ isSelected,
2065
+ isStartDate,
2066
+ isEndDate,
2067
+ isSelectedMonth,
2068
+ isLastDay,
2069
+ isFirstDay
2070
+ }) => ({
2071
+ position: "relative",
2072
+ margin: theme.spacing(0.25),
2073
+ "& .MuiPickersDay-root": {
2074
+ margin: 0
2075
+ },
2076
+ // Highlight the selected date range
2077
+ ...isSelected && isSelectedMonth && {
2078
+ // Creates a continuous background color between start and end date
2079
+ "&::before": {
2080
+ content: '""',
2081
+ position: "absolute",
2082
+ top: 0,
2083
+ right: "-2px",
2084
+ bottom: 0,
2085
+ left: "-2px",
2086
+ backgroundColor: theme.palette.primary.background,
2087
+ // Selected start date OR first day of the month
2088
+ ...(isStartDate || isFirstDay) && {
2089
+ left: 0,
2090
+ borderRadius: `${theme.shape.borderRadius}px 0 0 ${theme.shape.borderRadius}px`
2091
+ },
2092
+ // Selected end date OR last day of the month
2093
+ ...(isEndDate || isLastDay) && {
2094
+ right: 0,
2095
+ borderRadius: `0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px 0`
2096
+ }
2097
+ },
2098
+ // First selected day
2099
+ "&:first-of-type::before": {
2100
+ left: 0,
2101
+ borderRadius: `${theme.shape.borderRadius}px 0 0 ${theme.shape.borderRadius}px`
2102
+ },
2103
+ // Last selected day
2104
+ "&:last-of-type::before": {
2105
+ right: 0,
2106
+ borderRadius: `0 ${theme.shape.borderRadius}px ${theme.shape.borderRadius}px 0`
2107
+ },
2108
+ // First day of month and last selected day in a week
2109
+ ...isFirstDay && {
2110
+ "&:last-of-type::before": {
2111
+ left: 0,
2112
+ right: 0,
2113
+ borderRadius: theme.shape.borderRadius
2114
+ }
2115
+ },
2116
+ // Last day of month and first selected day in a week
2117
+ ...isLastDay && {
2118
+ "&:first-of-type::before": {
2119
+ left: 0,
2120
+ right: 0,
2121
+ borderRadius: theme.shape.borderRadius
2122
+ }
2123
+ },
2124
+ "& .MuiPickersDay-today": {
2125
+ borderColor: `${theme.palette.default.outlinedBorder} !important`,
2126
+ ...(isStartDate || isEndDate) && {
2127
+ boxShadow: `0 0 0 1px inset ${theme.palette.background.paper}`
2128
+ }
2129
+ },
2130
+ // Always having a solid background color below to avoid color blending
2131
+ "&::after": {
2132
+ content: '""',
2133
+ position: "absolute",
2134
+ top: 0,
2135
+ right: 0,
2136
+ bottom: 0,
2137
+ left: 0,
2138
+ backgroundColor: theme.palette.background.paper,
2139
+ borderRadius: theme.shape.borderRadius,
2140
+ transition: "background-color 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"
2141
+ },
2142
+ "&:hover::after": {
2143
+ backgroundColor: theme.palette.primary.relatedLight
2144
+ }
2145
+ }
2146
+ })
2147
+ );
2148
+ const CustomPickersDay = material.styled(xDatePickers.PickersDay, {
2149
+ shouldForwardProp: (prop) => prop !== "isDateRangeLimit"
2150
+ })(({ theme, isDateRangeLimit }) => ({
2151
+ "&.MuiPickersDay-root": {
2152
+ position: "relative",
2153
+ zIndex: 1,
2154
+ "&.Mui-selected": {
2155
+ color: theme.palette.text.primary
2156
+ },
2157
+ // Is selected date within the range
2158
+ ...isDateRangeLimit && {
2159
+ "&.Mui-selected": {
2160
+ backgroundColor: `${theme.palette.primary.main} !important`,
2161
+ color: theme.palette.primary.contrastText,
2162
+ "&:hover": {
2163
+ backgroundColor: `${theme.palette.primary.dark} !important`
2164
+ }
2165
+ }
2166
+ }
2167
+ }
2168
+ }));
2169
+ const isSameDay = (d1, d2) => {
2170
+ if (!d1 || !d2) return false;
2171
+ return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth() && d1.getDate() === d2.getDate();
2172
+ };
2173
+ function PickersDay({
2174
+ day,
2175
+ startDate,
2176
+ endDate,
2177
+ selectedMonth,
2178
+ ...otherProps
2179
+ }) {
2180
+ const isStartDate = Boolean(startDate && isSameDay(startDate, day));
2181
+ const isEndDate = Boolean(endDate && isSameDay(endDate, day));
2182
+ const isInsideRange = Boolean(
2183
+ startDate && endDate && day.getTime() >= startDate.getTime() && day.getTime() <= endDate.getTime()
2184
+ );
2185
+ const isFirstDayOfMonth = Boolean(day.getDate() === 1);
2186
+ const isLastDayOfMonth = Boolean(
2187
+ day.getDate() === new Date(day.getFullYear(), day.getMonth() + 1, 0).getDate()
2188
+ );
2189
+ const isDayInSelectedMonth = Boolean(
2190
+ selectedMonth && day.getMonth() === selectedMonth.getMonth()
2191
+ );
2192
+ return /* @__PURE__ */ jsxRuntime.jsx(
2193
+ PickersDayWrapper,
2194
+ {
2195
+ isSelected: isInsideRange,
2196
+ isStartDate,
2197
+ isEndDate,
2198
+ isSelectedMonth: isDayInSelectedMonth,
2199
+ isLastDay: isLastDayOfMonth,
2200
+ isFirstDay: isFirstDayOfMonth,
2201
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2202
+ CustomPickersDay,
2203
+ {
2204
+ ...otherProps,
2205
+ day,
2206
+ selected: isInsideRange || isStartDate || isEndDate,
2207
+ isDateRangeLimit: isStartDate || isEndDate,
2208
+ "data-name": "pickers-day"
2209
+ }
2210
+ )
2211
+ }
2212
+ );
2213
+ }
2214
+ const FieldsWrapper = material.styled(material.Box, {
2215
+ shouldForwardProp: (prop) => !["variant"].includes(prop)
2216
+ })(({ variant, theme }) => ({
2217
+ display: "flex",
2218
+ gap: variant === "standard" ? theme.spacing(1) : "1px",
2219
+ "& .CartoDatePicker-root": {
2220
+ // Start date field
2221
+ "&:first-of-type": {
2222
+ ".MuiInputBase-root": {
2223
+ borderRadius: theme.spacing(0.5, 0, 0, 0.5),
2224
+ boxShadow: `1px 0 0 0 ${theme.palette.default.outlinedBorder}`,
2225
+ ...variant === "outlined" && {
2226
+ // Remove border from the right side only in its default state. Nested negation selector to target only specific Mui rules, otherwise it would force us to rewrite the state styles.
2227
+ "&:not(:hover):not(.Mui-focused):not(.Mui-error) .MuiOutlinedInput-notchedOutline": {
2228
+ borderRightColor: "transparent"
2229
+ }
2230
+ },
2231
+ ...variant === "filled" && {
2232
+ "&::before, &::after": {
2233
+ borderRadius: theme.spacing(0.5, 0, 0, 0.5)
2234
+ }
2235
+ },
2236
+ ...variant === "standard" && {
2237
+ boxShadow: "none",
2238
+ borderRadius: 0
2239
+ }
2240
+ }
2241
+ },
2242
+ // End date field
2243
+ "&:last-of-type": {
2244
+ ".MuiInputBase-root": {
2245
+ borderRadius: theme.spacing(0, 0.5, 0.5, 0),
2246
+ ...variant === "outlined" && {
2247
+ // Remove border from the left side only in its default state
2248
+ "&:not(:hover):not(.Mui-focused):not(.Mui-error) .MuiOutlinedInput-notchedOutline": {
2249
+ borderLeftColor: "transparent"
2250
+ }
2251
+ },
2252
+ ...variant === "filled" && {
2253
+ "&::before, &::after": {
2254
+ borderRadius: theme.spacing(0, 0.5, 0.5, 0)
2255
+ }
2256
+ },
2257
+ ...variant === "standard" && {
2258
+ borderRadius: 0
2259
+ }
2260
+ }
2261
+ }
2262
+ }
2263
+ }));
2264
+ function DateRangePicker({
2265
+ globalHelperText,
2266
+ error,
2267
+ variant = "outlined",
2268
+ startProps,
2269
+ endProps,
2270
+ "aria-label": ariaLabel,
2271
+ "data-testid": dataTestId,
2272
+ ...props
2273
+ }) {
2274
+ const intl = reactIntl.useIntl();
2275
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
2276
+ const [isEndDateOpen, setIsEndDateOpen] = React.useState(false);
2277
+ const [isStartDateOpen, setIsStartDateOpen] = React.useState(false);
2278
+ const [startDate, setStartDate] = React.useState(
2279
+ (startProps == null ? void 0 : startProps.value) || null
2280
+ );
2281
+ const [endDate, setEndDate] = React.useState((endProps == null ? void 0 : endProps.value) || null);
2282
+ const [selectedMonth, setSelectedMonth] = React.useState(
2283
+ (endProps == null ? void 0 : endProps.value) ?? (startProps == null ? void 0 : startProps.value) ?? /* @__PURE__ */ new Date()
2284
+ );
2285
+ const hasError = error ?? (startProps == null ? void 0 : startProps.error) ?? (endProps == null ? void 0 : endProps.error);
2286
+ const handleStartDateChange = (value, context) => {
2287
+ setStartDate(value);
2288
+ if (startProps == null ? void 0 : startProps.onChange) {
2289
+ startProps.onChange(value, context);
2290
+ }
2291
+ if (value && context.validationError === null && !isStartDateOpen && context.trigger === null) {
2292
+ setIsStartDateOpen(false);
2293
+ setIsEndDateOpen(true);
2294
+ }
2295
+ };
2296
+ const handleEndDateChange = (value, context) => {
2297
+ setEndDate(value);
2298
+ if (endProps == null ? void 0 : endProps.onChange) {
2299
+ endProps.onChange(value, context);
2300
+ }
2301
+ };
2302
+ const handleStartDateOpen = () => {
2303
+ setIsStartDateOpen(true);
2304
+ setIsEndDateOpen(false);
2305
+ setTimeout(() => {
2306
+ setSelectedMonth(startDate ?? /* @__PURE__ */ new Date());
2307
+ }, 120);
2308
+ };
2309
+ const handleStartDateClose = () => {
2310
+ setIsStartDateOpen(false);
2311
+ setIsEndDateOpen(true);
2312
+ setTimeout(() => {
2313
+ setSelectedMonth(endDate ?? startDate ?? /* @__PURE__ */ new Date());
2314
+ }, 120);
2315
+ };
2316
+ const handleEndDateOpen = () => {
2317
+ setIsStartDateOpen(false);
2318
+ setIsEndDateOpen(true);
2319
+ setTimeout(() => {
2320
+ setSelectedMonth(endDate ?? startDate ?? /* @__PURE__ */ new Date());
2321
+ }, 120);
2322
+ };
2323
+ return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { children: [
2324
+ /* @__PURE__ */ jsxRuntime.jsxs(
2325
+ FieldsWrapper,
2326
+ {
2327
+ variant,
2328
+ "data-name": "date-range-picker",
2329
+ "aria-label": ariaLabel,
2330
+ "data-testid": dataTestId,
2331
+ children: [
2332
+ /* @__PURE__ */ jsxRuntime.jsx(
2333
+ DatePicker,
2334
+ {
2335
+ ...props,
2336
+ ...startProps,
2337
+ value: (startProps == null ? void 0 : startProps.value) ?? startDate,
2338
+ maxDate: endDate ?? void 0,
2339
+ label: (startProps == null ? void 0 : startProps.label) ?? intlConfig.formatMessage({ id: "c4r.form.startDate" }),
2340
+ slotProps: {
2341
+ popper: {
2342
+ placement: "bottom-start",
2343
+ "aria-label": intlConfig.formatMessage({
2344
+ id: "c4r.form.startDateCalendar"
2345
+ })
2346
+ },
2347
+ ...startProps == null ? void 0 : startProps.slotProps
2348
+ },
2349
+ slots: {
2350
+ openPickerIcon: iconsMaterial.TodayOutlined,
2351
+ day: (props2) => /* @__PURE__ */ jsxRuntime.jsx(
2352
+ PickersDay,
2353
+ {
2354
+ ...props2,
2355
+ startDate,
2356
+ endDate,
2357
+ selectedMonth
2358
+ }
2359
+ ),
2360
+ ...startProps == null ? void 0 : startProps.slots
2361
+ },
2362
+ error: (startProps == null ? void 0 : startProps.error) ?? error,
2363
+ open: isStartDateOpen,
2364
+ onChange: handleStartDateChange,
2365
+ onOpen: handleStartDateOpen,
2366
+ onClose: handleStartDateClose,
2367
+ onMonthChange: (month) => setSelectedMonth(month),
2368
+ variant
2369
+ }
2370
+ ),
2371
+ /* @__PURE__ */ jsxRuntime.jsx(
2372
+ DatePicker,
2373
+ {
2374
+ ...props,
2375
+ ...endProps,
2376
+ value: (endProps == null ? void 0 : endProps.value) ?? endDate,
2377
+ minDate: startDate ?? void 0,
2378
+ slotProps: {
2379
+ popper: {
2380
+ "aria-label": intlConfig.formatMessage({
2381
+ id: "c4r.form.endDateCalendar"
2382
+ })
2383
+ },
2384
+ ...endProps == null ? void 0 : endProps.slotProps
2385
+ },
2386
+ slots: {
2387
+ day: (props2) => /* @__PURE__ */ jsxRuntime.jsx(
2388
+ PickersDay,
2389
+ {
2390
+ ...props2,
2391
+ startDate,
2392
+ endDate,
2393
+ selectedMonth
2394
+ }
2395
+ ),
2396
+ ...endProps == null ? void 0 : endProps.slots
2397
+ },
2398
+ label: (endProps == null ? void 0 : endProps.label) ?? intlConfig.formatMessage({ id: "c4r.form.endDate" }),
2399
+ error: (endProps == null ? void 0 : endProps.error) ?? error,
2400
+ open: isEndDateOpen,
2401
+ onOpen: handleEndDateOpen,
2402
+ onClose: () => setIsEndDateOpen(false),
2403
+ onChange: handleEndDateChange,
2404
+ onMonthChange: (month) => setSelectedMonth(month),
2405
+ variant
2406
+ }
2407
+ )
2408
+ ]
2409
+ }
2410
+ ),
2411
+ globalHelperText && /* @__PURE__ */ jsxRuntime.jsx(material.FormHelperText, { error: hasError, children: globalHelperText })
2412
+ ] });
2413
+ }
2414
+ const getDateTimeFormat = (views, includeDate, ampm, format) => {
2415
+ const hasHours = views == null ? void 0 : views.includes("hours");
2416
+ const hasSeconds = views == null ? void 0 : views.includes("seconds");
2417
+ const hasMinutes = views == null ? void 0 : views.includes("minutes");
2418
+ const hasOnlyHours = (views == null ? void 0 : views.length) === 1 && views[0] === "hours";
2419
+ if (format) return format;
2420
+ const timeFormatParts = [];
2421
+ if (includeDate) {
2422
+ timeFormatParts.push("MM/dd/yyyy ");
2423
+ }
2424
+ if (hasHours) {
2425
+ timeFormatParts.push(ampm ? "hh" : "HH");
2426
+ }
2427
+ if (!hasOnlyHours) {
2428
+ timeFormatParts.push(":");
2429
+ }
2430
+ if (hasMinutes) {
2431
+ timeFormatParts.push("mm");
2432
+ }
2433
+ if (hasSeconds) {
2434
+ timeFormatParts.push(":ss");
2435
+ }
2436
+ if (ampm) {
2437
+ timeFormatParts.push(" a");
2438
+ }
2439
+ return timeFormatParts.join("");
2440
+ };
2441
+ function TimePicker({
2442
+ handleClear,
2443
+ variant = "outlined",
2444
+ size = "small",
2445
+ label,
2446
+ labelHelpTooltip,
2447
+ type,
2448
+ helperText,
2449
+ placeholder,
2450
+ error,
2451
+ showClock = true,
2452
+ readOnly,
2453
+ slotProps,
2454
+ slots,
2455
+ ampm = true,
2456
+ views = ["hours", "minutes"],
2457
+ format,
2458
+ "data-testid": dataTestId,
2459
+ "aria-label": ariaLabel,
2460
+ ...props
2461
+ }) {
2462
+ const intl = reactIntl.useIntl();
2463
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
2464
+ const inputRef = React.useRef(null);
2465
+ const [inputWidth, setInputWidth] = React.useState(0);
2466
+ React.useEffect(() => {
2467
+ if (!inputRef.current) return;
2468
+ const resizeObserver = new ResizeObserver((entries) => {
2469
+ var _a;
2470
+ const width = (_a = entries[0]) == null ? void 0 : _a.contentRect.width;
2471
+ if (width) {
2472
+ setInputWidth(width);
2473
+ }
2474
+ });
2475
+ resizeObserver.observe(inputRef.current);
2476
+ return () => {
2477
+ resizeObserver.disconnect();
2478
+ };
2479
+ }, []);
2480
+ return /* @__PURE__ */ jsxRuntime.jsx(
2481
+ DateFieldContainer,
2482
+ {
2483
+ size,
2484
+ variant,
2485
+ readOnly,
2486
+ "data-name": "time-picker",
2487
+ "data-testid": dataTestId ?? "time-picker",
2488
+ "aria-label": ariaLabel,
2489
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2490
+ TimePicker$1.TimePicker,
2491
+ {
2492
+ ...props,
2493
+ ref: inputRef,
2494
+ label: /* @__PURE__ */ jsxRuntime.jsx(
2495
+ LabelWithIndicator,
2496
+ {
2497
+ label: label ?? intlConfig.formatMessage({ id: "c4r.form.time" }),
2498
+ type,
2499
+ icon: labelHelpTooltip && /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: labelHelpTooltip, children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.HelpOutline, { htmlColor: "text.secondary" }) })
2500
+ }
2501
+ ),
2502
+ views: ["hours"],
2503
+ format: getDateTimeFormat(views, false, ampm, format),
2504
+ slotProps: {
2505
+ textField: {
2506
+ variant,
2507
+ helperText,
2508
+ placeholder,
2509
+ size,
2510
+ error: error ?? void 0,
2511
+ // undefined is needed to allow the component to control the error state for the default validation
2512
+ inputProps: {
2513
+ "data-testid": "time-picker-input"
2514
+ }
2515
+ },
2516
+ field: {
2517
+ clearable: !!handleClear,
2518
+ onClear: handleClear
2519
+ },
2520
+ popper: {
2521
+ placement: "bottom-end"
2522
+ },
2523
+ layout: {
2524
+ sx: {
2525
+ width: inputWidth
2526
+ }
2527
+ },
2528
+ ...slotProps
2529
+ },
2530
+ slots: {
2531
+ clearButton: (props2) => /* @__PURE__ */ jsxRuntime.jsx(ClearButton, { ...props2, size, variant }),
2532
+ openPickerButton: (props2) => /* @__PURE__ */ jsxRuntime.jsx(
2533
+ material.IconButton,
2534
+ {
2535
+ ...props2,
2536
+ size,
2537
+ "aria-label": intlConfig.formatMessage({
2538
+ id: "c4r.form.chooseDate"
2539
+ })
2540
+ }
2541
+ ),
2542
+ ...slots
2543
+ },
2544
+ disableOpenPicker: !showClock,
2545
+ readOnly,
2546
+ ampm
2547
+ }
2548
+ )
2549
+ }
2550
+ );
2551
+ }
2552
+ function DateTimePicker({
2553
+ handleClear,
2554
+ variant = "outlined",
2555
+ size = "small",
2556
+ label,
2557
+ labelHelpTooltip,
2558
+ type,
2559
+ helperText,
2560
+ placeholder,
2561
+ error,
2562
+ showCalendar = true,
2563
+ readOnly,
2564
+ slotProps,
2565
+ slots,
2566
+ ampm = true,
2567
+ views = ["hours", "minutes"],
2568
+ format,
2569
+ "data-testid": dataTestId,
2570
+ "aria-label": ariaLabel,
2571
+ ...props
2572
+ }) {
2573
+ const intl = reactIntl.useIntl();
2574
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
2575
+ return /* @__PURE__ */ jsxRuntime.jsx(
2576
+ DateFieldContainer,
2577
+ {
2578
+ size,
2579
+ variant,
2580
+ readOnly,
2581
+ "data-name": "date-time-picker",
2582
+ "data-testid": dataTestId ?? "date-time-picker",
2583
+ "aria-label": ariaLabel,
2584
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2585
+ DateTimePicker$1.DateTimePicker,
2586
+ {
2587
+ ...props,
2588
+ label: /* @__PURE__ */ jsxRuntime.jsx(
2589
+ LabelWithIndicator,
2590
+ {
2591
+ label: label ?? intlConfig.formatMessage({ id: "c4r.form.time" }),
2592
+ type,
2593
+ icon: labelHelpTooltip && /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: labelHelpTooltip, children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.HelpOutline, { htmlColor: "text.secondary" }) })
2594
+ }
2595
+ ),
2596
+ views: ["year", "month", "day", "hours"],
2597
+ format: getDateTimeFormat(views, true, ampm, format),
2598
+ slotProps: {
2599
+ textField: {
2600
+ variant,
2601
+ helperText,
2602
+ placeholder,
2603
+ size,
2604
+ error: error ?? void 0,
2605
+ // undefined is needed to allow the component to control the error state for the default validation
2606
+ inputProps: {
2607
+ "data-testid": "date-time-picker-input"
2608
+ }
2609
+ },
2610
+ field: {
2611
+ clearable: !!handleClear,
2612
+ onClear: handleClear
2613
+ },
2614
+ ...slotProps
2615
+ },
2616
+ slots: {
2617
+ clearButton: (props2) => /* @__PURE__ */ jsxRuntime.jsx(ClearButton, { ...props2, size, variant }),
2618
+ openPickerButton: (props2) => /* @__PURE__ */ jsxRuntime.jsx(
2619
+ material.IconButton,
2620
+ {
2621
+ ...props2,
2622
+ size,
2623
+ "aria-label": intlConfig.formatMessage({
2624
+ id: "c4r.form.chooseDate"
2625
+ })
2626
+ }
2627
+ ),
2628
+ ...slots
2629
+ },
2630
+ disableOpenPicker: !showCalendar,
2631
+ readOnly,
2632
+ ampm
2633
+ }
2634
+ )
2635
+ }
2636
+ );
2637
+ }
2638
+ const DEFAULT_ITEMS = [{ outlinedBullet: false, value: "" }];
2639
+ const Content$2 = material.styled("ul")(({ theme }) => ({
2640
+ listStyle: "none",
2641
+ paddingLeft: 0,
2642
+ margin: theme.spacing(0.5, 0, 0, 0)
2643
+ }));
2644
+ const Entry = material.styled("li")(({ theme }) => ({
2645
+ display: "flex",
2646
+ alignItems: "center",
2647
+ justifyContent: "space-between",
2648
+ "&:not(:last-child)": {
2649
+ marginBottom: theme.spacing(0.5)
2650
+ }
2651
+ }));
2652
+ const Bullet = material.styled("span")(({ theme }) => ({
2653
+ width: theme.spacing(1),
2654
+ height: theme.spacing(1),
2655
+ marginRight: theme.spacing(0.5),
2656
+ border: `2px solid ${theme.palette.qualitative.bold[1]}`,
2657
+ borderRadius: "50%",
2658
+ backgroundColor: theme.palette.qualitative.bold[1]
2659
+ }));
2660
+ const Category = material.styled(TablePaginationActions.Typography)(({ theme }) => ({
2661
+ minWidth: theme.spacing(10),
2662
+ marginRight: theme.spacing(1.5)
2663
+ }));
2664
+ function TooltipData({
2665
+ items = DEFAULT_ITEMS,
2666
+ title
2667
+ }) {
2668
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2669
+ title && /* @__PURE__ */ jsxRuntime.jsx(TablePaginationActions.Typography, { color: "inherit", variant: "caption", weight: "medium", children: title }),
2670
+ /* @__PURE__ */ jsxRuntime.jsx(Content$2, { children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(Entry, { children: [
2671
+ /* @__PURE__ */ jsxRuntime.jsx(
2672
+ Bullet,
2673
+ {
2674
+ style: {
2675
+ backgroundColor: `${item.outlinedBullet ? "transparent" : item.color}`,
2676
+ borderColor: item.color
2677
+ }
2678
+ }
2679
+ ),
2680
+ item.category && /* @__PURE__ */ jsxRuntime.jsx(Category, { color: "inherit", variant: "caption", children: item.category }),
2681
+ /* @__PURE__ */ jsxRuntime.jsx(TablePaginationActions.Typography, { color: "inherit", variant: "caption", weight: "medium", children: item.value })
2682
+ ] }, index)) })
2683
+ ] });
2684
+ }
2685
+ const Footer = material.styled(material.Box, {
2686
+ shouldForwardProp: (prop) => !["withGutter", "disabled"].includes(prop)
2687
+ })(
2688
+ ({ withGutter, disabled, theme }) => ({
2689
+ display: "flex",
2690
+ alignItems: "center",
2691
+ justifyContent: "flex-end",
2692
+ gap: theme.spacing(1),
2693
+ ...withGutter && {
2694
+ height: theme.spacing(4),
2695
+ padding: theme.spacing(0, 0.5),
2696
+ borderTop: `1px solid ${theme.palette.divider}`,
2697
+ borderBottom: "1px solid transparent"
2698
+ },
2699
+ ...disabled && {
2700
+ backgroundColor: theme.palette.default.background
2701
+ }
2702
+ })
2703
+ );
2704
+ function CodeAreaFooter({
2705
+ onClickFooter,
2706
+ buttonFooterLabelId,
2707
+ disabledButtonFooter,
2708
+ withGutter = true,
2709
+ showSnackbar,
2710
+ onCloseSnackbar,
2711
+ loading,
2712
+ disabled,
2713
+ ...props
2714
+ }) {
2715
+ const intl = reactIntl.useIntl();
2716
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
2717
+ if (!onClickFooter) return null;
2718
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2719
+ Footer,
2720
+ {
2721
+ withGutter,
2722
+ disabled,
2723
+ "data-name": "code-area-footer",
2724
+ "data-gutter": withGutter,
2725
+ children: [
2726
+ /* @__PURE__ */ jsxRuntime.jsx(
2727
+ Button,
2728
+ {
2729
+ variant: "text",
2730
+ ...props,
2731
+ loading,
2732
+ onClick: onClickFooter,
2733
+ disabled: disabled || disabledButtonFooter,
2734
+ children: intlConfig.formatMessage({
2735
+ id: buttonFooterLabelId || "c4r.button.save"
2736
+ })
2737
+ }
2738
+ ),
2739
+ /* @__PURE__ */ jsxRuntime.jsx(
2740
+ Snackbar,
2741
+ {
2742
+ open: showSnackbar,
2743
+ autoWidth: true,
2744
+ closeable: false,
2745
+ autoHideDuration: 4e3,
2746
+ onClose: onCloseSnackbar,
2747
+ children: intlConfig.formatMessage({
2748
+ id: "c4r.notifications.changesSaved"
2749
+ })
2750
+ }
2751
+ )
2752
+ ]
2753
+ }
2754
+ );
2755
+ }
2756
+ const Header = material.styled(material.Box, { shouldForwardProp: (prop) => prop !== "size" })(({ size, theme }) => ({
2757
+ position: "absolute",
2758
+ top: 0,
2759
+ right: theme.spacing(0.5),
2760
+ zIndex: 1,
2761
+ display: "flex",
2762
+ justifyContent: "flex-end",
2763
+ gap: theme.spacing(1),
2764
+ padding: size === "small" ? theme.spacing(0.5) : theme.spacing(1, 2, 2),
2765
+ paddingRight: size === "small" ? 0 : theme.spacing(1.5)
2766
+ }));
2767
+ function CodeAreaHeader({
2768
+ disabled,
2769
+ copyValue,
2770
+ onClickExpand,
2771
+ size
2772
+ }) {
2773
+ const intl = reactIntl.useIntl();
2774
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
2775
+ const showExpandButton = !!onClickExpand;
2776
+ const showCopyButton = copyValue !== void 0;
2777
+ const showMenu = showExpandButton && showCopyButton;
2778
+ const { copy } = useCopyValue();
2779
+ const [openSnackbar, setOpenSnackbar] = React.useState(false);
2780
+ const [anchorEl, setAnchorEl] = React.useState(null);
2781
+ const open = Boolean(anchorEl);
2782
+ const openDropdown = (event) => {
2783
+ setAnchorEl(event.currentTarget);
2784
+ };
2785
+ const closeDropdown = () => {
2786
+ setAnchorEl(null);
2787
+ };
2788
+ const handleCopy = (e) => {
2789
+ e.preventDefault();
2790
+ if (copyValue) {
2791
+ copy(copyValue).then(() => {
2792
+ setOpenSnackbar(true);
2793
+ }).catch(console.error);
2794
+ }
2795
+ };
2796
+ if (!showExpandButton && !showCopyButton) {
2797
+ return null;
2798
+ }
2799
+ if (showMenu) {
2800
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2801
+ /* @__PURE__ */ jsxRuntime.jsxs(Header, { size, "data-size": size, "data-name": "code-area-header", children: [
2802
+ /* @__PURE__ */ jsxRuntime.jsx(
2803
+ IconButton,
2804
+ {
2805
+ color: "default",
2806
+ size,
2807
+ icon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.MoreVertOutlined, {}),
2808
+ disabled,
2809
+ tooltip: intlConfig.formatMessage({ id: `c4r.button.showOptions` }),
2810
+ tooltipPlacement: "top",
2811
+ "aria-controls": open ? "basic-menu" : void 0,
2812
+ "aria-haspopup": "true",
2813
+ "aria-expanded": open ? "true" : void 0,
2814
+ onClick: openDropdown
2815
+ }
2816
+ ),
2817
+ /* @__PURE__ */ jsxRuntime.jsxs(
2818
+ Menu$1,
2819
+ {
2820
+ anchorEl,
2821
+ open,
2822
+ onClose: closeDropdown,
2823
+ id: "menu",
2824
+ MenuListProps: { "aria-labelledby": "menu-button" },
2825
+ "aria-label": "Code area actions",
2826
+ transformOrigin: { vertical: "top", horizontal: "right" },
2827
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
2828
+ children: [
2829
+ /* @__PURE__ */ jsxRuntime.jsxs(MenuItem.MenuItem, { onClick: handleCopy, disabled, id: "copy", children: [
2830
+ /* @__PURE__ */ jsxRuntime.jsx(material.ListItemIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopyOutlined, {}) }),
2831
+ /* @__PURE__ */ jsxRuntime.jsx(material.ListItemText, { children: intlConfig.formatMessage({ id: `c4r.button.copy` }) })
2832
+ ] }),
2833
+ /* @__PURE__ */ jsxRuntime.jsxs(MenuItem.MenuItem, { onClick: onClickExpand, disabled, id: "expand", children: [
2834
+ /* @__PURE__ */ jsxRuntime.jsx(material.ListItemIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(OpenDiagonallyRight.OpenDiagonallyRight, {}) }),
2835
+ /* @__PURE__ */ jsxRuntime.jsx(material.ListItemText, { children: intlConfig.formatMessage({ id: `c4r.button.expand` }) })
2836
+ ] })
2837
+ ]
2838
+ }
2839
+ )
2840
+ ] }),
2841
+ /* @__PURE__ */ jsxRuntime.jsx(
2842
+ Snackbar,
2843
+ {
2844
+ open: openSnackbar,
2845
+ autoWidth: true,
2846
+ closeable: false,
2847
+ autoHideDuration: 4e3,
2848
+ onClose: () => setOpenSnackbar(false),
2849
+ children: intlConfig.formatMessage({
2850
+ id: "c4r.notifications.copiedToClipboard"
2851
+ })
2852
+ }
2853
+ )
2854
+ ] });
2855
+ }
2856
+ return /* @__PURE__ */ jsxRuntime.jsxs(Header, { size, "data-size": size, "data-name": "code-area-header", children: [
2857
+ showCopyButton && /* @__PURE__ */ jsxRuntime.jsx(
2858
+ CopiableComponent,
2859
+ {
2860
+ disabled,
2861
+ value: copyValue,
2862
+ button: true,
2863
+ buttonProps: { size }
2864
+ }
2865
+ ),
2866
+ showExpandButton && /* @__PURE__ */ jsxRuntime.jsx(
2867
+ IconButton,
2868
+ {
2869
+ color: "default",
2870
+ size,
2871
+ onClick: onClickExpand,
2872
+ icon: /* @__PURE__ */ jsxRuntime.jsx(OpenDiagonallyRight.OpenDiagonallyRight, {}),
2873
+ disabled,
2874
+ tooltip: intlConfig.formatMessage({ id: `c4r.button.expand` }),
2875
+ tooltipPlacement: "top"
2876
+ }
2877
+ )
2878
+ ] });
2879
+ }
2880
+ const CodeAreaTheme = material.styled(material.Box, {
2881
+ shouldForwardProp: (prop) => !["size", "height"].includes(prop)
2882
+ })(({ size, height, theme }) => ({
2883
+ position: "relative",
2884
+ flex: 1,
2885
+ display: "flex",
2886
+ cursor: "text",
2887
+ ":focus-within &, .error &": {
2888
+ marginBottom: 0
2889
+ },
2890
+ "& .react-codemirror2": {
2891
+ width: "100%",
2892
+ height: "100% !important",
2893
+ position: "relative"
2894
+ },
2895
+ "& .CodeMirror": {
2896
+ position: "absolute",
2897
+ top: 0,
2898
+ bottom: 0,
2899
+ left: 0,
2900
+ right: 0,
2901
+ zIndex: 1,
2902
+ height: "100% !important",
2903
+ backgroundColor: theme.palette.background.default
2904
+ },
2905
+ "& .CodeMirror-code": {
2906
+ "&> div:first-of-type .CodeMirror-line": {
2907
+ marginTop: theme.spacing(-0.25)
2908
+ }
2909
+ },
2910
+ "& .CodeMirror-scroll": {
2911
+ paddingLeft: theme.spacing(1),
2912
+ paddingRight: theme.spacing(1),
2913
+ backgroundColor: "transparent"
2914
+ },
2915
+ "& .CodeMirror-lines": {
2916
+ padding: theme.spacing(1, 0)
2917
+ },
2918
+ "& .CodeMirror pre.CodeMirror-line, & .CodeMirror pre.CodeMirror-line-like": {
2919
+ boxSizing: "border-box",
2920
+ paddingLeft: 0,
2921
+ paddingTop: theme.spacing(0.25),
2922
+ lineHeight: 1.2
2923
+ },
2924
+ "& .CodeMirror-linenumbers": {
2925
+ width: `${theme.spacing(4.5)} !important`
2926
+ },
2927
+ "& .CodeMirror-linenumber": {
2928
+ width: `${theme.spacing(4.5)} !important`,
2929
+ height: theme.spacing(2),
2930
+ marginBottom: `${theme.spacing(-0.25)} !important`,
2931
+ paddingTop: theme.spacing(0.25),
2932
+ paddingRight: theme.spacing(1.25),
2933
+ boxSizing: "border-box !important",
2934
+ color: theme.palette.text.secondary
2935
+ },
2936
+ // Active line addon
2937
+ "& .CodeMirror-activeline-background, & .CodeMirror-activeline-gutter": {
2938
+ backgroundColor: "transparent"
2939
+ },
2940
+ "& .CodeMirror-gutter-background": {
2941
+ width: `${theme.spacing(6.25)} !important`
2942
+ // Hack needed to simulate active line background
2943
+ },
2944
+ "& .CodeMirror-sizer": {
2945
+ paddingTop: theme.spacing(0.25),
2946
+ marginLeft: `${theme.spacing(5.25)} !important`,
2947
+ borderRightWidth: `${theme.spacing(4)} !important`
2948
+ // Hack needed to simulate active line background
2949
+ },
2950
+ "& .CodeMirror-matchingbracket": {
2951
+ color: `${colors.lime[900]} !important`,
2952
+ backgroundColor: theme.palette.black[4],
2953
+ boxShadow: `0 0 0 1px ${theme.palette.text.hint}`
2954
+ },
2955
+ // Selected line
2956
+ "& .CodeMirror-selected, & .CodeMirror-focused .CodeMirror-selected, & .CodeMirror-line::selection, & .CodeMirror-line > span::selection, & .CodeMirror-line > span > span::selection": {
2957
+ background: `${material.alpha(colors.blue[800], 0.2)} !important`
2958
+ },
2959
+ "& .CodeMirror-gutters": {
2960
+ borderRight: 0,
2961
+ color: theme.palette.text.secondary,
2962
+ backgroundColor: theme.palette.default.background
2963
+ },
2964
+ "& .CodeMirror-gutter-elt": {
2965
+ "& .CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded": {
2966
+ marginLeft: theme.spacing(-1),
2967
+ "&:after": {
2968
+ fontSize: theme.typography.caption.fontSize
2969
+ }
2970
+ }
2971
+ },
2972
+ "& .CodeMirror-placeholder": {
2973
+ paddingTop: "0 !important",
2974
+ marginLeft: `${theme.spacing(-0.5)} !important`,
2975
+ marginBottom: `${theme.spacing(-0.25)} !important`,
2976
+ color: `${theme.palette.text.hint} !important`
2977
+ },
2978
+ "& .MuiLinearProgress-root": {
2979
+ height: "2px",
2980
+ position: "absolute",
2981
+ top: 0,
2982
+ left: 0,
2983
+ right: 0,
2984
+ zIndex: 1
2985
+ },
2986
+ "& .pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like, & .cm-bracket": {
2987
+ color: theme.palette.text.primary
2988
+ },
2989
+ "& .CodeMirror pre.CodeMirror-placeholder": {
2990
+ color: theme.palette.text.hint
2991
+ },
2992
+ "& .CodeMirror-composing": {
2993
+ border: 0
2994
+ },
2995
+ // Theme: light
2996
+ "& .cm-keyword, & .cm-string, & .cm-string-2, & .cm-other": {
2997
+ color: colors.purple[500]
2998
+ },
2999
+ "& .cm-operator, & .cm-tag, & .cm-attribute": {
3000
+ color: colors.teal[700]
3001
+ },
3002
+ "& .cm-number, & .cm-property, & .cm-builtin": {
3003
+ color: colors.red[700]
3004
+ },
3005
+ "& .cm-comment": {
3006
+ color: theme.palette.text.secondary
3007
+ },
3008
+ "& .cm-variable": {
3009
+ color: colors.lime[900]
3010
+ },
3011
+ "& .cm-variable-2": {
3012
+ color: theme.palette.text.primary
3013
+ },
3014
+ "& .cm-punctuation, & .cm-def, ": {
3015
+ color: colors.blue[800]
3016
+ },
3017
+ "& .cm-variable-3, & .cm-type": {
3018
+ color: colors.indigo[800]
3019
+ },
3020
+ "& .CodeMirror-foldmarker": {
3021
+ textShadow: "none",
3022
+ color: theme.palette.primary.main
3023
+ },
3024
+ "& .cm-error": {
3025
+ color: theme.palette.error.main
3026
+ },
3027
+ "& .CodeMirror-selected": {
3028
+ background: colors.blue[800]
3029
+ },
3030
+ "& .cm-header-1": {
3031
+ fontSize: theme.typography.h2.fontSize
3032
+ },
3033
+ "& .cm-header-2": {
3034
+ fontSize: theme.typography.h3.fontSize
3035
+ },
3036
+ "& .cm-header-3": {
3037
+ fontSize: theme.typography.h4.fontSize
3038
+ },
3039
+ "& .cm-header-4": {
3040
+ fontSize: theme.typography.h5.fontSize
3041
+ },
3042
+ "& .cm-header-5": {
3043
+ fontSize: theme.typography.h6.fontSize
3044
+ },
3045
+ ...size === "small" && {
3046
+ "& .CodeMirror": {
3047
+ height: height ? height : "auto",
3048
+ minHeight: theme.spacing(9),
3049
+ ...theme.typography.code3
3050
+ }
3051
+ }
3052
+ }));
3053
+ function findCodeAreaControlCodeOccurrences(content) {
3054
+ const lines = content.split("\n");
3055
+ const matches = [];
3056
+ const beginStack = [];
3057
+ lines.forEach((line, index) => {
3058
+ const lineNumber = index + 1;
3059
+ if (line.trim() === "-- BEGIN CONTROL CODE") {
3060
+ beginStack.push(lineNumber);
3061
+ } else if (line.trim() === "-- END CONTROL CODE" && beginStack.length > 0) {
3062
+ const startLine = beginStack.pop();
3063
+ matches.push({
3064
+ from: startLine,
3065
+ to: lineNumber
3066
+ });
3067
+ }
3068
+ });
3069
+ while (beginStack.length > 0) {
3070
+ const startLine = beginStack.pop();
3071
+ matches.push({
3072
+ from: startLine,
3073
+ to: lines.length
3074
+ // Set end to last line for unmatched BEGIN
3075
+ });
3076
+ }
3077
+ return matches;
3078
+ }
3079
+ function foldCode(editor, { from, to }) {
3080
+ editor.foldCode(
3081
+ 0,
3082
+ {
3083
+ rangeFinder: () => {
3084
+ if (!to) return;
3085
+ return {
3086
+ from: { line: from - 1, ch: 0 },
3087
+ to: { line: to - 1, ch: 0 }
3088
+ };
3089
+ }
3090
+ },
3091
+ "fold"
3092
+ );
3093
+ }
3094
+ function CodeAreaInput({
3095
+ options,
3096
+ value,
3097
+ defaultValue,
3098
+ id,
3099
+ onEditorDidMount,
3100
+ onChange,
3101
+ onBlur,
3102
+ onFocus,
3103
+ placeholder,
3104
+ disabled,
3105
+ size = "small",
3106
+ height,
3107
+ autoFoldControlBlocks,
3108
+ "data-testid": dataTestId,
3109
+ "aria-label": ariaLabel,
3110
+ ...props
3111
+ }) {
3112
+ var _a;
3113
+ const editorRef = React.useRef();
3114
+ const [editor, setEditor] = React.useState(null);
3115
+ const initialFoldingDoneRef = React.useRef(false);
3116
+ const codeMirrorOptions = {
3117
+ mode: "sql",
3118
+ theme: "light",
3119
+ lineNumbers: true,
3120
+ lineWrapping: true,
3121
+ extraKeys: { "Ctrl-Space": "autocomplete" },
3122
+ placeholder,
3123
+ disabled,
3124
+ gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
3125
+ styleActiveLine: { nonEmpty: true },
3126
+ styleActiveSelected: true,
3127
+ matchBrackets: true,
3128
+ foldOptions: {
3129
+ minFoldSize: 1,
3130
+ scanUp: false
3131
+ },
3132
+ ...options
3133
+ };
3134
+ React.useEffect(() => {
3135
+ return () => {
3136
+ setEditor(null);
3137
+ };
3138
+ }, []);
3139
+ React.useEffect(() => {
3140
+ if (!value || !editor || !autoFoldControlBlocks || initialFoldingDoneRef.current)
3141
+ return;
3142
+ const numberOfBlocks = findCodeAreaControlCodeOccurrences(value);
3143
+ if (!numberOfBlocks.length) return;
3144
+ for (const line of numberOfBlocks) {
3145
+ foldCode(editor, line);
3146
+ }
3147
+ initialFoldingDoneRef.current = true;
3148
+ }, [value, editor, autoFoldControlBlocks]);
3149
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3150
+ CodeAreaTheme,
3151
+ {
3152
+ size,
3153
+ height,
3154
+ id,
3155
+ "data-size": size,
3156
+ "data-height": height,
3157
+ "data-mode": typeof (options == null ? void 0 : options.mode) === "object" && ((_a = options.mode) == null ? void 0 : _a.name) ? options.mode.name : options == null ? void 0 : options.mode,
3158
+ "data-fold-gutter": options == null ? void 0 : options.foldGutter,
3159
+ "data-testid": dataTestId,
3160
+ "aria-label": ariaLabel ?? "Code editor text area",
3161
+ "data-name": "code-area-input",
3162
+ children: [
3163
+ value !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
3164
+ reactCodemirror2.Controlled,
3165
+ {
3166
+ ...props,
3167
+ value,
3168
+ editorDidMount: (editor2) => {
3169
+ editorRef.current = editor2;
3170
+ setEditor(editor2);
3171
+ onEditorDidMount == null ? void 0 : onEditorDidMount(editor2);
3172
+ },
3173
+ options: codeMirrorOptions,
3174
+ onBeforeChange: (editor2, data, value2) => {
3175
+ onChange == null ? void 0 : onChange(value2);
3176
+ },
3177
+ onBlur: (editor2) => {
3178
+ onBlur == null ? void 0 : onBlur(editor2.getValue());
3179
+ },
3180
+ onFocus
3181
+ }
3182
+ ),
3183
+ defaultValue !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
3184
+ reactCodemirror2.UnControlled,
3185
+ {
3186
+ ...props,
3187
+ value: defaultValue,
3188
+ options: codeMirrorOptions,
3189
+ onBlur: (editor2) => {
3190
+ onBlur == null ? void 0 : onBlur(editor2.getValue());
3191
+ },
3192
+ onFocus
3193
+ }
3194
+ )
3195
+ ]
3196
+ }
3197
+ );
3198
+ }
3199
+ const Root$2 = material.styled(material.FormControl)(() => ({
3200
+ display: "flex",
3201
+ flexDirection: "column",
3202
+ flex: 1
3203
+ }));
3204
+ const CodeMirrorWrapper = material.styled(material.Box, {
3205
+ shouldForwardProp: (prop) => ![
3206
+ "variant",
3207
+ "error",
3208
+ "disabled",
3209
+ "readOnly",
3210
+ "lineNumbers",
3211
+ "fullScreen"
3212
+ ].includes(prop)
3213
+ })(
3214
+ ({ variant, error, disabled, readOnly, lineNumbers, fullScreen, theme }) => ({
3215
+ position: "relative",
3216
+ overflow: "auto",
3217
+ display: "flex",
3218
+ flexDirection: "column",
3219
+ flex: 1,
3220
+ width: "100%",
3221
+ minHeight: 0,
3222
+ background: theme.palette.background.paper,
3223
+ // Active line addon
3224
+ ".CodeMirror-focused .CodeMirror-activeline": {
3225
+ "& .CodeMirror-activeline-background, & .CodeMirror-activeline-gutter": {
3226
+ background: theme.palette.primary.background
3227
+ }
3228
+ },
3229
+ ...fullScreen && {
3230
+ maxWidth: "100%",
3231
+ maxHeight: "100vh",
3232
+ height: "100vh"
3233
+ },
3234
+ ...(variant === "filled" || variant === "outlined") && {
3235
+ borderRadius: theme.spacing(0.5),
3236
+ transition: theme.transitions.create("background-color", {
3237
+ easing: theme.transitions.easing.easeInOut,
3238
+ duration: theme.transitions.duration.shortest
3239
+ }),
3240
+ "&:after": {
3241
+ content: '""',
3242
+ position: "absolute",
3243
+ top: 0,
3244
+ left: 0,
3245
+ right: 0,
3246
+ bottom: 0,
3247
+ pointerEvents: "none",
3248
+ border: `1px solid ${theme.palette.default.outlinedBorder}`,
3249
+ borderRadius: theme.spacing(0.5),
3250
+ transition: theme.transitions.create("border-color", {
3251
+ easing: theme.transitions.easing.easeInOut,
3252
+ duration: theme.transitions.duration.shortest
3253
+ })
3254
+ },
3255
+ "&:hover:after": {
3256
+ borderColor: theme.palette.common.black
3257
+ },
3258
+ "&:focus-within": {
3259
+ overflow: "hidden",
3260
+ "&:after": {
3261
+ borderWidth: "2px",
3262
+ borderColor: theme.palette.primary.main
3263
+ }
3264
+ },
3265
+ ...error && {
3266
+ "&.MuiBox-root:after": {
3267
+ borderWidth: "2px",
3268
+ borderColor: theme.palette.error.main
3269
+ }
3270
+ }
3271
+ },
3272
+ ...variant === "filled" && {
3273
+ backgroundColor: theme.palette.background.paper,
3274
+ "&.codeArea-filled:after": {
3275
+ borderColor: "transparent"
3276
+ },
3277
+ "&.codeArea-filled:hover:after": {
3278
+ borderColor: theme.palette.common.black
3279
+ },
3280
+ "&.codeArea-filled:focus-within:after": {
3281
+ borderWidth: "2px",
3282
+ borderColor: theme.palette.primary.main
3283
+ },
3284
+ "& .CodeMirror": {
3285
+ backgroundColor: theme.palette.default.background,
3286
+ "&:focus-within": {
3287
+ backgroundColor: theme.palette.background.paper
3288
+ }
3289
+ },
3290
+ ...error && {
3291
+ borderColor: theme.palette.error.main,
3292
+ "& .CodeMirror": {
3293
+ backgroundColor: theme.palette.default.background
3294
+ },
3295
+ "&:hover, &:focus-within, &.codeArea-filled:after, &.codeArea-filled:hover:after, &.codeArea-filled:focus-within:after": {
3296
+ borderColor: theme.palette.error.main
3297
+ },
3298
+ "&:focus-within": {
3299
+ "& .CodeMirror": {
3300
+ backgroundColor: theme.palette.background.paper
3301
+ }
3302
+ }
3303
+ }
3304
+ },
3305
+ ...readOnly && {
3306
+ "& .CodeMirror": {
3307
+ backgroundColor: theme.palette.default.background,
3308
+ ".CodeMirror-cursors": {
3309
+ visibility: "hidden !important"
3310
+ }
3311
+ },
3312
+ ...variant === "filled" && {
3313
+ backgroundColor: theme.palette.background.paper
3314
+ }
3315
+ },
3316
+ ...disabled && {
3317
+ pointerEvents: "none",
3318
+ "& .CodeMirror": {
3319
+ color: theme.palette.text.disabled,
3320
+ backgroundColor: theme.palette.default.background,
3321
+ "& span, .CodeMirror-linenumber, .CodeMirror-guttermarker-subtle": {
3322
+ color: theme.palette.text.disabled
3323
+ }
3324
+ },
3325
+ ...variant === "filled" && {
3326
+ backgroundColor: theme.palette.background.paper
3327
+ }
3328
+ },
3329
+ ...!lineNumbers && {
3330
+ "& .CodeMirror-scroll .CodeMirror-sizer": {
3331
+ marginLeft: `${theme.spacing(1)} !important`
3332
+ },
3333
+ "& .CodeMirror-gutter-background": {
3334
+ width: `${theme.spacing(2)} !important`
3335
+ }
3336
+ }
3337
+ })
3338
+ );
3339
+ const InputWrapper = material.styled(material.Box, {
3340
+ shouldForwardProp: (prop) => prop !== "hasActions"
3341
+ })(({ theme, hasActions }) => ({
3342
+ flex: "1 1 auto",
3343
+ overflowY: "auto",
3344
+ display: "flex",
3345
+ flexDirection: "column",
3346
+ ...hasActions && {
3347
+ ".CodeMirror-line": {
3348
+ paddingRight: `${theme.spacing(4)} !important`
3349
+ }
3350
+ }
3351
+ }));
3352
+ const HelpIcon = material.styled(iconsMaterial.HelpOutline)(({ theme }) => ({
3353
+ width: TablePaginationActions.ICON_SIZE_SMALL,
3354
+ height: TablePaginationActions.ICON_SIZE_SMALL,
3355
+ fill: theme.palette.text.secondary
3356
+ }));
3357
+ function CodeAreaField({
3358
+ value,
3359
+ defaultValue,
3360
+ validate,
3361
+ onChange,
3362
+ onBlur,
3363
+ onFocus,
3364
+ label,
3365
+ labelHelpTooltip,
3366
+ placeholder,
3367
+ type,
3368
+ disabled,
3369
+ copyValue,
3370
+ helperText,
3371
+ error,
3372
+ size = "small",
3373
+ variant = "outlined",
3374
+ onClickExpand,
3375
+ onClickFooter,
3376
+ disabledButtonFooter,
3377
+ buttonFooterLabelId,
3378
+ options,
3379
+ id = "code-area-field",
3380
+ saveLoading,
3381
+ showSaveSnackbar,
3382
+ onCloseSaveSnackbar,
3383
+ fullScreen,
3384
+ isExpanded,
3385
+ ...props
3386
+ }) {
3387
+ const [focused, setFocused] = React.useState(false);
3388
+ const readOnly = (options == null ? void 0 : options.readOnly) ?? false;
3389
+ const lineNumbers = (options == null ? void 0 : options.lineNumbers) ?? true;
3390
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3391
+ Root$2,
3392
+ {
3393
+ size,
3394
+ error,
3395
+ disabled,
3396
+ "aria-disabled": disabled,
3397
+ "data-size": size,
3398
+ "data-full-screen": fullScreen,
3399
+ "data-variant": variant,
3400
+ "data-name": "code-area-field",
3401
+ children: [
3402
+ label && /* @__PURE__ */ jsxRuntime.jsx(
3403
+ material.InputLabel,
3404
+ {
3405
+ htmlFor: id,
3406
+ disabled,
3407
+ error,
3408
+ focused,
3409
+ shrink: true,
3410
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3411
+ LabelWithIndicator,
3412
+ {
3413
+ label,
3414
+ type,
3415
+ icon: labelHelpTooltip ? /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: labelHelpTooltip, children: /* @__PURE__ */ jsxRuntime.jsx(
3416
+ HelpIcon,
3417
+ {
3418
+ "aria-label": typeof labelHelpTooltip === "string" ? labelHelpTooltip : void 0
3419
+ }
3420
+ ) }) : void 0
3421
+ }
3422
+ )
3423
+ }
3424
+ ),
3425
+ /* @__PURE__ */ jsxRuntime.jsxs(
3426
+ CodeMirrorWrapper,
3427
+ {
3428
+ variant,
3429
+ error: !!error,
3430
+ disabled,
3431
+ readOnly,
3432
+ lineNumbers,
3433
+ className: variant === "filled" ? "codeArea-filled" : "",
3434
+ fullScreen,
3435
+ children: [
3436
+ /* @__PURE__ */ jsxRuntime.jsx(
3437
+ CodeAreaHeader,
3438
+ {
3439
+ onClickExpand,
3440
+ copyValue,
3441
+ disabled,
3442
+ size: isExpanded ? "medium" : "small"
3443
+ }
3444
+ ),
3445
+ /* @__PURE__ */ jsxRuntime.jsx(InputWrapper, { hasActions: !!copyValue || !!onClickExpand, children: /* @__PURE__ */ jsxRuntime.jsx(
3446
+ CodeAreaInput,
3447
+ {
3448
+ ...props,
3449
+ id,
3450
+ disabled,
3451
+ value,
3452
+ defaultValue,
3453
+ placeholder,
3454
+ onFocus: () => {
3455
+ setFocused(true);
3456
+ onFocus == null ? void 0 : onFocus();
3457
+ },
3458
+ onBlur: (value2) => {
3459
+ if (onBlur) onBlur(value2);
3460
+ if (onChange) onChange(value2);
3461
+ if (validate) validate(value2);
3462
+ setFocused(false);
3463
+ },
3464
+ onChange,
3465
+ size,
3466
+ options: {
3467
+ ...readOnly && {
3468
+ styleActiveLine: false,
3469
+ matchBrackets: false
3470
+ },
3471
+ ...options
3472
+ }
3473
+ }
3474
+ ) }),
3475
+ /* @__PURE__ */ jsxRuntime.jsx(
3476
+ CodeAreaFooter,
3477
+ {
3478
+ buttonFooterLabelId,
3479
+ onClickFooter,
3480
+ disabled,
3481
+ disabledButtonFooter,
3482
+ size: "small",
3483
+ loading: !!saveLoading,
3484
+ showSnackbar: showSaveSnackbar,
3485
+ onCloseSnackbar: onCloseSaveSnackbar
3486
+ }
3487
+ )
3488
+ ]
3489
+ }
3490
+ ),
3491
+ helperText && /* @__PURE__ */ jsxRuntime.jsx(material.FormHelperText, { children: helperText })
3492
+ ]
3493
+ }
3494
+ );
3495
+ }
3496
+ const ErrorWrapper = material.styled(material.Box)(({ theme }) => ({
3497
+ position: "relative",
3498
+ marginBottom: "1px",
3499
+ padding: theme.spacing(1.5, 2, 1.5, 5.5),
3500
+ "&:before": {
3501
+ content: '""',
3502
+ position: "absolute",
3503
+ top: 0,
3504
+ left: 0,
3505
+ bottom: 0,
3506
+ zIndex: 1,
3507
+ width: theme.spacing(5),
3508
+ background: theme.palette.background.default
3509
+ },
3510
+ "&:after": {
3511
+ content: '""',
3512
+ position: "absolute",
3513
+ top: 0,
3514
+ right: 0,
3515
+ left: 0,
3516
+ bottom: 0,
3517
+ zIndex: 2,
3518
+ background: `linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 40%)`
3519
+ },
3520
+ ".MuiFormHelperText-root": {
3521
+ marginTop: 0
3522
+ }
3523
+ }));
3524
+ const ErrorContent = material.styled(material.Box)(({ theme }) => ({
3525
+ position: "relative",
3526
+ zIndex: 3,
3527
+ display: "flex",
3528
+ alignItems: "center",
3529
+ gap: theme.spacing(1)
3530
+ }));
3531
+ function CodeAreaDialogError({
3532
+ children,
3533
+ hasDivider
3534
+ }) {
3535
+ const theme = material.useTheme();
3536
+ if (!children) return null;
3537
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3538
+ /* @__PURE__ */ jsxRuntime.jsx(ErrorWrapper, { children: /* @__PURE__ */ jsxRuntime.jsxs(ErrorContent, { children: [
3539
+ /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ErrorOutline, { htmlColor: theme.palette.error.main }),
3540
+ /* @__PURE__ */ jsxRuntime.jsx(material.FormHelperText, { error: true, children })
3541
+ ] }) }),
3542
+ hasDivider && /* @__PURE__ */ jsxRuntime.jsx(material.Divider, {})
3543
+ ] });
3544
+ }
3545
+ const sizesHeight = {
3546
+ [
3547
+ "small"
3548
+ /* Small */
3549
+ ]: "480px",
3550
+ [
3551
+ "medium"
3552
+ /* Medium */
3553
+ ]: "640px",
3554
+ [
3555
+ "large"
3556
+ /* Large */
3557
+ ]: "640px",
3558
+ [
3559
+ "xlarge"
3560
+ /* XLarge */
3561
+ ]: "720px"
3562
+ };
3563
+ const dialogDimensionsBySize = {
3564
+ [
3565
+ "small"
3566
+ /* Small */
3567
+ ]: {
3568
+ width: "432px",
3569
+ maxWidth: "432px"
3570
+ },
3571
+ [
3572
+ "medium"
3573
+ /* Medium */
3574
+ ]: {
3575
+ width: "592px",
3576
+ maxWidth: "592px"
3577
+ },
3578
+ [
3579
+ "large"
3580
+ /* Large */
3581
+ ]: {
3582
+ width: "768px",
3583
+ maxWidth: "768px",
3584
+ minHeight: "576px"
3585
+ },
3586
+ [
3587
+ "xlarge"
3588
+ /* XLarge */
3589
+ ]: {
3590
+ width: "calc(100vw - 80px)",
3591
+ height: "calc(100vh - 80px)",
3592
+ maxWidth: "960px"
3593
+ }
3594
+ };
3595
+ const DialogPaper = material.styled(material.Paper, {
3596
+ shouldForwardProp: (prop) => !["fullScreen", "height", "width", "hasForm"].includes(prop)
3597
+ })(
3598
+ ({
3599
+ fullScreen,
3600
+ height,
3601
+ width,
3602
+ hasForm,
3603
+ size = "small",
3604
+ theme
3605
+ }) => ({
3606
+ "&.MuiPaper-root": {
3607
+ position: "relative",
3608
+ display: "flex",
3609
+ flexDirection: "column",
3610
+ margin: theme.spacing(5),
3611
+ borderRadius: theme.spacing(1),
3612
+ ...dialogDimensionsBySize[size],
3613
+ maxHeight: sizesHeight[size],
3614
+ [`@media (max-height:${sizesHeight[size]})`]: {
3615
+ maxHeight: "calc(100vh - 80px)",
3616
+ ...size === "large" && {
3617
+ minHeight: height !== "auto" ? "calc(100vh - 80px)" : "auto"
3618
+ }
3619
+ },
3620
+ ...fullScreen && {
3621
+ width: "100vw",
3622
+ maxWidth: `calc(100vw - ${theme.spacing(10)})`,
3623
+ height: "100vh",
3624
+ maxHeight: `calc(100vh - ${theme.spacing(10)})`,
3625
+ margin: theme.spacing(5),
3626
+ borderRadius: theme.spacing(1)
3627
+ },
3628
+ ...height && {
3629
+ height,
3630
+ minHeight: height
3631
+ },
3632
+ ...width && {
3633
+ width
3634
+ },
3635
+ [theme.breakpoints.down("sm")]: {
3636
+ position: "absolute",
3637
+ width: "100%",
3638
+ maxWidth: "100%",
3639
+ height: "100vh",
3640
+ maxHeight: "100vh",
3641
+ top: 0,
3642
+ bottom: 0,
3643
+ left: 0,
3644
+ right: 0,
3645
+ margin: 0,
3646
+ borderRadius: 0,
3647
+ ...height && {
3648
+ top: "auto",
3649
+ borderRadius: theme.spacing(1, 1, 0, 0),
3650
+ height,
3651
+ minHeight: height
3652
+ }
3653
+ },
3654
+ // Special case for Dialogs wrapped in Form
3655
+ ...hasForm && {
3656
+ maxHeight: `calc(100vh - ${theme.spacing(10)})`,
3657
+ form: {
3658
+ flex: 1,
3659
+ display: "flex",
3660
+ flexDirection: "column",
3661
+ justifyContent: "space-between",
3662
+ overflow: "hidden",
3663
+ ...dialogDimensionsBySize[size],
3664
+ maxWidth: "100%",
3665
+ ...fullScreen && {
3666
+ width: "100%",
3667
+ maxWidth: "100%",
3668
+ height: "100%",
3669
+ maxHeight: "100%"
3670
+ },
3671
+ ...height && {
3672
+ height,
3673
+ minHeight: height
3674
+ },
3675
+ ...width && {
3676
+ width
3677
+ },
3678
+ [theme.breakpoints.down("sm")]: {
3679
+ width: "100%",
3680
+ maxWidth: "100%",
3681
+ height: "100vh",
3682
+ maxHeight: "100vh",
3683
+ ...height && {
3684
+ top: "auto",
3685
+ borderRadius: theme.spacing(1, 1, 0, 0),
3686
+ height,
3687
+ minHeight: height
3688
+ }
3689
+ }
3690
+ }
3691
+ }
3692
+ }
3693
+ })
3694
+ );
3695
+ function _Dialog({
3696
+ nonModal,
3697
+ children,
3698
+ size = "small",
3699
+ PaperProps,
3700
+ fullScreen,
3701
+ height,
3702
+ width,
3703
+ hasForm,
3704
+ "aria-label": ariaLabel,
3705
+ "data-testid": dataTestId,
3706
+ ...props
3707
+ }, ref) {
3708
+ if (nonModal) {
3709
+ return /* @__PURE__ */ jsxRuntime.jsx(
3710
+ DialogPaper,
3711
+ {
3712
+ size,
3713
+ fullScreen,
3714
+ height,
3715
+ width,
3716
+ hasForm,
3717
+ "aria-label": ariaLabel,
3718
+ "data-testid": dataTestId,
3719
+ "data-name": "dialog",
3720
+ ...props,
3721
+ ref,
3722
+ children
3723
+ }
3724
+ );
3725
+ }
3726
+ return /* @__PURE__ */ jsxRuntime.jsx(
3727
+ material.Dialog,
3728
+ {
3729
+ PaperComponent: DialogPaper,
3730
+ PaperProps: {
3731
+ ...PaperProps,
3732
+ size,
3733
+ fullScreen,
3734
+ height,
3735
+ width,
3736
+ hasForm
3737
+ },
3738
+ fullScreen,
3739
+ role: "section",
3740
+ "aria-label": ariaLabel,
3741
+ "data-testid": dataTestId,
3742
+ "data-size": size,
3743
+ "data-width": width,
3744
+ "data-height": height,
3745
+ "data-name": "dialog",
3746
+ ...props,
3747
+ ref,
3748
+ children
3749
+ }
3750
+ );
3751
+ }
3752
+ const Dialog = React.forwardRef(_Dialog);
3753
+ const DialogTitle = material.styled(material.DialogTitle)(() => ({
3754
+ padding: 0,
3755
+ zIndex: 10
3756
+ }));
3757
+ const Main$1 = material.styled(material.Box)(({ theme }) => ({
3758
+ display: "flex",
3759
+ alignItems: "center",
3760
+ justifyContent: "space-between",
3761
+ padding: theme.spacing(2),
3762
+ minHeight: theme.spacing(8)
3763
+ }));
3764
+ const ItemsWrapper$1 = material.styled(material.Box)(({ theme }) => ({
3765
+ display: "flex",
3766
+ alignItems: "center",
3767
+ gap: theme.spacing(1),
3768
+ overflow: "hidden"
3769
+ }));
3770
+ const CloseIcon = material.styled(iconsMaterial.CloseOutlined)(({ theme }) => ({
3771
+ color: theme.palette.text.secondary
3772
+ }));
3773
+ const DividerBottom = material.styled(material.Divider)(() => ({
3774
+ "+ .MuiDialogContent-root": {
3775
+ borderTop: "none !important"
3776
+ }
3777
+ }));
3778
+ function DialogHeader({
3779
+ title,
3780
+ chipLabel,
3781
+ chipProps,
3782
+ children,
3783
+ onClose,
3784
+ secondaryActions,
3785
+ "aria-label": ariaLabel,
3786
+ closeIcon,
3787
+ ...otherProps
3788
+ }) {
3789
+ const intl = reactIntl.useIntl();
3790
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
3791
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3792
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { component: "div", "data-name": "dialog-header", ...otherProps, children: [
3793
+ /* @__PURE__ */ jsxRuntime.jsxs(Main$1, { children: [
3794
+ /* @__PURE__ */ jsxRuntime.jsxs(ItemsWrapper$1, { flex: 1, maxWidth: 0.8, children: [
3795
+ /* @__PURE__ */ jsxRuntime.jsx(
3796
+ TablePaginationActions.Typography,
3797
+ {
3798
+ component: "h2",
3799
+ variant: "inherit",
3800
+ noWrap: true,
3801
+ "aria-label": ariaLabel,
3802
+ role: "heading",
3803
+ children: title
3804
+ }
3805
+ ),
3806
+ chipLabel && /* @__PURE__ */ jsxRuntime.jsx(material.Chip, { color: "default", label: chipLabel, ...chipProps })
3807
+ ] }),
3808
+ /* @__PURE__ */ jsxRuntime.jsxs(ItemsWrapper$1, { children: [
3809
+ secondaryActions,
3810
+ onClose && /* @__PURE__ */ jsxRuntime.jsx(
3811
+ material.Tooltip,
3812
+ {
3813
+ title: intlConfig.formatMessage({ id: "c4r.button.close" }),
3814
+ placement: "left",
3815
+ children: /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { onClick: onClose, children: closeIcon || /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, { "data-testid": "CloseIcon" }) })
3816
+ }
3817
+ )
3818
+ ] })
3819
+ ] }),
3820
+ children
3821
+ ] }),
3822
+ children && /* @__PURE__ */ jsxRuntime.jsx(DividerBottom, {})
3823
+ ] });
3824
+ }
3825
+ const Content$1 = material.styled(material.DialogContent, {
3826
+ shouldForwardProp: (prop) => !["scrollableContent", "withGutter", "withBottomGutter"].includes(prop)
3827
+ })(({ theme, scrollableContent, withGutter, withBottomGutter }) => ({
3828
+ display: "flex",
3829
+ flexDirection: "column",
3830
+ gap: theme.spacing(3),
3831
+ padding: 0,
3832
+ ...theme.typography.body2,
3833
+ color: theme.palette.text.secondary,
3834
+ ".MuiAlert-root": {
3835
+ minHeight: "auto"
3836
+ },
3837
+ ...scrollableContent && {
3838
+ borderBottom: `1px solid ${theme.palette.divider}`,
3839
+ "+ .MuiDivider-root": {
3840
+ display: "none"
3841
+ }
3842
+ },
3843
+ ...withGutter && {
3844
+ padding: ` ${theme.spacing(1, 2, 0)} !important`,
3845
+ ".MuiDialog-paperFullScreen &": {
3846
+ padding: `${theme.spacing(2, 2, 0)} !important`
3847
+ }
3848
+ },
3849
+ ...withBottomGutter && {
3850
+ paddingBottom: `${theme.spacing(3)} !important`,
3851
+ ".MuiDialog-paperFullScreen &": {
3852
+ paddingBottom: `${theme.spacing(3)} !important`
3853
+ }
3854
+ }
3855
+ }));
3856
+ function _DialogContent({
3857
+ children,
3858
+ scrollableContent,
3859
+ hasFooterAlert,
3860
+ withGutter = true,
3861
+ withBottomGutter = true,
3862
+ onScroll,
3863
+ ...props
3864
+ }, ref) {
3865
+ const theme = material.useTheme();
3866
+ const [contentRef, setContentRef] = React.useState(null);
3867
+ React.useImperativeHandle(
3868
+ ref,
3869
+ () => contentRef,
3870
+ [contentRef]
3871
+ );
3872
+ const updateBorders = React.useCallback(
3873
+ (node) => {
3874
+ const bottom = Math.abs(node.scrollHeight - node.clientHeight - node.scrollTop) < 1;
3875
+ const top = node.scrollTop === 0;
3876
+ const borderStyle = `1px solid ${theme.palette.divider}`;
3877
+ node.style.borderTop = top ? "none" : borderStyle;
3878
+ node.style.borderBottom = bottom && !hasFooterAlert ? "none" : borderStyle;
3879
+ },
3880
+ [theme.palette.divider, hasFooterAlert]
3881
+ );
3882
+ const handleScroll = React.useCallback(
3883
+ (event) => {
3884
+ updateBorders(event.target);
3885
+ onScroll == null ? void 0 : onScroll(event);
3886
+ },
3887
+ [updateBorders, onScroll]
3888
+ );
3889
+ React.useEffect(() => {
3890
+ if (!contentRef) return;
3891
+ updateBorders(contentRef);
3892
+ }, [contentRef, updateBorders]);
3893
+ React.useEffect(() => {
3894
+ if (!contentRef || typeof ResizeObserver === "undefined") return;
3895
+ const resizeObserver = new ResizeObserver(() => {
3896
+ updateBorders(contentRef);
3897
+ });
3898
+ resizeObserver.observe(contentRef);
3899
+ return () => resizeObserver.disconnect();
3900
+ }, [contentRef, updateBorders]);
3901
+ return /* @__PURE__ */ jsxRuntime.jsx(
3902
+ Content$1,
3903
+ {
3904
+ ref: setContentRef,
3905
+ onScroll: handleScroll,
3906
+ scrollableContent,
3907
+ withGutter,
3908
+ withBottomGutter: withBottomGutter && withGutter,
3909
+ "data-name": "dialog-content",
3910
+ ...props,
3911
+ children
3912
+ }
3913
+ );
3914
+ }
3915
+ const DialogContent = React.forwardRef(_DialogContent);
3916
+ const DialogContentPadded = material.styled(DialogContent, {
3917
+ shouldForwardProp: (prop) => prop !== "withAlert"
3918
+ })(({ withAlert, theme }) => ({
3919
+ padding: `${theme.spacing(0, 2)} !important`,
3920
+ ...withAlert && {
3921
+ paddingBottom: `${theme.spacing(3)} !important`
3922
+ }
3923
+ }));
3924
+ const StyledAlert = material.styled(Alert$1.Alert)(({ theme }) => ({
3925
+ minHeight: "auto",
3926
+ padding: 0,
3927
+ backgroundColor: "transparent",
3928
+ "& .MuiTypography-root": {
3929
+ color: theme.palette.text.secondary,
3930
+ a: {
3931
+ color: theme.palette.primary.main
3932
+ }
3933
+ },
3934
+ "& .MuiAlertTitle-root": {
3935
+ color: theme.palette.text.primary
3936
+ }
3937
+ }));
3938
+ function DialogAlert({
3939
+ children,
3940
+ severity = "neutral",
3941
+ ...otherProps
3942
+ }) {
3943
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledAlert, { severity, ...otherProps, "data-name": "dialog-alert", children });
3944
+ }
3945
+ const Root$1 = material.styled(material.Box, {
3946
+ shouldForwardProp: (prop) => !["dark", "hasChildren"].includes(prop)
3947
+ })(({ dark, hasChildren, theme }) => ({
3948
+ flex: "0 0 auto",
3949
+ display: "block",
3950
+ minHeight: hasChildren ? theme.spacing(8) : "auto",
3951
+ zIndex: 10,
3952
+ ...dark && {
3953
+ backgroundColor: theme.palette.common.black,
3954
+ color: theme.palette.white[60],
3955
+ ".MuiAlert-root": {
3956
+ ".MuiTypography-root, .MuiAlert-message :not(.MuiAlertTitle-root)": {
3957
+ color: theme.palette.white[60],
3958
+ a: {
3959
+ color: `${theme.palette.secondary.main} !important`
3960
+ }
3961
+ },
3962
+ ".MuiAlert-icon": {
3963
+ color: theme.palette.white[60]
3964
+ }
3965
+ }
3966
+ }
3967
+ }));
3968
+ const Main = material.styled(material.Box)(() => ({
3969
+ display: "flex",
3970
+ alignItems: "center",
3971
+ justifyContent: "space-between",
3972
+ "& > div:empty": {
3973
+ padding: 0
3974
+ }
3975
+ }));
3976
+ const ItemsWrapper = material.styled(material.Box, {
3977
+ shouldForwardProp: (prop) => prop !== "hasAlert"
3978
+ })(({ hasAlert, theme }) => ({
3979
+ display: "flex",
3980
+ alignItems: "center",
3981
+ gap: theme.spacing(1),
3982
+ padding: theme.spacing(2),
3983
+ paddingTop: hasAlert ? 0 : theme.spacing(2)
3984
+ }));
3985
+ const DialogActions = material.styled(material.DialogActions, {
3986
+ shouldForwardProp: (prop) => prop !== "hasAlert"
3987
+ })(({ hasAlert, theme }) => ({
3988
+ gap: theme.spacing(1),
3989
+ padding: theme.spacing(2),
3990
+ paddingTop: hasAlert ? 0 : theme.spacing(2),
3991
+ margin: 0,
3992
+ ".MuiButton-root + .MuiButton-root": {
3993
+ marginLeft: 0
3994
+ }
3995
+ }));
3996
+ const DividerTop = material.styled(material.Divider)(() => ({
3997
+ // To prevent double border in the top when content is scrollable
3998
+ marginTop: "-1px"
3999
+ }));
4000
+ function DialogFooter({
4001
+ children,
4002
+ secondaryActions,
4003
+ alertContent,
4004
+ alertProps,
4005
+ dark,
4006
+ topContent,
4007
+ ...otherProps
4008
+ }) {
4009
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4010
+ topContent,
4011
+ !!alertContent && /* @__PURE__ */ jsxRuntime.jsx(DividerTop, {}),
4012
+ /* @__PURE__ */ jsxRuntime.jsxs(
4013
+ Root$1,
4014
+ {
4015
+ ...otherProps,
4016
+ dark,
4017
+ "data-theme": dark ? "dark" : "light",
4018
+ "data-name": "dialog-footer",
4019
+ hasChildren: !!children,
4020
+ children: [
4021
+ !!alertContent && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { p: 2, pt: 1.5, pb: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(DialogAlert, { ...alertProps, children: alertContent }) }),
4022
+ /* @__PURE__ */ jsxRuntime.jsxs(Main, { children: [
4023
+ /* @__PURE__ */ jsxRuntime.jsx(ItemsWrapper, { hasAlert: !!alertContent, children: secondaryActions }),
4024
+ /* @__PURE__ */ jsxRuntime.jsx(DialogActions, { hasAlert: !!alertContent, children })
4025
+ ] })
4026
+ ]
4027
+ }
4028
+ )
4029
+ ] });
4030
+ }
4031
+ const Backdrop = material.styled(material.Box)(({ theme }) => ({
4032
+ position: "absolute",
4033
+ width: "100%",
4034
+ zIndex: 100,
4035
+ top: 0,
4036
+ bottom: 0,
4037
+ left: 0,
4038
+ right: 0,
4039
+ overflow: "hidden",
4040
+ display: "flex",
4041
+ boxSizing: "border-box",
4042
+ alignItems: "flex-end",
4043
+ background: theme.palette.white[60]
4044
+ }));
4045
+ const AnimationWrapper = material.styled("div")(() => ({
4046
+ width: "100%"
4047
+ }));
4048
+ const BackdropContent = material.styled(material.Box)(({ theme }) => ({
4049
+ width: "100%",
4050
+ padding: theme.spacing(1.5, 2, 2),
4051
+ backgroundColor: theme.palette.background.paper,
4052
+ borderTop: `1px solid ${theme.palette.divider}`,
4053
+ ".MuiDialogActions-root": {
4054
+ padding: 0,
4055
+ marginTop: theme.spacing(1)
4056
+ }
4057
+ }));
4058
+ function DialogConfirmation({
4059
+ children,
4060
+ onClickAway,
4061
+ actions,
4062
+ severity = "warning",
4063
+ opened,
4064
+ "data-testid": dataTestId,
4065
+ "aria-label": ariaLabel,
4066
+ ...alertProps
4067
+ }) {
4068
+ const containerRef = React.useRef(null);
4069
+ const theme = material.useTheme();
4070
+ const handleClickAway = () => {
4071
+ if (onClickAway) {
4072
+ onClickAway();
4073
+ }
4074
+ };
4075
+ return /* @__PURE__ */ jsxRuntime.jsx(
4076
+ Backdrop,
4077
+ {
4078
+ ref: containerRef,
4079
+ "data-testid": dataTestId,
4080
+ "aria-label": ariaLabel,
4081
+ role: "presentation",
4082
+ "data-name": "dialog-confirmation",
4083
+ children: /* @__PURE__ */ jsxRuntime.jsx(ClickAwayListener, { onClickAway: handleClickAway, children: /* @__PURE__ */ jsxRuntime.jsx(
4084
+ material.Slide,
4085
+ {
4086
+ direction: "up",
4087
+ in: opened,
4088
+ container: containerRef.current,
4089
+ mountOnEnter: true,
4090
+ unmountOnExit: true,
4091
+ easing: theme.transitions.easing.easeOut,
4092
+ timeout: 350,
4093
+ children: /* @__PURE__ */ jsxRuntime.jsx(AnimationWrapper, { children: /* @__PURE__ */ jsxRuntime.jsxs(BackdropContent, { children: [
4094
+ /* @__PURE__ */ jsxRuntime.jsx(DialogAlert, { severity, ...alertProps, children }),
4095
+ /* @__PURE__ */ jsxRuntime.jsx(DialogActions, { children: actions })
4096
+ ] }) })
4097
+ }
4098
+ ) })
4099
+ }
4100
+ );
4101
+ }
4102
+ const Root = material.styled(material.Box)(({ theme }) => ({
4103
+ display: "flex",
4104
+ alignItems: "center",
4105
+ justifyContent: "center",
4106
+ height: theme.spacing(8),
4107
+ marginBottom: theme.spacing(2),
4108
+ "& > div": {
4109
+ flex: 1
4110
+ }
4111
+ }));
4112
+ const StepContainer = material.styled(material.Box)(({ theme }) => ({
4113
+ display: "flex",
4114
+ flex: 1,
4115
+ flexDirection: "column",
4116
+ justifyContent: "center",
4117
+ alignItems: "center",
4118
+ position: "relative",
4119
+ "&:before, &:after": {
4120
+ content: '""',
4121
+ background: theme.palette.divider,
4122
+ position: "absolute",
4123
+ top: theme.spacing(1.25),
4124
+ height: theme.spacing(0.25),
4125
+ width: `calc(50% - ${theme.spacing(2.5)})`
4126
+ },
4127
+ "&:before": {
4128
+ left: 0
4129
+ },
4130
+ "&:after": {
4131
+ right: 0
4132
+ },
4133
+ "&:first-of-type:before": {
4134
+ content: "none"
4135
+ },
4136
+ "&:last-of-type:after": {
4137
+ content: "none"
4138
+ }
4139
+ }));
4140
+ function getStepNumberColors({
4141
+ theme,
4142
+ completed,
4143
+ current
4144
+ }) {
4145
+ if (completed) {
4146
+ return {
4147
+ background: theme.palette.success.main,
4148
+ borderColor: theme.palette.success.main,
4149
+ color: theme.palette.common.white
4150
+ };
4151
+ } else if (current) {
4152
+ return {
4153
+ background: theme.palette.text.primary,
4154
+ borderColor: theme.palette.text.primary,
4155
+ color: theme.palette.common.white
4156
+ };
4157
+ } else {
4158
+ return {
4159
+ borderColor: theme.palette.text.secondary,
4160
+ color: theme.palette.text.secondary
4161
+ };
4162
+ }
4163
+ }
4164
+ const StepNumber = material.styled("span", {
4165
+ shouldForwardProp: (prop) => prop !== "completed" && prop !== "current"
4166
+ })(({ theme, completed, current }) => ({
4167
+ display: "flex",
4168
+ justifyContent: "center",
4169
+ alignItems: "center",
4170
+ height: theme.spacing(3),
4171
+ width: theme.spacing(3),
4172
+ marginBottom: theme.spacing(1),
4173
+ borderRadius: "50%",
4174
+ border: `${theme.spacing(0.25)} solid currentColor`,
4175
+ ...theme.typography.caption,
4176
+ ...getStepNumberColors({ theme, completed, current })
4177
+ }));
4178
+ function DialogStepper({
4179
+ currentStep,
4180
+ stepsLabels,
4181
+ ...props
4182
+ }) {
4183
+ return /* @__PURE__ */ jsxRuntime.jsx(Root, { ...props, "data-name": "dialog-stepper", children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { display: "flex" }, children: stepsLabels.map((stepLabel, idx) => {
4184
+ const step = idx + 1;
4185
+ const isCurrent = step === currentStep;
4186
+ const isCompleted = step < currentStep;
4187
+ const labelColor = isCompleted ? "success.main" : isCurrent ? "textPrimary" : "textSecondary";
4188
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4189
+ StepContainer,
4190
+ {
4191
+ "data-state": isCompleted ? "completed" : isCurrent ? "current" : "uncompleted",
4192
+ children: [
4193
+ /* @__PURE__ */ jsxRuntime.jsx(StepNumber, { completed: isCompleted, current: isCurrent, children: isCompleted ? /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Check, { fontSize: "small", "aria-label": "Completed step" }) : step }),
4194
+ /* @__PURE__ */ jsxRuntime.jsx(TablePaginationActions.Typography, { variant: "caption", component: "div", color: labelColor, children: stepLabel })
4195
+ ]
4196
+ },
4197
+ idx
4198
+ );
4199
+ }) }) });
4200
+ }
4201
+ const Content = material.styled(DialogContent, {
4202
+ shouldForwardProp: (prop) => !["error", "withBorder"].includes(prop)
4203
+ })(
4204
+ ({ error, withBorder, theme }) => ({
4205
+ gap: 0,
4206
+ border: withBorder ? `1px solid ${theme.palette.divider} !important` : void 0,
4207
+ borderBottom: error ? "none !important" : void 0,
4208
+ ".react-codemirror2": {
4209
+ display: "flex",
4210
+ flexDirection: "column",
4211
+ minHeight: "100%"
4212
+ },
4213
+ ".CodeMirror-wrap": {
4214
+ display: "flex",
4215
+ flexDirection: "column",
4216
+ flex: 1
4217
+ },
4218
+ "& + .MuiDivider-root": {
4219
+ display: "none"
4220
+ }
4221
+ })
4222
+ );
4223
+ function CodeAreaDialogContent({
4224
+ children,
4225
+ error,
4226
+ withBorder = true,
4227
+ withGutter = false
4228
+ }) {
4229
+ if (!children) return null;
4230
+ return /* @__PURE__ */ jsxRuntime.jsx(Content, { withGutter, error, withBorder, children });
4231
+ }
4232
+ function CodeAreaDialogConfirmation({
4233
+ onClose,
4234
+ onCancel,
4235
+ cancelLabelId,
4236
+ cancelButton,
4237
+ closeButton,
4238
+ contentLabelId,
4239
+ titleLabelId,
4240
+ severity = "warning",
4241
+ content
4242
+ }) {
4243
+ const intl = reactIntl.useIntl();
4244
+ const intlConfig = TablePaginationActions.useImperativeIntl(intl);
4245
+ if (!onClose || !onCancel) {
4246
+ return null;
4247
+ }
4248
+ return /* @__PURE__ */ jsxRuntime.jsx(
4249
+ DialogConfirmation,
4250
+ {
4251
+ opened: true,
4252
+ severity,
4253
+ title: intlConfig.formatMessage({
4254
+ id: titleLabelId || "c4r.dialog.confirmation.title"
4255
+ }),
4256
+ actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4257
+ onCancel && (cancelButton ? cancelButton : /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: onCancel, children: intlConfig.formatMessage({
4258
+ id: cancelLabelId || "c4r.button.cancel"
4259
+ }) })),
4260
+ onClose && (closeButton ? closeButton : /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "contained", onClick: onClose, children: intlConfig.formatMessage({
4261
+ id: "c4r.button.leave"
4262
+ }) }))
4263
+ ] }),
4264
+ children: content ? content : intlConfig.formatMessage({
4265
+ id: contentLabelId || "c4r.dialog.confirmation.content"
4266
+ })
4267
+ }
4268
+ );
4269
+ }
4270
+ function CodeAreaDialog({
4271
+ open,
4272
+ onClose,
4273
+ title,
4274
+ error,
4275
+ helperText,
4276
+ onClickFooter,
4277
+ disabledButtonFooter,
4278
+ buttonFooterLabelId,
4279
+ disabled,
4280
+ showConfirmation,
4281
+ onCancelConfirm,
4282
+ onCloseConfirm,
4283
+ footerProps,
4284
+ saveLoading,
4285
+ showSaveSnackbar,
4286
+ onCloseSaveSnackbar,
4287
+ "data-testid": dataTestId,
4288
+ "aria-label": ariaLabel,
4289
+ ...props
4290
+ }) {
4291
+ const showFooter = error || !!onClickFooter || !!footerProps;
4292
+ if (!open) return null;
4293
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4294
+ Dialog,
4295
+ {
4296
+ open,
4297
+ fullScreen: true,
4298
+ onClose,
4299
+ "data-testid": dataTestId,
4300
+ "aria-label": ariaLabel,
4301
+ "data-name": "code-area-dialog",
4302
+ children: [
4303
+ /* @__PURE__ */ jsxRuntime.jsx(
4304
+ DialogHeader,
4305
+ {
4306
+ title,
4307
+ onClose,
4308
+ closeIcon: !onClickFooter && /* @__PURE__ */ jsxRuntime.jsx(OpenDiagonallyRight.CloseDiagonallyRight, {})
4309
+ }
4310
+ ),
4311
+ /* @__PURE__ */ jsxRuntime.jsx(CodeAreaDialogContent, { error, children: /* @__PURE__ */ jsxRuntime.jsx(
4312
+ CodeAreaField,
4313
+ {
4314
+ ...props,
4315
+ disabled,
4316
+ variant: null,
4317
+ isExpanded: true
4318
+ }
4319
+ ) }),
4320
+ showFooter && /* @__PURE__ */ jsxRuntime.jsx(
4321
+ DialogFooter,
4322
+ {
4323
+ ...footerProps,
4324
+ topContent: error && /* @__PURE__ */ jsxRuntime.jsx(CodeAreaDialogError, { hasDivider: !!onClickFooter, children: helperText }),
4325
+ children: !!onClickFooter && /* @__PURE__ */ jsxRuntime.jsx(
4326
+ CodeAreaFooter,
4327
+ {
4328
+ onClickFooter,
4329
+ buttonFooterLabelId,
4330
+ disabled,
4331
+ disabledButtonFooter,
4332
+ withGutter: false,
4333
+ variant: "contained",
4334
+ size: "medium",
4335
+ loading: !!saveLoading,
4336
+ showSnackbar: showSaveSnackbar,
4337
+ onCloseSnackbar: onCloseSaveSnackbar
4338
+ }
4339
+ )
4340
+ }
4341
+ ),
4342
+ showConfirmation && /* @__PURE__ */ jsxRuntime.jsx(
4343
+ CodeAreaDialogConfirmation,
4344
+ {
4345
+ onClose: onCloseConfirm ?? onClose,
4346
+ onCancel: onCancelConfirm,
4347
+ cancelLabelId: "c4r.button.keepEditing"
4348
+ }
4349
+ )
4350
+ ]
4351
+ }
4352
+ );
4353
+ }
4354
+ exports.TablePaginationActions = TablePaginationActions.TablePaginationActions;
4355
+ exports.Typography = TablePaginationActions.Typography;
4356
+ exports.Alert = Alert$1.Alert;
4357
+ exports.MenuItem = MenuItem.MenuItem;
4358
+ exports.AccordionGroup = AccordionGroup;
4359
+ exports.AppBar = AppBar;
4360
+ exports.Autocomplete = Autocomplete;
4361
+ exports.Avatar = Avatar;
4362
+ exports.Button = Button;
4363
+ exports.CodeAreaDialog = CodeAreaDialog;
4364
+ exports.CodeAreaDialogConfirmation = CodeAreaDialogConfirmation;
4365
+ exports.CodeAreaDialogContent = CodeAreaDialogContent;
4366
+ exports.CodeAreaDialogError = CodeAreaDialogError;
4367
+ exports.CodeAreaField = CodeAreaField;
4368
+ exports.CodeAreaFooter = CodeAreaFooter;
4369
+ exports.CodeAreaHeader = CodeAreaHeader;
4370
+ exports.CodeAreaInput = CodeAreaInput;
4371
+ exports.CopiableComponent = CopiableComponent;
4372
+ exports.CreatableAutocomplete = CreatableAutocomplete;
4373
+ exports.DatePicker = DatePicker;
4374
+ exports.DateRangePicker = DateRangePicker;
4375
+ exports.DateTimePicker = DateTimePicker;
4376
+ exports.Dialog = Dialog;
4377
+ exports.DialogActions = DialogActions;
4378
+ exports.DialogAlert = DialogAlert;
4379
+ exports.DialogConfirmation = DialogConfirmation;
4380
+ exports.DialogContent = DialogContent;
4381
+ exports.DialogContentPadded = DialogContentPadded;
4382
+ exports.DialogFooter = DialogFooter;
4383
+ exports.DialogHeader = DialogHeader;
4384
+ exports.DialogPaper = DialogPaper;
4385
+ exports.DialogStepper = DialogStepper;
4386
+ exports.IconButton = IconButton;
4387
+ exports.LabelWithIndicator = LabelWithIndicator;
4388
+ exports.Menu = Menu$1;
4389
+ exports.MenuItemFilter = MenuItemFilter;
4390
+ exports.MenuList = MenuList;
4391
+ exports.MultipleAutocomplete = MultipleAutocomplete;
4392
+ exports.MultipleSelectField = MultipleSelectField;
4393
+ exports.PasswordField = PasswordField;
4394
+ exports.SelectField = SelectField;
4395
+ exports.Snackbar = Snackbar;
4396
+ exports.TimePicker = TimePicker;
4397
+ exports.ToggleButtonGroup = ToggleButtonGroup;
4398
+ exports.TooltipData = TooltipData;
4399
+ exports.UploadField = UploadField;
4400
+ exports.UploadFieldBase = UploadFieldBase;
4401
+ exports.copyString = copyString;
4402
+ exports.dialogDimensionsBySize = dialogDimensionsBySize;
4403
+ exports.useCopyValue = useCopyValue;