@ssplib/react-components 0.0.337 → 0.0.338

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import{jsxs as e,jsx as r,Fragment as t}from"react/jsx-runtime";import{Grid as n,Typography as o,Box as i,Stack as a,Button as l,useTheme as s,Checkbox as c,Card as d,InputLabel as u,TextField as p,SvgIcon as m,useMediaQuery as f,LinearProgress as h,TableContainer as g,Paper as y,CircularProgress as b,FormControlLabel as x,Switch as v,Autocomplete as C,MobileStepper as w,SwipeableDrawer as k,Modal as E,Menu as S,MenuItem as D,Skeleton as I,IconButton as Y,Collapse as M,PaginationItem as O,Alert as T,FormControl as A,Select as R,AppBar as F,Avatar as V,FormLabel as P,FormHelperText as $}from"@mui/material";import{FileDownload as j,ErrorOutline as N,ReportProblemRounded as z,PendingRounded as B,FilterAlt as L,KeyboardArrowDown as W,ExpandLess as _,ExpandMore as q,Refresh as U,KeyboardArrowUp as K}from"@mui/icons-material";import*as X from"react";import H,{createContext as G,useContext as J,useCallback as Q,useState as Z,useEffect as ee,useMemo as re,useRef as te}from"react";import ne from"lodash.get";import{LocalizationProvider as oe,DatePicker as ie,TimePicker as ae}from"@mui/x-date-pickers";import{AdapterDayjs as le}from"@mui/x-date-pickers/AdapterDayjs";import se from"dayjs";import"dayjs/locale/pt-br";import ce from"lodash.hasin";import{useFormContext as de,useForm as ue,Controller as pe}from"react-hook-form";import me from"axios";import{useDropzone as fe}from"react-dropzone";import he from"@emotion/styled";import{ThemeContext as ge}from"@emotion/react";import ye from"@mui/icons-material/CameraAlt";import be from"@mui/icons-material/Delete";import xe from"@mui/icons-material/Done";import ve from"@mui/icons-material/InsertDriveFile";import Ce from"@mui/icons-material/PictureAsPdf";import we from"@mui/material/InputLabel";import{IMaskInput as ke}from"react-imask";import{useQuery as Ee}from"react-query";import Se from"@mui/icons-material/KeyboardArrowLeft";import De from"@mui/icons-material/KeyboardArrowRight";import Ie from"@mui/icons-material/Save";import{LoadingButton as Ye}from"@mui/lab";import{toast as Me,ToastContainer as Oe}from"react-toastify";import Te from"@mui/icons-material/ContentPasteOutlined";import Ae from"@mui/material/Typography";import Re from"@mui/icons-material/Clear";import Fe from"@mui/icons-material/FileDownload";import Ve from"@mui/icons-material/NavigateNextRounded";import Pe from"@mui/icons-material/Search";import $e from"@mui/material/Grid";import je from"@mui/material/Pagination";import Ne from"@mui/material/TextField";import ze from"jszip";import Be from"@mui/icons-material/CloseRounded";import Le from"tinycolor2";import We from"lodash.clonedeep";import*as _e from"xlsx";import qe from"next/dynamic";import Ue from"@mui/icons-material/KeyboardArrowDown";import Ke from"@mui/icons-material/LogoutOutlined";import Xe from"@mui/icons-material/Menu";import He from"@mui/icons-material/Person";import Ge from"@mui/material/LinearProgress";import Je from"next/image";import Qe from"next/link";import{useRouter as Ze}from"next/router";import er from"keycloak-js";import{getCookie as rr,setCookie as tr,deleteCookie as nr}from"cookies-next";import or from"jwt-decode";function ir({title:t}){return e(n,{paddingY:1,item:!0,marginTop:1,marginBottom:3,xs:12,children:[r(o,{textTransform:"uppercase",fontWeight:600,children:t}),r(i,{sx:{backgroundColor:"#94A3B8",height:6,borderRadius:1}})]})}function ar({name:t,title:l,tag:s,xs:c=12,md:d,lg:u}){let p=s&&"Distrital"===s?"#BFDBFE":"Estadual"===s?"#BBF7D0":"Federal"===s?"#FEF08A":"Internacional"===s?"#FED7AA":"Não"===s?"#FECACA":"#BBF7D0";return r(n,{paddingBottom:3,item:!0,xs:c,md:d,lg:u,paddingRight:2,children:e(a,{spacing:1,children:[e(a,{spacing:1,direction:"row",children:[r(o,{sx:{backgroundColor:"#E2E8F0",maxWidth:"max-content",paddingX:1,borderRadius:2,color:"#1E293B"},fontWeight:600,children:l}),s&&r(o,{sx:{backgroundColor:p,maxWidth:"max-content",paddingX:1,borderRadius:2,color:"#1E293B"},fontWeight:600,children:s})]}),t&&r(i,{children:"false"===String(t)?"Não":"true"===String(t)?"Sim":""===String(t)?"":t?String(t):"Não informado"})]})})}function lr({title:t,xs:i=12,tag:l,md:s,lg:c,paddingBottom:d=3}){let u=l&&"Não"===l?"#FECACA":"Sim"===l?"#BBF7D0":"#E2E8F0";return r(n,{paddingBottom:d,item:!0,xs:i,md:s,lg:c,paddingRight:2,children:e(a,{spacing:1,direction:"row",children:[r(o,{sx:{backgroundColor:"#E2E8F0",maxWidth:"max-content",paddingX:1,borderRadius:2,color:"#1E293B"},fontWeight:600,fontSize:16,children:t}),l&&r(o,{sx:{backgroundColor:u,maxWidth:"max-content",paddingX:1,borderRadius:2,color:"#1E293B"},fontWeight:600,children:l})]})})}const sr=/*#__PURE__*/G({});function cr({title:t,name:i,md:s,fileURL:c,fileExt:d="pdf"}){const{user:u}=J(sr);return r(n,{paddingBottom:3,paddingRight:3,md:s,children:e(a,{spacing:1,sx:{backgroundColor:"#F8FAFC",paddingY:1,paddingX:3,borderRadius:2,border:1,borderColor:"#CBD5E1"},children:[r(o,{fontWeight:600,sx:{textAlign:"center"},children:t}),e(a,{direction:"row",spacing:2,alignItems:"center",children:[r(j,{sx:{fill:"red"}}),r(o,{children:i})]}),r(a,{alignItems:"center",children:r(l,{variant:"outlined",color:"error",size:"small",endIcon:r(j,{}),onClick:()=>fetch(c,{method:"GET",headers:{Authorization:`Bearer ${u?.token}`}}).then(e=>e.blob()).then(e=>{var r=window.URL.createObjectURL(e);const t=document.createElement("a");t.href=r,t.download=i.split(".")[0]+`.${d}`,t.click()}),children:"Baixar"})})]})})}const dr=/*#__PURE__*/G(null);function ur({name:t,title:a,defaultValue:l=!1,xs:d=12,sm:u,md:p,onChange:m,disabled:f=!1}){const h=J(dr),g=s(),y=h?.formWatch(t)||l,b=Q(e=>{f||(h?.formSetValue(t,!h?.formGetValues(t)),m?.(e))},[h,t,f,m]);return r(n,{item:!0,xs:d,sm:u,md:p,children:e(i,{onClick:e=>b(e),sx:{border:"1px solid",borderColor:y?g.palette.primary.main:"#E0E0E0",borderRadius:"8px",padding:"8px 16px",cursor:f?"not-allowed":"pointer",backgroundColor:y?`${g.palette.primary.main}10`:"white",transition:"all 0.2s",display:"flex",alignItems:"center",position:"relative",opacity:f?.6:1,mb:.5,"&:hover":{borderColor:f||y?void 0:g.palette.grey[400],backgroundColor:f||y?void 0:g.palette.grey[50]}},children:[r(c,{checked:y,size:"small",sx:{padding:0,mr:1.5,"&.Mui-checked":{color:g.palette.primary.main}}}),"string"==typeof a?r(o,{variant:"body2",color:y?"primary.main":"text.primary",fontWeight:y?600:400,children:a}):a,r("input",{type:"checkbox",...h?.formRegister(t),style:{display:"none"}})]})})}function pr(e){let r=[];return e.forEach(e=>{if(e.props){if(e.props.children){const t=pr(Array.isArray(e.props.children)?e.props.children:[e.props.children]);return void(r=r.concat(t))}e.props.name&&r.push(e.props.name)}}),r}function mr({customText:t="Selecione pelo menos 1 opção",...o}){const[i,a]=Z(!1),[l,s]=Z(!0),c=J(dr),d=/*#__PURE__*/H.cloneElement(o.children,{onChange:()=>{i&&!c.formGetValues(d.props.name)&&s(!1)}});return e(n,{container:!0,sx:{padding:1,borderRadius:2},children:[r("input",{type:"text",...c.formRegister(o.name,{validate:(e,r)=>{if(i&&l)return!0;const n=pr(Array.isArray(o.children)?o.children:[o.children]);let d=!1;return n.forEach(e=>{c.formGetValues(e)&&(d=!0)}),!!d||(a(!0),s(!0),t)}}),hidden:!0}),d,r(n,{item:!0,xs:12,children:i&&l&&o.content})]})}function fr({name:t,title:a,customWarning:l,defaultValue:u=!1,xs:p=12,sm:m,md:f}){const h=J(dr),g=s(),y=h?.formWatch(t)||u,b=Q(e=>{h?.formSetValue(t,!h?.formGetValues(t))},[h,t]);return e(n,{item:!0,xs:p,sm:m,md:f,children:[e(i,{onClick:e=>b(e),sx:{border:"1px solid",borderColor:y?g.palette.primary.main:"#E0E0E0",borderRadius:"8px",padding:"8px 16px",cursor:"pointer",backgroundColor:y?`${g.palette.primary.main}10`:"white",transition:"all 0.2s",display:"flex",alignItems:"center",position:"relative",marginBottom:.5,"&:hover":{borderColor:y?void 0:g.palette.grey[400],backgroundColor:y?void 0:g.palette.grey[50]}},children:[r(c,{checked:y,size:"small",sx:{padding:0,mr:1.5,"&.Mui-checked":{color:g.palette.primary.main}}}),r(o,{variant:"body2",color:y?"primary.main":"text.primary",fontWeight:y?600:400,children:a}),r("input",{type:"checkbox",...h?.formRegister(t),style:{display:"none"}})]}),y&&r(d,{sx:{bgcolor:"#FFFBF5",color:"#F59E0B",padding:1,paddingLeft:2},children:l||e(o,{children:[r("b",{children:"Atenção"})," ",r("i",{children:a})," possui regras específicas."]})})]})}function hr(e){let r=[];return e.forEach(e=>{if(e.props){if(e.props.children){const t=hr(Array.isArray(e.props.children)?e.props.children:[e.props.children]);return void(r=r.concat(t))}e.props.name&&r.push(e.props.name)}}),r}function gr({customText:t="Selecione pelo menos 1 opção",...a}){const l=J(dr);return e(n,{container:!0,sx:{border:ne(l.errors,a.name)?"2px solid #d32f2f":"",padding:1,borderRadius:2},children:[r("input",{type:"text",...l.formRegister(a.name,{validate:(e,r)=>{const n=hr(Array.isArray(a.children)?a.children:[a.children]);let o=!1;return n.forEach((e,r)=>{l.formGetValues(e)&&(o=!0)}),!!o||t}}),hidden:!0},1),a.children,ne(l.errors,a.name)&&r(n,{item:!0,xs:12,children:e(i,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:1,border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),r(o,{variant:"caption",color:"inherit",fontWeight:600,fontSize:14,children:ne(l.errors,a.name)?.message})]})})]})}function yr({name:a,required:l=!1,title:s,xs:c=12,sm:d,md:m,minDt:f,defaultValue:h,persistValue:g,maxDt:y,...b}){const x=J(dr),[v,C]=Z(void 0!==h?se(h,"DD/MM/YYYY"):void 0);return ee(()=>{void 0!==v&&x.formSetValue(a,v?v.format("DD/MM/YYYY"):v)},[v]),ee(()=>{if(!g)return()=>{x.formUnregister(a)}},[]),r(t,{children:e(n,{item:!0,xs:c,sm:d,md:m,children:[s&&r(u,{required:l,children:s}),e(oe,{adapterLocale:"pt-br",dateAdapter:le,children:[r(ie,{minDate:se(f,"DD/MM/YYYY"),maxDate:se(y,"DD/MM/YYYY"),format:"DD/MM/YYYY",value:v,onChange:e=>{C(e)},disableHighlightToday:!0,sx:{outline:ne(x.errors,a)?"1px solid transparent":"",backgroundColor:"white",width:"100%","& .MuiOutlinedInput-root":{borderRadius:"8px",transition:"all 0.2s","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"2px"},"&.Mui-error .MuiOutlinedInput-notchedOutline":{borderColor:"error.main",borderWidth:"2px"}},div:{input:{paddingX:2,paddingY:1.05}}},inputRef:e=>r(p,{size:"small",...e,...x?.formRegister(a,{validate:(e,r)=>!ce(r,a)||(e||(e=""),e.length<=0&&l?"Este campo é obrigatório":e.length<10&&l?"A data precisa seguir o padrão DD/MM/AAAA":!f||se(f,"DD/MM/YYYY").isSame(se(e,"DD/MM/YYYY"))||se(f,"DD/MM/YYYY").isBefore(se(e,"DD/MM/YYYY"))?!y||se(y,"DD/MM/YYYY").isSame(se(e,"DD/MM/YYYY"))||se(y,"DD/MM/YYYY").isAfter(se(e,"DD/MM/YYYY"))?void 0:"A data escolhida não é válida":`A data tem que ser depois de ${f} e antes de ${y}`),shouldUnregister:!0}),fullWidth:!0})}),ne(x.errors,a)&&e(i,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:"8px",border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),r(o,{variant:"caption",color:"inherit",fontWeight:600,fontSize:14,children:ne(x.errors,a)?.message})]})]})]})})}function br({name:i,required:a=!1,title:l,xs:s=12,sm:c,md:d,minDt:m,defaultValue:f,persistValue:h,maxDt:g,...y}){const b=de(),[x,v]=Z(void 0!==f?se(f,"DD/MM/YYYY"):void 0);return ee(()=>{void 0!==x&&b.setValue(i,x?x.format("DD/MM/YYYY"):x)},[x]),ee(()=>{if(!h)return()=>{b.unregister(i)}},[]),r(t,{children:e(n,{item:!0,xs:s,sm:c,md:d,children:[l&&r(u,{required:a,children:l}),e(oe,{adapterLocale:"pt-br",dateAdapter:le,children:[r(ie,{minDate:se(m,"DD/MM/YYYY"),maxDate:se(g,"DD/MM/YYYY"),format:"DD/MM/YYYY",value:x,onChange:e=>{v(void 0)},disableHighlightToday:!0,sx:{outline:ne(b.formState.errors,i)?"1px solid #a51c30":"",backgroundColor:"white",width:"100%",div:{input:{paddingX:2,paddingY:1.05}}},inputRef:e=>r(p,{size:"small",...e,...b?.register(i,{validate:(e,r)=>!ce(r,i)||(e||(e=""),e.length<=0&&a?"Este campo é obrigatório":e.length<10&&a?"A data precisa seguir o padrão DD/MM/AAAA":!m||se(m,"DD/MM/YYYY").isSame(se(e,"DD/MM/YYYY"))||se(m,"DD/MM/YYYY").isBefore(se(e,"DD/MM/YYYY"))?!g||se(g,"DD/MM/YYYY").isSame(se(e,"DD/MM/YYYY"))||se(g,"DD/MM/YYYY").isAfter(se(e,"DD/MM/YYYY"))?void 0:"A data escolhida não é válida":`A data tem que ser depois de ${m} e antes de ${g}`),shouldUnregister:!0}),fullWidth:!0})}),r(o,{sx:{color:"#a51c30",fontSize:14,paddingLeft:1},children:ne(b.formState.errors,i)?.message})]})]})})}function xr({name:t,required:a=!1,title:l,defaultValue:s="",xs:c=12,sm:d,md:m}){const f=J(dr),[h,g]=Z(s?se(s,"HH:mm"):null);return ee(()=>{f.formSetValue(t,h?h.format("HH:mm"):h)},[h]),ee(()=>()=>{f.formUnregister(t)},[]),e(n,{item:!0,xs:c,sm:d,md:m,children:[l&&r(u,{required:a,children:l}),e(oe,{adapterLocale:"pt-br",dateAdapter:le,children:[r(ae,{value:h,ampm:!1,onChange:e=>{g(e)},sx:{outline:ne(f.errors,t)?"1px solid transparent":"",backgroundColor:"white",width:"100%","& .MuiOutlinedInput-root":{borderRadius:"8px",transition:"all 0.2s","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"2px"},"&.Mui-error .MuiOutlinedInput-notchedOutline":{borderColor:"error.main",borderWidth:"2px"}},div:{input:{paddingX:2,paddingY:1.05}}},inputRef:e=>r(p,{size:"small",...e,...f?.formRegister(t,{validate:(e,r)=>!ce(r,t)||(e||(e=""),e.length<=0&&a?"Este campo é obrigatório":e.length<5&&a?"A hora precisa seguir o padrão HH:MM":void 0),shouldUnregister:!0}),fullWidth:!0})}),ne(f.errors,t)&&e(i,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:"8px",border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),r(o,{variant:"caption",color:"inherit",fontWeight:600,fontSize:14,children:ne(f.errors,t)?.message})]})]})]})}function vr(){return vr=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},vr.apply(null,arguments)}function Cr(e){return null!==e&&"object"==typeof e&&e.constructor===Object}function wr(e){if(!Cr(e))return e;const r={};return Object.keys(e).forEach(t=>{r[t]=wr(e[t])}),r}function kr(e,r,t={clone:!0}){const n=t.clone?vr({},e):e;return Cr(e)&&Cr(r)&&Object.keys(r).forEach(o=>{"__proto__"!==o&&(n[o]=Cr(r[o])&&o in e&&Cr(e[o])?kr(e[o],r[o],t):t.clone&&Cr(r[o])?wr(r[o]):r[o])}),n}function Er(e){var r={exports:{}};return e(r,r.exports),r.exports}var Sr="function"==typeof Symbol&&Symbol.for,Dr=Sr?Symbol.for("react.element"):60103,Ir=Sr?Symbol.for("react.portal"):60106,Yr=Sr?Symbol.for("react.fragment"):60107,Mr=Sr?Symbol.for("react.strict_mode"):60108,Or=Sr?Symbol.for("react.profiler"):60114,Tr=Sr?Symbol.for("react.provider"):60109,Ar=Sr?Symbol.for("react.context"):60110,Rr=Sr?Symbol.for("react.async_mode"):60111,Fr=Sr?Symbol.for("react.concurrent_mode"):60111,Vr=Sr?Symbol.for("react.forward_ref"):60112,Pr=Sr?Symbol.for("react.suspense"):60113,$r=Sr?Symbol.for("react.suspense_list"):60120,jr=Sr?Symbol.for("react.memo"):60115,Nr=Sr?Symbol.for("react.lazy"):60116,zr=Sr?Symbol.for("react.block"):60121,Br=Sr?Symbol.for("react.fundamental"):60117,Lr=Sr?Symbol.for("react.responder"):60118,Wr=Sr?Symbol.for("react.scope"):60119;function _r(e){if("object"==typeof e&&null!==e){var r=e.$$typeof;switch(r){case Dr:switch(e=e.type){case Rr:case Fr:case Yr:case Or:case Mr:case Pr:return e;default:switch(e=e&&e.$$typeof){case Ar:case Vr:case Nr:case jr:case Tr:return e;default:return r}}case Ir:return r}}}function qr(e){return _r(e)===Fr}var Ur={AsyncMode:Rr,ConcurrentMode:Fr,ContextConsumer:Ar,ContextProvider:Tr,Element:Dr,ForwardRef:Vr,Fragment:Yr,Lazy:Nr,Memo:jr,Portal:Ir,Profiler:Or,StrictMode:Mr,Suspense:Pr,isAsyncMode:function(e){return qr(e)||_r(e)===Rr},isConcurrentMode:qr,isContextConsumer:function(e){return _r(e)===Ar},isContextProvider:function(e){return _r(e)===Tr},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===Dr},isForwardRef:function(e){return _r(e)===Vr},isFragment:function(e){return _r(e)===Yr},isLazy:function(e){return _r(e)===Nr},isMemo:function(e){return _r(e)===jr},isPortal:function(e){return _r(e)===Ir},isProfiler:function(e){return _r(e)===Or},isStrictMode:function(e){return _r(e)===Mr},isSuspense:function(e){return _r(e)===Pr},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===Yr||e===Fr||e===Or||e===Mr||e===Pr||e===$r||"object"==typeof e&&null!==e&&(e.$$typeof===Nr||e.$$typeof===jr||e.$$typeof===Tr||e.$$typeof===Ar||e.$$typeof===Vr||e.$$typeof===Br||e.$$typeof===Lr||e.$$typeof===Wr||e.$$typeof===zr)},typeOf:_r},Kr=Er(function(e,r){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,h=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function v(e){if("object"==typeof e&&null!==e){var r=e.$$typeof;switch(r){case t:var m=e.type;switch(m){case c:case d:case o:case a:case i:case p:return m;default:var g=m&&m.$$typeof;switch(g){case s:case u:case h:case f:case l:return g;default:return r}}case n:return r}}}var C=d,w=s,k=l,E=t,S=u,D=o,I=h,Y=f,M=n,O=a,T=i,A=p,R=!1;function F(e){return v(e)===d}r.AsyncMode=c,r.ConcurrentMode=C,r.ContextConsumer=w,r.ContextProvider=k,r.Element=E,r.ForwardRef=S,r.Fragment=D,r.Lazy=I,r.Memo=Y,r.Portal=M,r.Profiler=O,r.StrictMode=T,r.Suspense=A,r.isAsyncMode=function(e){return R||(R=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),F(e)||v(e)===c},r.isConcurrentMode=F,r.isContextConsumer=function(e){return v(e)===s},r.isContextProvider=function(e){return v(e)===l},r.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},r.isForwardRef=function(e){return v(e)===u},r.isFragment=function(e){return v(e)===o},r.isLazy=function(e){return v(e)===h},r.isMemo=function(e){return v(e)===f},r.isPortal=function(e){return v(e)===n},r.isProfiler=function(e){return v(e)===a},r.isStrictMode=function(e){return v(e)===i},r.isSuspense=function(e){return v(e)===p},r.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===d||e===a||e===i||e===p||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===f||e.$$typeof===l||e.$$typeof===s||e.$$typeof===u||e.$$typeof===y||e.$$typeof===b||e.$$typeof===x||e.$$typeof===g)},r.typeOf=v}()}),Xr=Er(function(e){e.exports="production"===process.env.NODE_ENV?Ur:Kr}),Hr=Object.getOwnPropertySymbols,Gr=Object.prototype.hasOwnProperty,Jr=Object.prototype.propertyIsEnumerable,Qr=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;var n=Object.getOwnPropertyNames(r).map(function(e){return r[e]});if("0123456789"!==n.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(e,r){for(var t,n,o=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),i=1;i<arguments.length;i++){for(var a in t=Object(arguments[i]))Gr.call(t,a)&&(o[a]=t[a]);if(Hr){n=Hr(t);for(var l=0;l<n.length;l++)Jr.call(t,n[l])&&(o[n[l]]=t[n[l]])}}return o},Zr=Function.call.bind(Object.prototype.hasOwnProperty),et="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",rt=Zr,tt=function(){};if("production"!==process.env.NODE_ENV){var nt=et,ot={},it=rt;tt=function(e){var r="Warning: "+e;"undefined"!=typeof console&&console.error(r);try{throw new Error(r)}catch(e){}}}function at(e,r,t,n,o){if("production"!==process.env.NODE_ENV)for(var i in e)if(it(e,i)){var a;try{if("function"!=typeof e[i]){var l=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}a=e[i](r,i,n,t,null,nt)}catch(e){a=e}if(!a||a instanceof Error||tt((n||"React class")+": type specification of "+t+" `"+i+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof a+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),a instanceof Error&&!(a.message in ot)){ot[a.message]=!0;var s=o?o():"";tt("Failed "+t+" type: "+a.message+(null!=s?s:""))}}}at.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(ot={})};var lt=at,st=function(){};function ct(){return null}function dt(){}function ut(){}"production"!==process.env.NODE_ENV&&(st=function(e){var r="Warning: "+e;"undefined"!=typeof console&&console.error(r);try{throw new Error(r)}catch(e){}}),ut.resetWarningCache=dt;var pt,mt=Er(function(e){e.exports="production"!==process.env.NODE_ENV?function(e){var r="function"==typeof Symbol&&Symbol.iterator,t="<<anonymous>>",n={array:l("array"),bigint:l("bigint"),bool:l("boolean"),func:l("function"),number:l("number"),object:l("object"),string:l("string"),symbol:l("symbol"),any:a(ct),arrayOf:function(e){return a(function(r,t,n,o,a){if("function"!=typeof e)return new i("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var l=r[t];if(!Array.isArray(l))return new i("Invalid "+o+" `"+a+"` of type `"+d(l)+"` supplied to `"+n+"`, expected an array.");for(var s=0;s<l.length;s++){var c=e(l,s,n,o,a+"["+s+"]",et);if(c instanceof Error)return c}return null})},element:a(function(r,t,n,o,a){var l=r[t];return e(l)?null:new i("Invalid "+o+" `"+a+"` of type `"+d(l)+"` supplied to `"+n+"`, expected a single ReactElement.")}),elementType:a(function(e,r,t,n,o){var a=e[r];return Xr.isValidElementType(a)?null:new i("Invalid "+n+" `"+o+"` of type `"+d(a)+"` supplied to `"+t+"`, expected a single ReactElement type.")}),instanceOf:function(e){return a(function(r,n,o,a,l){return r[n]instanceof e?null:new i("Invalid "+a+" `"+l+"` of type `"+((s=r[n]).constructor&&s.constructor.name?s.constructor.name:t)+"` supplied to `"+o+"`, expected instance of `"+(e.name||t)+"`.");var s})},node:a(function(e,r,t,n,o){return c(e[r])?null:new i("Invalid "+n+" `"+o+"` supplied to `"+t+"`, expected a ReactNode.")}),objectOf:function(e){return a(function(r,t,n,o,a){if("function"!=typeof e)return new i("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var l=r[t],s=d(l);if("object"!==s)return new i("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+n+"`, expected an object.");for(var c in l)if(rt(l,c)){var u=e(l,c,n,o,a+"."+c,et);if(u instanceof Error)return u}return null})},oneOf:function(e){return Array.isArray(e)?a(function(r,t,n,a,l){for(var s=r[t],c=0;c<e.length;c++)if(o(s,e[c]))return null;var d=JSON.stringify(e,function(e,r){return"symbol"===u(r)?String(r):r});return new i("Invalid "+a+" `"+l+"` of value `"+String(s)+"` supplied to `"+n+"`, expected one of "+d+".")}):("production"!==process.env.NODE_ENV&&st(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),ct)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&st("Invalid argument supplied to oneOfType, expected an instance of array."),ct;for(var r=0;r<e.length;r++){var t=e[r];if("function"!=typeof t)return st("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+p(t)+" at index "+r+"."),ct}return a(function(r,t,n,o,a){for(var l=[],s=0;s<e.length;s++){var c=(0,e[s])(r,t,n,o,a,et);if(null==c)return null;c.data&&rt(c.data,"expectedType")&&l.push(c.data.expectedType)}return new i("Invalid "+o+" `"+a+"` supplied to `"+n+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(e){return a(function(r,t,n,o,a){var l=r[t],c=d(l);if("object"!==c)return new i("Invalid "+o+" `"+a+"` of type `"+c+"` supplied to `"+n+"`, expected `object`.");for(var p in e){var m=e[p];if("function"!=typeof m)return s(n,o,a,p,u(m));var f=m(l,p,n,o,a+"."+p,et);if(f)return f}return null})},exact:function(e){return a(function(r,t,n,o,a){var l=r[t],c=d(l);if("object"!==c)return new i("Invalid "+o+" `"+a+"` of type `"+c+"` supplied to `"+n+"`, expected `object`.");var p=Qr({},r[t],e);for(var m in p){var f=e[m];if(rt(e,m)&&"function"!=typeof f)return s(n,o,a,m,u(f));if(!f)return new i("Invalid "+o+" `"+a+"` key `"+m+"` supplied to `"+n+"`.\nBad object: "+JSON.stringify(r[t],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var h=f(l,m,n,o,a+"."+m,et);if(h)return h}return null})}};function o(e,r){return e===r?0!==e||1/e==1/r:e!=e&&r!=r}function i(e,r){this.message=e,this.data=r&&"object"==typeof r?r:{},this.stack=""}function a(e){function r(r,n,o,a,l,s,c){if(a=a||t,s=s||o,c!==et){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}return null==n[o]?r?new i(null===n[o]?"The "+l+" `"+s+"` is marked as required in `"+a+"`, but its value is `null`.":"The "+l+" `"+s+"` is marked as required in `"+a+"`, but its value is `undefined`."):null:e(n,o,a,l,s)}process;var n=r.bind(null,!1);return n.isRequired=r.bind(null,!0),n}function l(e){return a(function(r,t,n,o,a,l){var s=r[t];return d(s)!==e?new i("Invalid "+o+" `"+a+"` of type `"+u(s)+"` supplied to `"+n+"`, expected `"+e+"`.",{expectedType:e}):null})}function s(e,r,t,n,o){return new i((e||"React class")+": "+r+" type `"+t+"."+n+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function c(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(c);if(null===t||e(t))return!0;var n=function(e){var t=e&&(r&&e[r]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(!n)return!1;var o,i=n.call(t);if(n!==t.entries){for(;!(o=i.next()).done;)if(!c(o.value))return!1}else for(;!(o=i.next()).done;){var a=o.value;if(a&&!c(a[1]))return!1}return!0;default:return!1}}function d(e){var r=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,r){return"symbol"===e||!!r&&("Symbol"===r["@@toStringTag"]||"function"==typeof Symbol&&r instanceof Symbol)}(r,e)?"symbol":r}function u(e){if(null==e)return""+e;var r=d(e);if("object"===r){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return r}function p(e){var r=u(e);switch(r){case"array":case"object":return"an "+r;case"boolean":case"date":case"regexp":return"a "+r;default:return r}}return i.prototype=Error.prototype,n.checkPropTypes=lt,n.resetWarningCache=lt.resetWarningCache,n.PropTypes=n,n}(Xr.isElement):function(){function e(e,r,t,n,o,i){if(i!==et){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function r(){return e}e.isRequired=e;var t={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:r,element:e,elementType:e,instanceOf:r,node:e,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:ut,resetWarningCache:dt};return t.PropTypes=t,t}()}),ft=Symbol.for("react.element"),ht=Symbol.for("react.portal"),gt=Symbol.for("react.fragment"),yt=Symbol.for("react.strict_mode"),bt=Symbol.for("react.profiler"),xt=Symbol.for("react.provider"),vt=Symbol.for("react.context"),Ct=Symbol.for("react.server_context"),wt=Symbol.for("react.forward_ref"),kt=Symbol.for("react.suspense"),Et=Symbol.for("react.suspense_list"),St=Symbol.for("react.memo"),Dt=Symbol.for("react.lazy"),It=Symbol.for("react.offscreen");function Yt(e){if("object"==typeof e&&null!==e){var r=e.$$typeof;switch(r){case ft:switch(e=e.type){case gt:case bt:case yt:case kt:case Et:return e;default:switch(e=e&&e.$$typeof){case Ct:case vt:case wt:case Dt:case St:case xt:return e;default:return r}}case ht:return r}}}pt=Symbol.for("react.module.reference");var Mt={ContextConsumer:vt,ContextProvider:xt,Element:ft,ForwardRef:wt,Fragment:gt,Lazy:Dt,Memo:St,Portal:ht,Profiler:bt,StrictMode:yt,Suspense:kt,SuspenseList:Et,isAsyncMode:function(){return!1},isConcurrentMode:function(){return!1},isContextConsumer:function(e){return Yt(e)===vt},isContextProvider:function(e){return Yt(e)===xt},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===ft},isForwardRef:function(e){return Yt(e)===wt},isFragment:function(e){return Yt(e)===gt},isLazy:function(e){return Yt(e)===Dt},isMemo:function(e){return Yt(e)===St},isPortal:function(e){return Yt(e)===ht},isProfiler:function(e){return Yt(e)===bt},isStrictMode:function(e){return Yt(e)===yt},isSuspense:function(e){return Yt(e)===kt},isSuspenseList:function(e){return Yt(e)===Et},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===gt||e===bt||e===yt||e===kt||e===Et||e===It||"object"==typeof e&&null!==e&&(e.$$typeof===Dt||e.$$typeof===St||e.$$typeof===xt||e.$$typeof===vt||e.$$typeof===wt||e.$$typeof===pt||void 0!==e.getModuleId)},typeOf:Yt},Ot=Er(function(e,r){"production"!==process.env.NODE_ENV&&function(){var e,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.server_context"),d=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen");function g(e){if("object"==typeof e&&null!==e){var r=e.$$typeof;switch(r){case t:var h=e.type;switch(h){case o:case a:case i:case u:case p:return h;default:var g=h&&h.$$typeof;switch(g){case c:case s:case d:case f:case m:case l:return g;default:return r}}case n:return r}}}e=Symbol.for("react.module.reference");var y=l,b=t,x=d,v=o,C=f,w=m,k=n,E=a,S=i,D=u,I=p,Y=!1,M=!1;r.ContextConsumer=s,r.ContextProvider=y,r.Element=b,r.ForwardRef=x,r.Fragment=v,r.Lazy=C,r.Memo=w,r.Portal=k,r.Profiler=E,r.StrictMode=S,r.Suspense=D,r.SuspenseList=I,r.isAsyncMode=function(e){return Y||(Y=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},r.isConcurrentMode=function(e){return M||(M=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},r.isContextConsumer=function(e){return g(e)===s},r.isContextProvider=function(e){return g(e)===l},r.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},r.isForwardRef=function(e){return g(e)===d},r.isFragment=function(e){return g(e)===o},r.isLazy=function(e){return g(e)===f},r.isMemo=function(e){return g(e)===m},r.isPortal=function(e){return g(e)===n},r.isProfiler=function(e){return g(e)===a},r.isStrictMode=function(e){return g(e)===i},r.isSuspense=function(e){return g(e)===u},r.isSuspenseList=function(e){return g(e)===p},r.isValidElementType=function(r){return"string"==typeof r||"function"==typeof r||r===o||r===a||r===i||r===u||r===p||r===h||"object"==typeof r&&null!==r&&(r.$$typeof===f||r.$$typeof===m||r.$$typeof===l||r.$$typeof===s||r.$$typeof===d||r.$$typeof===e||void 0!==r.getModuleId)},r.typeOf=g}()}),Tt=Er(function(e){e.exports="production"===process.env.NODE_ENV?Mt:Ot});const At=/^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;function Rt(e,r=""){return e.displayName||e.name||function(e){const r=`${e}`.match(At);return r&&r[1]||""}(e)||r}function Ft(e,r,t){const n=Rt(r);return e.displayName||(""!==n?`${t}(${n})`:t)}function Vt(e){if("string"!=typeof e)throw new Error("production"!==process.env.NODE_ENV?"MUI: `capitalize(string)` expects a string argument.":function(e){let r="https://mui.com/production-error/?code="+e;for(let e=1;e<arguments.length;e+=1)r+="&args[]="+encodeURIComponent(arguments[e]);return"Minified MUI error #"+e+"; visit "+r+" for the full message."}(7));return e.charAt(0).toUpperCase()+e.slice(1)}function Pt(e,r){const t=vr({},r);return Object.keys(e).forEach(n=>{if(n.toString().match(/^(components|slots)$/))t[n]=vr({},e[n],t[n]);else if(n.toString().match(/^(componentsProps|slotProps)$/)){const o=e[n]||{},i=r[n];t[n]={},i&&Object.keys(i)?o&&Object.keys(o)?(t[n]=vr({},i),Object.keys(o).forEach(e=>{t[n][e]=Pt(o[e],i[e])})):t[n]=i:t[n]=o}else void 0===t[n]&&(t[n]=e[n])}),t}const $t=e=>e;var jt=(()=>{let e=$t;return{configure(r){e=r},generate:r=>e(r),reset(){e=$t}}})();const Nt={active:"active",checked:"checked",completed:"completed",disabled:"disabled",readOnly:"readOnly",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",required:"required",selected:"selected"};function zt(e,r){if(null==e)return{};var t={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==r.indexOf(n))continue;t[n]=e[n]}return t}const Bt=["values","unit","step"];var Lt={borderRadius:4},Wt="production"!==process.env.NODE_ENV?mt.oneOfType([mt.number,mt.string,mt.object,mt.array]):{};function _t(e,r){return r?kr(e,r,{clone:!1}):e}const qt={xs:0,sm:600,md:900,lg:1200,xl:1536},Ut={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${qt[e]}px)`};function Kt(e,r,t){const n=e.theme||{};if(Array.isArray(r)){const e=n.breakpoints||Ut;return r.reduce((n,o,i)=>(n[e.up(e.keys[i])]=t(r[i]),n),{})}if("object"==typeof r){const e=n.breakpoints||Ut;return Object.keys(r).reduce((n,o)=>(-1!==Object.keys(e.values||qt).indexOf(o)?n[e.up(o)]=t(r[o],o):n[o]=r[o],n),{})}return t(r)}function Xt(e={}){var r;return(null==(r=e.keys)?void 0:r.reduce((r,t)=>(r[e.up(t)]={},r),{}))||{}}function Ht(e,r){return e.reduce((e,r)=>{const t=e[r];return(!t||0===Object.keys(t).length)&&delete e[r],e},r)}function Gt({values:e,breakpoints:r,base:t}){const n=t||function(e,r){if("object"!=typeof e)return{};const t={},n=Object.keys(r);return Array.isArray(e)?n.forEach((r,n)=>{n<e.length&&(t[r]=!0)}):n.forEach(r=>{null!=e[r]&&(t[r]=!0)}),t}(e,r),o=Object.keys(n);if(0===o.length)return e;let i;return o.reduce((r,t,n)=>(Array.isArray(e)?(r[t]=null!=e[n]?e[n]:e[i],i=n):"object"==typeof e?(r[t]=null!=e[t]?e[t]:e[i],i=t):r[t]=e,r),{})}function Jt(e,r,t=!0){if(!r||"string"!=typeof r)return null;if(e&&e.vars&&t){const t=`vars.${r}`.split(".").reduce((e,r)=>e&&e[r]?e[r]:null,e);if(null!=t)return t}return r.split(".").reduce((e,r)=>e&&null!=e[r]?e[r]:null,e)}function Qt(e,r,t,n=t){let o;return o="function"==typeof e?e(t):Array.isArray(e)?e[t]||n:Jt(e,t)||n,r&&(o=r(o,n,e)),o}function Zt(e){const{prop:r,cssProperty:t=e.prop,themeKey:n,transform:o}=e,i=e=>{if(null==e[r])return null;const i=e[r],a=Jt(e.theme,n)||{};return Kt(e,i,e=>{let n=Qt(a,o,e);return e===n&&"string"==typeof e&&(n=Qt(a,o,`${r}${"default"===e?"":Vt(e)}`,e)),!1===t?n:{[t]:n}})};return i.propTypes="production"!==process.env.NODE_ENV?{[r]:Wt}:{},i.filterProps=[r],i}const en={m:"margin",p:"padding"},rn={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},tn={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},nn=function(){const e={};return r=>(void 0===e[r]&&(e[r]=(e=>{if(e.length>2){if(!tn[e])return[e];e=tn[e]}const[r,t]=e.split(""),n=en[r],o=rn[t]||"";return Array.isArray(o)?o.map(e=>n+e):[n+o]})(r)),e[r])}(),on=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],an=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],ln=[...on,...an];function sn(e,r,t,n){var o;const i=null!=(o=Jt(e,r,!1))?o:t;return"number"==typeof i?e=>"string"==typeof e?e:("production"!==process.env.NODE_ENV&&"number"!=typeof e&&console.error(`MUI: Expected ${n} argument to be a number or a string, got ${e}.`),i*e):Array.isArray(i)?e=>"string"==typeof e?e:("production"!==process.env.NODE_ENV&&(Number.isInteger(e)?e>i.length-1&&console.error([`MUI: The value provided (${e}) overflows.`,`The supported values are: ${JSON.stringify(i)}.`,`${e} > ${i.length-1}, you need to add the missing values.`].join("\n")):console.error([`MUI: The \`theme.${r}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${r}\` as a number.`].join("\n"))),i[e]):"function"==typeof i?i:("production"!==process.env.NODE_ENV&&console.error([`MUI: The \`theme.${r}\` value (${i}) is invalid.`,"It should be a number, an array or a function."].join("\n")),()=>{})}function cn(e){return sn(e,"spacing",8,"spacing")}function dn(e,r){if("string"==typeof r||null==r)return r;const t=e(Math.abs(r));return r>=0?t:"number"==typeof t?-t:`-${t}`}function un(e,r){const t=cn(e.theme);return Object.keys(e).map(n=>function(e,r,t,n){if(-1===r.indexOf(t))return null;const o=function(e,r){return t=>e.reduce((e,n)=>(e[n]=dn(r,t),e),{})}(nn(t),n);return Kt(e,e[t],o)}(e,r,n,t)).reduce(_t,{})}function pn(e){return un(e,on)}function mn(e){return un(e,an)}function fn(...e){const r=e.reduce((e,r)=>(r.filterProps.forEach(t=>{e[t]=r}),e),{}),t=e=>Object.keys(e).reduce((t,n)=>r[n]?_t(t,r[n](e)):t,{});return t.propTypes="production"!==process.env.NODE_ENV?e.reduce((e,r)=>Object.assign(e,r.propTypes),{}):{},t.filterProps=e.reduce((e,r)=>e.concat(r.filterProps),[]),t}function hn(e){return"number"!=typeof e?e:`${e}px solid`}pn.propTypes="production"!==process.env.NODE_ENV?on.reduce((e,r)=>(e[r]=Wt,e),{}):{},pn.filterProps=on,mn.propTypes="production"!==process.env.NODE_ENV?an.reduce((e,r)=>(e[r]=Wt,e),{}):{},mn.filterProps=an,"production"===process.env.NODE_ENV||ln.reduce((e,r)=>(e[r]=Wt,e),{});const gn=Zt({prop:"border",themeKey:"borders",transform:hn}),yn=Zt({prop:"borderTop",themeKey:"borders",transform:hn}),bn=Zt({prop:"borderRight",themeKey:"borders",transform:hn}),xn=Zt({prop:"borderBottom",themeKey:"borders",transform:hn}),vn=Zt({prop:"borderLeft",themeKey:"borders",transform:hn}),Cn=Zt({prop:"borderColor",themeKey:"palette"}),wn=Zt({prop:"borderTopColor",themeKey:"palette"}),kn=Zt({prop:"borderRightColor",themeKey:"palette"}),En=Zt({prop:"borderBottomColor",themeKey:"palette"}),Sn=Zt({prop:"borderLeftColor",themeKey:"palette"}),Dn=e=>{if(null!=e.borderRadius){const r=sn(e.theme,"shape.borderRadius",4,"borderRadius");return Kt(e,e.borderRadius,e=>({borderRadius:dn(r,e)}))}return null};Dn.propTypes="production"!==process.env.NODE_ENV?{borderRadius:Wt}:{},Dn.filterProps=["borderRadius"],fn(gn,yn,bn,xn,vn,Cn,wn,kn,En,Sn,Dn);const In=e=>{if(null!=e.gap){const r=sn(e.theme,"spacing",8,"gap");return Kt(e,e.gap,e=>({gap:dn(r,e)}))}return null};In.propTypes="production"!==process.env.NODE_ENV?{gap:Wt}:{},In.filterProps=["gap"];const Yn=e=>{if(null!=e.columnGap){const r=sn(e.theme,"spacing",8,"columnGap");return Kt(e,e.columnGap,e=>({columnGap:dn(r,e)}))}return null};Yn.propTypes="production"!==process.env.NODE_ENV?{columnGap:Wt}:{},Yn.filterProps=["columnGap"];const Mn=e=>{if(null!=e.rowGap){const r=sn(e.theme,"spacing",8,"rowGap");return Kt(e,e.rowGap,e=>({rowGap:dn(r,e)}))}return null};function On(e,r){return"grey"===r?r:e}function Tn(e){return e<=1&&0!==e?100*e+"%":e}Mn.propTypes="production"!==process.env.NODE_ENV?{rowGap:Wt}:{},Mn.filterProps=["rowGap"],fn(In,Yn,Mn,Zt({prop:"gridColumn"}),Zt({prop:"gridRow"}),Zt({prop:"gridAutoFlow"}),Zt({prop:"gridAutoColumns"}),Zt({prop:"gridAutoRows"}),Zt({prop:"gridTemplateColumns"}),Zt({prop:"gridTemplateRows"}),Zt({prop:"gridTemplateAreas"}),Zt({prop:"gridArea"})),fn(Zt({prop:"color",themeKey:"palette",transform:On}),Zt({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:On}),Zt({prop:"backgroundColor",themeKey:"palette",transform:On}));const An=Zt({prop:"width",transform:Tn}),Rn=e=>null!=e.maxWidth?Kt(e,e.maxWidth,r=>{var t,n,o;return{maxWidth:(null==(t=e.theme)||null==(n=t.breakpoints)||null==(o=n.values)?void 0:o[r])||qt[r]||Tn(r)}}):null;Rn.filterProps=["maxWidth"];const Fn=Zt({prop:"minWidth",transform:Tn}),Vn=Zt({prop:"height",transform:Tn}),Pn=Zt({prop:"maxHeight",transform:Tn}),$n=Zt({prop:"minHeight",transform:Tn});Zt({prop:"size",cssProperty:"width",transform:Tn}),Zt({prop:"size",cssProperty:"height",transform:Tn}),fn(An,Rn,Fn,Vn,Pn,$n,Zt({prop:"boxSizing"}));var jn={border:{themeKey:"borders",transform:hn},borderTop:{themeKey:"borders",transform:hn},borderRight:{themeKey:"borders",transform:hn},borderBottom:{themeKey:"borders",transform:hn},borderLeft:{themeKey:"borders",transform:hn},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:Dn},color:{themeKey:"palette",transform:On},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:On},backgroundColor:{themeKey:"palette",transform:On},p:{style:mn},pt:{style:mn},pr:{style:mn},pb:{style:mn},pl:{style:mn},px:{style:mn},py:{style:mn},padding:{style:mn},paddingTop:{style:mn},paddingRight:{style:mn},paddingBottom:{style:mn},paddingLeft:{style:mn},paddingX:{style:mn},paddingY:{style:mn},paddingInline:{style:mn},paddingInlineStart:{style:mn},paddingInlineEnd:{style:mn},paddingBlock:{style:mn},paddingBlockStart:{style:mn},paddingBlockEnd:{style:mn},m:{style:pn},mt:{style:pn},mr:{style:pn},mb:{style:pn},ml:{style:pn},mx:{style:pn},my:{style:pn},margin:{style:pn},marginTop:{style:pn},marginRight:{style:pn},marginBottom:{style:pn},marginLeft:{style:pn},marginX:{style:pn},marginY:{style:pn},marginInline:{style:pn},marginInlineStart:{style:pn},marginInlineEnd:{style:pn},marginBlock:{style:pn},marginBlockStart:{style:pn},marginBlockEnd:{style:pn},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:In},rowGap:{style:Mn},columnGap:{style:Yn},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:Tn},maxWidth:{style:Rn},minWidth:{transform:Tn},height:{transform:Tn},maxHeight:{transform:Tn},minHeight:{transform:Tn},boxSizing:{},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};const Nn=function(){function e(e,r,t,n){const o={[e]:r,theme:t},i=n[e];if(!i)return{[e]:r};const{cssProperty:a=e,themeKey:l,transform:s,style:c}=i;if(null==r)return null;if("typography"===l&&"inherit"===r)return{[e]:r};const d=Jt(t,l)||{};return c?c(o):Kt(o,r,r=>{let t=Qt(d,s,r);return r===t&&"string"==typeof r&&(t=Qt(d,s,`${e}${"default"===r?"":Vt(r)}`,r)),!1===a?t:{[a]:t}})}return function r(t){var n;const{sx:o,theme:i={}}=t||{};if(!o)return null;const a=null!=(n=i.unstable_sxConfig)?n:jn;function l(t){let n=t;if("function"==typeof t)n=t(i);else if("object"!=typeof t)return t;if(!n)return null;const o=Xt(i.breakpoints),l=Object.keys(o);let s=o;return Object.keys(n).forEach(t=>{const o="function"==typeof(l=n[t])?l(i):l;var l;if(null!=o)if("object"==typeof o)if(a[t])s=_t(s,e(t,o,i,a));else{const e=Kt({theme:i},o,e=>({[t]:e}));!function(...e){const r=e.reduce((e,r)=>e.concat(Object.keys(r)),[]),t=new Set(r);return e.every(e=>t.size===Object.keys(e).length)}(e,o)?s=_t(s,e):s[t]=r({sx:o,theme:i})}else s=_t(s,e(t,o,i,a))}),Ht(l,s)}return Array.isArray(o)?o.map(l):l(o)}}();Nn.filterProps=["sx"];var zn=Nn;const Bn=["breakpoints","palette","spacing","shape"];function Ln(e={},...r){const{breakpoints:t={},palette:n={},spacing:o,shape:i={}}=e,a=zt(e,Bn),l=function(e){const{values:r={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:t="px",step:n=5}=e,o=zt(e,Bt),i=(e=>{const r=Object.keys(e).map(r=>({key:r,val:e[r]}))||[];return r.sort((e,r)=>e.val-r.val),r.reduce((e,r)=>vr({},e,{[r.key]:r.val}),{})})(r),a=Object.keys(i);function l(e){return`@media (min-width:${"number"==typeof r[e]?r[e]:e}${t})`}function s(e){return`@media (max-width:${("number"==typeof r[e]?r[e]:e)-n/100}${t})`}function c(e,o){const i=a.indexOf(o);return`@media (min-width:${"number"==typeof r[e]?r[e]:e}${t}) and (max-width:${(-1!==i&&"number"==typeof r[a[i]]?r[a[i]]:o)-n/100}${t})`}return vr({keys:a,values:i,up:l,down:s,between:c,only:function(e){return a.indexOf(e)+1<a.length?c(e,a[a.indexOf(e)+1]):l(e)},not:function(e){const r=a.indexOf(e);return 0===r?l(a[1]):r===a.length-1?s(a[r]):c(e,a[a.indexOf(e)+1]).replace("@media","@media not all and")},unit:t},o)}(t),s=function(e=8){if(e.mui)return e;const r=cn({spacing:e}),t=(...e)=>("production"!==process.env.NODE_ENV&&(e.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${e.length}`)),(0===e.length?[1]:e).map(e=>{const t=r(e);return"number"==typeof t?`${t}px`:t}).join(" "));return t.mui=!0,t}(o);let c=kr({breakpoints:l,direction:"ltr",components:{},palette:vr({mode:"light"},n),spacing:s,shape:vr({},Lt,i)},a);return c=r.reduce((e,r)=>kr(e,r),c),c.unstable_sxConfig=vr({},jn,null==a?void 0:a.unstable_sxConfig),c.unstable_sx=function(e){return zn({sx:e,theme:this})},c}const Wn=Ln(),_n=["sx"];function qn(e){var r,t,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(r=0;r<e.length;r++)e[r]&&(t=qn(e[r]))&&(n&&(n+=" "),n+=t);else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Un(){for(var e,r,t=0,n="";t<arguments.length;)(e=arguments[t++])&&(r=qn(e))&&(n&&(n+=" "),n+=r);return n}const Kn=["variant"];function Xn(e){return 0===e.length}function Hn(e){const{variant:r}=e,t=zt(e,Kn);let n=r||"";return Object.keys(t).sort().forEach(r=>{n+="color"===r?Xn(n)?e[r]:Vt(e[r]):`${Xn(n)?r:Vt(r)}${Vt(e[r].toString())}`}),n}const Gn=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function Jn(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}const Qn=Ln();function Zn({defaultTheme:e,theme:r,themeId:t}){return 0===Object.keys(r).length?e:r[t]||r}const eo=function(e={}){const{themeId:r,defaultTheme:t=Qn,rootShouldForwardProp:n=Jn,slotShouldForwardProp:o=Jn}=e,i=e=>zn(vr({},e,{theme:Zn(vr({},e,{defaultTheme:t,themeId:r}))}));return i.__mui_systemSx=!0,(e,a={})=>{(e=>{Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=e.__emotion_styles.filter(e=>!(null!=e&&e.__mui_systemSx)))})(e);const{name:l,slot:s,skipVariantsResolver:c,skipSx:d,overridesResolver:u}=a,p=zt(a,Gn),m=void 0!==c?c:s&&"Root"!==s||!1,f=d||!1;let h;var g;"production"!==process.env.NODE_ENV&&l&&(h=`${l}-${g=s||"Root",g.charAt(0).toLowerCase()+g.slice(1)}`);let y=Jn;"Root"===s?y=n:s?y=o:function(e){return"string"==typeof e&&e.charCodeAt(0)>96}(e)&&(y=void 0);const b=function(e,r){const t=he(e,r);return"production"!==process.env.NODE_ENV?(...r)=>{const n="string"==typeof e?`"${e}"`:"component";return 0===r.length?console.error([`MUI: Seems like you called \`styled(${n})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join("\n")):r.some(e=>void 0===e)&&console.error(`MUI: the styled(${n})(...args) API requires all its args to be defined.`),t(...r)}:t}(e,vr({shouldForwardProp:y,label:h},p)),x=(n,...o)=>{const a=o?o.map(e=>"function"==typeof e&&e.__emotion_real!==e?n=>e(vr({},n,{theme:Zn(vr({},n,{defaultTheme:t,themeId:r}))})):e):[];let c=n;l&&u&&a.push(e=>{const n=Zn(vr({},e,{defaultTheme:t,themeId:r})),o=((e,r)=>r.components&&r.components[e]&&r.components[e].styleOverrides?r.components[e].styleOverrides:null)(l,n);if(o){const r={};return Object.entries(o).forEach(([t,o])=>{r[t]="function"==typeof o?o(vr({},e,{theme:n})):o}),u(e,r)}return null}),l&&!m&&a.push(e=>{const n=Zn(vr({},e,{defaultTheme:t,themeId:r}));return((e,r,t,n)=>{var o,i;const{ownerState:a={}}=e,l=[],s=null==t||null==(o=t.components)||null==(i=o[n])?void 0:i.variants;return s&&s.forEach(t=>{let n=!0;Object.keys(t.props).forEach(r=>{a[r]!==t.props[r]&&e[r]!==t.props[r]&&(n=!1)}),n&&l.push(r[Hn(t.props)])}),l})(e,((e,r)=>{let t=[];r&&r.components&&r.components[e]&&r.components[e].variants&&(t=r.components[e].variants);const n={};return t.forEach(e=>{const r=Hn(e.props);n[r]=e.style}),n})(l,n),n,l)}),f||a.push(i);const d=a.length-o.length;if(Array.isArray(n)&&d>0){const e=new Array(d).fill("");c=[...n,...e],c.raw=[...n.raw,...e]}else"function"==typeof n&&n.__emotion_real!==n&&(c=e=>n(vr({},e,{theme:Zn(vr({},e,{defaultTheme:t,themeId:r}))})));const p=b(c,...a);if("production"!==process.env.NODE_ENV){let r;l&&(r=`${l}${s||""}`),void 0===r&&(r=`Styled(${function(e){if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)return Rt(e,"Component");if("object"==typeof e)switch(e.$$typeof){case Tt.ForwardRef:return Ft(e,e.render,"ForwardRef");case Tt.Memo:return Ft(e,e.type,"memo");default:return}}}(e)})`),p.displayName=r}return e.muiName&&(p.muiName=e.muiName),p};return b.withConfig&&(x.withConfig=b.withConfig),x}}();var ro=eo;function to(e){const{theme:r,name:t,props:n}=e;return r&&r.components&&r.components[t]&&r.components[t].defaultProps?Pt(r.components[t].defaultProps,n):n}const no=["component","direction","spacing","divider","children","className","useFlexGap"],oo=Ln(),io=ro("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,r)=>r.root});function ao(e){return function({props:e,name:r,defaultTheme:t,themeId:n}){let o=function(e=Wn){return function(e=null){const r=X.useContext(ge);return r&&0!==Object.keys(r).length?r:e}(e)}(t);return n&&(o=o[n]||o),to({theme:o,name:r,props:e})}({props:e,name:"MuiStack",defaultTheme:oo})}function lo(e,r){const t=X.Children.toArray(e).filter(Boolean);return t.reduce((e,n,o)=>(e.push(n),o<t.length-1&&e.push(/*#__PURE__*/X.cloneElement(r,{key:`separator-${o}`})),e),[])}const so=({ownerState:e,theme:r})=>{let t=vr({display:"flex",flexDirection:"column"},Kt({theme:r},Gt({values:e.direction,breakpoints:r.breakpoints.values}),e=>({flexDirection:e})));if(e.spacing){const n=cn(r),o=Object.keys(r.breakpoints.values).reduce((r,t)=>(("object"==typeof e.spacing&&null!=e.spacing[t]||"object"==typeof e.direction&&null!=e.direction[t])&&(r[t]=!0),r),{}),i=Gt({values:e.direction,base:o}),a=Gt({values:e.spacing,base:o});"object"==typeof i&&Object.keys(i).forEach((e,r,t)=>{i[e]||(i[e]=r>0?i[t[r-1]]:"column")}),t=kr(t,Kt({theme:r},a,(r,t)=>{return e.useFlexGap?{gap:dn(n,r)}:{"& > :not(style) + :not(style)":{margin:0,[`margin${o=t?i[t]:e.direction,{row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"}[o]}`]:dn(n,r)}};var o}))}return t=function(e,...r){const t=Xt(e),n=[t,...r].reduce((e,r)=>kr(e,r),{});return Ht(Object.keys(t),n)}(r.breakpoints,t),t},co=function(e={}){const{createStyledComponent:t=io,useThemeProps:n=ao,componentName:o="MuiStack"}=e,i=t(so),a=/*#__PURE__*/X.forwardRef(function(e,t){const a=function(e){const{sx:r}=e,t=zt(e,_n),{systemProps:n,otherProps:o}=(e=>{var r,t;const n={systemProps:{},otherProps:{}},o=null!=(r=null==e||null==(t=e.theme)?void 0:t.unstable_sxConfig)?r:jn;return Object.keys(e).forEach(r=>{o[r]?n.systemProps[r]=e[r]:n.otherProps[r]=e[r]}),n})(t);let i;return i=Array.isArray(r)?[n,...r]:"function"==typeof r?(...e)=>{const t=r(...e);return Cr(t)?vr({},n,t):n}:vr({},n,r),vr({},o,{sx:i})}(n(e)),{component:l="div",direction:s="column",spacing:c=0,divider:d,children:u,className:p,useFlexGap:m=!1}=a,f=zt(a,no),h={direction:s,spacing:c,useFlexGap:m},g=function(e,r,t){const n={};return Object.keys(e).forEach(r=>{n[r]=e[r].reduce((e,r)=>{if(r){const n=(e=>function(e,r,t="Mui"){const n=Nt[r];return n?`${t}-${n}`:`${jt.generate(e)}-${r}`}(o,e))(r);""!==n&&e.push(n),t&&t[r]&&e.push(t[r])}return e},[]).join(" ")}),n}({root:["root"]},0,{});/*#__PURE__*/
2
- return r(i,vr({as:l,ownerState:h,ref:t,className:Un(g.root,p)},f,{children:d?lo(u,d):u}))});return"production"!==process.env.NODE_ENV&&(a.propTypes={children:mt.node,direction:mt.oneOfType([mt.oneOf(["column-reverse","column","row-reverse","row"]),mt.arrayOf(mt.oneOf(["column-reverse","column","row-reverse","row"])),mt.object]),divider:mt.node,spacing:mt.oneOfType([mt.arrayOf(mt.oneOfType([mt.number,mt.string])),mt.number,mt.object,mt.string]),sx:mt.oneOfType([mt.arrayOf(mt.oneOfType([mt.func,mt.object,mt.bool])),mt.func,mt.object])}),a}();"production"!==process.env.NODE_ENV&&(co.propTypes={children:mt.node,component:mt.elementType,direction:mt.oneOfType([mt.oneOf(["column-reverse","column","row-reverse","row"]),mt.arrayOf(mt.oneOf(["column-reverse","column","row-reverse","row"])),mt.object]),divider:mt.node,spacing:mt.oneOfType([mt.arrayOf(mt.oneOfType([mt.number,mt.string])),mt.number,mt.object,mt.string]),sx:mt.oneOfType([mt.arrayOf(mt.oneOfType([mt.func,mt.object,mt.bool])),mt.func,mt.object]),useFlexGap:mt.bool});var uo=co;function po(t){return r(m,{...t,children:e("svg",{width:"26",height:"34",viewBox:"0 0 26 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r("path",{d:"M24.9717 11.5L14.8333 1.36165C14.5757 1.10371 14.2262 0.958634 13.8617 0.958313H5.66667C4.32953 0.958313 3.04717 1.48949 2.10167 2.43498C1.15617 3.38048 0.625 4.66285 0.625 5.99998V28C0.625 29.3371 1.15617 30.6195 2.10167 31.565C3.04717 32.5105 4.32953 33.0416 5.66667 33.0416H20.3333C21.6705 33.0416 22.9528 32.5105 23.8983 31.565C24.8438 30.6195 25.375 29.3371 25.375 28V12.4166C25.3606 12.0713 25.2166 11.744 24.9717 11.5ZM15.2917 5.65165L20.6817 11.0416H15.2917V5.65165ZM20.3333 30.2916H5.66667C5.05888 30.2916 4.47598 30.0502 4.04621 29.6204C3.61644 29.1907 3.375 28.6078 3.375 28V5.99998C3.375 5.39219 3.61644 4.8093 4.04621 4.37953C4.47598 3.94976 5.05888 3.70831 5.66667 3.70831H12.5417V12.4166C12.5464 12.7798 12.6928 13.1268 12.9496 13.3837C13.2065 13.6405 13.5535 13.7869 13.9167 13.7916H22.625V28C22.625 28.6078 22.3836 29.1907 21.9538 29.6204C21.524 30.0502 20.9411 30.2916 20.3333 30.2916Z",fill:"#fff"}),r("path",{d:"M15.7317 22.225C14.6044 21.5176 13.756 20.4425 13.33 19.1817C13.7248 18.0021 13.8439 16.7478 13.6784 15.515C13.6255 15.2044 13.474 14.9191 13.2464 14.7013C13.0187 14.4835 12.727 14.3448 12.4144 14.3058C12.1018 14.2667 11.7849 14.3293 11.5107 14.4844C11.2364 14.6394 11.0194 14.8786 10.8917 15.1667C10.683 16.6487 10.8403 18.1594 11.35 19.5667C10.6537 21.1933 9.87664 22.7842 9.02169 24.3333C7.72002 25.0667 5.94169 26.1667 5.66669 27.4317C5.44669 28.4583 7.37169 31.0983 10.6534 25.3783C12.1126 24.8366 13.6072 24.3956 15.1267 24.0583C16.2499 24.7005 17.5029 25.0827 18.7934 25.1767C19.0897 25.1843 19.3816 25.1043 19.6325 24.9465C19.8835 24.7887 20.0822 24.5603 20.2036 24.2899C20.3251 24.0195 20.3639 23.7193 20.3152 23.4269C20.2666 23.1345 20.1325 22.8631 19.93 22.6467C19.16 21.8583 16.8684 22.0783 15.7317 22.225ZM6.96836 27.725C7.48213 26.8458 8.16063 26.0739 8.96669 25.4517C7.72002 27.4317 6.96836 27.78 6.96836 27.7433V27.725ZM12.3217 15.24C12.7984 15.24 12.7617 17.3483 12.4317 17.9167C12.1831 17.0521 12.1454 16.1405 12.3217 15.2583V15.24ZM10.7267 24.1867C11.3478 23.0533 11.887 21.877 12.34 20.6667C12.8257 21.5704 13.5012 22.3585 14.32 22.9767C13.09 23.2848 11.888 23.6956 10.7267 24.205V24.1867ZM19.3434 23.8567C19.3434 23.8567 19.0134 24.26 16.905 23.3433C19.1967 23.1967 19.5817 23.7283 19.3434 23.875V23.8567Z",fill:"#fff"})]})})}function mo(t){return r(m,{...t,children:e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r("path",{d:"M20 8.70001H4C3.90151 8.70001 3.80398 8.68061 3.71299 8.64292C3.62199 8.60523 3.53931 8.54999 3.46967 8.48034C3.40003 8.4107 3.34478 8.32802 3.30709 8.23703C3.2694 8.14603 3.25 8.0485 3.25 7.95001C3.25 7.85152 3.2694 7.75399 3.30709 7.663C3.34478 7.57201 3.40003 7.48933 3.46967 7.41968C3.53931 7.35004 3.62199 7.29479 3.71299 7.2571C3.80398 7.21941 3.90151 7.20001 4 7.20001H20C20.1989 7.20001 20.3897 7.27903 20.5303 7.41968C20.671 7.56033 20.75 7.7511 20.75 7.95001C20.75 8.14892 20.671 8.33969 20.5303 8.48034C20.3897 8.621 20.1989 8.70001 20 8.70001Z",fill:"white"}),r("path",{d:"M16.44 20.75H7.56C7.24309 20.7717 6.92503 20.7302 6.62427 20.628C6.3235 20.5259 6.04601 20.365 5.80788 20.1548C5.56975 19.9446 5.37572 19.6891 5.23704 19.4034C5.09836 19.1176 5.01779 18.8071 5 18.49V7.99998C5 7.80107 5.07902 7.61031 5.21967 7.46965C5.36032 7.329 5.55109 7.24998 5.75 7.24998C5.94891 7.24998 6.13968 7.329 6.28033 7.46965C6.42098 7.61031 6.5 7.80107 6.5 7.99998V18.49C6.5 18.9 6.97 19.25 7.5 19.25H16.38C16.94 19.25 17.38 18.9 17.38 18.49V7.99998C17.38 7.78516 17.4653 7.57913 17.6172 7.42723C17.7691 7.27532 17.9752 7.18998 18.19 7.18998C18.4048 7.18998 18.6109 7.27532 18.7628 7.42723C18.9147 7.57913 19 7.78516 19 7.99998V18.49C18.9822 18.8071 18.9016 19.1176 18.763 19.4034C18.6243 19.6891 18.4303 19.9446 18.1921 20.1548C17.954 20.365 17.6765 20.5259 17.3757 20.628C17.075 20.7302 16.7569 20.7717 16.44 20.75ZM16.56 7.74998C16.4611 7.75133 16.363 7.73285 16.2714 7.69563C16.1798 7.65842 16.0966 7.60323 16.0267 7.53331C15.9568 7.4634 15.9016 7.38018 15.8644 7.28858C15.8271 7.19698 15.8087 7.09885 15.81 6.99998V5.50998C15.81 5.09999 15.33 4.74998 14.81 4.74998H9.22C8.67 4.74998 8.22 5.09999 8.22 5.50998V6.99998C8.22 7.1989 8.14098 7.38966 8.00033 7.53031C7.85968 7.67097 7.66891 7.74998 7.47 7.74998C7.27109 7.74998 7.08032 7.67097 6.93967 7.53031C6.79902 7.38966 6.72 7.1989 6.72 6.99998V5.50998C6.75872 4.8813 7.04203 4.29275 7.50929 3.87035C7.97655 3.44795 8.5906 3.22527 9.22 3.24998H14.78C15.4145 3.21717 16.0362 3.4362 16.51 3.85944C16.9838 4.28267 17.2713 4.87586 17.31 5.50998V6.99998C17.3113 7.09931 17.2929 7.19792 17.2558 7.29007C17.2187 7.38222 17.1637 7.46608 17.0939 7.53679C17.0241 7.6075 16.941 7.66364 16.8493 7.70195C16.7577 7.74027 16.6593 7.75999 16.56 7.75998V7.74998Z",fill:"white"}),r("path",{d:"M10.22 17C10.0219 16.9974 9.8326 16.9175 9.6925 16.7774C9.55241 16.6373 9.47256 16.4481 9.46997 16.25V11.72C9.46997 11.5211 9.54899 11.3303 9.68964 11.1896C9.83029 11.049 10.0211 10.97 10.22 10.97C10.4189 10.97 10.6096 11.049 10.7503 11.1896C10.891 11.3303 10.97 11.5211 10.97 11.72V16.24C10.9713 16.3393 10.9529 16.4379 10.9158 16.5301C10.8787 16.6222 10.8236 16.7061 10.7539 16.7768C10.6841 16.8475 10.601 16.9036 10.5093 16.9419C10.4177 16.9803 10.3193 17 10.22 17Z",fill:"white"}),r("path",{d:"M13.78 17C13.5811 17 13.3904 16.921 13.2497 16.7803C13.109 16.6396 13.03 16.4489 13.03 16.25V11.72C13.03 11.5211 13.109 11.3303 13.2497 11.1896C13.3904 11.049 13.5811 10.97 13.78 10.97C13.9789 10.97 14.1697 11.049 14.3104 11.1896C14.451 11.3303 14.53 11.5211 14.53 11.72V16.24C14.53 16.4398 14.4513 16.6316 14.311 16.7739C14.1706 16.9161 13.9799 16.9973 13.78 17Z",fill:"white"})]})})}function fo(e){const r=1048576;return e<r?`${(e/1024).toFixed(1)}KB`:`${(e/r).toFixed(1)}MB`}function ho({name:t="filesUid",tipoArquivo:a,title:c,required:d=!1,multiple:p=!1,apiURL:m,sizeLimit:g=4,xs:y=12,sm:b,md:x,route:v="",tstToken:C="",dropZoneOptions:w,disabled:k=!1}){const{getRootProps:E,getInputProps:S}=fe({disabled:k,multiple:p,useFsAccessApi:!0,onDrop:e=>{O(-1),e.filter(e=>!(e.size/1048576>g&&(j(`Por favor, escolha um arquivo com tamanho inferior a ${g} MB`),setTimeout(()=>{j("")},3e3),1))).forEach((e,r)=>{let t=Date.now()+r;const n=new FormData;n.append("files",e),n.append("tipoArquivo",a),me.post(m,n,{onUploadProgress:r=>{const n=Math.round(100*r.loaded/r.total);O(n),n>=100&&A(r=>[...r,{id:t,name:e.name,loading:!0,error:!1,file:e,size:e.size}])},headers:{Authorization:`Bearer ${""===C?I?I.token:"":C}`}}).then(e=>{if(e.status>200){const r=ne(e.data,v,e.data)[0].coSeqArquivo;D.setFilesUid(e=>[...e,{CO_SEQ_ARQUIVO:r,CO_TIPO_ARQUIVO:parseInt(a)}]),F(e=>[...e,t]);const n={};n[t]=r,P(e=>({...e,...n}))}else O(-1),z(t)}).catch(e=>{console.log(e),O(-1),z(t)})})},...w||{}}),D=J(dr),{user:I}=J(sr),Y=s();f(Y.breakpoints.only("xs"));const[M,O]=Z(-1),[T,A]=Z([]),[R,F]=Z([]),[V,P]=Z({}),[$,j]=Z(""),z=(e,r,t)=>{A(T.filter(r=>r.id!==e)),t&&D.setFilesUid(e=>e.filter(e=>e.CO_SEQ_ARQUIVO!==t)),r||(j("Erro ao enviar arquivo. Verifique o formato e tente mais tarde."),setTimeout(()=>{j("")},3e3))};return ee(()=>{if(m){const e=T.filter(e=>void 0!==V[e.id]).map(e=>({CO_SEQ_ARQUIVO:V[e.id],CO_TIPO_ARQUIVO:parseInt(a)}));D?.formSetValue(t,e)}else{const e=new DataTransfer;T.forEach(r=>{e.items.add(r.file)}),D?.formSetValue(t,e.files)}},[T,D,t,V,m,a]),ee(()=>()=>{D.setFilesUid(e=>e.filter(e=>e.CO_TIPO_ARQUIVO!==parseInt(a)))},[]),r(n,{item:!0,xs:y,sm:b,md:x,sx:{width:"100%",opacity:k?.5:1,pointerEvents:k?"none":"auto"},children:e(i,{bgcolor:"white",p:2,borderRadius:"8px",color:"#1E293B",children:[r(u,{required:d,sx:{marginBottom:2,textTransform:"capitalize"},children:c}),e(uo,{...E({className:"dropzone"}),bgcolor:"#EFEFEF",justifyContent:"center",alignItems:"center",textAlign:"center",borderRadius:"6px",py:8,border:"solid 1.5px #989898",sx:{borderStyle:"dashed",cursor:"pointer"},children:[r("input",{...S(),...D.formRegister(t,{validate:(e,r)=>{if(d&&(null==e||Array.isArray(e)&&0===e.length))return"O campo de arquivo é obrigatório"}})}),e(uo,{spacing:2,alignItems:"center",children:[e(i,{children:[r(o,{fontWeight:600,fontSize:18,children:"Arraste seus arquivos até aqui"}),r(o,{children:"ou selecione arquivos que estão no seu computador"})]}),r(l,{variant:"contained",sx:{backgroundColor:"#64748B",pointerEvents:"none",borderRadius:"8px",width:"fit-content"},disabled:k,children:"Selecionar"}),e(o,{fontWeight:300,children:["Tamanho máximo por arquivo ",g,"MB"]})]})]}),e(o,{pt:2,fontSize:16,fontWeight:600,children:["Você selecionou ",T.length," arquivo",T.length>1?"s":"","."]}),e(uo,{width:"100%",marginTop:1,spacing:1,children:[T.map(t=>e(uo,{direction:"row",justifyContent:"space-between",border:"solid 1px #E2E8F0",borderRadius:2,p:1,children:[e(uo,{direction:"row",children:[r(uo,{direction:"row",justifyContent:"center",alignItems:"center",minWidth:30,pr:1.5,children:r(po,{sx:{filter:"invert(42%) sepia(86%) saturate(2412%) hue-rotate(326deg) brightness(86%) contrast(102%)",transform:"scale(1.5)",width:30}})}),e(uo,{children:[r(o,{fontWeight:600,children:t.name}),r(o,{fontSize:14,children:fo(t.size)})]})]}),r(l,{size:"small",startIcon:r(mo,{}),variant:"contained",onClick:e=>{return r=t.id,void(Object.keys(V).includes(r.toString())&&fetch(`${m}/${V[r]}`,{method:"DELETE",headers:{Authorization:`Bearer ${""===C?I?I.token:"":C}`}}).then(e=>{e.ok||z(r,!0,V[r]),200===e.status&&z(r,!0,V[r])}).catch(e=>console.log(e)));var r},sx:{height:40,backgroundColor:"#DE3F50",borderRadius:"8px"},disabled:k,children:"Remover"})]})),M>0&&M<100&&r(h,{value:M,sx:{backgroundColor:"#103D6A",".MuiLinearProgress-bar":{backgroundColor:"#BDDDFA"}}})]}),$&&e(i,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:"16px",border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),r(o,{variant:"caption",color:"inherit",fontWeight:600,fontSize:14,children:$})]}),ne(D?.errors,t)&&e(i,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:"8px",border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),r(o,{variant:"caption",color:"inherit",fontWeight:600,fontSize:14,children:"O campo de arquivo é obrigatório"})]})]})})}function go({name:t,tipoArquivo:a,title:c,required:d=!1,multiple:p=!1,apiURL:m,route:h="",sizeLimit:x=4,xs:v=12,sm:C,md:w}){const k=J(dr),{user:E}=J(sr),S=s(),D=f(S.breakpoints.only("xs")),[I,Y]=Z([]),[M,O]=Z([]),[T,A]=Z({}),[R,F]=Z(""),V=Q(e=>{const r=e.target.files,t=Object.keys(r).map(e=>r[e]);Y([...I,...t.filter(e=>!(e.size/1048576>x&&(F(`Por favor, escolha um arquivo com tamanho inferior a ${x} MB`),setTimeout(()=>{F("")},3e3),1))).map((e,r)=>{let t=Date.now()+r;const n=new FormData;return n.append("files",e),n.append("tipoArquivo",a),fetch(m,{method:"POST",body:n,headers:{Authorization:`Bearer ${E?E.token:""}`}}).then(e=>{e.ok?e.json().then(e=>{if(e.status&&200===e.status.status){const r=ne(e,h,e)[0].coSeqArquivo;k.setFilesUid(e=>[...e,{CO_SEQ_ARQUIVO:r,CO_TIPO_ARQUIVO:parseInt(a)}]),O(e=>[...e,t]);const n={};n[t]=r,A(e=>({...e,...n}))}else P(t)}):P(t)}).catch(e=>{P(t)}),{id:t,name:e.name,loading:!0,error:!1,file:e}})])},[I,k]),P=(e,r,t)=>{Y(I.filter(r=>r.id!==e)),t&&k.setFilesUid(e=>e.filter(e=>e.CO_SEQ_ARQUIVO!==t)),r||(F("Erro ao enviar arquivo. Tente novamente mais tarde"),setTimeout(()=>{F("")},3e3))};return ee(()=>{const e=new DataTransfer;I.forEach(r=>{e.items.add(r.file)}),k?.formSetValue(t,e.files)},[I,k,t]),ee(()=>()=>{k.setFilesUid(e=>e.filter(e=>e.CO_TIPO_ARQUIVO!==parseInt(a)))},[]),e(n,{item:!0,xs:v,sm:C,md:w,sx:{width:"100%"},children:[r(u,{required:d,sx:{marginBottom:2,textTransform:"capitalize"},children:c}),e(i,{sx:{backgroundColor:"#e2eafc",padding:1,borderRadius:1,marginTop:1},children:[r("input",{id:t,type:"file",multiple:p,...k?.formRegister(t,{validate:(e,r)=>{if((e.length&&M.length)<=0&&d)return"O campo de arquivo é obrigatório"}}),onChange:V,accept:".pdf",style:{display:"none"}}),r("input",{id:t+"foto",type:"file",capture:"environment",multiple:p,...k?.formRegister(t,{validate:(e,r)=>{if((e.length&&M.length)<=0&&d)return"O campo de arquivo é obrigatório"}}),onChange:V,accept:".jpg, .png, .jpeg",style:{display:"none"}}),e(i,{sx:{display:{sx:"block",md:"flex"}},children:[r(i,{sx:{width:"100%",marginRight:{xs:0,md:1},marginBottom:{xs:1,md:0}},children:!p&&I.length>=1?r(l,{disabled:!0,variant:"contained",disableElevation:!0,startIcon:r(ve,{}),component:"span",sx:{textTransform:"none"},fullWidth:!0,children:"Escolher Documento"}):r("label",{htmlFor:t,children:r(l,{variant:"contained",disableElevation:!0,startIcon:r(ve,{}),component:"span",sx:{textTransform:"none"},fullWidth:!0,children:"Escolher Documento"})})}),r(i,{sx:{width:"100%"},children:!p&&I.length>=1?r(l,{disabled:!0,variant:"contained",disableElevation:!0,startIcon:r(ye,{}),component:"span",sx:{textTransform:"none",backgroundColor:"#0096c7"},fullWidth:!0,children:D?"Tirar Foto":"Escolher Imagem"}):r("label",{htmlFor:t+"foto",children:r(l,{variant:"contained",disableElevation:!0,startIcon:r(ye,{}),component:"span",sx:{textTransform:"none",backgroundColor:"#0096c7"},fullWidth:!0,children:D?"Tirar Foto":"Escolher Imagem"})})})]}),e(o,{fontWeight:600,paddingY:1,color:"black",children:["Você selecionou ",I.length," arquivo",I.length>1&&"s"]}),I.length>0&&r(g,{component:y,children:r(uo,{direction:"column",children:I.map(t=>e(uo,{direction:"row",justifyContent:"space-between",padding:.5,children:[r(i,{children:e(uo,{direction:"row",spacing:2,children:[M.includes(t.id)?r(xe,{sx:{fill:"#06d6a0"}}):r(b,{size:22,sx:{color:"black"}}),r(Ce,{color:"error"}),r(o,{fontWeight:600,children:t.name})]})}),r(i,{children:M.includes(t.id)&&r(l,{variant:"contained",size:"small",sx:{textTransform:"none",backgroundColor:"#d1495b","&:hover":{backgroundColor:"#c1121f"}},onClick:e=>{return r=t.id,void(Object.keys(T).includes(r.toString())&&fetch(`${m}/${T[r]}`,{method:"DELETE",headers:{Authorization:`Bearer ${E?.token}`}}).then(e=>{e.ok||P(r,!0,T[r]),200===e.status&&P(r,!0,T[r])}).catch(e=>console.log(e)));var r},startIcon:r(be,{}),children:"Remover"})})]},t.name))})}),R&&e(i,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:"16px",border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),r(o,{variant:"caption",color:"inherit",fontWeight:600,fontSize:14,children:R})]}),ne(k?.errors,t)&&e(i,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:"8px",border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),r(o,{variant:"caption",color:"inherit",fontWeight:600,fontSize:14,children:"* O campo de arquivo é obrigatório"})]})]})]})}function yo({defaultChecked:t=!1,...n}){const i=J(dr);ee(()=>{i?.formSetValue(n.name,t)},[]);const l=re(()=>n.overrideYes||"Sim",[n.overrideYes]),s=re(()=>n.overrideNo||"Não",[n.overrideNo]);return e(a,{sx:{alignItems:"center",justifyContent:"center"},children:[n.title&&r(u,{children:n.title}),r(x,{control:r(v,{defaultChecked:t,...i?.formRegister(n.name)}),label:r(o,{width:25,sx:{userSelect:"none",fontWeight:600},children:i?.formWatch(n.name)?l:s}),sx:{paddingLeft:1}})]})}var bo=/*#__PURE__*/H.memo(yo);function xo({invert:e=!1,hasCheckValue:n=!1,...o}){const i=J(dr);return ee(()=>()=>{(n?e:i.formWatch(o.switchId)===e)&&o.unregisterNameList.forEach(e=>i.formUnregister(e))},[o.unregisterNameList]),r(t,{})}function vo({invert:n=!1,checkValue:o,...i}){const a=J(dr);return r(t,{children:(o?a?.formWatch(i.switchId)===o!==n:a?.formWatch(i.switchId)!==n)&&e(t,{children:[r(xo,{switchId:i.switchId,unregisterNameList:i.unregisterNameList,hasCheckValue:!!o,invert:o?a?.formWatch(i.switchId)===o!==n:n}),i.children]})})}const Co=/*#__PURE__*/H.forwardRef(function({imaskConfig:e,onMaskChange:t,name:n,...o},i){const a=te(null),[l,s]=Z(""),[c,d]=Z(e.mask),u=J(dr),p=u.formWatch(n);return ee(()=>{void 0!==p&&p!==l&&s(p)},[p]),ee(()=>{const e=a.current?.maskRef?.value;void 0!==e&&u.formSetValue(n,e)},[l,n]),r(ke,{...o,...e,name:n,mask:c,value:l,ref:a,inputRef:i,onAccept:(e,r)=>{s(e),r.updateValue(),t?.(e,d)}})});function wo({formConfig:e,disabled:t,imaskConfig:n,onMaskChange:o}){return r(p,{...e,disabled:t,fullWidth:!0,InputProps:{inputComponent:Co,inputProps:{imaskConfig:n,onMaskChange:o}}})}const ko={cep:{mask:"00000-000"},phone:{mask:[{mask:"(00) 0000-0000"},{mask:"(00) 00000-0000"}],dispatch:(e,r)=>{const t=(r.value+e).replace(/\D/g,"");return t.length<=2?r.compiledMasks[0]:"9"===t.substring(2,3)?r.compiledMasks[1]:r.compiledMasks[0]}},sei:{mask:"00000-00000000/0000-00"},cpf:{mask:"000.000.000-00"},cnpj:{mask:"00.000.000/0000-00"},rg:{mask:"00000[000000]"},cpf_cnpj:{mask:[{mask:"000.000.000-00"},{mask:"00.000.000/0000-00"}],dispatch:(e,r)=>{const t=(r.value+e).replace(/\D/g,"");return r.compiledMasks[t.length>11?1:0]}}},Eo={cnpj:{length:18,message:"O CNPJ precisa ter no mínimo 14 dígitos"},cpf:{length:14,message:"O CPF precisa ter no mínimo 11 dígitos"},sei:{length:22,message:"O Número SEI precisa ter no mínimo 19 dígitos"},cep:{length:9,message:"O CEP precisa ter no mínimo 8 dígitos"}},So={backgroundColor:"white","& .MuiOutlinedInput-root":{borderRadius:"8px",transition:"all 0.2s","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"2px"},"&.Mui-error .MuiOutlinedInput-notchedOutline":{borderWidth:"2px"}}},Do=e=>({sx:{backgroundColor:e?"#FFEBEE":"transparent",borderRadius:"8px",padding:e?"8px 12px":0,marginBottom:e?"4px":0,marginTop:e?"8px":0,border:e?"1px solid #FFCDD2":"none",color:"error.main",marginLeft:0,marginRight:0}}),Io={mb:1,fontWeight:500,fontSize:"0.875rem",color:"text.primary",transform:"none",position:"static"};function Yo({type:t="input",name:o,title:a,required:l,numberMask:s="000000000000000",customPlaceholder:c,defaultValue:d="",inputMinLength:m=1,inputMaxLength:f=255,customValidate:h,xs:g=12,sm:y,md:b,gridProps:x,labelProps:v,disabled:C=!1,sx:w,InputProps:k,InputLabelProps:E,...S}){const D=J(dr),I=(e,r)=>{const n=e??"";if(0===n.length&&l)return"Este campo é obrigatório";if(h){const e=h(n,r);if(e)return e}const o=Eo[t];if(o&&n.length<o.length&&l)return o.message;if(["input","text","password","search","tel","url"].includes(t)||"number"===t){if(n.length>f)return`Limite máximo de ${f} caracteres`;if(n.length<m&&l)return`Limite mínimo de ${m} caracteres`}if("phone"===t){const e=n.replace(/\D/g,"");if(e.length>2){if("9"===e.substring(2,3)){if(n.length<15&&l)return"O número de celular precisa ter 11 dígitos"}else if(n.length<14&&l)return"O número fixo precisa ter 10 dígitos"}else if(n.length<14&&l)return"O número precisa ter pelo menos 10 dígitos"}if("email"===t){if(n.length>50)return"Limite máximo de 50 caracteres";if(!/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g.test(n)&&l)return"O e-mail inserido não é válido"}return"cpf_cnpj"===t&&(n.length<14||n.length>14&&n.length<18)&&l?"O CPF/CNPJ precisa ter no mínimo 11/14 dígitos":void 0},Y=ne(D.errors,o),M=Boolean(Y),O=D.formWatch(o),T=M?e(i,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),Y?.message]}):void 0,A=re(()=>w?[So,w].flat():So,[w]),R=re(()=>({...D.formRegister(o,{validate:I}),error:M,helperText:T,fullWidth:!0,size:"small",variant:"outlined",placeholder:c??a,FormHelperTextProps:Do(M),sx:A,InputProps:k,InputLabelProps:E,...S}),[o,M,T,c,a,A,k,E,S]);return e(n,{item:!0,xs:g,sm:y,md:b,...x,children:[a&&r(u,{required:l,sx:v?.sx?[Io,v.sx].flat():Io,...v,children:a}),(()=>{const e="number"===t?{mask:s}:ko[t];if(e)return r(wo,{formConfig:R,imaskConfig:e,disabled:C});const n="input"===t?"text":t;return r(p,{...R,type:n,value:O??d,onChange:e=>D.formSetValue(o,e.target.value),disabled:C})})()]})}var Mo=/*#__PURE__*/H.memo(Yo);function Oo({name:t,required:o=!1,title:i,defaultChecked:l=!1,xs:s=12,unregisterNameList:c,sm:d,md:u,...p}){const m=`${t}-switch`;return e(n,{item:!0,xs:s,sm:d,md:u,children:[i&&r(we,{required:o,sx:{textTransform:"capitalize"},children:i}),e(a,{direction:"row",children:[r(bo,{name:m,defaultChecked:l}),r(vo,{switchId:m,unregisterNameList:c,children:r(Yo,{name:"ddd",type:"input"})})]})]})}function To({name:t,required:o=!1,title:i,customPlaceholder:a,url:l,xs:s=12,sm:c,md:d,dataPath:u=""}){const m=J(dr),{user:f}=J(sr),[h,g]=Z([]);Ee(`autocomplete-${t}`,()=>fetch(l,{headers:{Authorization:`Bearer ${f?f.token:""}`}}).then(e=>e.json().then(e=>g(y(e)))));const y=Q(e=>Array.isArray(e)?e:"object"==typeof e?ne(e,u):void 0,[]),b=Q((e,r)=>{m?.formSetValue(t,r?r.id:""),m?.formTrigger(t)},[m,t]);return e(n,{item:!0,xs:s,sm:c,md:d,children:[i&&r(we,{required:o,children:i}),r("input",{type:"text",...m?.formRegister(t,{validate:(e,r)=>{if(e.length<=0&&o)return"Este campo é obrigatório"}}),hidden:!0}),r(C,{options:h,isOptionEqualToValue:(e,r)=>e.id===r.id,onChange:b,renderInput:e=>r(p,{...e,placeholder:a,size:"small",error:!!ne(m?.errors,t),helperText:ne(m?.errors,t)?.message})})]})}let Ao=!0;function Ro({name:t,url:o,title:a,customLoadingText:l,shouldRefetch:s=!0,required:c=!1,defaultValue:d,route:m="",onChange:f=()=>{},xs:h=12,sm:g,watchValue:y,md:b,disabled:x=!1}){const v=J(dr),[w,k]=Z(!0),[E,S]=Z([]),[D,I]=Z("Carregando..."),[Y,M]=Z(null),[O,T]=Z(null),[A,R]=Z(null),{user:F}=J(sr),V=function(e,r,n=!1){try{return Promise.resolve(function(o,i){try{var a=(R(null),Promise.resolve(fetch(e,{method:"GET",headers:{Authorization:`Bearer ${F?.token}`}})).then(function(e){if(!e.ok){const r=401===e.status?"Sessão expirada. Faça login novamente.":403===e.status?"Acesso negado. Verifique suas permissões.":e.status>=500?"Erro interno do servidor. Tente novamente mais tarde.":"Erro ao carregar dados";return R(r),I(r),void k(!1)}return Promise.resolve(e.json()).then(function(e){const o=ne(e,r,e);if(n){const e=o.filter(e=>e.id===d);e.length>0?(S(o),k(!1),v.formSetValue(t,d),M(e[0])):(R("Valor padrão inválido"),I("Erro ao carregar dados. Valor inválido"),k(!1))}else S(o),k(!1)})}))}catch(e){return i(e)}return a&&a.then?a.then(void 0,i):a}(0,function(e){console.error("Network error:",e),R("Erro de conexão. Verifique sua internet e tente novamente."),I("Erro de conexão. Verifique sua internet e tente novamente."),k(!1)}))}catch(e){return Promise.reject(e)}};function P(){(d||!s)&&E.length>0||(k(!0),S([]),l&&I(l),V(o,m,!1))}return ee(()=>{d&&V(o,m,!0)},[]),ee(()=>{y&&Ao&&(T(y),v.formSetValue(t,y.id),f(y.id))},[y]),d&&E.length<=0&&!Y?r(n,{item:!0,xs:h,sm:g,md:b,children:r(p,{size:"small",fullWidth:!0,placeholder:D,disabled:!0})}):e(n,{item:!0,xs:h,sm:g,md:b,children:[a&&r(u,{required:c,children:a}),r("input",{type:"text",...v?.formRegister(t,{validate:(e,r)=>e?e.length<=0&&c?"Este campo é obrigatório":void 0:"Este campo é obrigatório"}),hidden:!0}),r(C,{value:O,loading:w,loadingText:D,options:E,defaultValue:Y,getOptionDisabled:e=>e?.disabled??!1,isOptionEqualToValue:(e,r)=>e.id===r.id,onChange:(e,r)=>function(e){if(Ao=!1,e)return T(e),v.formSetValue(t,e.id),void f(e.id);T(null),v.formSetValue(t,""),f(void 0)}(r),renderInput:n=>{const o=ne(v?.errors,t),l=!!o||!!A;let s=o?.message||A;return l&&(s=e(i,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),s]})),r(p,{...n,size:"small",fullWidth:!0,placeholder:a,onFocus:P,error:l,helperText:s,FormHelperTextProps:{sx:{backgroundColor:l?"#FFEBEE":"transparent",borderRadius:"8px",padding:l?"8px 12px":0,marginBottom:l?"4px":0,marginTop:l?"8px":0,border:l?"1px solid #FFCDD2":"none",color:"error.main",marginLeft:0,marginRight:0}}})},sx:{bgcolor:"white","& .MuiOutlinedInput-root":{borderRadius:"8px",transition:"all 0.2s","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"2px"},"&.Mui-error .MuiOutlinedInput-notchedOutline":{borderWidth:"2px"}}},size:"small",fullWidth:!0,disabled:x})]})}let Fo=!0;function Vo({name:t,title:o,required:a=!1,list:l,defaultValue:s,onChange:c=()=>{},xs:d=12,sm:m,watchValue:f,forceUpdate:h=!1,md:g}){const y=J(dr),[b,x]=Z(null);return ee(()=>{s&&y?.formSetValue(t,s.id)},[]),ee(()=>{f&&(Fo||h)?(x(f),y.formSetValue(t,f.id),c(f.id)):void 0===f&&(Fo||h)&&(x(null),y.formSetValue(t,void 0),c(void 0))},[f]),e(n,{item:!0,xs:d,sm:m,md:g,children:[o&&r(u,{required:a,children:o}),r("input",{type:"text",...y?.formRegister(t,{validate:(e,r)=>{if(a&&!e)return"Este campo é obrigatório"}}),hidden:!0}),r(C,{value:b,options:l,defaultValue:s,getOptionLabel:e=>e.label?e.label.toString():"Não Encontrado",isOptionEqualToValue:(e,r)=>e.id===r.id,onChange:(e,r)=>function(e){if(Fo=!1,e)return x(e),y.formSetValue(t,e.id),void c(e.id);x(null),y.formSetValue(t,""),c(void 0)}(r),renderInput:n=>{const a=ne(y?.errors,t),l=!!a;let s=a?.message;return l&&(s=e(i,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),s]})),r(p,{...n,size:"small",fullWidth:!0,placeholder:o,error:l,helperText:s,FormHelperTextProps:{sx:{backgroundColor:l?"#FFEBEE":"transparent",borderRadius:"8px",padding:l?"8px 12px":0,marginBottom:l?"4px":0,marginTop:l?"8px":0,border:l?"1px solid #FFCDD2":"none",color:"error.main",marginLeft:0,marginRight:0}}})},size:"small",sx:{bgcolor:"white","& .MuiOutlinedInput-root":{borderRadius:"8px",transition:"all 0.2s","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"2px"},"&.Mui-error .MuiOutlinedInput-notchedOutline":{borderWidth:"2px"}}},fullWidth:!0})]})}let Po=!0;function $o({name:t,url:o,title:i,customLoadingText:a,shouldRefetch:l=!0,required:s=!1,defaultValue:c,route:d="",onChange:m=()=>{},xs:f=12,sm:h,watchValue:g,md:y,disabled:b=!1}){const x=de(),[v,w]=Z(!0),[k,E]=Z([]),[S,D]=Z("Carregando..."),[I,Y]=Z(null),[M,O]=Z(null),{user:T}=J(sr);function A(){(c||!l)&&k.length>0||(w(!0),E([]),a&&D(a),fetch(o,{method:"GET",headers:{Authorization:`Bearer ${T?.token}`}}).then(e=>{e.ok?e.json().then(e=>{E(ne(e,d,e)),w(!1)}):D("Erro ao carregar dados")}))}return ee(()=>{c&&fetch(o,{method:"GET",headers:{Authorization:`Bearer ${T?.token}`}}).then(e=>{e.ok?(console.log("llll"),e.json().then(e=>{let r=ne(e,d,e).filter(e=>e.id===c);r.length>0?(E(ne(e,d,e)),w(!1),x.setValue(t,c),Y(r[0])):D("Erro ao carregar dados. Valor inválido")})):D("Erro ao carregar dados")})},[]),ee(()=>{g&&Po&&(O(g),x.setValue(t,g.id),m(g.id))},[g]),c&&k.length<=0&&!I?r(n,{item:!0,xs:f,sm:h,md:y,children:r(p,{size:"small",fullWidth:!0,placeholder:S,disabled:!0})}):e(n,{item:!0,xs:f,sm:h,md:y,children:[i&&r(u,{required:s,children:i}),r("input",{type:"text",...x?.register(t,{validate:(e,r)=>{if(e.length<=0&&s)return"Este campo é obrigatório"}}),hidden:!0}),r(C,{value:M,loading:v,loadingText:S,options:k,defaultValue:I,getOptionDisabled:e=>e?.disabled??!1,isOptionEqualToValue:(e,r)=>e.id===r.id,onChange:(e,r)=>function(e){if(Po=!1,e)return O(e),x.setValue(t,e.id),void m(e.id);O(null),x.setValue(t,""),m(void 0)}(r),renderInput:e=>r(p,{...e,size:"small",fullWidth:!0,placeholder:i,onFocus:A,error:!!ne(x.formState.errors,t),helperText:ne(x.formState.errors,t)?.message}),sx:{bgcolor:"white"},size:"small",fullWidth:!0,disabled:b})]})}const jo=/*#__PURE__*/H.forwardRef(function(e,t){const{onChange:n,maskProps:o,onMask:i,maskValue:a,setMaskValue:l,watchValue:s,...c}=e,[d,u]=Z(o.mask);delete c.value;const p=te(null),[m,f]=Z(""),h=de();return ee(()=>{s&&f(s)},[s]),ee(()=>{h.setValue(c.name,p.current.element.value)},[m]),delete c.watchValue,r(ke,{...c,...o,mask:d,value:m,ref:p,inputRef:t,onChange:e=>{},onAccept:(e,r)=>{f(e),r.updateValue(),i&&i(e,u)}})});function No(e){const n=J(dr),[o,i]=Z("");return r(t,{children:r(p,{...e.formConfig,onInput:r=>{n.formSetValue(e.formConfig.name,r.target.value)},InputProps:{inputComponent:jo,inputProps:{maskProps:e.maskProps,onMask:e.onMask,maskValue:o,setMaskValue:i,watchValue:e.watchValue}},disabled:e.disabled,fullWidth:!0})})}function zo({type:t="input",numberMask:o="000000000000000",xs:i=12,sm:a,inputMinLength:l=1,inputMaxLength:s=255,defaultValue:c="",md:d,disabled:m=!1,watchValue:f,...h}){const g=de();return ee(()=>{void 0!==f&&g.setValue(h.name,f)},[f]),e(n,{item:!0,xs:i,sm:a,md:d,children:[h.title&&r(u,{htmlFor:"campo",required:h.required,sx:{mb:1,fontWeight:500,fontSize:"0.875rem",color:"text.primary",transform:"none",position:"static"},children:h.title}),(()=>{const e={fullWidth:!0,size:"small",placeholder:h.customPlaceholder?h.customPlaceholder:h.title},n=h.name,i=ne(g?.formState.errors,h.name),a=i?.message,d=!!i,u={...g?.register(n,{validate:(e,r)=>{const n=e??"";if(n.length<=0&&h.required)return"Este campo é obrigatório";if("cnpj"===t){if(n.length<18&&h.required)return"O CNPJ precisa ter no mínimo 14 dígitos"}else if("cpf"===t){if(n.length<14&&h.required)return"O CPF precisa ter no mínimo 11 dígitos"}else if("sei"===t){if(n.length<22&&h.required)return"O Número SEI precisa ter no mínimo 19 dígitos"}else if("cep"===t){if(n.length<9&&h.required)return"O CPF precisa ter no mínimo 8 dígitos"}else if("input"===t||"password"===t||"number"===t){if(n.length>s)return`Limite máximo de ${s} caracteres`;if(n.length<l&&h.required)return`Limite mínimo de ${l} caracteres`}else if("email"===t){if(n.length>50)return"Limite máximo de 50 caracteres";if(!/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g.test(e)&&h.required)return"O e-mail inserido não é valido"}else if("cpf_cnpj"===t){if((n.length<14||n.length>14&&n.length<18)&&h.required)return"O CPF/CNPJ precisa ter no mínimo 11/14 dígitos"}else if("phone"===t&&n.length<14&&h.required)return"O número precisa ter pelo menos 10 dígitos"}}),error:d,helperText:a,...e,sx:{backgroundColor:"white","& .MuiOutlinedInput-root":{borderRadius:"8px",transition:"all 0.2s","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"1px"}}}};switch(t){case"input":case"email":return r(p,{...u,defaultValue:c,disabled:m});case"password":return r(p,{...u,type:"password",disabled:m});case"number":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:o},watchValue:f,disabled:m});case"cep":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"00000-000"},watchValue:f,disabled:m});case"phone":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"(00) [#]0000-0000",definitions:{"#":/^9$/}},watchValue:f,disabled:m});case"sei":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"00000-00000000/0000-00"},watchValue:f,disabled:m});case"cpf_cnpj":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"000.000.000-00[0]"},onMask:(e,r)=>{r(e.length>14?"00.000.000/0000-00":"000.000.000-00[0]")},watchValue:f,disabled:m});case"cpf":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"000.000.000-00"},watchValue:f,disabled:m});case"cnpj":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"00.000.000/0000-00"},watchValue:f,disabled:m});case"rg":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"00000[000000]"},watchValue:f,disabled:m})}})()]})}var Bo=/*#__PURE__*/H.memo(zo);function Lo({name:t,required:o=!1,title:i,customPlaceholder:a,defaultValue:l="",xs:s=12,sm:c,watchValue:d="",inputMinLength:u=3,inputMaxLength:m=255,md:f,...h}){const g=de();return ee(()=>{g.setValue(t,d)},[d]),e(n,{item:!0,xs:s,sm:c,md:f,children:[i&&r(we,{required:o,sx:{textTransform:"capitalize",mb:1,fontWeight:500,fontSize:"0.875rem",color:"text.primary",transform:"none",position:"static"},children:i}),r(p,{multiline:!0,fullWidth:!0,minRows:3,defaultValue:l,...g.register(t,{validate:(e,r)=>o&&e.length<=0?"Este campo é obrigatório":e.length>m?`Limite máximo de ${m} caracteres`:e.length<u&&o?`Limite mínimo de ${u} caracteres`:void 0}),error:!!ne(g.formState.errors,t),helperText:ne(g.formState.errors,t)?.message,sx:{bgcolor:"white","& .MuiOutlinedInput-root":{borderRadius:"8px","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"1px"}}},placeholder:a||i})]})}function Wo({name:t,required:o=!1,title:a,customPlaceholder:l,defaultValue:s="",xs:c=12,sm:d,watchValue:u="",inputMinLength:m=3,inputMaxLength:f=255,md:h,...g}){const y=J(dr);ee(()=>{y.formSetValue(t,u)},[u]);const b=ne(y.errors,t);let x=b?.message;const v=!!b;return v&&(x=e(i,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),x]})),e(n,{item:!0,xs:c,sm:d,md:h,children:[a&&r(we,{required:o,sx:{textTransform:"capitalize",mb:1,fontWeight:500,fontSize:"0.875rem",color:"text.primary",transform:"none",position:"static"},children:a}),r(p,{multiline:!0,fullWidth:!0,minRows:3,defaultValue:s,...y.formRegister(t,{validate:(e,r)=>o&&e.length<=0?"Este campo é obrigatório":e.length>f?`Limite máximo de ${f} caracteres`:e.length<m&&o?`Limite mínimo de ${m} caracteres`:void 0}),error:v,helperText:x,FormHelperTextProps:{sx:{backgroundColor:v?"#FFEBEE":"transparent",borderRadius:"8px",padding:v?"8px 12px":0,marginBottom:v?"4px":0,marginTop:v?"8px":0,border:v?"1px solid #FFCDD2":"none",color:"error.main",marginLeft:0,marginRight:0}},sx:{bgcolor:"white","& .MuiOutlinedInput-root":{borderRadius:"8px","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"2px"},"&.Mui-error .MuiOutlinedInput-notchedOutline":{borderWidth:"2px"}}},placeholder:l||a})]})}function _o({name:t,required:a=!1,xs:l=12,sm:d,md:u}){const m=J(dr),f=`switch-${t}`;ee(()=>{m.formWatch(f)||m.formSetValue(t,void 0)},[m]);const h=s(),g=m.formWatch(f);return r(n,{item:!0,xs:l,sm:d,md:u,children:e(i,{onClick:()=>{m.formSetValue(f,!g)},sx:{border:"1px solid",borderColor:g?h.palette.primary.main:"#E0E0E0",borderRadius:"8px",padding:"8px 16px",cursor:"pointer",backgroundColor:g?`${h.palette.primary.main}10`:"white",transition:"all 0.2s",display:"flex",alignItems:"center",mb:.5,"&:hover":{borderColor:g?void 0:h.palette.grey[400],backgroundColor:g?void 0:h.palette.grey[50]}},children:[r(c,{checked:!!g,size:"small",sx:{padding:0,mr:1.5,"&.Mui-checked":{color:h.palette.primary.main}}}),r(i,{sx:{flexGrow:1},onClick:e=>e.stopPropagation(),children:g?r(p,{size:"small",fullWidth:!0,...m.formRegister(t,{validate:(e,r)=>{if(!0===m.formWatch(f)&&(!e||e.length<=0&&a))return"Este campo não pode ser vazio"}}),required:a,error:!!ne(m.errors,t),helperText:ne(m.errors,t)?.message,placeholder:"Outro",sx:{"& .MuiOutlinedInput-root":{backgroundColor:"white"}}}):r(o,{color:"text.primary",children:"Outro"})})]})})}const qo=(e,r)=>{if(!e||Object.keys(e).length<=0)return[];if(!e[r])return[];let t=Object.keys(e[r]).map(e=>`${r}.${e}`);return e.files&&(t=[...t,...Object.keys(e.files).map(e=>`files.${e}`)]),t};function Uo({debugLog:t=!1,test:n=!1,testConfig:o={},customMarginBottom:c=10,...d}){d.children=Array.isArray(d.children)?d.children.filter((e,r)=>e):d.children;const u=Array.isArray(d.children)?d.children.length:1,p=J(dr),m=te(null),h=s(),[g,y]=Z(0),b=(Array.isArray(d.children)?d.children:[d.children]).map((e,r)=>/*#__PURE__*/H.cloneElement(e,{...e.props,prefix:r})),x=u;return e(i,{children:[n&&r(a,{direction:"row",justifyContent:"end",children:r(l,{variant:"contained",color:"error",onClick:()=>{Object.keys(o).forEach((e,r)=>{const t=o[Number(e)];Object.keys(t).forEach(r=>{p.formUnregister(`${e}.${r}`),p.formSetValue(`${e}.${r}`,t[r])}),r<Object.keys(o).length-1&&new Promise(e=>setTimeout(e,100)).then(()=>{m.current?.click()})})},children:"EXCLUIR BANCO PRODUÇÃO"})}),e(a,{sx:{padding:2,marginBottom:c},children:[r(i,{children:b.map((e,t)=>r(i,{hidden:!(g===t),children:b[t]},"formsB"+t))}),r(w,{variant:"text",steps:x,position:f(h.breakpoints.only("xs"))?"bottom":"static",activeStep:g,sx:{paddingTop:2,paddingBottom:4,paddingX:0},backButton:r(l,{variant:"contained",startIcon:r(Se,{}),onClick:()=>{y(e=>e-1)},disabled:0===g,sx:{textTransform:"none"},children:"Voltar"}),nextButton:g<x-1?r(l,{variant:"contained",endIcon:r(De,{}),onClick:function(){try{return t&&console.log(p.formGetValues()),Promise.resolve(p.formTrigger(qo(p.formGetValues(),g))).then(function(e){e?y(e=>e+1):Me("Formulário incompleto! Verifique os campos marcados e tente novamente.",{type:"warning",theme:"light"})})}catch(e){return Promise.reject(e)}},sx:{textTransform:"none"},ref:m,children:"Próximo"}):r(i,{children:r(Ye,{variant:"contained",type:"submit",loading:p.submiting,loadingPosition:"start",startIcon:r(Ie,{}),onClick:e=>function(e){try{return Promise.resolve(p.formTrigger(qo(p.formGetValues(),g))).then(function(r){r||(e.preventDefault(),Me("Formulário incompleto! Verifique os campos marcados e tente novamente.",{type:"warning",theme:"light"}))})}catch(e){return Promise.reject(e)}}(e),sx:{textTransform:"none",backgroundColor:"#22C55E","&:hover":{backgroundColor:"#48cf7a"}},children:r("span",{children:"Salvar"})})})})]})]})}var Ko=/*#__PURE__*/H.memo(Uo);function Xo(e,r,t){if(!e.props)return e;const n=e.props.children;if(!n)/*#__PURE__*/return H.cloneElement(e,{...e.props,name:`${r}.${e.props.name}`,key:e.props.name?`${r}.${e.props.name}`:`noListing-${t}-${r}-${e.props.name}`});let o;if(Array.isArray(n)){let e=[];n.forEach((n,o)=>{e.push(Xo(n,r,t+(o+1)))}),o=e}else o=Xo(n,r,t+1);/*#__PURE__*/return H.cloneElement(e,{...e.props,children:o,name:`${r}.${e.props.name}`,key:e.props.name?`${r}.${e.props.name}`:`noListing-${t}-${r}-${e.props.name}`})}function Ho({optional:o=!1,title:l,prefix:s=0,optionalMessage:c,defaultChecked:d,...u}){const p=J(dr),m=`switch-${s}`,f=(Array.isArray(u.children)?u.children:[u.children]).map((e,r)=>e&&Xo(e,s,r));return e(i,{children:[r(n,{item:!0,xs:12,children:e(a,{direction:"row",justifyContent:"space-between",children:[e(a,{direction:"row",spacing:2,children:[r(i,{sx:{marginTop:.6},children:r(a,{sx:{backgroundColor:"#E6F8EB",borderRadius:"100%",height:"35px",width:"35px"},justifyContent:"center",alignItems:"center",children:r(Te,{sx:{height:"18px",fill:"#01BA35"}})})}),r(Ae,{variant:"h6",fontWeight:600,fontSize:28,fontFamily:"Inter",sx:{color:"#1E293B",paddingBottom:4},children:l})]}),r(i,{hidden:!o,children:r(bo,{name:m,defaultChecked:!o||d,overrideNo:u.overrideSwitchNo,overrideYes:u.overrideSwitchYes})})]})}),r(a,{spacing:2,children:o?p.formWatch(m)?r(n,{container:!0,spacing:1,children:f}):r(a,{justifyContent:"center",alignItems:"center",children:r(Ae,{fontFamily:"Inter",fontSize:22,paddingY:8,textAlign:"center",children:c||e(t,{children:[r("b",{children:l})," é opcional. ",r("br",{}),"Marque a opção acima caso haja necessidade."]})})}):r(n,{container:!0,spacing:1,children:f})})]})}var Go=/*#__PURE__*/H.memo(Ho);let Jo={open:()=>{},close:()=>{},openReparented:()=>{},reparent:()=>r(t,{})};function Qo(){const[n,l]=Z(!1),[c,d]=Z(null),u=()=>l(!1);te(null);const p=s(),m=f(p.breakpoints.up("sm")),[h,g]=Z({}),[y,b]=Z(-1321465654);return ee(()=>{Jo.open=e=>{e&&d(e),b(-1321465654),l(!0)},Jo.reparent=(e,n)=>(g(o=>({...o,[n]:r(t,{children:e})})),r(t,{})),Jo.openReparented=e=>{b(e),d(null),l(!0)},Jo.close=u},[l]),r(t,{children:m?r(E,{open:n,onClose:u,children:e(i,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",borderRadius:2,bgcolor:"white",border:"1px solid #454545",boxShadow:24},children:[r(i,{onClick:u,width:"fit-content",height:"fit-content",position:"absolute",right:0,top:0,margin:.6,sx:{":hover":{transform:"scale(1.03)",transition:"all 500ms",cursor:"pointer"}},children:r(Be,{sx:{transform:"scale(.9)"}})}),e(i,{overflow:"auto",maxHeight:"90vh",p:2,marginTop:4,borderTop:"solid 1px gray",bgcolor:"#F9F9F9",borderRadius:2,children:[c,h[y]]})]})}):e(k,{anchor:"bottom",open:n,onClose:u,onOpen:()=>{},PaperProps:{sx:{bgcolor:"transparent"}},children:[r(a,{direction:"row",onClick:u,maxHeight:"8vh",height:"8vh",justifyContent:"center",alignItems:"center",children:r(o,{fontWeight:600,color:"white",children:"Clique fora para fechar"})}),e(i,{p:2,maxHeight:"92vh",bgcolor:"white",overflow:"auto",children:[c,h[y]]})]})})}function Zo({customColor:e="#383838",customFontColor:t="white",...n}){const o=Le(e);return r(l,{...n,sx:{bgcolor:o.toHexString(),color:Le(t).toHexString(),":hover":{bgcolor:o.darken(10).toHexString()},boxShadow:"none",borderRadius:3,textTransform:"capitalize",paddingX:2},size:"small",children:n.children})}function ei({data:n=[],...o}){const[i,a]=H.useState(null),l=Boolean(i),s=()=>{a(null)};return e(t,{children:[r(Zo,{...o.btProps,onClick:e=>{a(e.currentTarget)},children:o.children}),r(S,{id:"basic-menu",anchorEl:i,open:l,onClose:s,MenuListProps:{"aria-labelledby":"basic-button"},children:n.map(e=>r(D,{onClick:r=>{e.onClick&&e.onClick(),s()},children:e.name}))})]})}function ri(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]/g,"")}function ti(e){return("string"!=typeof e?e.toString():e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}let ni=[],oi=!1,ii="",ai=!1,li={},si="";function ci({mediaQueryLG:n,columns:o,emptyMsg:c={user:"Nenhum dado encontrado",public:"Nenhum dado encontrado"},dataPath:d="",tableName:u="Dados",csv:p,columnSize:m,action:g,useKC:b=!0,statusKeyName:x="",csvExcludeKeys:v=[],csvExcludeKeysCSV:C=[],csvExcludeKeysAll:w=[],csvCustomKeyNames:k={},csvExcludeValidate:E=(e,r)=>!1,csvButtonTitle:S="Salvar .CSV",csvNoZipText:D="Salvar .CSV",csvAllButtonTitle:T="Salvar todos em CSV",removeQuotes:A=!1,normalize:R=!1,csvShowAllButton:F=!1,csvWithoutZip:V=!1,itemCount:P=10,csvUpper:$=!1,csvZipFileNamesKey:j="",generateCsvZip:N=!1,hideTitleCSV:U=!1,csvExcludeUpper:X=[],multipleDataPath:H="",expandTextMaxLength:G=50,collapsedSize:re=53,customMargin:oe=4,customMarginMobile:ie=0,filtersFunc:ae,filters:le=[],orderBy:ce=[],customErrorMsg:de,customTableStyle:ue={},id:pe,initialData:me=null,isLoading:fe,alwaysExpanded:he=!1}){const[ge,ye]=Z(null),[be,xe]=Z(me),{user:ve,userLoaded:Ce}=J(sr),[we,ke]=Z([]),[Ee,Se]=Z([]),[De,Ie]=Z(P),[Ye,Me]=Z(0),[Oe,Te]=Z(1),[Be,Le]=Z(1);Z("");const[We,_e]=Z({}),[qe,Ue]=Z({}),[Ke,Xe]=Z({}),[He,Ge]=Z("filterKey"),Je=s(),Qe=f(Je.breakpoints.only("xs")),Ze=te(null),er=f(Je.breakpoints.up(2e3));ii=`tableFilter_${pe}`,si=`tableFilterCache_${pe}`,li=ae??{},localStorage.getItem(si)||localStorage.setItem(si,JSON.stringify(le)),localStorage.getItem(si)!==JSON.stringify(le)&&(localStorage.setItem(si,JSON.stringify(le)),localStorage.removeItem(ii));const rr=Q(e=>{if(e.length<=0)return 1;let r=e.length/De;return r=r<1?1:r,Math.ceil(r)},[De]),tr=Q(e=>Array.isArray(e)?e:"object"==typeof e?ne(e,d):void 0,[]);ee(()=>{if(ge||!tr(be))return;const e=tr(be);ke(e),Se(e),Te(rr(e)),localStorage.getItem(ii)&&dr(JSON.parse(localStorage.getItem(ii)))},[De,be,rr,ge]),ee(()=>{Me(Be-1)},[Be]);const nr=Q((e,r)=>{Le(r)},[]),or=Q(()=>{const e=Ye*De;return we.slice(e,e+De)},[we,De,Ye]),ir=Q((e,r=!1)=>{if(e.preventDefault(),we.length<=0)return;const t=Object.keys(we[0]);if(N&&r){const e=t.filter(e=>!v.includes(e)),r=e.map(e=>k[e]?k[e]:e).join(",")+"\n",o=new ze,i={};we.forEach(e=>{i[e[j]]||(i[e[j]]=[]),i[e[j]].push(e)}),Object.keys(i).forEach(n=>{const a=[];i[n].forEach(r=>{let n=!0;if(t.forEach(e=>{E(e,r[e])&&(n=!1)}),n){const t=e.map(e=>{if("string"==typeof r[e]){let t=$?r[e].toUpperCase():r[e];return t=R?t.normalize("NFD").replace(/[\u0300-\u036f]/g,""):t,A?`${t}`:`"${t}"`}if("object"==typeof r[e]&&!Array.isArray(r[e])&&null!==r[e]){let t=ar(r[e]).slice(1,-1),n=$&&!X.includes(e)?t.toUpperCase():t;return n=R?n.normalize("NFD").replace(/[\u0300-\u036f]/g,""):n,A?`${n}`:`"${n}"`}return r[e]}).join(",");a.push(t)}});const l=U?a.join("\n"):"\ufeff"+r+a.join("\n");a.length>0&&o.file(`${n.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}.csv`,l)});var n=window.document.createElement("a");o.generateAsync({type:"base64"}).then(e=>{n.setAttribute("href","data:application/zip;base64,"+e),n.setAttribute("download",`${p?.fileName}.zip`),n.click()})}else{let e=t.filter(e=>!C.includes(e)).map(e=>e===H?"hrTermino":e);""!==H&&(e=["dtInicio","hrInicio",...e]);const r=e.map(e=>k[e]?k[e]:e).join(",")+"\n",o=[];we.forEach(r=>{let n=!0;if(t.forEach(e=>{E(e,r[e])&&(n=!1)}),n){const t=e.map(e=>{if("dtInicio"===e)return"{dtInicio}";if("hrInicio"===e)return"{hrInicio}";if("hrTermino"===e)return"{hrTermino}";if("string"==typeof r[e]){let t=$&&!X.includes(e)?r[e].toUpperCase():r[e];return t=R?t.normalize("NFD").replace(/[\u0300-\u036f]/g,""):t,A?`${t}`:`"${t}"`}if("object"==typeof r[e]&&!Array.isArray(r[e])&&null!==r[e]){let t=ar(r[e]).slice(1,-1),n=$&&!X.includes(e)?t.toUpperCase():t;return n=R?n.normalize("NFD").replace(/[\u0300-\u036f]/g,""):n,A?`${n}`:`"${n}"`}return r[e]}).join(",");if(""!==H){const e=r[H];e&&e.forEach(e=>{o.push(t.replace("{dtInicio}",e.dtInicio).replace("{hrInicio}",e.hrInicio).replace("{hrTermino}",e.hrTermino))})}else o.push(t)}});const i=r+o.join("\n");(n=window.document.createElement("a")).setAttribute("href","data:text/csv;charset=utf-8,%EF%BB%BF"+encodeURI(i)),n.setAttribute("download",`${p?.fileName}.csv`),n.click()}},[we]);function ar(e){let r=[];if("object"==typeof e&&!Array.isArray(e)&&null!==e)for(let[t,n]of Object.entries(e))"object"!=typeof n||Array.isArray(n)||null===n?n&&r.push(t):r.push(t+": "+ar(n));return"["+r.join(" - ")+"]"}const lr=Q(e=>{if(e.preventDefault(),we.length<=0)return;const r=Object.keys(we[0]).filter(e=>!w.includes(e)),t=r.join(",")+"\n",n=we.map(e=>r.map(r=>{if("tbRa"===r)return e[r].NO_CIDADE;if("rlEventoData"===r)return`${e[r][0].DT_INICIO} - ${e[r][0].HR_INICIO}`;if("string"==typeof e[r]){let t=$&&!X.includes(r)?e[r].toUpperCase():e[r];return t=R?t.normalize("NFD").replace(/[\u0300-\u036f]/g,""):t,A?`${t}`:`"${t}"`}if("object"==typeof e[r]&&!Array.isArray(e[r])&&null!==e[r]){let t=ar(e[r]).slice(1,-1),n=$&&!X.includes(r)?t.toUpperCase():t;return n=R?n.normalize("NFD").replace(/[\u0300-\u036f]/g,""):n,A?`${n}`:`"${n}"`}return e[r]}).join(",")).join("\n"),o=t+n;var i=window.document.createElement("a");i.setAttribute("href","data:text/csv;charset=utf-8,%EF%BB%BF"+encodeURI(o)),i.setAttribute("download",`${p?.fileName}.csv`),i.click()},[we]);function cr(){ke(ni),Se(ni),Te(rr(ni)),Me(0),Le(1),localStorage.removeItem(ii),Ge((new Date).getTime().toString())}function dr(e){if(!ni)return;let r=JSON.parse(JSON.stringify(ni));e.filter(e=>e.value||"entre"===e.operator&&(e.value||e.value2)).forEach(e=>{let t=[];switch(e.type){case"number":switch(e.operator){case"igual":r.forEach(r=>{Number(ne(r,e.keyName,""))===Number(e.value)&&t.push(r)});break;case"maior que":r.forEach(r=>{Number(ne(r,e.keyName,""))>Number(e.value)&&t.push(r)});break;case"menor que":r.forEach(r=>{Number(ne(r,e.keyName,""))<Number(e.value)&&t.push(r)})}break;case"string":switch(console.log("ata: ",e.operator),e.operator){case"igual":r.forEach(r=>{const n=ne(r,e.keyName,"");e.useList?ti(n)===ti(e.value.id)&&t.push(r):ti(n)===ti(e.value)&&t.push(r)});break;case"contem":r.forEach(r=>{const n=ne(r,e.keyName,"");n&&(e.useList?ti(n).includes(ti(e.value.id))&&t.push(r):ti(n).includes(ti(e.value))&&t.push(r))});break;case"tem um dos":r.forEach(r=>{const n=ne(r,e.keyName,"");n&&e.value.map(e=>ti(e.id)).includes(ti(n))&&t.push(r)})}break;case"date":switch(e.operator){case"data exata":r.forEach(r=>{const n=se(ne(r,e.keyName,""),"DD/MM/YYYY");n.isValid()&&n.isSame(se(e.value,"DD/MM/YYYY"))&&t.push(r)});break;case"entre":const n=se(e.value?e.value:"01/01/2000","DD/MM/YYYY"),o=se(e.value2?e.value2:"31/12/2030","DD/MM/YYYY");r.forEach(r=>{const i=se(ne(r,e.keyName,""),"DD/MM/YYYY");(i.isAfter(n)||i.isSame(n))&&(i.isBefore(o)||i.isSame(o))&&t.push(r)})}break;case"dates":switch(e.operator){case"data inicio":r.forEach(r=>{const n=li[e.customFunc](ne(r,e.keyName,""))??[];n.length<=0||se(n[0],"DD/MM/YYYY").isSame(se(e.value,"DD/MM/YYYY"))&&t.push(r)});break;case"data fim":r.forEach(r=>{const n=li[e.customFunc](ne(r,e.keyName,""))??[];n.length<=0||se(n[n.length-1],"DD/MM/YYYY").isSame(se(e.value,"DD/MM/YYYY"))&&t.push(r)});break;case"tem a data":r.forEach(r=>{(li[e.customFunc](ne(r,e.keyName,""))??[]).includes(e.value)&&t.push(r)});break;case"entre":const n=se(e.value?e.value:"01/01/2000","DD/MM/YYYY"),o=se(e.value2?e.value2:"31/12/2030","DD/MM/YYYY");r.forEach(r=>{const i=li[e.customFunc](ne(r,e.keyName,""))??[];let a=!1;i.forEach(e=>{if(a)return;const r=se(e,"DD/MM/YYYY");r.isValid()&&(r.isAfter(n)||r.isSame(n))&&(r.isBefore(o)||r.isSame(o))&&(a=!0)}),a&&t.push(r)})}}r=t}),ke(r),Te(rr(r)),Me(0),Le(1),localStorage.setItem(ii,JSON.stringify(e)),Se(r)}return ee(()=>{const e=Ye*De,r=we.slice(e,e+De);let t={};r.forEach((e,r)=>{o.forEach(n=>{t[r]=!0===t[r]||(ne(e,n?.keyName,"")??"Não Informado").toString().length>=G})}),Ue(t)},[we,De,Ye]),ee(()=>{console.log(Ze.current)},[Ze.current]),ge?r(i,{bgcolor:"#fff2c8",color:"#3e3129",padding:2,marginX:2,borderRadius:4,children:e(Ae,{fontSize:24,textAlign:"center",fontFamily:"Inter",children:[403===ge.status&&"Acesso negado",500===ge.status&&e(i,{fontWeight:500,textAlign:"center",children:[r(z,{sx:{transform:"scale(2)",marginY:1,fill:"#3e3129"}}),r(i,{children:de||e(t,{children:["Não foi possível se conectar ao servidor no momento. Por favor, aguarde alguns instantes e tente de novo.",r("br",{}),r("br",{}),"Caso precise de ajuda, entre em contato pelo email: ",r("strong",{children:"cdes@ssp.df.gov.br"})]})})]})]})}):fe?r(a,{sx:{height:"100%",width:"100%"},justifyContent:"center",alignItems:"center",children:e(i,{width:"100%",children:[e(a,{direction:"row",justifyContent:"center",alignItems:"center",justifyItems:"center",spacing:2,marginY:4,children:[r(B,{sx:{fill:"#5e5e5e"}}),e(Ae,{fontWeight:600,fontSize:20,textTransform:"capitalize",textAlign:"center",color:"#5e5e5e",children:["Carregando ",u]})]}),r(h,{color:"inherit"}),Array(10).fill("").map(t=>r(a,{direction:{xs:"column",md:"row"},spacing:{xs:3,md:1},justifyContent:"space-between",paddingY:8,borderBottom:"1px solid #cacaca",children:Array(7).fill(0).map(t=>e(i,{children:[r(I,{width:60}),r(I,{width:120})]}))}))]})}):!Ce&&b?r(h,{}):e(t,{children:[e(i,{marginX:Qe?ie:oe,bgcolor:"white",p:2,borderRadius:6,...ue,children:[e(a,{spacing:1.5,direction:{xs:"column",md:"row"},children:[e(a,{spacing:1.5,direction:{xs:"column",md:"row"},height:{md:"40px",xs:"inherit"},width:"100%",children:[r(Ne,{InputProps:{startAdornment:r(Pe,{sx:{marginRight:1,fill:"#c0c0c0"}}),sx:{".MuiOutlinedInput-notchedOutline":{border:"none"}}},sx:{border:"solid 1px #CBD5E1",backgroundColor:"#F8FAFC",borderRadius:"50px",maxWidth:"600px"},size:"small",onChange:function(e){console.log(Ee);const r=e.target.value;if(""===r)return ke(Ee),void Te(rr(tr(we)));const t=tr(we),n=[];t.forEach(e=>{const t=[];if(Object.keys(e).map(r=>{let n=ne(e,r,"")??"";"number"==typeof n&&(n=n.toString()),"string"==typeof n&&t.push(n)}),t.length<=0)return;let o=!1;t.forEach(e=>{if(["P","C","A","R","L","PA"].includes(e))switch(e){case"P":return void("em analise".includes(r.toLowerCase())&&(o=!0));case"C":return void("cancelado".includes(r.toLowerCase())&&(o=!0));case"A":return void("cadastrado".includes(r.toLowerCase())&&(o=!0));case"R":return void("reprovado".includes(r.toLowerCase())&&(o=!0));case"L":return void("licenciado".includes(r.toLowerCase())&&(o=!0));case"PA":return void(("pré aprovado".includes(r.toLowerCase())||"pre aprovado".includes(r.toLowerCase()))&&(o=!0));case"FP":return void("fora do prazo".includes(r.toLowerCase())&&(o=!0))}ri(e.toLowerCase()).includes(ri(r.toLowerCase()))&&(o=!0)}),o&&n.push(e)}),ke(n),Te(rr(n)),Me(0),Le(1)},fullWidth:!0,placeholder:`Pesquisar ${u}`}),le.length>0&&r(l,{startIcon:r(L,{}),variant:"contained",onClick:e=>Jo.open(r(di,{reset:cr,filtrar:dr,baseFilters:[...le],filters:localStorage.getItem(ii)?JSON.parse(localStorage.getItem(ii)):[...le]},He)),sx:{borderRadius:3,paddingX:"24px",paddingY:"8px",backgroundColor:"#208FE8",textTransform:"capitalize"},children:r(a,{direction:"row",borderRadius:5,padding:0,children:r("span",{children:"Filtrar"})})}),e(a,{direction:"row",spacing:1,children:[r(ei,{data:ce.map(e=>({name:e.label,onClick:()=>function(e){let r=[...we];r.sort((r,t)=>{const n="string"===e.type?ne(r,e.key,""):Number(ne(r,e.key,0)),o="string"===e.type?ne(t,e.key,""):Number(ne(t,e.key,0));if(ai){if(n<o)return-1;if(n>o)return 1}else{if(n>o)return-1;if(n<o)return 1}return 0}),ai=!ai,ke(r)}(e)})),btProps:{startIcon:r(W,{}),fullWidth:!0},children:"Ordenar"}),r(l,{variant:"contained",fullWidth:!0,startIcon:r(oi?K:W,{}),sx:{backgroundColor:"#637082",":hover":{backgroundColor:"#3c4757"},textTransform:"capitalize",borderRadius:3,padding:{md:"0px 8px"}},onClick:function(){let e={};for(let r=0;r<P;r++)e[r]=!oi;Xe(e),_e(e),oi=!oi},children:oi?"Recolher":"Expandir"})]})]}),e(a,{alignItems:"end",width:{xs:"100%",md:"20%"},direction:{xs:"row",md:"column"},spacing:{xs:1,md:0},children:[e(Ae,{fontWeight:600,textAlign:"end",children:["Registro de ",u,"s"]}),r(a,{justifyContent:"center",children:e(Ae,{children:["Exibindo ",Ye*De+1,"-",Ye*De+1+or().length-1," de ",we.length]})})]})]}),localStorage.getItem(ii)&&r(i,{display:"inline-flex",flexWrap:"wrap",padding:.5,borderRadius:4,marginBottom:1,children:JSON.parse(localStorage.getItem(ii)??"[]").filter(e=>e.value||"entre"===e.operator&&(e.value||e.value2)).map(t=>e(a,{direction:"row",spacing:1,bgcolor:"#4e85c1",color:"white",width:"fit-content",paddingY:.5,borderRadius:2,paddingX:1,m:.5,children:[r(Ae,{fontWeight:700,children:t.label}),r(Ae,{fontStyle:"italic",children:t.operator}),r(Ae,{bgcolor:"white",borderRadius:2,paddingX:1,color:"black",children:Array.isArray(t.value)?t.value.map(e=>e.label).join(" - "):"object"==typeof t.value?t.value.label:"entre"===t.operator?`${t.value?t.value:"Antes"} e ${t.value2?t.value2:"Depois"}`:t.value.toString()}),r(Y,{onClick:e=>{let r=JSON.parse(localStorage.getItem(ii)??"[]");r=r.map(e=>e.label===t.label?{...e,value:"",...e.value2?{value2:""}:{}}:e),dr(r)},size:"small",sx:{padding:0},children:r(Re,{sx:{fill:"white"}})})]}))}),r(a,{spacing:.2,children:or().length<=0?r(a,{sx:{backgroundColor:"#E2E8F0",padding:2,marginX:{xs:2,md:0}},justifyContent:"center",alignItems:"center",children:r(Ae,{fontSize:21,fontFamily:"Inter",fontWeight:600,textAlign:"center",children:ve?c.user:c.public})}):or().map((s,c)=>r(y,{sx:{padding:.5,backgroundColor:c%2==0?"#F8FAFC":"white",paddingTop:2,paddingBottom:he?2:.5,borderTop:"solid 1.5px #E2E8F0",position:"relative"},elevation:0,children:e($e,{container:!0,spacing:Qe?2:0,paddingX:2,rowSpacing:2,children:[o.map(o=>e($e,{item:!0,xs:12,md:er?12/m*(o.size?o.size:1):n?n.all:12/m*(o.size?o.size:1),sx:{overflow:"hidden"},children:[r(i,{sx:{width:"max-content",paddingX:1},children:r(Ae,{fontSize:16,fontWeight:700,color:"#1E293B",fontFamily:"Inter",children:o.title})}),r(i,{paddingLeft:1,position:"relative",children:r(M,{in:he||!0===We[c],collapsedSize:he?"auto":re,onExited:e=>Xe(e=>({...e,[c]:!1})),children:r(i,{sx:{wordWrap:"break-word",color:"#1E293B",fontSize:16},fontFamily:"Inter",children:o.customComponent?o.customComponent(ne(s,o.keyName),s):e(t,{children:[r(i,{color:"transparent",sx:{pointerEvents:"none",userSelect:"none"},children:ne(s,o.keyName,"")}),r(i,{position:"absolute",top:0,children:he||Ke[c]?ne(s,o?.keyName,""):(ne(s,o?.keyName,"")??"").toString().length>=G?r(t,{children:(ne(s,o?.keyName,"")??"").toString().substring(0,G)+"..."}):ne(s,o?.keyName,"")})]})})})})]},String(o?.keyName)+c)),r($e,{item:!0,xs:12,md:er?12/m:n?n.action:12/m,children:r(a,{direction:"row",alignItems:"center",justifyContent:Qe?"start":"flex-end",sx:{height:"100%",paddingBottom:Qe?2:0},children:g(s)})}),qe[c]&&!he&&r(a,{direction:"row",justifyContent:"flex-end",bottom:0,width:"100%",children:r(l,{onClick:e=>{_e(e=>({...e,[c]:!e[c]})),Xe(e=>({...e,[c]:!0}))},sx:{padding:0,color:"#637082",textTransform:"capitalize"},startIcon:r(We[c]?_:q,{}),children:We[c]?"Ver Menos":"Ver Mais"})})]})},c))}),or().length>0&&r(a,{padding:1,direction:{xs:"column",md:"row"},spacing:{xs:2,md:0},justifyContent:"space-between",alignItems:"center",children:p&&e(a,{direction:{xs:"column",md:"row"},justifyContent:"flex-end",spacing:1,children:[V&&r(l,{startIcon:r(Fe,{}),variant:"contained",size:"small",onClick:ir,sx:{backgroundColor:"#5a88b0",marginRight:{xs:2,md:0},width:{xs:"100%",md:"fit-content"}},children:D}),F&&r(l,{startIcon:r(Fe,{}),variant:"contained",size:"small",onClick:lr,sx:{backgroundColor:"#64748B",marginRight:{xs:2,md:0},width:{xs:"100%",md:"fit-content"}},children:T}),r(l,{startIcon:r(Fe,{}),variant:"contained",size:"small",onClick:e=>ir(e,!0),sx:{backgroundColor:"#22C55E",marginRight:{xs:2,md:0},width:{xs:"100%",md:"fit-content"}},children:S})]})})]}),r(a,{direction:"row",justifyContent:"center",paddingY:1,paddingTop:2,children:e(a,{direction:"row",justifyContent:"center",alignItems:"center",spacing:2,children:[r(l,{onClick:e=>Le(e=>e>1?e-1:1),sx:{bgcolor:"white",borderRadius:"50px",height:"40px",width:"40px",minWidth:0,border:"solid 1px #E2E8F0"},children:r(Ve,{sx:{transform:"scale(1.5) scaleX(-1)"}})}),r(je,{renderItem:e=>"page"===e.type?r(l,{onClick:e.onClick,sx:{fontWeight:600,...e.selected?{bgcolor:"#33B55D",color:"white"}:{color:"#1E293B"},borderRadius:"100%",padding:0,margin:0,minWidth:0,width:"40px",height:"40px",marginX:.25},children:e.page}):["next","previous","page"].includes(e.type)?void 0:r(O,{...e}),count:Oe,siblingCount:Qe?0:6,size:"large",onChange:nr,page:Be,shape:"circular",variant:"outlined",sx:{".MuiPagination-ul":{backgroundColor:"white",border:"solid 1px #E2E8F0",borderRadius:"50px",paddingX:.25,paddingY:.5}}}),r(l,{onClick:e=>Le(e=>e<Oe?e+1:Oe),sx:{bgcolor:"white",borderRadius:"50px",height:"40px",width:"40px",minWidth:0,border:"solid 1px #E2E8F0"},children:r(Ve,{sx:{transform:"scale(1.5)"}})})]})})]})}function di({filters:t,baseFilters:n,filtrar:o,reset:s}){const[c,d]=Z(t),[u,p]=Z(!1),[m,f]=H.useState(null),h=Boolean(m);return e(i,{width:{xs:"inherit",md:850},children:[r(S,{open:h,onClose:()=>{f(null)},anchorEl:m,children:n.map(e=>r(D,{onClick:r=>{var t;t=e,d(e=>[...e,t]),f(null)},children:e.label}))}),e(a,{direction:"row",justifyContent:"space-between",children:[r(Ae,{fontWeight:700,fontSize:18,children:"Filtrar"}),r(l,{startIcon:r(U,{}),sx:{textTransform:"capitalize"},onClick:e=>{s(),Jo.close()},children:"Limpar"})]}),r(i,{marginBottom:1,children:r(T,{severity:"warning",children:"Preencha apenas os campos que deseja filtrar."})}),r(a,{children:u?c.map((e,t)=>r(ui,{filterValue:e,setReset:p,idx:t,setDt:e=>{d(r=>{let n=[...r];return n[t]=e,n})},removeDt:()=>{d(e=>{let r=[...e];return r.splice(t,1),r})}})):r(i,{children:c.map((e,t)=>r(ui,{filterValue:e,setReset:p,idx:t,setDt:e=>{d(r=>{let n=[...r];return n[t]=e,n})},removeDt:()=>{d(e=>{let r=[...e];return r.splice(t,1),r})}}))})}),r(a,{direction:"row",justifyContent:"flex-end",marginTop:1,children:r(l,{variant:"contained",color:"success",startIcon:r(Pe,{}),sx:{textTransform:"capitalize"},onClick:e=>{o(c),Jo.close()},children:"Filtrar"})})]})}function ui({filterValue:t,setDt:n,idx:o}){const[i,l]=Z(t.operator),[c,d]=Z(t),u=s(),p=f(u.breakpoints.only("xs"));return ee(()=>{n(c)},[c]),e(a,{direction:"row",alignItems:"end",spacing:1,width:"100%",bgcolor:o%2==0?"#ededed":"inherit",padding:.5,borderRadius:2,children:[!p&&r(Ae,{width:"100%",alignContent:"center",fontWeight:600,color:"#323232",children:t.label}),e(A,{sx:{width:"100%"},children:[p&&r(Ae,{children:t.label}),r(R,{onChange:e=>{const r=e.target.value;d(e=>({...e,operator:r,value:""})),l(r)},defaultValue:i,size:"small",sx:{bgcolor:"white"},fullWidth:!0,children:t.operators.map(e=>r(D,{value:e,children:e}))})]}),r(pi,{filterValue:t,operator:c.operator,onChange:(e,r="value")=>{d(t=>({...t,[r]:e}))}})]})}function pi({filterValue:n,operator:o,onChange:a}){switch(n.type){case"number":return r(Ne,{type:"number",size:"small",placeholder:"Valor",defaultValue:n.value,onChange:e=>{a(e.target.value)},sx:{bgcolor:"white"},fullWidth:!0});case"string":if(n.useList)switch(o){case"tem um dos":return r(C,{multiple:!0,id:"tags-standard",onChange:(e,r)=>{a(r.length<=0?"":r)},options:n.useList,defaultValue:Array.isArray(n.value)?n.value:[],renderInput:e=>r(Ne,{...e,variant:"standard",placeholder:"Escolha os valores",fullWidth:!0}),fullWidth:!0});case"contem":case"igual":return r(i,{width:"100%",children:r(C,{options:n.useList,onChange:(e,r)=>{a(r)},defaultValue:"object"==typeof n.value?n.value:void 0,isOptionEqualToValue:(e,r)=>e.label===r.label,renderInput:e=>r(Ne,{...e,size:"small",placeholder:"Escolha um valor",fullWidth:!0,sx:{bgcolor:"white"}}),fullWidth:!0})})}return r(Ne,{size:"small",placeholder:"Valor",defaultValue:n.value,onChange:e=>{a(e.target.value)},sx:{bgcolor:"white"},fullWidth:!0});case"date":case"dates":switch(o){case"data exata":case"data fim":case"data inicio":case"tem a data":return r(oe,{adapterLocale:"pt-br",dateAdapter:le,children:r(ie,{format:"DD/MM/YYYY",onChange:e=>{a(e.isValid()?e.format("DD/MM/YYYY"):"")},defaultValue:n.value?se(n.value,"DD/MM/YYYY"):void 0,sx:{div:{input:{paddingX:2,paddingY:1.05}},width:"100%",bgcolor:"white"},inputRef:e=>r(Ne,{...e,size:"small",fullWidth:!0})})});case"entre":return e(oe,{adapterLocale:"pt-br",dateAdapter:le,children:[r(ie,{format:"DD/MM/YYYY",onChange:e=>{a(e.isValid()?e.format("DD/MM/YYYY"):"")},defaultValue:n.value?se(n.value,"DD/MM/YYYY"):void 0,sx:{div:{input:{paddingX:2,paddingY:1.05}},width:"100%",bgcolor:"white"},inputRef:e=>r(Ne,{...e,size:"small",fullWidth:!0})}),r(ie,{format:"DD/MM/YYYY",onChange:e=>{a(e.isValid()?e.format("DD/MM/YYYY"):"","value2")},defaultValue:n.value2?se(n.value2,"DD/MM/YYYY"):void 0,sx:{div:{input:{paddingX:2,paddingY:1.05}},width:"100%",bgcolor:"white"},inputRef:e=>r(Ne,{...e,size:"small",fullWidth:!0})})]})}}return r(t,{})}var mi=/*#__PURE__*/H.memo(ci);function fi({customErrorMsg:n,error:a}){return r(i,{bgcolor:"#fff2c8",color:"#3e3129",padding:2,marginX:2,borderRadius:4,children:e(o,{fontSize:24,textAlign:"center",fontFamily:"Inter",children:[403===a.status&&"Acesso negado",500===a.status&&e(i,{fontWeight:500,textAlign:"center",children:[r(z,{sx:{transform:"scale(2)",marginY:1,fill:"#3e3129"}}),r(i,{children:n||e(t,{children:["Não foi possível se conectar ao servidor no momento. Por favor, aguarde alguns instantes e tente de novo.",r("br",{}),r("br",{}),"Caso precise de ajuda, entre em contato pelo email: ",r("strong",{children:"cdes@ssp.df.gov.br"})]})})]})]})})}function hi({tableName:t}){return r(a,{sx:{height:"100%",width:"100%"},justifyContent:"center",alignItems:"center",children:e(i,{width:"100%",children:[e(a,{direction:"row",justifyContent:"center",alignItems:"center",justifyItems:"center",spacing:2,marginY:4,children:[r(B,{sx:{fill:"#5e5e5e"}}),e(Ae,{fontWeight:600,fontSize:20,textTransform:"capitalize",textAlign:"center",color:"#5e5e5e",children:["Carregando ",t]})]}),r(h,{color:"inherit"}),Array(10).fill("").map(t=>r(a,{direction:{xs:"column",md:"row"},spacing:{xs:3,md:1},justifyContent:"space-between",paddingY:8,borderBottom:"1px solid #cacaca",children:Array(7).fill(0).map(t=>e(i,{children:[r(I,{width:60}),r(I,{width:120})]}))}))]})})}const gi=(e,r)=>{if(e.length<=0)return 1;let t=e.length/r;return t=t<1?1:t,Math.ceil(t)};function yi(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]/g,"")}function bi(e){return("string"!=typeof e?e.toString():e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function xi({filterData:e,startData:r,filtersFuncData:t={},localTableName:n="",setCurrentPage:o,setList:i,setListClone:a,setListPage:l,setPagCount:s,itemsCount:c}){if(!r)return;let d=JSON.parse(JSON.stringify(r));e.filter(e=>e.value||"entre"===e.operator&&(e.value||e.value2)).forEach(e=>{let r=[];switch(e.type){case"number":switch(e.operator){case"igual":d.forEach(t=>{Number(ne(t,e.keyName,""))===Number(e.value)&&r.push(t)});break;case"maior que":d.forEach(t=>{Number(ne(t,e.keyName,""))>Number(e.value)&&r.push(t)});break;case"menor que":d.forEach(t=>{Number(ne(t,e.keyName,""))<Number(e.value)&&r.push(t)})}break;case"string":switch(e.operator){case"igual":d.forEach(t=>{const n=ne(t,e.keyName,"");e.useList?bi(n)===bi(e.value.id)&&r.push(t):bi(n)===bi(e.value)&&r.push(t)});break;case"contem":d.forEach(t=>{const n=ne(t,e.keyName,"");n&&(e.useList?bi(n).includes(bi(e.value.id))&&r.push(t):bi(n).includes(bi(e.value))&&r.push(t))});break;case"tem um dos":d.forEach(t=>{const n=ne(t,e.keyName,"");n&&e.value.map(e=>bi(e.id)).includes(bi(n))&&r.push(t)})}break;case"date":switch(e.operator){case"data exata":d.forEach(t=>{const n=se(ne(t,e.keyName,""),"DD/MM/YYYY");n.isValid()&&n.isSame(se(e.value,"DD/MM/YYYY"))&&r.push(t)});break;case"entre":const t=se(e.value?e.value:"01/01/2000","DD/MM/YYYY"),n=se(e.value2?e.value2:"31/12/2030","DD/MM/YYYY");d.forEach(o=>{const i=se(ne(o,e.keyName,""),"DD/MM/YYYY");(i.isAfter(t)||i.isSame(t))&&(i.isBefore(n)||i.isSame(n))&&r.push(o)})}break;case"dates":switch(e.operator){case"data inicio":d.forEach(n=>{const o=(t[e.customFunc](ne(n,e.keyName,""))??[]).filter(e=>void 0!==e&&""!==e);o.length<=0||se(o[0],"DD/MM/YYYY").isSame(se(e.value,"DD/MM/YYYY"))&&r.push(n)});break;case"data fim":d.forEach(n=>{const o=(t[e.customFunc](ne(n,e.keyName,""))??[]).filter(e=>void 0!==e&&""!==e);o.length<=0||(console.log(o),se(o[o.length-1],"DD/MM/YYYY").isSame(se(e.value,"DD/MM/YYYY"))&&r.push(n))});break;case"tem a data":d.forEach(n=>{const o=(t[e.customFunc](ne(n,e.keyName,""))??[]).filter(e=>void 0!==e&&""!==e);o.includes(e.value)&&r.push(n)});break;case"entre":const n=se(e.value?e.value:"01/01/2000","DD/MM/YYYY"),o=se(e.value2?e.value2:"31/12/2030","DD/MM/YYYY");d.forEach(i=>{const a=(t[e.customFunc](ne(i,e.keyName,""))??[]).filter(e=>void 0!==e&&""!==e);let l=!1;a.forEach(e=>{if(l)return;const r=se(e,"DD/MM/YYYY");r.isValid()&&(r.isAfter(n)||r.isSame(n))&&(r.isBefore(o)||r.isSame(o))&&(l=!0)}),l&&r.push(i)})}}d=r}),i(d),s(gi(d,c)),o(0),l(1),localStorage.setItem(n,JSON.stringify(e)),a(d)}function vi({order:e,list:r,orderAsc:t=!1}){const n=We(r).sort((r,n)=>{const o="string"===e.type?ne(r,e.key,""):Number(ne(r,e.key,0)),i="string"===e.type?ne(n,e.key,""):Number(ne(n,e.key,0));if(t){if(o<i)return-1;if(o>i)return 1}else{if(o>i)return-1;if(o<i)return 1}return 0});return n}function Ci({filters:t,baseFilters:n,filtrar:o,reset:s}){const[c,d]=Z(t),[u,p]=Z(!1),[m,f]=H.useState(null),h=Boolean(m);return e(i,{width:{xs:"inherit",md:850},children:[r(S,{open:h,onClose:()=>{f(null)},anchorEl:m,children:n.map(e=>r(D,{onClick:r=>{var t;t=e,d(e=>[...e,t]),f(null)},children:e.label}))}),e(a,{direction:"row",justifyContent:"space-between",children:[r(Ae,{fontWeight:700,fontSize:18,children:"Filtrar"}),r(l,{startIcon:r(U,{}),sx:{textTransform:"capitalize"},onClick:e=>{s(),Jo.close()},children:"Limpar"})]}),r(i,{marginBottom:1,children:r(T,{severity:"warning",children:"Preencha apenas os campos que deseja filtrar."})}),r(a,{children:u?c.map((e,t)=>r(wi,{filterValue:e,setReset:p,idx:t,setDt:e=>{d(r=>{let n=[...r];return n[t]=e,n})},removeDt:()=>{d(e=>{let r=[...e];return r.splice(t,1),r})}})):r(i,{children:c.map((e,t)=>r(wi,{filterValue:e,setReset:p,idx:t,setDt:e=>{d(r=>{let n=[...r];return n[t]=e,n})},removeDt:()=>{d(e=>{let r=[...e];return r.splice(t,1),r})}}))})}),r(a,{direction:"row",justifyContent:"flex-end",marginTop:1,children:r(l,{variant:"contained",color:"success",startIcon:r(Pe,{}),sx:{textTransform:"capitalize"},onClick:e=>{o(c),Jo.close()},children:"Filtrar"})})]})}function wi({filterValue:t,setDt:n,idx:o}){const[i,l]=Z(t.operator),[c,d]=Z(t),u=s(),p=f(u.breakpoints.only("xs"));return ee(()=>{n(c)},[c]),e(a,{direction:"row",alignItems:"end",spacing:1,width:"100%",bgcolor:o%2==0?"#ededed":"inherit",padding:.5,borderRadius:2,children:[!p&&r(Ae,{width:"100%",alignContent:"center",fontWeight:600,color:"#323232",children:t.label}),e(A,{sx:{width:"100%"},children:[p&&r(Ae,{children:t.label}),r(R,{onChange:e=>{const r=e.target.value;d(e=>({...e,operator:r,value:""})),l(r)},defaultValue:i,size:"small",sx:{bgcolor:"white"},fullWidth:!0,children:t.operators.map(e=>r(D,{value:e,children:e}))})]}),r(ki,{filterValue:t,operator:c.operator,onChange:(e,r="value")=>{d(t=>({...t,[r]:e}))}})]})}function ki({filterValue:n,operator:o,onChange:a}){switch(n.type){case"number":return r(Ne,{type:"number",size:"small",placeholder:"Valor",defaultValue:n.value,onChange:e=>{a(e.target.value)},sx:{bgcolor:"white"},fullWidth:!0});case"string":if(n.useList)switch(o){case"tem um dos":return r(C,{multiple:!0,id:"tags-standard",onChange:(e,r)=>{a(r.length<=0?"":r)},options:n.useList,defaultValue:Array.isArray(n.value)?n.value:[],renderInput:e=>r(Ne,{...e,variant:"standard",placeholder:"Escolha os valores",fullWidth:!0}),fullWidth:!0});case"contem":case"igual":return r(i,{width:"100%",children:r(C,{options:n.useList,onChange:(e,r)=>{a(r)},defaultValue:"object"==typeof n.value?n.value:void 0,isOptionEqualToValue:(e,r)=>e.label===r.label,renderInput:e=>r(Ne,{...e,size:"small",placeholder:"Escolha um valor",fullWidth:!0,sx:{bgcolor:"white"}}),fullWidth:!0})})}return r(Ne,{size:"small",placeholder:"Valor",defaultValue:n.value,onChange:e=>{a(e.target.value)},sx:{bgcolor:"white"},fullWidth:!0});case"date":case"dates":switch(o){case"data exata":case"data fim":case"data inicio":case"tem a data":return r(oe,{adapterLocale:"pt-br",dateAdapter:le,children:r(ie,{format:"DD/MM/YYYY",onChange:e=>{a(e.isValid()?e.format("DD/MM/YYYY"):"")},defaultValue:n.value?se(n.value,"DD/MM/YYYY"):void 0,sx:{div:{input:{paddingX:2,paddingY:1.05}},width:"100%",bgcolor:"white"},inputRef:e=>r(Ne,{...e,size:"small",fullWidth:!0})})});case"entre":return e(oe,{adapterLocale:"pt-br",dateAdapter:le,children:[r(ie,{format:"DD/MM/YYYY",onChange:e=>{a(e.isValid()?e.format("DD/MM/YYYY"):"")},defaultValue:n.value?se(n.value,"DD/MM/YYYY"):void 0,sx:{div:{input:{paddingX:2,paddingY:1.05}},width:"100%",bgcolor:"white"},inputRef:e=>r(Ne,{...e,size:"small",fullWidth:!0})}),r(ie,{format:"DD/MM/YYYY",onChange:e=>{a(e.isValid()?e.format("DD/MM/YYYY"):"","value2")},defaultValue:n.value2?se(n.value2,"DD/MM/YYYY"):void 0,sx:{div:{input:{paddingX:2,paddingY:1.05}},width:"100%",bgcolor:"white"},inputRef:e=>r(Ne,{...e,size:"small",fullWidth:!0})})]})}}return r(t,{})}let Ei=!1,Si="",Di={},Ii="";function Yi({mediaQueryLG:n,columns:o,csvConfig:c,fetchFunc:d,emptyMsg:u={user:"Nenhum dado encontrado",public:"Nenhum dado encontrado"},dataPath:p="",tableName:m="Dado",columnSize:g,action:b,useKC:x=!0,itemCount:v=10,expandTextMaxLength:C=50,collapsedSize:w=53,customMargin:k=4,customMarginMobile:E=0,filtersFunc:S,filters:D=[],orderBy:I=[],customErrorMsg:T,customTableStyle:A={},id:R,initialData:F=null,isExpandable:V=!0,alwaysExpanded:P=!1}){const[$,j]=Z(!1),[N,z]=Z(null),[B,U]=Z(F),{user:X,userLoaded:H}=J(sr),[G,re]=Z([]),[oe,ie]=Z([]),[ae,le]=Z(v),[se,ce]=Z(0),[de,ue]=Z(1),[pe,me]=Z(1),[fe,he]=Z({}),[ge,ye]=Z({}),[be,xe]=Z({}),[ve,Ce]=Z("filterKey"),we=s(),ke=f(we.breakpoints.only("xs")),Ee=te(B),Se=te("true"===localStorage.getItem(`order-${R}`)||!1),De=f(we.breakpoints.up(2e3));Si=`tableFilter_${R}`,Ii=`tableFilterCache_${R}`,Di=S??{},localStorage.getItem(Ii)||localStorage.setItem(Ii,JSON.stringify(D)),localStorage.getItem(Ii)!==JSON.stringify(D)&&(localStorage.setItem(Ii,JSON.stringify(D)),localStorage.removeItem(Si)),ee(()=>{z(null),d&&(!H&&x||(j(!0),d().then(e=>e.ok?e.json().then(e=>{if(204===e.statusCode)U({body:{data:[]}}),Ee.current=[];else if(403===e.statusCode)z({status:e.statusCode});else{let r=p?ne(e,p):e;if(r&&Array.isArray(r)){let e=r;if(localStorage.getItem(`order-data-${R}`))try{e=vi({order:JSON.parse(localStorage.getItem(`order-data-${R}`)),list:r,orderAsc:Se.current})}catch(e){console.log(e)}else I.length>0&&(e=vi({order:I[0],list:r,orderAsc:Se.current}));U(e),Ee.current=JSON.parse(JSON.stringify(e))}else U({body:{data:[]}}),Ee.current=[]}j(!1)}):(z({status:500}),void j(!1))).catch(e=>{z({status:500})})))},[H,d]);const Ie=Q(e=>Array.isArray(e)?e:"object"==typeof e?ne(e,p):void 0,[]);ee(()=>{if($||N||!Ie(B))return;let e=Ie(B);re(e),ie(e),ue(gi(e,ae)),localStorage.getItem(Si)&&xi({filterData:JSON.parse(localStorage.getItem(Si)),filtersFuncData:Di,localTableName:Si,setCurrentPage:ce,setList:re,setListClone:ie,setListPage:me,setPagCount:ue,startData:Ee.current,itemsCount:ae})},[ae,$,B,N]),ee(()=>{ce(pe-1)},[pe]);const Ye=Q((e,r)=>{me(r)},[]),Me=Q(()=>{const e=se*ae;return G.slice(e,e+ae)},[G,ae,se]);function Oe(){re(Ee.current),ie(Ee.current),ue(gi(Ee.current,ae)),ce(0),me(1),localStorage.removeItem(Si),Ce((new Date).getTime().toString())}ee(()=>{const e=se*ae,r=G.slice(e,e+ae);let t={};r.forEach((e,r)=>{o.forEach(n=>{t[r]=!0===t[r]||(ne(e,n.keyName,"")??"Não Informado").toString().length>=C})}),ye(t)},[G,ae,se]);const Te=(e,r=!1)=>{c&&function(e,r,t){try{if(e.length<=0)return Promise.resolve();let n=[];r.downloadAll&&r.customAll?n=r.customAll(e,t):!r.downloadAll&&r.customFiltered?n=r.customFiltered(e,t):e.forEach(e=>{const o={};r.map.forEach(n=>{if(n.useFilterValue&&!r.downloadAll&&!n.onlyAll){const r=t.filter(e=>e.label==n.useFilterValue.label&&n.useFilterValue.operators.includes(e.operator)),i=r.length>0&&r.reduce(e=>e.value).value||void 0;return void(o[n.name]=i||ne(e,n.key))}n.onlyFilter||(o[n.name]=ne(e,n.key))}),n.push(o)});const o=_e.utils.json_to_sheet(n),i=_e.utils.book_new();return _e.utils.book_append_sheet(i,o,r.fileName),_e.writeFile(i,`${r.fileName}.xlsx`),Promise.resolve()}catch(e){return Promise.reject(e)}}(e,{...c,...r?{downloadAll:!0}:{}},JSON.parse(localStorage.getItem(Si)??"[]")||[])},ze=e=>{xi({filterData:e,filtersFuncData:Di,localTableName:Si,setCurrentPage:ce,setList:re,setListClone:ie,setListPage:me,setPagCount:ue,startData:Ee.current,itemsCount:ae})};return N?r(fi,{customErrorMsg:T,error:N}):$?r(hi,{tableName:m}):!H&&x?r(h,{}):e(t,{children:[e(i,{marginX:ke?E:k,bgcolor:"white",p:2,borderRadius:6,...A,children:[e(a,{spacing:1.5,direction:{xs:"column",md:"row"},children:[e(a,{spacing:1.5,direction:{xs:"column",md:"row"},height:{md:"40px",xs:"inherit"},width:"100%",children:[r(Ne,{InputProps:{startAdornment:r(Pe,{sx:{marginRight:1,fill:"#c0c0c0"}}),sx:{".MuiOutlinedInput-notchedOutline":{border:"none"}}},sx:{border:"solid 1px #CBD5E1",backgroundColor:"#F8FAFC",borderRadius:"50px",maxWidth:"600px"},size:"small",onChange:function(e){const r=e.target.value;if(""===r)return re(oe),void ue(gi(Ie(G),ae));const t=[];oe.forEach(e=>{const n=[];if(Object.keys(e).map(r=>{let t=ne(e,r,"")??"";"number"==typeof t&&(t=t.toString()),"string"==typeof t&&n.push(t)}),n.length<=0)return;let o=!1;n.forEach(e=>{if(["P","C","A","R","L","PA"].includes(e))switch(e){case"P":return void("em analise".includes(r.toLowerCase())&&(o=!0));case"C":return void("cancelado".includes(r.toLowerCase())&&(o=!0));case"A":return void("cadastrado".includes(r.toLowerCase())&&(o=!0));case"R":return void("reprovado".includes(r.toLowerCase())&&(o=!0));case"L":return void("licenciado".includes(r.toLowerCase())&&(o=!0));case"PA":return void(("pré aprovado".includes(r.toLowerCase())||"pre aprovado".includes(r.toLowerCase()))&&(o=!0));case"FP":return void("fora do prazo".includes(r.toLowerCase())&&(o=!0))}yi(e.toLowerCase()).includes(yi(r.toLowerCase()))&&(o=!0)}),o&&t.push(e)}),re(t),ue(gi(t,ae)),ce(0),me(1)},fullWidth:!0,placeholder:`Pesquisar ${m}`}),r(l,{startIcon:r(L,{}),variant:"contained",onClick:e=>Jo.open(r(Ci,{reset:Oe,filtrar:e=>ze(e),baseFilters:[...D],filters:localStorage.getItem(Si)?JSON.parse(localStorage.getItem(Si)):[...D]},ve)),sx:{borderRadius:3,paddingX:"24px",paddingY:"8px",backgroundColor:"#208FE8",textTransform:"capitalize"},children:r(a,{direction:"row",borderRadius:5,padding:0,children:r("span",{children:"Filtrar"})})}),e(a,{direction:"row",spacing:1,children:[I.length>0&&r(ei,{data:I.map(e=>({name:e.label,onClick:()=>(e=>{Se.current=!Se.current;const r=vi({order:e,list:G,orderAsc:Se.current});localStorage.setItem(`order-${R}`,Se.current.toString()),localStorage.setItem(`order-data-${R}`,JSON.stringify(e)),re(r)})(e)})),btProps:{startIcon:r(W,{}),fullWidth:!0},children:"Ordenar"}),V&&!P&&r(l,{variant:"contained",fullWidth:!0,startIcon:r(Ei?K:W,{}),sx:{backgroundColor:"#637082",":hover":{backgroundColor:"#3c4757"},textTransform:"capitalize",borderRadius:3,padding:{md:"0px 8px"}},onClick:function(){let e={};for(let r=0;r<v;r++)e[r]=!Ei;xe(e),he(e),Ei=!Ei},children:Ei?"Recolher":"Expandir"})]})]}),e(a,{alignItems:"end",width:{xs:"100%",md:"20%"},direction:{xs:"row",md:"column"},spacing:{xs:1,md:0},children:[e(Ae,{fontWeight:600,textAlign:"end",children:["Registro de ",m,"s"]}),r(a,{justifyContent:"center",children:e(Ae,{children:["Exibindo ",se*ae+1,"-",se*ae+1+Me().length-1," de ",G.length]})})]})]}),localStorage.getItem(Si)&&r(i,{display:"inline-flex",flexWrap:"wrap",padding:.5,borderRadius:4,marginBottom:1,children:JSON.parse(localStorage.getItem(Si)??"[]").filter(e=>e.value||"entre"===e.operator&&(e.value||e.value2)).map(t=>e(a,{direction:"row",spacing:1,bgcolor:"#4e85c1",color:"white",width:"fit-content",paddingY:.5,borderRadius:2,paddingX:1,m:.5,children:[r(Ae,{fontWeight:700,children:t.label}),r(Ae,{fontStyle:"italic",children:t.operator}),r(Ae,{bgcolor:"white",borderRadius:2,paddingX:1,color:"black",children:Array.isArray(t.value)?t.value.map(e=>e.label).join(" - "):"object"==typeof t.value?t.value.label:"entre"===t.operator?`${t.value?t.value:"Antes"} e ${t.value2?t.value2:"Depois"}`:t.value.toString()}),r(Y,{onClick:e=>{let r=JSON.parse(localStorage.getItem(Si)??"[]");r=r.map(e=>e.label===t.label?{...e,value:"",...e.value2?{value2:""}:{}}:e),ze(r)},size:"small",sx:{padding:0},children:r(Re,{sx:{fill:"white"}})})]}))}),r(a,{spacing:.2,children:Me().length<=0?r(a,{sx:{backgroundColor:"#E2E8F0",padding:2,marginX:{xs:2,md:0}},justifyContent:"center",alignItems:"center",children:r(Ae,{fontSize:21,fontFamily:"Inter",fontWeight:600,textAlign:"center",children:X?u.user:u.public})}):Me().map((s,c)=>r(y,{sx:{padding:.5,backgroundColor:c%2==0?"#F8FAFC":"white",paddingTop:2,paddingBottom:P?2:.5,borderTop:"solid 1.5px #E2E8F0",position:"relative"},elevation:0,children:e($e,{container:!0,spacing:ke?2:0,paddingX:2,rowSpacing:2,children:[o.map(o=>e($e,{item:!0,xs:12,md:De?12/g*(o.size?o.size:1):n?n.all:12/g*(o.size?o.size:1),sx:{overflow:"hidden"},children:[r(i,{sx:{width:"max-content",paddingX:1},children:r(Ae,{fontSize:16,fontWeight:700,color:"#1E293B",fontFamily:"Inter",children:o.title})}),r(i,{paddingLeft:1,position:"relative",children:r(M,{in:P||!0===fe[c],collapsedSize:P?"auto":w,onExited:e=>xe(e=>({...e,[c]:!1})),children:r(i,{sx:{wordWrap:"break-word",color:"#1E293B",fontSize:16},fontFamily:"Inter",children:o.customComponent?o.customComponent(ne(s,o.keyName),s):e(t,{children:[r(i,{color:"transparent",sx:{pointerEvents:"none",userSelect:"none"},children:ne(s,o.keyName,"")}),r(i,{position:"absolute",top:0,children:P||be[c]?ne(s,o.keyName,""):(ne(s,o.keyName,"")??"").toString().length>=C?r(t,{children:(ne(s,o.keyName,"")??"").toString().substring(0,C)+"..."}):ne(s,o.keyName,"")})]})})})})]},o.keyName+c)),r($e,{item:!0,xs:12,md:De?12/g:n?n.action:12/g,children:r(a,{direction:"row",alignItems:"center",justifyContent:ke?"start":"flex-end",sx:{height:"100%",paddingBottom:ke?2:0},children:b(s)})}),ge[c]&&!P&&r(a,{direction:"row",justifyContent:"flex-end",bottom:0,width:"100%",children:r(l,{onClick:e=>{he(e=>({...e,[c]:!e[c]})),xe(e=>({...e,[c]:!0}))},sx:{padding:0,color:"#637082",textTransform:"capitalize"},startIcon:r(fe[c]?_:q,{}),children:fe[c]?"Ver Menos":"Ver Mais"})})]})},c))}),Me().length>0&&r(a,{padding:1,direction:{xs:"column",md:"row"},spacing:{xs:2,md:0},justifyContent:"space-between",alignItems:"center",children:c&&e(a,{direction:{xs:"column",md:"row"},justifyContent:"flex-end",spacing:1,children:[JSON.parse(localStorage.getItem(Si)??"[]").filter(e=>e.value||"entre"===e.operator&&(e.value||e.value2)).length>0&&r(l,{startIcon:r(Fe,{}),variant:"contained",size:"small",onClick:e=>Te(G),sx:{backgroundColor:"#a5a5a5",marginRight:{xs:2,md:0},width:{xs:"100%",md:"fit-content"}},children:"Baixar Filtrados"}),r(l,{startIcon:r(Fe,{}),variant:"contained",size:"small",onClick:e=>Te(Ee.current,!0),sx:{backgroundColor:"#22C55E",marginRight:{xs:2,md:0},width:{xs:"100%",md:"fit-content"}},children:"Baixar Tabela"})]})})]}),r(a,{direction:"row",justifyContent:"center",paddingY:1,paddingTop:2,children:e(a,{direction:"row",justifyContent:"center",alignItems:"center",spacing:2,children:[r(l,{onClick:e=>me(e=>e>1?e-1:1),sx:{bgcolor:"white",borderRadius:"50px",height:"40px",width:"40px",minWidth:0,border:"solid 1px #E2E8F0"},children:r(Ve,{sx:{transform:"scale(1.5) scaleX(-1)"}})}),r(je,{renderItem:e=>"page"===e.type?r(l,{onClick:e.onClick,sx:{fontWeight:600,...e.selected?{bgcolor:"#33B55D",color:"white"}:{color:"#1E293B"},borderRadius:"100%",padding:0,margin:0,minWidth:0,width:"40px",height:"40px",marginX:.25},children:e.page}):["next","previous","page"].includes(e.type)?void 0:r(O,{...e}),count:de,siblingCount:ke?0:6,size:"large",onChange:Ye,page:pe,shape:"circular",variant:"outlined",sx:{".MuiPagination-ul":{backgroundColor:"white",border:"solid 1px #E2E8F0",borderRadius:"50px",paddingX:.25,paddingY:.5}}}),r(l,{onClick:e=>me(e=>e<de?e+1:de),sx:{bgcolor:"white",borderRadius:"50px",height:"40px",width:"40px",minWidth:0,border:"solid 1px #E2E8F0"},children:r(Ve,{sx:{transform:"scale(1.5)"}})})]})})]})}var Mi=/*#__PURE__*/H.memo(Yi);const Oi=qe(()=>import("./Map-31d95a26.js").then(e=>e.Map),{ssr:!1});function Ti({links:n,title:s,img:c,pos:d="fixed",next:u=!0,el:p,menuItems:m,paddingBottom:f=0,logoutMsg:h="Sair",logoutFunc:g,loginOptions:y,logoutOptions:b,...x}){let v;u&&(v=Ze());const{user:C,login:w,logout:k,type:E}=J(sr),[I,M]=Z(null),[O,T]=Z(null),A=Boolean(I),R=Boolean(O),[P,$]=Z(!1),j=Q(e=>{M(e.currentTarget)},[]),N=Q(()=>{M(null)},[]),z=Q((e,r)=>{$(!0),M(null),v?v.push({pathname:r}).finally(()=>$(!1)):$(!1)},[v]);return e(t,{children:[e(i,{position:d,sx:{width:"100%",zIndex:100},children:[r(F,{position:"relative",elevation:0,sx:{backgroundColor:"#F1F5F9",color:"black",paddingY:1,paddingX:{xs:1,md:4}},children:e(a,{direction:"row",justifyContent:"space-between",children:[e(a,{direction:"row",alignItems:"center",spacing:2,marginRight:2,sx:{display:{xs:"none",md:"flex"},width:"100%"},children:[r(Qe,{href:"/",children:u?r(Je,{src:c,alt:s,width:40,height:40}):r("img",{src:c,height:35})}),r(i,{children:r(o,{variant:"subtitle1",fontWeight:600,children:s})})]}),r(i,{sx:{display:{xs:"flex",md:"none"}},children:n.length>0&&e(t,{children:[r(Y,{onClick:j,children:r(Xe,{})}),r(S,{open:A,onClose:N,anchorEl:I,children:n.map(e=>r(D,{onClick:r=>z(r,e.path),children:r(o,{textTransform:"capitalize",children:e.name})},`navmenu${e}`))})]})}),e(a,{direction:"row",justifyContent:"flex-end",alignItems:"center",sx:{width:{md:"100%"}},children:[r(a,{direction:"row",spacing:2,sx:{display:{xs:"none",md:"flex"}},children:n.map(e=>r(i,{sx:{a:{color:"#2c7da0",textDecoration:"none",textTransform:"capitalize","&:hover":{color:"#90e0ef"}}},children:r(l,{onClick:r=>{return t=e.path,$(!0),void(v?v.push({pathname:t}).finally(()=>$(!1)):$(!1));var t},sx:{textTransform:"capitalize"},children:e.name})},`navigation${e.path}`))}),e(a,{direction:"row",spacing:2,children:[r(i,{children:p}),C?e(a,{direction:"row",spacing:1,sx:{"&:hover":{backgroundColor:"#a9def9",cursor:"pointer"},padding:.5,borderRadius:60},children:[e(i,{sx:{display:"flex",alignItems:"center"},children:[r(V,{sx:{width:30,height:30},src:C.image}),e(S,{open:R,onClose:e=>T(null),anchorEl:O,disableScrollLock:!0,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},sx:{".MuiMenu-paper":{borderRadius:4}},children:[m,r(D,{onClick:function(e){try{T(null);const e={...b,onBeforeLogout:function(){try{function e(){return Promise.resolve(b?.onBeforeLogout?.()).then(function(){})}const r=function(){if(g){const e=function(e,r){try{var t=Promise.resolve(g()).then(function(){})}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(0,function(e){console.error(e)});if(e&&e.then)return e.then(function(){})}}();return Promise.resolve(r&&r.then?r.then(e):e())}catch(t){return Promise.reject(t)}}};return k(e),Promise.resolve()}catch(e){return Promise.reject(e)}},children:e(a,{direction:"row",spacing:1,children:[r(Ke,{sx:{fill:"#545454"}}),r(o,{textTransform:"capitalize",children:h})]})})]})]}),e(a,{direction:"row",spacing:.4,alignItems:"center",onClick:e=>T(e.currentTarget),sx:{userSelect:"none"},children:[r(o,{children:"Olá,"}),r(o,{fontWeight:600,children:C?.given_name}),r(Ue,{})]})]}):r(l,"govbr"===E?{variant:"contained",size:"small",startIcon:r(He,{}),onClick:()=>w(y),sx:{color:"white",textTransform:"inherit",borderRadius:50,paddingX:2},children:r(o,{fontWeight:600,fontSize:15,padding:.4,children:"Entrar com o gov.br"})}:{variant:"contained",size:"small",startIcon:r(He,{}),onClick:()=>w(y),sx:{color:"white",textTransform:"inherit",borderRadius:50,paddingX:2},children:r(o,{fontWeight:600,fontSize:15,padding:.4,children:"Entrar"})})]})]})]})}),P&&r(Ge,{})]}),r(i,{paddingBottom:f})]})}function Ai({links:n,title:c,img:d,pos:u="fixed",next:p=!0,el:m,menuItems:f,color:h="blue",route:g="/teste/89",paddingBottom:y=0,logoutMsg:b="Sair",customBgColor:x="#FFFFFF",logoutFunc:v,loginOptions:C,logoutOptions:w,...k}){const E=s(),I=n.length<=3?"md":"lg";let M;p&&(M=Ze());const{user:O,login:T,logout:A,type:R}=J(sr),[P,$]=Z(null),[j,N]=Z(null),z=Boolean(P),B=Boolean(j),[L,W]=Z(!1),_=Q(e=>{$(e.currentTarget)},[]),q=Q(()=>{$(null)},[]),U=Q((e,r)=>{W(!0),$(null),M?M.push({pathname:r}).finally(()=>W(!1)):W(!1)},[M]);return e(t,{children:[e(i,{position:u,sx:{width:"100%",zIndex:100},children:[r(F,{position:"relative",elevation:0,sx:{color:E.palette.getContrastText(x),paddingX:{xs:1,[I]:4},bgcolor:x},children:e(a,{direction:"row",justifyContent:"space-between",bgcolor:x,children:[e(a,{direction:"row",alignItems:"center",spacing:2,marginRight:2,sx:{display:{xs:"none",[I]:"flex"},width:"100%"},children:[r(Qe,{href:"/",children:p?r(Je,{src:d,alt:c,width:40,height:40}):r("img",{src:d,height:35})}),r(i,{children:r(o,{variant:"subtitle1",fontWeight:600,children:c})})]}),r(a,{direction:"row",width:"100%",justifyContent:"center",alignItems:"center",spacing:2,sx:{display:{xs:"none",[I]:"flex"}},children:n.map((e,t)=>{const n=function(e,r){return"/"===r?e===r:e.startsWith(r)}(p?M?.pathname??"":g,e.path);return r(i,{paddingX:3,paddingY:.8,borderRadius:50,bgcolor:n?h:"transparent",color:n?"#fff":"inherit",sx:{transition:"all 0.2s ease-in-out",":hover":{backgroundColor:n?h:"rgba(0,0,0,0.05)",cursor:"pointer",userSelect:"none",filter:n?"brightness(1.1)":"none"}},onClick:r=>{var t;p&&console.log("pathname:",M?.pathname,":=",e.path),t=e.path,W(!0),M?M.push({pathname:t}).finally(()=>W(!1)):W(!1)},children:r(a,{justifyContent:"center",children:r(o,{fontWeight:n?600:500,whiteSpace:"nowrap",children:e.name})})},JSON.stringify({x:e,index:t}))})}),r(i,{sx:{display:{xs:"flex",[I]:"none"}},children:n.length>0&&e(t,{children:[r(Y,{onClick:_,children:r(Xe,{})}),r(S,{open:z,onClose:q,anchorEl:P,children:n.map((e,t)=>r(D,{onClick:r=>U(r,e.path),children:r(o,{textTransform:"capitalize",children:e.name})},JSON.stringify({x:e,index:t})))})]})}),r(a,{direction:"row",justifyContent:"flex-end",alignItems:"center",sx:{width:{[I]:"100%"}},paddingY:1,children:e(a,{direction:"row",spacing:2,children:[r(i,{children:m}),O?e(a,{direction:"row",spacing:1,sx:{"&:hover":{backgroundColor:"#a9def9",cursor:"pointer"},padding:.5,borderRadius:60},children:[e(i,{sx:{display:"flex",alignItems:"center"},children:[r(V,{sx:{width:30,height:30},src:O.image}),e(S,{open:B,onClose:e=>N(null),anchorEl:j,disableScrollLock:!0,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},sx:{".MuiMenu-paper":{borderRadius:4}},children:[f,r(D,{onClick:function(e){try{N(null);const e={...w,onBeforeLogout:function(){try{function e(){return Promise.resolve(w?.onBeforeLogout?.()).then(function(){})}const r=function(){if(v){const e=function(e,r){try{var t=Promise.resolve(v()).then(function(){})}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(0,function(e){console.error(e)});if(e&&e.then)return e.then(function(){})}}();return Promise.resolve(r&&r.then?r.then(e):e())}catch(t){return Promise.reject(t)}}};return A(e),Promise.resolve()}catch(e){return Promise.reject(e)}},children:e(a,{direction:"row",spacing:1,children:[r(Ke,{sx:{fill:"#545454"}}),r(o,{textTransform:"capitalize",children:b})]})})]})]}),e(a,{direction:"row",spacing:.4,alignItems:"center",onClick:e=>N(e.currentTarget),sx:{userSelect:"none"},children:[r(o,{children:"Olá,"}),r(o,{fontWeight:600,children:O.given_name}),r(Ue,{})]})]}):r(l,"govbr"===R?{variant:"contained",size:"small",startIcon:r(He,{}),onClick:()=>T(C),sx:{color:"white",textTransform:"inherit",borderRadius:50,paddingX:2},children:r(o,{fontWeight:600,fontSize:15,padding:.4,children:"Entrar com o gov.br"})}:{variant:"contained",size:"small",startIcon:r(He,{}),onClick:()=>T(C),sx:{color:"white",textTransform:"inherit",borderRadius:50,paddingX:2},children:r(o,{fontWeight:600,fontSize:15,padding:.4,children:"Entrar"})})]})})]})}),L&&r(Ge,{})]}),r(i,{paddingBottom:y})]})}function Ri({children:e,onSubmit:t,formMethod:n="GET",submiting:o=!1}){const{register:i,handleSubmit:a,control:l,formState:s,reset:c,watch:d,trigger:u,setValue:p,unregister:m,getValues:f}=ue(),[h,g]=Z([]);return r(dr.Provider,{value:{formRegister:i,formWatch:d,formReset:c,formControl:l,formSetValue:p,formTrigger:u,formUnregister:m,formGetValues:f,formHandleSubmit:a,setFilesUid:g,formState:s,errors:s?.errors,submiting:o},children:r("form",{method:n,onSubmit:a(e=>t(e,h),()=>Me("Formulário incompleto! Verifique os campos marcados e tente novamente.",{type:"warning",position:"top-right",theme:"colored"})),children:e})})}function Fi(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}const Vi="keycloak-logout-pending";function Pi({url:e,realm:t,clientId:n,children:o,type:i="ad",resource_name:a="eventos-front",basePath:l="",redirectUri:s="",onAuthSuccess:c,onAuthError:d,onLogoutSuccess:u,enableDebugLogs:p="development"===process.env.NODE_ENV}){const[m,f]=Z(null),[h,g]=Z(!1),y=te(null),b=te(!1),x=te(null),v=Ze(),C=Q(function(e){p&&console.log(`[KeycloakAuth] ${e}`,...[].slice.call(arguments,1))},[p]),w=Q(function(e){p&&console.error(`[KeycloakAuth] ${e}`,...[].slice.call(arguments,1))},[p]),k=Q(e=>{const r=e.tokenParsed;if(!r)return null;const t=(r.resource_access??{})[a],n=Array.isArray(t?.roles)?t.roles:[];return{...r,token:e.token,roles:n}},[a]),E=Q(function(){try{const e=y.current;return e&&e.authenticated?Promise.resolve(Fi(function(){return Promise.resolve(e.updateToken(30)).then(function(r){if(r){const r=k(e);r&&(f(r),C("Token renovado com sucesso"))}else C("Token ainda válido, renovação não necessária");return!0})},function(e){return w("Falha ao renovar token",e),f(null),!1})):(C("Não é possível renovar token: usuário não autenticado"),Promise.resolve(!1))}catch(e){return Promise.reject(e)}},[k,C,w]),S=Q(()=>{x.current&&clearInterval(x.current),x.current=setInterval(function(){try{return Promise.resolve(E()).then(function(){})}catch(e){return Promise.reject(e)}},6e4),C("Renovação automática de token configurada")},[E,C]),D=Q(()=>{x.current&&(clearInterval(x.current),x.current=null,C("Renovação automática de token removida"))},[C]);ee(()=>{if(b.current)return;b.current=!0;const r=new er({url:e,realm:t,clientId:n});return y.current=r,r.onTokenExpired=function(){try{return C("Token expirado, tentando renovar..."),Promise.resolve(E()).then(function(){})}catch(e){return Promise.reject(e)}},r.onAuthRefreshError=()=>{w("Erro ao renovar autenticação - refresh token inválido"),f(null),D()},r.onAuthLogout=()=>{C("Usuário deslogado em outra sessão"),f(null),D()},r.init({onLoad:"check-sso",pkceMethod:"S256",silentCheckSsoRedirectUri:"undefined"!=typeof window?`${window.location.origin}${l}/silent-check-sso.html`:void 0,checkLoginIframe:!0,checkLoginIframeInterval:30}).then(e=>{if(localStorage.getItem(Vi))return localStorage.removeItem(Vi),localStorage.removeItem("user-data.img"),C("Logout pendente detectado, limpando estado e chamando onLogoutSuccess..."),f(null),g(!0),D(),e&&r&&r.clearToken(),void u?.();if(g(!0),!e)return C("Usuário não autenticado"),void f(null);const t=k(r);t&&(f(t),S(),C("Autenticação bem-sucedida",{user:t.preferred_username}),c?.(t))}).catch(e=>{w("Falha na inicialização do Keycloak",e),g(!0),f(null);const r=e instanceof Error?e:new Error("Falha na autenticação");d?.(r)}),"success"===v.query.status&&window.history.replaceState(null,"",v.pathname),()=>{D()}},[e,t,n,a,v.query,v.pathname,k,S,D,E,C,w,c,d,u]);const I=Q(e=>{const r=y.current;if(!r){const r=new Error("Keycloak não inicializado");return w("Tentativa de login com Keycloak não inicializado"),void e?.onError?.(r)}C("Iniciando fluxo de login...",{authenticated:r.authenticated,clientId:r.clientId});const t={redirectUri:e?.redirectUri||s||window.location.href,idpHint:e?.idpHint,loginHint:e?.loginHint,prompt:e?.prompt,action:e?.action,locale:e?.locale,acr:e?.acr,scope:e?.scope,maxAge:e?.maxAge};r.login(t).then(()=>{e?.onSuccess?.()}).catch(r=>{const t=r instanceof Error?r:new Error("Falha no login");w("Erro no login",t),e?.onError?.(t)})},[s,C,w]),Y=Q(function(e){try{function r(){localStorage.setItem(Vi,"true"),D();const r=e?.redirectUri||`${window.location.origin}${l}`;if(C("Redirecionando para logout...",{redirectUri:r,type:i}),"govbr"===i&&t.token)try{const e=new URL(`${t.authServerUrl}/realms/${t.realm}/protocol/openid-connect/logout`);return e.searchParams.set("client_id",t.clientId||n),e.searchParams.set("post_logout_redirect_uri",r),e.searchParams.set("id_token_hint",t.idToken||""),e.searchParams.set("initiating_idp","oidc"),C("Logout GovBR federado - redirecionando para:",e.toString()),void(window.location.href=e.toString())}catch(e){w("Erro ao construir URL de logout federado, usando fallback",e)}const o=Fi(function(){return Promise.resolve(t.logout({redirectUri:r,logoutMethod:e?.logoutMethod})).then(function(){})},function(e){localStorage.removeItem(Vi),w("Erro no logout",e)});if(o&&o.then)return o.then(function(){})}const t=y.current;if(!t)return w("Tentativa de logout com Keycloak não inicializado"),Promise.resolve();C("Iniciando fluxo de logout...");const o=function(){if(e?.onBeforeLogout){const r=Fi(function(){return Promise.resolve(e.onBeforeLogout()).then(function(){})},function(e){w("Erro no callback onBeforeLogout",e)});if(r&&r.then)return r.then(function(){})}}();return Promise.resolve(o&&o.then?o.then(r):r())}catch(a){return Promise.reject(a)}},[C,w,D,i,n]),M=Q(e=>{const r={token:e.access_token,roles:e.claims.roles.map(e=>e.name),sub:e.claims.sub,exp:e.claims.exp,iat:e.claims.iat,email_verified:"true"===e.claims.email_verified,preferred_username:e.claims.preferred_username,email:e.claims.email,name:e.claims.name,given_name:e.claims.given_name};f(r),C("Dados de usuário externo salvos",{username:r.preferred_username})},[C]),O=Q(e=>m?.roles?.includes(e)??!1,[m?.roles]),T=Q(e=>!(!m?.roles||0===e.length)&&e.every(e=>m.roles.includes(e)),[m?.roles]),A=Q(e=>!(!m?.roles||0===e.length)&&e.some(e=>m.roles.includes(e)),[m?.roles]),R=re(()=>({user:m,isAuth:!!m,userLoaded:h,login:I,logout:Y,saveUserData:M,type:i,refreshToken:E,hasRole:O,hasAllRoles:T,hasAnyRole:A,accessToken:m?.token}),[m,h,I,Y,M,i,E,O,T,A]);return r(sr.Provider,{value:R,children:o})}const $i="nextauth.token",ji="user-data.img";function Ni({children:e,AUTH_URL:t,oidcConfig:n,redirectURL:o,validateTokenRoute:i,testToken:a,testIP:l,logoutURL:s=o}){const c=n.authority+"/authorize?response_type=code&client_id="+n.client_id+"&scope="+n.scope+"&redirect_uri="+n.redirect_uri,[d,u]=Z(null),[p,m]=Z(!1),f=Ze();ee(()=>{const e=rr($i);e?fetch(`${t}${i}`,{method:"POST",headers:{Authorization:`Bearer ${e}`}}).then(r=>{if(r.ok){const r=or(e),t=localStorage.getItem(ji);u({name:r.given_name,image:t??"",roles:r.roles.map(e=>String(e.code)),token:e,preferred_username:r.preferred_username,email:r.email,email_verified:"true"===r.email_verified,sub:r.sub}),m(!0)}else y()}):m(!0)},[]);const h=Q(e=>{if(!location||"localhost"!==location.hostname&&location.hostname!==l)m(!1),f.replace(c);else{const r=a;tr($i,r),u({name:"Teste",image:"",roles:["1"],token:r}),f.replace(e?.redirectUri?.toString()||o).then(()=>{m(!0),e?.onSuccess?.()}).catch(r=>{e?.onError?.(r instanceof Error?r:new Error("Erro no redirecionamento"))})}},[l,a,o,c,f]),g=Q(function(e){try{const r=e.ssp_token;tr($i,r);const t=or(r),n=or(e.id_token);return Promise.resolve(fetch(n.picture,{headers:{Authorization:`Bearer ${e.access_token}`}}).then(e=>{200===e.status&&e.blob().then(e=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>{const e=n.result;localStorage.setItem(ji,e),u({name:t.name,image:e,roles:t.roles.map(e=>String(e.code)),token:r,preferred_username:t.preferred_username,email:t.email,sub:t.sub}),f.replace(o).finally(()=>m(!0))}}),u({name:t.name,image:"",roles:t.roles.map(e=>String(e.code)),token:r,preferred_username:t.preferred_username,email:t.email,sub:t.sub}),f.replace(o).finally(()=>m(!0))})).then(function(){f.replace(o).finally(()=>m(!0))})}catch(e){return Promise.reject(e)}},[o,f]),y=Q(function(e){try{function r(){m(!1),f.replace(e?.redirectUri||s).then(()=>{e?.onSuccess?.()}).finally(()=>{u(null),nr($i),localStorage.removeItem(ji),m(!0)})}const t=function(){if(e?.onBeforeLogout){const r=function(r,t){try{var n=Promise.resolve(e.onBeforeLogout()).then(function(){})}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}(0,function(e){console.error("[OAuthProvider] Erro no callback onBeforeLogout",e)});if(r&&r.then)return r.then(function(){})}}();return Promise.resolve(t&&t.then?t.then(r):r())}catch(n){return Promise.reject(n)}},[s,f]),b=Q(e=>d?.roles?.includes(e)??!1,[d?.roles]),x=Q(e=>!(!d?.roles||0===e.length)&&e.every(e=>d.roles.includes(e)),[d?.roles]),v=Q(e=>!(!d?.roles||0===e.length)&&e.some(e=>d.roles.includes(e)),[d?.roles]),C=Q(function(){try{return console.warn("[OAuthProvider] refreshToken não é suportado neste provider"),Promise.resolve(!1)}catch(e){return Promise.reject(e)}},[]),w=re(()=>({user:d,isAuth:!!d,userLoaded:p,login:h,logout:y,saveUserData:g,type:"govbr",refreshToken:C,hasRole:b,hasAllRoles:x,hasAnyRole:v,accessToken:d?.token}),[d,p,h,y,g,C,b,x,v]);return r(sr.Provider,{value:w,children:e})}function zi(n){return e(t,{children:[r(Qo,{}),n.children,r(Oe,{position:"bottom-right",theme:"colored"})]})}function Bi({name:t,options:a,title:l,required:c=!1,disabled:d=!1,row:u=!1,xs:p=12,sm:m,md:f,defaultValue:h,watchValue:g}){const y=J(dr),b=s();return ee(()=>{void 0!==g&&y.formSetValue(t,g)},[g,t,y]),r(n,{item:!0,xs:p,sm:m,md:f,children:r(pe,{name:t,control:y.formControl,defaultValue:h??"",rules:{required:!!c&&"Este campo é obrigatório"},render:({field:t,fieldState:{error:n}})=>e(A,{error:!!n,disabled:d,fullWidth:!0,children:[l&&r(P,{required:c,error:!!n,sx:{mb:1,fontWeight:500,fontSize:"0.875rem"},children:l}),r(i,{display:"flex",flexDirection:u?"row":"column",gap:1,flexWrap:"wrap",children:a.map((n,a)=>{const l=t.value===n.value;return e(i,{onClick:()=>!d&&t.onChange(l&&!c?"":n.value),sx:{border:"1px solid",borderColor:l?b.palette.primary.main:"#E0E0E0",borderRadius:"8px",padding:"8px 16px",cursor:d?"not-allowed":"pointer",backgroundColor:l?`${b.palette.primary.main}10`:"white",transition:"all 0.2s",display:"flex",alignItems:"center",position:"relative",opacity:d?.6:1,"&:hover":{borderColor:d||l?void 0:b.palette.grey[400],backgroundColor:d||l?void 0:b.palette.grey[50]}},children:[r(i,{sx:{width:"18px",height:"18px",borderRadius:"50%",border:"2px solid",borderColor:l?b.palette.primary.main:"#9E9E9E",mr:1.5,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s"},children:l&&r(i,{sx:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:b.palette.primary.main}})}),r(o,{variant:"body2",color:l?"primary.main":"text.primary",fontWeight:l?600:400,children:n.label})]},a)})}),n&&e($,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:"8px",border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1,marginLeft:0,marginRight:0},children:[r(N,{fontSize:"small"}),n.message]})]})})})}var Li=/*#__PURE__*/H.memo(Bi);export{$i as AUTH_COOKIE_NAME,Oo as ActiveInput,sr as AuthContext,To as AutoComplete,Zo as Button,ir as Category,ur as CheckBox,mr as CheckBoxAdditional,fr as CheckBoxWarning,yr as DatePicker,ho as DropFileUpload,Ro as FetchAutoComplete,ar as Field,lr as FieldLabel,cr as File,go as FileUpload,Vo as FixedAutoComplete,dr as FormContext,Ri as FormProvider,br as GenericDatePicker,$o as GenericFetchAutoComplete,Bo as GenericInput,No as GenericMaskInput,Lo as GenericMultInput,mi as GenericTable,Mo as Input,Pi as KeycloakAuthProvider,Jo as MODAL,Oi as Map,wo as MaskInput,ei as Menu,Wo as MultInput,Ti as NavBar,Ni as OAuthProvider,_o as OtherCheckBox,Li as Radio,gr as RequiredCheckBoxGroup,zi as SspComponentsProvider,Ko as Stepper,Go as StepperBlock,bo as Switch,vo as SwitchWatch,Ai as TabNavBar,Mi as Table,xr as TimePicker,xo as ToggleVisibility};
2
+ return r(i,vr({as:l,ownerState:h,ref:t,className:Un(g.root,p)},f,{children:d?lo(u,d):u}))});return"production"!==process.env.NODE_ENV&&(a.propTypes={children:mt.node,direction:mt.oneOfType([mt.oneOf(["column-reverse","column","row-reverse","row"]),mt.arrayOf(mt.oneOf(["column-reverse","column","row-reverse","row"])),mt.object]),divider:mt.node,spacing:mt.oneOfType([mt.arrayOf(mt.oneOfType([mt.number,mt.string])),mt.number,mt.object,mt.string]),sx:mt.oneOfType([mt.arrayOf(mt.oneOfType([mt.func,mt.object,mt.bool])),mt.func,mt.object])}),a}();"production"!==process.env.NODE_ENV&&(co.propTypes={children:mt.node,component:mt.elementType,direction:mt.oneOfType([mt.oneOf(["column-reverse","column","row-reverse","row"]),mt.arrayOf(mt.oneOf(["column-reverse","column","row-reverse","row"])),mt.object]),divider:mt.node,spacing:mt.oneOfType([mt.arrayOf(mt.oneOfType([mt.number,mt.string])),mt.number,mt.object,mt.string]),sx:mt.oneOfType([mt.arrayOf(mt.oneOfType([mt.func,mt.object,mt.bool])),mt.func,mt.object]),useFlexGap:mt.bool});var uo=co;function po(t){return r(m,{...t,children:e("svg",{width:"26",height:"34",viewBox:"0 0 26 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r("path",{d:"M24.9717 11.5L14.8333 1.36165C14.5757 1.10371 14.2262 0.958634 13.8617 0.958313H5.66667C4.32953 0.958313 3.04717 1.48949 2.10167 2.43498C1.15617 3.38048 0.625 4.66285 0.625 5.99998V28C0.625 29.3371 1.15617 30.6195 2.10167 31.565C3.04717 32.5105 4.32953 33.0416 5.66667 33.0416H20.3333C21.6705 33.0416 22.9528 32.5105 23.8983 31.565C24.8438 30.6195 25.375 29.3371 25.375 28V12.4166C25.3606 12.0713 25.2166 11.744 24.9717 11.5ZM15.2917 5.65165L20.6817 11.0416H15.2917V5.65165ZM20.3333 30.2916H5.66667C5.05888 30.2916 4.47598 30.0502 4.04621 29.6204C3.61644 29.1907 3.375 28.6078 3.375 28V5.99998C3.375 5.39219 3.61644 4.8093 4.04621 4.37953C4.47598 3.94976 5.05888 3.70831 5.66667 3.70831H12.5417V12.4166C12.5464 12.7798 12.6928 13.1268 12.9496 13.3837C13.2065 13.6405 13.5535 13.7869 13.9167 13.7916H22.625V28C22.625 28.6078 22.3836 29.1907 21.9538 29.6204C21.524 30.0502 20.9411 30.2916 20.3333 30.2916Z",fill:"#fff"}),r("path",{d:"M15.7317 22.225C14.6044 21.5176 13.756 20.4425 13.33 19.1817C13.7248 18.0021 13.8439 16.7478 13.6784 15.515C13.6255 15.2044 13.474 14.9191 13.2464 14.7013C13.0187 14.4835 12.727 14.3448 12.4144 14.3058C12.1018 14.2667 11.7849 14.3293 11.5107 14.4844C11.2364 14.6394 11.0194 14.8786 10.8917 15.1667C10.683 16.6487 10.8403 18.1594 11.35 19.5667C10.6537 21.1933 9.87664 22.7842 9.02169 24.3333C7.72002 25.0667 5.94169 26.1667 5.66669 27.4317C5.44669 28.4583 7.37169 31.0983 10.6534 25.3783C12.1126 24.8366 13.6072 24.3956 15.1267 24.0583C16.2499 24.7005 17.5029 25.0827 18.7934 25.1767C19.0897 25.1843 19.3816 25.1043 19.6325 24.9465C19.8835 24.7887 20.0822 24.5603 20.2036 24.2899C20.3251 24.0195 20.3639 23.7193 20.3152 23.4269C20.2666 23.1345 20.1325 22.8631 19.93 22.6467C19.16 21.8583 16.8684 22.0783 15.7317 22.225ZM6.96836 27.725C7.48213 26.8458 8.16063 26.0739 8.96669 25.4517C7.72002 27.4317 6.96836 27.78 6.96836 27.7433V27.725ZM12.3217 15.24C12.7984 15.24 12.7617 17.3483 12.4317 17.9167C12.1831 17.0521 12.1454 16.1405 12.3217 15.2583V15.24ZM10.7267 24.1867C11.3478 23.0533 11.887 21.877 12.34 20.6667C12.8257 21.5704 13.5012 22.3585 14.32 22.9767C13.09 23.2848 11.888 23.6956 10.7267 24.205V24.1867ZM19.3434 23.8567C19.3434 23.8567 19.0134 24.26 16.905 23.3433C19.1967 23.1967 19.5817 23.7283 19.3434 23.875V23.8567Z",fill:"#fff"})]})})}function mo(t){return r(m,{...t,children:e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r("path",{d:"M20 8.70001H4C3.90151 8.70001 3.80398 8.68061 3.71299 8.64292C3.62199 8.60523 3.53931 8.54999 3.46967 8.48034C3.40003 8.4107 3.34478 8.32802 3.30709 8.23703C3.2694 8.14603 3.25 8.0485 3.25 7.95001C3.25 7.85152 3.2694 7.75399 3.30709 7.663C3.34478 7.57201 3.40003 7.48933 3.46967 7.41968C3.53931 7.35004 3.62199 7.29479 3.71299 7.2571C3.80398 7.21941 3.90151 7.20001 4 7.20001H20C20.1989 7.20001 20.3897 7.27903 20.5303 7.41968C20.671 7.56033 20.75 7.7511 20.75 7.95001C20.75 8.14892 20.671 8.33969 20.5303 8.48034C20.3897 8.621 20.1989 8.70001 20 8.70001Z",fill:"white"}),r("path",{d:"M16.44 20.75H7.56C7.24309 20.7717 6.92503 20.7302 6.62427 20.628C6.3235 20.5259 6.04601 20.365 5.80788 20.1548C5.56975 19.9446 5.37572 19.6891 5.23704 19.4034C5.09836 19.1176 5.01779 18.8071 5 18.49V7.99998C5 7.80107 5.07902 7.61031 5.21967 7.46965C5.36032 7.329 5.55109 7.24998 5.75 7.24998C5.94891 7.24998 6.13968 7.329 6.28033 7.46965C6.42098 7.61031 6.5 7.80107 6.5 7.99998V18.49C6.5 18.9 6.97 19.25 7.5 19.25H16.38C16.94 19.25 17.38 18.9 17.38 18.49V7.99998C17.38 7.78516 17.4653 7.57913 17.6172 7.42723C17.7691 7.27532 17.9752 7.18998 18.19 7.18998C18.4048 7.18998 18.6109 7.27532 18.7628 7.42723C18.9147 7.57913 19 7.78516 19 7.99998V18.49C18.9822 18.8071 18.9016 19.1176 18.763 19.4034C18.6243 19.6891 18.4303 19.9446 18.1921 20.1548C17.954 20.365 17.6765 20.5259 17.3757 20.628C17.075 20.7302 16.7569 20.7717 16.44 20.75ZM16.56 7.74998C16.4611 7.75133 16.363 7.73285 16.2714 7.69563C16.1798 7.65842 16.0966 7.60323 16.0267 7.53331C15.9568 7.4634 15.9016 7.38018 15.8644 7.28858C15.8271 7.19698 15.8087 7.09885 15.81 6.99998V5.50998C15.81 5.09999 15.33 4.74998 14.81 4.74998H9.22C8.67 4.74998 8.22 5.09999 8.22 5.50998V6.99998C8.22 7.1989 8.14098 7.38966 8.00033 7.53031C7.85968 7.67097 7.66891 7.74998 7.47 7.74998C7.27109 7.74998 7.08032 7.67097 6.93967 7.53031C6.79902 7.38966 6.72 7.1989 6.72 6.99998V5.50998C6.75872 4.8813 7.04203 4.29275 7.50929 3.87035C7.97655 3.44795 8.5906 3.22527 9.22 3.24998H14.78C15.4145 3.21717 16.0362 3.4362 16.51 3.85944C16.9838 4.28267 17.2713 4.87586 17.31 5.50998V6.99998C17.3113 7.09931 17.2929 7.19792 17.2558 7.29007C17.2187 7.38222 17.1637 7.46608 17.0939 7.53679C17.0241 7.6075 16.941 7.66364 16.8493 7.70195C16.7577 7.74027 16.6593 7.75999 16.56 7.75998V7.74998Z",fill:"white"}),r("path",{d:"M10.22 17C10.0219 16.9974 9.8326 16.9175 9.6925 16.7774C9.55241 16.6373 9.47256 16.4481 9.46997 16.25V11.72C9.46997 11.5211 9.54899 11.3303 9.68964 11.1896C9.83029 11.049 10.0211 10.97 10.22 10.97C10.4189 10.97 10.6096 11.049 10.7503 11.1896C10.891 11.3303 10.97 11.5211 10.97 11.72V16.24C10.9713 16.3393 10.9529 16.4379 10.9158 16.5301C10.8787 16.6222 10.8236 16.7061 10.7539 16.7768C10.6841 16.8475 10.601 16.9036 10.5093 16.9419C10.4177 16.9803 10.3193 17 10.22 17Z",fill:"white"}),r("path",{d:"M13.78 17C13.5811 17 13.3904 16.921 13.2497 16.7803C13.109 16.6396 13.03 16.4489 13.03 16.25V11.72C13.03 11.5211 13.109 11.3303 13.2497 11.1896C13.3904 11.049 13.5811 10.97 13.78 10.97C13.9789 10.97 14.1697 11.049 14.3104 11.1896C14.451 11.3303 14.53 11.5211 14.53 11.72V16.24C14.53 16.4398 14.4513 16.6316 14.311 16.7739C14.1706 16.9161 13.9799 16.9973 13.78 17Z",fill:"white"})]})})}function fo(e){const r=1048576;return e<r?`${(e/1024).toFixed(1)}KB`:`${(e/r).toFixed(1)}MB`}function ho({name:t="filesUid",tipoArquivo:a,title:c,required:d=!1,multiple:p=!1,apiURL:m,sizeLimit:g=4,xs:y=12,sm:b,md:x,route:v="",tstToken:C="",dropZoneOptions:w,disabled:k=!1}){const{getRootProps:E,getInputProps:S}=fe({disabled:k,multiple:p,useFsAccessApi:!0,onDrop:e=>{O(-1),e.filter(e=>!(e.size/1048576>g&&(j(`Por favor, escolha um arquivo com tamanho inferior a ${g} MB`),setTimeout(()=>{j("")},3e3),1))).forEach((e,r)=>{let t=Date.now()+r;const n=new FormData;n.append("files",e),n.append("tipoArquivo",a),me.post(m,n,{onUploadProgress:r=>{const n=Math.round(100*r.loaded/r.total);O(n),n>=100&&A(r=>[...r,{id:t,name:e.name,loading:!0,error:!1,file:e,size:e.size}])},headers:{Authorization:`Bearer ${""===C?I?I.token:"":C}`}}).then(e=>{if(e.status>200){const r=ne(e.data,v,e.data)[0].coSeqArquivo;D.setFilesUid(e=>[...e,{CO_SEQ_ARQUIVO:r,CO_TIPO_ARQUIVO:parseInt(a)}]),F(e=>[...e,t]);const n={};n[t]=r,P(e=>({...e,...n}))}else O(-1),z(t)}).catch(e=>{console.log(e),O(-1),z(t)})})},...w||{}}),D=J(dr),{user:I}=J(sr),Y=s();f(Y.breakpoints.only("xs"));const[M,O]=Z(-1),[T,A]=Z([]),[R,F]=Z([]),[V,P]=Z({}),[$,j]=Z(""),z=(e,r,t)=>{A(T.filter(r=>r.id!==e)),t&&D.setFilesUid(e=>e.filter(e=>e.CO_SEQ_ARQUIVO!==t)),r||(j("Erro ao enviar arquivo. Verifique o formato e tente mais tarde."),setTimeout(()=>{j("")},3e3))};return ee(()=>{if(m){const e=T.filter(e=>void 0!==V[e.id]).map(e=>({CO_SEQ_ARQUIVO:V[e.id],CO_TIPO_ARQUIVO:parseInt(a)}));D?.formSetValue(t,e)}else{const e=new DataTransfer;T.forEach(r=>{e.items.add(r.file)}),D?.formSetValue(t,e.files)}},[T,D,t,V,m,a]),ee(()=>()=>{D.setFilesUid(e=>e.filter(e=>e.CO_TIPO_ARQUIVO!==parseInt(a)))},[]),r(n,{item:!0,xs:y,sm:b,md:x,sx:{width:"100%",opacity:k?.5:1,pointerEvents:k?"none":"auto"},children:e(i,{bgcolor:"white",p:2,borderRadius:"8px",color:"#1E293B",children:[r(u,{required:d,sx:{marginBottom:2,textTransform:"capitalize"},children:c}),e(uo,{...E({className:"dropzone"}),bgcolor:"#EFEFEF",justifyContent:"center",alignItems:"center",textAlign:"center",borderRadius:"6px",py:8,border:"solid 1.5px #989898",sx:{borderStyle:"dashed",cursor:"pointer"},children:[r("input",{...S(),...D.formRegister(t,{validate:(e,r)=>{if(d&&(null==e||Array.isArray(e)&&0===e.length))return"O campo de arquivo é obrigatório"}})}),e(uo,{spacing:2,alignItems:"center",children:[e(i,{children:[r(o,{fontWeight:600,fontSize:18,children:"Arraste seus arquivos até aqui"}),r(o,{children:"ou selecione arquivos que estão no seu computador"})]}),r(l,{variant:"contained",sx:{backgroundColor:"#64748B",pointerEvents:"none",borderRadius:"8px",width:"fit-content"},disabled:k,children:"Selecionar"}),e(o,{fontWeight:300,children:["Tamanho máximo por arquivo ",g,"MB"]})]})]}),e(o,{pt:2,fontSize:16,fontWeight:600,children:["Você selecionou ",T.length," arquivo",T.length>1?"s":"","."]}),e(uo,{width:"100%",marginTop:1,spacing:1,children:[T.map(t=>e(uo,{direction:"row",justifyContent:"space-between",border:"solid 1px #E2E8F0",borderRadius:2,p:1,children:[e(uo,{direction:"row",children:[r(uo,{direction:"row",justifyContent:"center",alignItems:"center",minWidth:30,pr:1.5,children:r(po,{sx:{filter:"invert(42%) sepia(86%) saturate(2412%) hue-rotate(326deg) brightness(86%) contrast(102%)",transform:"scale(1.5)",width:30}})}),e(uo,{children:[r(o,{fontWeight:600,children:t.name}),r(o,{fontSize:14,children:fo(t.size)})]})]}),r(l,{size:"small",startIcon:r(mo,{}),variant:"contained",onClick:e=>{return r=t.id,void(Object.keys(V).includes(r.toString())&&fetch(`${m}/${V[r]}`,{method:"DELETE",headers:{Authorization:`Bearer ${""===C?I?I.token:"":C}`}}).then(e=>{e.ok||z(r,!0,V[r]),200===e.status&&z(r,!0,V[r])}).catch(e=>console.log(e)));var r},sx:{height:40,backgroundColor:"#DE3F50",borderRadius:"8px"},disabled:k,children:"Remover"})]})),M>0&&M<100&&r(h,{value:M,sx:{backgroundColor:"#103D6A",".MuiLinearProgress-bar":{backgroundColor:"#BDDDFA"}}})]}),$&&e(i,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:"16px",border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),r(o,{variant:"caption",color:"inherit",fontWeight:600,fontSize:14,children:$})]}),ne(D?.errors,t)&&e(i,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:"8px",border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),r(o,{variant:"caption",color:"inherit",fontWeight:600,fontSize:14,children:"O campo de arquivo é obrigatório"})]})]})})}function go({name:t,tipoArquivo:a,title:c,required:d=!1,multiple:p=!1,apiURL:m,route:h="",sizeLimit:x=4,xs:v=12,sm:C,md:w}){const k=J(dr),{user:E}=J(sr),S=s(),D=f(S.breakpoints.only("xs")),[I,Y]=Z([]),[M,O]=Z([]),[T,A]=Z({}),[R,F]=Z(""),V=Q(e=>{const r=e.target.files,t=Object.keys(r).map(e=>r[e]);Y([...I,...t.filter(e=>!(e.size/1048576>x&&(F(`Por favor, escolha um arquivo com tamanho inferior a ${x} MB`),setTimeout(()=>{F("")},3e3),1))).map((e,r)=>{let t=Date.now()+r;const n=new FormData;return n.append("files",e),n.append("tipoArquivo",a),fetch(m,{method:"POST",body:n,headers:{Authorization:`Bearer ${E?E.token:""}`}}).then(e=>{e.ok?e.json().then(e=>{if(e.status&&200===e.status.status){const r=ne(e,h,e)[0].coSeqArquivo;k.setFilesUid(e=>[...e,{CO_SEQ_ARQUIVO:r,CO_TIPO_ARQUIVO:parseInt(a)}]),O(e=>[...e,t]);const n={};n[t]=r,A(e=>({...e,...n}))}else P(t)}):P(t)}).catch(e=>{P(t)}),{id:t,name:e.name,loading:!0,error:!1,file:e}})])},[I,k]),P=(e,r,t)=>{Y(I.filter(r=>r.id!==e)),t&&k.setFilesUid(e=>e.filter(e=>e.CO_SEQ_ARQUIVO!==t)),r||(F("Erro ao enviar arquivo. Tente novamente mais tarde"),setTimeout(()=>{F("")},3e3))};return ee(()=>{const e=new DataTransfer;I.forEach(r=>{e.items.add(r.file)}),k?.formSetValue(t,e.files)},[I,k,t]),ee(()=>()=>{k.setFilesUid(e=>e.filter(e=>e.CO_TIPO_ARQUIVO!==parseInt(a)))},[]),e(n,{item:!0,xs:v,sm:C,md:w,sx:{width:"100%"},children:[r(u,{required:d,sx:{marginBottom:2,textTransform:"capitalize"},children:c}),e(i,{sx:{backgroundColor:"#e2eafc",padding:1,borderRadius:1,marginTop:1},children:[r("input",{id:t,type:"file",multiple:p,...k?.formRegister(t,{validate:(e,r)=>{if((e.length&&M.length)<=0&&d)return"O campo de arquivo é obrigatório"}}),onChange:V,accept:".pdf",style:{display:"none"}}),r("input",{id:t+"foto",type:"file",capture:"environment",multiple:p,...k?.formRegister(t,{validate:(e,r)=>{if((e.length&&M.length)<=0&&d)return"O campo de arquivo é obrigatório"}}),onChange:V,accept:".jpg, .png, .jpeg",style:{display:"none"}}),e(i,{sx:{display:{sx:"block",md:"flex"}},children:[r(i,{sx:{width:"100%",marginRight:{xs:0,md:1},marginBottom:{xs:1,md:0}},children:!p&&I.length>=1?r(l,{disabled:!0,variant:"contained",disableElevation:!0,startIcon:r(ve,{}),component:"span",sx:{textTransform:"none"},fullWidth:!0,children:"Escolher Documento"}):r("label",{htmlFor:t,children:r(l,{variant:"contained",disableElevation:!0,startIcon:r(ve,{}),component:"span",sx:{textTransform:"none"},fullWidth:!0,children:"Escolher Documento"})})}),r(i,{sx:{width:"100%"},children:!p&&I.length>=1?r(l,{disabled:!0,variant:"contained",disableElevation:!0,startIcon:r(ye,{}),component:"span",sx:{textTransform:"none",backgroundColor:"#0096c7"},fullWidth:!0,children:D?"Tirar Foto":"Escolher Imagem"}):r("label",{htmlFor:t+"foto",children:r(l,{variant:"contained",disableElevation:!0,startIcon:r(ye,{}),component:"span",sx:{textTransform:"none",backgroundColor:"#0096c7"},fullWidth:!0,children:D?"Tirar Foto":"Escolher Imagem"})})})]}),e(o,{fontWeight:600,paddingY:1,color:"black",children:["Você selecionou ",I.length," arquivo",I.length>1&&"s"]}),I.length>0&&r(g,{component:y,children:r(uo,{direction:"column",children:I.map(t=>e(uo,{direction:"row",justifyContent:"space-between",padding:.5,children:[r(i,{children:e(uo,{direction:"row",spacing:2,children:[M.includes(t.id)?r(xe,{sx:{fill:"#06d6a0"}}):r(b,{size:22,sx:{color:"black"}}),r(Ce,{color:"error"}),r(o,{fontWeight:600,children:t.name})]})}),r(i,{children:M.includes(t.id)&&r(l,{variant:"contained",size:"small",sx:{textTransform:"none",backgroundColor:"#d1495b","&:hover":{backgroundColor:"#c1121f"}},onClick:e=>{return r=t.id,void(Object.keys(T).includes(r.toString())&&fetch(`${m}/${T[r]}`,{method:"DELETE",headers:{Authorization:`Bearer ${E?.token}`}}).then(e=>{e.ok||P(r,!0,T[r]),200===e.status&&P(r,!0,T[r])}).catch(e=>console.log(e)));var r},startIcon:r(be,{}),children:"Remover"})})]},t.name))})}),R&&e(i,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:"16px",border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),r(o,{variant:"caption",color:"inherit",fontWeight:600,fontSize:14,children:R})]}),ne(k?.errors,t)&&e(i,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:"8px",border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),r(o,{variant:"caption",color:"inherit",fontWeight:600,fontSize:14,children:"* O campo de arquivo é obrigatório"})]})]})]})}function yo({defaultChecked:t=!1,...n}){const i=J(dr);ee(()=>{i?.formSetValue(n.name,t)},[]);const l=re(()=>n.overrideYes||"Sim",[n.overrideYes]),s=re(()=>n.overrideNo||"Não",[n.overrideNo]);return e(a,{sx:{alignItems:"center",justifyContent:"center"},children:[n.title&&r(u,{children:n.title}),r(x,{control:r(v,{defaultChecked:t,...i?.formRegister(n.name)}),label:r(o,{width:25,sx:{userSelect:"none",fontWeight:600},children:i?.formWatch(n.name)?l:s}),sx:{paddingLeft:1}})]})}var bo=/*#__PURE__*/H.memo(yo);function xo({invert:e=!1,hasCheckValue:n=!1,...o}){const i=J(dr);return ee(()=>()=>{(n?e:i.formWatch(o.switchId)===e)&&o.unregisterNameList.forEach(e=>i.formUnregister(e))},[o.unregisterNameList]),r(t,{})}function vo({invert:n=!1,checkValue:o,...i}){const a=J(dr);return r(t,{children:(o?a?.formWatch(i.switchId)===o!==n:a?.formWatch(i.switchId)!==n)&&e(t,{children:[r(xo,{switchId:i.switchId,unregisterNameList:i.unregisterNameList,hasCheckValue:!!o,invert:o?a?.formWatch(i.switchId)===o!==n:n}),i.children]})})}const Co=/*#__PURE__*/H.forwardRef(function({imaskConfig:e,onMaskChange:t,name:n,...o},i){const a=te(null),[l,s]=Z(""),[c,d]=Z(e.mask),u=J(dr),p=u.formWatch(n);return ee(()=>{void 0!==p&&p!==l&&s(p)},[p]),ee(()=>{const e=a.current?.maskRef?.value;void 0!==e&&u.formSetValue(n,e)},[l,n]),r(ke,{...o,...e,name:n,mask:c,value:l,ref:a,inputRef:i,onAccept:(e,r)=>{s(e),r.updateValue(),t?.(e,d)}})});function wo({formConfig:e,disabled:t,imaskConfig:n,onMaskChange:o}){return r(p,{...e,disabled:t,fullWidth:!0,InputProps:{inputComponent:Co,inputProps:{imaskConfig:n,onMaskChange:o}}})}const ko={cep:{mask:"00000-000"},phone:{mask:[{mask:"(00) 0000-0000"},{mask:"(00) 00000-0000"}],dispatch:(e,r)=>{const t=(r.value+e).replace(/\D/g,"");return t.length<=2?r.compiledMasks[0]:"9"===t.substring(2,3)?r.compiledMasks[1]:r.compiledMasks[0]}},sei:{mask:"00000-00000000/0000-00"},cpf:{mask:"000.000.000-00"},cnpj:{mask:"00.000.000/0000-00"},rg:{mask:"00000[000000]"},cpf_cnpj:{mask:[{mask:"000.000.000-00"},{mask:"00.000.000/0000-00"}],dispatch:(e,r)=>{const t=(r.value+e).replace(/\D/g,"");return r.compiledMasks[t.length>11?1:0]}}},Eo={cnpj:{length:18,message:"O CNPJ precisa ter no mínimo 14 dígitos"},cpf:{length:14,message:"O CPF precisa ter no mínimo 11 dígitos"},sei:{length:22,message:"O Número SEI precisa ter no mínimo 19 dígitos"},cep:{length:9,message:"O CEP precisa ter no mínimo 8 dígitos"}},So={backgroundColor:"white","& .MuiOutlinedInput-root":{borderRadius:"8px",transition:"all 0.2s","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"2px"},"&.Mui-error .MuiOutlinedInput-notchedOutline":{borderWidth:"2px"}}},Do=e=>({sx:{backgroundColor:e?"#FFEBEE":"transparent",borderRadius:"8px",padding:e?"8px 12px":0,marginBottom:e?"4px":0,marginTop:e?"8px":0,border:e?"1px solid #FFCDD2":"none",color:"error.main",marginLeft:0,marginRight:0}}),Io={mb:1,fontWeight:500,fontSize:"0.875rem",color:"text.primary",transform:"none",position:"static"};function Yo({type:t="input",name:o,title:a,required:l,numberMask:s="000000000000000",customPlaceholder:c,defaultValue:d="",inputMinLength:m=1,inputMaxLength:f=255,customValidate:h,xs:g=12,sm:y,md:b,gridProps:x,labelProps:v,disabled:C=!1,sx:w,InputProps:k,InputLabelProps:E,...S}){const D=J(dr),I=(e,r)=>{const n=e??"";if(0===n.length&&l)return"Este campo é obrigatório";if(h){const e=h(n,r);if(e)return e}const o=Eo[t];if(o&&n.length<o.length&&l)return o.message;if(["input","text","password","search","tel","url"].includes(t)||"number"===t){if(n.length>f)return`Limite máximo de ${f} caracteres`;if(n.length<m&&l)return`Limite mínimo de ${m} caracteres`}if("phone"===t){const e=n.replace(/\D/g,"");if(e.length>2){if("9"===e.substring(2,3)){if(n.length<15&&l)return"O número de celular precisa ter 11 dígitos"}else if(n.length<14&&l)return"O número fixo precisa ter 10 dígitos"}else if(n.length<14&&l)return"O número precisa ter pelo menos 10 dígitos"}if("email"===t){if(n.length>50)return"Limite máximo de 50 caracteres";if(!/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g.test(n)&&l)return"O e-mail inserido não é válido"}return"cpf_cnpj"===t&&(n.length<14||n.length>14&&n.length<18)&&l?"O CPF/CNPJ precisa ter no mínimo 11/14 dígitos":void 0},Y=ne(D.errors,o),M=Boolean(Y),O=D.formWatch(o),T=M?e(i,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),Y?.message]}):void 0,A=re(()=>w?[So,w].flat():So,[w]),R=re(()=>({...D.formRegister(o,{validate:I}),error:M,helperText:T,fullWidth:!0,size:"small",variant:"outlined",placeholder:c??a,FormHelperTextProps:Do(M),sx:A,InputProps:k,InputLabelProps:E,...S}),[o,M,T,c,a,A,k,E,S]);return e(n,{item:!0,xs:g,sm:y,md:b,...x,children:[a&&r(u,{required:l,sx:v?.sx?[Io,v.sx].flat():Io,...v,children:a}),(()=>{const e="number"===t?{mask:s}:ko[t];if(e)return r(wo,{formConfig:R,imaskConfig:e,disabled:C});const n="input"===t?"text":t;return r(p,{...R,type:n,value:O??d,onChange:e=>D.formSetValue(o,e.target.value),disabled:C})})()]})}var Mo=/*#__PURE__*/H.memo(Yo);function Oo({name:t,required:o=!1,title:i,defaultChecked:l=!1,xs:s=12,unregisterNameList:c,sm:d,md:u,...p}){const m=`${t}-switch`;return e(n,{item:!0,xs:s,sm:d,md:u,children:[i&&r(we,{required:o,sx:{textTransform:"capitalize"},children:i}),e(a,{direction:"row",children:[r(bo,{name:m,defaultChecked:l}),r(vo,{switchId:m,unregisterNameList:c,children:r(Yo,{name:"ddd",type:"input"})})]})]})}function To({name:t,required:o=!1,title:i,customPlaceholder:a,url:l,xs:s=12,sm:c,md:d,dataPath:u=""}){const m=J(dr),{user:f}=J(sr),[h,g]=Z([]);Ee(`autocomplete-${t}`,()=>fetch(l,{headers:{Authorization:`Bearer ${f?f.token:""}`}}).then(e=>e.json().then(e=>g(y(e)))));const y=Q(e=>Array.isArray(e)?e:"object"==typeof e?ne(e,u):void 0,[]),b=Q((e,r)=>{m?.formSetValue(t,r?r.id:""),m?.formTrigger(t)},[m,t]);return e(n,{item:!0,xs:s,sm:c,md:d,children:[i&&r(we,{required:o,children:i}),r("input",{type:"text",...m?.formRegister(t,{validate:(e,r)=>{if(e.length<=0&&o)return"Este campo é obrigatório"}}),hidden:!0}),r(C,{options:h,isOptionEqualToValue:(e,r)=>e.id===r.id,onChange:b,renderInput:e=>r(p,{...e,placeholder:a,size:"small",error:!!ne(m?.errors,t),helperText:ne(m?.errors,t)?.message})})]})}let Ao=!0;function Ro({name:t,url:o,title:a,customLoadingText:l,shouldRefetch:s=!0,required:c=!1,defaultValue:d,route:m="",onChange:f=()=>{},xs:h=12,sm:g,watchValue:y,md:b,disabled:x=!1}){const v=J(dr),[w,k]=Z(!0),[E,S]=Z([]),[D,I]=Z("Carregando..."),[Y,M]=Z(null),[O,T]=Z(null),[A,R]=Z(null),{user:F}=J(sr),V=function(e,r,n=!1){try{return Promise.resolve(function(o,i){try{var a=(R(null),Promise.resolve(fetch(e,{method:"GET",headers:{Authorization:`Bearer ${F?.token}`}})).then(function(e){if(!e.ok){const r=401===e.status?"Sessão expirada. Faça login novamente.":403===e.status?"Acesso negado. Verifique suas permissões.":e.status>=500?"Erro interno do servidor. Tente novamente mais tarde.":"Erro ao carregar dados";return R(r),I(r),void k(!1)}return Promise.resolve(e.json()).then(function(e){const o=ne(e,r,e);if(n){const e=o.filter(e=>e.id===d);e.length>0?(S(o),k(!1),v.formSetValue(t,d),M(e[0])):(R("Valor padrão inválido"),I("Erro ao carregar dados. Valor inválido"),k(!1))}else S(o),k(!1)})}))}catch(e){return i(e)}return a&&a.then?a.then(void 0,i):a}(0,function(e){console.error("Network error:",e),R("Erro de conexão. Verifique sua internet e tente novamente."),I("Erro de conexão. Verifique sua internet e tente novamente."),k(!1)}))}catch(e){return Promise.reject(e)}};function P(){(d||!s)&&E.length>0||(k(!0),S([]),l&&I(l),V(o,m,!1))}return ee(()=>{d&&V(o,m,!0)},[]),ee(()=>{y&&Ao&&(T(y),v.formSetValue(t,y.id),f(y.id))},[y]),d&&E.length<=0&&!Y?r(n,{item:!0,xs:h,sm:g,md:b,children:r(p,{size:"small",fullWidth:!0,placeholder:D,disabled:!0})}):e(n,{item:!0,xs:h,sm:g,md:b,children:[a&&r(u,{required:c,children:a}),r("input",{type:"text",...v?.formRegister(t,{validate:(e,r)=>{if(c&&!e)return"Este campo é obrigatório"}}),hidden:!0}),r(C,{value:O,loading:w,loadingText:D,options:E,defaultValue:Y,getOptionDisabled:e=>e?.disabled??!1,isOptionEqualToValue:(e,r)=>e.id===r.id,onChange:(e,r)=>function(e){if(Ao=!1,e)return T(e),v.formSetValue(t,e.id),void f(e.id);T(null),v.formSetValue(t,""),f(void 0)}(r),renderInput:n=>{const o=ne(v?.errors,t),l=!!o||!!A;let s=o?.message||A;return l&&(s=e(i,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),s]})),r(p,{...n,size:"small",fullWidth:!0,placeholder:a,onFocus:P,error:l,helperText:s,FormHelperTextProps:{sx:{backgroundColor:l?"#FFEBEE":"transparent",borderRadius:"8px",padding:l?"8px 12px":0,marginBottom:l?"4px":0,marginTop:l?"8px":0,border:l?"1px solid #FFCDD2":"none",color:"error.main",marginLeft:0,marginRight:0}}})},sx:{bgcolor:"white","& .MuiOutlinedInput-root":{borderRadius:"8px",transition:"all 0.2s","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"2px"},"&.Mui-error .MuiOutlinedInput-notchedOutline":{borderWidth:"2px"}}},size:"small",fullWidth:!0,disabled:x})]})}let Fo=!0;function Vo({name:t,title:o,required:a=!1,list:l,defaultValue:s,onChange:c=()=>{},xs:d=12,sm:m,watchValue:f,forceUpdate:h=!1,md:g}){const y=J(dr),[b,x]=Z(null);return ee(()=>{s&&y?.formSetValue(t,s.id)},[]),ee(()=>{f&&(Fo||h)?(x(f),y.formSetValue(t,f.id),c(f.id)):void 0===f&&(Fo||h)&&(x(null),y.formSetValue(t,void 0),c(void 0))},[f]),e(n,{item:!0,xs:d,sm:m,md:g,children:[o&&r(u,{required:a,children:o}),r("input",{type:"text",...y?.formRegister(t,{validate:(e,r)=>{if(a&&!e)return"Este campo é obrigatório"}}),hidden:!0}),r(C,{value:b,options:l,defaultValue:s,getOptionLabel:e=>e.label?e.label.toString():"Não Encontrado",isOptionEqualToValue:(e,r)=>e.id===r.id,onChange:(e,r)=>function(e){if(Fo=!1,e)return x(e),y.formSetValue(t,e.id),void c(e.id);x(null),y.formSetValue(t,""),c(void 0)}(r),renderInput:n=>{const a=ne(y?.errors,t),l=!!a;let s=a?.message;return l&&(s=e(i,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),s]})),r(p,{...n,size:"small",fullWidth:!0,placeholder:o,error:l,helperText:s,FormHelperTextProps:{sx:{backgroundColor:l?"#FFEBEE":"transparent",borderRadius:"8px",padding:l?"8px 12px":0,marginBottom:l?"4px":0,marginTop:l?"8px":0,border:l?"1px solid #FFCDD2":"none",color:"error.main",marginLeft:0,marginRight:0}}})},size:"small",sx:{bgcolor:"white","& .MuiOutlinedInput-root":{borderRadius:"8px",transition:"all 0.2s","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"2px"},"&.Mui-error .MuiOutlinedInput-notchedOutline":{borderWidth:"2px"}}},fullWidth:!0})]})}let Po=!0;function $o({name:t,url:o,title:i,customLoadingText:a,shouldRefetch:l=!0,required:s=!1,defaultValue:c,route:d="",onChange:m=()=>{},xs:f=12,sm:h,watchValue:g,md:y,disabled:b=!1}){const x=de(),[v,w]=Z(!0),[k,E]=Z([]),[S,D]=Z("Carregando..."),[I,Y]=Z(null),[M,O]=Z(null),{user:T}=J(sr);function A(){(c||!l)&&k.length>0||(w(!0),E([]),a&&D(a),fetch(o,{method:"GET",headers:{Authorization:`Bearer ${T?.token}`}}).then(e=>{e.ok?e.json().then(e=>{E(ne(e,d,e)),w(!1)}):D("Erro ao carregar dados")}))}return ee(()=>{c&&fetch(o,{method:"GET",headers:{Authorization:`Bearer ${T?.token}`}}).then(e=>{e.ok?(console.log("llll"),e.json().then(e=>{let r=ne(e,d,e).filter(e=>e.id===c);r.length>0?(E(ne(e,d,e)),w(!1),x.setValue(t,c),Y(r[0])):D("Erro ao carregar dados. Valor inválido")})):D("Erro ao carregar dados")})},[]),ee(()=>{g&&Po&&(O(g),x.setValue(t,g.id),m(g.id))},[g]),c&&k.length<=0&&!I?r(n,{item:!0,xs:f,sm:h,md:y,children:r(p,{size:"small",fullWidth:!0,placeholder:S,disabled:!0})}):e(n,{item:!0,xs:f,sm:h,md:y,children:[i&&r(u,{required:s,children:i}),r("input",{type:"text",...x?.register(t,{validate:(e,r)=>{if(e.length<=0&&s)return"Este campo é obrigatório"}}),hidden:!0}),r(C,{value:M,loading:v,loadingText:S,options:k,defaultValue:I,getOptionDisabled:e=>e?.disabled??!1,isOptionEqualToValue:(e,r)=>e.id===r.id,onChange:(e,r)=>function(e){if(Po=!1,e)return O(e),x.setValue(t,e.id),void m(e.id);O(null),x.setValue(t,""),m(void 0)}(r),renderInput:e=>r(p,{...e,size:"small",fullWidth:!0,placeholder:i,onFocus:A,error:!!ne(x.formState.errors,t),helperText:ne(x.formState.errors,t)?.message}),sx:{bgcolor:"white"},size:"small",fullWidth:!0,disabled:b})]})}const jo=/*#__PURE__*/H.forwardRef(function(e,t){const{onChange:n,maskProps:o,onMask:i,maskValue:a,setMaskValue:l,watchValue:s,...c}=e,[d,u]=Z(o.mask);delete c.value;const p=te(null),[m,f]=Z(""),h=de();return ee(()=>{s&&f(s)},[s]),ee(()=>{h.setValue(c.name,p.current.element.value)},[m]),delete c.watchValue,r(ke,{...c,...o,mask:d,value:m,ref:p,inputRef:t,onChange:e=>{},onAccept:(e,r)=>{f(e),r.updateValue(),i&&i(e,u)}})});function No(e){const n=J(dr),[o,i]=Z("");return r(t,{children:r(p,{...e.formConfig,onInput:r=>{n.formSetValue(e.formConfig.name,r.target.value)},InputProps:{inputComponent:jo,inputProps:{maskProps:e.maskProps,onMask:e.onMask,maskValue:o,setMaskValue:i,watchValue:e.watchValue}},disabled:e.disabled,fullWidth:!0})})}function zo({type:t="input",numberMask:o="000000000000000",xs:i=12,sm:a,inputMinLength:l=1,inputMaxLength:s=255,defaultValue:c="",md:d,disabled:m=!1,watchValue:f,...h}){const g=de();return ee(()=>{void 0!==f&&g.setValue(h.name,f)},[f]),e(n,{item:!0,xs:i,sm:a,md:d,children:[h.title&&r(u,{htmlFor:"campo",required:h.required,sx:{mb:1,fontWeight:500,fontSize:"0.875rem",color:"text.primary",transform:"none",position:"static"},children:h.title}),(()=>{const e={fullWidth:!0,size:"small",placeholder:h.customPlaceholder?h.customPlaceholder:h.title},n=h.name,i=ne(g?.formState.errors,h.name),a=i?.message,d=!!i,u={...g?.register(n,{validate:(e,r)=>{const n=e??"";if(n.length<=0&&h.required)return"Este campo é obrigatório";if("cnpj"===t){if(n.length<18&&h.required)return"O CNPJ precisa ter no mínimo 14 dígitos"}else if("cpf"===t){if(n.length<14&&h.required)return"O CPF precisa ter no mínimo 11 dígitos"}else if("sei"===t){if(n.length<22&&h.required)return"O Número SEI precisa ter no mínimo 19 dígitos"}else if("cep"===t){if(n.length<9&&h.required)return"O CPF precisa ter no mínimo 8 dígitos"}else if("input"===t||"password"===t||"number"===t){if(n.length>s)return`Limite máximo de ${s} caracteres`;if(n.length<l&&h.required)return`Limite mínimo de ${l} caracteres`}else if("email"===t){if(n.length>50)return"Limite máximo de 50 caracteres";if(!/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g.test(e)&&h.required)return"O e-mail inserido não é valido"}else if("cpf_cnpj"===t){if((n.length<14||n.length>14&&n.length<18)&&h.required)return"O CPF/CNPJ precisa ter no mínimo 11/14 dígitos"}else if("phone"===t&&n.length<14&&h.required)return"O número precisa ter pelo menos 10 dígitos"}}),error:d,helperText:a,...e,sx:{backgroundColor:"white","& .MuiOutlinedInput-root":{borderRadius:"8px",transition:"all 0.2s","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"1px"}}}};switch(t){case"input":case"email":return r(p,{...u,defaultValue:c,disabled:m});case"password":return r(p,{...u,type:"password",disabled:m});case"number":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:o},watchValue:f,disabled:m});case"cep":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"00000-000"},watchValue:f,disabled:m});case"phone":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"(00) [#]0000-0000",definitions:{"#":/^9$/}},watchValue:f,disabled:m});case"sei":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"00000-00000000/0000-00"},watchValue:f,disabled:m});case"cpf_cnpj":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"000.000.000-00[0]"},onMask:(e,r)=>{r(e.length>14?"00.000.000/0000-00":"000.000.000-00[0]")},watchValue:f,disabled:m});case"cpf":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"000.000.000-00"},watchValue:f,disabled:m});case"cnpj":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"00.000.000/0000-00"},watchValue:f,disabled:m});case"rg":return r(No,{formConfig:u,defaultValue:c,maskProps:{mask:"00000[000000]"},watchValue:f,disabled:m})}})()]})}var Bo=/*#__PURE__*/H.memo(zo);function Lo({name:t,required:o=!1,title:i,customPlaceholder:a,defaultValue:l="",xs:s=12,sm:c,watchValue:d="",inputMinLength:u=3,inputMaxLength:m=255,md:f,...h}){const g=de();return ee(()=>{g.setValue(t,d)},[d]),e(n,{item:!0,xs:s,sm:c,md:f,children:[i&&r(we,{required:o,sx:{textTransform:"capitalize",mb:1,fontWeight:500,fontSize:"0.875rem",color:"text.primary",transform:"none",position:"static"},children:i}),r(p,{multiline:!0,fullWidth:!0,minRows:3,defaultValue:l,...g.register(t,{validate:(e,r)=>o&&e.length<=0?"Este campo é obrigatório":e.length>m?`Limite máximo de ${m} caracteres`:e.length<u&&o?`Limite mínimo de ${u} caracteres`:void 0}),error:!!ne(g.formState.errors,t),helperText:ne(g.formState.errors,t)?.message,sx:{bgcolor:"white","& .MuiOutlinedInput-root":{borderRadius:"8px","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"1px"}}},placeholder:a||i})]})}function Wo({name:t,required:o=!1,title:a,customPlaceholder:l,defaultValue:s="",xs:c=12,sm:d,watchValue:u="",inputMinLength:m=3,inputMaxLength:f=255,md:h,...g}){const y=J(dr);ee(()=>{y.formSetValue(t,u)},[u]);const b=ne(y.errors,t);let x=b?.message;const v=!!b;return v&&(x=e(i,{component:"span",sx:{display:"flex",alignItems:"center",gap:1},children:[r(N,{fontSize:"small"}),x]})),e(n,{item:!0,xs:c,sm:d,md:h,children:[a&&r(we,{required:o,sx:{textTransform:"capitalize",mb:1,fontWeight:500,fontSize:"0.875rem",color:"text.primary",transform:"none",position:"static"},children:a}),r(p,{multiline:!0,fullWidth:!0,minRows:3,defaultValue:s,...y.formRegister(t,{validate:(e,r)=>o&&e.length<=0?"Este campo é obrigatório":e.length>f?`Limite máximo de ${f} caracteres`:e.length<m&&o?`Limite mínimo de ${m} caracteres`:void 0}),error:v,helperText:x,FormHelperTextProps:{sx:{backgroundColor:v?"#FFEBEE":"transparent",borderRadius:"8px",padding:v?"8px 12px":0,marginBottom:v?"4px":0,marginTop:v?"8px":0,border:v?"1px solid #FFCDD2":"none",color:"error.main",marginLeft:0,marginRight:0}},sx:{bgcolor:"white","& .MuiOutlinedInput-root":{borderRadius:"8px","& fieldset":{borderColor:"#E0E0E0"},"&:hover fieldset":{borderColor:"#BDBDBD"},"&.Mui-focused fieldset":{borderColor:"primary.main",borderWidth:"2px"},"&.Mui-error .MuiOutlinedInput-notchedOutline":{borderWidth:"2px"}}},placeholder:l||a})]})}function _o({name:t,required:a=!1,xs:l=12,sm:d,md:u}){const m=J(dr),f=`switch-${t}`;ee(()=>{m.formWatch(f)||m.formSetValue(t,void 0)},[m]);const h=s(),g=m.formWatch(f);return r(n,{item:!0,xs:l,sm:d,md:u,children:e(i,{onClick:()=>{m.formSetValue(f,!g)},sx:{border:"1px solid",borderColor:g?h.palette.primary.main:"#E0E0E0",borderRadius:"8px",padding:"8px 16px",cursor:"pointer",backgroundColor:g?`${h.palette.primary.main}10`:"white",transition:"all 0.2s",display:"flex",alignItems:"center",mb:.5,"&:hover":{borderColor:g?void 0:h.palette.grey[400],backgroundColor:g?void 0:h.palette.grey[50]}},children:[r(c,{checked:!!g,size:"small",sx:{padding:0,mr:1.5,"&.Mui-checked":{color:h.palette.primary.main}}}),r(i,{sx:{flexGrow:1},onClick:e=>e.stopPropagation(),children:g?r(p,{size:"small",fullWidth:!0,...m.formRegister(t,{validate:(e,r)=>{if(!0===m.formWatch(f)&&(!e||e.length<=0&&a))return"Este campo não pode ser vazio"}}),required:a,error:!!ne(m.errors,t),helperText:ne(m.errors,t)?.message,placeholder:"Outro",sx:{"& .MuiOutlinedInput-root":{backgroundColor:"white"}}}):r(o,{color:"text.primary",children:"Outro"})})]})})}const qo=(e,r)=>{if(!e||Object.keys(e).length<=0)return[];if(!e[r])return[];let t=Object.keys(e[r]).map(e=>`${r}.${e}`);return e.files&&(t=[...t,...Object.keys(e.files).map(e=>`files.${e}`)]),t};function Uo({debugLog:t=!1,test:n=!1,testConfig:o={},customMarginBottom:c=10,...d}){d.children=Array.isArray(d.children)?d.children.filter((e,r)=>e):d.children;const u=Array.isArray(d.children)?d.children.length:1,p=J(dr),m=te(null),h=s(),[g,y]=Z(0),b=(Array.isArray(d.children)?d.children:[d.children]).map((e,r)=>/*#__PURE__*/H.cloneElement(e,{...e.props,prefix:r})),x=u;return e(i,{children:[n&&r(a,{direction:"row",justifyContent:"end",children:r(l,{variant:"contained",color:"error",onClick:()=>{Object.keys(o).forEach((e,r)=>{const t=o[Number(e)];Object.keys(t).forEach(r=>{p.formUnregister(`${e}.${r}`),p.formSetValue(`${e}.${r}`,t[r])}),r<Object.keys(o).length-1&&new Promise(e=>setTimeout(e,100)).then(()=>{m.current?.click()})})},children:"EXCLUIR BANCO PRODUÇÃO"})}),e(a,{sx:{padding:2,marginBottom:c},children:[r(i,{children:b.map((e,t)=>r(i,{hidden:!(g===t),children:b[t]},"formsB"+t))}),r(w,{variant:"text",steps:x,position:f(h.breakpoints.only("xs"))?"bottom":"static",activeStep:g,sx:{paddingTop:2,paddingBottom:4,paddingX:0},backButton:r(l,{variant:"contained",startIcon:r(Se,{}),onClick:()=>{y(e=>e-1)},disabled:0===g,sx:{textTransform:"none"},children:"Voltar"}),nextButton:g<x-1?r(l,{variant:"contained",endIcon:r(De,{}),onClick:function(){try{return t&&console.log(p.formGetValues()),Promise.resolve(p.formTrigger(qo(p.formGetValues(),g))).then(function(e){e?y(e=>e+1):Me("Formulário incompleto! Verifique os campos marcados e tente novamente.",{type:"warning",theme:"light"})})}catch(e){return Promise.reject(e)}},sx:{textTransform:"none"},ref:m,children:"Próximo"}):r(i,{children:r(Ye,{variant:"contained",type:"submit",loading:p.submiting,loadingPosition:"start",startIcon:r(Ie,{}),onClick:e=>function(e){try{return Promise.resolve(p.formTrigger(qo(p.formGetValues(),g))).then(function(r){r||(e.preventDefault(),Me("Formulário incompleto! Verifique os campos marcados e tente novamente.",{type:"warning",theme:"light"}))})}catch(e){return Promise.reject(e)}}(e),sx:{textTransform:"none",backgroundColor:"#22C55E","&:hover":{backgroundColor:"#48cf7a"}},children:r("span",{children:"Salvar"})})})})]})]})}var Ko=/*#__PURE__*/H.memo(Uo);function Xo(e,r,t){if(!e.props)return e;const n=e.props.children;if(!n)/*#__PURE__*/return H.cloneElement(e,{...e.props,name:`${r}.${e.props.name}`,key:e.props.name?`${r}.${e.props.name}`:`noListing-${t}-${r}-${e.props.name}`});let o;if(Array.isArray(n)){let e=[];n.forEach((n,o)=>{e.push(Xo(n,r,t+(o+1)))}),o=e}else o=Xo(n,r,t+1);/*#__PURE__*/return H.cloneElement(e,{...e.props,children:o,name:`${r}.${e.props.name}`,key:e.props.name?`${r}.${e.props.name}`:`noListing-${t}-${r}-${e.props.name}`})}function Ho({optional:o=!1,title:l,prefix:s=0,optionalMessage:c,defaultChecked:d,...u}){const p=J(dr),m=`switch-${s}`,f=(Array.isArray(u.children)?u.children:[u.children]).map((e,r)=>e&&Xo(e,s,r));return e(i,{children:[r(n,{item:!0,xs:12,children:e(a,{direction:"row",justifyContent:"space-between",children:[e(a,{direction:"row",spacing:2,children:[r(i,{sx:{marginTop:.6},children:r(a,{sx:{backgroundColor:"#E6F8EB",borderRadius:"100%",height:"35px",width:"35px"},justifyContent:"center",alignItems:"center",children:r(Te,{sx:{height:"18px",fill:"#01BA35"}})})}),r(Ae,{variant:"h6",fontWeight:600,fontSize:28,fontFamily:"Inter",sx:{color:"#1E293B",paddingBottom:4},children:l})]}),r(i,{hidden:!o,children:r(bo,{name:m,defaultChecked:!o||d,overrideNo:u.overrideSwitchNo,overrideYes:u.overrideSwitchYes})})]})}),r(a,{spacing:2,children:o?p.formWatch(m)?r(n,{container:!0,spacing:1,children:f}):r(a,{justifyContent:"center",alignItems:"center",children:r(Ae,{fontFamily:"Inter",fontSize:22,paddingY:8,textAlign:"center",children:c||e(t,{children:[r("b",{children:l})," é opcional. ",r("br",{}),"Marque a opção acima caso haja necessidade."]})})}):r(n,{container:!0,spacing:1,children:f})})]})}var Go=/*#__PURE__*/H.memo(Ho);let Jo={open:()=>{},close:()=>{},openReparented:()=>{},reparent:()=>r(t,{})};function Qo(){const[n,l]=Z(!1),[c,d]=Z(null),u=()=>l(!1);te(null);const p=s(),m=f(p.breakpoints.up("sm")),[h,g]=Z({}),[y,b]=Z(-1321465654);return ee(()=>{Jo.open=e=>{e&&d(e),b(-1321465654),l(!0)},Jo.reparent=(e,n)=>(g(o=>({...o,[n]:r(t,{children:e})})),r(t,{})),Jo.openReparented=e=>{b(e),d(null),l(!0)},Jo.close=u},[l]),r(t,{children:m?r(E,{open:n,onClose:u,children:e(i,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",borderRadius:2,bgcolor:"white",border:"1px solid #454545",boxShadow:24},children:[r(i,{onClick:u,width:"fit-content",height:"fit-content",position:"absolute",right:0,top:0,margin:.6,sx:{":hover":{transform:"scale(1.03)",transition:"all 500ms",cursor:"pointer"}},children:r(Be,{sx:{transform:"scale(.9)"}})}),e(i,{overflow:"auto",maxHeight:"90vh",p:2,marginTop:4,borderTop:"solid 1px gray",bgcolor:"#F9F9F9",borderRadius:2,children:[c,h[y]]})]})}):e(k,{anchor:"bottom",open:n,onClose:u,onOpen:()=>{},PaperProps:{sx:{bgcolor:"transparent"}},children:[r(a,{direction:"row",onClick:u,maxHeight:"8vh",height:"8vh",justifyContent:"center",alignItems:"center",children:r(o,{fontWeight:600,color:"white",children:"Clique fora para fechar"})}),e(i,{p:2,maxHeight:"92vh",bgcolor:"white",overflow:"auto",children:[c,h[y]]})]})})}function Zo({customColor:e="#383838",customFontColor:t="white",...n}){const o=Le(e);return r(l,{...n,sx:{bgcolor:o.toHexString(),color:Le(t).toHexString(),":hover":{bgcolor:o.darken(10).toHexString()},boxShadow:"none",borderRadius:3,textTransform:"capitalize",paddingX:2},size:"small",children:n.children})}function ei({data:n=[],...o}){const[i,a]=H.useState(null),l=Boolean(i),s=()=>{a(null)};return e(t,{children:[r(Zo,{...o.btProps,onClick:e=>{a(e.currentTarget)},children:o.children}),r(S,{id:"basic-menu",anchorEl:i,open:l,onClose:s,MenuListProps:{"aria-labelledby":"basic-button"},children:n.map(e=>r(D,{onClick:r=>{e.onClick&&e.onClick(),s()},children:e.name}))})]})}function ri(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]/g,"")}function ti(e){return("string"!=typeof e?e.toString():e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}let ni=[],oi=!1,ii="",ai=!1,li={},si="";function ci({mediaQueryLG:n,columns:o,emptyMsg:c={user:"Nenhum dado encontrado",public:"Nenhum dado encontrado"},dataPath:d="",tableName:u="Dados",csv:p,columnSize:m,action:g,useKC:b=!0,statusKeyName:x="",csvExcludeKeys:v=[],csvExcludeKeysCSV:C=[],csvExcludeKeysAll:w=[],csvCustomKeyNames:k={},csvExcludeValidate:E=(e,r)=>!1,csvButtonTitle:S="Salvar .CSV",csvNoZipText:D="Salvar .CSV",csvAllButtonTitle:T="Salvar todos em CSV",removeQuotes:A=!1,normalize:R=!1,csvShowAllButton:F=!1,csvWithoutZip:V=!1,itemCount:P=10,csvUpper:$=!1,csvZipFileNamesKey:j="",generateCsvZip:N=!1,hideTitleCSV:U=!1,csvExcludeUpper:X=[],multipleDataPath:H="",expandTextMaxLength:G=50,collapsedSize:re=53,customMargin:oe=4,customMarginMobile:ie=0,filtersFunc:ae,filters:le=[],orderBy:ce=[],customErrorMsg:de,customTableStyle:ue={},id:pe,initialData:me=null,isLoading:fe,alwaysExpanded:he=!1}){const[ge,ye]=Z(null),[be,xe]=Z(me),{user:ve,userLoaded:Ce}=J(sr),[we,ke]=Z([]),[Ee,Se]=Z([]),[De,Ie]=Z(P),[Ye,Me]=Z(0),[Oe,Te]=Z(1),[Be,Le]=Z(1);Z("");const[We,_e]=Z({}),[qe,Ue]=Z({}),[Ke,Xe]=Z({}),[He,Ge]=Z("filterKey"),Je=s(),Qe=f(Je.breakpoints.only("xs")),Ze=te(null),er=f(Je.breakpoints.up(2e3));ii=`tableFilter_${pe}`,si=`tableFilterCache_${pe}`,li=ae??{},localStorage.getItem(si)||localStorage.setItem(si,JSON.stringify(le)),localStorage.getItem(si)!==JSON.stringify(le)&&(localStorage.setItem(si,JSON.stringify(le)),localStorage.removeItem(ii));const rr=Q(e=>{if(e.length<=0)return 1;let r=e.length/De;return r=r<1?1:r,Math.ceil(r)},[De]),tr=Q(e=>Array.isArray(e)?e:"object"==typeof e?ne(e,d):void 0,[]);ee(()=>{if(ge||!tr(be))return;const e=tr(be);ke(e),Se(e),Te(rr(e)),localStorage.getItem(ii)&&dr(JSON.parse(localStorage.getItem(ii)))},[De,be,rr,ge]),ee(()=>{Me(Be-1)},[Be]);const nr=Q((e,r)=>{Le(r)},[]),or=Q(()=>{const e=Ye*De;return we.slice(e,e+De)},[we,De,Ye]),ir=Q((e,r=!1)=>{if(e.preventDefault(),we.length<=0)return;const t=Object.keys(we[0]);if(N&&r){const e=t.filter(e=>!v.includes(e)),r=e.map(e=>k[e]?k[e]:e).join(",")+"\n",o=new ze,i={};we.forEach(e=>{i[e[j]]||(i[e[j]]=[]),i[e[j]].push(e)}),Object.keys(i).forEach(n=>{const a=[];i[n].forEach(r=>{let n=!0;if(t.forEach(e=>{E(e,r[e])&&(n=!1)}),n){const t=e.map(e=>{if("string"==typeof r[e]){let t=$?r[e].toUpperCase():r[e];return t=R?t.normalize("NFD").replace(/[\u0300-\u036f]/g,""):t,A?`${t}`:`"${t}"`}if("object"==typeof r[e]&&!Array.isArray(r[e])&&null!==r[e]){let t=ar(r[e]).slice(1,-1),n=$&&!X.includes(e)?t.toUpperCase():t;return n=R?n.normalize("NFD").replace(/[\u0300-\u036f]/g,""):n,A?`${n}`:`"${n}"`}return r[e]}).join(",");a.push(t)}});const l=U?a.join("\n"):"\ufeff"+r+a.join("\n");a.length>0&&o.file(`${n.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}.csv`,l)});var n=window.document.createElement("a");o.generateAsync({type:"base64"}).then(e=>{n.setAttribute("href","data:application/zip;base64,"+e),n.setAttribute("download",`${p?.fileName}.zip`),n.click()})}else{let e=t.filter(e=>!C.includes(e)).map(e=>e===H?"hrTermino":e);""!==H&&(e=["dtInicio","hrInicio",...e]);const r=e.map(e=>k[e]?k[e]:e).join(",")+"\n",o=[];we.forEach(r=>{let n=!0;if(t.forEach(e=>{E(e,r[e])&&(n=!1)}),n){const t=e.map(e=>{if("dtInicio"===e)return"{dtInicio}";if("hrInicio"===e)return"{hrInicio}";if("hrTermino"===e)return"{hrTermino}";if("string"==typeof r[e]){let t=$&&!X.includes(e)?r[e].toUpperCase():r[e];return t=R?t.normalize("NFD").replace(/[\u0300-\u036f]/g,""):t,A?`${t}`:`"${t}"`}if("object"==typeof r[e]&&!Array.isArray(r[e])&&null!==r[e]){let t=ar(r[e]).slice(1,-1),n=$&&!X.includes(e)?t.toUpperCase():t;return n=R?n.normalize("NFD").replace(/[\u0300-\u036f]/g,""):n,A?`${n}`:`"${n}"`}return r[e]}).join(",");if(""!==H){const e=r[H];e&&e.forEach(e=>{o.push(t.replace("{dtInicio}",e.dtInicio).replace("{hrInicio}",e.hrInicio).replace("{hrTermino}",e.hrTermino))})}else o.push(t)}});const i=r+o.join("\n");(n=window.document.createElement("a")).setAttribute("href","data:text/csv;charset=utf-8,%EF%BB%BF"+encodeURI(i)),n.setAttribute("download",`${p?.fileName}.csv`),n.click()}},[we]);function ar(e){let r=[];if("object"==typeof e&&!Array.isArray(e)&&null!==e)for(let[t,n]of Object.entries(e))"object"!=typeof n||Array.isArray(n)||null===n?n&&r.push(t):r.push(t+": "+ar(n));return"["+r.join(" - ")+"]"}const lr=Q(e=>{if(e.preventDefault(),we.length<=0)return;const r=Object.keys(we[0]).filter(e=>!w.includes(e)),t=r.join(",")+"\n",n=we.map(e=>r.map(r=>{if("tbRa"===r)return e[r].NO_CIDADE;if("rlEventoData"===r)return`${e[r][0].DT_INICIO} - ${e[r][0].HR_INICIO}`;if("string"==typeof e[r]){let t=$&&!X.includes(r)?e[r].toUpperCase():e[r];return t=R?t.normalize("NFD").replace(/[\u0300-\u036f]/g,""):t,A?`${t}`:`"${t}"`}if("object"==typeof e[r]&&!Array.isArray(e[r])&&null!==e[r]){let t=ar(e[r]).slice(1,-1),n=$&&!X.includes(r)?t.toUpperCase():t;return n=R?n.normalize("NFD").replace(/[\u0300-\u036f]/g,""):n,A?`${n}`:`"${n}"`}return e[r]}).join(",")).join("\n"),o=t+n;var i=window.document.createElement("a");i.setAttribute("href","data:text/csv;charset=utf-8,%EF%BB%BF"+encodeURI(o)),i.setAttribute("download",`${p?.fileName}.csv`),i.click()},[we]);function cr(){ke(ni),Se(ni),Te(rr(ni)),Me(0),Le(1),localStorage.removeItem(ii),Ge((new Date).getTime().toString())}function dr(e){if(!ni)return;let r=JSON.parse(JSON.stringify(ni));e.filter(e=>e.value||"entre"===e.operator&&(e.value||e.value2)).forEach(e=>{let t=[];switch(e.type){case"number":switch(e.operator){case"igual":r.forEach(r=>{Number(ne(r,e.keyName,""))===Number(e.value)&&t.push(r)});break;case"maior que":r.forEach(r=>{Number(ne(r,e.keyName,""))>Number(e.value)&&t.push(r)});break;case"menor que":r.forEach(r=>{Number(ne(r,e.keyName,""))<Number(e.value)&&t.push(r)})}break;case"string":switch(console.log("ata: ",e.operator),e.operator){case"igual":r.forEach(r=>{const n=ne(r,e.keyName,"");e.useList?ti(n)===ti(e.value.id)&&t.push(r):ti(n)===ti(e.value)&&t.push(r)});break;case"contem":r.forEach(r=>{const n=ne(r,e.keyName,"");n&&(e.useList?ti(n).includes(ti(e.value.id))&&t.push(r):ti(n).includes(ti(e.value))&&t.push(r))});break;case"tem um dos":r.forEach(r=>{const n=ne(r,e.keyName,"");n&&e.value.map(e=>ti(e.id)).includes(ti(n))&&t.push(r)})}break;case"date":switch(e.operator){case"data exata":r.forEach(r=>{const n=se(ne(r,e.keyName,""),"DD/MM/YYYY");n.isValid()&&n.isSame(se(e.value,"DD/MM/YYYY"))&&t.push(r)});break;case"entre":const n=se(e.value?e.value:"01/01/2000","DD/MM/YYYY"),o=se(e.value2?e.value2:"31/12/2030","DD/MM/YYYY");r.forEach(r=>{const i=se(ne(r,e.keyName,""),"DD/MM/YYYY");(i.isAfter(n)||i.isSame(n))&&(i.isBefore(o)||i.isSame(o))&&t.push(r)})}break;case"dates":switch(e.operator){case"data inicio":r.forEach(r=>{const n=li[e.customFunc](ne(r,e.keyName,""))??[];n.length<=0||se(n[0],"DD/MM/YYYY").isSame(se(e.value,"DD/MM/YYYY"))&&t.push(r)});break;case"data fim":r.forEach(r=>{const n=li[e.customFunc](ne(r,e.keyName,""))??[];n.length<=0||se(n[n.length-1],"DD/MM/YYYY").isSame(se(e.value,"DD/MM/YYYY"))&&t.push(r)});break;case"tem a data":r.forEach(r=>{(li[e.customFunc](ne(r,e.keyName,""))??[]).includes(e.value)&&t.push(r)});break;case"entre":const n=se(e.value?e.value:"01/01/2000","DD/MM/YYYY"),o=se(e.value2?e.value2:"31/12/2030","DD/MM/YYYY");r.forEach(r=>{const i=li[e.customFunc](ne(r,e.keyName,""))??[];let a=!1;i.forEach(e=>{if(a)return;const r=se(e,"DD/MM/YYYY");r.isValid()&&(r.isAfter(n)||r.isSame(n))&&(r.isBefore(o)||r.isSame(o))&&(a=!0)}),a&&t.push(r)})}}r=t}),ke(r),Te(rr(r)),Me(0),Le(1),localStorage.setItem(ii,JSON.stringify(e)),Se(r)}return ee(()=>{const e=Ye*De,r=we.slice(e,e+De);let t={};r.forEach((e,r)=>{o.forEach(n=>{t[r]=!0===t[r]||(ne(e,n?.keyName,"")??"Não Informado").toString().length>=G})}),Ue(t)},[we,De,Ye]),ee(()=>{console.log(Ze.current)},[Ze.current]),ge?r(i,{bgcolor:"#fff2c8",color:"#3e3129",padding:2,marginX:2,borderRadius:4,children:e(Ae,{fontSize:24,textAlign:"center",fontFamily:"Inter",children:[403===ge.status&&"Acesso negado",500===ge.status&&e(i,{fontWeight:500,textAlign:"center",children:[r(z,{sx:{transform:"scale(2)",marginY:1,fill:"#3e3129"}}),r(i,{children:de||e(t,{children:["Não foi possível se conectar ao servidor no momento. Por favor, aguarde alguns instantes e tente de novo.",r("br",{}),r("br",{}),"Caso precise de ajuda, entre em contato pelo email: ",r("strong",{children:"cdes@ssp.df.gov.br"})]})})]})]})}):fe?r(a,{sx:{height:"100%",width:"100%"},justifyContent:"center",alignItems:"center",children:e(i,{width:"100%",children:[e(a,{direction:"row",justifyContent:"center",alignItems:"center",justifyItems:"center",spacing:2,marginY:4,children:[r(B,{sx:{fill:"#5e5e5e"}}),e(Ae,{fontWeight:600,fontSize:20,textTransform:"capitalize",textAlign:"center",color:"#5e5e5e",children:["Carregando ",u]})]}),r(h,{color:"inherit"}),Array(10).fill("").map(t=>r(a,{direction:{xs:"column",md:"row"},spacing:{xs:3,md:1},justifyContent:"space-between",paddingY:8,borderBottom:"1px solid #cacaca",children:Array(7).fill(0).map(t=>e(i,{children:[r(I,{width:60}),r(I,{width:120})]}))}))]})}):!Ce&&b?r(h,{}):e(t,{children:[e(i,{marginX:Qe?ie:oe,bgcolor:"white",p:2,borderRadius:6,...ue,children:[e(a,{spacing:1.5,direction:{xs:"column",md:"row"},children:[e(a,{spacing:1.5,direction:{xs:"column",md:"row"},height:{md:"40px",xs:"inherit"},width:"100%",children:[r(Ne,{InputProps:{startAdornment:r(Pe,{sx:{marginRight:1,fill:"#c0c0c0"}}),sx:{".MuiOutlinedInput-notchedOutline":{border:"none"}}},sx:{border:"solid 1px #CBD5E1",backgroundColor:"#F8FAFC",borderRadius:"50px",maxWidth:"600px"},size:"small",onChange:function(e){console.log(Ee);const r=e.target.value;if(""===r)return ke(Ee),void Te(rr(tr(we)));const t=tr(we),n=[];t.forEach(e=>{const t=[];if(Object.keys(e).map(r=>{let n=ne(e,r,"")??"";"number"==typeof n&&(n=n.toString()),"string"==typeof n&&t.push(n)}),t.length<=0)return;let o=!1;t.forEach(e=>{if(["P","C","A","R","L","PA"].includes(e))switch(e){case"P":return void("em analise".includes(r.toLowerCase())&&(o=!0));case"C":return void("cancelado".includes(r.toLowerCase())&&(o=!0));case"A":return void("cadastrado".includes(r.toLowerCase())&&(o=!0));case"R":return void("reprovado".includes(r.toLowerCase())&&(o=!0));case"L":return void("licenciado".includes(r.toLowerCase())&&(o=!0));case"PA":return void(("pré aprovado".includes(r.toLowerCase())||"pre aprovado".includes(r.toLowerCase()))&&(o=!0));case"FP":return void("fora do prazo".includes(r.toLowerCase())&&(o=!0))}ri(e.toLowerCase()).includes(ri(r.toLowerCase()))&&(o=!0)}),o&&n.push(e)}),ke(n),Te(rr(n)),Me(0),Le(1)},fullWidth:!0,placeholder:`Pesquisar ${u}`}),le.length>0&&r(l,{startIcon:r(L,{}),variant:"contained",onClick:e=>Jo.open(r(di,{reset:cr,filtrar:dr,baseFilters:[...le],filters:localStorage.getItem(ii)?JSON.parse(localStorage.getItem(ii)):[...le]},He)),sx:{borderRadius:3,paddingX:"24px",paddingY:"8px",backgroundColor:"#208FE8",textTransform:"capitalize"},children:r(a,{direction:"row",borderRadius:5,padding:0,children:r("span",{children:"Filtrar"})})}),e(a,{direction:"row",spacing:1,children:[r(ei,{data:ce.map(e=>({name:e.label,onClick:()=>function(e){let r=[...we];r.sort((r,t)=>{const n="string"===e.type?ne(r,e.key,""):Number(ne(r,e.key,0)),o="string"===e.type?ne(t,e.key,""):Number(ne(t,e.key,0));if(ai){if(n<o)return-1;if(n>o)return 1}else{if(n>o)return-1;if(n<o)return 1}return 0}),ai=!ai,ke(r)}(e)})),btProps:{startIcon:r(W,{}),fullWidth:!0},children:"Ordenar"}),r(l,{variant:"contained",fullWidth:!0,startIcon:r(oi?K:W,{}),sx:{backgroundColor:"#637082",":hover":{backgroundColor:"#3c4757"},textTransform:"capitalize",borderRadius:3,padding:{md:"0px 8px"}},onClick:function(){let e={};for(let r=0;r<P;r++)e[r]=!oi;Xe(e),_e(e),oi=!oi},children:oi?"Recolher":"Expandir"})]})]}),e(a,{alignItems:"end",width:{xs:"100%",md:"20%"},direction:{xs:"row",md:"column"},spacing:{xs:1,md:0},children:[e(Ae,{fontWeight:600,textAlign:"end",children:["Registro de ",u,"s"]}),r(a,{justifyContent:"center",children:e(Ae,{children:["Exibindo ",Ye*De+1,"-",Ye*De+1+or().length-1," de ",we.length]})})]})]}),localStorage.getItem(ii)&&r(i,{display:"inline-flex",flexWrap:"wrap",padding:.5,borderRadius:4,marginBottom:1,children:JSON.parse(localStorage.getItem(ii)??"[]").filter(e=>e.value||"entre"===e.operator&&(e.value||e.value2)).map(t=>e(a,{direction:"row",spacing:1,bgcolor:"#4e85c1",color:"white",width:"fit-content",paddingY:.5,borderRadius:2,paddingX:1,m:.5,children:[r(Ae,{fontWeight:700,children:t.label}),r(Ae,{fontStyle:"italic",children:t.operator}),r(Ae,{bgcolor:"white",borderRadius:2,paddingX:1,color:"black",children:Array.isArray(t.value)?t.value.map(e=>e.label).join(" - "):"object"==typeof t.value?t.value.label:"entre"===t.operator?`${t.value?t.value:"Antes"} e ${t.value2?t.value2:"Depois"}`:t.value.toString()}),r(Y,{onClick:e=>{let r=JSON.parse(localStorage.getItem(ii)??"[]");r=r.map(e=>e.label===t.label?{...e,value:"",...e.value2?{value2:""}:{}}:e),dr(r)},size:"small",sx:{padding:0},children:r(Re,{sx:{fill:"white"}})})]}))}),r(a,{spacing:.2,children:or().length<=0?r(a,{sx:{backgroundColor:"#E2E8F0",padding:2,marginX:{xs:2,md:0}},justifyContent:"center",alignItems:"center",children:r(Ae,{fontSize:21,fontFamily:"Inter",fontWeight:600,textAlign:"center",children:ve?c.user:c.public})}):or().map((s,c)=>r(y,{sx:{padding:.5,backgroundColor:c%2==0?"#F8FAFC":"white",paddingTop:2,paddingBottom:he?2:.5,borderTop:"solid 1.5px #E2E8F0",position:"relative"},elevation:0,children:e($e,{container:!0,spacing:Qe?2:0,paddingX:2,rowSpacing:2,children:[o.map(o=>e($e,{item:!0,xs:12,md:er?12/m*(o.size?o.size:1):n?n.all:12/m*(o.size?o.size:1),sx:{overflow:"hidden"},children:[r(i,{sx:{width:"max-content",paddingX:1},children:r(Ae,{fontSize:16,fontWeight:700,color:"#1E293B",fontFamily:"Inter",children:o.title})}),r(i,{paddingLeft:1,position:"relative",children:r(M,{in:he||!0===We[c],collapsedSize:he?"auto":re,onExited:e=>Xe(e=>({...e,[c]:!1})),children:r(i,{sx:{wordWrap:"break-word",color:"#1E293B",fontSize:16},fontFamily:"Inter",children:o.customComponent?o.customComponent(ne(s,o.keyName),s):e(t,{children:[r(i,{color:"transparent",sx:{pointerEvents:"none",userSelect:"none"},children:ne(s,o.keyName,"")}),r(i,{position:"absolute",top:0,children:he||Ke[c]?ne(s,o?.keyName,""):(ne(s,o?.keyName,"")??"").toString().length>=G?r(t,{children:(ne(s,o?.keyName,"")??"").toString().substring(0,G)+"..."}):ne(s,o?.keyName,"")})]})})})})]},String(o?.keyName)+c)),r($e,{item:!0,xs:12,md:er?12/m:n?n.action:12/m,children:r(a,{direction:"row",alignItems:"center",justifyContent:Qe?"start":"flex-end",sx:{height:"100%",paddingBottom:Qe?2:0},children:g(s)})}),qe[c]&&!he&&r(a,{direction:"row",justifyContent:"flex-end",bottom:0,width:"100%",children:r(l,{onClick:e=>{_e(e=>({...e,[c]:!e[c]})),Xe(e=>({...e,[c]:!0}))},sx:{padding:0,color:"#637082",textTransform:"capitalize"},startIcon:r(We[c]?_:q,{}),children:We[c]?"Ver Menos":"Ver Mais"})})]})},c))}),or().length>0&&r(a,{padding:1,direction:{xs:"column",md:"row"},spacing:{xs:2,md:0},justifyContent:"space-between",alignItems:"center",children:p&&e(a,{direction:{xs:"column",md:"row"},justifyContent:"flex-end",spacing:1,children:[V&&r(l,{startIcon:r(Fe,{}),variant:"contained",size:"small",onClick:ir,sx:{backgroundColor:"#5a88b0",marginRight:{xs:2,md:0},width:{xs:"100%",md:"fit-content"}},children:D}),F&&r(l,{startIcon:r(Fe,{}),variant:"contained",size:"small",onClick:lr,sx:{backgroundColor:"#64748B",marginRight:{xs:2,md:0},width:{xs:"100%",md:"fit-content"}},children:T}),r(l,{startIcon:r(Fe,{}),variant:"contained",size:"small",onClick:e=>ir(e,!0),sx:{backgroundColor:"#22C55E",marginRight:{xs:2,md:0},width:{xs:"100%",md:"fit-content"}},children:S})]})})]}),r(a,{direction:"row",justifyContent:"center",paddingY:1,paddingTop:2,children:e(a,{direction:"row",justifyContent:"center",alignItems:"center",spacing:2,children:[r(l,{onClick:e=>Le(e=>e>1?e-1:1),sx:{bgcolor:"white",borderRadius:"50px",height:"40px",width:"40px",minWidth:0,border:"solid 1px #E2E8F0"},children:r(Ve,{sx:{transform:"scale(1.5) scaleX(-1)"}})}),r(je,{renderItem:e=>"page"===e.type?r(l,{onClick:e.onClick,sx:{fontWeight:600,...e.selected?{bgcolor:"#33B55D",color:"white"}:{color:"#1E293B"},borderRadius:"100%",padding:0,margin:0,minWidth:0,width:"40px",height:"40px",marginX:.25},children:e.page}):["next","previous","page"].includes(e.type)?void 0:r(O,{...e}),count:Oe,siblingCount:Qe?0:6,size:"large",onChange:nr,page:Be,shape:"circular",variant:"outlined",sx:{".MuiPagination-ul":{backgroundColor:"white",border:"solid 1px #E2E8F0",borderRadius:"50px",paddingX:.25,paddingY:.5}}}),r(l,{onClick:e=>Le(e=>e<Oe?e+1:Oe),sx:{bgcolor:"white",borderRadius:"50px",height:"40px",width:"40px",minWidth:0,border:"solid 1px #E2E8F0"},children:r(Ve,{sx:{transform:"scale(1.5)"}})})]})})]})}function di({filters:t,baseFilters:n,filtrar:o,reset:s}){const[c,d]=Z(t),[u,p]=Z(!1),[m,f]=H.useState(null),h=Boolean(m);return e(i,{width:{xs:"inherit",md:850},children:[r(S,{open:h,onClose:()=>{f(null)},anchorEl:m,children:n.map(e=>r(D,{onClick:r=>{var t;t=e,d(e=>[...e,t]),f(null)},children:e.label}))}),e(a,{direction:"row",justifyContent:"space-between",children:[r(Ae,{fontWeight:700,fontSize:18,children:"Filtrar"}),r(l,{startIcon:r(U,{}),sx:{textTransform:"capitalize"},onClick:e=>{s(),Jo.close()},children:"Limpar"})]}),r(i,{marginBottom:1,children:r(T,{severity:"warning",children:"Preencha apenas os campos que deseja filtrar."})}),r(a,{children:u?c.map((e,t)=>r(ui,{filterValue:e,setReset:p,idx:t,setDt:e=>{d(r=>{let n=[...r];return n[t]=e,n})},removeDt:()=>{d(e=>{let r=[...e];return r.splice(t,1),r})}})):r(i,{children:c.map((e,t)=>r(ui,{filterValue:e,setReset:p,idx:t,setDt:e=>{d(r=>{let n=[...r];return n[t]=e,n})},removeDt:()=>{d(e=>{let r=[...e];return r.splice(t,1),r})}}))})}),r(a,{direction:"row",justifyContent:"flex-end",marginTop:1,children:r(l,{variant:"contained",color:"success",startIcon:r(Pe,{}),sx:{textTransform:"capitalize"},onClick:e=>{o(c),Jo.close()},children:"Filtrar"})})]})}function ui({filterValue:t,setDt:n,idx:o}){const[i,l]=Z(t.operator),[c,d]=Z(t),u=s(),p=f(u.breakpoints.only("xs"));return ee(()=>{n(c)},[c]),e(a,{direction:"row",alignItems:"end",spacing:1,width:"100%",bgcolor:o%2==0?"#ededed":"inherit",padding:.5,borderRadius:2,children:[!p&&r(Ae,{width:"100%",alignContent:"center",fontWeight:600,color:"#323232",children:t.label}),e(A,{sx:{width:"100%"},children:[p&&r(Ae,{children:t.label}),r(R,{onChange:e=>{const r=e.target.value;d(e=>({...e,operator:r,value:""})),l(r)},defaultValue:i,size:"small",sx:{bgcolor:"white"},fullWidth:!0,children:t.operators.map(e=>r(D,{value:e,children:e}))})]}),r(pi,{filterValue:t,operator:c.operator,onChange:(e,r="value")=>{d(t=>({...t,[r]:e}))}})]})}function pi({filterValue:n,operator:o,onChange:a}){switch(n.type){case"number":return r(Ne,{type:"number",size:"small",placeholder:"Valor",defaultValue:n.value,onChange:e=>{a(e.target.value)},sx:{bgcolor:"white"},fullWidth:!0});case"string":if(n.useList)switch(o){case"tem um dos":return r(C,{multiple:!0,id:"tags-standard",onChange:(e,r)=>{a(r.length<=0?"":r)},options:n.useList,defaultValue:Array.isArray(n.value)?n.value:[],renderInput:e=>r(Ne,{...e,variant:"standard",placeholder:"Escolha os valores",fullWidth:!0}),fullWidth:!0});case"contem":case"igual":return r(i,{width:"100%",children:r(C,{options:n.useList,onChange:(e,r)=>{a(r)},defaultValue:"object"==typeof n.value?n.value:void 0,isOptionEqualToValue:(e,r)=>e.label===r.label,renderInput:e=>r(Ne,{...e,size:"small",placeholder:"Escolha um valor",fullWidth:!0,sx:{bgcolor:"white"}}),fullWidth:!0})})}return r(Ne,{size:"small",placeholder:"Valor",defaultValue:n.value,onChange:e=>{a(e.target.value)},sx:{bgcolor:"white"},fullWidth:!0});case"date":case"dates":switch(o){case"data exata":case"data fim":case"data inicio":case"tem a data":return r(oe,{adapterLocale:"pt-br",dateAdapter:le,children:r(ie,{format:"DD/MM/YYYY",onChange:e=>{a(e.isValid()?e.format("DD/MM/YYYY"):"")},defaultValue:n.value?se(n.value,"DD/MM/YYYY"):void 0,sx:{div:{input:{paddingX:2,paddingY:1.05}},width:"100%",bgcolor:"white"},inputRef:e=>r(Ne,{...e,size:"small",fullWidth:!0})})});case"entre":return e(oe,{adapterLocale:"pt-br",dateAdapter:le,children:[r(ie,{format:"DD/MM/YYYY",onChange:e=>{a(e.isValid()?e.format("DD/MM/YYYY"):"")},defaultValue:n.value?se(n.value,"DD/MM/YYYY"):void 0,sx:{div:{input:{paddingX:2,paddingY:1.05}},width:"100%",bgcolor:"white"},inputRef:e=>r(Ne,{...e,size:"small",fullWidth:!0})}),r(ie,{format:"DD/MM/YYYY",onChange:e=>{a(e.isValid()?e.format("DD/MM/YYYY"):"","value2")},defaultValue:n.value2?se(n.value2,"DD/MM/YYYY"):void 0,sx:{div:{input:{paddingX:2,paddingY:1.05}},width:"100%",bgcolor:"white"},inputRef:e=>r(Ne,{...e,size:"small",fullWidth:!0})})]})}}return r(t,{})}var mi=/*#__PURE__*/H.memo(ci);function fi({customErrorMsg:n,error:a}){return r(i,{bgcolor:"#fff2c8",color:"#3e3129",padding:2,marginX:2,borderRadius:4,children:e(o,{fontSize:24,textAlign:"center",fontFamily:"Inter",children:[403===a.status&&"Acesso negado",500===a.status&&e(i,{fontWeight:500,textAlign:"center",children:[r(z,{sx:{transform:"scale(2)",marginY:1,fill:"#3e3129"}}),r(i,{children:n||e(t,{children:["Não foi possível se conectar ao servidor no momento. Por favor, aguarde alguns instantes e tente de novo.",r("br",{}),r("br",{}),"Caso precise de ajuda, entre em contato pelo email: ",r("strong",{children:"cdes@ssp.df.gov.br"})]})})]})]})})}function hi({tableName:t}){return r(a,{sx:{height:"100%",width:"100%"},justifyContent:"center",alignItems:"center",children:e(i,{width:"100%",children:[e(a,{direction:"row",justifyContent:"center",alignItems:"center",justifyItems:"center",spacing:2,marginY:4,children:[r(B,{sx:{fill:"#5e5e5e"}}),e(Ae,{fontWeight:600,fontSize:20,textTransform:"capitalize",textAlign:"center",color:"#5e5e5e",children:["Carregando ",t]})]}),r(h,{color:"inherit"}),Array(10).fill("").map(t=>r(a,{direction:{xs:"column",md:"row"},spacing:{xs:3,md:1},justifyContent:"space-between",paddingY:8,borderBottom:"1px solid #cacaca",children:Array(7).fill(0).map(t=>e(i,{children:[r(I,{width:60}),r(I,{width:120})]}))}))]})})}const gi=(e,r)=>{if(e.length<=0)return 1;let t=e.length/r;return t=t<1?1:t,Math.ceil(t)};function yi(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]/g,"")}function bi(e){return("string"!=typeof e?e.toString():e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function xi({filterData:e,startData:r,filtersFuncData:t={},localTableName:n="",setCurrentPage:o,setList:i,setListClone:a,setListPage:l,setPagCount:s,itemsCount:c}){if(!r)return;let d=JSON.parse(JSON.stringify(r));e.filter(e=>e.value||"entre"===e.operator&&(e.value||e.value2)).forEach(e=>{let r=[];switch(e.type){case"number":switch(e.operator){case"igual":d.forEach(t=>{Number(ne(t,e.keyName,""))===Number(e.value)&&r.push(t)});break;case"maior que":d.forEach(t=>{Number(ne(t,e.keyName,""))>Number(e.value)&&r.push(t)});break;case"menor que":d.forEach(t=>{Number(ne(t,e.keyName,""))<Number(e.value)&&r.push(t)})}break;case"string":switch(e.operator){case"igual":d.forEach(t=>{const n=ne(t,e.keyName,"");e.useList?bi(n)===bi(e.value.id)&&r.push(t):bi(n)===bi(e.value)&&r.push(t)});break;case"contem":d.forEach(t=>{const n=ne(t,e.keyName,"");n&&(e.useList?bi(n).includes(bi(e.value.id))&&r.push(t):bi(n).includes(bi(e.value))&&r.push(t))});break;case"tem um dos":d.forEach(t=>{const n=ne(t,e.keyName,"");n&&e.value.map(e=>bi(e.id)).includes(bi(n))&&r.push(t)})}break;case"date":switch(e.operator){case"data exata":d.forEach(t=>{const n=se(ne(t,e.keyName,""),"DD/MM/YYYY");n.isValid()&&n.isSame(se(e.value,"DD/MM/YYYY"))&&r.push(t)});break;case"entre":const t=se(e.value?e.value:"01/01/2000","DD/MM/YYYY"),n=se(e.value2?e.value2:"31/12/2030","DD/MM/YYYY");d.forEach(o=>{const i=se(ne(o,e.keyName,""),"DD/MM/YYYY");(i.isAfter(t)||i.isSame(t))&&(i.isBefore(n)||i.isSame(n))&&r.push(o)})}break;case"dates":switch(e.operator){case"data inicio":d.forEach(n=>{const o=(t[e.customFunc](ne(n,e.keyName,""))??[]).filter(e=>void 0!==e&&""!==e);o.length<=0||se(o[0],"DD/MM/YYYY").isSame(se(e.value,"DD/MM/YYYY"))&&r.push(n)});break;case"data fim":d.forEach(n=>{const o=(t[e.customFunc](ne(n,e.keyName,""))??[]).filter(e=>void 0!==e&&""!==e);o.length<=0||(console.log(o),se(o[o.length-1],"DD/MM/YYYY").isSame(se(e.value,"DD/MM/YYYY"))&&r.push(n))});break;case"tem a data":d.forEach(n=>{const o=(t[e.customFunc](ne(n,e.keyName,""))??[]).filter(e=>void 0!==e&&""!==e);o.includes(e.value)&&r.push(n)});break;case"entre":const n=se(e.value?e.value:"01/01/2000","DD/MM/YYYY"),o=se(e.value2?e.value2:"31/12/2030","DD/MM/YYYY");d.forEach(i=>{const a=(t[e.customFunc](ne(i,e.keyName,""))??[]).filter(e=>void 0!==e&&""!==e);let l=!1;a.forEach(e=>{if(l)return;const r=se(e,"DD/MM/YYYY");r.isValid()&&(r.isAfter(n)||r.isSame(n))&&(r.isBefore(o)||r.isSame(o))&&(l=!0)}),l&&r.push(i)})}}d=r}),i(d),s(gi(d,c)),o(0),l(1),localStorage.setItem(n,JSON.stringify(e)),a(d)}function vi({order:e,list:r,orderAsc:t=!1}){const n=We(r).sort((r,n)=>{const o="string"===e.type?ne(r,e.key,""):Number(ne(r,e.key,0)),i="string"===e.type?ne(n,e.key,""):Number(ne(n,e.key,0));if(t){if(o<i)return-1;if(o>i)return 1}else{if(o>i)return-1;if(o<i)return 1}return 0});return n}function Ci({filters:t,baseFilters:n,filtrar:o,reset:s}){const[c,d]=Z(t),[u,p]=Z(!1),[m,f]=H.useState(null),h=Boolean(m);return e(i,{width:{xs:"inherit",md:850},children:[r(S,{open:h,onClose:()=>{f(null)},anchorEl:m,children:n.map(e=>r(D,{onClick:r=>{var t;t=e,d(e=>[...e,t]),f(null)},children:e.label}))}),e(a,{direction:"row",justifyContent:"space-between",children:[r(Ae,{fontWeight:700,fontSize:18,children:"Filtrar"}),r(l,{startIcon:r(U,{}),sx:{textTransform:"capitalize"},onClick:e=>{s(),Jo.close()},children:"Limpar"})]}),r(i,{marginBottom:1,children:r(T,{severity:"warning",children:"Preencha apenas os campos que deseja filtrar."})}),r(a,{children:u?c.map((e,t)=>r(wi,{filterValue:e,setReset:p,idx:t,setDt:e=>{d(r=>{let n=[...r];return n[t]=e,n})},removeDt:()=>{d(e=>{let r=[...e];return r.splice(t,1),r})}})):r(i,{children:c.map((e,t)=>r(wi,{filterValue:e,setReset:p,idx:t,setDt:e=>{d(r=>{let n=[...r];return n[t]=e,n})},removeDt:()=>{d(e=>{let r=[...e];return r.splice(t,1),r})}}))})}),r(a,{direction:"row",justifyContent:"flex-end",marginTop:1,children:r(l,{variant:"contained",color:"success",startIcon:r(Pe,{}),sx:{textTransform:"capitalize"},onClick:e=>{o(c),Jo.close()},children:"Filtrar"})})]})}function wi({filterValue:t,setDt:n,idx:o}){const[i,l]=Z(t.operator),[c,d]=Z(t),u=s(),p=f(u.breakpoints.only("xs"));return ee(()=>{n(c)},[c]),e(a,{direction:"row",alignItems:"end",spacing:1,width:"100%",bgcolor:o%2==0?"#ededed":"inherit",padding:.5,borderRadius:2,children:[!p&&r(Ae,{width:"100%",alignContent:"center",fontWeight:600,color:"#323232",children:t.label}),e(A,{sx:{width:"100%"},children:[p&&r(Ae,{children:t.label}),r(R,{onChange:e=>{const r=e.target.value;d(e=>({...e,operator:r,value:""})),l(r)},defaultValue:i,size:"small",sx:{bgcolor:"white"},fullWidth:!0,children:t.operators.map(e=>r(D,{value:e,children:e}))})]}),r(ki,{filterValue:t,operator:c.operator,onChange:(e,r="value")=>{d(t=>({...t,[r]:e}))}})]})}function ki({filterValue:n,operator:o,onChange:a}){switch(n.type){case"number":return r(Ne,{type:"number",size:"small",placeholder:"Valor",defaultValue:n.value,onChange:e=>{a(e.target.value)},sx:{bgcolor:"white"},fullWidth:!0});case"string":if(n.useList)switch(o){case"tem um dos":return r(C,{multiple:!0,id:"tags-standard",onChange:(e,r)=>{a(r.length<=0?"":r)},options:n.useList,defaultValue:Array.isArray(n.value)?n.value:[],renderInput:e=>r(Ne,{...e,variant:"standard",placeholder:"Escolha os valores",fullWidth:!0}),fullWidth:!0});case"contem":case"igual":return r(i,{width:"100%",children:r(C,{options:n.useList,onChange:(e,r)=>{a(r)},defaultValue:"object"==typeof n.value?n.value:void 0,isOptionEqualToValue:(e,r)=>e.label===r.label,renderInput:e=>r(Ne,{...e,size:"small",placeholder:"Escolha um valor",fullWidth:!0,sx:{bgcolor:"white"}}),fullWidth:!0})})}return r(Ne,{size:"small",placeholder:"Valor",defaultValue:n.value,onChange:e=>{a(e.target.value)},sx:{bgcolor:"white"},fullWidth:!0});case"date":case"dates":switch(o){case"data exata":case"data fim":case"data inicio":case"tem a data":return r(oe,{adapterLocale:"pt-br",dateAdapter:le,children:r(ie,{format:"DD/MM/YYYY",onChange:e=>{a(e.isValid()?e.format("DD/MM/YYYY"):"")},defaultValue:n.value?se(n.value,"DD/MM/YYYY"):void 0,sx:{div:{input:{paddingX:2,paddingY:1.05}},width:"100%",bgcolor:"white"},inputRef:e=>r(Ne,{...e,size:"small",fullWidth:!0})})});case"entre":return e(oe,{adapterLocale:"pt-br",dateAdapter:le,children:[r(ie,{format:"DD/MM/YYYY",onChange:e=>{a(e.isValid()?e.format("DD/MM/YYYY"):"")},defaultValue:n.value?se(n.value,"DD/MM/YYYY"):void 0,sx:{div:{input:{paddingX:2,paddingY:1.05}},width:"100%",bgcolor:"white"},inputRef:e=>r(Ne,{...e,size:"small",fullWidth:!0})}),r(ie,{format:"DD/MM/YYYY",onChange:e=>{a(e.isValid()?e.format("DD/MM/YYYY"):"","value2")},defaultValue:n.value2?se(n.value2,"DD/MM/YYYY"):void 0,sx:{div:{input:{paddingX:2,paddingY:1.05}},width:"100%",bgcolor:"white"},inputRef:e=>r(Ne,{...e,size:"small",fullWidth:!0})})]})}}return r(t,{})}let Ei=!1,Si="",Di={},Ii="";function Yi({mediaQueryLG:n,columns:o,csvConfig:c,fetchFunc:d,emptyMsg:u={user:"Nenhum dado encontrado",public:"Nenhum dado encontrado"},dataPath:p="",tableName:m="Dado",columnSize:g,action:b,useKC:x=!0,itemCount:v=10,expandTextMaxLength:C=50,collapsedSize:w=53,customMargin:k=4,customMarginMobile:E=0,filtersFunc:S,filters:D=[],orderBy:I=[],customErrorMsg:T,customTableStyle:A={},id:R,initialData:F=null,isExpandable:V=!0,alwaysExpanded:P=!1}){const[$,j]=Z(!1),[N,z]=Z(null),[B,U]=Z(F),{user:X,userLoaded:H}=J(sr),[G,re]=Z([]),[oe,ie]=Z([]),[ae,le]=Z(v),[se,ce]=Z(0),[de,ue]=Z(1),[pe,me]=Z(1),[fe,he]=Z({}),[ge,ye]=Z({}),[be,xe]=Z({}),[ve,Ce]=Z("filterKey"),we=s(),ke=f(we.breakpoints.only("xs")),Ee=te(B),Se=te("true"===localStorage.getItem(`order-${R}`)||!1),De=f(we.breakpoints.up(2e3));Si=`tableFilter_${R}`,Ii=`tableFilterCache_${R}`,Di=S??{},localStorage.getItem(Ii)||localStorage.setItem(Ii,JSON.stringify(D)),localStorage.getItem(Ii)!==JSON.stringify(D)&&(localStorage.setItem(Ii,JSON.stringify(D)),localStorage.removeItem(Si)),ee(()=>{z(null),d&&(!H&&x||(j(!0),d().then(e=>e.ok?e.json().then(e=>{if(204===e.statusCode)U({body:{data:[]}}),Ee.current=[];else if(403===e.statusCode)z({status:e.statusCode});else{let r=p?ne(e,p):e;if(r&&Array.isArray(r)){let e=r;if(localStorage.getItem(`order-data-${R}`))try{e=vi({order:JSON.parse(localStorage.getItem(`order-data-${R}`)),list:r,orderAsc:Se.current})}catch(e){console.log(e)}else I.length>0&&(e=vi({order:I[0],list:r,orderAsc:Se.current}));U(e),Ee.current=JSON.parse(JSON.stringify(e))}else U({body:{data:[]}}),Ee.current=[]}j(!1)}):(z({status:500}),void j(!1))).catch(e=>{z({status:500})})))},[H,d]);const Ie=Q(e=>Array.isArray(e)?e:"object"==typeof e?ne(e,p):void 0,[]);ee(()=>{if($||N||!Ie(B))return;let e=Ie(B);re(e),ie(e),ue(gi(e,ae)),localStorage.getItem(Si)&&xi({filterData:JSON.parse(localStorage.getItem(Si)),filtersFuncData:Di,localTableName:Si,setCurrentPage:ce,setList:re,setListClone:ie,setListPage:me,setPagCount:ue,startData:Ee.current,itemsCount:ae})},[ae,$,B,N]),ee(()=>{ce(pe-1)},[pe]);const Ye=Q((e,r)=>{me(r)},[]),Me=Q(()=>{const e=se*ae;return G.slice(e,e+ae)},[G,ae,se]);function Oe(){re(Ee.current),ie(Ee.current),ue(gi(Ee.current,ae)),ce(0),me(1),localStorage.removeItem(Si),Ce((new Date).getTime().toString())}ee(()=>{const e=se*ae,r=G.slice(e,e+ae);let t={};r.forEach((e,r)=>{o.forEach(n=>{t[r]=!0===t[r]||(ne(e,n.keyName,"")??"Não Informado").toString().length>=C})}),ye(t)},[G,ae,se]);const Te=(e,r=!1)=>{c&&function(e,r,t){try{if(e.length<=0)return Promise.resolve();let n=[];r.downloadAll&&r.customAll?n=r.customAll(e,t):!r.downloadAll&&r.customFiltered?n=r.customFiltered(e,t):e.forEach(e=>{const o={};r.map.forEach(n=>{if(n.useFilterValue&&!r.downloadAll&&!n.onlyAll){const r=t.filter(e=>e.label==n.useFilterValue.label&&n.useFilterValue.operators.includes(e.operator)),i=r.length>0&&r.reduce(e=>e.value).value||void 0;return void(o[n.name]=i||ne(e,n.key))}n.onlyFilter||(o[n.name]=ne(e,n.key))}),n.push(o)});const o=_e.utils.json_to_sheet(n),i=_e.utils.book_new();return _e.utils.book_append_sheet(i,o,r.fileName),_e.writeFile(i,`${r.fileName}.xlsx`),Promise.resolve()}catch(e){return Promise.reject(e)}}(e,{...c,...r?{downloadAll:!0}:{}},JSON.parse(localStorage.getItem(Si)??"[]")||[])},ze=e=>{xi({filterData:e,filtersFuncData:Di,localTableName:Si,setCurrentPage:ce,setList:re,setListClone:ie,setListPage:me,setPagCount:ue,startData:Ee.current,itemsCount:ae})};return N?r(fi,{customErrorMsg:T,error:N}):$?r(hi,{tableName:m}):!H&&x?r(h,{}):e(t,{children:[e(i,{marginX:ke?E:k,bgcolor:"white",p:2,borderRadius:6,...A,children:[e(a,{spacing:1.5,direction:{xs:"column",md:"row"},children:[e(a,{spacing:1.5,direction:{xs:"column",md:"row"},height:{md:"40px",xs:"inherit"},width:"100%",children:[r(Ne,{InputProps:{startAdornment:r(Pe,{sx:{marginRight:1,fill:"#c0c0c0"}}),sx:{".MuiOutlinedInput-notchedOutline":{border:"none"}}},sx:{border:"solid 1px #CBD5E1",backgroundColor:"#F8FAFC",borderRadius:"50px",maxWidth:"600px"},size:"small",onChange:function(e){const r=e.target.value;if(""===r)return re(oe),void ue(gi(Ie(G),ae));const t=[];oe.forEach(e=>{const n=[];if(Object.keys(e).map(r=>{let t=ne(e,r,"")??"";"number"==typeof t&&(t=t.toString()),"string"==typeof t&&n.push(t)}),n.length<=0)return;let o=!1;n.forEach(e=>{if(["P","C","A","R","L","PA"].includes(e))switch(e){case"P":return void("em analise".includes(r.toLowerCase())&&(o=!0));case"C":return void("cancelado".includes(r.toLowerCase())&&(o=!0));case"A":return void("cadastrado".includes(r.toLowerCase())&&(o=!0));case"R":return void("reprovado".includes(r.toLowerCase())&&(o=!0));case"L":return void("licenciado".includes(r.toLowerCase())&&(o=!0));case"PA":return void(("pré aprovado".includes(r.toLowerCase())||"pre aprovado".includes(r.toLowerCase()))&&(o=!0));case"FP":return void("fora do prazo".includes(r.toLowerCase())&&(o=!0))}yi(e.toLowerCase()).includes(yi(r.toLowerCase()))&&(o=!0)}),o&&t.push(e)}),re(t),ue(gi(t,ae)),ce(0),me(1)},fullWidth:!0,placeholder:`Pesquisar ${m}`}),r(l,{startIcon:r(L,{}),variant:"contained",onClick:e=>Jo.open(r(Ci,{reset:Oe,filtrar:e=>ze(e),baseFilters:[...D],filters:localStorage.getItem(Si)?JSON.parse(localStorage.getItem(Si)):[...D]},ve)),sx:{borderRadius:3,paddingX:"24px",paddingY:"8px",backgroundColor:"#208FE8",textTransform:"capitalize"},children:r(a,{direction:"row",borderRadius:5,padding:0,children:r("span",{children:"Filtrar"})})}),e(a,{direction:"row",spacing:1,children:[I.length>0&&r(ei,{data:I.map(e=>({name:e.label,onClick:()=>(e=>{Se.current=!Se.current;const r=vi({order:e,list:G,orderAsc:Se.current});localStorage.setItem(`order-${R}`,Se.current.toString()),localStorage.setItem(`order-data-${R}`,JSON.stringify(e)),re(r)})(e)})),btProps:{startIcon:r(W,{}),fullWidth:!0},children:"Ordenar"}),V&&!P&&r(l,{variant:"contained",fullWidth:!0,startIcon:r(Ei?K:W,{}),sx:{backgroundColor:"#637082",":hover":{backgroundColor:"#3c4757"},textTransform:"capitalize",borderRadius:3,padding:{md:"0px 8px"}},onClick:function(){let e={};for(let r=0;r<v;r++)e[r]=!Ei;xe(e),he(e),Ei=!Ei},children:Ei?"Recolher":"Expandir"})]})]}),e(a,{alignItems:"end",width:{xs:"100%",md:"20%"},direction:{xs:"row",md:"column"},spacing:{xs:1,md:0},children:[e(Ae,{fontWeight:600,textAlign:"end",children:["Registro de ",m,"s"]}),r(a,{justifyContent:"center",children:e(Ae,{children:["Exibindo ",se*ae+1,"-",se*ae+1+Me().length-1," de ",G.length]})})]})]}),localStorage.getItem(Si)&&r(i,{display:"inline-flex",flexWrap:"wrap",padding:.5,borderRadius:4,marginBottom:1,children:JSON.parse(localStorage.getItem(Si)??"[]").filter(e=>e.value||"entre"===e.operator&&(e.value||e.value2)).map(t=>e(a,{direction:"row",spacing:1,bgcolor:"#4e85c1",color:"white",width:"fit-content",paddingY:.5,borderRadius:2,paddingX:1,m:.5,children:[r(Ae,{fontWeight:700,children:t.label}),r(Ae,{fontStyle:"italic",children:t.operator}),r(Ae,{bgcolor:"white",borderRadius:2,paddingX:1,color:"black",children:Array.isArray(t.value)?t.value.map(e=>e.label).join(" - "):"object"==typeof t.value?t.value.label:"entre"===t.operator?`${t.value?t.value:"Antes"} e ${t.value2?t.value2:"Depois"}`:t.value.toString()}),r(Y,{onClick:e=>{let r=JSON.parse(localStorage.getItem(Si)??"[]");r=r.map(e=>e.label===t.label?{...e,value:"",...e.value2?{value2:""}:{}}:e),ze(r)},size:"small",sx:{padding:0},children:r(Re,{sx:{fill:"white"}})})]}))}),r(a,{spacing:.2,children:Me().length<=0?r(a,{sx:{backgroundColor:"#E2E8F0",padding:2,marginX:{xs:2,md:0}},justifyContent:"center",alignItems:"center",children:r(Ae,{fontSize:21,fontFamily:"Inter",fontWeight:600,textAlign:"center",children:X?u.user:u.public})}):Me().map((s,c)=>r(y,{sx:{padding:.5,backgroundColor:c%2==0?"#F8FAFC":"white",paddingTop:2,paddingBottom:P?2:.5,borderTop:"solid 1.5px #E2E8F0",position:"relative"},elevation:0,children:e($e,{container:!0,spacing:ke?2:0,paddingX:2,rowSpacing:2,children:[o.map(o=>e($e,{item:!0,xs:12,md:De?12/g*(o.size?o.size:1):n?n.all:12/g*(o.size?o.size:1),sx:{overflow:"hidden"},children:[r(i,{sx:{width:"max-content",paddingX:1},children:r(Ae,{fontSize:16,fontWeight:700,color:"#1E293B",fontFamily:"Inter",children:o.title})}),r(i,{paddingLeft:1,position:"relative",children:r(M,{in:P||!0===fe[c],collapsedSize:P?"auto":w,onExited:e=>xe(e=>({...e,[c]:!1})),children:r(i,{sx:{wordWrap:"break-word",color:"#1E293B",fontSize:16},fontFamily:"Inter",children:o.customComponent?o.customComponent(ne(s,o.keyName),s):e(t,{children:[r(i,{color:"transparent",sx:{pointerEvents:"none",userSelect:"none"},children:ne(s,o.keyName,"")}),r(i,{position:"absolute",top:0,children:P||be[c]?ne(s,o.keyName,""):(ne(s,o.keyName,"")??"").toString().length>=C?r(t,{children:(ne(s,o.keyName,"")??"").toString().substring(0,C)+"..."}):ne(s,o.keyName,"")})]})})})})]},o.keyName+c)),r($e,{item:!0,xs:12,md:De?12/g:n?n.action:12/g,children:r(a,{direction:"row",alignItems:"center",justifyContent:ke?"start":"flex-end",sx:{height:"100%",paddingBottom:ke?2:0},children:b(s)})}),ge[c]&&!P&&r(a,{direction:"row",justifyContent:"flex-end",bottom:0,width:"100%",children:r(l,{onClick:e=>{he(e=>({...e,[c]:!e[c]})),xe(e=>({...e,[c]:!0}))},sx:{padding:0,color:"#637082",textTransform:"capitalize"},startIcon:r(fe[c]?_:q,{}),children:fe[c]?"Ver Menos":"Ver Mais"})})]})},c))}),Me().length>0&&r(a,{padding:1,direction:{xs:"column",md:"row"},spacing:{xs:2,md:0},justifyContent:"space-between",alignItems:"center",children:c&&e(a,{direction:{xs:"column",md:"row"},justifyContent:"flex-end",spacing:1,children:[JSON.parse(localStorage.getItem(Si)??"[]").filter(e=>e.value||"entre"===e.operator&&(e.value||e.value2)).length>0&&r(l,{startIcon:r(Fe,{}),variant:"contained",size:"small",onClick:e=>Te(G),sx:{backgroundColor:"#a5a5a5",marginRight:{xs:2,md:0},width:{xs:"100%",md:"fit-content"}},children:"Baixar Filtrados"}),r(l,{startIcon:r(Fe,{}),variant:"contained",size:"small",onClick:e=>Te(Ee.current,!0),sx:{backgroundColor:"#22C55E",marginRight:{xs:2,md:0},width:{xs:"100%",md:"fit-content"}},children:"Baixar Tabela"})]})})]}),r(a,{direction:"row",justifyContent:"center",paddingY:1,paddingTop:2,children:e(a,{direction:"row",justifyContent:"center",alignItems:"center",spacing:2,children:[r(l,{onClick:e=>me(e=>e>1?e-1:1),sx:{bgcolor:"white",borderRadius:"50px",height:"40px",width:"40px",minWidth:0,border:"solid 1px #E2E8F0"},children:r(Ve,{sx:{transform:"scale(1.5) scaleX(-1)"}})}),r(je,{renderItem:e=>"page"===e.type?r(l,{onClick:e.onClick,sx:{fontWeight:600,...e.selected?{bgcolor:"#33B55D",color:"white"}:{color:"#1E293B"},borderRadius:"100%",padding:0,margin:0,minWidth:0,width:"40px",height:"40px",marginX:.25},children:e.page}):["next","previous","page"].includes(e.type)?void 0:r(O,{...e}),count:de,siblingCount:ke?0:6,size:"large",onChange:Ye,page:pe,shape:"circular",variant:"outlined",sx:{".MuiPagination-ul":{backgroundColor:"white",border:"solid 1px #E2E8F0",borderRadius:"50px",paddingX:.25,paddingY:.5}}}),r(l,{onClick:e=>me(e=>e<de?e+1:de),sx:{bgcolor:"white",borderRadius:"50px",height:"40px",width:"40px",minWidth:0,border:"solid 1px #E2E8F0"},children:r(Ve,{sx:{transform:"scale(1.5)"}})})]})})]})}var Mi=/*#__PURE__*/H.memo(Yi);const Oi=qe(()=>import("./Map-31d95a26.js").then(e=>e.Map),{ssr:!1});function Ti({links:n,title:s,img:c,pos:d="fixed",next:u=!0,el:p,menuItems:m,paddingBottom:f=0,logoutMsg:h="Sair",logoutFunc:g,loginOptions:y,logoutOptions:b,...x}){let v;u&&(v=Ze());const{user:C,login:w,logout:k,type:E}=J(sr),[I,M]=Z(null),[O,T]=Z(null),A=Boolean(I),R=Boolean(O),[P,$]=Z(!1),j=Q(e=>{M(e.currentTarget)},[]),N=Q(()=>{M(null)},[]),z=Q((e,r)=>{$(!0),M(null),v?v.push({pathname:r}).finally(()=>$(!1)):$(!1)},[v]);return e(t,{children:[e(i,{position:d,sx:{width:"100%",zIndex:100},children:[r(F,{position:"relative",elevation:0,sx:{backgroundColor:"#F1F5F9",color:"black",paddingY:1,paddingX:{xs:1,md:4}},children:e(a,{direction:"row",justifyContent:"space-between",children:[e(a,{direction:"row",alignItems:"center",spacing:2,marginRight:2,sx:{display:{xs:"none",md:"flex"},width:"100%"},children:[r(Qe,{href:"/",children:u?r(Je,{src:c,alt:s,width:40,height:40}):r("img",{src:c,height:35})}),r(i,{children:r(o,{variant:"subtitle1",fontWeight:600,children:s})})]}),r(i,{sx:{display:{xs:"flex",md:"none"}},children:n.length>0&&e(t,{children:[r(Y,{onClick:j,children:r(Xe,{})}),r(S,{open:A,onClose:N,anchorEl:I,children:n.map(e=>r(D,{onClick:r=>z(r,e.path),children:r(o,{textTransform:"capitalize",children:e.name})},`navmenu${e}`))})]})}),e(a,{direction:"row",justifyContent:"flex-end",alignItems:"center",sx:{width:{md:"100%"}},children:[r(a,{direction:"row",spacing:2,sx:{display:{xs:"none",md:"flex"}},children:n.map(e=>r(i,{sx:{a:{color:"#2c7da0",textDecoration:"none",textTransform:"capitalize","&:hover":{color:"#90e0ef"}}},children:r(l,{onClick:r=>{return t=e.path,$(!0),void(v?v.push({pathname:t}).finally(()=>$(!1)):$(!1));var t},sx:{textTransform:"capitalize"},children:e.name})},`navigation${e.path}`))}),e(a,{direction:"row",spacing:2,children:[r(i,{children:p}),C?e(a,{direction:"row",spacing:1,sx:{"&:hover":{backgroundColor:"#a9def9",cursor:"pointer"},padding:.5,borderRadius:60},children:[e(i,{sx:{display:"flex",alignItems:"center"},children:[r(V,{sx:{width:30,height:30},src:C.image}),e(S,{open:R,onClose:e=>T(null),anchorEl:O,disableScrollLock:!0,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},sx:{".MuiMenu-paper":{borderRadius:4}},children:[m,r(D,{onClick:function(e){try{T(null);const e={...b,onBeforeLogout:function(){try{function e(){return Promise.resolve(b?.onBeforeLogout?.()).then(function(){})}const r=function(){if(g){const e=function(e,r){try{var t=Promise.resolve(g()).then(function(){})}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(0,function(e){console.error(e)});if(e&&e.then)return e.then(function(){})}}();return Promise.resolve(r&&r.then?r.then(e):e())}catch(t){return Promise.reject(t)}}};return k(e),Promise.resolve()}catch(e){return Promise.reject(e)}},children:e(a,{direction:"row",spacing:1,children:[r(Ke,{sx:{fill:"#545454"}}),r(o,{textTransform:"capitalize",children:h})]})})]})]}),e(a,{direction:"row",spacing:.4,alignItems:"center",onClick:e=>T(e.currentTarget),sx:{userSelect:"none"},children:[r(o,{children:"Olá,"}),r(o,{fontWeight:600,children:C?.given_name}),r(Ue,{})]})]}):r(l,"govbr"===E?{variant:"contained",size:"small",startIcon:r(He,{}),onClick:()=>w(y),sx:{color:"white",textTransform:"inherit",borderRadius:50,paddingX:2},children:r(o,{fontWeight:600,fontSize:15,padding:.4,children:"Entrar com o gov.br"})}:{variant:"contained",size:"small",startIcon:r(He,{}),onClick:()=>w(y),sx:{color:"white",textTransform:"inherit",borderRadius:50,paddingX:2},children:r(o,{fontWeight:600,fontSize:15,padding:.4,children:"Entrar"})})]})]})]})}),P&&r(Ge,{})]}),r(i,{paddingBottom:f})]})}function Ai({links:n,title:c,img:d,pos:u="fixed",next:p=!0,el:m,menuItems:f,color:h="blue",route:g="/teste/89",paddingBottom:y=0,logoutMsg:b="Sair",customBgColor:x="#FFFFFF",logoutFunc:v,loginOptions:C,logoutOptions:w,...k}){const E=s(),I=n.length<=3?"md":"lg";let M;p&&(M=Ze());const{user:O,login:T,logout:A,type:R}=J(sr),[P,$]=Z(null),[j,N]=Z(null),z=Boolean(P),B=Boolean(j),[L,W]=Z(!1),_=Q(e=>{$(e.currentTarget)},[]),q=Q(()=>{$(null)},[]),U=Q((e,r)=>{W(!0),$(null),M?M.push({pathname:r}).finally(()=>W(!1)):W(!1)},[M]);return e(t,{children:[e(i,{position:u,sx:{width:"100%",zIndex:100},children:[r(F,{position:"relative",elevation:0,sx:{color:E.palette.getContrastText(x),paddingX:{xs:1,[I]:4},bgcolor:x},children:e(a,{direction:"row",justifyContent:"space-between",bgcolor:x,children:[e(a,{direction:"row",alignItems:"center",spacing:2,marginRight:2,sx:{display:{xs:"none",[I]:"flex"},width:"100%"},children:[r(Qe,{href:"/",children:p?r(Je,{src:d,alt:c,width:40,height:40}):r("img",{src:d,height:35})}),r(i,{children:r(o,{variant:"subtitle1",fontWeight:600,children:c})})]}),r(a,{direction:"row",width:"100%",justifyContent:"center",alignItems:"center",spacing:2,sx:{display:{xs:"none",[I]:"flex"}},children:n.map((e,t)=>{const n=function(e,r){return"/"===r?e===r:e.startsWith(r)}(p?M?.pathname??"":g,e.path);return r(i,{paddingX:3,paddingY:.8,borderRadius:50,bgcolor:n?h:"transparent",color:n?"#fff":"inherit",sx:{transition:"all 0.2s ease-in-out",":hover":{backgroundColor:n?h:"rgba(0,0,0,0.05)",cursor:"pointer",userSelect:"none",filter:n?"brightness(1.1)":"none"}},onClick:r=>{var t;p&&console.log("pathname:",M?.pathname,":=",e.path),t=e.path,W(!0),M?M.push({pathname:t}).finally(()=>W(!1)):W(!1)},children:r(a,{justifyContent:"center",children:r(o,{fontWeight:n?600:500,whiteSpace:"nowrap",children:e.name})})},JSON.stringify({x:e,index:t}))})}),r(i,{sx:{display:{xs:"flex",[I]:"none"}},children:n.length>0&&e(t,{children:[r(Y,{onClick:_,children:r(Xe,{})}),r(S,{open:z,onClose:q,anchorEl:P,children:n.map((e,t)=>r(D,{onClick:r=>U(r,e.path),children:r(o,{textTransform:"capitalize",children:e.name})},JSON.stringify({x:e,index:t})))})]})}),r(a,{direction:"row",justifyContent:"flex-end",alignItems:"center",sx:{width:{[I]:"100%"}},paddingY:1,children:e(a,{direction:"row",spacing:2,children:[r(i,{children:m}),O?e(a,{direction:"row",spacing:1,sx:{"&:hover":{backgroundColor:"#a9def9",cursor:"pointer"},padding:.5,borderRadius:60},children:[e(i,{sx:{display:"flex",alignItems:"center"},children:[r(V,{sx:{width:30,height:30},src:O.image}),e(S,{open:B,onClose:e=>N(null),anchorEl:j,disableScrollLock:!0,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},sx:{".MuiMenu-paper":{borderRadius:4}},children:[f,r(D,{onClick:function(e){try{N(null);const e={...w,onBeforeLogout:function(){try{function e(){return Promise.resolve(w?.onBeforeLogout?.()).then(function(){})}const r=function(){if(v){const e=function(e,r){try{var t=Promise.resolve(v()).then(function(){})}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}(0,function(e){console.error(e)});if(e&&e.then)return e.then(function(){})}}();return Promise.resolve(r&&r.then?r.then(e):e())}catch(t){return Promise.reject(t)}}};return A(e),Promise.resolve()}catch(e){return Promise.reject(e)}},children:e(a,{direction:"row",spacing:1,children:[r(Ke,{sx:{fill:"#545454"}}),r(o,{textTransform:"capitalize",children:b})]})})]})]}),e(a,{direction:"row",spacing:.4,alignItems:"center",onClick:e=>N(e.currentTarget),sx:{userSelect:"none"},children:[r(o,{children:"Olá,"}),r(o,{fontWeight:600,children:O.given_name}),r(Ue,{})]})]}):r(l,"govbr"===R?{variant:"contained",size:"small",startIcon:r(He,{}),onClick:()=>T(C),sx:{color:"white",textTransform:"inherit",borderRadius:50,paddingX:2},children:r(o,{fontWeight:600,fontSize:15,padding:.4,children:"Entrar com o gov.br"})}:{variant:"contained",size:"small",startIcon:r(He,{}),onClick:()=>T(C),sx:{color:"white",textTransform:"inherit",borderRadius:50,paddingX:2},children:r(o,{fontWeight:600,fontSize:15,padding:.4,children:"Entrar"})})]})})]})}),L&&r(Ge,{})]}),r(i,{paddingBottom:y})]})}function Ri({children:e,onSubmit:t,formMethod:n="GET",submiting:o=!1}){const{register:i,handleSubmit:a,control:l,formState:s,reset:c,watch:d,trigger:u,setValue:p,unregister:m,getValues:f}=ue(),[h,g]=Z([]);return r(dr.Provider,{value:{formRegister:i,formWatch:d,formReset:c,formControl:l,formSetValue:p,formTrigger:u,formUnregister:m,formGetValues:f,formHandleSubmit:a,setFilesUid:g,formState:s,errors:s?.errors,submiting:o},children:r("form",{method:n,onSubmit:a(e=>t(e,h),()=>Me("Formulário incompleto! Verifique os campos marcados e tente novamente.",{type:"warning",position:"top-right",theme:"colored"})),children:e})})}function Fi(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}const Vi="keycloak-logout-pending";function Pi({url:e,realm:t,clientId:n,children:o,type:i="ad",resource_name:a="eventos-front",basePath:l="",redirectUri:s="",onAuthSuccess:c,onAuthError:d,onLogoutSuccess:u,enableDebugLogs:p="development"===process.env.NODE_ENV}){const[m,f]=Z(null),[h,g]=Z(!1),y=te(null),b=te(!1),x=te(null),v=Ze(),C=Q(function(e){p&&console.log(`[KeycloakAuth] ${e}`,...[].slice.call(arguments,1))},[p]),w=Q(function(e){p&&console.error(`[KeycloakAuth] ${e}`,...[].slice.call(arguments,1))},[p]),k=Q(e=>{const r=e.tokenParsed;if(!r)return null;const t=(r.resource_access??{})[a],n=Array.isArray(t?.roles)?t.roles:[];return{...r,token:e.token,roles:n}},[a]),E=Q(function(){try{const e=y.current;return e&&e.authenticated?Promise.resolve(Fi(function(){return Promise.resolve(e.updateToken(30)).then(function(r){if(r){const r=k(e);r&&(f(r),C("Token renovado com sucesso"))}else C("Token ainda válido, renovação não necessária");return!0})},function(e){return w("Falha ao renovar token",e),f(null),!1})):(C("Não é possível renovar token: usuário não autenticado"),Promise.resolve(!1))}catch(e){return Promise.reject(e)}},[k,C,w]),S=Q(()=>{x.current&&clearInterval(x.current),x.current=setInterval(function(){try{return Promise.resolve(E()).then(function(){})}catch(e){return Promise.reject(e)}},6e4),C("Renovação automática de token configurada")},[E,C]),D=Q(()=>{x.current&&(clearInterval(x.current),x.current=null,C("Renovação automática de token removida"))},[C]);ee(()=>{if(b.current)return;b.current=!0;const r=new er({url:e,realm:t,clientId:n});return y.current=r,r.onTokenExpired=function(){try{return C("Token expirado, tentando renovar..."),Promise.resolve(E()).then(function(){})}catch(e){return Promise.reject(e)}},r.onAuthRefreshError=()=>{w("Erro ao renovar autenticação - refresh token inválido"),f(null),D()},r.onAuthLogout=()=>{C("Usuário deslogado em outra sessão"),f(null),D()},r.init({onLoad:"check-sso",pkceMethod:"S256",silentCheckSsoRedirectUri:"undefined"!=typeof window?`${window.location.origin}${l}/silent-check-sso.html`:void 0,checkLoginIframe:!0,checkLoginIframeInterval:30}).then(e=>{if(localStorage.getItem(Vi))return localStorage.removeItem(Vi),localStorage.removeItem("user-data.img"),C("Logout pendente detectado, limpando estado e chamando onLogoutSuccess..."),f(null),g(!0),D(),e&&r&&r.clearToken(),void u?.();if(g(!0),!e)return C("Usuário não autenticado"),void f(null);const t=k(r);t&&(f(t),S(),C("Autenticação bem-sucedida",{user:t.preferred_username}),c?.(t))}).catch(e=>{w("Falha na inicialização do Keycloak",e),g(!0),f(null);const r=e instanceof Error?e:new Error("Falha na autenticação");d?.(r)}),"success"===v.query.status&&window.history.replaceState(null,"",v.pathname),()=>{D()}},[e,t,n,a,v.query,v.pathname,k,S,D,E,C,w,c,d,u]);const I=Q(e=>{const r=y.current;if(!r){const r=new Error("Keycloak não inicializado");return w("Tentativa de login com Keycloak não inicializado"),void e?.onError?.(r)}C("Iniciando fluxo de login...",{authenticated:r.authenticated,clientId:r.clientId});const t={redirectUri:e?.redirectUri||s||window.location.href,idpHint:e?.idpHint,loginHint:e?.loginHint,prompt:e?.prompt,action:e?.action,locale:e?.locale,acr:e?.acr,scope:e?.scope,maxAge:e?.maxAge};r.login(t).then(()=>{e?.onSuccess?.()}).catch(r=>{const t=r instanceof Error?r:new Error("Falha no login");w("Erro no login",t),e?.onError?.(t)})},[s,C,w]),Y=Q(function(e){try{function r(){localStorage.setItem(Vi,"true"),D();const r=e?.redirectUri||`${window.location.origin}${l}`;if(C("Redirecionando para logout...",{redirectUri:r,type:i}),"govbr"===i&&t.token)try{const e=new URL(`${t.authServerUrl}/realms/${t.realm}/protocol/openid-connect/logout`);return e.searchParams.set("client_id",t.clientId||n),e.searchParams.set("post_logout_redirect_uri",r),e.searchParams.set("id_token_hint",t.idToken||""),e.searchParams.set("initiating_idp","oidc"),C("Logout GovBR federado - redirecionando para:",e.toString()),void(window.location.href=e.toString())}catch(e){w("Erro ao construir URL de logout federado, usando fallback",e)}const o=Fi(function(){return Promise.resolve(t.logout({redirectUri:r,logoutMethod:e?.logoutMethod})).then(function(){})},function(e){localStorage.removeItem(Vi),w("Erro no logout",e)});if(o&&o.then)return o.then(function(){})}const t=y.current;if(!t)return w("Tentativa de logout com Keycloak não inicializado"),Promise.resolve();C("Iniciando fluxo de logout...");const o=function(){if(e?.onBeforeLogout){const r=Fi(function(){return Promise.resolve(e.onBeforeLogout()).then(function(){})},function(e){w("Erro no callback onBeforeLogout",e)});if(r&&r.then)return r.then(function(){})}}();return Promise.resolve(o&&o.then?o.then(r):r())}catch(a){return Promise.reject(a)}},[C,w,D,i,n]),M=Q(e=>{const r={token:e.access_token,roles:e.claims.roles.map(e=>e.name),sub:e.claims.sub,exp:e.claims.exp,iat:e.claims.iat,email_verified:"true"===e.claims.email_verified,preferred_username:e.claims.preferred_username,email:e.claims.email,name:e.claims.name,given_name:e.claims.given_name};f(r),C("Dados de usuário externo salvos",{username:r.preferred_username})},[C]),O=Q(e=>m?.roles?.includes(e)??!1,[m?.roles]),T=Q(e=>!(!m?.roles||0===e.length)&&e.every(e=>m.roles.includes(e)),[m?.roles]),A=Q(e=>!(!m?.roles||0===e.length)&&e.some(e=>m.roles.includes(e)),[m?.roles]),R=re(()=>({user:m,isAuth:!!m,userLoaded:h,login:I,logout:Y,saveUserData:M,type:i,refreshToken:E,hasRole:O,hasAllRoles:T,hasAnyRole:A,accessToken:m?.token}),[m,h,I,Y,M,i,E,O,T,A]);return r(sr.Provider,{value:R,children:o})}const $i="nextauth.token",ji="user-data.img";function Ni({children:e,AUTH_URL:t,oidcConfig:n,redirectURL:o,validateTokenRoute:i,testToken:a,testIP:l,logoutURL:s=o}){const c=n.authority+"/authorize?response_type=code&client_id="+n.client_id+"&scope="+n.scope+"&redirect_uri="+n.redirect_uri,[d,u]=Z(null),[p,m]=Z(!1),f=Ze();ee(()=>{const e=rr($i);e?fetch(`${t}${i}`,{method:"POST",headers:{Authorization:`Bearer ${e}`}}).then(r=>{if(r.ok){const r=or(e),t=localStorage.getItem(ji);u({name:r.given_name,image:t??"",roles:r.roles.map(e=>String(e.code)),token:e,preferred_username:r.preferred_username,email:r.email,email_verified:"true"===r.email_verified,sub:r.sub}),m(!0)}else y()}):m(!0)},[]);const h=Q(e=>{if(!location||"localhost"!==location.hostname&&location.hostname!==l)m(!1),f.replace(c);else{const r=a;tr($i,r),u({name:"Teste",image:"",roles:["1"],token:r}),f.replace(e?.redirectUri?.toString()||o).then(()=>{m(!0),e?.onSuccess?.()}).catch(r=>{e?.onError?.(r instanceof Error?r:new Error("Erro no redirecionamento"))})}},[l,a,o,c,f]),g=Q(function(e){try{const r=e.ssp_token;tr($i,r);const t=or(r),n=or(e.id_token);return Promise.resolve(fetch(n.picture,{headers:{Authorization:`Bearer ${e.access_token}`}}).then(e=>{200===e.status&&e.blob().then(e=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>{const e=n.result;localStorage.setItem(ji,e),u({name:t.name,image:e,roles:t.roles.map(e=>String(e.code)),token:r,preferred_username:t.preferred_username,email:t.email,sub:t.sub}),f.replace(o).finally(()=>m(!0))}}),u({name:t.name,image:"",roles:t.roles.map(e=>String(e.code)),token:r,preferred_username:t.preferred_username,email:t.email,sub:t.sub}),f.replace(o).finally(()=>m(!0))})).then(function(){f.replace(o).finally(()=>m(!0))})}catch(e){return Promise.reject(e)}},[o,f]),y=Q(function(e){try{function r(){m(!1),f.replace(e?.redirectUri||s).then(()=>{e?.onSuccess?.()}).finally(()=>{u(null),nr($i),localStorage.removeItem(ji),m(!0)})}const t=function(){if(e?.onBeforeLogout){const r=function(r,t){try{var n=Promise.resolve(e.onBeforeLogout()).then(function(){})}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}(0,function(e){console.error("[OAuthProvider] Erro no callback onBeforeLogout",e)});if(r&&r.then)return r.then(function(){})}}();return Promise.resolve(t&&t.then?t.then(r):r())}catch(n){return Promise.reject(n)}},[s,f]),b=Q(e=>d?.roles?.includes(e)??!1,[d?.roles]),x=Q(e=>!(!d?.roles||0===e.length)&&e.every(e=>d.roles.includes(e)),[d?.roles]),v=Q(e=>!(!d?.roles||0===e.length)&&e.some(e=>d.roles.includes(e)),[d?.roles]),C=Q(function(){try{return console.warn("[OAuthProvider] refreshToken não é suportado neste provider"),Promise.resolve(!1)}catch(e){return Promise.reject(e)}},[]),w=re(()=>({user:d,isAuth:!!d,userLoaded:p,login:h,logout:y,saveUserData:g,type:"govbr",refreshToken:C,hasRole:b,hasAllRoles:x,hasAnyRole:v,accessToken:d?.token}),[d,p,h,y,g,C,b,x,v]);return r(sr.Provider,{value:w,children:e})}function zi(n){return e(t,{children:[r(Qo,{}),n.children,r(Oe,{position:"bottom-right",theme:"colored"})]})}function Bi({name:t,options:a,title:l,required:c=!1,disabled:d=!1,row:u=!1,xs:p=12,sm:m,md:f,defaultValue:h,watchValue:g}){const y=J(dr),b=s();return ee(()=>{void 0!==g&&y.formSetValue(t,g)},[g,t,y]),r(n,{item:!0,xs:p,sm:m,md:f,children:r(pe,{name:t,control:y.formControl,defaultValue:h??"",rules:{required:!!c&&"Este campo é obrigatório"},render:({field:t,fieldState:{error:n}})=>e(A,{error:!!n,disabled:d,fullWidth:!0,children:[l&&r(P,{required:c,error:!!n,sx:{mb:1,fontWeight:500,fontSize:"0.875rem"},children:l}),r(i,{display:"flex",flexDirection:u?"row":"column",gap:1,flexWrap:"wrap",children:a.map((n,a)=>{const l=t.value===n.value;return e(i,{onClick:()=>!d&&t.onChange(l&&!c?"":n.value),sx:{border:"1px solid",borderColor:l?b.palette.primary.main:"#E0E0E0",borderRadius:"8px",padding:"8px 16px",cursor:d?"not-allowed":"pointer",backgroundColor:l?`${b.palette.primary.main}10`:"white",transition:"all 0.2s",display:"flex",alignItems:"center",position:"relative",opacity:d?.6:1,"&:hover":{borderColor:d||l?void 0:b.palette.grey[400],backgroundColor:d||l?void 0:b.palette.grey[50]}},children:[r(i,{sx:{width:"18px",height:"18px",borderRadius:"50%",border:"2px solid",borderColor:l?b.palette.primary.main:"#9E9E9E",mr:1.5,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s"},children:l&&r(i,{sx:{width:"10px",height:"10px",borderRadius:"50%",backgroundColor:b.palette.primary.main}})}),r(o,{variant:"body2",color:l?"primary.main":"text.primary",fontWeight:l?600:400,children:n.label})]},a)})}),n&&e($,{sx:{backgroundColor:"#FFEBEE",borderRadius:"8px",padding:"8px 12px",marginTop:"8px",border:"1px solid #FFCDD2",color:"error.main",display:"flex",alignItems:"center",gap:1,marginLeft:0,marginRight:0},children:[r(N,{fontSize:"small"}),n.message]})]})})})}var Li=/*#__PURE__*/H.memo(Bi);export{$i as AUTH_COOKIE_NAME,Oo as ActiveInput,sr as AuthContext,To as AutoComplete,Zo as Button,ir as Category,ur as CheckBox,mr as CheckBoxAdditional,fr as CheckBoxWarning,yr as DatePicker,ho as DropFileUpload,Ro as FetchAutoComplete,ar as Field,lr as FieldLabel,cr as File,go as FileUpload,Vo as FixedAutoComplete,dr as FormContext,Ri as FormProvider,br as GenericDatePicker,$o as GenericFetchAutoComplete,Bo as GenericInput,No as GenericMaskInput,Lo as GenericMultInput,mi as GenericTable,Mo as Input,Pi as KeycloakAuthProvider,Jo as MODAL,Oi as Map,wo as MaskInput,ei as Menu,Wo as MultInput,Ti as NavBar,Ni as OAuthProvider,_o as OtherCheckBox,Li as Radio,gr as RequiredCheckBoxGroup,zi as SspComponentsProvider,Ko as Stepper,Go as StepperBlock,bo as Switch,vo as SwitchWatch,Ai as TabNavBar,Mi as Table,xr as TimePicker,xo as ToggleVisibility};
3
3
  //# sourceMappingURL=index.esm.js.map