@carto/meridian-ds 1.4.3-alpha-codemirror.1 → 1.4.3-alpha-codemirror.3

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),b=require("react"),i=require("@mui/material"),M=require("../TablePaginationActions-BfAn9gSh.cjs"),T=require("react-intl"),B=require("@mui/icons-material"),U=require("../Alert-Bcn_9-oO.cjs");require("cartocolor");const $=require("../MenuItem-Dbss-WG1.cjs"),Z=require("../ArrowDown-BD0WmQR3.cjs"),Oe=require("@mui/x-date-pickers/DatePicker"),Fe=require("@mui/x-date-pickers"),$e=require("@mui/x-date-pickers/TimePicker"),Le=require("@mui/x-date-pickers/DateTimePicker"),N=require("../OpenDiagonallyRight-DqSU7b6o.cjs"),ne=require("react-codemirror2"),F=require("@mui/material/colors");require("codemirror/lib/codemirror.css");require("codemirror/lib/codemirror.js");require("codemirror/mode/sql/sql.js");require("codemirror/mode/javascript/javascript.js");require("codemirror/mode/htmlmixed/htmlmixed.js");require("codemirror/mode/markdown/markdown.js");require("codemirror/mode/shell/shell.js");require("codemirror/mode/python/python.js");require("codemirror/addon/display/placeholder");require("codemirror/addon/hint/sql-hint.js");require("codemirror/addon/hint/show-hint.css");require("codemirror/addon/hint/show-hint.js");require("codemirror/addon/selection/active-line.js");require("codemirror/addon/edit/matchbrackets.js");require("codemirror/addon/fold/foldcode.js");require("codemirror/addon/fold/foldgutter.js");require("codemirror/addon/fold/foldgutter.css");require("codemirror/addon/fold/brace-fold.js");require("codemirror/addon/fold/xml-fold.js");require("codemirror/addon/fold/indent-fold.js");require("codemirror/addon/fold/markdown-fold.js");require("codemirror/addon/fold/comment-fold.js");const Ee=require("@mui/material/ClickAwayListener"),We=i.styled(i.Box)({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"}),He=i.styled(i.Box)({visibility:"hidden",pointerEvents:"none"});function qe({children:e,loading:t,disabled:o,startIcon:n,endIcon:a,loadingPosition:s,...l},d){const c=r.jsx(i.CircularProgress,{size:18,color:"inherit"}),g=t&&s===void 0,p=()=>g?r.jsxs(i.Box,{sx:{position:"relative"},children:[r.jsx(We,{children:c}),r.jsx(He,{children:e})]}):e,u=m=>{if(!g)return t&&s!==void 0?s===m?c:void 0:m==="start"?n:a};return r.jsx(i.Button,{disabled:t||o,startIcon:u("start"),endIcon:u("end"),...l,role:l.href?"link":"button",ref:d,children:r.jsx(M.Typography,{variant:"inherit",color:"inherit",noWrap:!0,component:"span",children:p()})})}const H=b.forwardRef(qe),Pe=i.styled(i.Box)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5)})),_e=i.styled(M.Typography)(({theme:e})=>({".Mui-disabled &":{color:e.palette.text.disabled}})),Ne=i.styled(i.Box)(({theme:e})=>({display:"flex",svg:{width:M.ICON_SIZE_SMALL,height:M.ICON_SIZE_SMALL,fontSize:M.ICON_SIZE_SMALL,path:{fill:e.palette.text.secondary,".Mui-disabled &":{fill:e.palette.text.disabled}}}}));function E({label:e,type:t,icon:o,inheritSize:n}){return r.jsxs(Pe,{children:[e,t&&r.jsx(_e,{component:"span",variant:n?"inherit":"caption",color:"textSecondary",weight:"regular",children:t==="required"?"(required)":"(optional)"}),o&&r.jsx(Ne,{children:o})]})}function ze({InputProps:e,size:t="small",...o},n){const a=T.useIntl(),s=M.useImperativeIntl(a),[l,d]=b.useState(!1),c=()=>d(!l);return r.jsx(i.TextField,{...o,ref:n,type:l?"text":"password",size:t,InputProps:{...e,endAdornment:r.jsx(i.InputAdornment,{position:"end",children:r.jsx(i.IconButton,{size:t,onClick:c,children:r.jsx(i.Tooltip,{title:s.formatMessage({id:`c4r.form.${l?"hidePassword":"showPassword"}`}),children:l?r.jsx(B.VisibilityOffOutlined,{}):r.jsx(B.VisibilityOutlined,{})})})})}})}const Ge=b.forwardRef(ze),_={};function Ve(e="$lodash$"){_[e]||(_[e]=0);const t=++_[e];return e==="$lodash$"?`${t}`:`${e}${t}`}const Ue=i.styled(i.Select)(({theme:e})=>({"& .MuiInputAdornment-positionStart":{paddingLeft:e.spacing(2),"&.MuiInputAdornment-sizeSmall":{paddingLeft:e.spacing(1.5)}},"& .MuiInputBase-inputAdornedStart":{paddingLeft:"0px !important"},"& .MuiSelect-select .MuiMenuItem-root:hover":{backgroundColor:"transparent"},"&.MuiInputBase-root .MuiSelect-select.MuiSelect-multiple":{paddingRight:e.spacing(7)}})),Ze=i.styled(i.MenuItem)(()=>({display:"none"}));function Ye({children:e,placeholder:t,size:o="small",displayEmpty:n,menuProps:a,inputProps:s,labelId:l,label:d,labelSecondary:c,helperText:g,name:p,error:u,focused:m,disabled:f,fullWidth:x,required:y,"aria-label":h,...k},j){const S=o==="small",[C]=b.useState(()=>Ve("select-label-")),I=d?l??C:void 0;return r.jsxs(i.FormControl,{size:o,error:u,focused:m,disabled:f,fullWidth:x,required:y,"data-name":"select-field","data-size":o,children:[r.jsxs(i.Box,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[d&&r.jsx(i.InputLabel,{shrink:!0,id:I,children:d}),c&&r.jsx(i.Box,{display:"flex",alignItems:"center",ml:2,mb:.5,children:c})]}),r.jsxs(Ue,{...k,labelId:I,name:p,ref:j,size:o,fullWidth:x,displayEmpty:n??!!t,inputProps:{...s,"aria-label":h},MenuProps:{...a,PopoverClasses:{paper:S?"MuiMenu-paper-sizeSmall":void 0},anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:0,horizontal:"left"}},children:[t&&r.jsx(Ze,{disabled:!0,value:"",children:r.jsx(M.Typography,{variant:S?"body2":"body1",color:"text.hint",component:"span",children:t})}),e]}),g&&r.jsx(i.FormHelperText,{"aria-label":`${p}-helper`,children:g})]})}const ue=b.forwardRef(Ye),Je=i.styled(i.ToggleButtonGroup,{shouldForwardProp:e=>e!=="variant"&&e!=="backgroundColor"})(({variant:e,backgroundColor:t,theme:o})=>({...e==="contained"&&{boxShadow:"none"},...e==="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}}}},...t==="primary"&&{backgroundColor:o.palette.background.paper},...t==="secondary"&&{backgroundColor:o.palette.background.default},...t==="transparent"&&{backgroundColor:"transparent"}}));function Ke({children:e,variant:t="floating",backgroundColor:o,...n}){const s=t==="unbounded"?"transparent":"primary";return r.jsx(Je,{...n,variant:t,backgroundColor:o??s,children:e})}const Xe=i.styled("div")(({theme:e})=>({position:"relative",display:"inline-flex","& + &, & + .optionIconButton":{marginLeft:e.spacing(.5)}})),Qe=i.styled(i.IconButton,{shouldForwardProp:e=>!["active"].includes(e)})(({active:e,theme:t})=>({...e&&{color:t.palette.primary.main,backgroundColor:t.palette.primary.background,"& svg:not(.doNotFillIcon) path":{fill:t.palette.primary.main}}}));function et({tooltip:e,tooltipPlacement:t="top",icon:o,size:n="medium",variant:a="icon",color:s="default",sx:l,className:d,loading:c,disabled:g,active:p,...u},m){return r.jsx(i.Tooltip,{placement:t,title:e??"",children:r.jsx(Xe,{className:`optionIconButton ${d??""}`,sx:l,"data-testid":"icon-button",children:r.jsx(Qe,{...u,ref:m,size:n,variant:a,color:s,active:p,disabled:g||c,role:"button",children:c?r.jsx(i.CircularProgress,{size:18,color:"inherit"}):o})})})}const L=b.forwardRef(et),tt=i.styled(i.Menu,{shouldForwardProp:e=>!["extended","width","height"].includes(e)})(({theme:e,extended:t,width:o,height:n})=>({...t&&{".MuiMenuItem-root":{minHeight:e.spacing(6)}},...o&&{".MuiList-root":{width:o,minWidth:o}},...n&&{".MuiMenu-paper":{overflow:"hidden"},".MuiList-root":{maxHeight:n}}}));function ot({extended:e,width:t,height:o,MenuListProps:n,...a},s){return r.jsx(tt,{...a,ref:s,"data-name":"menu",width:t,height:o,extended:e,MenuListProps:{...n,"data-width":t,"data-height":o,"data-extended":e}})}const pe=b.forwardRef(ot),rt=i.styled(i.MenuList,{shouldForwardProp:e=>!["extended","width","height"].includes(e)})(({theme:e,extended:t,width:o,height:n})=>({...t&&{".MuiMenuItem-root":{minHeight:e.spacing(6)}},"&.MuiList-root":{...o&&{width:o,minWidth:o},...n&&{maxHeight:n}}}));function nt({extended:e,width:t,height:o,...n},a){return r.jsx(rt,{...n,ref:a,width:t,height:o,extended:e,"data-name":"menu-list","data-width":t,"data-height":o,"data-extended":e})}const it=b.forwardRef(nt),at=i.styled($.MenuItem)(()=>({marginTop:"0 !important"})),lt=i.styled(i.Link)(({disabled:e,theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(1),width:"100%",textAlign:"initial",...e&&{pointerEvents:"none",color:t.palette.text.disabled}}));function st({areAllSelected:e,areAnySelected:t,selectAll:o,selectAllDisabled:n,"aria-label":a,"data-testid":s},l){const d=T.useIntl(),c=M.useImperativeIntl(d);return r.jsx(at,{ref:l,fixed:!0,"data-name":"menu-filter","aria-label":a,"data-testid":s,children:r.jsxs(lt,{variant:"body2",color:"textPrimary",component:"button",underline:"none",disabled:!!n,onClick:o,tabIndex:0,children:[r.jsx(i.Checkbox,{checked:e,indeterminate:t&&!e,disabled:n}),c.formatMessage({id:"c4r.form.selectAll"})]})})}const Y=b.forwardRef(st);function dt({selectedOptions:e,options:t,onChange:o}){const[n,a]=b.useState(e??[]),s=t.length===n.length,l=n.length>0;return b.useEffect(()=>{n!==e&&a(n)},[e]),{areAllSelected:s,areAnySelected:l,currentOptions:n,handleChange:p=>{const{target:{value:u}}=p,m=typeof u=="string"?u.split(","):u.filter(f=>f!==void 0);a(m),o(m)},selectAll:()=>{const p=t==null?void 0:t.filter(({disabled:u})=>!u).map(({value:u})=>u);p&&(p.every(m=>n.includes(m))?(a([]),o([])):(a(p),o(p)))},unselectAll:()=>{a([]),o([])}}}const ct=i.styled(i.MenuItem)(({theme:e})=>({"&.Mui-disabled":{pointerEvents:"auto","&:hover":{backgroundColor:`${e.palette.background.default} !important`}}})),ut=i.styled(i.InputAdornment,{shouldForwardProp:e=>e!=="size"})(({theme:e,size:t})=>({display:"none",position:"absolute",top:e.spacing(2),right:e.spacing(3.5),".MuiInputBase-root:hover &, .MuiInputBase-root.Mui-focused &":{display:"flex"},".MuiSvgIcon-root":{color:e.palette.text.hint},...t==="medium"&&{top:e.spacing(3),right:e.spacing(5)}})),pt=[],gt=()=>{};function ft({options:e=pt,selectedOptions:t,size:o="small",placeholder:n,showCounter:a,showFilters:s=!0,onChange:l=gt,selectAllDisabled:d,tooltipPlacement:c,variant:g,...p},u){const{areAllSelected:m,areAnySelected:f,currentOptions:x,handleChange:y,selectAll:h,unselectAll:k}=dt({options:e,selectedOptions:t,onChange:l}),j=o==="small",S=j||g==="standard"?0:2,C=T.useIntl(),I=M.useImperativeIntl(C),v=`${x.length} ${I.formatMessage({id:"c4r.form.selected"})}`,A=b.useMemo(()=>m?r.jsx(M.Typography,{component:"span",variant:j?"body2":"body1",color:"textPrimary",ml:S,children:I.formatMessage({id:"c4r.form.allSelected"})}):f?r.jsx(M.Typography,{component:"span",variant:j?"body2":"body1",color:"textPrimary",ml:S,children:a&&x.length>1?v:x.join(", ")}):r.jsx(M.Typography,{component:"span",variant:j?"body2":"body1",color:"text.hint",ml:S,children:n??I.formatMessage({id:"c4r.form.noneSelected"})}),[m,f,v,x,I,j,S,n,a]);return r.jsxs(ue,{...p,ref:u,multiple:!0,displayEmpty:!0,placeholder:n,value:x,renderValue:()=>A,onChange:y,size:o,variant:g,endAdornment:s&&f&&r.jsx(ut,{position:"end",size:o,children:r.jsx(i.IconButton,{onClick:k,size:o,children:r.jsx(B.Cancel,{})})}),menuProps:{PaperProps:{sx:{".MuiList-root":{paddingTop:0}}}},children:[s&&r.jsx(Y,{areAllSelected:m,areAnySelected:f,selectAll:h,selectAllDisabled:d}),e==null?void 0:e.map(D=>{const O=r.jsxs(ct,{value:D.value,disabled:D.disabled,tabIndex:0,children:[r.jsx(i.Checkbox,{disabled:D.disabled,checked:x.includes(D.value)}),r.jsx(i.ListItemText,{primary:D.label})]},D.value);return D.tooltip?r.jsx(i.Tooltip,{title:D.tooltip,placement:c,children:O},D.value):O})]})}const xt=b.forwardRef(ft),mt=i.styled(i.TextField,{shouldForwardProp:e=>e!=="cursor"})(({cursor:e,theme:t})=>({"&.MuiTextField-root .MuiInputBase-root":{cursor:e,paddingRight:t.spacing(1),"& input":{cursor:e},"&.Mui-disabled":{pointerEvents:"none","& .MuiButtonBase-root":{color:t.palette.text.disabled}},"&.MuiInputBase-sizeSmall":{paddingRight:t.spacing(.5)}},"& .MuiFormLabel-root":{cursor:e,"&.Mui-disabled":{pointerEvents:"none"}}}));function bt({buttonText:e,hasFiles:t,size:o,error:n,disabled:a,handleReset:s,handleOpen:l,inProgress:d}){return r.jsx(i.InputAdornment,{position:"end",children:d?r.jsx(i.IconButton,{"aria-label":"Loading",disabled:!0,size:o,children:r.jsx(i.CircularProgress,{size:18})}):t?r.jsx(i.IconButton,{onClick:s,size:o,"aria-label":"Delete",disabled:a,children:r.jsx(B.Cancel,{})}):r.jsx(i.Button,{onClick:l,size:o,variant:"text",color:n?"default":"primary",disabled:a,children:e})})}function ge({name:e,multiple:t,handleReset:o,handleOpen:n,dragOver:a,error:s,placeholder:l,focused:d,buttonText:c="Browse",inProgress:g,InputProps:p,size:u="small",hasFiles:m,cursor:f="pointer",...x}){return r.jsx(mt,{...x,size:u,error:s,placeholder:l,focused:d??a,cursor:f,InputProps:{...p,name:e,readOnly:!0,endAdornment:r.jsx(bt,{buttonText:c,hasFiles:m,size:u,error:s,disabled:!!a,handleReset:o,handleOpen:n,inProgress:g})}})}function ht({onChange:e,files:t,multiple:o,placeholder:n,uploadInputRef:a}){const s=T.useIntl(),l=M.useImperativeIntl(s),[d,c]=b.useState(""),[g,p]=b.useState(!1);b.useEffect(()=>{!t||t.length===0?c(""):t.length===1?c(t[0].name):c(l.formatMessage({id:"c4r.form.filesSelected"},{count:t.length}))},[t,l]);const u=()=>{var C;(C=a.current)==null||C.click()},m=C=>{C.preventDefault(),p(!0)},f=C=>{C.preventDefault(),p(!1)},x=C=>{C.preventDefault(),p(!1);const I=C.dataTransfer.items,v=y(I);e==null||e(v)},y=C=>{const I=[];for(const v of Array.from(C))if(v.kind==="file"){const A=v.getAsFile();I.push(A)}return I},h=C=>{const I=Array.from(C.target.files);e==null||e(I)},k=C=>{C.stopPropagation(),c("")},j=b.useMemo(()=>{const C=l.formatMessage({id:"c4r.form.dragPlaceholder"},{count:o?0:1}),I=l.formatMessage({id:"c4r.form.dragActivePlaceholder"},{count:o?0:1});let v="";return g?v=I:v=n??C,v},[g,o,n,l]);return{filesText:d,getPlaceholder:j,dragOver:g,inputEvents:{onDragOver:m,onDragLeave:f,onDrop:x,onClick:u},handleFiles:h,handleReset:k}}const yt=["application/JSON"];function Ct({name:e,buttonText:t,accept:o,files:n,inProgress:a,onChange:s,multiple:l,placeholder:d,error:c,focused:g,nativeInputProps:p,...u}){const m=o??yt,f=b.useRef(null),{filesText:x,getPlaceholder:y,dragOver:h,inputEvents:k,handleFiles:j,handleReset:S}=ht({uploadInputRef:f,files:n,onChange:s,multiple:l,placeholder:d});return r.jsxs(r.Fragment,{children:[r.jsx(ge,{...u,placeholder:y,value:x,error:c,focused:g??h,handleReset:S,dragOver:h,inProgress:a,hasFiles:!!x,InputProps:k,buttonText:t}),r.jsx("input",{...p,ref:f,style:{display:"none"},type:"file","aria-label":e,name:e,accept:String(m),multiple:l,onChange:j})]})}function Mt({disabled:e,loading:t,...o},n){return r.jsx(i.Autocomplete,{...o,ref:n,disabled:e||t,popupIcon:t?r.jsx(i.CircularProgress,{size:18,color:"inherit"}):r.jsx(Z.ArrowDown,{}),"data-name":"autocomplete",ListboxProps:{"aria-multiselectable":!1,...o.ListboxProps}})}const jt=b.forwardRef(Mt),fe=e=>e&&typeof e=="object"?e.title??String(e):String(e),xe=(e,t)=>typeof e!="object"||e===null?{value:e,multiple:t}:{...e,multiple:t},me=e=>r.jsx("span",{"data-testid":"more-options-tag",children:`+${e}`});function be(){return{renderOption:(t,o,n,a,s)=>{const{title:l,inputValue:d,divider:c,fixed:g,extended:p,dense:u,destructive:m,disabled:f,subtitle:x,iconColor:y,startAdornment:h,endAdornment:k,alternativeTitle:j,secondaryText:S,multiple:C}=o,{key:I,...v}=t,A=typeof o=="string"||typeof o=="number",D=(O,w,R,W)=>R||W||(w&&typeof w=="object"&&"value"in w?String(w.value):O(w));return r.jsx(b.Fragment,{children:c?r.jsx(i.Divider,{}):r.jsxs(r.Fragment,{children:[d&&r.jsx(i.Divider,{}),r.jsxs($.MenuItem,{...v,...!A&&{fixed:g,extended:p,dense:u,destructive:m,disabled:f,subtitle:x,iconColor:y},"aria-disabled":x||f,"aria-selected":n.selected,children:[!x&&(h||C||s)&&r.jsxs(i.ListItemIcon,{children:[s||C&&r.jsx(i.Checkbox,{checked:n.selected}),h]}),r.jsxs(i.ListItemText,{children:[D(a??fe,o,j,l),S&&r.jsx(M.Typography,{component:"p",variant:"caption",color:"text.secondary",children:S})]}),!x&&k]})]})},I)}}}function It({getOptionLabel:e,newItemLabel:t,newItemIcon:o,multiple:n}){const a=T.useIntl(),s=M.useImperativeIntl(a),l=i.createFilterOptions(),{renderOption:d}=be();return{creatableFilterOptions:(u,m)=>{const f=l(u,m),{inputValue:x}=m,y=u.some(h=>x===e(h));if(x.length>1&&x!==""&&!y){let h;typeof t=="function"?h=t(x):t?h=`${t} "${x}"`:h=`${s.formatMessage({id:"c4r.form.add"})} "${x}"`,f.push({inputValue:x,title:h})}return f},creatableOptionLabel:u=>typeof u=="string"?u:u.inputValue?u.inputValue:e(u),creatableRenderOption:(u,m,f)=>{const x=m.inputValue?o??r.jsx(B.AddCircleOutlineOutlined,{}):void 0,y=xe(m,!!n);return d(u,y,f,e,x)}}}function he({options:e,value:t,onChange:o,getOptionLabel:n}){const[a,s]=b.useState(Array.isArray(t)?t:t?[t]:[]),{renderOption:l}=be();b.useEffect(()=>{const m=Array.isArray(t)?t:t?[t]:[];s(m)},[t]);const d=a.length===e.length,c=a.length>0&&a.length<e.length;return{multipleValue:a,allSelected:d,someSelected:c,handleSelectAll:m=>{const f=d?[]:[...e];s(f),o==null||o(m,f,"selectOption")},handleChange:(m,f,x)=>{s(f===null?[]:f),o==null||o(m,f,x)},multipleRenderOption:(m,f,x)=>{const y=xe(f,!0);return l(m,y,x,n)}}}function vt({children:e,showFilters:t,allSelected:o,someSelected:n,handleSelectAll:a=()=>{},multiple:s,...l},d){return r.jsxs("ul",{ref:d,...l,role:"listbox","aria-multiselectable":s,children:[t&&s&&r.jsx(Y,{areAllSelected:!!o,areAnySelected:!!n,selectAll:a}),e]})}const ye=b.forwardRef(vt);function kt({newItemLabel:e,newItemIcon:t,getOptionLabel:o=fe,multiple:n,disableCloseOnSelect:a,disabled:s,loading:l,showFilters:d,options:c=[],value:g,onChange:p,getLimitTagsText:u,...m},f){const{freeSolo:x=!0,...y}=m,{multipleValue:h,allSelected:k,someSelected:j,handleSelectAll:S,handleChange:C}=he({options:c,value:g,onChange:p}),{creatableFilterOptions:I,creatableOptionLabel:v,creatableRenderOption:A}=It({getOptionLabel:o,newItemLabel:e,newItemIcon:t,multiple:n});return r.jsx(i.Autocomplete,{...y,ref:f,options:c,value:n?h:g,onChange:C,filterOptions:I,getOptionLabel:v,renderOption:A,freeSolo:x,forcePopupIcon:!0,multiple:n,disableCloseOnSelect:a??n,ListboxComponent:ye,ListboxProps:{showFilters:d,allSelected:k,someSelected:j,handleSelectAll:S,multiple:n},getLimitTagsText:u??me,disabled:s||l,popupIcon:l?r.jsx(i.CircularProgress,{size:18,color:"inherit"}):r.jsx(Z.ArrowDown,{}),"data-name":"creatable-autocomplete"})}const St=b.forwardRef(kt);function wt({renderOption:e,disableCloseOnSelect:t=!0,disabled:o,loading:n,showFilters:a,options:s,value:l,onChange:d,getOptionLabel:c,getLimitTagsText:g,...p},u){const{multipleValue:m,allSelected:f,someSelected:x,handleSelectAll:y,handleChange:h,multipleRenderOption:k}=he({options:s,value:l,onChange:d,getOptionLabel:c});return r.jsx(i.Autocomplete,{...p,ref:u,options:s,value:m,onChange:h,getOptionLabel:c,renderOption:e??k,ListboxComponent:ye,ListboxProps:{showFilters:a,allSelected:f,someSelected:x,handleSelectAll:y,multiple:!0},multiple:!0,getLimitTagsText:g??me,disableCloseOnSelect:t,disabled:o||n,popupIcon:n?r.jsx(i.CircularProgress,{size:18,color:"inherit"}):r.jsx(Z.ArrowDown,{}),"data-name":"multiple-autocomplete"})}const Dt=b.forwardRef(wt),At=({children:e,disabled:t,value:o,onCopied:n,copyText:a="c4r.button.copy",copiedText:s="c4r.notifications.copiedToClipboard",button:l,buttonLabel:d,buttonProps:c,ariaLabel:g,dataTestId:p,tooltipPlacement:u="top",...m},f)=>{const x=T.useIntl(),y=M.useImperativeIntl(x),[h,k]=b.useState(!1),{copy:j}=J(a,s),S=C=>{C.preventDefault(),j(o).then(()=>{n==null||n(),k(!0)}).catch(console.error)};return r.jsxs(r.Fragment,{children:[r.jsx(i.Tooltip,{title:y.formatMessage({id:a}),leaveDelay:0,placement:u,children:r.jsxs(i.Box,{...m,sx:{cursor:t?void 0:"pointer"},onClick:S,"data-name":"copiable",ref:f,children:[e,l&&r.jsx(L,{...c,disabled:t,icon:r.jsx(B.ContentCopyOutlined,{}),"data-testid":p,"aria-label":g||d,sx:{display:"flex"}})]})}),r.jsx(q,{open:h,autoWidth:!0,closeable:!1,autoHideDuration:4e3,onClose:()=>k(!1),children:y.formatMessage({id:s})})]})},Ce=b.forwardRef(At);async function Me(e){return await navigator.clipboard.writeText(e)}const J=(e="c4r.button.copy",t="c4r.notifications.copiedToClipboard")=>{const[o,n]=b.useState(e);return{message:o,copy:async s=>{await Me(s),n(t),setTimeout(()=>n(e),1e3)}}},Bt=i.styled("div",{shouldForwardProp:e=>e!=="variant"})(({variant:e,theme:t})=>({width:"100%",borderRadius:t.spacing(.5),...e==="outlined"&&{backgroundColor:t.palette.background.paper,boxShadow:`inset 0 0 0 1px ${t.palette.divider}`}}));function Tt({variant:e="standard",items:t,...o}){return r.jsx(Bt,{...o,variant:e,children:t.map((n,a)=>r.jsxs(i.Accordion,{disabled:n.disabled,defaultExpanded:n.defaultExpanded,onChange:n.onChange,children:[r.jsx(i.AccordionSummary,{"aria-controls":`${a}-content`,id:`${a}-header`,children:n.summary}),r.jsx(i.AccordionDetails,{children:n.content})]},a))})}const ie={large:5,medium:4,small:3,xsmall:2.25},Rt=i.styled(i.Avatar,{shouldForwardProp:e=>e!=="size"&&e!=="disabled"})(({theme:e,size:t="medium",disabled:o=!1})=>({width:e.spacing(ie[t]),height:e.spacing(ie[t]),...e.typography.subtitle1,...t==="large"&&{...e.typography.h6},...t==="small"&&{...e.typography.caption,fontWeight:500},...t==="xsmall"&&{...e.typography.caption,fontWeight:500,svg:{width:M.ICON_SIZE_SMALL,height:M.ICON_SIZE_SMALL}},...o&&{opacity:.6}}));function Ot(e){return r.jsx(Rt,{...e})}const je=480,Ft=i.styled(i.Snackbar)(({theme:e})=>({bottom:e.spacing(2),right:e.spacing(2),left:e.spacing(2),[e.breakpoints.up("sm")]:{bottom:e.spacing(4),right:"auto",left:"50%",width:"100%",maxWidth:`${je}px`}})),$t=i.styled(i.Box,{shouldForwardProp:e=>e!=="autoWidth"})(({autoWidth:e,theme:t})=>({minWidth:"100%",maxWidth:`${je}px`,margin:t.spacing(0,1),...e&&{minWidth:"auto"},[t.breakpoints.up("sm")]:{minWidth:t.spacing(40),...e&&{minWidth:"auto"}}})),Lt=i.styled(U.Alert,{shouldForwardProp:e=>!["hasActions","closeable"].includes(e)})(({hasActions:e,closeable:t,icon:o,theme:n})=>({position:"relative",display:"flex",flexWrap:"wrap",columnGap:n.spacing(1),rowGap:n.spacing(.25),padding:n.spacing(1),paddingLeft:n.spacing(2),color:n.palette.common.white,backgroundColor:n.palette.common.black,".MuiAlert-message":{padding:n.spacing(.75,0)},".MuiAlert-message .MuiTypography-root, .MuiAlert-icon":{color:n.palette.common.white},".MuiAlert-message .MuiTypography-root:not(.MuiAlertTitle-root)":{...n.typography.body2},".MuiAlert-message .MuiCircularProgress-circle":{color:n.palette.common.white},".MuiAlert-icon":{position:"absolute",top:n.spacing(1),left:n.spacing(1.5),display:"flex",alignItems:"center",justifyContent:"center",width:n.spacing(3),marginTop:n.spacing(.5)},"&.MuiAlert-standardError":{backgroundColor:n.palette.error.main},...o!==!1&&{paddingLeft:n.spacing(5.5)},...t&&{paddingRight:n.spacing(6)},...!t&&!e&&{paddingRight:n.spacing(1.5)},...e&&{".MuiAlert-message":{minWidth:"fit-content",padding:n.spacing(.75,0)}}})),Et=i.styled(i.Box)(({theme:e})=>({position:"absolute",top:e.spacing(1),right:e.spacing(1),"& button:hover, & button:focus-visible":{backgroundColor:e.palette.white[8]},svg:{color:e.palette.white[60]}}));function q({severity:e="neutral",autoHideDuration:t=M.NOTIFICATION_DURATION_IN_MS,closeable:o=!0,children:n,title:a,action:s,open:l,onClose:d=()=>{},autoWidth:c,icon:g,...p}){const u=T.useIntl(),m=M.useImperativeIntl(u),x=g===!1||e==="neutral"&&!g,h=t===null?null:t||M.NOTIFICATION_DURATION_IN_MS;return r.jsx(i.Portal,{children:r.jsx(Ft,{...p,open:l,autoHideDuration:h,onClose:d,TransitionComponent:c?i.Fade:i.Slide,"data-auto-width":c,children:r.jsxs($t,{sx:{position:"relative"},autoWidth:c,children:[r.jsx(Lt,{severity:e,action:s,icon:x?!1:g,elevation:6,hasActions:!!s,closeable:o,title:a,children:n}),o&&r.jsx(Et,{children:r.jsx(L,{color:"default",onClick:k=>d(k,"timeout"),icon:r.jsx(B.CloseOutlined,{}),tooltip:m.formatMessage({id:"c4r.button.close"})})})]})})})}const Wt=i.styled("div")(({theme:e})=>({display:"flex",alignItems:"center",height:M.APPBAR_SIZE,marginRight:e.spacing(1.5)})),Ht=i.styled(i.IconButton)(({theme:e})=>({marginRight:e.spacing(1),"&.MuiButtonBase-root svg path":{fill:e.palette.brand.appBarContrastText}})),qt=i.styled(i.Divider)(({theme:e})=>({borderColor:i.alpha(e.palette.brand.appBarContrastText,.12)}));function Pt({onClickMenu:e}){return r.jsx(i.Box,{sx:{display:{md:"none",xs:"block"}},children:r.jsxs(Wt,{children:[r.jsx(Ht,{onClick:e,children:r.jsx(B.MenuOutlined,{})}),r.jsx(qt,{orientation:"vertical",flexItem:!0})]})})}const _t=i.styled("div")(({theme:e})=>({display:"flex",marginRight:e.spacing(1.5),"& a":{display:"flex"},"& svg, & img":{width:e.spacing(4),height:e.spacing(4)}}));function Nt({logo:e}){return r.jsx(_t,{children:e})}const zt=i.styled(M.Typography)({display:"flex",alignItems:"center",whiteSpace:"nowrap"});function Gt({text:e}){const t=i.useTheme();return r.jsx(zt,{component:"span",variant:"subtitle1",color:t.palette.brand.appBarContrastText,children:e})}const Vt=i.styled(M.Typography)(({theme:e})=>({display:"flex",alignItems:"center","&::before":{content:'"/"',margin:e.spacing(0,1),opacity:.6,color:e.palette.brand.appBarContrastText}}));function Ut({text:e}){const t=i.useTheme();return r.jsx(Vt,{component:"span",variant:"body2",weight:"strong",color:t.palette.brand.appBarContrastText,children:e})}const Zt=i.styled(i.AppBar)(({theme:e})=>({backgroundColor:e.palette.brand.appBarMain,"& .MuiTypography-root":{color:e.palette.brand.appBarContrastText},"& .MuiIconButton-root path":{fill:e.palette.brand.appBarContrastText}})),Yt=i.styled("div")(({theme:e})=>({display:"flex",alignItems:"center",maxWidth:"calc(100% - 300px)",overflow:"hidden",[e.breakpoints.down("sm")]:{minWidth:"192px"}})),Jt=i.styled("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",flex:1,marginLeft:e.spacing(1)}));function Kt({children:e,brandLogo:t,brandText:o,secondaryText:n,showBurgerMenu:a=!1,onClickMenu:s,...l}){return r.jsx(Zt,{...l,children:r.jsxs(i.Toolbar,{children:[r.jsxs(Yt,{children:[a&&r.jsx(Pt,{onClickMenu:s}),t&&r.jsx(Nt,{logo:t}),o&&r.jsx(Gt,{text:o}),n&&r.jsx(Ut,{text:n})]}),r.jsx(Jt,{children:e})]})})}const Xt=i.styled(i.Box,{shouldForwardProp:e=>!["size","variant"].includes(e)})(({size:e,variant:t,theme:o})=>({position:"absolute",right:o.spacing(5.75),...e==="small"&&{right:o.spacing(4),top:"3px"},...t==="standard"&&{right:o.spacing(4.75),...e==="small"&&{right:o.spacing(3.5)}}}));function K({size:e,variant:t,...o}){const n=T.useIntl(),a=M.useImperativeIntl(n);return r.jsx(Xt,{size:e,variant:t,children:r.jsx(i.IconButton,{...o,size:e,"aria-label":a.formatMessage({id:"c4r.form.clearSelection"})})})}const Qt=i.styled(i.Box,{shouldForwardProp:e=>!["size","variant","readOnly"].includes(e)})(({size:e,variant:t,readOnly:o,theme:n})=>({".MuiInputBase-root":{"& .clearButton svg":{color:n.palette.text.hint},...e==="small"&&{paddingRight:`${n.spacing(1)} !important`},...e==="medium"&&{"& .MuiInputAdornment-root":{"& .MuiIconButton-edgeEnd":{marginRight:n.spacing(-1)}}},...t==="standard"&&{paddingRight:`${n.spacing(1)} !important`,...e==="small"&&{paddingRight:`${n.spacing(.5)} !important`}},...o&&{"& .MuiInputAdornment-root":{"& svg":{color:n.palette.text.disabled}}}}}));function X({children:e,size:t,variant:o,readOnly:n,...a}){return r.jsx(Qt,{...a,size:t,variant:o,readOnly:n,children:e})}function z({handleClear:e,variant:t="outlined",size:o="small",label:n,labelHelpTooltip:a,type:s,helperText:l,placeholder:d,slotProps:c,slots:g,error:p,showCalendar:u=!0,readOnly:m,"aria-label":f,"data-testid":x,...y}){const h=T.useIntl(),k=M.useImperativeIntl(h);return r.jsx(i.Box,{className:"CartoDatePicker-root","data-testid":"date-picker",children:r.jsx(X,{size:o,variant:t,readOnly:m,"data-name":"date-picker","aria-label":f,"data-testid":x,children:r.jsx(Oe.DatePicker,{...y,label:n&&r.jsx(E,{label:n,type:s,icon:a&&r.jsx(i.Tooltip,{title:a,children:r.jsx(B.HelpOutline,{htmlColor:"text.secondary"})})}),slotProps:{textField:{variant:t,helperText:l,placeholder:d,size:o,error:p??void 0,inputProps:{"data-testid":"date-picker-input"}},field:{clearable:!!e,onClear:e},...c},slots:{clearButton:j=>r.jsx(K,{...j,size:o,variant:t}),openPickerButton:j=>r.jsx(i.IconButton,{...j,size:o,"aria-label":k.formatMessage({id:"c4r.form.chooseDate"})}),...g},disableOpenPicker:!u,readOnly:m})})})}const eo=i.styled(i.Box,{shouldForwardProp:e=>!["isSelected","isStartDate","isEndDate","isSelectedMonth","isLastDay","isFirstDay"].includes(e)})(({theme:e,isSelected:t,isStartDate:o,isEndDate:n,isSelectedMonth:a,isLastDay:s,isFirstDay:l})=>({position:"relative",margin:e.spacing(.25),"& .MuiPickersDay-root":{margin:0},...t&&a&&{"&::before":{content:'""',position:"absolute",top:0,right:"-2px",bottom:0,left:"-2px",backgroundColor:e.palette.primary.background,...(o||l)&&{left:0,borderRadius:`${e.shape.borderRadius}px 0 0 ${e.shape.borderRadius}px`},...(n||s)&&{right:0,borderRadius:`0 ${e.shape.borderRadius}px ${e.shape.borderRadius}px 0`}},"&:first-of-type::before":{left:0,borderRadius:`${e.shape.borderRadius}px 0 0 ${e.shape.borderRadius}px`},"&:last-of-type::before":{right:0,borderRadius:`0 ${e.shape.borderRadius}px ${e.shape.borderRadius}px 0`},...l&&{"&:last-of-type::before":{left:0,right:0,borderRadius:e.shape.borderRadius}},...s&&{"&:first-of-type::before":{left:0,right:0,borderRadius:e.shape.borderRadius}},"& .MuiPickersDay-today":{borderColor:`${e.palette.default.outlinedBorder} !important`,...(o||n)&&{boxShadow:`0 0 0 1px inset ${e.palette.background.paper}`}},"&::after":{content:'""',position:"absolute",top:0,right:0,bottom:0,left:0,backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadius,transition:"background-color 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"},"&:hover::after":{backgroundColor:e.palette.primary.relatedLight}}})),to=i.styled(Fe.PickersDay,{shouldForwardProp:e=>e!=="isDateRangeLimit"})(({theme:e,isDateRangeLimit:t})=>({"&.MuiPickersDay-root":{position:"relative",zIndex:1,"&.Mui-selected":{color:e.palette.text.primary},...t&&{"&.Mui-selected":{backgroundColor:`${e.palette.primary.main} !important`,color:e.palette.primary.contrastText,"&:hover":{backgroundColor:`${e.palette.primary.dark} !important`}}}}})),ae=(e,t)=>!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();function le({day:e,startDate:t,endDate:o,selectedMonth:n,...a}){const s=!!(t&&ae(t,e)),l=!!(o&&ae(o,e)),d=!!(t&&o&&e.getTime()>=t.getTime()&&e.getTime()<=o.getTime()),c=e.getDate()===1,g=e.getDate()===new Date(e.getFullYear(),e.getMonth()+1,0).getDate(),p=!!(n&&e.getMonth()===n.getMonth());return r.jsx(eo,{isSelected:d,isStartDate:s,isEndDate:l,isSelectedMonth:p,isLastDay:g,isFirstDay:c,children:r.jsx(to,{...a,day:e,selected:d||s||l,isDateRangeLimit:s||l,"data-name":"pickers-day"})})}const oo=i.styled(i.Box,{shouldForwardProp:e=>!["variant"].includes(e)})(({variant:e,theme:t})=>({display:"flex",gap:e==="standard"?t.spacing(1):"1px","& .CartoDatePicker-root":{"&:first-of-type":{".MuiInputBase-root":{borderRadius:t.spacing(.5,0,0,.5),boxShadow:`1px 0 0 0 ${t.palette.default.outlinedBorder}`,...e==="outlined"&&{"&:not(:hover):not(.Mui-focused):not(.Mui-error) .MuiOutlinedInput-notchedOutline":{borderRightColor:"transparent"}},...e==="filled"&&{"&::before, &::after":{borderRadius:t.spacing(.5,0,0,.5)}},...e==="standard"&&{boxShadow:"none",borderRadius:0}}},"&:last-of-type":{".MuiInputBase-root":{borderRadius:t.spacing(0,.5,.5,0),...e==="outlined"&&{"&:not(:hover):not(.Mui-focused):not(.Mui-error) .MuiOutlinedInput-notchedOutline":{borderLeftColor:"transparent"}},...e==="filled"&&{"&::before, &::after":{borderRadius:t.spacing(0,.5,.5,0)}},...e==="standard"&&{borderRadius:0}}}}}));function ro({globalHelperText:e,error:t,variant:o="outlined",startProps:n,endProps:a,"aria-label":s,"data-testid":l,...d}){const c=T.useIntl(),g=M.useImperativeIntl(c),[p,u]=b.useState(!1),[m,f]=b.useState(!1),[x,y]=b.useState((n==null?void 0:n.value)||null),[h,k]=b.useState((a==null?void 0:a.value)||null),[j,S]=b.useState((a==null?void 0:a.value)??(n==null?void 0:n.value)??new Date),C=t??(n==null?void 0:n.error)??(a==null?void 0:a.error),I=(w,R)=>{y(w),n!=null&&n.onChange&&n.onChange(w,R),w&&R.validationError===null&&!m&&R.trigger===null&&(f(!1),u(!0))},v=(w,R)=>{k(w),a!=null&&a.onChange&&a.onChange(w,R)},A=()=>{f(!0),u(!1),setTimeout(()=>{S(x??new Date)},120)},D=()=>{f(!1),u(!0),setTimeout(()=>{S(h??x??new Date)},120)},O=()=>{f(!1),u(!0),setTimeout(()=>{S(h??x??new Date)},120)};return r.jsxs(i.Box,{children:[r.jsxs(oo,{variant:o,"data-name":"date-range-picker","aria-label":s,"data-testid":l,children:[r.jsx(z,{...d,...n,value:(n==null?void 0:n.value)??x,maxDate:h??void 0,label:(n==null?void 0:n.label)??g.formatMessage({id:"c4r.form.startDate"}),slotProps:{popper:{placement:"bottom-start","aria-label":g.formatMessage({id:"c4r.form.startDateCalendar"})},...n==null?void 0:n.slotProps},slots:{openPickerIcon:B.TodayOutlined,day:w=>r.jsx(le,{...w,startDate:x,endDate:h,selectedMonth:j}),...n==null?void 0:n.slots},error:(n==null?void 0:n.error)??t,open:m,onChange:I,onOpen:A,onClose:D,onMonthChange:w=>S(w),variant:o}),r.jsx(z,{...d,...a,value:(a==null?void 0:a.value)??h,minDate:x??void 0,slotProps:{popper:{"aria-label":g.formatMessage({id:"c4r.form.endDateCalendar"})},...a==null?void 0:a.slotProps},slots:{day:w=>r.jsx(le,{...w,startDate:x,endDate:h,selectedMonth:j}),...a==null?void 0:a.slots},label:(a==null?void 0:a.label)??g.formatMessage({id:"c4r.form.endDate"}),error:(a==null?void 0:a.error)??t,open:p,onOpen:O,onClose:()=>u(!1),onChange:v,onMonthChange:w=>S(w),variant:o})]}),e&&r.jsx(i.FormHelperText,{error:C,children:e})]})}const Ie=(e,t,o,n)=>{const a=e==null?void 0:e.includes("hours"),s=e==null?void 0:e.includes("seconds"),l=e==null?void 0:e.includes("minutes"),d=(e==null?void 0:e.length)===1&&e[0]==="hours";if(n)return n;const c=[];return t&&c.push("MM/dd/yyyy "),a&&c.push(o?"hh":"HH"),d||c.push(":"),l&&c.push("mm"),s&&c.push(":ss"),o&&c.push(" a"),c.join("")};function no({handleClear:e,variant:t="outlined",size:o="small",label:n,labelHelpTooltip:a,type:s,helperText:l,placeholder:d,error:c,showClock:g=!0,readOnly:p,slotProps:u,slots:m,ampm:f=!0,views:x=["hours","minutes"],format:y,"data-testid":h,"aria-label":k,...j}){const S=T.useIntl(),C=M.useImperativeIntl(S),I=b.useRef(null),[v,A]=b.useState(0);return b.useEffect(()=>{if(!I.current)return;const D=new ResizeObserver(O=>{var R;const w=(R=O[0])==null?void 0:R.contentRect.width;w&&A(w)});return D.observe(I.current),()=>{D.disconnect()}},[]),r.jsx(X,{size:o,variant:t,readOnly:p,"data-name":"time-picker","data-testid":h??"time-picker","aria-label":k,children:r.jsx($e.TimePicker,{...j,ref:I,label:r.jsx(E,{label:n??C.formatMessage({id:"c4r.form.time"}),type:s,icon:a&&r.jsx(i.Tooltip,{title:a,children:r.jsx(B.HelpOutline,{htmlColor:"text.secondary"})})}),views:["hours"],format:Ie(x,!1,f,y),slotProps:{textField:{variant:t,helperText:l,placeholder:d,size:o,error:c??void 0,inputProps:{"data-testid":"time-picker-input"}},field:{clearable:!!e,onClear:e},popper:{placement:"bottom-end"},layout:{sx:{width:v}},...u},slots:{clearButton:D=>r.jsx(K,{...D,size:o,variant:t}),openPickerButton:D=>r.jsx(i.IconButton,{...D,size:o,"aria-label":C.formatMessage({id:"c4r.form.chooseDate"})}),...m},disableOpenPicker:!g,readOnly:p,ampm:f})})}function io({handleClear:e,variant:t="outlined",size:o="small",label:n,labelHelpTooltip:a,type:s,helperText:l,placeholder:d,error:c,showCalendar:g=!0,readOnly:p,slotProps:u,slots:m,ampm:f=!0,views:x=["hours","minutes"],format:y,"data-testid":h,"aria-label":k,...j}){const S=T.useIntl(),C=M.useImperativeIntl(S);return r.jsx(X,{size:o,variant:t,readOnly:p,"data-name":"date-time-picker","data-testid":h??"date-time-picker","aria-label":k,children:r.jsx(Le.DateTimePicker,{...j,label:r.jsx(E,{label:n??C.formatMessage({id:"c4r.form.time"}),type:s,icon:a&&r.jsx(i.Tooltip,{title:a,children:r.jsx(B.HelpOutline,{htmlColor:"text.secondary"})})}),views:["year","month","day","hours"],format:Ie(x,!0,f,y),slotProps:{textField:{variant:t,helperText:l,placeholder:d,size:o,error:c??void 0,inputProps:{"data-testid":"date-time-picker-input"}},field:{clearable:!!e,onClear:e},...u},slots:{clearButton:I=>r.jsx(K,{...I,size:o,variant:t}),openPickerButton:I=>r.jsx(i.IconButton,{...I,size:o,"aria-label":C.formatMessage({id:"c4r.form.chooseDate"})}),...m},disableOpenPicker:!g,readOnly:p,ampm:f})})}const ao=[{outlinedBullet:!1,value:""}],lo=i.styled("ul")(({theme:e})=>({listStyle:"none",paddingLeft:0,margin:e.spacing(.5,0,0,0)})),so=i.styled("li")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between","&:not(:last-child)":{marginBottom:e.spacing(.5)}})),co=i.styled("span")(({theme:e})=>({width:e.spacing(1),height:e.spacing(1),marginRight:e.spacing(.5),border:`2px solid ${e.palette.qualitative.bold[1]}`,borderRadius:"50%",backgroundColor:e.palette.qualitative.bold[1]})),uo=i.styled(M.Typography)(({theme:e})=>({minWidth:e.spacing(10),marginRight:e.spacing(1.5)}));function po({items:e=ao,title:t}){return r.jsxs(r.Fragment,{children:[t&&r.jsx(M.Typography,{color:"inherit",variant:"caption",weight:"medium",children:t}),r.jsx(lo,{children:e.map((o,n)=>r.jsxs(so,{children:[r.jsx(co,{style:{backgroundColor:`${o.outlinedBullet?"transparent":o.color}`,borderColor:o.color}}),o.category&&r.jsx(uo,{color:"inherit",variant:"caption",children:o.category}),r.jsx(M.Typography,{color:"inherit",variant:"caption",weight:"medium",children:o.value})]},n))})]})}const go=i.styled(i.Box,{shouldForwardProp:e=>!["withGutter","disabled"].includes(e)})(({withGutter:e,disabled:t,theme:o})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",gap:o.spacing(1),...e&&{height:o.spacing(4),padding:o.spacing(0,.5),borderTop:`1px solid ${o.palette.divider}`,borderBottom:"1px solid transparent"},...t&&{backgroundColor:o.palette.default.background}}));function ve({onClickFooter:e,labelIdButtonFooter:t,ariaLabelButtonFooter:o,disabledButtonFooter:n,withGutter:a=!0,showSnackbar:s,onCloseSnackbar:l,loading:d,disabled:c,...g}){const p=T.useIntl(),u=M.useImperativeIntl(p);return e?r.jsxs(go,{withGutter:a,disabled:c,"data-name":"code-area-footer","data-gutter":a,children:[r.jsx(H,{variant:"text",...g,loading:d,onClick:e,"aria-label":o||"save-form-button",disabled:c||n,children:u.formatMessage({id:t||"c4r.button.save"})}),r.jsx(q,{open:s,autoWidth:!0,closeable:!1,autoHideDuration:4e3,onClose:l,children:u.formatMessage({id:"c4r.notifications.changesSaved"})})]}):null}const se=i.styled(i.Box,{shouldForwardProp:e=>e!=="size"})(({size:e,theme:t})=>({position:"absolute",top:0,right:t.spacing(.5),zIndex:1,display:"flex",justifyContent:"flex-end",gap:t.spacing(1),padding:e==="small"?t.spacing(.5):t.spacing(1,2,2),paddingRight:e==="small"?0:t.spacing(1.5)}));function fo({disabled:e,copyValue:t,onClickExpand:o,size:n}){const a=T.useIntl(),s=M.useImperativeIntl(a),l=!!o,d=t!==void 0,c=l&&d,{copy:g}=J(),[p,u]=b.useState(!1),[m,f]=b.useState(null),x=!!m,y=j=>{f(j.currentTarget)},h=()=>{f(null)},k=j=>{j.preventDefault(),t&&g(t).then(()=>{u(!0)}).catch(console.error)};return!l&&!d?null:c?r.jsxs(r.Fragment,{children:[r.jsxs(se,{size:n,"data-size":n,"data-name":"code-area-header",children:[r.jsx(L,{color:"default",size:n,icon:r.jsx(B.MoreVertOutlined,{}),disabled:e,tooltip:s.formatMessage({id:"c4r.button.showOptions"}),tooltipPlacement:"top","aria-controls":x?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":x?"true":void 0,onClick:y}),r.jsxs(pe,{anchorEl:m,open:x,onClose:h,id:"menu",MenuListProps:{"aria-labelledby":"menu-button"},"aria-label":"Code area actions",transformOrigin:{vertical:"top",horizontal:"right"},anchorOrigin:{vertical:"bottom",horizontal:"right"},children:[r.jsxs($.MenuItem,{onClick:k,disabled:e,id:"copy",children:[r.jsx(i.ListItemIcon,{children:r.jsx(B.ContentCopyOutlined,{})}),r.jsx(i.ListItemText,{children:s.formatMessage({id:"c4r.button.copy"})})]}),r.jsxs($.MenuItem,{onClick:o,disabled:e,id:"expand",children:[r.jsx(i.ListItemIcon,{children:r.jsx(N.OpenDiagonallyRight,{})}),r.jsx(i.ListItemText,{children:s.formatMessage({id:"c4r.button.expand"})})]})]})]}),r.jsx(q,{open:p,autoWidth:!0,closeable:!1,autoHideDuration:4e3,onClose:()=>u(!1),children:s.formatMessage({id:"c4r.notifications.copiedToClipboard"})})]}):r.jsxs(se,{size:n,"data-size":n,"data-name":"code-area-header",children:[d&&r.jsx(Ce,{disabled:e,value:t,button:!0,buttonProps:{size:n}}),l&&r.jsx(L,{color:"default",size:n,onClick:o,icon:r.jsx(N.OpenDiagonallyRight,{}),disabled:e,tooltip:s.formatMessage({id:"c4r.button.expand"}),tooltipPlacement:"top"})]})}const xo=i.styled(i.Box,{shouldForwardProp:e=>!["size","height"].includes(e)})(({size:e,height:t,theme:o})=>({position:"relative",flex:1,display:"flex",cursor:"text",":focus-within &, .error &":{marginBottom:0},"& .react-codemirror2":{width:"100%",height:"100% !important",position:"relative"},"& .CodeMirror":{position:"absolute",top:0,bottom:0,left:0,right:0,zIndex:1,height:"100% !important",backgroundColor:o.palette.background.default},"& .CodeMirror-code":{"&> div:first-of-type .CodeMirror-line":{marginTop:o.spacing(-.25)}},"& .CodeMirror-scroll":{paddingLeft:o.spacing(1),paddingRight:o.spacing(1),backgroundColor:"transparent"},"& .CodeMirror-lines":{padding:o.spacing(1,0)},"& .CodeMirror pre.CodeMirror-line, & .CodeMirror pre.CodeMirror-line-like":{boxSizing:"border-box",paddingLeft:0,paddingTop:o.spacing(.25),lineHeight:1.2},"& .CodeMirror-linenumbers":{width:`${o.spacing(4.5)} !important`},"& .CodeMirror-linenumber":{width:`${o.spacing(4.5)} !important`,height:o.spacing(2),marginBottom:`${o.spacing(-.25)} !important`,paddingTop:o.spacing(.25),paddingRight:o.spacing(1.25),boxSizing:"border-box !important",color:o.palette.text.secondary},"& .CodeMirror-activeline-background, & .CodeMirror-activeline-gutter":{backgroundColor:"transparent"},"& .CodeMirror-gutter-background":{width:`${o.spacing(6.25)} !important`},"& .CodeMirror-sizer":{paddingTop:o.spacing(.25),marginLeft:`${o.spacing(5.25)} !important`,borderRightWidth:`${o.spacing(4)} !important`},"& .CodeMirror-matchingbracket":{color:`${F.lime[900]} !important`,backgroundColor:o.palette.black[4],boxShadow:`0 0 0 1px ${o.palette.text.hint}`},"& .CodeMirror-selected, & .CodeMirror-focused .CodeMirror-selected, & .CodeMirror-line::selection, & .CodeMirror-line > span::selection, & .CodeMirror-line > span > span::selection":{background:`${i.alpha(F.blue[800],.2)} !important`},"& .CodeMirror-gutters":{borderRight:0,color:o.palette.text.secondary,backgroundColor:o.palette.default.background},"& .CodeMirror-gutter-elt":{"& .CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded":{marginLeft:o.spacing(-1),"&:after":{fontSize:o.typography.caption.fontSize}}},"& .CodeMirror-placeholder":{paddingTop:"0 !important",marginLeft:`${o.spacing(-.5)} !important`,marginBottom:`${o.spacing(-.25)} !important`,color:`${o.palette.text.hint} !important`},"& .MuiLinearProgress-root":{height:"2px",position:"absolute",top:0,left:0,right:0,zIndex:1},"& .pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like, & .cm-bracket":{color:o.palette.text.primary},"& .CodeMirror pre.CodeMirror-placeholder":{color:o.palette.text.hint},"& .CodeMirror-composing":{border:0},"& .cm-keyword, & .cm-string, & .cm-string-2, & .cm-other":{color:F.purple[500]},"& .cm-operator, & .cm-tag, & .cm-attribute":{color:F.teal[700]},"& .cm-number, & .cm-property, & .cm-builtin":{color:F.red[700]},"& .cm-comment":{color:o.palette.text.secondary},"& .cm-variable":{color:F.lime[900]},"& .cm-variable-2":{color:o.palette.text.primary},"& .cm-punctuation, & .cm-def, ":{color:F.blue[800]},"& .cm-variable-3, & .cm-type":{color:F.indigo[800]},"& .CodeMirror-foldmarker":{textShadow:"none",color:o.palette.primary.main},"& .cm-error":{color:o.palette.error.main},"& .CodeMirror-selected":{background:F.blue[800]},"& .cm-header-1":{fontSize:o.typography.h2.fontSize},"& .cm-header-2":{fontSize:o.typography.h3.fontSize},"& .cm-header-3":{fontSize:o.typography.h4.fontSize},"& .cm-header-4":{fontSize:o.typography.h5.fontSize},"& .cm-header-5":{fontSize:o.typography.h6.fontSize},...e==="small"&&{"& .CodeMirror":{height:t||"auto",minHeight:o.spacing(9),...o.typography.code3}}}));function mo(e){const t=e.split(`
2
- `),o=[],n=[];for(t.forEach((a,s)=>{const l=s+1;if(a.trim()==="-- BEGIN CONTROL CODE")n.push(l);else if(a.trim()==="-- END CONTROL CODE"&&n.length>0){const d=n.pop();o.push({from:d,to:l})}});n.length>0;){const a=n.pop();o.push({from:a,to:t.length})}return o}function ke({options:e,value:t,defaultValue:o,id:n,onEditorDidMount:a,onChange:s,onBlur:l,onFocus:d,placeholder:c,disabled:g,size:p="small",height:u,"data-testid":m,"aria-label":f="Code editor text area","aria-labelledby":x,...y}){var I;const h=b.useRef(),k={mode:"sql",theme:"light",lineNumbers:!0,lineWrapping:!0,extraKeys:{"Ctrl-Space":"autocomplete"},placeholder:c,disabled:g,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],styleActiveLine:{nonEmpty:!0},styleActiveSelected:!0,matchBrackets:!0,foldOptions:{minFoldSize:1,scanUp:!1},...e},[j,S]=b.useState(null);b.useEffect(()=>()=>{S(null)},[]);const C=b.useCallback(({from:v,to:A})=>{j.foldCode(0,{rangeFinder:()=>{if(A)return{from:{line:v-1,ch:0},to:{line:A-1,ch:0}}}},"fold")},[j]);return b.useEffect(()=>{if(!t||!j)return;const v=mo(t);if(v.length)for(const A of v)C(A)},[t,C,j]),r.jsxs(xo,{size:p,height:u,id:n,"data-size":p,"data-height":u,"data-mode":typeof(e==null?void 0:e.mode)=="object"&&((I=e.mode)!=null&&I.name)?e.mode.name:e==null?void 0:e.mode,"data-fold-gutter":e==null?void 0:e.foldGutter,"data-testid":m,"aria-label":x?void 0:f,"aria-labelledby":x,"data-name":"code-area-input",children:[t!==void 0&&r.jsx(ne.Controlled,{...y,value:t,editorDidMount:v=>{h.current=v,S(v),a==null||a(v)},options:k,onBeforeChange:(v,A,D)=>{s==null||s(D)},onBlur:v=>{l==null||l(v.getValue())},onFocus:d}),o!==void 0&&r.jsx(ne.UnControlled,{...y,value:o,options:k,onBlur:v=>{l==null||l(v.getValue())},onFocus:d})]})}const bo=i.styled(i.FormControl)(()=>({display:"flex",flexDirection:"column",flex:1})),ho=i.styled(i.Box,{shouldForwardProp:e=>!["variant","error","disabled","readOnly","lineNumbers","fullScreen"].includes(e)})(({variant:e,error:t,disabled:o,readOnly:n,lineNumbers:a,fullScreen:s,theme:l})=>({position:"relative",overflow:"auto",display:"flex",flexDirection:"column",flex:1,width:"100%",minHeight:0,background:l.palette.background.paper,".CodeMirror-focused .CodeMirror-activeline":{"& .CodeMirror-activeline-background, & .CodeMirror-activeline-gutter":{background:l.palette.primary.background}},...s&&{maxWidth:"100%",maxHeight:"100vh",height:"100vh"},...(e==="filled"||e==="outlined")&&{borderRadius:l.spacing(.5),transition:l.transitions.create("background-color",{easing:l.transitions.easing.easeInOut,duration:l.transitions.duration.shortest}),"&:after":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",border:`1px solid ${l.palette.default.outlinedBorder}`,borderRadius:l.spacing(.5),transition:l.transitions.create("border-color",{easing:l.transitions.easing.easeInOut,duration:l.transitions.duration.shortest})},"&:hover:after":{borderColor:l.palette.common.black},"&:focus-within":{overflow:"hidden","&:after":{borderWidth:"2px",borderColor:l.palette.primary.main}},...t&&{"&.MuiBox-root:after":{borderWidth:"2px",borderColor:l.palette.error.main}}},...e==="filled"&&{backgroundColor:l.palette.background.paper,"&.codeArea-filled:after":{borderColor:"transparent"},"&.codeArea-filled:hover:after":{borderColor:l.palette.common.black},"&.codeArea-filled:focus-within:after":{borderWidth:"2px",borderColor:l.palette.primary.main},"& .CodeMirror":{backgroundColor:l.palette.default.background,"&:focus-within":{backgroundColor:l.palette.background.paper}},...t&&{borderColor:l.palette.error.main,"& .CodeMirror":{backgroundColor:l.palette.default.background},"&:hover, &:focus-within, &.codeArea-filled:after, &.codeArea-filled:hover:after, &.codeArea-filled:focus-within:after":{borderColor:l.palette.error.main},"&:focus-within":{"& .CodeMirror":{backgroundColor:l.palette.background.paper}}}},...n&&{"& .CodeMirror":{backgroundColor:l.palette.default.background,".CodeMirror-cursors":{visibility:"hidden !important"}},...e==="filled"&&{backgroundColor:l.palette.background.paper}},...o&&{pointerEvents:"none","& .CodeMirror":{color:l.palette.text.disabled,backgroundColor:l.palette.default.background,"& span, .CodeMirror-linenumber, .CodeMirror-guttermarker-subtle":{color:l.palette.text.disabled}},...e==="filled"&&{backgroundColor:l.palette.background.paper}},...!a&&{"& .CodeMirror-scroll .CodeMirror-sizer":{marginLeft:`${l.spacing(1)} !important`},"& .CodeMirror-gutter-background":{width:`${l.spacing(2)} !important`}}})),yo=i.styled(i.Box,{shouldForwardProp:e=>e!=="hasActions"})(({theme:e,hasActions:t})=>({flex:"1 1 auto",overflowY:"auto",display:"flex",flexDirection:"column",...t&&{".CodeMirror-line":{paddingRight:`${e.spacing(4)} !important`}}})),Co=i.styled(B.HelpOutline)(({theme:e})=>({width:M.ICON_SIZE_SMALL,height:M.ICON_SIZE_SMALL,fill:e.palette.text.secondary}));function Se({value:e,defaultValue:t,validate:o,onChange:n,onBlur:a,onFocus:s,label:l,labelHelpTooltip:d,placeholder:c,type:g,disabled:p,copyValue:u,helperText:m,error:f,size:x="small",variant:y="outlined",onClickExpand:h,onClickFooter:k,disabledButtonFooter:j,labelIdButtonFooter:S,ariaLabelButtonFooter:C,options:I,id:v="code-area-field",saveLoading:A,showSaveSnackbar:D,onCloseSaveSnackbar:O,fullScreen:w,isExpanded:R,...W}){const[Te,oe]=b.useState(!1),re=(I==null?void 0:I.readOnly)??!1,Re=(I==null?void 0:I.lineNumbers)??!0;return r.jsxs(bo,{size:x,error:f,disabled:p,"aria-disabled":p,"data-size":x,"data-full-screen":w,"data-variant":y,"data-name":"code-area-field",children:[l&&r.jsx(i.InputLabel,{htmlFor:v,disabled:p,error:f,focused:Te,shrink:!0,id:`${v}-label`,children:r.jsx(E,{label:l,type:g,icon:d?r.jsx(i.Tooltip,{title:d,children:r.jsx(Co,{"aria-label":typeof d=="string"?d:void 0})}):void 0})}),r.jsxs(ho,{variant:y,error:!!f,disabled:p,readOnly:re,lineNumbers:Re,className:y==="filled"?"codeArea-filled":"",fullScreen:w,children:[r.jsx(fo,{onClickExpand:h,copyValue:u,disabled:p,size:R?"medium":"small"}),r.jsx(yo,{hasActions:!!u||!!h,children:r.jsx(ke,{...W,id:v,disabled:p,value:e,defaultValue:t,placeholder:c,onFocus:()=>{oe(!0),s==null||s()},onBlur:P=>{a&&a(P),n&&n(P),o&&o(P),oe(!1)},onChange:n,size:x,options:{...re&&{styleActiveLine:!1,matchBrackets:!1},...I},"aria-labelledby":l?`${v}-label`:void 0})}),r.jsx(ve,{labelIdButtonFooter:S,ariaLabelButtonFooter:C,onClickFooter:k,disabled:p,disabledButtonFooter:j,size:"small",loading:!!A,showSnackbar:D,onCloseSnackbar:O})]}),m&&r.jsx(i.FormHelperText,{children:m})]})}const Mo=i.styled(i.Box)(({theme:e})=>({position:"relative",marginBottom:"1px",padding:e.spacing(1.5,2,1.5,5.5),"&:before":{content:'""',position:"absolute",top:0,left:0,bottom:0,zIndex:1,width:e.spacing(5),background:e.palette.background.default},"&:after":{content:'""',position:"absolute",top:0,right:0,left:0,bottom:0,zIndex:2,background:"linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 40%)"},".MuiFormHelperText-root":{marginTop:0}})),jo=i.styled(i.Box)(({theme:e})=>({position:"relative",zIndex:3,display:"flex",alignItems:"center",gap:e.spacing(1)}));function Io({children:e,hasDivider:t}){const o=i.useTheme();return e?r.jsxs(r.Fragment,{children:[r.jsx(Mo,{children:r.jsxs(jo,{children:[r.jsx(B.ErrorOutline,{htmlColor:o.palette.error.main}),r.jsx(i.FormHelperText,{error:!0,children:e})]})}),t&&r.jsx(i.Divider,{})]}):null}const de={small:"480px",medium:"640px",large:"640px",xlarge:"720px"},G={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"}},V=i.styled(i.Paper,{shouldForwardProp:e=>!["fullScreen","height","width","hasForm"].includes(e)})(({fullScreen:e,height:t,width:o,hasForm:n,size:a="small",theme:s})=>({"&.MuiPaper-root":{position:"relative",display:"flex",flexDirection:"column",margin:s.spacing(5),borderRadius:s.spacing(1),...G[a],maxHeight:de[a],[`@media (max-height:${de[a]})`]:{maxHeight:"calc(100vh - 80px)",...a==="large"&&{minHeight:t!=="auto"?"calc(100vh - 80px)":"auto"}},...e&&{width:"100vw",maxWidth:`calc(100vw - ${s.spacing(10)})`,height:"100vh",maxHeight:`calc(100vh - ${s.spacing(10)})`,margin:s.spacing(5),borderRadius:s.spacing(1)},...t&&{height:t,minHeight:t},...o&&{width:o},[s.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,...t&&{top:"auto",borderRadius:s.spacing(1,1,0,0),height:t,minHeight:t}},...n&&{maxHeight:`calc(100vh - ${s.spacing(10)})`,form:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between",overflow:"hidden",...G[a],maxWidth:"100%",...e&&{width:"100%",maxWidth:"100%",height:"100%",maxHeight:"100%"},...t&&{height:t,minHeight:t},...o&&{width:o},[s.breakpoints.down("sm")]:{width:"100%",maxWidth:"100%",height:"100vh",maxHeight:"100vh",...t&&{top:"auto",borderRadius:s.spacing(1,1,0,0),height:t,minHeight:t}}}}}}));function vo({nonModal:e,children:t,size:o="small",PaperProps:n,fullScreen:a,height:s,width:l,hasForm:d,"aria-label":c,"data-testid":g,...p},u){return e?r.jsx(V,{size:o,fullScreen:a,height:s,width:l,hasForm:d,"aria-label":c,"data-testid":g,"data-name":"dialog",...p,ref:u,children:t}):r.jsx(i.Dialog,{PaperComponent:V,PaperProps:{...n,size:o,fullScreen:a,height:s,width:l,hasForm:d},fullScreen:a,role:"section","aria-label":c,"data-testid":g,"data-size":o,"data-width":l,"data-height":s,"data-name":"dialog",...p,ref:u,children:t})}const we=b.forwardRef(vo),ko=i.styled(i.DialogTitle)(()=>({padding:0,zIndex:10})),So=i.styled(i.Box)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(2),minHeight:e.spacing(8)})),ce=i.styled(i.Box)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),overflow:"hidden"})),wo=i.styled(B.CloseOutlined)(({theme:e})=>({color:e.palette.text.secondary})),Do=i.styled(i.Divider)(()=>({"+ .MuiDialogContent-root":{borderTop:"none !important"}}));function De({title:e,chipLabel:t,chipProps:o,children:n,onClose:a,secondaryActions:s,"aria-label":l,closeIcon:d,...c}){const g=T.useIntl(),p=M.useImperativeIntl(g);return r.jsxs(r.Fragment,{children:[r.jsxs(ko,{component:"div","data-name":"dialog-header",...c,children:[r.jsxs(So,{children:[r.jsxs(ce,{flex:1,maxWidth:.8,children:[r.jsx(M.Typography,{component:"h2",variant:"inherit",noWrap:!0,"aria-label":l,role:"heading",children:e}),t&&r.jsx(i.Chip,{color:"default",label:t,...o})]}),r.jsxs(ce,{children:[s,a&&r.jsx(i.Tooltip,{title:p.formatMessage({id:"c4r.button.close"}),placement:"left",children:r.jsx(i.IconButton,{onClick:a,children:d||r.jsx(wo,{"data-testid":"CloseIcon"})})})]})]}),n]}),n&&r.jsx(Do,{})]})}const Ao=i.styled(i.DialogContent,{shouldForwardProp:e=>!["scrollableContent","withGutter","withBottomGutter"].includes(e)})(({theme:e,scrollableContent:t,withGutter:o,withBottomGutter:n})=>({display:"flex",flexDirection:"column",gap:e.spacing(3),padding:0,...e.typography.body2,color:e.palette.text.secondary,".MuiAlert-root":{minHeight:"auto"},...t&&{borderBottom:`1px solid ${e.palette.divider}`,"+ .MuiDivider-root":{display:"none"}},...o&&{padding:` ${e.spacing(1,2,0)} !important`,".MuiDialog-paperFullScreen &":{padding:`${e.spacing(2,2,0)} !important`}},...n&&{paddingBottom:`${e.spacing(3)} !important`,".MuiDialog-paperFullScreen &":{paddingBottom:`${e.spacing(3)} !important`}}}));function Bo({children:e,scrollableContent:t,hasFooterAlert:o,withGutter:n=!0,withBottomGutter:a=!0,onScroll:s,...l},d){const c=i.useTheme(),[g,p]=b.useState(null);b.useImperativeHandle(d,()=>g,[g]);const u=b.useCallback(f=>{const x=Math.abs(f.scrollHeight-f.clientHeight-f.scrollTop)<1,y=f.scrollTop===0,h=`1px solid ${c.palette.divider}`;f.style.borderTop=y?"none":h,f.style.borderBottom=x&&!o?"none":h},[c.palette.divider,o]),m=b.useCallback(f=>{u(f.target),s==null||s(f)},[u,s]);return b.useEffect(()=>{g&&u(g)},[g,u]),b.useEffect(()=>{if(!g||typeof ResizeObserver>"u")return;const f=new ResizeObserver(()=>{u(g)});return f.observe(g),()=>f.disconnect()},[g,u]),r.jsx(Ao,{ref:p,onScroll:m,scrollableContent:t,withGutter:n,withBottomGutter:a&&n,"data-name":"dialog-content",...l,children:e})}const Q=b.forwardRef(Bo),To=i.styled(Q,{shouldForwardProp:e=>e!=="withAlert"})(({withAlert:e,theme:t})=>({padding:`${t.spacing(0,2)} !important`,...e&&{paddingBottom:`${t.spacing(3)} !important`}})),Ro=i.styled(U.Alert)(({theme:e})=>({minHeight:"auto",padding:0,backgroundColor:"transparent","& .MuiTypography-root":{color:e.palette.text.secondary,a:{color:e.palette.primary.main}},"& .MuiAlertTitle-root":{color:e.palette.text.primary}}));function ee({children:e,severity:t="neutral",...o}){return r.jsx(Ro,{severity:t,...o,"data-name":"dialog-alert",children:e})}const Oo=i.styled(i.Box,{shouldForwardProp:e=>!["dark","hasChildren"].includes(e)})(({dark:e,hasChildren:t,theme:o})=>({flex:"0 0 auto",display:"block",minHeight:t?o.spacing(8):"auto",zIndex:10,...e&&{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]}}}})),Fo=i.styled(i.Box)(()=>({display:"flex",alignItems:"center",justifyContent:"space-between","& > div:empty":{padding:0}})),$o=i.styled(i.Box,{shouldForwardProp:e=>e!=="hasAlert"})(({hasAlert:e,theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(1),padding:t.spacing(2),paddingTop:e?0:t.spacing(2)})),te=i.styled(i.DialogActions,{shouldForwardProp:e=>e!=="hasAlert"})(({hasAlert:e,theme:t})=>({gap:t.spacing(1),padding:t.spacing(2),paddingTop:e?0:t.spacing(2),margin:0,".MuiButton-root + .MuiButton-root":{marginLeft:0}})),Lo=i.styled(i.Divider)(()=>({marginTop:"-1px"}));function Ae({children:e,secondaryActions:t,alertContent:o,alertProps:n,dark:a,topContent:s,...l}){return r.jsxs(r.Fragment,{children:[s,!!o&&r.jsx(Lo,{}),r.jsxs(Oo,{...l,dark:a,"data-theme":a?"dark":"light","data-name":"dialog-footer",hasChildren:!!e,children:[!!o&&r.jsx(i.Box,{sx:{p:2,pt:1.5,pb:1},children:r.jsx(ee,{...n,children:o})}),r.jsxs(Fo,{children:[r.jsx($o,{hasAlert:!!o,children:t}),r.jsx(te,{hasAlert:!!o,children:e})]})]})]})}const Eo=i.styled(i.Box)(({theme:e})=>({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:e.palette.white[60]})),Wo=i.styled("div")(()=>({width:"100%"})),Ho=i.styled(i.Box)(({theme:e})=>({width:"100%",padding:e.spacing(1.5,2,2),backgroundColor:e.palette.background.paper,borderTop:`1px solid ${e.palette.divider}`,".MuiDialogActions-root":{padding:0,marginTop:e.spacing(1)}}));function Be({children:e,onClickAway:t,actions:o,severity:n="warning",opened:a,"data-testid":s,"aria-label":l,...d}){const c=b.useRef(null),g=i.useTheme(),p=()=>{t&&t()};return r.jsx(Eo,{ref:c,"data-testid":s,"aria-label":l,role:"presentation","data-name":"dialog-confirmation",children:r.jsx(Ee,{onClickAway:p,children:r.jsx(i.Slide,{direction:"up",in:a,container:c.current,mountOnEnter:!0,unmountOnExit:!0,easing:g.transitions.easing.easeOut,timeout:350,children:r.jsx(Wo,{children:r.jsxs(Ho,{children:[r.jsx(ee,{severity:n,...d,children:e}),r.jsx(te,{children:o})]})})})})})}const qo=i.styled(i.Box)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",height:e.spacing(8),marginBottom:e.spacing(2),"& > div":{flex:1}})),Po=i.styled(i.Box)(({theme:e})=>({display:"flex",flex:1,flexDirection:"column",justifyContent:"center",alignItems:"center",position:"relative","&:before, &:after":{content:'""',background:e.palette.divider,position:"absolute",top:e.spacing(1.25),height:e.spacing(.25),width:`calc(50% - ${e.spacing(2.5)})`},"&:before":{left:0},"&:after":{right:0},"&:first-of-type:before":{content:"none"},"&:last-of-type:after":{content:"none"}}));function _o({theme:e,completed:t,current:o}){return t?{background:e.palette.success.main,borderColor:e.palette.success.main,color:e.palette.common.white}:o?{background:e.palette.text.primary,borderColor:e.palette.text.primary,color:e.palette.common.white}:{borderColor:e.palette.text.secondary,color:e.palette.text.secondary}}const No=i.styled("span",{shouldForwardProp:e=>e!=="completed"&&e!=="current"})(({theme:e,completed:t,current:o})=>({display:"flex",justifyContent:"center",alignItems:"center",height:e.spacing(3),width:e.spacing(3),marginBottom:e.spacing(1),borderRadius:"50%",border:`${e.spacing(.25)} solid currentColor`,...e.typography.caption,..._o({theme:e,completed:t,current:o})}));function zo({currentStep:e,stepsLabels:t,...o}){return r.jsx(qo,{...o,"data-name":"dialog-stepper",children:r.jsx(i.Box,{sx:{display:"flex"},children:t.map((n,a)=>{const s=a+1,l=s===e,d=s<e,c=d?"success.main":l?"textPrimary":"textSecondary";return r.jsxs(Po,{"data-state":d?"completed":l?"current":"uncompleted",children:[r.jsx(No,{completed:d,current:l,children:d?r.jsx(B.Check,{fontSize:"small","aria-label":"Completed step"}):s}),r.jsx(M.Typography,{variant:"caption",component:"div",color:c,children:n})]},a)})})})}const Go=i.styled(Q,{shouldForwardProp:e=>!["error","withBorder"].includes(e)})(({error:e,withBorder:t,theme:o})=>({gap:0,border:t?`1px solid ${o.palette.divider} !important`:void 0,borderBottom:e?"none !important":void 0,".react-codemirror2":{display:"flex",flexDirection:"column",minHeight:"100%"},".CodeMirror-wrap":{display:"flex",flexDirection:"column",flex:1},"& + .MuiDivider-root":{display:"none"}}));function Vo({children:e,error:t,withBorder:o=!0,withGutter:n=!1}){return e?r.jsx(Go,{withGutter:n,error:t,withBorder:o,children:e}):null}function Uo({onClose:e,onCancel:t,cancelLabel:o,cancelButton:n,closeButton:a,contentLabel:s,titleLabel:l,severity:d="warning",content:c}){const g=T.useIntl(),p=M.useImperativeIntl(g);return!e||!t?null:r.jsx(Be,{opened:!0,severity:d,title:p.formatMessage({id:l||"c4r.dialog.confirmation.title"}),actions:r.jsxs(r.Fragment,{children:[t&&(n||r.jsx(H,{onClick:t,children:p.formatMessage({id:o||"c4r.button.cancel"})})),e&&(a||r.jsx(H,{variant:"contained",onClick:e,children:p.formatMessage({id:"c4r.button.leave"})}))]}),children:c||p.formatMessage({id:s||"c4r.dialog.confirmation.content"})})}function Zo({open:e,onClose:t,title:o,error:n,helperText:a,onClickFooter:s,disabledButtonFooter:l,labelIdButtonFooter:d,ariaLabelButtonFooter:c,disabled:g,showConfirmation:p,onCancelConfirm:u,onCloseConfirm:m,footerProps:f,saveLoading:x,showSaveSnackbar:y,onCloseSaveSnackbar:h,"data-testid":k,"aria-label":j,...S}){const C=n||!!s||!!f;return e?r.jsxs(we,{open:e,fullScreen:!0,onClose:t,"data-testid":k,"aria-label":j,"data-name":"code-area-dialog",children:[r.jsx(De,{title:o,onClose:t,closeIcon:!s&&r.jsx(N.CloseDiagonallyRight,{})}),r.jsx(Vo,{error:n,children:r.jsx(Se,{...S,disabled:g,variant:null,isExpanded:!0})}),C&&r.jsx(Ae,{...f,topContent:n&&r.jsx(Io,{hasDivider:!!s,children:a}),children:!!s&&r.jsx(ve,{onClickFooter:s,labelIdButtonFooter:d,ariaLabelButtonFooter:c,disabled:g,disabledButtonFooter:l,withGutter:!1,variant:"contained",size:"medium",loading:!!x,showSnackbar:y,onCloseSnackbar:h})}),p&&r.jsx(Uo,{onClose:m??t,onCancel:u,cancelLabel:"c4r.button.keepEditing"})]}):null}exports.TablePaginationActions=M.TablePaginationActions;exports.Typography=M.Typography;exports.Alert=U.Alert;exports.MenuItem=$.MenuItem;exports.AccordionGroup=Tt;exports.AppBar=Kt;exports.Autocomplete=jt;exports.Avatar=Ot;exports.Button=H;exports.CodeAreaDialog=Zo;exports.CodeAreaField=Se;exports.CodeAreaInput=ke;exports.CopiableComponent=Ce;exports.CreatableAutocomplete=St;exports.DatePicker=z;exports.DateRangePicker=ro;exports.DateTimePicker=io;exports.Dialog=we;exports.DialogActions=te;exports.DialogAlert=ee;exports.DialogConfirmation=Be;exports.DialogContent=Q;exports.DialogContentPadded=To;exports.DialogFooter=Ae;exports.DialogHeader=De;exports.DialogPaper=V;exports.DialogStepper=zo;exports.IconButton=L;exports.LabelWithIndicator=E;exports.Menu=pe;exports.MenuItemFilter=Y;exports.MenuList=it;exports.MultipleAutocomplete=Dt;exports.MultipleSelectField=xt;exports.PasswordField=Ge;exports.SelectField=ue;exports.Snackbar=q;exports.TimePicker=no;exports.ToggleButtonGroup=Ke;exports.TooltipData=po;exports.UploadField=Ct;exports.UploadFieldBase=ge;exports.copyString=Me;exports.dialogDimensionsBySize=G;exports.useCopyValue=J;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),b=require("react"),i=require("@mui/material"),j=require("../TablePaginationActions-BfAn9gSh.cjs"),B=require("react-intl"),D=require("@mui/icons-material"),U=require("../Alert-Bcn_9-oO.cjs");require("cartocolor");const $=require("../MenuItem-Dbss-WG1.cjs"),Z=require("../ArrowDown-BD0WmQR3.cjs"),Ee=require("@mui/x-date-pickers/DatePicker"),We=require("@mui/x-date-pickers"),He=require("@mui/x-date-pickers/TimePicker"),qe=require("@mui/x-date-pickers/DateTimePicker"),N=require("../OpenDiagonallyRight-DqSU7b6o.cjs"),ie=require("react-codemirror2"),F=require("@mui/material/colors");require("codemirror/lib/codemirror.css");require("codemirror/lib/codemirror.js");require("codemirror/mode/sql/sql.js");require("codemirror/mode/javascript/javascript.js");require("codemirror/mode/htmlmixed/htmlmixed.js");require("codemirror/mode/markdown/markdown.js");require("codemirror/mode/shell/shell.js");require("codemirror/mode/python/python.js");require("codemirror/addon/display/placeholder");require("codemirror/addon/hint/sql-hint.js");require("codemirror/addon/hint/show-hint.css");require("codemirror/addon/hint/show-hint.js");require("codemirror/addon/selection/active-line.js");require("codemirror/addon/edit/matchbrackets.js");require("codemirror/addon/fold/foldcode.js");require("codemirror/addon/fold/foldgutter.js");require("codemirror/addon/fold/foldgutter.css");require("codemirror/addon/fold/brace-fold.js");require("codemirror/addon/fold/xml-fold.js");require("codemirror/addon/fold/indent-fold.js");require("codemirror/addon/fold/markdown-fold.js");require("codemirror/addon/fold/comment-fold.js");const Pe=require("@mui/material/ClickAwayListener"),_e=i.styled(i.Box)({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"}),Ne=i.styled(i.Box)({visibility:"hidden",pointerEvents:"none"});function ze({children:e,loading:t,disabled:o,startIcon:n,endIcon:a,loadingPosition:s,...l},d){const c=r.jsx(i.CircularProgress,{size:18,color:"inherit"}),g=t&&s===void 0,p=()=>g?r.jsxs(i.Box,{sx:{position:"relative"},children:[r.jsx(_e,{children:c}),r.jsx(Ne,{children:e})]}):e,u=m=>{if(!g)return t&&s!==void 0?s===m?c:void 0:m==="start"?n:a};return r.jsx(i.Button,{disabled:t||o,startIcon:u("start"),endIcon:u("end"),...l,role:l.href?"link":"button",ref:d,children:r.jsx(j.Typography,{variant:"inherit",color:"inherit",noWrap:!0,component:"span",children:p()})})}const H=b.forwardRef(ze),Ge=i.styled(i.Box)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5)})),Ve=i.styled(j.Typography)(({theme:e})=>({".Mui-disabled &":{color:e.palette.text.disabled}})),Ue=i.styled(i.Box)(({theme:e})=>({display:"flex",svg:{width:j.ICON_SIZE_SMALL,height:j.ICON_SIZE_SMALL,fontSize:j.ICON_SIZE_SMALL,path:{fill:e.palette.text.secondary,".Mui-disabled &":{fill:e.palette.text.disabled}}}}));function E({label:e,type:t,icon:o,inheritSize:n}){return r.jsxs(Ge,{children:[e,t&&r.jsx(Ve,{component:"span",variant:n?"inherit":"caption",color:"textSecondary",weight:"regular",children:t==="required"?"(required)":"(optional)"}),o&&r.jsx(Ue,{children:o})]})}function Ze({InputProps:e,size:t="small",...o},n){const a=B.useIntl(),s=j.useImperativeIntl(a),[l,d]=b.useState(!1),c=()=>d(!l);return r.jsx(i.TextField,{...o,ref:n,type:l?"text":"password",size:t,InputProps:{...e,endAdornment:r.jsx(i.InputAdornment,{position:"end",children:r.jsx(i.IconButton,{size:t,onClick:c,children:r.jsx(i.Tooltip,{title:s.formatMessage({id:`c4r.form.${l?"hidePassword":"showPassword"}`}),children:l?r.jsx(D.VisibilityOffOutlined,{}):r.jsx(D.VisibilityOutlined,{})})})})}})}const Ye=b.forwardRef(Ze),_={};function Je(e="$lodash$"){_[e]||(_[e]=0);const t=++_[e];return e==="$lodash$"?`${t}`:`${e}${t}`}const Ke=i.styled(i.Select)(({theme:e})=>({"& .MuiInputAdornment-positionStart":{paddingLeft:e.spacing(2),"&.MuiInputAdornment-sizeSmall":{paddingLeft:e.spacing(1.5)}},"& .MuiInputBase-inputAdornedStart":{paddingLeft:"0px !important"},"& .MuiSelect-select .MuiMenuItem-root:hover":{backgroundColor:"transparent"},"&.MuiInputBase-root .MuiSelect-select.MuiSelect-multiple":{paddingRight:e.spacing(7)}})),Xe=i.styled(i.MenuItem)(()=>({display:"none"}));function Qe({children:e,placeholder:t,size:o="small",displayEmpty:n,menuProps:a,inputProps:s,labelId:l,label:d,labelSecondary:c,helperText:g,name:p,error:u,focused:m,disabled:f,fullWidth:x,required:C,"aria-label":h,...v},I){const k=o==="small",[M]=b.useState(()=>Je("select-label-")),y=d?l??M:void 0;return r.jsxs(i.FormControl,{size:o,error:u,focused:m,disabled:f,fullWidth:x,required:C,"data-name":"select-field","data-size":o,children:[r.jsxs(i.Box,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[d&&r.jsx(i.InputLabel,{shrink:!0,id:y,children:d}),c&&r.jsx(i.Box,{display:"flex",alignItems:"center",ml:2,mb:.5,children:c})]}),r.jsxs(Ke,{...v,labelId:y,name:p,ref:I,size:o,fullWidth:x,displayEmpty:n??!!t,inputProps:{...s,"aria-label":h},MenuProps:{...a,PopoverClasses:{paper:k?"MuiMenu-paper-sizeSmall":void 0},anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:0,horizontal:"left"}},children:[t&&r.jsx(Xe,{disabled:!0,value:"",children:r.jsx(j.Typography,{variant:k?"body2":"body1",color:"text.hint",component:"span",children:t})}),e]}),g&&r.jsx(i.FormHelperText,{"aria-label":`${p}-helper`,children:g})]})}const pe=b.forwardRef(Qe),et=i.styled(i.ToggleButtonGroup,{shouldForwardProp:e=>e!=="variant"&&e!=="backgroundColor"})(({variant:e,backgroundColor:t,theme:o})=>({...e==="contained"&&{boxShadow:"none"},...e==="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}}}},...t==="primary"&&{backgroundColor:o.palette.background.paper},...t==="secondary"&&{backgroundColor:o.palette.background.default},...t==="transparent"&&{backgroundColor:"transparent"}}));function tt({children:e,variant:t="floating",backgroundColor:o,...n}){const s=t==="unbounded"?"transparent":"primary";return r.jsx(et,{...n,variant:t,backgroundColor:o??s,children:e})}const ot=i.styled("div")(({theme:e})=>({position:"relative",display:"inline-flex","& + &, & + .optionIconButton":{marginLeft:e.spacing(.5)}})),rt=i.styled(i.IconButton,{shouldForwardProp:e=>!["active"].includes(e)})(({active:e,theme:t})=>({...e&&{color:t.palette.primary.main,backgroundColor:t.palette.primary.background,"& svg:not(.doNotFillIcon) path":{fill:t.palette.primary.main}}}));function nt({tooltip:e,tooltipPlacement:t="top",icon:o,size:n="medium",variant:a="icon",color:s="default",sx:l,className:d,loading:c,disabled:g,active:p,...u},m){return r.jsx(i.Tooltip,{placement:t,title:e??"",children:r.jsx(ot,{className:`optionIconButton ${d??""}`,sx:l,"data-testid":"icon-button",children:r.jsx(rt,{...u,ref:m,size:n,variant:a,color:s,active:p,disabled:g||c,role:"button",children:c?r.jsx(i.CircularProgress,{size:18,color:"inherit"}):o})})})}const L=b.forwardRef(nt),it=i.styled(i.Menu,{shouldForwardProp:e=>!["extended","width","height"].includes(e)})(({theme:e,extended:t,width:o,height:n})=>({...t&&{".MuiMenuItem-root":{minHeight:e.spacing(6)}},...o&&{".MuiList-root":{width:o,minWidth:o}},...n&&{".MuiMenu-paper":{overflow:"hidden"},".MuiList-root":{maxHeight:n}}}));function at({extended:e,width:t,height:o,MenuListProps:n,...a},s){return r.jsx(it,{...a,ref:s,"data-name":"menu",width:t,height:o,extended:e,MenuListProps:{...n,"data-width":t,"data-height":o,"data-extended":e}})}const ge=b.forwardRef(at),lt=i.styled(i.MenuList,{shouldForwardProp:e=>!["extended","width","height"].includes(e)})(({theme:e,extended:t,width:o,height:n})=>({...t&&{".MuiMenuItem-root":{minHeight:e.spacing(6)}},"&.MuiList-root":{...o&&{width:o,minWidth:o},...n&&{maxHeight:n}}}));function st({extended:e,width:t,height:o,...n},a){return r.jsx(lt,{...n,ref:a,width:t,height:o,extended:e,"data-name":"menu-list","data-width":t,"data-height":o,"data-extended":e})}const dt=b.forwardRef(st),ct=i.styled($.MenuItem)(()=>({marginTop:"0 !important"})),ut=i.styled(i.Link)(({disabled:e,theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(1),width:"100%",textAlign:"initial",...e&&{pointerEvents:"none",color:t.palette.text.disabled}}));function pt({areAllSelected:e,areAnySelected:t,selectAll:o,selectAllDisabled:n,"aria-label":a,"data-testid":s},l){const d=B.useIntl(),c=j.useImperativeIntl(d);return r.jsx(ct,{ref:l,fixed:!0,"data-name":"menu-filter","aria-label":a,"data-testid":s,children:r.jsxs(ut,{variant:"body2",color:"textPrimary",component:"button",underline:"none",disabled:!!n,onClick:o,tabIndex:0,children:[r.jsx(i.Checkbox,{checked:e,indeterminate:t&&!e,disabled:n}),c.formatMessage({id:"c4r.form.selectAll"})]})})}const Y=b.forwardRef(pt);function gt({selectedOptions:e,options:t,onChange:o}){const[n,a]=b.useState(e??[]),s=t.length===n.length,l=n.length>0;return b.useEffect(()=>{n!==e&&a(n)},[e]),{areAllSelected:s,areAnySelected:l,currentOptions:n,handleChange:p=>{const{target:{value:u}}=p,m=typeof u=="string"?u.split(","):u.filter(f=>f!==void 0);a(m),o(m)},selectAll:()=>{const p=t==null?void 0:t.filter(({disabled:u})=>!u).map(({value:u})=>u);p&&(p.every(m=>n.includes(m))?(a([]),o([])):(a(p),o(p)))},unselectAll:()=>{a([]),o([])}}}const ft=i.styled(i.MenuItem)(({theme:e})=>({"&.Mui-disabled":{pointerEvents:"auto","&:hover":{backgroundColor:`${e.palette.background.default} !important`}}})),xt=i.styled(i.InputAdornment,{shouldForwardProp:e=>e!=="size"})(({theme:e,size:t})=>({display:"none",position:"absolute",top:e.spacing(2),right:e.spacing(3.5),".MuiInputBase-root:hover &, .MuiInputBase-root.Mui-focused &":{display:"flex"},".MuiSvgIcon-root":{color:e.palette.text.hint},...t==="medium"&&{top:e.spacing(3),right:e.spacing(5)}})),mt=[],bt=()=>{};function ht({options:e=mt,selectedOptions:t,size:o="small",placeholder:n,showCounter:a,showFilters:s=!0,onChange:l=bt,selectAllDisabled:d,tooltipPlacement:c,variant:g,...p},u){const{areAllSelected:m,areAnySelected:f,currentOptions:x,handleChange:C,selectAll:h,unselectAll:v}=gt({options:e,selectedOptions:t,onChange:l}),I=o==="small",k=I||g==="standard"?0:2,M=B.useIntl(),y=j.useImperativeIntl(M),S=`${x.length} ${y.formatMessage({id:"c4r.form.selected"})}`,T=b.useMemo(()=>m?r.jsx(j.Typography,{component:"span",variant:I?"body2":"body1",color:"textPrimary",ml:k,children:y.formatMessage({id:"c4r.form.allSelected"})}):f?r.jsx(j.Typography,{component:"span",variant:I?"body2":"body1",color:"textPrimary",ml:k,children:a&&x.length>1?S:x.join(", ")}):r.jsx(j.Typography,{component:"span",variant:I?"body2":"body1",color:"text.hint",ml:k,children:n??y.formatMessage({id:"c4r.form.noneSelected"})}),[m,f,S,x,y,I,k,n,a]);return r.jsxs(pe,{...p,ref:u,multiple:!0,displayEmpty:!0,placeholder:n,value:x,renderValue:()=>T,onChange:C,size:o,variant:g,endAdornment:s&&f&&r.jsx(xt,{position:"end",size:o,children:r.jsx(i.IconButton,{onClick:v,size:o,children:r.jsx(D.Cancel,{})})}),menuProps:{PaperProps:{sx:{".MuiList-root":{paddingTop:0}}}},children:[s&&r.jsx(Y,{areAllSelected:m,areAnySelected:f,selectAll:h,selectAllDisabled:d}),e==null?void 0:e.map(A=>{const O=r.jsxs(ft,{value:A.value,disabled:A.disabled,tabIndex:0,children:[r.jsx(i.Checkbox,{disabled:A.disabled,checked:x.includes(A.value)}),r.jsx(i.ListItemText,{primary:A.label})]},A.value);return A.tooltip?r.jsx(i.Tooltip,{title:A.tooltip,placement:c,children:O},A.value):O})]})}const yt=b.forwardRef(ht),Ct=i.styled(i.TextField,{shouldForwardProp:e=>e!=="cursor"})(({cursor:e,theme:t})=>({"&.MuiTextField-root .MuiInputBase-root":{cursor:e,paddingRight:t.spacing(1),"& input":{cursor:e},"&.Mui-disabled":{pointerEvents:"none","& .MuiButtonBase-root":{color:t.palette.text.disabled}},"&.MuiInputBase-sizeSmall":{paddingRight:t.spacing(.5)}},"& .MuiFormLabel-root":{cursor:e,"&.Mui-disabled":{pointerEvents:"none"}}}));function Mt({buttonText:e,hasFiles:t,size:o,error:n,disabled:a,handleReset:s,handleOpen:l,inProgress:d}){return r.jsx(i.InputAdornment,{position:"end",children:d?r.jsx(i.IconButton,{"aria-label":"Loading",disabled:!0,size:o,children:r.jsx(i.CircularProgress,{size:18})}):t?r.jsx(i.IconButton,{onClick:s,size:o,"aria-label":"Delete",disabled:a,children:r.jsx(D.Cancel,{})}):r.jsx(i.Button,{onClick:l,size:o,variant:"text",color:n?"default":"primary",disabled:a,children:e})})}function fe({name:e,multiple:t,handleReset:o,handleOpen:n,dragOver:a,error:s,placeholder:l,focused:d,buttonText:c="Browse",inProgress:g,InputProps:p,size:u="small",hasFiles:m,cursor:f="pointer",...x}){return r.jsx(Ct,{...x,size:u,error:s,placeholder:l,focused:d??a,cursor:f,InputProps:{...p,name:e,readOnly:!0,endAdornment:r.jsx(Mt,{buttonText:c,hasFiles:m,size:u,error:s,disabled:!!a,handleReset:o,handleOpen:n,inProgress:g})}})}function jt({onChange:e,files:t,multiple:o,placeholder:n,uploadInputRef:a}){const s=B.useIntl(),l=j.useImperativeIntl(s),[d,c]=b.useState(""),[g,p]=b.useState(!1);b.useEffect(()=>{!t||t.length===0?c(""):t.length===1?c(t[0].name):c(l.formatMessage({id:"c4r.form.filesSelected"},{count:t.length}))},[t,l]);const u=()=>{var M;(M=a.current)==null||M.click()},m=M=>{M.preventDefault(),p(!0)},f=M=>{M.preventDefault(),p(!1)},x=M=>{M.preventDefault(),p(!1);const y=M.dataTransfer.items,S=C(y);e==null||e(S)},C=M=>{const y=[];for(const S of Array.from(M))if(S.kind==="file"){const T=S.getAsFile();y.push(T)}return y},h=M=>{const y=Array.from(M.target.files);e==null||e(y)},v=M=>{M.stopPropagation(),c("")},I=b.useMemo(()=>{const M=l.formatMessage({id:"c4r.form.dragPlaceholder"},{count:o?0:1}),y=l.formatMessage({id:"c4r.form.dragActivePlaceholder"},{count:o?0:1});let S="";return g?S=y:S=n??M,S},[g,o,n,l]);return{filesText:d,getPlaceholder:I,dragOver:g,inputEvents:{onDragOver:m,onDragLeave:f,onDrop:x,onClick:u},handleFiles:h,handleReset:v}}const It=["application/JSON"];function vt({name:e,buttonText:t,accept:o,files:n,inProgress:a,onChange:s,multiple:l,placeholder:d,error:c,focused:g,nativeInputProps:p,...u}){const m=o??It,f=b.useRef(null),{filesText:x,getPlaceholder:C,dragOver:h,inputEvents:v,handleFiles:I,handleReset:k}=jt({uploadInputRef:f,files:n,onChange:s,multiple:l,placeholder:d});return r.jsxs(r.Fragment,{children:[r.jsx(fe,{...u,placeholder:C,value:x,error:c,focused:g??h,handleReset:k,dragOver:h,inProgress:a,hasFiles:!!x,InputProps:v,buttonText:t}),r.jsx("input",{...p,ref:f,style:{display:"none"},type:"file","aria-label":e,name:e,accept:String(m),multiple:l,onChange:I})]})}function kt({disabled:e,loading:t,...o},n){return r.jsx(i.Autocomplete,{...o,ref:n,disabled:e||t,popupIcon:t?r.jsx(i.CircularProgress,{size:18,color:"inherit"}):r.jsx(Z.ArrowDown,{}),"data-name":"autocomplete",ListboxProps:{"aria-multiselectable":!1,...o.ListboxProps}})}const St=b.forwardRef(kt),xe=e=>e&&typeof e=="object"?e.title??String(e):String(e),me=(e,t)=>typeof e!="object"||e===null?{value:e,multiple:t}:{...e,multiple:t},be=e=>r.jsx("span",{"data-testid":"more-options-tag",children:`+${e}`});function he(){return{renderOption:(t,o,n,a,s)=>{const{title:l,inputValue:d,divider:c,fixed:g,extended:p,dense:u,destructive:m,disabled:f,subtitle:x,iconColor:C,startAdornment:h,endAdornment:v,alternativeTitle:I,secondaryText:k,multiple:M}=o,{key:y,...S}=t,T=typeof o=="string"||typeof o=="number",A=(O,w,R,W)=>R||W||(w&&typeof w=="object"&&"value"in w?String(w.value):O(w));return r.jsx(b.Fragment,{children:c?r.jsx(i.Divider,{}):r.jsxs(r.Fragment,{children:[d&&r.jsx(i.Divider,{}),r.jsxs($.MenuItem,{...S,...!T&&{fixed:g,extended:p,dense:u,destructive:m,disabled:f,subtitle:x,iconColor:C},"aria-disabled":x||f,"aria-selected":n.selected,children:[!x&&(h||M||s)&&r.jsxs(i.ListItemIcon,{children:[s||M&&r.jsx(i.Checkbox,{checked:n.selected}),h]}),r.jsxs(i.ListItemText,{children:[A(a??xe,o,I,l),k&&r.jsx(j.Typography,{component:"p",variant:"caption",color:"text.secondary",children:k})]}),!x&&v]})]})},y)}}}function wt({getOptionLabel:e,newItemLabel:t,newItemIcon:o,multiple:n}){const a=B.useIntl(),s=j.useImperativeIntl(a),l=i.createFilterOptions(),{renderOption:d}=he();return{creatableFilterOptions:(u,m)=>{const f=l(u,m),{inputValue:x}=m,C=u.some(h=>x===e(h));if(x.length>1&&x!==""&&!C){let h;typeof t=="function"?h=t(x):t?h=`${t} "${x}"`:h=`${s.formatMessage({id:"c4r.form.add"})} "${x}"`,f.push({inputValue:x,title:h})}return f},creatableOptionLabel:u=>typeof u=="string"?u:u.inputValue?u.inputValue:e(u),creatableRenderOption:(u,m,f)=>{const x=m.inputValue?o??r.jsx(D.AddCircleOutlineOutlined,{}):void 0,C=me(m,!!n);return d(u,C,f,e,x)}}}function ye({options:e,value:t,onChange:o,getOptionLabel:n}){const[a,s]=b.useState(Array.isArray(t)?t:t?[t]:[]),{renderOption:l}=he();b.useEffect(()=>{const m=Array.isArray(t)?t:t?[t]:[];s(m)},[t]);const d=a.length===e.length,c=a.length>0&&a.length<e.length;return{multipleValue:a,allSelected:d,someSelected:c,handleSelectAll:m=>{const f=d?[]:[...e];s(f),o==null||o(m,f,"selectOption")},handleChange:(m,f,x)=>{s(f===null?[]:f),o==null||o(m,f,x)},multipleRenderOption:(m,f,x)=>{const C=me(f,!0);return l(m,C,x,n)}}}function At({children:e,showFilters:t,allSelected:o,someSelected:n,handleSelectAll:a=()=>{},multiple:s,...l},d){return r.jsxs("ul",{ref:d,...l,role:"listbox","aria-multiselectable":s,children:[t&&s&&r.jsx(Y,{areAllSelected:!!o,areAnySelected:!!n,selectAll:a}),e]})}const Ce=b.forwardRef(At);function Dt({newItemLabel:e,newItemIcon:t,getOptionLabel:o=xe,multiple:n,disableCloseOnSelect:a,disabled:s,loading:l,showFilters:d,options:c=[],value:g,onChange:p,getLimitTagsText:u,...m},f){const{freeSolo:x=!0,...C}=m,{multipleValue:h,allSelected:v,someSelected:I,handleSelectAll:k,handleChange:M}=ye({options:c,value:g,onChange:p}),{creatableFilterOptions:y,creatableOptionLabel:S,creatableRenderOption:T}=wt({getOptionLabel:o,newItemLabel:e,newItemIcon:t,multiple:n});return r.jsx(i.Autocomplete,{...C,ref:f,options:c,value:n?h:g,onChange:M,filterOptions:y,getOptionLabel:S,renderOption:T,freeSolo:x,forcePopupIcon:!0,multiple:n,disableCloseOnSelect:a??n,ListboxComponent:Ce,ListboxProps:{showFilters:d,allSelected:v,someSelected:I,handleSelectAll:k,multiple:n},getLimitTagsText:u??be,disabled:s||l,popupIcon:l?r.jsx(i.CircularProgress,{size:18,color:"inherit"}):r.jsx(Z.ArrowDown,{}),"data-name":"creatable-autocomplete"})}const Bt=b.forwardRef(Dt);function Tt({renderOption:e,disableCloseOnSelect:t=!0,disabled:o,loading:n,showFilters:a,options:s,value:l,onChange:d,getOptionLabel:c,getLimitTagsText:g,...p},u){const{multipleValue:m,allSelected:f,someSelected:x,handleSelectAll:C,handleChange:h,multipleRenderOption:v}=ye({options:s,value:l,onChange:d,getOptionLabel:c});return r.jsx(i.Autocomplete,{...p,ref:u,options:s,value:m,onChange:h,getOptionLabel:c,renderOption:e??v,ListboxComponent:Ce,ListboxProps:{showFilters:a,allSelected:f,someSelected:x,handleSelectAll:C,multiple:!0},multiple:!0,getLimitTagsText:g??be,disableCloseOnSelect:t,disabled:o||n,popupIcon:n?r.jsx(i.CircularProgress,{size:18,color:"inherit"}):r.jsx(Z.ArrowDown,{}),"data-name":"multiple-autocomplete"})}const Rt=b.forwardRef(Tt),Ot=({children:e,disabled:t,value:o,onCopied:n,copyText:a="c4r.button.copy",copiedText:s="c4r.notifications.copiedToClipboard",button:l,buttonLabel:d,buttonProps:c,ariaLabel:g,dataTestId:p,tooltipPlacement:u="top",...m},f)=>{const x=B.useIntl(),C=j.useImperativeIntl(x),[h,v]=b.useState(!1),{copy:I}=J(a,s),k=M=>{M.preventDefault(),I(o).then(()=>{n==null||n(),v(!0)}).catch(console.error)};return r.jsxs(r.Fragment,{children:[r.jsx(i.Tooltip,{title:C.formatMessage({id:a}),leaveDelay:0,placement:u,children:r.jsxs(i.Box,{...m,sx:{cursor:t?void 0:"pointer"},onClick:k,"data-name":"copiable",ref:f,children:[e,l&&r.jsx(L,{...c,disabled:t,icon:r.jsx(D.ContentCopyOutlined,{}),"data-testid":p,"aria-label":g||d,sx:{display:"flex"}})]})}),r.jsx(q,{open:h,autoWidth:!0,closeable:!1,autoHideDuration:4e3,onClose:()=>v(!1),children:C.formatMessage({id:s})})]})},Me=b.forwardRef(Ot);async function je(e){return await navigator.clipboard.writeText(e)}const J=(e="c4r.button.copy",t="c4r.notifications.copiedToClipboard")=>{const[o,n]=b.useState(e);return{message:o,copy:async s=>{await je(s),n(t),setTimeout(()=>n(e),1e3)}}},Ft=i.styled("div",{shouldForwardProp:e=>e!=="variant"})(({variant:e,theme:t})=>({width:"100%",borderRadius:t.spacing(.5),...e==="outlined"&&{backgroundColor:t.palette.background.paper,boxShadow:`inset 0 0 0 1px ${t.palette.divider}`}}));function $t({variant:e="standard",items:t,...o}){return r.jsx(Ft,{...o,variant:e,children:t.map((n,a)=>r.jsxs(i.Accordion,{disabled:n.disabled,defaultExpanded:n.defaultExpanded,onChange:n.onChange,children:[r.jsx(i.AccordionSummary,{"aria-controls":`${a}-content`,id:`${a}-header`,children:n.summary}),r.jsx(i.AccordionDetails,{children:n.content})]},a))})}const ae={large:5,medium:4,small:3,xsmall:2.25},Lt=i.styled(i.Avatar,{shouldForwardProp:e=>e!=="size"&&e!=="disabled"})(({theme:e,size:t="medium",disabled:o=!1})=>({width:e.spacing(ae[t]),height:e.spacing(ae[t]),...e.typography.subtitle1,...t==="large"&&{...e.typography.h6},...t==="small"&&{...e.typography.caption,fontWeight:500},...t==="xsmall"&&{...e.typography.caption,fontWeight:500,svg:{width:j.ICON_SIZE_SMALL,height:j.ICON_SIZE_SMALL}},...o&&{opacity:.6}}));function Et(e){return r.jsx(Lt,{...e})}const Ie=480,Wt=i.styled(i.Snackbar)(({theme:e})=>({bottom:e.spacing(2),right:e.spacing(2),left:e.spacing(2),[e.breakpoints.up("sm")]:{bottom:e.spacing(4),right:"auto",left:"50%",width:"100%",maxWidth:`${Ie}px`}})),Ht=i.styled(i.Box,{shouldForwardProp:e=>e!=="autoWidth"})(({autoWidth:e,theme:t})=>({minWidth:"100%",maxWidth:`${Ie}px`,margin:t.spacing(0,1),...e&&{minWidth:"auto"},[t.breakpoints.up("sm")]:{minWidth:t.spacing(40),...e&&{minWidth:"auto"}}})),qt=i.styled(U.Alert,{shouldForwardProp:e=>!["hasActions","closeable"].includes(e)})(({hasActions:e,closeable:t,icon:o,theme:n})=>({position:"relative",display:"flex",flexWrap:"wrap",columnGap:n.spacing(1),rowGap:n.spacing(.25),padding:n.spacing(1),paddingLeft:n.spacing(2),color:n.palette.common.white,backgroundColor:n.palette.common.black,".MuiAlert-message":{padding:n.spacing(.75,0)},".MuiAlert-message .MuiTypography-root, .MuiAlert-icon":{color:n.palette.common.white},".MuiAlert-message .MuiTypography-root:not(.MuiAlertTitle-root)":{...n.typography.body2},".MuiAlert-message .MuiCircularProgress-circle":{color:n.palette.common.white},".MuiAlert-icon":{position:"absolute",top:n.spacing(1),left:n.spacing(1.5),display:"flex",alignItems:"center",justifyContent:"center",width:n.spacing(3),marginTop:n.spacing(.5)},"&.MuiAlert-standardError":{backgroundColor:n.palette.error.main},...o!==!1&&{paddingLeft:n.spacing(5.5)},...t&&{paddingRight:n.spacing(6)},...!t&&!e&&{paddingRight:n.spacing(1.5)},...e&&{".MuiAlert-message":{minWidth:"fit-content",padding:n.spacing(.75,0)}}})),Pt=i.styled(i.Box)(({theme:e})=>({position:"absolute",top:e.spacing(1),right:e.spacing(1),"& button:hover, & button:focus-visible":{backgroundColor:e.palette.white[8]},svg:{color:e.palette.white[60]}}));function q({severity:e="neutral",autoHideDuration:t=j.NOTIFICATION_DURATION_IN_MS,closeable:o=!0,children:n,title:a,action:s,open:l,onClose:d=()=>{},autoWidth:c,icon:g,...p}){const u=B.useIntl(),m=j.useImperativeIntl(u),x=g===!1||e==="neutral"&&!g,h=t===null?null:t||j.NOTIFICATION_DURATION_IN_MS;return r.jsx(i.Portal,{children:r.jsx(Wt,{...p,open:l,autoHideDuration:h,onClose:d,TransitionComponent:c?i.Fade:i.Slide,"data-auto-width":c,children:r.jsxs(Ht,{sx:{position:"relative"},autoWidth:c,children:[r.jsx(qt,{severity:e,action:s,icon:x?!1:g,elevation:6,hasActions:!!s,closeable:o,title:a,children:n}),o&&r.jsx(Pt,{children:r.jsx(L,{color:"default",onClick:v=>d(v,"timeout"),icon:r.jsx(D.CloseOutlined,{}),tooltip:m.formatMessage({id:"c4r.button.close"})})})]})})})}const _t=i.styled("div")(({theme:e})=>({display:"flex",alignItems:"center",height:j.APPBAR_SIZE,marginRight:e.spacing(1.5)})),Nt=i.styled(i.IconButton)(({theme:e})=>({marginRight:e.spacing(1),"&.MuiButtonBase-root svg path":{fill:e.palette.brand.appBarContrastText}})),zt=i.styled(i.Divider)(({theme:e})=>({borderColor:i.alpha(e.palette.brand.appBarContrastText,.12)}));function Gt({onClickMenu:e}){return r.jsx(i.Box,{sx:{display:{md:"none",xs:"block"}},children:r.jsxs(_t,{children:[r.jsx(Nt,{onClick:e,children:r.jsx(D.MenuOutlined,{})}),r.jsx(zt,{orientation:"vertical",flexItem:!0})]})})}const Vt=i.styled("div")(({theme:e})=>({display:"flex",marginRight:e.spacing(1.5),"& a":{display:"flex"},"& svg, & img":{width:e.spacing(4),height:e.spacing(4)}}));function Ut({logo:e}){return r.jsx(Vt,{children:e})}const Zt=i.styled(j.Typography)({display:"flex",alignItems:"center",whiteSpace:"nowrap"});function Yt({text:e}){const t=i.useTheme();return r.jsx(Zt,{component:"span",variant:"subtitle1",color:t.palette.brand.appBarContrastText,children:e})}const Jt=i.styled(j.Typography)(({theme:e})=>({display:"flex",alignItems:"center","&::before":{content:'"/"',margin:e.spacing(0,1),opacity:.6,color:e.palette.brand.appBarContrastText}}));function Kt({text:e}){const t=i.useTheme();return r.jsx(Jt,{component:"span",variant:"body2",weight:"strong",color:t.palette.brand.appBarContrastText,children:e})}const Xt=i.styled(i.AppBar)(({theme:e})=>({backgroundColor:e.palette.brand.appBarMain,"& .MuiTypography-root":{color:e.palette.brand.appBarContrastText},"& .MuiIconButton-root path":{fill:e.palette.brand.appBarContrastText}})),Qt=i.styled("div")(({theme:e})=>({display:"flex",alignItems:"center",maxWidth:"calc(100% - 300px)",overflow:"hidden",[e.breakpoints.down("sm")]:{minWidth:"192px"}})),eo=i.styled("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",flex:1,marginLeft:e.spacing(1)}));function to({children:e,brandLogo:t,brandText:o,secondaryText:n,showBurgerMenu:a=!1,onClickMenu:s,...l}){return r.jsx(Xt,{...l,children:r.jsxs(i.Toolbar,{children:[r.jsxs(Qt,{children:[a&&r.jsx(Gt,{onClickMenu:s}),t&&r.jsx(Ut,{logo:t}),o&&r.jsx(Yt,{text:o}),n&&r.jsx(Kt,{text:n})]}),r.jsx(eo,{children:e})]})})}const oo=i.styled(i.Box,{shouldForwardProp:e=>!["size","variant"].includes(e)})(({size:e,variant:t,theme:o})=>({position:"absolute",right:o.spacing(5.75),...e==="small"&&{right:o.spacing(4),top:"3px"},...t==="standard"&&{right:o.spacing(4.75),...e==="small"&&{right:o.spacing(3.5)}}}));function K({size:e,variant:t,...o}){const n=B.useIntl(),a=j.useImperativeIntl(n);return r.jsx(oo,{size:e,variant:t,children:r.jsx(i.IconButton,{...o,size:e,"aria-label":a.formatMessage({id:"c4r.form.clearSelection"})})})}const ro=i.styled(i.Box,{shouldForwardProp:e=>!["size","variant","readOnly"].includes(e)})(({size:e,variant:t,readOnly:o,theme:n})=>({".MuiInputBase-root":{"& .clearButton svg":{color:n.palette.text.hint},...e==="small"&&{paddingRight:`${n.spacing(1)} !important`},...e==="medium"&&{"& .MuiInputAdornment-root":{"& .MuiIconButton-edgeEnd":{marginRight:n.spacing(-1)}}},...t==="standard"&&{paddingRight:`${n.spacing(1)} !important`,...e==="small"&&{paddingRight:`${n.spacing(.5)} !important`}},...o&&{"& .MuiInputAdornment-root":{"& svg":{color:n.palette.text.disabled}}}}}));function X({children:e,size:t,variant:o,readOnly:n,...a}){return r.jsx(ro,{...a,size:t,variant:o,readOnly:n,children:e})}function z({handleClear:e,variant:t="outlined",size:o="small",label:n,labelHelpTooltip:a,type:s,helperText:l,placeholder:d,slotProps:c,slots:g,error:p,showCalendar:u=!0,readOnly:m,"aria-label":f,"data-testid":x,...C}){const h=B.useIntl(),v=j.useImperativeIntl(h);return r.jsx(i.Box,{className:"CartoDatePicker-root","data-testid":"date-picker",children:r.jsx(X,{size:o,variant:t,readOnly:m,"data-name":"date-picker","aria-label":f,"data-testid":x,children:r.jsx(Ee.DatePicker,{...C,label:n&&r.jsx(E,{label:n,type:s,icon:a&&r.jsx(i.Tooltip,{title:a,children:r.jsx(D.HelpOutline,{htmlColor:"text.secondary"})})}),slotProps:{textField:{variant:t,helperText:l,placeholder:d,size:o,error:p??void 0,inputProps:{"data-testid":"date-picker-input"}},field:{clearable:!!e,onClear:e},...c},slots:{clearButton:I=>r.jsx(K,{...I,size:o,variant:t}),openPickerButton:I=>r.jsx(i.IconButton,{...I,size:o,"aria-label":v.formatMessage({id:"c4r.form.chooseDate"})}),...g},disableOpenPicker:!u,readOnly:m})})})}const no=i.styled(i.Box,{shouldForwardProp:e=>!["isSelected","isStartDate","isEndDate","isSelectedMonth","isLastDay","isFirstDay"].includes(e)})(({theme:e,isSelected:t,isStartDate:o,isEndDate:n,isSelectedMonth:a,isLastDay:s,isFirstDay:l})=>({position:"relative",margin:e.spacing(.25),"& .MuiPickersDay-root":{margin:0},...t&&a&&{"&::before":{content:'""',position:"absolute",top:0,right:"-2px",bottom:0,left:"-2px",backgroundColor:e.palette.primary.background,...(o||l)&&{left:0,borderRadius:`${e.shape.borderRadius}px 0 0 ${e.shape.borderRadius}px`},...(n||s)&&{right:0,borderRadius:`0 ${e.shape.borderRadius}px ${e.shape.borderRadius}px 0`}},"&:first-of-type::before":{left:0,borderRadius:`${e.shape.borderRadius}px 0 0 ${e.shape.borderRadius}px`},"&:last-of-type::before":{right:0,borderRadius:`0 ${e.shape.borderRadius}px ${e.shape.borderRadius}px 0`},...l&&{"&:last-of-type::before":{left:0,right:0,borderRadius:e.shape.borderRadius}},...s&&{"&:first-of-type::before":{left:0,right:0,borderRadius:e.shape.borderRadius}},"& .MuiPickersDay-today":{borderColor:`${e.palette.default.outlinedBorder} !important`,...(o||n)&&{boxShadow:`0 0 0 1px inset ${e.palette.background.paper}`}},"&::after":{content:'""',position:"absolute",top:0,right:0,bottom:0,left:0,backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadius,transition:"background-color 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"},"&:hover::after":{backgroundColor:e.palette.primary.relatedLight}}})),io=i.styled(We.PickersDay,{shouldForwardProp:e=>e!=="isDateRangeLimit"})(({theme:e,isDateRangeLimit:t})=>({"&.MuiPickersDay-root":{position:"relative",zIndex:1,"&.Mui-selected":{color:e.palette.text.primary},...t&&{"&.Mui-selected":{backgroundColor:`${e.palette.primary.main} !important`,color:e.palette.primary.contrastText,"&:hover":{backgroundColor:`${e.palette.primary.dark} !important`}}}}})),le=(e,t)=>!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate();function se({day:e,startDate:t,endDate:o,selectedMonth:n,...a}){const s=!!(t&&le(t,e)),l=!!(o&&le(o,e)),d=!!(t&&o&&e.getTime()>=t.getTime()&&e.getTime()<=o.getTime()),c=e.getDate()===1,g=e.getDate()===new Date(e.getFullYear(),e.getMonth()+1,0).getDate(),p=!!(n&&e.getMonth()===n.getMonth());return r.jsx(no,{isSelected:d,isStartDate:s,isEndDate:l,isSelectedMonth:p,isLastDay:g,isFirstDay:c,children:r.jsx(io,{...a,day:e,selected:d||s||l,isDateRangeLimit:s||l,"data-name":"pickers-day"})})}const ao=i.styled(i.Box,{shouldForwardProp:e=>!["variant"].includes(e)})(({variant:e,theme:t})=>({display:"flex",gap:e==="standard"?t.spacing(1):"1px","& .CartoDatePicker-root":{"&:first-of-type":{".MuiInputBase-root":{borderRadius:t.spacing(.5,0,0,.5),boxShadow:`1px 0 0 0 ${t.palette.default.outlinedBorder}`,...e==="outlined"&&{"&:not(:hover):not(.Mui-focused):not(.Mui-error) .MuiOutlinedInput-notchedOutline":{borderRightColor:"transparent"}},...e==="filled"&&{"&::before, &::after":{borderRadius:t.spacing(.5,0,0,.5)}},...e==="standard"&&{boxShadow:"none",borderRadius:0}}},"&:last-of-type":{".MuiInputBase-root":{borderRadius:t.spacing(0,.5,.5,0),...e==="outlined"&&{"&:not(:hover):not(.Mui-focused):not(.Mui-error) .MuiOutlinedInput-notchedOutline":{borderLeftColor:"transparent"}},...e==="filled"&&{"&::before, &::after":{borderRadius:t.spacing(0,.5,.5,0)}},...e==="standard"&&{borderRadius:0}}}}}));function lo({globalHelperText:e,error:t,variant:o="outlined",startProps:n,endProps:a,"aria-label":s,"data-testid":l,...d}){const c=B.useIntl(),g=j.useImperativeIntl(c),[p,u]=b.useState(!1),[m,f]=b.useState(!1),[x,C]=b.useState((n==null?void 0:n.value)||null),[h,v]=b.useState((a==null?void 0:a.value)||null),[I,k]=b.useState((a==null?void 0:a.value)??(n==null?void 0:n.value)??new Date),M=t??(n==null?void 0:n.error)??(a==null?void 0:a.error),y=(w,R)=>{C(w),n!=null&&n.onChange&&n.onChange(w,R),w&&R.validationError===null&&!m&&R.trigger===null&&(f(!1),u(!0))},S=(w,R)=>{v(w),a!=null&&a.onChange&&a.onChange(w,R)},T=()=>{f(!0),u(!1),setTimeout(()=>{k(x??new Date)},120)},A=()=>{f(!1),u(!0),setTimeout(()=>{k(h??x??new Date)},120)},O=()=>{f(!1),u(!0),setTimeout(()=>{k(h??x??new Date)},120)};return r.jsxs(i.Box,{children:[r.jsxs(ao,{variant:o,"data-name":"date-range-picker","aria-label":s,"data-testid":l,children:[r.jsx(z,{...d,...n,value:(n==null?void 0:n.value)??x,maxDate:h??void 0,label:(n==null?void 0:n.label)??g.formatMessage({id:"c4r.form.startDate"}),slotProps:{popper:{placement:"bottom-start","aria-label":g.formatMessage({id:"c4r.form.startDateCalendar"})},...n==null?void 0:n.slotProps},slots:{openPickerIcon:D.TodayOutlined,day:w=>r.jsx(se,{...w,startDate:x,endDate:h,selectedMonth:I}),...n==null?void 0:n.slots},error:(n==null?void 0:n.error)??t,open:m,onChange:y,onOpen:T,onClose:A,onMonthChange:w=>k(w),variant:o}),r.jsx(z,{...d,...a,value:(a==null?void 0:a.value)??h,minDate:x??void 0,slotProps:{popper:{"aria-label":g.formatMessage({id:"c4r.form.endDateCalendar"})},...a==null?void 0:a.slotProps},slots:{day:w=>r.jsx(se,{...w,startDate:x,endDate:h,selectedMonth:I}),...a==null?void 0:a.slots},label:(a==null?void 0:a.label)??g.formatMessage({id:"c4r.form.endDate"}),error:(a==null?void 0:a.error)??t,open:p,onOpen:O,onClose:()=>u(!1),onChange:S,onMonthChange:w=>k(w),variant:o})]}),e&&r.jsx(i.FormHelperText,{error:M,children:e})]})}const ve=(e,t,o,n)=>{const a=e==null?void 0:e.includes("hours"),s=e==null?void 0:e.includes("seconds"),l=e==null?void 0:e.includes("minutes"),d=(e==null?void 0:e.length)===1&&e[0]==="hours";if(n)return n;const c=[];return t&&c.push("MM/dd/yyyy "),a&&c.push(o?"hh":"HH"),d||c.push(":"),l&&c.push("mm"),s&&c.push(":ss"),o&&c.push(" a"),c.join("")};function so({handleClear:e,variant:t="outlined",size:o="small",label:n,labelHelpTooltip:a,type:s,helperText:l,placeholder:d,error:c,showClock:g=!0,readOnly:p,slotProps:u,slots:m,ampm:f=!0,views:x=["hours","minutes"],format:C,"data-testid":h,"aria-label":v,...I}){const k=B.useIntl(),M=j.useImperativeIntl(k),y=b.useRef(null),[S,T]=b.useState(0);return b.useEffect(()=>{if(!y.current)return;const A=new ResizeObserver(O=>{var R;const w=(R=O[0])==null?void 0:R.contentRect.width;w&&T(w)});return A.observe(y.current),()=>{A.disconnect()}},[]),r.jsx(X,{size:o,variant:t,readOnly:p,"data-name":"time-picker","data-testid":h??"time-picker","aria-label":v,children:r.jsx(He.TimePicker,{...I,ref:y,label:r.jsx(E,{label:n??M.formatMessage({id:"c4r.form.time"}),type:s,icon:a&&r.jsx(i.Tooltip,{title:a,children:r.jsx(D.HelpOutline,{htmlColor:"text.secondary"})})}),views:["hours"],format:ve(x,!1,f,C),slotProps:{textField:{variant:t,helperText:l,placeholder:d,size:o,error:c??void 0,inputProps:{"data-testid":"time-picker-input"}},field:{clearable:!!e,onClear:e},popper:{placement:"bottom-end"},layout:{sx:{width:S}},...u},slots:{clearButton:A=>r.jsx(K,{...A,size:o,variant:t}),openPickerButton:A=>r.jsx(i.IconButton,{...A,size:o,"aria-label":M.formatMessage({id:"c4r.form.chooseDate"})}),...m},disableOpenPicker:!g,readOnly:p,ampm:f})})}function co({handleClear:e,variant:t="outlined",size:o="small",label:n,labelHelpTooltip:a,type:s,helperText:l,placeholder:d,error:c,showCalendar:g=!0,readOnly:p,slotProps:u,slots:m,ampm:f=!0,views:x=["hours","minutes"],format:C,"data-testid":h,"aria-label":v,...I}){const k=B.useIntl(),M=j.useImperativeIntl(k);return r.jsx(X,{size:o,variant:t,readOnly:p,"data-name":"date-time-picker","data-testid":h??"date-time-picker","aria-label":v,children:r.jsx(qe.DateTimePicker,{...I,label:r.jsx(E,{label:n??M.formatMessage({id:"c4r.form.time"}),type:s,icon:a&&r.jsx(i.Tooltip,{title:a,children:r.jsx(D.HelpOutline,{htmlColor:"text.secondary"})})}),views:["year","month","day","hours"],format:ve(x,!0,f,C),slotProps:{textField:{variant:t,helperText:l,placeholder:d,size:o,error:c??void 0,inputProps:{"data-testid":"date-time-picker-input"}},field:{clearable:!!e,onClear:e},...u},slots:{clearButton:y=>r.jsx(K,{...y,size:o,variant:t}),openPickerButton:y=>r.jsx(i.IconButton,{...y,size:o,"aria-label":M.formatMessage({id:"c4r.form.chooseDate"})}),...m},disableOpenPicker:!g,readOnly:p,ampm:f})})}const uo=[{outlinedBullet:!1,value:""}],po=i.styled("ul")(({theme:e})=>({listStyle:"none",paddingLeft:0,margin:e.spacing(.5,0,0,0)})),go=i.styled("li")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between","&:not(:last-child)":{marginBottom:e.spacing(.5)}})),fo=i.styled("span")(({theme:e})=>({width:e.spacing(1),height:e.spacing(1),marginRight:e.spacing(.5),border:`2px solid ${e.palette.qualitative.bold[1]}`,borderRadius:"50%",backgroundColor:e.palette.qualitative.bold[1]})),xo=i.styled(j.Typography)(({theme:e})=>({minWidth:e.spacing(10),marginRight:e.spacing(1.5)}));function mo({items:e=uo,title:t}){return r.jsxs(r.Fragment,{children:[t&&r.jsx(j.Typography,{color:"inherit",variant:"caption",weight:"medium",children:t}),r.jsx(po,{children:e.map((o,n)=>r.jsxs(go,{children:[r.jsx(fo,{style:{backgroundColor:`${o.outlinedBullet?"transparent":o.color}`,borderColor:o.color}}),o.category&&r.jsx(xo,{color:"inherit",variant:"caption",children:o.category}),r.jsx(j.Typography,{color:"inherit",variant:"caption",weight:"medium",children:o.value})]},n))})]})}const bo=i.styled(i.Box,{shouldForwardProp:e=>!["withGutter","disabled"].includes(e)})(({withGutter:e,disabled:t,theme:o})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",gap:o.spacing(1),...e&&{height:o.spacing(4),padding:o.spacing(0,.5),borderTop:`1px solid ${o.palette.divider}`,borderBottom:"1px solid transparent"},...t&&{backgroundColor:o.palette.default.background}}));function Q({onClickFooter:e,labelIdButtonFooter:t,ariaLabelButtonFooter:o,disabledButtonFooter:n,withGutter:a=!0,showSnackbar:s,onCloseSnackbar:l,loading:d,disabled:c,...g}){const p=B.useIntl(),u=j.useImperativeIntl(p);return e?r.jsxs(bo,{withGutter:a,disabled:c,"data-name":"code-area-footer","data-gutter":a,children:[r.jsx(H,{variant:"text",...g,loading:d,onClick:e,"aria-label":o||"save-form-button",disabled:c||n,children:u.formatMessage({id:t||"c4r.button.save"})}),r.jsx(q,{open:s,autoWidth:!0,closeable:!1,autoHideDuration:4e3,onClose:l,children:u.formatMessage({id:"c4r.notifications.changesSaved"})})]}):null}const de=i.styled(i.Box,{shouldForwardProp:e=>e!=="size"})(({size:e,theme:t})=>({position:"absolute",top:0,right:t.spacing(.5),zIndex:1,display:"flex",justifyContent:"flex-end",gap:t.spacing(1),padding:e==="small"?t.spacing(.5):t.spacing(1,2,2),paddingRight:e==="small"?0:t.spacing(1.5)}));function ke({disabled:e,copyValue:t,onClickExpand:o,size:n}){const a=B.useIntl(),s=j.useImperativeIntl(a),l=!!o,d=t!==void 0,c=l&&d,{copy:g}=J(),[p,u]=b.useState(!1),[m,f]=b.useState(null),x=!!m,C=I=>{f(I.currentTarget)},h=()=>{f(null)},v=I=>{I.preventDefault(),t&&g(t).then(()=>{u(!0)}).catch(console.error)};return!l&&!d?null:c?r.jsxs(r.Fragment,{children:[r.jsxs(de,{size:n,"data-size":n,"data-name":"code-area-header",children:[r.jsx(L,{color:"default",size:n,icon:r.jsx(D.MoreVertOutlined,{}),disabled:e,tooltip:s.formatMessage({id:"c4r.button.showOptions"}),tooltipPlacement:"top","aria-controls":x?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":x?"true":void 0,onClick:C}),r.jsxs(ge,{anchorEl:m,open:x,onClose:h,id:"menu",MenuListProps:{"aria-labelledby":"menu-button"},"aria-label":"Code area actions",transformOrigin:{vertical:"top",horizontal:"right"},anchorOrigin:{vertical:"bottom",horizontal:"right"},children:[r.jsxs($.MenuItem,{onClick:v,disabled:e,id:"copy",children:[r.jsx(i.ListItemIcon,{children:r.jsx(D.ContentCopyOutlined,{})}),r.jsx(i.ListItemText,{children:s.formatMessage({id:"c4r.button.copy"})})]}),r.jsxs($.MenuItem,{onClick:o,disabled:e,id:"expand",children:[r.jsx(i.ListItemIcon,{children:r.jsx(N.OpenDiagonallyRight,{})}),r.jsx(i.ListItemText,{children:s.formatMessage({id:"c4r.button.expand"})})]})]})]}),r.jsx(q,{open:p,autoWidth:!0,closeable:!1,autoHideDuration:4e3,onClose:()=>u(!1),children:s.formatMessage({id:"c4r.notifications.copiedToClipboard"})})]}):r.jsxs(de,{size:n,"data-size":n,"data-name":"code-area-header",children:[d&&r.jsx(Me,{disabled:e,value:t,button:!0,buttonProps:{size:n}}),l&&r.jsx(L,{color:"default",size:n,onClick:o,icon:r.jsx(N.OpenDiagonallyRight,{}),disabled:e,tooltip:s.formatMessage({id:"c4r.button.expand"}),tooltipPlacement:"top"})]})}const ho=i.styled(i.Box,{shouldForwardProp:e=>!["size","height"].includes(e)})(({size:e,height:t,theme:o})=>({position:"relative",flex:1,display:"flex",cursor:"text",":focus-within &, .error &":{marginBottom:0},"& .react-codemirror2":{width:"100%",height:"100% !important",position:"relative"},"& .CodeMirror":{position:"absolute",top:0,bottom:0,left:0,right:0,zIndex:1,height:"100% !important",backgroundColor:o.palette.background.default},"& .CodeMirror-code":{"&> div:first-of-type .CodeMirror-line":{marginTop:o.spacing(-.25)}},"& .CodeMirror-scroll":{paddingLeft:o.spacing(1),paddingRight:o.spacing(1),backgroundColor:"transparent"},"& .CodeMirror-lines":{padding:o.spacing(1,0)},"& .CodeMirror pre.CodeMirror-line, & .CodeMirror pre.CodeMirror-line-like":{boxSizing:"border-box",paddingLeft:0,paddingTop:o.spacing(.25),lineHeight:1.2},"& .CodeMirror-linenumbers":{width:`${o.spacing(4.5)} !important`},"& .CodeMirror-linenumber":{width:`${o.spacing(4.5)} !important`,height:o.spacing(2),marginBottom:`${o.spacing(-.25)} !important`,paddingTop:o.spacing(.25),paddingRight:o.spacing(1.25),boxSizing:"border-box !important",color:o.palette.text.secondary},"& .CodeMirror-activeline-background, & .CodeMirror-activeline-gutter":{backgroundColor:"transparent"},"& .CodeMirror-gutter-background":{width:`${o.spacing(6.25)} !important`},"& .CodeMirror-sizer":{paddingTop:o.spacing(.25),marginLeft:`${o.spacing(5.25)} !important`,borderRightWidth:`${o.spacing(4)} !important`},"& .CodeMirror-matchingbracket":{color:`${F.lime[900]} !important`,backgroundColor:o.palette.black[4],boxShadow:`0 0 0 1px ${o.palette.text.hint}`},"& .CodeMirror-selected, & .CodeMirror-focused .CodeMirror-selected, & .CodeMirror-line::selection, & .CodeMirror-line > span::selection, & .CodeMirror-line > span > span::selection":{background:`${i.alpha(F.blue[800],.2)} !important`},"& .CodeMirror-gutters":{borderRight:0,color:o.palette.text.secondary,backgroundColor:o.palette.default.background},"& .CodeMirror-gutter-elt":{"& .CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded":{marginLeft:o.spacing(-1),"&:after":{fontSize:o.typography.caption.fontSize}}},"& .CodeMirror-placeholder":{paddingTop:"0 !important",marginLeft:`${o.spacing(-.5)} !important`,marginBottom:`${o.spacing(-.25)} !important`,color:`${o.palette.text.hint} !important`},"& .MuiLinearProgress-root":{height:"2px",position:"absolute",top:0,left:0,right:0,zIndex:1},"& .pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like, & .cm-bracket":{color:o.palette.text.primary},"& .CodeMirror pre.CodeMirror-placeholder":{color:o.palette.text.hint},"& .CodeMirror-composing":{border:0},"& .cm-keyword, & .cm-string, & .cm-string-2, & .cm-other":{color:F.purple[500]},"& .cm-operator, & .cm-tag, & .cm-attribute":{color:F.teal[700]},"& .cm-number, & .cm-property, & .cm-builtin":{color:F.red[700]},"& .cm-comment":{color:o.palette.text.secondary},"& .cm-variable":{color:F.lime[900]},"& .cm-variable-2":{color:o.palette.text.primary},"& .cm-punctuation, & .cm-def, ":{color:F.blue[800]},"& .cm-variable-3, & .cm-type":{color:F.indigo[800]},"& .CodeMirror-foldmarker":{textShadow:"none",color:o.palette.primary.main},"& .cm-error":{color:o.palette.error.main},"& .CodeMirror-selected":{background:F.blue[800]},"& .cm-header-1":{fontSize:o.typography.h2.fontSize},"& .cm-header-2":{fontSize:o.typography.h3.fontSize},"& .cm-header-3":{fontSize:o.typography.h4.fontSize},"& .cm-header-4":{fontSize:o.typography.h5.fontSize},"& .cm-header-5":{fontSize:o.typography.h6.fontSize},...e==="small"&&{"& .CodeMirror":{height:t||"auto",minHeight:o.spacing(9),...o.typography.code3}}}));function yo(e){const t=e.split(`
2
+ `),o=[],n=[];for(t.forEach((a,s)=>{const l=s+1;if(a.trim()==="-- BEGIN CONTROL CODE")n.push(l);else if(a.trim()==="-- END CONTROL CODE"&&n.length>0){const d=n.pop();o.push({from:d,to:l})}});n.length>0;){const a=n.pop();o.push({from:a,to:t.length})}return o}function Se({options:e,value:t,defaultValue:o,id:n,onEditorDidMount:a,onChange:s,onBlur:l,onFocus:d,placeholder:c,disabled:g,size:p="small",height:u,"data-testid":m,"aria-label":f="Code editor text area",...x}){var M;const C=b.useRef(),h={mode:"sql",theme:"light",lineNumbers:!0,lineWrapping:!0,extraKeys:{"Ctrl-Space":"autocomplete"},placeholder:c,disabled:g,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],styleActiveLine:{nonEmpty:!0},styleActiveSelected:!0,matchBrackets:!0,foldOptions:{minFoldSize:1,scanUp:!1},...e},[v,I]=b.useState(null);b.useEffect(()=>()=>{I(null)},[]);const k=b.useCallback(({from:y,to:S})=>{v.foldCode(0,{rangeFinder:()=>{if(S)return{from:{line:y-1,ch:0},to:{line:S-1,ch:0}}}},"fold")},[v]);return b.useEffect(()=>{if(!t||!v)return;const y=yo(t);if(y.length)for(const S of y)k(S)},[t,k,v]),r.jsxs(ho,{size:p,height:u,id:n,"data-size":p,"data-height":u,"data-mode":typeof(e==null?void 0:e.mode)=="object"&&((M=e.mode)!=null&&M.name)?e.mode.name:e==null?void 0:e.mode,"data-fold-gutter":e==null?void 0:e.foldGutter,"data-testid":m,"aria-label":f,"data-name":"code-area-input",children:[t!==void 0&&r.jsx(ie.Controlled,{...x,value:t,editorDidMount:y=>{C.current=y,I(y),a==null||a(y)},options:h,onBeforeChange:(y,S,T)=>{s==null||s(T)},onBlur:y=>{l==null||l(y.getValue())},onFocus:d}),o!==void 0&&r.jsx(ie.UnControlled,{...x,value:o,options:h,onBlur:y=>{l==null||l(y.getValue())},onFocus:d})]})}const Co=i.styled(i.FormControl)(()=>({display:"flex",flexDirection:"column",flex:1})),Mo=i.styled(i.Box,{shouldForwardProp:e=>!["variant","error","disabled","readOnly","lineNumbers","fullScreen"].includes(e)})(({variant:e,error:t,disabled:o,readOnly:n,lineNumbers:a,fullScreen:s,theme:l})=>({position:"relative",overflow:"auto",display:"flex",flexDirection:"column",flex:1,width:"100%",minHeight:0,background:l.palette.background.paper,".CodeMirror-focused .CodeMirror-activeline":{"& .CodeMirror-activeline-background, & .CodeMirror-activeline-gutter":{background:l.palette.primary.background}},...s&&{maxWidth:"100%",maxHeight:"100vh",height:"100vh"},...(e==="filled"||e==="outlined")&&{borderRadius:l.spacing(.5),transition:l.transitions.create("background-color",{easing:l.transitions.easing.easeInOut,duration:l.transitions.duration.shortest}),"&:after":{content:'""',position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",border:`1px solid ${l.palette.default.outlinedBorder}`,borderRadius:l.spacing(.5),transition:l.transitions.create("border-color",{easing:l.transitions.easing.easeInOut,duration:l.transitions.duration.shortest})},"&:hover:after":{borderColor:l.palette.common.black},"&:focus-within":{overflow:"hidden","&:after":{borderWidth:"2px",borderColor:l.palette.primary.main}},...t&&{"&.MuiBox-root:after":{borderWidth:"2px",borderColor:l.palette.error.main}}},...e==="filled"&&{backgroundColor:l.palette.background.paper,"&.codeArea-filled:after":{borderColor:"transparent"},"&.codeArea-filled:hover:after":{borderColor:l.palette.common.black},"&.codeArea-filled:focus-within:after":{borderWidth:"2px",borderColor:l.palette.primary.main},"& .CodeMirror":{backgroundColor:l.palette.default.background,"&:focus-within":{backgroundColor:l.palette.background.paper}},...t&&{borderColor:l.palette.error.main,"& .CodeMirror":{backgroundColor:l.palette.default.background},"&:hover, &:focus-within, &.codeArea-filled:after, &.codeArea-filled:hover:after, &.codeArea-filled:focus-within:after":{borderColor:l.palette.error.main},"&:focus-within":{"& .CodeMirror":{backgroundColor:l.palette.background.paper}}}},...n&&{"& .CodeMirror":{backgroundColor:l.palette.default.background,".CodeMirror-cursors":{visibility:"hidden !important"}},...e==="filled"&&{backgroundColor:l.palette.background.paper}},...o&&{pointerEvents:"none","& .CodeMirror":{color:l.palette.text.disabled,backgroundColor:l.palette.default.background,"& span, .CodeMirror-linenumber, .CodeMirror-guttermarker-subtle":{color:l.palette.text.disabled}},...e==="filled"&&{backgroundColor:l.palette.background.paper}},...!a&&{"& .CodeMirror-scroll .CodeMirror-sizer":{marginLeft:`${l.spacing(1)} !important`},"& .CodeMirror-gutter-background":{width:`${l.spacing(2)} !important`}}})),jo=i.styled(i.Box,{shouldForwardProp:e=>e!=="hasActions"})(({theme:e,hasActions:t})=>({flex:"1 1 auto",overflowY:"auto",display:"flex",flexDirection:"column",...t&&{".CodeMirror-line":{paddingRight:`${e.spacing(4)} !important`}}})),Io=i.styled(D.HelpOutline)(({theme:e})=>({width:j.ICON_SIZE_SMALL,height:j.ICON_SIZE_SMALL,fill:e.palette.text.secondary}));function we({value:e,defaultValue:t,validate:o,onChange:n,onBlur:a,onFocus:s,label:l,labelHelpTooltip:d,placeholder:c,type:g,disabled:p,copyValue:u,helperText:m,error:f,size:x="small",variant:C="outlined",onClickExpand:h,onClickFooter:v,disabledButtonFooter:I,labelIdButtonFooter:k,ariaLabelButtonFooter:M,options:y,id:S="code-area-field",saveLoading:T,showSaveSnackbar:A,onCloseSaveSnackbar:O,fullScreen:w,isExpanded:R,...W}){const[$e,re]=b.useState(!1),ne=(y==null?void 0:y.readOnly)??!1,Le=(y==null?void 0:y.lineNumbers)??!0;return r.jsxs(Co,{size:x,error:f,disabled:p,"aria-disabled":p,"data-size":x,"data-full-screen":w,"data-variant":C,"data-name":"code-area-field",children:[l&&r.jsx(i.InputLabel,{htmlFor:S,disabled:p,error:f,focused:$e,shrink:!0,id:`${S}-label`,children:r.jsx(E,{label:l,type:g,icon:d?r.jsx(i.Tooltip,{title:d,children:r.jsx(Io,{"aria-label":typeof d=="string"?d:void 0})}):void 0})}),r.jsxs(Mo,{variant:C,error:!!f,disabled:p,readOnly:ne,lineNumbers:Le,className:C==="filled"?"codeArea-filled":"",fullScreen:w,children:[r.jsx(ke,{onClickExpand:h,copyValue:u,disabled:p,size:R?"medium":"small"}),r.jsx(jo,{hasActions:!!u||!!h,children:r.jsx(Se,{...W,id:S,disabled:p,value:e,defaultValue:t,placeholder:c,onFocus:()=>{re(!0),s==null||s()},onBlur:P=>{a&&a(P),n&&n(P),o&&o(P),re(!1)},onChange:n,size:x,options:{...ne&&{styleActiveLine:!1,matchBrackets:!1},...y},"aria-labelledby":l?`${S}-label`:void 0})}),r.jsx(Q,{labelIdButtonFooter:k,ariaLabelButtonFooter:M,onClickFooter:v,disabled:p,disabledButtonFooter:I,size:"small",loading:!!T,showSnackbar:A,onCloseSnackbar:O})]}),m&&r.jsx(i.FormHelperText,{children:m})]})}const vo=i.styled(i.Box)(({theme:e})=>({position:"relative",marginBottom:"1px",padding:e.spacing(1.5,2,1.5,5.5),"&:before":{content:'""',position:"absolute",top:0,left:0,bottom:0,zIndex:1,width:e.spacing(5),background:e.palette.background.default},"&:after":{content:'""',position:"absolute",top:0,right:0,left:0,bottom:0,zIndex:2,background:"linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 40%)"},".MuiFormHelperText-root":{marginTop:0}})),ko=i.styled(i.Box)(({theme:e})=>({position:"relative",zIndex:3,display:"flex",alignItems:"center",gap:e.spacing(1)}));function Ae({children:e,hasDivider:t}){const o=i.useTheme();return e?r.jsxs(r.Fragment,{children:[r.jsx(vo,{children:r.jsxs(ko,{children:[r.jsx(D.ErrorOutline,{htmlColor:o.palette.error.main}),r.jsx(i.FormHelperText,{error:!0,children:e})]})}),t&&r.jsx(i.Divider,{})]}):null}const ce={small:"480px",medium:"640px",large:"640px",xlarge:"720px"},G={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"}},V=i.styled(i.Paper,{shouldForwardProp:e=>!["fullScreen","height","width","hasForm"].includes(e)})(({fullScreen:e,height:t,width:o,hasForm:n,size:a="small",theme:s})=>({"&.MuiPaper-root":{position:"relative",display:"flex",flexDirection:"column",margin:s.spacing(5),borderRadius:s.spacing(1),...G[a],maxHeight:ce[a],[`@media (max-height:${ce[a]})`]:{maxHeight:"calc(100vh - 80px)",...a==="large"&&{minHeight:t!=="auto"?"calc(100vh - 80px)":"auto"}},...e&&{width:"100vw",maxWidth:`calc(100vw - ${s.spacing(10)})`,height:"100vh",maxHeight:`calc(100vh - ${s.spacing(10)})`,margin:s.spacing(5),borderRadius:s.spacing(1)},...t&&{height:t,minHeight:t},...o&&{width:o},[s.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,...t&&{top:"auto",borderRadius:s.spacing(1,1,0,0),height:t,minHeight:t}},...n&&{maxHeight:`calc(100vh - ${s.spacing(10)})`,form:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between",overflow:"hidden",...G[a],maxWidth:"100%",...e&&{width:"100%",maxWidth:"100%",height:"100%",maxHeight:"100%"},...t&&{height:t,minHeight:t},...o&&{width:o},[s.breakpoints.down("sm")]:{width:"100%",maxWidth:"100%",height:"100vh",maxHeight:"100vh",...t&&{top:"auto",borderRadius:s.spacing(1,1,0,0),height:t,minHeight:t}}}}}}));function So({nonModal:e,children:t,size:o="small",PaperProps:n,fullScreen:a,height:s,width:l,hasForm:d,"aria-label":c,"data-testid":g,...p},u){return e?r.jsx(V,{size:o,fullScreen:a,height:s,width:l,hasForm:d,"aria-label":c,"data-testid":g,"data-name":"dialog",...p,ref:u,children:t}):r.jsx(i.Dialog,{PaperComponent:V,PaperProps:{...n,size:o,fullScreen:a,height:s,width:l,hasForm:d},fullScreen:a,role:"section","aria-label":c,"data-testid":g,"data-size":o,"data-width":l,"data-height":s,"data-name":"dialog",...p,ref:u,children:t})}const De=b.forwardRef(So),wo=i.styled(i.DialogTitle)(()=>({padding:0,zIndex:10})),Ao=i.styled(i.Box)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(2),minHeight:e.spacing(8)})),ue=i.styled(i.Box)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),overflow:"hidden"})),Do=i.styled(D.CloseOutlined)(({theme:e})=>({color:e.palette.text.secondary})),Bo=i.styled(i.Divider)(()=>({"+ .MuiDialogContent-root":{borderTop:"none !important"}}));function Be({title:e,chipLabel:t,chipProps:o,children:n,onClose:a,secondaryActions:s,"aria-label":l,closeIcon:d,...c}){const g=B.useIntl(),p=j.useImperativeIntl(g);return r.jsxs(r.Fragment,{children:[r.jsxs(wo,{component:"div","data-name":"dialog-header",...c,children:[r.jsxs(Ao,{children:[r.jsxs(ue,{flex:1,maxWidth:.8,children:[r.jsx(j.Typography,{component:"h2",variant:"inherit",noWrap:!0,"aria-label":l,role:"heading",children:e}),t&&r.jsx(i.Chip,{color:"default",label:t,...o})]}),r.jsxs(ue,{children:[s,a&&r.jsx(i.Tooltip,{title:p.formatMessage({id:"c4r.button.close"}),placement:"left",children:r.jsx(i.IconButton,{onClick:a,children:d||r.jsx(Do,{"data-testid":"CloseIcon"})})})]})]}),n]}),n&&r.jsx(Bo,{})]})}const To=i.styled(i.DialogContent,{shouldForwardProp:e=>!["scrollableContent","withGutter","withBottomGutter"].includes(e)})(({theme:e,scrollableContent:t,withGutter:o,withBottomGutter:n})=>({display:"flex",flexDirection:"column",gap:e.spacing(3),padding:0,...e.typography.body2,color:e.palette.text.secondary,".MuiAlert-root":{minHeight:"auto"},...t&&{borderBottom:`1px solid ${e.palette.divider}`,"+ .MuiDivider-root":{display:"none"}},...o&&{padding:` ${e.spacing(1,2,0)} !important`,".MuiDialog-paperFullScreen &":{padding:`${e.spacing(2,2,0)} !important`}},...n&&{paddingBottom:`${e.spacing(3)} !important`,".MuiDialog-paperFullScreen &":{paddingBottom:`${e.spacing(3)} !important`}}}));function Ro({children:e,scrollableContent:t,hasFooterAlert:o,withGutter:n=!0,withBottomGutter:a=!0,onScroll:s,...l},d){const c=i.useTheme(),[g,p]=b.useState(null);b.useImperativeHandle(d,()=>g,[g]);const u=b.useCallback(f=>{const x=Math.abs(f.scrollHeight-f.clientHeight-f.scrollTop)<1,C=f.scrollTop===0,h=`1px solid ${c.palette.divider}`;f.style.borderTop=C?"none":h,f.style.borderBottom=x&&!o?"none":h},[c.palette.divider,o]),m=b.useCallback(f=>{u(f.target),s==null||s(f)},[u,s]);return b.useEffect(()=>{g&&u(g)},[g,u]),b.useEffect(()=>{if(!g||typeof ResizeObserver>"u")return;const f=new ResizeObserver(()=>{u(g)});return f.observe(g),()=>f.disconnect()},[g,u]),r.jsx(To,{ref:p,onScroll:m,scrollableContent:t,withGutter:n,withBottomGutter:a&&n,"data-name":"dialog-content",...l,children:e})}const ee=b.forwardRef(Ro),Oo=i.styled(ee,{shouldForwardProp:e=>e!=="withAlert"})(({withAlert:e,theme:t})=>({padding:`${t.spacing(0,2)} !important`,...e&&{paddingBottom:`${t.spacing(3)} !important`}})),Fo=i.styled(U.Alert)(({theme:e})=>({minHeight:"auto",padding:0,backgroundColor:"transparent","& .MuiTypography-root":{color:e.palette.text.secondary,a:{color:e.palette.primary.main}},"& .MuiAlertTitle-root":{color:e.palette.text.primary}}));function te({children:e,severity:t="neutral",...o}){return r.jsx(Fo,{severity:t,...o,"data-name":"dialog-alert",children:e})}const $o=i.styled(i.Box,{shouldForwardProp:e=>!["dark","hasChildren"].includes(e)})(({dark:e,hasChildren:t,theme:o})=>({flex:"0 0 auto",display:"block",minHeight:t?o.spacing(8):"auto",zIndex:10,...e&&{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]}}}})),Lo=i.styled(i.Box)(()=>({display:"flex",alignItems:"center",justifyContent:"space-between","& > div:empty":{padding:0}})),Eo=i.styled(i.Box,{shouldForwardProp:e=>e!=="hasAlert"})(({hasAlert:e,theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(1),padding:t.spacing(2),paddingTop:e?0:t.spacing(2)})),oe=i.styled(i.DialogActions,{shouldForwardProp:e=>e!=="hasAlert"})(({hasAlert:e,theme:t})=>({gap:t.spacing(1),padding:t.spacing(2),paddingTop:e?0:t.spacing(2),margin:0,".MuiButton-root + .MuiButton-root":{marginLeft:0}})),Wo=i.styled(i.Divider)(()=>({marginTop:"-1px"}));function Te({children:e,secondaryActions:t,alertContent:o,alertProps:n,dark:a,topContent:s,...l}){return r.jsxs(r.Fragment,{children:[s,!!o&&r.jsx(Wo,{}),r.jsxs($o,{...l,dark:a,"data-theme":a?"dark":"light","data-name":"dialog-footer",hasChildren:!!e,children:[!!o&&r.jsx(i.Box,{sx:{p:2,pt:1.5,pb:1},children:r.jsx(te,{...n,children:o})}),r.jsxs(Lo,{children:[r.jsx(Eo,{hasAlert:!!o,children:t}),r.jsx(oe,{hasAlert:!!o,children:e})]})]})]})}const Ho=i.styled(i.Box)(({theme:e})=>({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:e.palette.white[60]})),qo=i.styled("div")(()=>({width:"100%"})),Po=i.styled(i.Box)(({theme:e})=>({width:"100%",padding:e.spacing(1.5,2,2),backgroundColor:e.palette.background.paper,borderTop:`1px solid ${e.palette.divider}`,".MuiDialogActions-root":{padding:0,marginTop:e.spacing(1)}}));function Re({children:e,onClickAway:t,actions:o,severity:n="warning",opened:a,"data-testid":s,"aria-label":l,...d}){const c=b.useRef(null),g=i.useTheme(),p=()=>{t&&t()};return r.jsx(Ho,{ref:c,"data-testid":s,"aria-label":l,role:"presentation","data-name":"dialog-confirmation",children:r.jsx(Pe,{onClickAway:p,children:r.jsx(i.Slide,{direction:"up",in:a,container:c.current,mountOnEnter:!0,unmountOnExit:!0,easing:g.transitions.easing.easeOut,timeout:350,children:r.jsx(qo,{children:r.jsxs(Po,{children:[r.jsx(te,{severity:n,...d,children:e}),r.jsx(oe,{children:o})]})})})})})}const _o=i.styled(i.Box)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",height:e.spacing(8),marginBottom:e.spacing(2),"& > div":{flex:1}})),No=i.styled(i.Box)(({theme:e})=>({display:"flex",flex:1,flexDirection:"column",justifyContent:"center",alignItems:"center",position:"relative","&:before, &:after":{content:'""',background:e.palette.divider,position:"absolute",top:e.spacing(1.25),height:e.spacing(.25),width:`calc(50% - ${e.spacing(2.5)})`},"&:before":{left:0},"&:after":{right:0},"&:first-of-type:before":{content:"none"},"&:last-of-type:after":{content:"none"}}));function zo({theme:e,completed:t,current:o}){return t?{background:e.palette.success.main,borderColor:e.palette.success.main,color:e.palette.common.white}:o?{background:e.palette.text.primary,borderColor:e.palette.text.primary,color:e.palette.common.white}:{borderColor:e.palette.text.secondary,color:e.palette.text.secondary}}const Go=i.styled("span",{shouldForwardProp:e=>e!=="completed"&&e!=="current"})(({theme:e,completed:t,current:o})=>({display:"flex",justifyContent:"center",alignItems:"center",height:e.spacing(3),width:e.spacing(3),marginBottom:e.spacing(1),borderRadius:"50%",border:`${e.spacing(.25)} solid currentColor`,...e.typography.caption,...zo({theme:e,completed:t,current:o})}));function Vo({currentStep:e,stepsLabels:t,...o}){return r.jsx(_o,{...o,"data-name":"dialog-stepper",children:r.jsx(i.Box,{sx:{display:"flex"},children:t.map((n,a)=>{const s=a+1,l=s===e,d=s<e,c=d?"success.main":l?"textPrimary":"textSecondary";return r.jsxs(No,{"data-state":d?"completed":l?"current":"uncompleted",children:[r.jsx(Go,{completed:d,current:l,children:d?r.jsx(D.Check,{fontSize:"small","aria-label":"Completed step"}):s}),r.jsx(j.Typography,{variant:"caption",component:"div",color:c,children:n})]},a)})})})}const Uo=i.styled(ee,{shouldForwardProp:e=>!["error","withBorder"].includes(e)})(({error:e,withBorder:t,theme:o})=>({gap:0,border:t?`1px solid ${o.palette.divider} !important`:void 0,borderBottom:e?"none !important":void 0,".react-codemirror2":{display:"flex",flexDirection:"column",minHeight:"100%"},".CodeMirror-wrap":{display:"flex",flexDirection:"column",flex:1},"& + .MuiDivider-root":{display:"none"}}));function Oe({children:e,error:t,withBorder:o=!0,withGutter:n=!1}){return e?r.jsx(Uo,{withGutter:n,error:t,withBorder:o,children:e}):null}function Fe({onClose:e,onCancel:t,cancelLabel:o,cancelButton:n,closeButton:a,contentLabel:s,titleLabel:l,severity:d="warning",content:c}){const g=B.useIntl(),p=j.useImperativeIntl(g);return!e||!t?null:r.jsx(Re,{opened:!0,severity:d,title:p.formatMessage({id:l||"c4r.dialog.confirmation.title"}),actions:r.jsxs(r.Fragment,{children:[t&&(n||r.jsx(H,{onClick:t,children:p.formatMessage({id:o||"c4r.button.cancel"})})),e&&(a||r.jsx(H,{variant:"contained",onClick:e,children:p.formatMessage({id:"c4r.button.leave"})}))]}),children:c||p.formatMessage({id:s||"c4r.dialog.confirmation.content"})})}function Zo({open:e,onClose:t,title:o,error:n,helperText:a,onClickFooter:s,disabledButtonFooter:l,labelIdButtonFooter:d,ariaLabelButtonFooter:c,disabled:g,showConfirmation:p,onCancelConfirm:u,onCloseConfirm:m,footerProps:f,saveLoading:x,showSaveSnackbar:C,onCloseSaveSnackbar:h,"data-testid":v,"aria-label":I,...k}){const M=n||!!s||!!f;return e?r.jsxs(De,{open:e,fullScreen:!0,onClose:t,"data-testid":v,"aria-label":I,"data-name":"code-area-dialog",children:[r.jsx(Be,{title:o,onClose:t,closeIcon:!s&&r.jsx(N.CloseDiagonallyRight,{})}),r.jsx(Oe,{error:n,children:r.jsx(we,{...k,disabled:g,variant:null,isExpanded:!0})}),M&&r.jsx(Te,{...f,topContent:n&&r.jsx(Ae,{hasDivider:!!s,children:a}),children:!!s&&r.jsx(Q,{onClickFooter:s,labelIdButtonFooter:d,ariaLabelButtonFooter:c,disabled:g,disabledButtonFooter:l,withGutter:!1,variant:"contained",size:"medium",loading:!!x,showSnackbar:C,onCloseSnackbar:h})}),p&&r.jsx(Fe,{onClose:m??t,onCancel:u,cancelLabel:"c4r.button.keepEditing"})]}):null}exports.TablePaginationActions=j.TablePaginationActions;exports.Typography=j.Typography;exports.Alert=U.Alert;exports.MenuItem=$.MenuItem;exports.AccordionGroup=$t;exports.AppBar=to;exports.Autocomplete=St;exports.Avatar=Et;exports.Button=H;exports.CodeAreaDialog=Zo;exports.CodeAreaDialogConfirmation=Fe;exports.CodeAreaDialogContent=Oe;exports.CodeAreaDialogError=Ae;exports.CodeAreaField=we;exports.CodeAreaFooter=Q;exports.CodeAreaHeader=ke;exports.CodeAreaInput=Se;exports.CopiableComponent=Me;exports.CreatableAutocomplete=Bt;exports.DatePicker=z;exports.DateRangePicker=lo;exports.DateTimePicker=co;exports.Dialog=De;exports.DialogActions=oe;exports.DialogAlert=te;exports.DialogConfirmation=Re;exports.DialogContent=ee;exports.DialogContentPadded=Oo;exports.DialogFooter=Te;exports.DialogHeader=Be;exports.DialogPaper=V;exports.DialogStepper=Vo;exports.IconButton=L;exports.LabelWithIndicator=E;exports.Menu=ge;exports.MenuItemFilter=Y;exports.MenuList=dt;exports.MultipleAutocomplete=Rt;exports.MultipleSelectField=yt;exports.PasswordField=Ye;exports.SelectField=pe;exports.Snackbar=q;exports.TimePicker=so;exports.ToggleButtonGroup=tt;exports.TooltipData=mo;exports.UploadField=vt;exports.UploadFieldBase=fe;exports.copyString=je;exports.dialogDimensionsBySize=G;exports.useCopyValue=J;