@zydon/common 2.8.86 → 2.8.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-J3T26XV2.js → chunk-45GFZNTZ.js} +3 -3
- package/dist/chunk-4UECQEE3.js +4 -0
- package/dist/chunk-4UECQEE3.js.map +1 -0
- package/dist/{chunk-ENNGRPXU.js → chunk-AYUKIKNC.js} +3 -3
- package/dist/{chunk-JFLONZMC.js → chunk-CKCNZJL6.js} +2 -2
- package/dist/chunk-K3T3E52L.js +4 -0
- package/dist/chunk-K3T3E52L.js.map +1 -0
- package/dist/components/Analytics/OverviewAnalytics/index.js +1 -1
- package/dist/components/Analytics/PartnerAnalysis/index.js +1 -1
- package/dist/components/Analytics/index.js +2 -2
- package/dist/components/AvatarButton/index.js +9 -9
- package/dist/components/AvatarButton/index.js.map +1 -1
- package/dist/components/Common/index.js +4 -4
- package/dist/components/DynamicDataView/index.js +1 -1
- package/dist/components/EasyCropModal/index.js +2 -2
- package/dist/components/FileUpload/index.js +4 -4
- package/dist/components/Filters/index.d.ts +7 -0
- package/dist/components/Filters/index.js +26 -0
- package/dist/components/Filters/index.js.map +1 -0
- package/dist/components/ToggleTheme/index.js +4 -4
- package/dist/components/form/FileUpload/index.js +4 -4
- package/dist/hooks/useFiltersSearchParams.d.ts +12 -0
- package/dist/hooks/useFiltersSearchParams.js +8 -0
- package/dist/hooks/useFiltersSearchParams.js.map +1 -0
- package/dist/hooks/useThemeToggle.js +4 -4
- package/dist/index.js +4 -4
- package/dist/props-8e304e21.d.ts +17 -0
- package/dist/theme/theme-provider.js +4 -4
- package/dist/types/period.d.ts +24 -0
- package/dist/types/period.js +2 -0
- package/dist/types/period.js.map +1 -0
- package/package.json +1 -1
- /package/dist/{chunk-J3T26XV2.js.map → chunk-45GFZNTZ.js.map} +0 -0
- /package/dist/{chunk-ENNGRPXU.js.map → chunk-AYUKIKNC.js.map} +0 -0
- /package/dist/{chunk-JFLONZMC.js.map → chunk-CKCNZJL6.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as a$5 } from './chunk-
|
|
1
|
+
import { a as a$5 } from './chunk-CKCNZJL6.js';
|
|
2
2
|
import { a } from './chunk-SYOUADDE.js';
|
|
3
|
-
import { a as a$2 } from './chunk-EN24URDV.js';
|
|
4
3
|
import { e } from './chunk-OF6623HG.js';
|
|
4
|
+
import { a as a$2 } from './chunk-EN24URDV.js';
|
|
5
5
|
import { a as a$6 } from './chunk-6U5LS7MP.js';
|
|
6
6
|
import { a as a$3 } from './chunk-5J35UAV6.js';
|
|
7
7
|
import { j } from './chunk-I3B772WD.js';
|
|
@@ -31,4 +31,4 @@ import ni from '@mui/material/CircularProgress';
|
|
|
31
31
|
var pr=({helperText:e,disabled:o,isError:r})=>e?jsx(sr,{error:r,sx:a=>({mx:"14px",color:o?a.palette.grey[500]:void 0}),children:e}):null,S=memo(pr);var Ce=styled(he)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),ke=styled(he)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),lo=styled(ze,{shouldForwardProp:e=>!["isDragActive","isError","disabled"].includes(e)})(({theme:e,isDragActive:o,isError:r,disabled:a})=>({outline:"none",cursor:"pointer",overflow:"hidden",position:"relative",padding:e.spacing(5),borderRadius:e.shape.borderRadius,transition:e.transitions.create("padding"),backgroundColor:e.palette.background.neutral,border:`dashed 1px ${e.palette.divider}`,...o&&{opacity:.72},...r&&{color:e.palette.error.main,backgroundColor:e.palette.error.lighter,borderColor:e.palette.error.light},...a&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}})),so=styled(cr)(({theme:e})=>({position:"relative",zIndex:999,pointerEvents:"auto",color:e.palette.grey[700],backgroundColor:e.palette.grey[100],"&:hover":{color:e.palette.grey[900],backgroundColor:e.palette.grey[300]}})),Xe=styled("div")({position:"relative",zIndex:1,userSelect:"none","&:hover":{zIndex:2}}),po=styled(he,{shouldForwardProp:e=>!["isDragging"].includes(e)})(({theme:e,width:o,isDragging:r})=>({width:o,height:100,alignItems:"center",display:"inline-flex",justifyContent:"center",margin:e.spacing(.5),padding:e.spacing(2,1,2,1),gap:e.spacing(1),borderRadius:e.spacing(1.25),overflow:"hidden",position:"relative",border:`solid 1px ${e.palette.divider}`,backgroundColor:e.palette.common.white,zIndex:1,transition:"box-shadow 150ms ease-in-out",boxShadow:r?`0 0 0 2px ${e.palette.primary.main}, ${e.customShadows.z8}, inset 0 0 0 1000px ${alpha(e.palette.primary.main,.06)}`:"0px 0px 0px 0px rgba(0, 0, 0, 0)"})),co=styled(m.div)(({theme:e,width:o,isDragging:r})=>({width:o,height:60,alignItems:"center",display:"inline-flex",justifyContent:"center",margin:e.spacing(.5),padding:e.spacing(2),borderRadius:e.spacing(1.25),overflow:"hidden",position:"relative",border:`solid 1px ${e.palette.divider}`,backgroundColor:e.palette.common.white,zIndex:1,transition:"box-shadow 150ms ease-in-out",boxShadow:r?`0 0 0 2px ${e.palette.primary.main}, ${e.customShadows.z8}, inset 0 0 0 1000px ${alpha(e.palette.primary.main,.06)}`:"0px 0px 0px 0px rgba(0, 0, 0, 0)"})),mo=styled(a)(({theme:e})=>({top:16,right:16,zIndex:9,position:"absolute",color:e.palette.common.white,backgroundColor:alpha(e.palette.grey[900],.72),"&:hover":{backgroundColor:alpha(e.palette.grey[900],.48)}})),fo=styled(ze,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="disabled"&&e!=="hasError"})(({theme:e,isDragActive:o,disabled:r,hasError:a})=>({width:64,height:64,flexShrink:0,display:"flex",borderRadius:1,cursor:"pointer",alignItems:"center",color:e.palette.text.disabled,justifyContent:"center",backgroundColor:alpha(e.palette.grey[500],.08),border:`dashed 1px ${alpha(e.palette.grey[500],.16)}`,...o&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...a&&{color:e.palette.error.main,borderColor:e.palette.error.main,backgroundColor:alpha(e.palette.error.main,.08)},"&:hover":{opacity:.72}})),uo=styled(ze)(({theme:e})=>({padding:e.spacing(1),top:0,left:0,width:"100%",height:"100%",position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",transition:"all 0.3s ease-in-out",filter:"blur(0)","&:hover .single-file-preview-img":{filter:"blur(3px)",transition:"all 0.1s ease-in-out"},"&:hover .single-file-preview-hover-overlay":{opacity:1}})),go=styled("img",{shouldForwardProp:e=>e!=="aspectRatio"&&e!=="isLoading"&&e!=="isUploading"&&e!=="maxWidth"&&e!=="maxHeight"&&e!=="cropSize"&&e!=="fill"})(({theme:e,aspectRatio:o,maxWidth:r,maxHeight:a,isLoading:t,isUploading:s,fill:n})=>({borderRadius:e.shape.borderRadius,objectFit:"cover",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%) scale(1)",filter:"blur(0)",zIndex:1,backgroundColor:e.palette.background.paper,...n&&{width:"100%",height:"100%"},...!n&&Math.abs(o)>=1&&{maxWidth:r,maxHeight:a,aspectRatio:Math.abs(o),width:"calc(100% - 16px)",height:void 0},...!n&&Math.abs(o)<1&&{maxWidth:r,maxHeight:a,aspectRatio:Math.abs(o),width:void 0,height:"calc(100% - 16px)"},transition:"all 0.3s ease-in-out",...t||s?{opacity:0,filter:"blur(1.5rem)",transform:"translate(-50%, -50%) scale(0.7)"}:{}})),xo=styled("img",{shouldForwardProp:e=>e!=="isLoading"&&e!=="isUploading"})(({isLoading:e,isUploading:o})=>({width:"100%",height:"100%",objectFit:"cover",top:0,left:0,filter:"blur(1.5rem)",transform:"scale(1.1)",position:"absolute",zIndex:0,transition:"opacity 0.3s ease-in-out",...e&&{opacity:0},...o&&{opacity:.7,filter:"blur(2rem)"}})),ho=styled(he)(({theme:e})=>({position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:alpha(e.palette.primary.darker,.75),zIndex:2,pointerEvents:"none",opacity:0,transition:"opacity 0.3s ease-in-out"})),bo=styled(he)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(mr)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var qe=styled(ze,{shouldForwardProp:e=>e!=="isError"&&e!=="hasFile"})(({theme:e,isError:o,hasFile:r})=>({top:0,gap:e.spacing(1),left:0,width:"100%",height:"100%",zIndex:9,display:"flex",borderRadius:"50%",position:"absolute",alignItems:"center",color:e.palette.text.disabled,flexDirection:"column",justifyContent:"center",backgroundColor:alpha(e.palette.grey[500],.08),transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.shorter}),"&:hover":{opacity:.92},...o&&{color:e.palette.error.main},...r&&{zIndex:9,opacity:0,color:e.palette.common.white,backgroundColor:alpha(e.palette.common.black,.54)}})),Io=styled(he)({top:0,left:0,right:0,bottom:0,position:"absolute",zIndex:10,alignItems:"center",justifyContent:"center",opacity:.8});styled(he)(({theme:e})=>({padding:20,justifyContent:"center",alignItems:"center",gap:4,alignSelf:"stretch",borderRadius:12,background:e.palette.divider,color:e.palette.text.disabled,height:160}));var Po=styled(ze,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="isError"&&e!=="hasFile"})(({theme:e,isDragActive:o,disabled:r,isError:a,hasFile:t})=>({padding:e.spacing(1),margin:"auto",width:144,height:144,cursor:"pointer",overflow:"hidden",borderRadius:"50%",border:`1px dashed ${e.palette.divider}`,...o&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...a&&{borderColor:"error.main"},...t&&{...a&&{bgcolor:alpha(e.palette.error.main,.08)},"&:hover .upload-placeholder":{opacity:1},"& img":{filter:"blur(0)"},"&:hover img":{filter:"blur(3px)"}}})),vo=styled("img")({width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",transition:"all 0.3s ease-in-out"}),Fo=styled(a)(({theme:e})=>({backgroundColor:alpha(e.palette.grey[900],.72),color:e.palette.common.white,"&:hover":{backgroundColor:alpha(e.palette.grey[600],.64),color:e.palette.common.white},"& svg":{width:14,height:14}}));var xr=({onRemove:e,sx:o,file:r,disableDrag:a,attributes:t,listeners:s,innerWidth:n,isDragging:d})=>{let c=r?.id;return c?jsx(gr,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(co,{width:n,isDragging:d,"data-testid":`preview-multi-img-${c}`,...j().inUp,sx:o,children:[jsx(a$2,{disableDrag:a,...t,...s}),jsx(Ee,{imageView:!0,file:r}),jsx(ke,{sx:{position:"absolute",right:3,top:3,zIndex:1},children:e&&jsx(Fo,{size:"small",label:"Remover arquivo",onClick:()=>e(r),icon:"DELETE_MARK_BUTTON_02"})})]})},`badge-${c}`):null},Eo=memo(xr);var Fr=({file:e$1,thumbnail:o,onRemove:r,sx:a$1,disableDrag:t=!1,disableTransitions:s=!1})=>{let n=e$1.size||0,d=e$1.name||e$1.id,c=e$1.id,m=typeof e$1=="string",l=t?70:80,{attributes:x,listeners:b,setNodeRef:I,transform:M,transition:E,isDragging:k}=useSortable({id:c,disabled:t}),z={transform:s?void 0:CSS.Transform.toString(M),transition:s?"none":E,opacity:s?.2:1,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${l+8}px`,height:"68px"};return o&&e$1?jsx(Xe,{ref:I,style:z,children:jsx(Eo,{innerWidth:l,isDragging:k,sx:a$1,file:e$1,disableDrag:t,attributes:x,listeners:b,onRemove:r})}):jsx(Xe,{ref:I,style:{...z,height:"80px",width:`${l+38}px`},children:jsxs(po,{width:l+30,isDragging:k,"data-testid":`preview-multi-img-${c}`,...j().inUp,sx:a$1,children:[jsx(a$2,{disableDrag:t,...x,...b}),e$1&&jsx(Ee,{file:e$1}),jsxs(he,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$3,{title:d,children:jsx(eo,{variant:"subtitle2",noWrap:!0,children:d})}),jsx(eo,{variant:"caption",sx:{color:"text.secondary"},children:m?"":e(n)})]}),jsx(ke,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$1),icon:"DELETE_MARK_BUTTON_02"})})]})})},Ao=memo(Fr);var kr=({thumbnail:e,files:o,onRemove:r,onReorder:a,sx:t})=>{let[s,n]=useState(!1),d=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),c=useCallback(l=>{let{active:x,over:b}=l;if(!(!x||!b||x.id===b.id)&&a){let I=o.findIndex(({id:E})=>E===x.id),M=o.findIndex(({id:E})=>E===b.id);I!==-1&&M!==-1&&(a(I,M,o),n(!0),setTimeout(()=>{n(!1);},300));}},[o,a]),m=jsx(AnimatePresence,{initial:!1,children:o.map(l=>jsx(Ao,{sx:t,id:`preview-file-${l.id}`,file:l,onRemove:r,thumbnail:e,disableDrag:!a,disableTransitions:s},`preview-file-${l.id}`))});return a?jsx(DndContext,{sensors:d,collisionDetection:closestCenter,onDragEnd:c,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:o.map(l=>l.id),strategy:horizontalListSortingStrategy,children:m})}):m},De=memo(kr);var Mo=forwardRef(({onLoading:e,aspectRatio:o,cropSize:r,...a},t)=>{let{maxWidth:s,maxHeight:n}=useMemo(()=>r&&typeof r=="object"?{maxWidth:r.width,maxHeight:r.height}:r&&typeof r=="number"?{maxWidth:r,maxHeight:r}:{maxWidth:"100%",maxHeight:"100%"},[r]);a$1(()=>{e?.(!0);}),useLayoutEffect(()=>{typeof t=="object"&&t?.current?e?.(!t.current.complete):e?.(!1);},[t,e]);let d=useCallback(()=>{e?.(!1);},[e]);return jsx(go,{...a,maxWidth:s,maxHeight:n,ref:t,aspectRatio:o,onLoad:d,onError:d})});Mo.displayName="LoadingPreviewImage";var Do=Mo;var qr=({file:e,aspectRatio:o=1,isUploading:r,isLoading:a,onLoading:t,cropSize:s,maxWidth:n,maxHeight:d,hoverAlt:c,fill:m})=>{let l=useRef(null),x=e?.id||"",b=e?.name||"",I=useMemo(()=>URL.createObjectURL(e),[e]);return useEffect(()=>()=>URL.revokeObjectURL(I),[I]),x?jsxs(uo,{className:"single-file-preview-box",children:[jsx(Do,{className:"single-file-preview-img",aspectRatio:o,cropSize:s,isLoading:a,isUploading:r,alt:b,src:I,ref:l,loading:"lazy",onLoading:t,onLoad:()=>t?.(!1),onError:()=>t?.(!1),maxWidth:n,maxHeight:d,fill:m},`image-preview-${x}`),jsx(xo,{className:"single-file-preview-bg",alt:b,src:I,isLoading:a,isUploading:r}),c&&jsx(ho,{className:"single-file-preview-hover-overlay",children:c})]}):null},Ke=memo(qr);var yo=["pdf"],_o=["txt"],Lo=["psd"],So=["doc","docx"],Oo=["xls","xlsx"],Uo=["zip","rar","iso"],To=["ai","eps"],Co=["ppt","pptx"],ko=["wav","aif","mp3","aac"],No=["jpg","jpeg","gif","bmp","png","svg","webp"],Bo=["m4v","avi","mpg","mp4","webm"];function Kr(e){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e.startsWith("audio/")?"audio":e==="application/pdf"?"pdf":e==="text/plain"?"txt":e==="application/msword"||e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"word":e==="application/vnd.ms-excel"||e==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"excel":e==="application/vnd.ms-powerpoint"||e==="application/vnd.openxmlformats-officedocument.presentationml.presentation"?"powerpoint":e==="application/zip"||e==="application/x-rar-compressed"||e==="application/x-iso9660-image"?"zip":e==="image/vnd.adobe.photoshop"?"photoshop":e==="application/illustrator"||e==="application/postscript"?"illustrator":null}function Wo(e,o){if(o){let a=Kr(o);if(a)return a}let r=jo(e);return _o.includes(r)?"txt":Uo.includes(r)?"zip":ko.includes(r)?"audio":No.includes(r)?"image":Bo.includes(r)?"video":So.includes(r)?"word":Oo.includes(r)?"excel":Co.includes(r)?"powerpoint":yo.includes(r)?"pdf":Lo.includes(r)?"photoshop":To.includes(r)?"illustrator":"file"}function Jr(e){let o=jo(e);return _o.includes(o)?"txt":Uo.includes(o)?"zip":ko.includes(o)?"audio":No.includes(o)?"image":Bo.includes(o)?"video":So.includes(o)?"word":Oo.includes(o)?"excel":Co.includes(o)?"powerpoint":yo.includes(o)?"pdf":Lo.includes(o)?"photoshop":To.includes(o)?"illustrator":e?.startsWith("http")?"image":o||"file"}function Go(e){let o;switch(Jr(e)){case"folder":o="IC_FOLDER";break;case"txt":o="IC_TXT";break;case"zip":o="IC_ZIP";break;case"audio":o="IC_AUDIO";break;case"video":o="IC_VIDEO";break;case"word":o="IC_WORD";break;case"excel":o="IC_EXCEL";break;case"powerpoint":o="IC_POWER_POINT";break;case"pdf":o="IC_PDF";break;case"photoshop":o="IC_PTS";break;case"illustrator":o="IC_AI";break;case"image":o="IC_IMG";break;default:o="IC_FILE";}return o}function jo(e){return e&&e.split(".").pop()||""}function Ia(e){return e.split("/").pop()}var Be={root:"mnl__file__thumbnail__root",img:"mnl__file__thumbnail__img",icon:"mnl__file__thumbnail__icon",removeBtn:"mnl__file__thumbnail__remove__button",downloadBtn:"mnl__file__thumbnail__download__button"},Ee=({sx:e,file:o,tooltip:r,onRemove:a,imageView:t,slotProps:s,onDownload:n,...d})=>{let c=useMemo(()=>o.size>0?URL.createObjectURL(o):o.url,[o]),m=o?.name||"",l=Wo(m,o.type);useEffect(()=>{if(o.size>0)return ()=>URL.revokeObjectURL(c)},[o,c]);let x=jsx(ze,{component:"img",src:c,className:Be.img,sx:{width:1,height:1,objectFit:"cover",borderRadius:"inherit",...s?.img}}),b=jsx(a$4,{icon:Go(l),sx:{width:32,height:32,flexShrink:0,...e}}),I=jsxs(he,{component:"span",className:Be.root,sx:{width:36,height:36,flexShrink:0,borderRadius:1.25,alignItems:"center",position:"relative",display:"inline-flex",justifyContent:"center",...e},...d,children:[l==="image"&&t?x:b,a&&jsx(ot,{"aria-label":"Remover arquivo",onClick:a,className:Be.removeBtn,sx:s?.removeBtn,children:jsx(a$4,{icon:"CLOSE_MARK_BUTTON",width:24})}),n&&jsx(cr,{"aria-label":"Baixar arquivo",onClick:n,className:Be.downloadBtn,sx:s?.downloadBtn,size:"small",children:jsx(a$4,{icon:"ARROW_DOWN_CICLE",width:12})})]});return r?jsx(it,{arrow:!0,title:m,slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[0,-12]}}]}},children:I}):I};var _a=e=>e.startsWith("image/"),Zo=(e,o=.8)=>new Promise((r,a)=>{let t=document.createElement("canvas"),s=t.getContext("2d"),n=new Image;n.onload=()=>{t.width=n.width,t.height=n.height,s?(s.drawImage(n,0,0),t.toBlob(d=>{if(d){let c=new File([d],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});r(c);}else a(new Error("Falha ao converter para WebP"));},"image/webp",o)):a(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},n.onerror=()=>a(new Error("Falha ao carregar imagem")),n.src=URL.createObjectURL(e);}),Ho=(e,o=.8,r,a)=>new Promise((t,s)=>{let n=document.createElement("canvas"),d=n.getContext("2d"),c=new Image;c.onload=()=>{let{width:m,height:l}=c;r&&m>r&&(l=l*r/m,m=r),a&&l>a&&(m=m*a/l,l=a),n.width=m,n.height=l,d?(d.imageSmoothingEnabled=!0,d.imageSmoothingQuality="high",d.drawImage(c,0,0,m,l),n.toBlob(x=>{if(x){let b=new File([x],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});t(b);}else s(new Error("Falha ao comprimir imagem"));},"image/webp",o)):s(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},c.onerror=()=>s(new Error("Falha ao carregar imagem")),c.src=URL.createObjectURL(e);}),$o=e=>{let o=e.match(/filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i);return o?.[1]||o?.[2]||""},Xo=e=>`UTF-8''${encodeURIComponent(e)}`;var dt=({onFilesSelect:e$1,onFileSelect:o,onReorder:r,onRemove:a,uploadFiles:t,filesPreview:s,dropzoneOptions:n,enableCrop:d=!1,customAspectRatio:c,convertToWebp:m=!0,cropSize:l,maxFiles:x,compressionQuality:b=.8,maxCompressedWidth:I,maxCompressedHeight:M})=>{let{showErrorMessage:E}=a$7(),k=useMemo(()=>c||(l&&typeof l!="number"?l.width/l.height:1),[c,l]),[z,P]=useState([]),[R,u]=useState(!1),[A,U]=useState(null),[C,v]=useState(null),[f,w]=useState(""),[D,T]=useState(!1),[y,_]=useState([]),[W,K]=useState(0),[re,Z]=useState(0),se=g=>{if(g.length<1)return;let h=g[0];U(h),K(L=>L+1);let F=new FileReader;F.onload=()=>{w(F.result),u(!0);},F.readAsDataURL(h);},ge=(g,h)=>{v(h);},pe=async g=>!A||!C?null:new Promise(h=>{let F=document.createElement("canvas"),L=F.getContext("2d"),N=new Image;N.onload=async()=>{let{width:G,height:ce,x:ye,y:ir}=C,ar=Math.abs(k),_e=G,Le=ce;l&&typeof l=="object"?(_e=l.width,Le=l.height):l&&typeof l=="number"&&(_e=l,Le=l/ar),F.width=_e,F.height=Le,L?(L.drawImage(N,ye,ir,G,ce,0,0,_e,Le),F.toBlob(async io=>{if(io){let $e=new File([io],A.name,{type:A.type,lastModified:Date.now()});if(m)try{$e=await Zo($e,b);}catch(nr){E(nr,"Erro ao converter para WebP");}let ao=$e;ao.id=g,h(ao);}else h(null);},"image/png")):h(null);},N.src=f;}),de=async()=>{if(!(!A||!C||y.length===0)){T(!0);try{let g=y[0],h=await pe(g.id);if(h){let L=await t([h]);L&&(!e$1&&!o&&P(N=>[...N,...L]),e$1?.([...s||[],...L]),o?.(h));}u(!1),T(!1),w(""),U(null);let F=y.slice(1);_(F),se(F);}catch(g){E(g,"Erro ao processar imagem"),T(!1);}}},H=()=>{u(!1),T(!1),w(""),U(null),_([]),K(0),Z(0);},J=async g=>{if(g.length===0)return;let h=Object.keys(n?.accept||{}).some(L=>L.includes("image/")),F=z.length+g.length;if(x&&F>x){E(new Error(`M\xE1ximo de ${x} arquivos`),"Erro ao fazer upload");return}try{if(h&&d){let N=g.filter(G=>G.type.startsWith("image/")).map((G,ce)=>{let ye=G;return ye.id=`temp-crop-${Date.now()}-${ce}`,ye});Z(N.length),K(0),_(N),se(N);}else {let L=[];for(let G of g)if(G.type.startsWith("image/")&&m)try{let ce=await Ho(G,b,I,M);L.push(ce);}catch(ce){E(ce,"Erro ao comprimir imagem"),L.push(G);}else L.push(G);let N=await t(L);N&&(!e$1&&!o&&P(G=>[...G,...N]),e$1?.([...s||[],...N]),o?.(N[0]));}}catch(L){E(L,"Erro ao processar arquivos");}},Q=g=>{if(!g.length)return;let h=g[0]?.errors[0]?.code,F=n?.maxSize||3145728;E(h==="file-too-large"?new Error(`O arquivo excede o tamanho m\xE1ximo de ${e(F)}`):h==="file-invalid-type"?new Error("Formato de arquivo n\xE3o suportado"):g[0]?.errors[0]||new Error("Erro ao enviar arquivo"),"Erro ao fazer upload");},{getRootProps:te,getInputProps:ie,isDragActive:p,isDragReject:ae,fileRejections:Y}=useDropzone({onDrop:J,onDropRejected:Q,...n}),Ie=g=>{if(!g){a||P([]),a?.(void 0);return}let h=z.filter(F=>F.id!==g.id);a||P(h),a?.(g);},we=(g,h,F)=>{r?.(g,h,F);},xe=useRef("");return useEffect(()=>{let g=s?.map(h=>h.id).join(",")||"";g!==xe.current&&(xe.current=g,P(s||[]));},[s]),{file:z?.[0],files:z,aspectRatio:k,dropzoneProps:{getRootProps:te,getInputProps:ie,isDragActive:p,isDragReject:ae,fileRejections:Y},cropState:{cropModalOpen:R,imagePreview:f,cropLoading:D,setCropModalOpen:u,onCropInitialized:ge,handleCropSave:de,handleCropCancel:H,currentImageIndex:W,totalPendingImages:re},setInitialFiles:P,handleRemove:Ie,handleReorder:we}},X=dt;var Je=(p=>(p.APPLICATION_OCTET_STREAM="application/octet-stream",p.IMAGE_JPEG="image/jpeg",p.IMAGE_JPG="image/jpg",p.IMAGE_PNG="image/png",p.IMAGE_GIF="image/gif",p.IMAGE_WEBP="image/webp",p.IMAGE_SVG="image/svg+xml",p.IMAGE_BMP="image/bmp",p.IMAGE_TIFF="image/tiff",p.IMAGE_ICO="image/x-icon",p.IMAGE_AVIF="image/avif",p.APPLICATION_PDF="application/pdf",p.TEXT_PLAIN="text/plain",p.TEXT_CSV="text/csv",p.APPLICATION_RTF="application/rtf",p.APPLICATION_MSWORD="application/msword",p.APPLICATION_DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",p.APPLICATION_MSEXCEL="application/vnd.ms-excel",p.APPLICATION_XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",p.APPLICATION_MSPOWERPOINT="application/vnd.ms-powerpoint",p.APPLICATION_PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",p.APPLICATION_ODT="application/vnd.oasis.opendocument.text",p.APPLICATION_ODS="application/vnd.oasis.opendocument.spreadsheet",p.APPLICATION_ODP="application/vnd.oasis.opendocument.presentation",p.APPLICATION_XML="application/xml",p.TEXT_XML="text/xml",p.TEXT_HTML="text/html",p.TEXT_CSS="text/css",p.APPLICATION_JSON="application/json",p.TEXT_JAVASCRIPT="text/javascript",p.APPLICATION_ZIP="application/zip",p.APPLICATION_GZIP="application/gzip",p.APPLICATION_RAR="application/vnd.rar",p.APPLICATION_7Z="application/x-7z-compressed",p.AUDIO_MPEG="audio/mpeg",p.AUDIO_WAV="audio/wav",p.AUDIO_OGG="audio/ogg",p.AUDIO_WEBM="audio/webm",p.AUDIO_AAC="audio/aac",p.VIDEO_MP4="video/mp4",p.VIDEO_MPEG="video/mpeg",p.VIDEO_OGG="video/ogg",p.VIDEO_WEBM="video/webm",p.VIDEO_QUICKTIME="video/quicktime",p))(Je||{}),We=(e=>(e["application/octet-stream"]="APPLICATION_OCTET_STREAM",e["image/jpeg"]="IMAGE_JPEG",e["image/jpg"]="IMAGE_JPG",e["image/png"]="IMAGE_PNG",e["image/gif"]="IMAGE_GIF",e["image/webp"]="IMAGE_WEBP",e["image/svg+xml"]="IMAGE_SVG",e["image/bmp"]="IMAGE_BMP",e["image/tiff"]="IMAGE_TIFF",e["image/x-icon"]="IMAGE_ICO",e["image/avif"]="IMAGE_AVIF",e["application/pdf"]="APPLICATION_PDF",e["text/plain"]="TEXT_PLAIN",e["text/csv"]="TEXT_CSV",e["application/rtf"]="APPLICATION_RTF",e["application/msword"]="APPLICATION_MSWORD",e["application/vnd.openxmlformats-officedocument.wordprocessingml.document"]="APPLICATION_DOCX",e["application/vnd.ms-excel"]="APPLICATION_MSEXCEL",e["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]="APPLICATION_XLSX",e["application/vnd.ms-powerpoint"]="APPLICATION_MSPOWERPOINT",e["application/vnd.openxmlformats-officedocument.presentationml.presentation"]="APPLICATION_PPTX",e["application/vnd.oasis.opendocument.text"]="APPLICATION_ODT",e["application/vnd.oasis.opendocument.spreadsheet"]="APPLICATION_ODS",e["application/vnd.oasis.opendocument.presentation"]="APPLICATION_ODP",e["application/xml"]="APPLICATION_XML",e["text/xml"]="TEXT_XML",e["text/html"]="TEXT_HTML",e["text/css"]="TEXT_CSS",e["application/json"]="APPLICATION_JSON",e["text/javascript"]="TEXT_JAVASCRIPT",e["application/zip"]="APPLICATION_ZIP",e["application/gzip"]="APPLICATION_GZIP",e["application/vnd.rar"]="APPLICATION_RAR",e["application/x-7z-compressed"]="APPLICATION_7Z",e["audio/mpeg"]="AUDIO_MPEG",e["audio/wav"]="AUDIO_WAV",e["audio/ogg"]="AUDIO_OGG",e["audio/webm"]="AUDIO_WEBM",e["audio/aac"]="AUDIO_AAC",e["video/mp4"]="VIDEO_MP4",e["video/mpeg"]="VIDEO_MPEG",e["video/ogg"]="VIDEO_OGG",e["video/webm"]="VIDEO_WEBM",e["video/quicktime"]="VIDEO_QUICKTIME",e))(We||{});var ut=({createFilesMutation:e,filesDetails:o})=>{let{showErrorMessage:r}=a$7(),[a,t]=useState(!1),[s,n]=useState(!1),[d,c]=useState(null),[m,l]=useState([]),x=useMemo(()=>m?.[0],[m]),b=s||a,I=useCallback(async P=>{if(!P.length){l([]),n(!1);return}n(!0);try{let u=(await Promise.all(P.map(async({url:A,id:U,name:C})=>{try{if(!A)return null;let v=await fetch(A);if(!v.ok)throw new Error(v.statusText);let f=await v.blob(),w=null;if(!C){let y=v.headers.get("content-disposition")||void 0;if(y){let _=$o(y);if(_)try{w=decodeURIComponent(_);}catch{w=_;}}}let D=w||C||U,T=new File([f],D,{type:f.type});return T.id=U,T.url=A,T}catch{return null}}))).filter(Boolean);l(u),n(!1);}catch(R){r(R,"Erro ao carregar arquivos"),l([]),n(!1);}},[r]),M=useRef("");useEffect(()=>{let P=o?.map(({id:R})=>R).join(",")||"";P!==M.current&&(async()=>(M.current=P,await I(o)))();},[o,I]);let E=async P=>{if(!P||!Array.isArray(P))throw new Error("Arquivos inv\xE1lidos");let R=P.filter(u=>u instanceof File);if(R?.length){t(!0);try{let u=R.map(v=>{let f=v.type||"application/octet-stream",w=We[f];if(!w)throw new Error(`Tipo de arquivo n\xE3o suportado: ${f}`);return {file:v,mimeType:f,contentTypeEnum:w}}),A=await e({files:u.map(({file:v,contentTypeEnum:f})=>({content_type:f,name:v.name}))}).unwrap(),U=A.files.map((v,f)=>{let w=u[f].file,D=w;return D.id=v.id,D.url=URL.createObjectURL(w),D});return await(await Promise.all(A.files.map((v,f)=>{let{mimeType:w}=u[f],D=U[f];return fetch(v.url,{method:"PUT",headers:{"Content-Type":w,"Content-Disposition":`inline; filename*=${Xo(D.name)}`,"X-File-Id":v.id},body:D})}))).forEach(async v=>{if(!v.ok)throw new Error("Erro no upload do arquivo.")}),U}catch(u){throw c(u),r(u,"Erro no upload"),u}finally{t(!1);}}},k=useMemo(()=>d&&d instanceof Error?d.message:d,[d]),z=useMemo(()=>o.filter(P=>!m.some(R=>R.id===P.id)),[o,m]);return {setFilesPreview:l,uploadFiles:E,filesPreview:m,filePreview:x,isLoadingPreview:s,isUploadingFiles:a,isUploadOrLoadingFiles:b,uploadErrorText:k,invalidFiles:z}},q=ut;var xt=({sx:e,id:o,name:r,tabIndex:a,uploading:t,getRootProps:s,getInputProps:n,isDragActive:d,isError:c,disabled:m,dropZoneSxProps:l,dropZoneContent:x,children:b,...I})=>jsxs(Ce,{children:[t&&jsx(a$6,{"data-testid":"uploading-progress-bar",sx:{zIndex:1}}),jsxs(ze,{sx:{width:1,position:"relative",...e},children:[jsxs(lo,{...s(),"data-testid":"drop-zone-styled-area",isError:c,isDragActive:d,disabled:!!m,sx:l,...I,children:[jsx("input",{...n(),id:o,tabIndex:a,name:r}),x]}),b]})]}),me=xt;function Ko(){let e=useTheme(),o=useId(),r=e.vars.palette.primary.main;return jsxs(Fragment,{children:[jsx("defs",{children:jsxs("linearGradient",{id:o,x1:"19.496%",x2:"77.479%",y1:"71.822%",y2:"16.69%",children:[jsx("stop",{offset:"0%",stopColor:r}),jsx("stop",{offset:"100%",stopColor:r,stopOpacity:"0"})]})}),jsx("path",{fill:`url(#${o})`,fillRule:"nonzero",d:"M0 198.78c0 41.458 14.945 79.236 39.539 107.786 28.214 32.765 69.128 53.365 114.734 53.434a148.44 148.44 0 0056.495-11.036c9.051-3.699 19.182-3.274 27.948 1.107a75.779 75.779 0 0033.957 8.01c5.023 0 9.942-.494 14.7-1.433 13.58-2.67 25.94-8.99 36.09-17.94 6.378-5.627 14.547-8.456 22.897-8.446h.142c27.589 0 53.215-8.732 74.492-23.696 19.021-13.36 34.554-31.696 44.904-53.224C474.92 234.58 480 213.388 480 190.958c0-76.93-59.774-139.305-133.498-139.305-7.516 0-14.88.663-22.063 1.899C305.418 21.42 271.355 0 232.499 0a103.651 103.651 0 00-45.88 10.661c-13.24 6.487-25.011 15.705-34.64 26.939-32.698.544-62.931 11.69-87.676 30.291C25.351 97.155 0 144.882 0 198.781z",opacity:"0.2"})]})}function Et({hideBackground:e,sx:o,...r}){let a=useTheme(),t=a.vars.palette.primary.main,s=a.vars.palette.primary.dark,n=a.vars.palette.primary.darker;return jsxs(ze,{component:"svg",width:"100%",height:"100%",viewBox:"0 0 480 360",xmlns:"http://www.w3.org/2000/svg",sx:{width:320,maxWidth:1,flexShrink:0,height:"auto",...o},...r,children:[!e&&jsx(Ko,{}),jsx("defs",{children:jsxs("linearGradient",{id:"linearGradient-2",x1:"30.113%",x2:"30.113%",y1:"0%",y2:"100%",children:[jsx("stop",{offset:"0%",stopOpacity:"0"}),jsx("stop",{offset:"100%"})]})}),jsx("path",{fill:"#FF4842",fillRule:"nonzero",d:"M293.006 206.192c-2.248 2.672-4.676 2.628-6.123 2.251l.054-1.384s5.979-2.733 5.827-2.159c-.057.215.057.733.242 1.292zM309.393 209.217c-3.818 2.206-6.058-.38-6.578-1.112.32-.84.801-2.204.703-2.592-.144-.577 5.827 2.155 5.827 2.155l.048 1.549zM305.303 187.204s3.632-2.093 4.425-1.151c.792.942-4.425 1.151-4.425 1.151zM307.497 188.355s-.598.299.721.681c1.318.383-.721-.681-.721-.681zM285.532 182.599c-.123.036 3.022 2.123 5.862.395-.012 0-5.154-.61-5.862-.395zM291.239 186.591s-.861 1.692-2.625 1.943c-1.764.251 2.625-1.943 2.625-1.943zM302.785 190.262s4.138 6.578 3.346 8.129c-.793 1.552-3.346-8.129-3.346-8.129zM294.62 216.416c0 .368 0 .712-.036.996-.107 1.33-3.381.828-3.381.828-2.99.416-4.066-1.019-4.422-2.392a5.444 5.444 0 01-.164-1.363 5.606 5.606 0 01.054-.819v-.272a1.998 1.998 0 011.859.379c1.331 1.08 3.095.252 3.095.252s1.294.107 1.793.538c.281.242.745-.341 1.098-.897.021.359.054 1.007.074 1.701.024.356.03.714.03 1.049z",opacity:"0.05"}),jsx("path",{fill:"#FF4842",fillRule:"nonzero",d:"M289.37 216.339s-.897.879-2.589-.479a5.444 5.444 0 01-.164-1.363c.864.658 2.466 1.842 2.753 1.842zM294.62 216.416a.67.67 0 01-.519.132.672.672 0 01-.452-.287c.348-.266.669-.566.956-.897.009.359.015.717.015 1.052zM301.637 217.032c0 .371 0 .715.033.996.108 1.333 3.382.828 3.382.828 2.989.419 4.066-1.017 4.421-2.392a5.728 5.728 0 00.111-2.182v-.272a2.024 2.024 0 00-1.862.379c-1.331 1.08-3.092.251-3.092.251s-1.294.111-1.794.542c-.281.242-.744-.341-1.094-.897a61.426 61.426 0 00-.078 1.701c-.024.35-.03.708-.027 1.046z",opacity:"0.05"}),jsx("path",{fill:"#FF4842",fillRule:"nonzero",d:"M306.887 216.949s.897.879 2.587-.479c.112-.444.169-.901.167-1.36-.867.655-2.47 1.839-2.754 1.839zM301.637 217.032a.67.67 0 00.969-.155 6.35 6.35 0 01-.957-.897c-.009.356-.014.714-.012 1.052zM319.614 106.269c.063-.138.123-.275.18-.41.057-.134.077-.209.11-.317-.11.237-.206.48-.29.727z",opacity:"0.05"}),jsx("path",{fill:n,fillRule:"nonzero",d:"M157.592 279.461a4.114 4.114 0 01-.917-3.131l13.196-107.979 1.094-8.97a4.142 4.142 0 014.078-3.635l38.654-.257a4.135 4.135 0 004.108-4.249l-.015-.409a4.14 4.14 0 014.135-4.279h40.619a4.134 4.134 0 014.098 4.682 4.137 4.137 0 003.995 4.682l39.01.996a4.13 4.13 0 013.97 4.831l-19.502 113.909-.368 2.152a4.042 4.042 0 01-.598 1.543l-135.557.114z"}),jsx("path",{fill:"#FFF",fillRule:"nonzero",d:"M251.256817 123.296578L274.098317 123.296578 274.098317 200.823078 251.256817 200.823078z",transform:"rotate(34.64 262.678 162.06)"}),jsx("path",{fill:"#FFC107",fillRule:"nonzero",d:"M270.624591 129.857671L286.750291 129.857671 286.750291 145.983371 270.624591 145.983371z",transform:"rotate(34.804 278.687 137.92)"}),jsx("path",{fill:"#FFC107",fillRule:"nonzero",d:"M260.275579 145.813111L276.423079 145.813111 276.423079 161.960611 260.275579 161.960611z",opacity:"0.5",transform:"rotate(34.64 268.35 153.887)"}),jsx("path",{fill:"#FFC107",fillRule:"nonzero",d:"M249.191579 161.852111L265.339079 161.852111 265.339079 177.999611 249.191579 177.999611z",opacity:"0.3",transform:"rotate(34.64 257.265 169.926)"}),jsx("path",{fill:"#FFF",fillRule:"nonzero",d:"M237.472537 121.334214L260.314037 121.334214 260.314037 198.567714 237.472537 198.567714z",transform:"rotate(16.29 248.893 159.951)"}),jsx("path",{fill:"#FF4842",fillRule:"nonzero",d:"M249.053192 123.761554L265.200692 123.761554 265.200692 139.909054 249.053192 139.909054z",transform:"rotate(16.29 257.127 131.835)"}),jsx("path",{fill:"#FF4842",fillRule:"nonzero",d:"M243.584192 142.473554L259.731692 142.473554 259.731692 158.621053 243.584192 158.621053z",opacity:"0.5",transform:"rotate(16.29 251.658 150.547)"}),jsx("path",{fill:"#FF4842",fillRule:"nonzero",d:"M238.116192 161.182554L254.263692 161.182554 254.263692 177.330054 238.116192 177.330054z",opacity:"0.3",transform:"rotate(16.29 246.19 169.256)"}),jsx("path",{fill:"#FFF",fillRule:"nonzero",d:"M230.099192 121.641542L252.940692 121.641542 252.940692 198.875042 230.099192 198.875042z",transform:"rotate(4.6 241.52 160.258)"}),jsx("path",{fill:"#1890FF",fillRule:"nonzero",d:"M235.800489 122.985499L251.947989 122.985499 251.947989 139.132999 235.800489 139.132999z",transform:"rotate(4.6 243.874 131.06)"}),jsx("path",{fill:"#1890FF",fillRule:"nonzero",d:"M234.234488 142.413498L250.381988 142.413498 250.381988 158.560998 234.234488 158.560998z",opacity:"0.5",transform:"rotate(4.6 242.308 150.487)"}),jsx("path",{fill:"#1890FF",fillRule:"nonzero",d:"M232.672488 161.846499L248.819988 161.846499 248.819988 177.993999 232.672488 177.993999z",opacity:"0.3",transform:"rotate(4.6 240.746 169.92)"}),jsx("path",{fill:"#FFF",fillRule:"nonzero",d:"M224.736657 123.384871L247.578157 123.384871 247.578157 200.618371 224.736657 200.618371z",transform:"rotate(-2.61 236.157 162.002)"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M226.751283 124.659968L242.898783 124.659968 242.898783 140.807468 226.751283 140.807468z",transform:"rotate(-2.61 234.825 132.734)"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M228.305601 143.479224L244.473301 143.479224 244.473301 159.646924 228.305601 159.646924z",opacity:"0.5",transform:"rotate(-2.862 236.39 151.563)"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M228.525282 163.608968L244.672782 163.608968 244.672782 179.756468 228.525282 179.756468z",opacity:"0.3",transform:"rotate(-2.61 236.599 171.683)"}),jsx("path",{fill:"#F4F6F8",fillRule:"nonzero",d:"M232.679 225.726l-20.294 7.851-29.661 11.466c-1.121-2.093-2.771-4.921-4.813-8.297-7.026-11.642-18.65-29.75-29.001-45.665-11.66-17.938-21.696-33.075-21.696-33.075l7.265-2.093 59.346-17.23 38.854 87.043z"}),jsx("path",{fill:"#000",fillRule:"nonzero",d:"M232.679 225.726l-20.294 7.851a152.535 152.535 0 01-34.484 3.169c-7.026-11.642-18.65-29.75-29-45.665l-14.42-35.18 59.343-17.218 38.855 87.043z",opacity:"0.1"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M247.777 220.841s-31.526 18.65-78.596 14.432l-37.525-91.486 17.984-3.091 62.168-10.677 35.279 89.043.69 1.779z"}),jsx("path",{fill:"#FF4842",fillRule:"nonzero",d:"M247.075 219.074c-7.424.365-16.013.329-24.654-.702-9.351-1.101-18.757-3.367-26.82-7.523-6.742-3.471-12.506-7.247-17.532-11.776-13.074-11.759-21.164-28.579-28.429-58.365l62.168-10.677 35.267 89.043z",opacity:"0.1"}),jsx("path",{fill:"#FFF",fillRule:"nonzero",d:"M270.203 213.959s-23.239 4.55-46.894 1.749c-9.351-1.1-18.757-3.367-26.82-7.522-6.742-3.471-12.503-7.247-17.532-11.777-16.181-14.557-24.725-36.866-33.536-81.918 0 0 38.633 9.325 76.836-11.101-.012.015 12.865 80.373 47.946 110.569z"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M165.405 131.03s31.416-1.776 40.187-8.548l1.331 4.276s-20.758 9.157-41.518 9.268v-4.996zM165.405 152.137s30.417-1.665 53.399-12.766l.777 1.776s-18.237 10.647-54.176 13.433v-2.443zM167.853 160.362s30.418-1.665 53.397-12.766l.777 1.776s-18.237 10.643-54.174 13.433v-2.443zM170.299 168.599s30.417-1.666 53.399-12.766l.774 1.775s-18.237 10.647-54.173 13.433v-2.442zM172.748 176.835s30.417-1.665 53.396-12.766l.777 1.776s-18.237 10.647-54.173 13.433v-2.443zM175.193 185.075s30.417-1.665 53.399-12.766l.774 1.776s-18.237 10.643-54.173 13.433v-2.443z",opacity:"0.3"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M389.069 287.344s-12.641-.762-11.152 8.097c0 0-.299 1.563 1.124 2.275 0 0 .021-.658 1.295-.434.454.077.916.099 1.375.066a2.832 2.832 0 001.677-.694c.468-.409 3.555-1.468 4.936-7.274 0 0 1.023-1.267.981-1.593l-2.132.897s.73 1.54.156 2.816c0 0-.069-2.759-.479-2.691-.083 0-1.109.533-1.109.533s1.253 2.69.299 4.628c0 0 .359-3.304-.699-4.434l-1.495.876s1.465 2.768.472 5.029c0 0 .254-3.465-.789-4.817l-1.361 1.062s1.379 2.729.539 4.604c0 0-.111-4.036-.835-4.341 0 0-1.195 1.049-1.369 1.494 0 0 .942 1.98.356 3.026 0 0-.359-2.691-.652-2.691 0 0-1.196 1.794-1.309 2.99 0 0 .051-1.818 1.022-3.172a3.593 3.593 0 00-1.818.942s.186-1.262 2.111-1.37c0 0 .981-1.351 1.241-1.435 0 0-1.914-.158-3.074.356 0 0 1.023-1.196 3.427-.649l1.342-1.094s-2.52-.347-3.588.036c0 0 1.229-1.052 3.95-.299l1.462-.873s-2.147-.463-3.426-.299c0 0 1.348-.729 3.856.06l1.044-.47s-1.573-.299-2.033-.358c-.461-.06-.488-.174-.488-.174a5.426 5.426 0 012.957.329s2.222-.813 2.186-.954z"}),jsx("ellipse",{cx:"380.363",cy:"298.487",fill:t,fillRule:"nonzero",opacity:"0.1",rx:"8.945",ry:"1.513"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M394.956 258.102s-7.125-.43-6.279 4.565a1.218 1.218 0 00.631 1.283s.015-.371.733-.245c.255.042.515.054.774.036.349-.023.681-.159.945-.389.264-.23 2.003-.828 2.783-4.102 0 0 .577-.714.553-.897l-1.196.511s.41.87.087 1.591c0 0-.039-1.558-.269-1.522-.048 0-.625.299-.625.299s.706 1.495.173 2.61c0 0 .204-1.862-.394-2.502l-.846.496s.825 1.561.266 2.834c0 0 .143-1.955-.446-2.714l-.765.598s.774 1.539.299 2.595c0 0-.063-2.275-.469-2.446a4.75 4.75 0 00-.775.834s.532 1.118.204 1.707c0 0-.204-1.515-.368-1.521 0 0-.67 1.001-.739 1.689a3.671 3.671 0 01.577-1.794 2.007 2.007 0 00-1.025.532s.104-.711 1.196-.771c0 0 .553-.763.699-.81 0 0-1.079-.09-1.734.2 0 0 .577-.67 1.932-.365l.759-.619s-1.423-.194-2.024.021c0 0 .694-.598 2.227-.161l.826-.494a7.445 7.445 0 00-1.935-.164s.763-.413 2.174.033l.598-.263s-.897-.177-1.148-.203c-.252-.027-.275-.099-.275-.099a3.078 3.078 0 011.668.185s1.232-.46 1.208-.538z"}),jsx("ellipse",{cx:"390.052",cy:"264.383",fill:t,fillRule:"nonzero",opacity:"0.1",rx:"5.044",ry:"1"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M352.896 262.437s-8.604-.52-7.588 5.51a1.47 1.47 0 00.763 1.549s0-.449.897-.299c.309.052.623.067.935.045a1.923 1.923 0 001.142-.473c.318-.279 2.419-.998 3.361-4.951 0 0 .697-.861.667-1.085l-1.468.622s.496 1.046.104 1.916c0 0-.048-1.877-.326-1.835-.056 0-.753.364-.753.364s.852 1.824.209 3.152c0 0 .245-2.249-.475-3.02l-1.023.598s.996 1.886.32 3.423c0 0 .174-2.359-.535-3.289l-.927.724s.939 1.857.365 3.133c0 0-.072-2.747-.565-2.954 0 0-.81.715-.933 1.008 0 0 .64 1.348.242 2.06 0 0-.245-1.83-.445-1.839 0 0-.804 1.214-.897 2.042.04-.768.28-1.512.697-2.159a2.427 2.427 0 00-1.235.643s.125-.858 1.435-.933c0 0 .667-.92.846-.974 0 0-1.303-.111-2.093.239 0 0 .694-.807 2.329-.44l.915-.747s-1.713-.233-2.442.024c0 0 .837-.715 2.69-.191l.996-.598s-1.462-.314-2.335-.201c0 0 .921-.496 2.625.042l.711-.32s-1.07-.209-1.384-.242c-.314-.033-.329-.119-.329-.119a3.69 3.69 0 012.012.221s1.519-.553 1.492-.646z"}),jsx("ellipse",{cx:"346.97",cy:"270.022",fill:t,fillRule:"nonzero",opacity:"0.1",rx:"6.09",ry:"1.028"}),jsx("rect",{width:"51.026",height:"91.312",x:"303.926",y:"69.211",fill:"#FFF",fillRule:"nonzero",rx:"4.737",transform:"rotate(-71.99 329.44 114.867)"}),jsx("circle",{cx:"303.613",cy:"103.507",r:"9.376",fill:t,fillRule:"nonzero",opacity:"0.2"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M344.582495 86.4883769L347.150665 86.4883769 347.150665 127.336977 344.582495 127.336977z",opacity:"0.2",transform:"rotate(-71.99 345.867 106.913)"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M333.028401 99.6373982L335.596571 99.6373982 335.596571 120.445898 333.028401 120.445898z",opacity:"0.2",transform:"rotate(-71.99 334.312 110.042)"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M337.109071 101.431004L339.677241 101.431004 339.677241 135.086304 337.109071 135.086304z",opacity:"0.2",transform:"rotate(-71.99 338.393 118.259)"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M338.505494 105.174377L341.073664 105.174377 341.073664 146.022978 338.505494 146.022978z",opacity:"0.2",transform:"rotate(-71.99 339.79 125.599)"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M348.060839 134.648161L353.026769 134.648161 353.026769 145.952261 348.060839 145.952261z",opacity:"0.5",transform:"rotate(-71.99 350.544 140.3)"}),jsx("rect",{width:"50.3",height:"78.305",x:"291.549",y:"174.486",fill:"#FFF",fillRule:"nonzero",rx:"4",transform:"rotate(-57.265 316.7 213.638)"}),jsx("path",{fill:"#DFE3E8",fillRule:"nonzero",d:"M278.038439 203.88874L292.269539 203.88874 292.269539 207.23723 278.038439 207.23723z",transform:"rotate(-57.57 285.154 205.563)"}),jsx("path",{fill:"#DFE3E8",fillRule:"nonzero",d:"M283.007935 199.201889L314.262535 199.201889 314.262535 202.272339 283.007935 202.272339z",transform:"rotate(-57.57 298.635 200.737)"}),jsx("path",{fill:"#DFE3E8",fillRule:"nonzero",d:"M288.543935 202.715889L319.798535 202.715889 319.798535 205.786339 288.543935 205.786339z",transform:"rotate(-57.57 304.171 204.251)"}),jsx("path",{fill:"#DFE3E8",fillRule:"nonzero",d:"M294.078936 206.235889L325.333536 206.235889 325.333536 209.306339 294.078936 209.306339z",transform:"rotate(-57.57 309.706 207.771)"}),jsx("path",{fill:"#DFE3E8",fillRule:"nonzero",d:"M299.879919 211.40702L331.090719 211.40702 331.090719 214.47316 299.879919 214.47316z",transform:"rotate(-57.265 315.485 212.94)"}),jsx("path",{fill:"#F4F6F8",fillRule:"nonzero",d:"M305.149936 213.268889L336.404536 213.268889 336.404536 216.339339 305.149936 216.339339z",transform:"rotate(-57.57 320.777 214.804)"}),jsx("path",{fill:"#F4F6F8",fillRule:"nonzero",d:"M310.685935 216.782889L341.940535 216.782889 341.940535 219.853339 310.685935 219.853339z",transform:"rotate(-57.57 326.313 218.318)"}),jsx("path",{fill:"#DFE3E8",fillRule:"nonzero",d:"M341.417983 210.406958L349.511163 210.406958 349.511163 218.500138 341.417983 218.500138z",transform:"rotate(-57.57 345.465 214.454)"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M269.277 168.76l-45.767.493a3.127 3.127 0 00-3.094 3.125v3.782a3.127 3.127 0 01-3.05 3.124l-33.024.792a3.124 3.124 0 01-3.095-2.308l-1.551-5.701a3.124 3.124 0 00-3.053-2.308l-44.113.475a3.125 3.125 0 00-3.05 3.648l17.747 104.449a3.129 3.129 0 003.071 2.604l139.363.598a3.129 3.129 0 003.082-3.714l-20.366-106.521a3.125 3.125 0 00-3.1-2.538z"}),jsx("path",{fill:s,fillRule:"nonzero",d:"M269.277 168.76l-45.767.493a3.127 3.127 0 00-3.094 3.125v3.782a3.127 3.127 0 01-3.05 3.124l-33.024.792a3.124 3.124 0 01-3.095-2.308l-1.551-5.701a3.124 3.124 0 00-3.053-2.308l-44.113.475a3.125 3.125 0 00-3.05 3.648l17.747 104.449a3.129 3.129 0 003.071 2.604l139.363.598a3.129 3.129 0 003.082-3.714l-20.366-106.521a3.125 3.125 0 00-3.1-2.538z",opacity:"0.243"}),jsx("path",{fill:"url(#linearGradient-2)",fillRule:"nonzero",d:"M269.277 168.76l-45.767.493a3.127 3.127 0 00-3.094 3.125v3.782a3.127 3.127 0 01-3.05 3.124l-33.024.792a3.124 3.124 0 01-3.095-2.308l-1.551-5.701a3.124 3.124 0 00-3.053-2.308l-44.113.475a3.125 3.125 0 00-3.05 3.648l17.747 104.449a3.129 3.129 0 003.071 2.604l139.363.598a3.129 3.129 0 003.082-3.714l-20.366-106.521a3.125 3.125 0 00-3.1-2.538z",opacity:"0.32"}),jsx("ellipse",{cx:"119.593",cy:"258.664",fill:t,fillRule:"nonzero",opacity:"0.1",rx:"4.846",ry:"1"}),jsx("ellipse",{cx:"101.03",cy:"260.545",fill:t,fillRule:"nonzero",opacity:"0.1",rx:"4.846",ry:"1"}),jsx("ellipse",{cx:"108.459",cy:"265.905",fill:t,fillRule:"nonzero",opacity:"0.1",rx:"3.444",ry:"1"}),jsx("ellipse",{cx:"89.193",cy:"265.433",fill:t,fillRule:"nonzero",opacity:"0.1",rx:"3.444",ry:"1"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M100.925 260.398s6.796-22.279-1.064-31.204c-5.881-6.676-12.557-5.877-15.547-5.052a5.528 5.528 0 00-3.564 2.963c-1.046 2.254-.858 5.913 6.521 10.186 12.35 7.151 13.119 16.96 13.119 16.96l.535 6.147z"}),jsx("path",{stroke:n,strokeLinecap:"round",strokeWidth:"0.5",d:"M85.382 227.302s20.031 6.278 15.546 33.096M97.083 229.547s-2.76 1.86-1.88 4.655M87.39 231.203s1.687-1.716 3.741-.768M95.31 239.832s2.963-1.495 3.728.379M102.638 242.962s-2.224-.176-2.263.897"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M101.2 260.575s-7.961-16.193-10.147-15.846c-1.037.17-1.516 1.196-1.734 2.218a6.516 6.516 0 00.434 3.941c1.13 2.601 4.165 7.519 11.447 9.687z"}),jsx("path",{stroke:n,strokeLinecap:"round",strokeWidth:"0.5",d:"M91.113 247.808s8.353 12.115 9.968 12.647"}),jsx("path",{stroke:n,strokeLinecap:"round",strokeWidth:"0.5",d:"M90.344 249.701L92.293 249.701"}),jsx("path",{stroke:n,strokeLinecap:"round",strokeWidth:"0.5",d:"M92.68 254.132L95.738 254.263"}),jsx("path",{stroke:n,strokeLinecap:"round",strokeWidth:"0.5",d:"M94.542 250.586L94.21 252.179"}),jsx("path",{stroke:n,strokeLinecap:"round",strokeWidth:"0.5",d:"M97.792 255.432L97.732 256.879"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M100.964 260.575s7.959-16.193 10.144-15.846c1.041.17 1.519 1.196 1.734 2.218a6.514 6.514 0 01-.433 3.941c-1.13 2.601-4.168 7.519-11.445 9.687z"}),jsx("path",{stroke:n,strokeLinecap:"round",strokeWidth:"0.5",d:"M111.051 247.808s-8.371 12.115-9.97 12.647"}),jsx("path",{stroke:n,strokeLinecap:"round",strokeWidth:"0.5",d:"M111.82 249.701L109.871 249.701"}),jsx("path",{stroke:n,strokeLinecap:"round",strokeWidth:"0.5",d:"M109.485 254.132L106.426 254.263"}),jsx("path",{stroke:n,strokeLinecap:"round",strokeWidth:"0.5",d:"M107.622 250.586L107.954 252.179"}),jsx("path",{stroke:n,strokeLinecap:"round",strokeWidth:"0.5",d:"M104.372 255.432L104.432 256.879"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M87.295 264.357a1.375 1.375 0 01-.452-.685.599.599 0 01.317-.697c.3-.11.598.09.837.299.24.21.512.431.81.38a1.237 1.237 0 01-.382-1.16.47.47 0 01.105-.236c.161-.174.454-.099.648.039.598.43.787 1.264.79 2.018.03-.277.03-.555 0-.831a.853.853 0 01.334-.727.938.938 0 01.476-.114.988.988 0 01.774.222.767.767 0 01-.03.947c-.229.257-.5.474-.801.64a1.805 1.805 0 00-.571.547.399.399 0 00-.042.096h-1.74a4.826 4.826 0 01-1.073-.738zM117.626 257.833a1.355 1.355 0 01-.452-.682.599.599 0 01.314-.696c.299-.111.598.089.837.299.239.209.509.436.817.391a1.236 1.236 0 01-.386-1.157.472.472 0 01.107-.236c.162-.173.455-.099.649.036.613.433.787 1.268.79 2.021a4.008 4.008 0 000-.834.852.852 0 01.299-.736.955.955 0 01.475-.11.998.998 0 01.774.218.768.768 0 01-.033.951 2.996 2.996 0 01-.798.64 1.767 1.767 0 00-.571.544.499.499 0 00-.042.098h-1.701a4.78 4.78 0 01-1.079-.747zM107.518 264.357a1.406 1.406 0 01-.455-.685.6.6 0 01.317-.697c.299-.11.598.09.837.299.239.21.505.437.816.395a1.247 1.247 0 01-.385-1.16.472.472 0 01.107-.236c.162-.174.455-.099.649.039.613.43.783 1.264.789 2.018.03-.277.03-.555 0-.832a.855.855 0 01.314-.735.93.93 0 01.476-.114.988.988 0 01.774.222.764.764 0 01-.033.947 3.028 3.028 0 01-.798.64 1.798 1.798 0 00-.571.547.411.411 0 00-.042.096h-1.734c-.385-.2-.742-.45-1.061-.744z"}),jsx("circle",{cx:"84.467",cy:"87.003",r:"6.467",fill:t,fillRule:"nonzero",opacity:"0.1"}),jsx("circle",{cx:"395.425",cy:"138.681",r:"6.467",fill:t,fillRule:"nonzero",opacity:"0.1"}),jsx("circle",{cx:"279.178",cy:"66.467",r:"6.467",fill:t,fillRule:"nonzero",opacity:"0.1"}),jsx("circle",{cx:"97.4",cy:"122.68",r:"10.838",fill:t,fillRule:"nonzero",opacity:"0.1"}),jsx("path",{fill:s,fillRule:"nonzero",d:"M206.029 209.911c-7.975 0-14.44 6.465-14.44 14.44s6.465 14.44 14.44 14.44 14.44-6.465 14.44-14.44-6.465-14.44-14.44-14.44z"}),jsx("path",{fill:t,fillRule:"nonzero",d:"M206.029 211.59c7.047 0 12.761 5.714 12.761 12.761 0 7.048-5.714 12.761-12.761 12.761-7.048 0-12.761-5.713-12.761-12.761.006-7.045 5.716-12.754 12.761-12.761",opacity:"0.72"}),jsx("path",{fill:s,fillRule:"nonzero",d:"M200.058 225.406l-.699-.681a.721.721 0 010-1.065l6.127-5.984a.753.753 0 01.546-.231c.206 0 .404.083.545.231l6.127 5.978a.733.733 0 010 1.065l-.699.682a.768.768 0 01-1.091 0l-3.622-3.727v8.843a.725.725 0 01-.219.523.76.76 0 01-.534.217h-1.009a.75.75 0 01-.759-.74v-8.832l-3.622 3.726a.768.768 0 01-1.091-.005z"})]})}var Qo=memo(Et);var At=({header:e,description:o,sx:r,...a})=>jsxs(he,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...r},...a,children:[jsx(Qo,{sx:{width:220}}),jsxs("div",{children:[jsx(eo,{gutterBottom:!0,variant:"h5",children:e||"Soltar ou selecionar arquivos"}),jsx(eo,{variant:"body2",sx:{color:"text.secondary"},children:o||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(eo,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),fe=memo(At);var _t=({onRemove:e,onReorder:o,onFilesSelect:r,createFilesMutation:a,filesDetails:t=[],id:s,disabled:n,error:d,helperText:c,thumbnail:m,dropZoneSxProps:l,uploading:x,tabIndex:b,maxFiles:I,placeholderAlt:M,placeholderProps:E,...k})=>{let{filesPreview:z,isUploadOrLoadingFiles:P,uploadErrorText:R,uploadFiles:u}=q({createFilesMutation:a,filesDetails:t}),{files:A,dropzoneProps:U,handleRemove:C,handleReorder:v}=X({onFilesSelect:r,onReorder:o,onRemove:e,filesPreview:z,dropzoneOptions:{multiple:!0,disabled:n,...k},maxFiles:I,uploadFiles:u}),{getRootProps:f,getInputProps:w,isDragActive:D,isDragReject:T}=U,y=!!A?.filter(W=>!!W.id).length,_=T||!!d||!!R;return jsxs(me,{id:s,uploading:x||P,disabled:n,dropZoneSxProps:l,tabIndex:b,getRootProps:f,getInputProps:w,isDragActive:D,isError:_,dropZoneContent:jsx(Fragment,{children:M?jsx(he,{children:M}):jsx(fe,{header:E?.header,description:E?.description})}),children:[jsx(S,{disabled:n,helperText:c,isError:_}),d?jsx(S,{helperText:d,isError:!0}):null,R?jsx(S,{helperText:R,isError:!0}):null,y&&jsx(ze,{sx:{my:3},children:jsx(De,{files:A,thumbnail:!!m,onRemove:e?C:void 0,onReorder:o?v:void 0})})]})},Lt=memo(_t);var kt=({onRemove:e,onReorder:o,onFilesSelect:r,createFilesMutation:a,filesDetails:t=[],id:s,disabled:n,error:d,helperText:c,dropZoneSxProps:m,placeholderProps:l,placeholderAlt:x,uploading:b,tabIndex:I,maxFiles:M,aspectRatio:E,enableCrop:k=!0,convertToWebp:z=!0,cropSize:P,name:R,label:u,keepInvalidFiles:A=!1,...U})=>{let{filesPreview:C,isUploadOrLoadingFiles:v,uploadErrorText:f,uploadFiles:w,invalidFiles:D}=q({createFilesMutation:a,filesDetails:t}),T=b||v,{files:y,dropzoneProps:_,cropState:W,aspectRatio:K,handleRemove:re,handleReorder:Z}=X({onFilesSelect:r,onReorder:o,onRemove:e,filesPreview:C,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:n,...U},enableCrop:k,customAspectRatio:E,convertToWebp:z,maxFiles:M,cropSize:P,uploadFiles:w}),{getRootProps:se,getInputProps:ge,isDragActive:pe,isDragReject:de}=_,{cropModalOpen:H,imagePreview:J,cropLoading:Q,onCropInitialized:te,handleCropSave:ie,handleCropCancel:p,currentImageIndex:ae,totalPendingImages:Y}=W,Ie=useMemo(()=>{if(!A)return y;let h=D.map(F=>({...new File([],F.name??"invalid-file"),id:F.id,url:"url.invalid"}));return [...y,...h]},[A,y,D]),we=!!Ie?.filter(h=>!!h.id).length,xe=de||!!d||!!f,g=useMemo(()=>{let h=u??"Ajustar Imagem",F=Y>1||ae>1?` (${ae} de ${Y})`:"";return `${h}${F}`},[u,Y,ae]);return jsxs(me,{id:s,name:R,uploading:T,disabled:n,dropZoneSxProps:m,tabIndex:I,getRootProps:se,getInputProps:ge,isDragActive:pe,isError:xe,dropZoneContent:jsx(Fragment,{children:x?jsx(he,{children:x}):jsx(fe,{header:l?.header,description:l?.description})}),children:[jsx(S,{disabled:n,helperText:c,isError:xe}),d?jsx(S,{helperText:d,isError:!0}):null,f?jsx(S,{helperText:f,isError:!0}):null,we&&jsx(ze,{sx:{my:3,ml:.5},children:jsx(De,{files:Ie,thumbnail:!0,onRemove:re,onReorder:o?Z:void 0})}),jsx(a$5,{open:H,onClose:p,label:g,imageSrc:J,aspectRatio:K,onInitialized:te,onSave:ie,loading:Q,cropSize:P})]})},Nt=memo(kt);var Ht=({onFileSelect:e$1,onRemove:o,createFilesMutation:r,fileDetails:a,id:t,disabled:s,error:n,helperText:d,sx:c,dropZoneSxProps:m$1,uploading:l,tabIndex:x,placeholderAlt:b,placeholderProps:I,...M})=>{let{filesPreview:E,isUploadOrLoadingFiles:k,uploadErrorText:z,uploadFiles:P}=q({createFilesMutation:r,filesDetails:a?[a]:[]}),R=k||l,{file:u,dropzoneProps:A,handleRemove:U}=X({uploadFiles:P,onFileSelect:e$1,onRemove:o,filesPreview:E,dropzoneOptions:{multiple:!1,disabled:s,...M}}),{getRootProps:C,getInputProps:v,isDragActive:f,isDragReject:w}=A,D=useCallback(W=>{W.stopPropagation(),U(u||void 0);},[u,U]),T=!!u,y=typeof u=="string",_=w||!!n||!!z;return jsxs(me,{id:t,uploading:R,disabled:s,dropZoneSxProps:m$1,tabIndex:x,getRootProps:C,getInputProps:v,isDragActive:f,isError:_,dropZoneContent:jsxs(Fragment,{children:[!T&&(b?jsx(he,{...I,children:b}):jsx(fe,{})),T&&jsxs(he,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:W=>`solid 1px ${W.palette.divider}`,...c},children:[jsx(Ee,{file:u}),jsxs(he,{flexGrow:1,sx:{minWidth:0},children:[jsx(eo,{variant:"subtitle2",noWrap:!0,children:y?u:u.name}),jsx(eo,{variant:"caption",sx:{color:"text.secondary"},children:y?"":e(u.size)})]}),o&&jsx(a$3,{title:"Remover arquivo",children:jsx(so,{edge:"end",size:"small",disabled:s,"aria-label":"Remover arquivo",onClick:D,children:jsx(a$4,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:[jsx(S,{disabled:s,helperText:d,isError:_}),n?jsx(S,{helperText:n,isError:!0}):null,z?jsx(S,{helperText:z,isError:!0}):null]})},$t=memo(Ht);var Yt=({onRemove:e,onFileSelect:o,createFilesMutation:r,fileDetails:a,id:t,disabled:s,error:n,helperText:d,dropZoneSxProps:c,placeholderProps:m,placeholderAlt:l,hoverAlt:x,uploading:b,tabIndex:I,aspectRatio:M,enableCrop:E=!0,convertToWebp:k=!0,name:z,label:P,cropSize:R,sx:u,maxWidth:A,maxHeight:U,compressionQuality:C=.8,maxCompressedWidth:v,maxCompressedHeight:f,fill:w,...D})=>{let{filesPreview:T,isUploadOrLoadingFiles:y,uploadErrorText:_,uploadFiles:W}=q({createFilesMutation:r,filesDetails:a?[a]:[]}),[K,re]=useState(!1),{file:Z,dropzoneProps:se,cropState:ge,handleRemove:pe,aspectRatio:de}=X({onFileSelect:o,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:s,...D},filesPreview:T,enableCrop:E,customAspectRatio:M,convertToWebp:k,cropSize:R,uploadFiles:W,compressionQuality:C,maxCompressedWidth:v,maxCompressedHeight:f}),{getRootProps:H,getInputProps:J,isDragActive:Q,isDragReject:te}=se,{cropModalOpen:ie,imagePreview:p,cropLoading:ae,onCropInitialized:Y,handleCropSave:Ie,handleCropCancel:we}=ge,xe=useCallback(()=>{pe(Z||void 0);},[Z,pe]),g=!!Z,h=te||!!n||!!_,F=b||y,L=g?{opacity:0}:{opacity:1},N=c?.width;return useEffect(()=>{g||re(!1);},[g]),jsxs(Ce,{sx:{...u,...N&&{width:N}},children:[(F||K)&&jsx(a$6,{}),jsxs(me,{id:t,uploading:F,disabled:s,dropZoneSxProps:c,tabIndex:I,getRootProps:H,getInputProps:J,isDragActive:Q,isError:h,name:z,dropZoneContent:jsxs(Fragment,{children:[l?jsx(he,{sx:L,children:l}):jsx(fe,{sx:L,header:m?.title,description:m?.description}),g&&jsx(Ke,{file:Z,cropSize:R,isLoading:K,isUploading:F,onLoading:re,aspectRatio:de,maxWidth:A,maxHeight:U,hoverAlt:x,fill:w})]}),children:[jsx(S,{disabled:s,helperText:d,isError:h}),n?jsx(S,{helperText:n,isError:!0}):null,_?jsx(S,{helperText:_,isError:!0}):null,g&&e&&jsx(mo,{size:"small",onClick:xe,disabled:s,label:"Remover arquivo",children:jsx(a$4,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$5,{open:ie,onClose:we,label:P??"Ajustar Imagem",imageSrc:p,aspectRatio:de,onInitialized:Y,onSave:Ie,loading:ae,cropSize:R})]})]})},ei=memo(Yt);var li=({onRemove:e,onFileSelect:o,createFilesMutation:r,fileDetails:a,disabled:t,label:s,id:n,tabIndex:d,error:c,helperText:m,sx:l,name:x,maxSize:b,uploading:I,aspectRatio:M=1,enableCrop:E=!0,convertToWebp:k=!0,cropSize:z,...P})=>{let[R,u]=useState(!1),{filesPreview:A,isUploadOrLoadingFiles:U,uploadErrorText:C,uploadFiles:v}=q({createFilesMutation:r,filesDetails:a?[a]:[]}),{file:f,dropzoneProps:w,cropState:D,handleRemove:T}=X({filesPreview:A,onFileSelect:o,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:t,maxSize:b,...P},enableCrop:E,customAspectRatio:M,convertToWebp:k,cropSize:z,uploadFiles:v}),{getRootProps:y,getInputProps:_,isDragActive:W,isDragReject:K}=w,{cropModalOpen:re,imagePreview:Z,cropLoading:se,onCropInitialized:ge,handleCropSave:pe,handleCropCancel:de}=D,H=K||!!c||!!C,J=R||U||I,Q=!!e,te=useRef(a?.url||""),ie=useRef(void 0);useEffect(()=>{if(!f){te.current="",ie.current=void 0;return}if(ie.current===f.id)return;ie.current=f.id,u(!0);let Y=URL.createObjectURL(f);return te.current=Y,()=>{URL.revokeObjectURL(Y);}},[f]);let p=()=>{u(!1);},ae=useCallback(()=>Q&&f?()=>T(f):y().onClick,[Q,f,y,T]);return jsxs(Fragment,{children:[jsxs(he,{sx:{alignItems:"center"},children:[jsxs(Po,{sx:l,isError:H,isDragActive:W,hasFile:!!f,...y(),onClick:ae(),children:[jsxs(bo,{children:[J&&jsx(Io,{children:jsx(ni,{size:135,thickness:2,color:"primary"})}),f&&jsx(vo,{alt:"Avatar Preview",src:te.current,onLoad:p,...J&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),!f&&!J&&jsxs(qe,{isError:H,hasFile:!1,children:[jsx(a$4,{icon:"ADD_IMAGE",width:32}),jsx(eo,{variant:"caption",textAlign:"center",sx:{color:H?"error.main":"text.disabled"},children:"Adicionar foto"})]}),f&&!J&&jsxs(qe,{isError:H,hasFile:!0,children:[jsx(a$4,{icon:Q?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(eo,{variant:"caption",textAlign:"center",sx:{color:H?"error.main":"common.white"},children:Q?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:x,id:n,tabIndex:d,..._()})]}),jsx(he,{sx:{alignItems:"center",mt:-.5},children:jsx(S,{helperText:m,disabled:t,isError:H})}),C?jsx(S,{helperText:C,isError:!0}):null,c?jsx(S,{helperText:c,isError:!0}):null]}),re&&Z&&jsx(a$5,{open:re,onClose:de,label:s??"Ajustar Imagem",imageSrc:Z,aspectRatio:M,onInitialized:ge,onSave:pe,loading:se,cropSize:z,cropShape:"round"})]})},si=memo(li);var mi=({error:e,name:o,disabled:r,sx:a,...t})=>{let{getRootProps:s,getInputProps:n,isDragActive:d,isDragReject:c}=useDropzone({disabled:r,...t}),m=c||e;return jsxs(fo,{...s(),isDragActive:d,hasError:!!m,disabled:!!r,sx:a,"data-testid":"upload-box",children:[jsx("input",{name:o,...n()}),"Selecionar arquivo"]})},fi=memo(mi);
|
|
32
32
|
|
|
33
33
|
export { S as a, De as b, Ke as c, Kr as d, Wo as e, Jr as f, Go as g, jo as h, Ia as i, Be as j, Ee as k, _a as l, Zo as m, Ho as n, $o as o, Xo as p, X as q, Je as r, We as s, q as t, Lt as u, Nt as v, $t as w, ei as x, si as y, fi as z };
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-45GFZNTZ.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var R={["LAST_YEAR"]:"Ano passado",["LAST_MONTH"]:"M\xEAs passado",["LAST_28_DAYS"]:"\xDAltimos 28 dias",["LAST_7_DAYS"]:"\xDAltimos 7 dias",["LAST_WEEK"]:"Semana passada",["YESTERDAY"]:"Ontem",["TODAY"]:"Hoje",["TOMORROW"]:"Amanh\xE3",["NEXT_7_DAYS"]:"Pr\xF3ximos 7 dias",["NEXT_30_DAYS"]:"Pr\xF3ximos 30 dias",["NEXT_90_DAYS"]:"Pr\xF3ximos 90 dias",["NEXT_MONTH"]:"Pr\xF3ximo m\xEAs",["THIS_YEAR"]:"Este ano",["NEXT_YEAR"]:"Pr\xF3ximo ano",["CUSTOM"]:"Personalizado"},Y=["TODAY","YESTERDAY","LAST_7_DAYS","LAST_WEEK","LAST_28_DAYS","LAST_MONTH","LAST_YEAR","CUSTOM"],d=["TODAY","TOMORROW","NEXT_7_DAYS","NEXT_30_DAYS","NEXT_90_DAYS","NEXT_MONTH","THIS_YEAR","NEXT_YEAR","CUSTOM"],u=["LAST_YEAR","LAST_MONTH","LAST_28_DAYS","LAST_7_DAYS","LAST_WEEK","YESTERDAY","TODAY","TOMORROW","NEXT_7_DAYS","NEXT_30_DAYS","NEXT_90_DAYS","NEXT_MONTH","THIS_YEAR","NEXT_YEAR","CUSTOM"],p=a=>{switch(a){case"PAST":return Y;case"FUTURE":return d;default:return u}},O=a=>{switch(a){case"FUTURE":return "NEXT_7_DAYS";case"PAST":default:return "LAST_28_DAYS"}},l=(a,r)=>{if(a==="CUSTOM")return {initialDate:null,finalDate:null};let s=r?new Date(r):new Date,t=new Date(s),e=new Date(s);switch(a){case"TODAY":break;case"YESTERDAY":t.setDate(t.getDate()-1),e.setDate(e.getDate()-1);break;case"TOMORROW":t.setDate(t.getDate()+1),e.setDate(e.getDate()+1);break;case"LAST_7_DAYS":t.setDate(t.getDate()-6);break;case"LAST_28_DAYS":t.setDate(t.getDate()-27);break;case"LAST_WEEK":{e.setDate(e.getDate()-e.getDay()-1),t.setTime(e.getTime()),t.setDate(t.getDate()-6);break}case"LAST_MONTH":t.setMonth(t.getMonth()-1,1),e.setDate(0);break;case"LAST_YEAR":t.setFullYear(t.getFullYear()-1,0,1),e.setFullYear(e.getFullYear()-1,11,31);break;case"NEXT_7_DAYS":e.setDate(e.getDate()+6);break;case"NEXT_30_DAYS":e.setDate(e.getDate()+29);break;case"NEXT_90_DAYS":e.setDate(e.getDate()+89);break;case"NEXT_MONTH":t.setMonth(t.getMonth()+1,1),e.setMonth(e.getMonth()+2,0);break;case"THIS_YEAR":t.setMonth(0,1),e.setMonth(11,31);break;case"NEXT_YEAR":t.setFullYear(t.getFullYear()+1,0,1),e.setFullYear(e.getFullYear()+1,11,31);break}return t.setHours(0,0,0,0),e.setHours(23,59,59,999),{initialDate:t,finalDate:e}},g=a=>{let r=O(a);return {period:r,...l(r)}},M=(a,r,s)=>!a||!r?"CUSTOM":s.find(e=>{if(e==="CUSTOM")return !1;let{initialDate:i,finalDate:n}=l(e);return i&&n&&a.toDateString()===i.toDateString()&&r.toDateString()===n.toDateString()})??"CUSTOM",E={["LAST_YEAR"]:"ano-passado",["LAST_MONTH"]:"mes-passado",["LAST_28_DAYS"]:"ultimos-28-dias",["LAST_7_DAYS"]:"ultimos-7-dias",["LAST_WEEK"]:"semana-passada",["YESTERDAY"]:"ontem",["TODAY"]:"hoje",["TOMORROW"]:"amanha",["NEXT_7_DAYS"]:"proximos-7-dias",["NEXT_30_DAYS"]:"proximos-30-dias",["NEXT_90_DAYS"]:"proximos-90-dias",["NEXT_MONTH"]:"proximo-mes",["THIS_YEAR"]:"este-ano",["NEXT_YEAR"]:"proximo-ano",["CUSTOM"]:"personalizado"},m=Object.fromEntries(Object.entries(E).map(([a,r])=>[r,a])),c={paramKey:"periodo",dataKey:"data"},_=a=>{let r=a.getFullYear(),s=String(a.getMonth()+1).padStart(2,"0"),t=String(a.getDate()).padStart(2,"0");return `${r}-${s}-${t}`},A=a=>{let r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(a);if(!r)return null;let[,s,t,e]=r;return new Date(Number(s),Number(t)-1,Number(e))},N=(a,r={},s)=>{let{paramKey:t,dataKey:e}={...c,...r},i=new URLSearchParams(s??"");return i.set(t,E[a.period]),a.period==="CUSTOM"&&a.initialDate&&a.finalDate?i.set(e,`${_(a.initialDate)}_${_(a.finalDate)}`):i.delete(e),i},P=(a,r={})=>{let{paramKey:s,dataKey:t}={...c,...r},e=a.get(s);if(!e)return null;let i=m[e];if(!i)return null;if(i!=="CUSTOM")return {period:i,...l(i)};let n=a.get(t);if(!n)return {period:"CUSTOM",initialDate:null,finalDate:null};let[D,S]=n.split("_"),o=D?A(D):null,T=S?A(S):null;return o&&o.setHours(0,0,0,0),T&&T.setHours(23,59,59,999),{period:"CUSTOM",initialDate:o,finalDate:T}};
|
|
2
|
+
|
|
3
|
+
export { R as a, p as b, l as c, g as d, M as e, c as f, N as g, P as h };
|
|
4
|
+
//# sourceMappingURL=chunk-4UECQEE3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Filters/utils.ts"],"names":["periodLabels","PAST_PERIODS","FUTURE_PERIODS","FREE_PERIODS","getPeriodsByType","type","getDefaultPeriodForType","getPeriodDates","period","reference","now","initialDate","finalDate","buildDefaultFilter","findMatchingPeriod","startDate","endDate","candidates","periodSlugs","slugToPeriod","key","slug","DEFAULT_FILTER_KEYS","formatDateOnly","date","year","month","day","parseDateOnly","raw","match","serializeFilterToSearchParams","value","keys","baseParams","paramKey","dataKey","params","deserializeFilterFromSearchParams","dataRaw","initialRaw","finalRaw"],"mappings":"AAIO,IAAMA,EAAuC,CAClD,YAAiB,EAAG,cACpB,aAAkB,EAAG,iBACrB,eAAoB,EAAG,qBACvB,cAAmB,EAAG,oBACtB,YAAiB,EAAG,iBACpB,YAAiB,EAAG,QACpB,QAAa,EAAG,OAChB,WAAgB,EAAG,YACnB,cAAmB,EAAG,qBACtB,eAAoB,EAAG,sBACvB,eAAoB,EAAG,sBACvB,aAAkB,EAAG,oBACrB,YAAiB,EAAG,WACpB,YAAiB,EAAG,iBACpB,SAAc,EAAG,eACnB,EAEMC,EAAyB,+FAS/B,EAEMC,EAA2B,6GAUjC,EAEMC,EAAyB,2LAgB/B,EAEaC,EAAoBC,GAAyB,CACxD,OAAQA,EAAM,CACZ,WACE,OAAOJ,EACT,aACE,OAAOC,EACT,QACE,OAAOC,CACX,CACF,EAEaG,EAA2BD,GAAuB,CAC7D,OAAQA,EAAM,CACZ,aACE,oBACF,WACA,QACE,oBACJ,CACF,EAEaE,EAAiB,CAC5BC,EACAC,IACyD,CACzD,GAAID,aACF,MAAO,CAAE,YAAa,KAAM,UAAW,IAAK,EAG9C,IAAME,EAAMD,EAAY,IAAI,KAAKA,CAAS,EAAI,IAAI,KAC5CE,EAAc,IAAI,KAAKD,CAAG,EAC1BE,EAAY,IAAI,KAAKF,CAAG,EAE9B,OAAQF,EAAQ,CACd,YACE,MAEF,gBACEG,EAAY,QAAQA,EAAY,QAAQ,EAAI,CAAC,EAC7CC,EAAU,QAAQA,EAAU,QAAQ,EAAI,CAAC,EACzC,MAEF,eACED,EAAY,QAAQA,EAAY,QAAQ,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B,YAAAD,EAAa,UAAAC,CAAU,CACzD","sourcesContent":["import { FilterValue, Period } from 'types/period';\n\nimport { Type } from './props';\n\nexport const periodLabels: Record<Period, string> = {\n [Period.LAST_YEAR]: 'Ano passado',\n [Period.LAST_MONTH]: 'Mês passado',\n [Period.LAST_28_DAYS]: 'Últimos 28 dias',\n [Period.LAST_7_DAYS]: 'Últimos 7 dias',\n [Period.LAST_WEEK]: 'Semana passada',\n [Period.YESTERDAY]: 'Ontem',\n [Period.TODAY]: 'Hoje',\n [Period.TOMORROW]: 'Amanhã',\n [Period.NEXT_7_DAYS]: 'Próximos 7 dias',\n [Period.NEXT_30_DAYS]: 'Próximos 30 dias',\n [Period.NEXT_90_DAYS]: 'Próximos 90 dias',\n [Period.NEXT_MONTH]: 'Próximo mês',\n [Period.THIS_YEAR]: 'Este ano',\n [Period.NEXT_YEAR]: 'Próximo ano',\n [Period.CUSTOM]: 'Personalizado',\n};\n\nconst PAST_PERIODS: Period[] = [\n Period.TODAY,\n Period.YESTERDAY,\n Period.LAST_7_DAYS,\n Period.LAST_WEEK,\n Period.LAST_28_DAYS,\n Period.LAST_MONTH,\n Period.LAST_YEAR,\n Period.CUSTOM,\n];\n\nconst FUTURE_PERIODS: Period[] = [\n Period.TODAY,\n Period.TOMORROW,\n Period.NEXT_7_DAYS,\n Period.NEXT_30_DAYS,\n Period.NEXT_90_DAYS,\n Period.NEXT_MONTH,\n Period.THIS_YEAR,\n Period.NEXT_YEAR,\n Period.CUSTOM,\n];\n\nconst FREE_PERIODS: Period[] = [\n Period.LAST_YEAR,\n Period.LAST_MONTH,\n Period.LAST_28_DAYS,\n Period.LAST_7_DAYS,\n Period.LAST_WEEK,\n Period.YESTERDAY,\n Period.TODAY,\n Period.TOMORROW,\n Period.NEXT_7_DAYS,\n Period.NEXT_30_DAYS,\n Period.NEXT_90_DAYS,\n Period.NEXT_MONTH,\n Period.THIS_YEAR,\n Period.NEXT_YEAR,\n Period.CUSTOM,\n];\n\nexport const getPeriodsByType = (type: Type): Period[] => {\n switch (type) {\n case Type.PAST:\n return PAST_PERIODS;\n case Type.FUTURE:\n return FUTURE_PERIODS;\n default:\n return FREE_PERIODS;\n }\n};\n\nexport const getDefaultPeriodForType = (type: Type): Period => {\n switch (type) {\n case Type.FUTURE:\n return Period.NEXT_7_DAYS;\n case Type.PAST:\n default:\n return Period.LAST_28_DAYS;\n }\n};\n\nexport const getPeriodDates = (\n period: Period,\n reference?: Date,\n): { initialDate: Date | null; finalDate: Date | null } => {\n if (period === Period.CUSTOM) {\n return { initialDate: null, finalDate: null };\n }\n\n const now = reference ? new Date(reference) : new Date();\n const initialDate = new Date(now);\n const finalDate = new Date(now);\n\n switch (period) {\n case Period.TODAY:\n break;\n\n case Period.YESTERDAY:\n initialDate.setDate(initialDate.getDate() - 1);\n finalDate.setDate(finalDate.getDate() - 1);\n break;\n\n case Period.TOMORROW:\n initialDate.setDate(initialDate.getDate() + 1);\n finalDate.setDate(finalDate.getDate() + 1);\n break;\n\n case Period.LAST_7_DAYS:\n initialDate.setDate(initialDate.getDate() - 6);\n break;\n\n case Period.LAST_28_DAYS:\n initialDate.setDate(initialDate.getDate() - 27);\n break;\n\n case Period.LAST_WEEK: {\n finalDate.setDate(finalDate.getDate() - finalDate.getDay() - 1);\n initialDate.setTime(finalDate.getTime());\n initialDate.setDate(initialDate.getDate() - 6);\n break;\n }\n\n case Period.LAST_MONTH:\n initialDate.setMonth(initialDate.getMonth() - 1, 1);\n finalDate.setDate(0);\n break;\n\n case Period.LAST_YEAR:\n initialDate.setFullYear(initialDate.getFullYear() - 1, 0, 1);\n finalDate.setFullYear(finalDate.getFullYear() - 1, 11, 31);\n break;\n\n case Period.NEXT_7_DAYS:\n finalDate.setDate(finalDate.getDate() + 6);\n break;\n\n case Period.NEXT_30_DAYS:\n finalDate.setDate(finalDate.getDate() + 29);\n break;\n\n case Period.NEXT_90_DAYS:\n finalDate.setDate(finalDate.getDate() + 89);\n break;\n\n case Period.NEXT_MONTH:\n initialDate.setMonth(initialDate.getMonth() + 1, 1);\n finalDate.setMonth(finalDate.getMonth() + 2, 0);\n break;\n\n case Period.THIS_YEAR:\n initialDate.setMonth(0, 1);\n finalDate.setMonth(11, 31);\n break;\n\n case Period.NEXT_YEAR:\n initialDate.setFullYear(initialDate.getFullYear() + 1, 0, 1);\n finalDate.setFullYear(finalDate.getFullYear() + 1, 11, 31);\n break;\n }\n\n initialDate.setHours(0, 0, 0, 0);\n finalDate.setHours(23, 59, 59, 999);\n\n return { initialDate, finalDate };\n};\n\nexport const buildDefaultFilter = (type: Type): FilterValue => {\n const period = getDefaultPeriodForType(type);\n return { period, ...getPeriodDates(period) };\n};\n\nexport const findMatchingPeriod = (\n startDate: Date | null,\n endDate: Date | null,\n candidates: Period[],\n): Period => {\n if (!startDate || !endDate) return Period.CUSTOM;\n\n const match = candidates.find(period => {\n if (period === Period.CUSTOM) return false;\n\n const { initialDate, finalDate } = getPeriodDates(period);\n\n return (\n initialDate &&\n finalDate &&\n startDate.toDateString() === initialDate.toDateString() &&\n endDate.toDateString() === finalDate.toDateString()\n );\n });\n\n return match ?? Period.CUSTOM;\n};\n\nexport const periodSlugs: Record<Period, string> = {\n [Period.LAST_YEAR]: 'ano-passado',\n [Period.LAST_MONTH]: 'mes-passado',\n [Period.LAST_28_DAYS]: 'ultimos-28-dias',\n [Period.LAST_7_DAYS]: 'ultimos-7-dias',\n [Period.LAST_WEEK]: 'semana-passada',\n [Period.YESTERDAY]: 'ontem',\n [Period.TODAY]: 'hoje',\n [Period.TOMORROW]: 'amanha',\n [Period.NEXT_7_DAYS]: 'proximos-7-dias',\n [Period.NEXT_30_DAYS]: 'proximos-30-dias',\n [Period.NEXT_90_DAYS]: 'proximos-90-dias',\n [Period.NEXT_MONTH]: 'proximo-mes',\n [Period.THIS_YEAR]: 'este-ano',\n [Period.NEXT_YEAR]: 'proximo-ano',\n [Period.CUSTOM]: 'personalizado',\n};\n\nconst slugToPeriod: Record<string, Period> = Object.fromEntries(\n (Object.entries(periodSlugs) as [Period, string][]).map(([key, slug]) => [\n slug,\n key,\n ]),\n);\n\nexport interface FilterUrlKeys {\n paramKey?: string;\n dataKey?: string;\n}\n\nexport const DEFAULT_FILTER_KEYS: Required<FilterUrlKeys> = {\n paramKey: 'periodo',\n dataKey: 'data',\n};\n\nconst formatDateOnly = (date: Date): string => {\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n\n return `${year}-${month}-${day}`;\n};\n\nconst parseDateOnly = (raw: string): Date | null => {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(raw);\n if (!match) return null;\n\n const [, year, month, day] = match;\n\n return new Date(Number(year), Number(month) - 1, Number(day));\n};\n\nexport const serializeFilterToSearchParams = (\n value: FilterValue,\n keys: FilterUrlKeys = {},\n baseParams?: URLSearchParams,\n): URLSearchParams => {\n const { paramKey, dataKey } = { ...DEFAULT_FILTER_KEYS, ...keys };\n const params = new URLSearchParams(baseParams ?? '');\n\n params.set(paramKey, periodSlugs[value.period]);\n\n if (\n value.period === Period.CUSTOM &&\n value.initialDate &&\n value.finalDate\n ) {\n params.set(\n dataKey,\n `${formatDateOnly(value.initialDate)}_${formatDateOnly(value.finalDate)}`,\n );\n } else {\n params.delete(dataKey);\n }\n\n return params;\n};\n\nexport const deserializeFilterFromSearchParams = (\n params: URLSearchParams,\n keys: FilterUrlKeys = {},\n): FilterValue | null => {\n const { paramKey, dataKey } = { ...DEFAULT_FILTER_KEYS, ...keys };\n const slug = params.get(paramKey);\n if (!slug) return null;\n\n const period = slugToPeriod[slug];\n if (!period) return null;\n\n if (period !== Period.CUSTOM) {\n return { period, ...getPeriodDates(period) };\n }\n\n const dataRaw = params.get(dataKey);\n if (!dataRaw) {\n return { period: Period.CUSTOM, initialDate: null, finalDate: null };\n }\n\n const [initialRaw, finalRaw] = dataRaw.split('_');\n const initialDate = initialRaw ? parseDateOnly(initialRaw) : null;\n const finalDate = finalRaw ? parseDateOnly(finalRaw) : null;\n\n if (initialDate) initialDate.setHours(0, 0, 0, 0);\n if (finalDate) finalDate.setHours(23, 59, 59, 999);\n\n return { period: Period.CUSTOM, initialDate, finalDate };\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a } from './chunk-373WGZZL.js';
|
|
2
|
+
import { a as a$1, e } from './chunk-X4F3O7PX.js';
|
|
2
3
|
import { a as a$3, b } from './chunk-Q2AVS24Z.js';
|
|
4
|
+
import { p, r, a as a$2 } from './chunk-YPL4KIKN.js';
|
|
3
5
|
import { a as a$5 } from './chunk-WUFEPE2G.js';
|
|
4
6
|
import { c, b as b$1 } from './chunk-BX2DSNRV.js';
|
|
5
|
-
import { a as a$1, e } from './chunk-X4F3O7PX.js';
|
|
6
|
-
import { p, r, a as a$2 } from './chunk-YPL4KIKN.js';
|
|
7
7
|
import { d, a as a$4 } from './chunk-GLRLKFPS.js';
|
|
8
8
|
import { useEffect, useMemo } from 'react';
|
|
9
9
|
import M from '@mui/material/CssBaseline';
|
|
@@ -14,4 +14,4 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
14
14
|
var W=t=>({lighter:lighten(t,.815),light:lighten(t,.225),main:t,dark:darken(t,.15),darker:darken(t,.35),contrastText:"#000"});function x(t,o,r$1="app"){let e$1=W(o.primaryColor),m=F(p);a(m,"dark.palette.primary",e$1),a(m,"light.palette.primary",e$1);let a$4={mode:o.colorScheme,colorSchemes:m,shadows:a$1(o.colorScheme),customShadows:r(o.colorScheme,e$1.main),shape:{borderRadius:8},components:a$2,typography:{...e,fontFamily:d(o.fontFamily)},cssVarPrefix:r$1,shouldSkipGeneratingVar:I},s=a$3(a$4,o);return experimental_extendTheme(s,t,b(o))}function I(t,o){let r=["mixins","overlays","direction","breakpoints","cssVarPrefix","unstable_sxConfig","typography","colorSchemes"],e={global:["tonalOffset","dividerChannel","contrastThreshold"],grey:["A100","A200","A400","A700"],text:["icon"]};if(t[0]==="palette"){let a=t[1],s=e[a]||e.global;return t.some(i=>s?.includes(i))}return t.some(a=>r?.includes(a))}var $=({children:t,primaryColor:o="#4E5BEC",cssVarPrefix:r="app"})=>{let{settings:e}=b$1();useEffect(()=>{localStorage.setItem(`${e.storageKey}`,e.colorScheme),localStorage.setItem(`${e.storageKey}-light`,"light"),localStorage.setItem(`${e.storageKey}-dark`,"dark");},[e.storageKey,e.colorScheme]);let m=useMemo(()=>{let s=x(a$5[1].systemValue,{primaryColor:o,colorScheme:e.colorScheme,contrast:e.contrast,navLayout:e.navLayout,navColor:e.navColor,compactLayout:e.compactLayout,fontFamily:e.fontFamily,storageKey:e.storageKey},r);return s.palette=s.colorSchemes?.[e.colorScheme]?.palette,s},[e,o,r]),a=useMemo(()=>({theme:m,mode:e.colorScheme,defaultMode:e.colorScheme,defaultColorScheme:e.colorScheme,modeStorageKey:e.storageKey,colorSchemeStorageKey:e.storageKey,attribute:a$4.ATTRIBUTE}),[m,e.colorScheme,e.storageKey]);return jsxs(Experimental_CssVarsProvider,{...a,children:[jsx(M,{enableColorScheme:!0}),jsx(B,{children:t})]})},B=({children:t})=>{let{settings:o,updateSettings:r}=b$1(),{mode:e,setMode:m}=useColorScheme();return useEffect(()=>{let a=o.colorScheme;document?.documentElement.setAttribute(a$4.ATTRIBUTE,a),m(a);},[o.colorScheme,m]),useEffect(()=>{e!==o.colorScheme&&r({colorScheme:e==="system"?o.colorScheme:e});},[e,o.colorScheme,r]),t},w=({children:t,cssVarPrefix:o,primaryColor:r="#4E5BEC",fontFamily:e="Public Sans",compactLayout:m=!0,contrast:a="default",navColor:s="integrate",navLayout:i="vertical",colorScheme:A="light"})=>{let k=`${o?`${o}-`:""}${a$4.STORAGE_KEY}`;return jsx(c,{primaryColor:r,fontFamily:e,compactLayout:m,contrast:a,navColor:s,navLayout:i,colorScheme:A,cssVarPrefix:o,storageKey:k,children:jsx($,{primaryColor:r,cssVarPrefix:o,children:t})})};var te=w;
|
|
15
15
|
|
|
16
16
|
export { x as a, te as b };
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-AYUKIKNC.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as a$1 } from './chunk-KGLU4CR2.js';
|
|
2
1
|
import { a } from './chunk-J5B2YJSR.js';
|
|
2
|
+
import { a as a$1 } from './chunk-KGLU4CR2.js';
|
|
3
3
|
import { b } from './chunk-2ZJUGM2S.js';
|
|
4
4
|
import P from '@mui/lab/LoadingButton';
|
|
5
5
|
import k from '@mui/material/Button';
|
|
@@ -13,4 +13,4 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
13
13
|
var w=({imageSrc:c,aspectRatio:p,cropShape:g,cropSize:u,onInitialized:h})=>{let[i,n]=useState(1),[t,m]=useState({x:0,y:0}),[y,l]=useState(0);return jsxs(r,{gap:2,children:[jsx(a$1,{imageSrc:c,aspectRatio:p,cropShape:g,zoom:i,crop:t,onZoomChange:n,onCropChange:m,onInitialized:h,rotation:y,onRotationChange:l,cropSize:u}),jsxs(r,{gap:1.5,children:[jsxs(r,{width:1,direction:"row",gap:3,flex:1,alignItems:"center",children:[jsx(d,{component:"label",htmlFor:"zoom-slider",width:85,color:"textSecondary",variant:"body2",children:"Zoom"}),jsx(I,{id:"zoom-slider",value:i,onChange:(e,C)=>n(Array.isArray(C)?C[0]:C),min:.1,max:4,size:"medium",step:.0125}),jsx(S,{size:"small",id:"zoom-slider",type:"number",value:i,onChange:e=>n(Number(e.target.value)),inputProps:{step:.0125},sx:{width:130}})]}),jsxs(r,{direction:"row",gap:4,justifyContent:"flex-start",children:[jsx(d,{component:"label",htmlFor:"rotation-slider",width:"45px",color:"textSecondary",variant:"body2",lineHeight:"39px",children:"Position"}),jsxs(r,{direction:"row",alignItems:"center",gap:3,children:[jsx(d,{component:"label",htmlFor:"rotation-slider",color:"textSecondary",variant:"body2",children:"Y"}),jsx(S,{size:"small",id:"rotation-slider",type:"number",value:t.y,onChange:e=>m({...t,y:Number(e.target.value)}),sx:{width:90}})]}),jsxs(r,{gap:3,direction:"row",alignItems:"center",children:[jsx(d,{component:"label",htmlFor:"rotation-slider",color:"textSecondary",variant:"body2",children:"X"}),jsx(S,{size:"small",id:"rotation-slider",type:"number",value:t.x,onChange:e=>m({...t,x:Number(e.target.value)}),sx:{width:90}})]})]})]})]})},v=w;var M=({open:c,onClose:p,label:g,onSave:u,imageSrc:h,aspectRatio:i,cropShape:n,cropSize:t,onInitialized:m,loading:y})=>{let l=b("down","sm");return jsx(a,{open:c,onClose:p,dialogTitle:g,actions:jsxs(Fragment,{children:[jsx(k,{variant:"outlined",size:"medium",onClick:p,color:"inherit",children:"Cancelar"}),jsx(P,{variant:"contained",size:"medium",onClick:u,loading:y,children:"Salvar"})]}),fullWidth:!0,maxWidth:"sm",fullScreen:l,PaperProps:{sx:l?{borderRadius:0,m:0}:void 0},dialogContentProps:{sx:l?{p:0}:void 0},children:jsx(v,{imageSrc:h,aspectRatio:i,cropShape:n,cropSize:t,onInitialized:m})})},q=M;
|
|
14
14
|
|
|
15
15
|
export { q as a };
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-CKCNZJL6.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var _=(T=>(T.LAST_YEAR="LAST_YEAR",T.LAST_MONTH="LAST_MONTH",T.LAST_28_DAYS="LAST_28_DAYS",T.LAST_7_DAYS="LAST_7_DAYS",T.LAST_WEEK="LAST_WEEK",T.YESTERDAY="YESTERDAY",T.TODAY="TODAY",T.TOMORROW="TOMORROW",T.NEXT_7_DAYS="NEXT_7_DAYS",T.NEXT_30_DAYS="NEXT_30_DAYS",T.NEXT_90_DAYS="NEXT_90_DAYS",T.NEXT_MONTH="NEXT_MONTH",T.THIS_YEAR="THIS_YEAR",T.NEXT_YEAR="NEXT_YEAR",T.CUSTOM="CUSTOM",T))(_||{});
|
|
2
|
+
|
|
3
|
+
export { _ as a };
|
|
4
|
+
//# sourceMappingURL=chunk-K3T3E52L.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/period.ts"],"names":["Period"],"mappings":"AAAO,IAAKA,OACVA,EAAA,UAAY,YACZA,EAAA,WAAa,aACbA,EAAA,aAAe,eACfA,EAAA,YAAc,cACdA,EAAA,UAAY,YACZA,EAAA,UAAY,YACZA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,YAAc,cACdA,EAAA,aAAe,eACfA,EAAA,aAAe,eACfA,EAAA,WAAa,aACbA,EAAA,UAAY,YACZA,EAAA,UAAY,YACZA,EAAA,OAAS,SAfCA,OAAA","sourcesContent":["export enum Period {\n LAST_YEAR = 'LAST_YEAR',\n LAST_MONTH = 'LAST_MONTH',\n LAST_28_DAYS = 'LAST_28_DAYS',\n LAST_7_DAYS = 'LAST_7_DAYS',\n LAST_WEEK = 'LAST_WEEK',\n YESTERDAY = 'YESTERDAY',\n TODAY = 'TODAY',\n TOMORROW = 'TOMORROW',\n NEXT_7_DAYS = 'NEXT_7_DAYS',\n NEXT_30_DAYS = 'NEXT_30_DAYS',\n NEXT_90_DAYS = 'NEXT_90_DAYS',\n NEXT_MONTH = 'NEXT_MONTH',\n THIS_YEAR = 'THIS_YEAR',\n NEXT_YEAR = 'NEXT_YEAR',\n CUSTOM = 'CUSTOM',\n}\n\nexport interface FilterValue {\n period: Period;\n initialDate: Date | null;\n finalDate: Date | null;\n}\n"]}
|
|
@@ -4,9 +4,9 @@ import { a, m, c as c$1, n } from '../../../chunk-XQZPUMVQ.js';
|
|
|
4
4
|
import { a as a$7 } from '../../../chunk-DRGARBKB.js';
|
|
5
5
|
import { a as a$6 } from '../../../chunk-J5XGGHQ7.js';
|
|
6
6
|
import { a as a$4 } from '../../../chunk-J5B2YJSR.js';
|
|
7
|
-
import { a as a$3 } from '../../../chunk-CBW32OUQ.js';
|
|
8
7
|
import { d as d$2 } from '../../../chunk-A7QSCOUE.js';
|
|
9
8
|
import { h, d as d$1, c as c$2 } from '../../../chunk-OF6623HG.js';
|
|
9
|
+
import { a as a$3 } from '../../../chunk-CBW32OUQ.js';
|
|
10
10
|
import { d } from '../../../chunk-E4Q7LX5L.js';
|
|
11
11
|
import { a as a$2 } from '../../../chunk-R2BCPHRH.js';
|
|
12
12
|
import { a as a$1 } from '../../../chunk-4F2NKGF6.js';
|
|
@@ -3,9 +3,9 @@ import { b as b$2, a as a$5 } from '../../../chunk-XL6SZZGI.js';
|
|
|
3
3
|
import { a, b as b$1, m, n, c } from '../../../chunk-XQZPUMVQ.js';
|
|
4
4
|
import { a as a$8 } from '../../../chunk-DRGARBKB.js';
|
|
5
5
|
import { a as a$4 } from '../../../chunk-J5B2YJSR.js';
|
|
6
|
-
import { a as a$3 } from '../../../chunk-CBW32OUQ.js';
|
|
7
6
|
import { d as d$2 } from '../../../chunk-A7QSCOUE.js';
|
|
8
7
|
import { h, d, a as a$6, c as c$1 } from '../../../chunk-OF6623HG.js';
|
|
8
|
+
import { a as a$3 } from '../../../chunk-CBW32OUQ.js';
|
|
9
9
|
import { d as d$1 } from '../../../chunk-E4Q7LX5L.js';
|
|
10
10
|
import { a as a$2 } from '../../../chunk-R2BCPHRH.js';
|
|
11
11
|
import { a as a$1 } from '../../../chunk-4F2NKGF6.js';
|
|
@@ -2,11 +2,11 @@ import { b as b$1, e, f, a as a$b } from '../../chunk-UWTX4JMW.js';
|
|
|
2
2
|
import { c as c$1, d } from '../../chunk-ERLI5GAP.js';
|
|
3
3
|
export { a as ReferenceCircle, b as WrappedTick } from '../../chunk-XL6SZZGI.js';
|
|
4
4
|
export { a as ChartCard, b as ChartCardHeader, c as ChartWrapper, i as ColoredCheckbox, m as EmptyState, l as EmptyStateContainer, g as LegendContainer, h as LegendItem, n as RotatedTick, k as SummaryDivider, j as SummaryStack, d as TooltipContainer, e as TooltipDivider, f as TooltipDot } from '../../chunk-XQZPUMVQ.js';
|
|
5
|
-
import { a as a$7 } from '../../chunk-XAPSXJZO.js';
|
|
6
|
-
import { a as a$8 } from '../../chunk-J7RPKCIN.js';
|
|
7
5
|
import { a as a$9 } from '../../chunk-DRGARBKB.js';
|
|
8
6
|
import { a as a$c } from '../../chunk-RUABKHIV.js';
|
|
9
7
|
import { a as a$1 } from '../../chunk-J5B2YJSR.js';
|
|
8
|
+
import { a as a$7 } from '../../chunk-XAPSXJZO.js';
|
|
9
|
+
import { a as a$8 } from '../../chunk-J7RPKCIN.js';
|
|
10
10
|
import { a } from '../../chunk-CBW32OUQ.js';
|
|
11
11
|
import { a as a$3 } from '../../chunk-4F2NKGF6.js';
|
|
12
12
|
import { c } from '../../chunk-VGTQYKAC.js';
|
|
@@ -6,26 +6,26 @@ import '../../chunk-PBLSVXV5.js';
|
|
|
6
6
|
import { a as a$2 } from '../../chunk-VR3K2Y2C.js';
|
|
7
7
|
import { a as a$1 } from '../../chunk-LQRRMVFN.js';
|
|
8
8
|
import '../../chunk-U4I7JPER.js';
|
|
9
|
-
import '../../chunk-
|
|
9
|
+
import '../../chunk-AYUKIKNC.js';
|
|
10
10
|
import '../../chunk-373WGZZL.js';
|
|
11
|
+
import '../../chunk-X4F3O7PX.js';
|
|
11
12
|
import '../../chunk-Q2AVS24Z.js';
|
|
12
13
|
import '../../chunk-LNESYSHP.js';
|
|
13
|
-
import '../../chunk-WUFEPE2G.js';
|
|
14
|
-
import '../../chunk-BX2DSNRV.js';
|
|
15
|
-
import '../../chunk-X4F3O7PX.js';
|
|
16
14
|
import '../../chunk-YPL4KIKN.js';
|
|
17
15
|
import '../../chunk-HBOBTNB5.js';
|
|
16
|
+
import '../../chunk-WUFEPE2G.js';
|
|
17
|
+
import '../../chunk-BX2DSNRV.js';
|
|
18
18
|
import '../../chunk-GLRLKFPS.js';
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
19
|
+
import E from '@mui/material/Avatar';
|
|
20
|
+
import s from '@mui/material/Divider';
|
|
21
|
+
import c from '@mui/material/Stack';
|
|
22
22
|
import { styled, alpha } from '@mui/material/styles';
|
|
23
23
|
import i from '@mui/material/Typography';
|
|
24
24
|
import _ from '@mui/lab/LoadingButton';
|
|
25
|
-
import
|
|
25
|
+
import j from '@mui/material/Button';
|
|
26
26
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var T=styled(c)({width:40,height:40,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid #1C1C1C",cursor:"pointer"}),w=styled(a)(({theme:o})=>({width:322,marginTop:20,"& .MuiPopover-paper":{width:540,padding:0,backgroundColor:o.palette.background.paper,borderRadius:o.spacing(1),backgroundImage:"none"}})),R=styled(c)(({theme:o})=>({alignItems:"center",justifyContent:"center",gap:o.spacing(1.5),padding:o.spacing(3),backgroundColor:alpha(o.palette.primary.main,.04)})),p=styled(c)(({theme:o})=>({marginLeft:o.spacing(1.75),marginRight:o.spacing(1.75),marginTop:o.spacing(2),marginBottom:o.spacing(2),gap:o.spacing(1)})),S=styled(j)(({theme:o})=>({width:"100%",alignItems:"flex-start",justifyContent:"flex-start",color:o.palette.text.primary})),A=styled(c)(({theme:o})=>({display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:o.spacing(2),cursor:"pointer"})),d=styled(c)(({theme:o})=>({alignItems:"center",gap:o.spacing(.5),color:o.palette.text.secondary,textAlign:"center","&:hover":{color:o.palette.primary.main}})),B=styled(_)(({theme:o})=>({width:"100%",alignItems:"flex-start",justifyContent:"flex-start",color:o.palette.error.main}));var U=({name:o="",email:g="",src:P,content:y,menuItems:f,subContent:v,logout:L,loadingLogout:x})=>{let m=a$1();return jsxs(Fragment,{children:[jsx(T,{"data-testid":"avatar-trigger-button",children:jsx(a$2,{alt:o,name:o,src:P,onClick:m.onOpen,"data-testid":"avatar-trigger",sx:{maxWidth:34,maxHeight:34}})}),jsxs(w,{open:m.open,onClose:m.onClose,arrow:"top-right",disableRestoreFocus:!0,"data-testid":"avatar-menu",children:[jsxs(R,{"data-testid":"avatar-account",children:[jsx(E,{sx:{bgcolor:r=>r.palette.mode==="dark"?alpha(r.palette.primary.main,.04):"success.lighter",border:r=>r.palette.mode==="dark"?"1px solid rgb(255, 252, 252)":"none",color:r=>r.palette.mode==="dark"?"primary.contrastText":"success.main",width:60,height:60},"data-testid":"avatar-initials",children:o.slice(0,2).toUpperCase()}),jsxs(c,{alignItems:"center",textAlign:"center",children:[jsx(i,{variant:"subtitle2",color:"text.primary",children:o}),jsx(i,{variant:"body2",color:"text.secondary",children:g})]})]}),jsx(s,{}),y&&jsxs(Fragment,{children:[jsx(p,{"data-testid":"avatar-content",children:y}),jsx(s,{})]}),f&&jsxs(Fragment,{children:[jsx(p,{"data-testid":"avatar-menu-items",children:f.map(r=>jsx(S,{"data-testid":`avatar-menu-item-${r.label.toLowerCase().replace(/\s+/g,"-")}`,startIcon:jsx(a$3,{icon:r.icon,color:M=>M.palette.mode==="dark"?"text.secondary":"primary.main"}),...r.component&&{component:r.component,to:r.to},...r.onClick&&{onClick:r.onClick},children:jsxs(c,{direction:"row",alignItems:"center",justifyContent:"space-between",flex:1,gap:1,children:[jsx(i,{variant:"caption",fontSize:13,color:"text.secondary",children:r.label}),jsx(a$3,{icon:"ARROW_RIGHT_SIMPLE",color:"text.primary"})]})},r.label))}),jsx(s,{})]}),v&&jsxs(Fragment,{children:[jsx(p,{"data-testid":"avatar-subcontent",children:v}),jsx(s,{})]}),jsx(p,{"data-testid":"avatar-resources",children:jsxs(A,{children:[jsxs(d,{"data-testid":"resource-youtube",onClick:()=>window.open("https://youtube.com/playlist?list=PLqv8txNiT9o_LReCh5wKPiQaeBTg2Q1i3&si=3nGSAU3AdcPwoa-R","_blank","noopener noreferrer"),children:[jsx(a$3,{icon:"YOUTUBE",color:"primary.main"}),jsx(i,{variant:"caption",children:"Videos"})]}),jsxs(d,{"data-testid":"resource-ajuda",onClick:()=>window.open("https://ajuda.zydon.com.br","_blank","noopener noreferrer"),children:[jsx(a$3,{icon:"HELP_CIRCLE",color:"primary.main"}),jsx(i,{variant:"caption",children:"Ajuda"})]}),jsxs(d,{"data-testid":"resource-docs",onClick:()=>window.open("https://docs.zydon.com.br","_blank","noopener noreferrer"),children:[jsx(a$3,{icon:"CODE_FOLDER",color:"primary.main"}),jsx(i,{variant:"caption",children:"Docs"})]})]})}),jsx(s,{}),jsxs(p,{direction:"row",children:[jsx(B,{"data-testid":"logout-button",startIcon:jsx(a$3,{icon:"LOGOUT_02"}),size:"small",onClick:L,loading:x,children:x?"Saindo...":"Sair"}),a$4(g)&&jsxs(c,{direction:"row",alignItems:"center",gap:1,children:[jsx(i,{variant:"overline",fontSize:11,color:"text.disabled",children:"Apar\xEAncia:"}),jsx(a$5,{})]})]})]})]})},rt=U;
|
|
29
29
|
|
|
30
30
|
export { rt as default };
|
|
31
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/AvatarButton/index.tsx","../../../src/components/AvatarButton/styles.ts"],"names":["Avatar","Divider","Stack","alpha","Typography","MuiLoadingButton","MuiButton","styled","Button","MenuPopover","MenuPopover_default","theme","AccountInformations","Section","MenuItem","ResourcesGrid","ResourceItem","LogoutButton","Fragment","jsx","jsxs","AvatarButton","name","email","src","content","menuItems","subContent","logout","loadingLogout","popover","usePopover_default","CustomAvatar_default","item","Icon_default","checkIsSpecialUser","Toggle_default","AvatarButton_default"],"mappings":"woBAAA,OAAOA,MAAY,uBACnB,OAAOC,MAAa,wBACpB,OAAOC,MAAW,sBAElB,OAAS,SAAAC,MAAa,uBACtB,OAAOC,MAAgB,2BCLvB,OAAOC,MAAsB,yBAC7B,OAAOC,MAAe,uBACtB,OAAOJ,MAAW,sBAClB,OAAS,SAAAC,EAAO,UAAAI,MAAc,uBAIvB,IAAMC,EAASD,EAAOL,CAAK,EAAE,CAClC,MAAO,GACP,OAAQ,GACR,WAAY,SACZ,eAAgB,SAChB,aAAc,MACd,OAAQ,oBACR,OAAQ,SACV,CAAC,EAEYO,EAAcF,EAAOG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L,2FACA,SACA,qBACF,EAGF,UAAAG,EAACe,EAAA,CAAK,KAAK,UAAU,MAAM,eAAe,EAC1Cf,EAACf,EAAA,CAAW,QAAQ,UAAU,kBAAM,GACtC,EAEAgB,EAACJ,EAAA,CACC,cAAY,iBACZ,QAAS,IACP,OAAO,KACL,6BACA,SACA,qBACF,EAGF,UAAAG,EAACe,EAAA,CAAK,KAAK,cAAc,MAAM,eAAe,EAC9Cf,EAACf,EAAA,CAAW,QAAQ,UAAU,iBAAK,GACrC,EAEAgB,EAACJ,EAAA,CACC,cAAY,gBACZ,QAAS,IACP,OAAO,KACL,4BACA,SACA,qBACF,EAGF,UAAAG,EAACe,EAAA,CAAK,KAAK,cAAc,MAAM,eAAe,EAC9Cf,EAACf,EAAA,CAAW,QAAQ,UAAU,gBAAI,GACpC,GACF,EACF,EAEAe,EAAClB,EAAA,EAAQ,EAETmB,EAACP,EAAA,CAAQ,UAAU,MACjB,UAAAM,EAACF,EAAA,CACC,cAAY,gBACZ,UAAWE,EAACe,EAAA,CAAK,KAAK,YAAY,EAClC,KAAK,QACL,QAASN,EACT,QAASC,EAER,SAAAA,EAAgB,YAAc,OACjC,EACCM,EAAmBZ,CAAK,GACvBH,EAAClB,EAAA,CAAM,UAAU,MAAM,WAAW,SAAS,IAAK,EAC9C,UAAAiB,EAACf,EAAA,CACC,QAAQ,WACR,SAAU,GACV,MAAM,gBACP,yBAED,EACAe,EAACiB,EAAA,EAAY,GACf,GAEJ,GACF,GACF,CAEJ,EAEOC,GAAQhB","sourcesContent":["import Avatar from '@mui/material/Avatar';\nimport Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport type { Theme } from '@mui/material/styles';\nimport { alpha } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport CustomAvatar from 'components/CustomAvatar';\nimport Icon from 'components/Icon';\nimport ToggleTheme from 'components/ToggleTheme';\nimport usePopover from 'hooks/usePopover';\nimport { checkIsSpecialUser } from 'utils/user';\n\nimport { AvatarButtonProps } from './props';\nimport {\n AccountInformations,\n Button,\n LogoutButton,\n MenuItem,\n MenuPopover,\n ResourceItem,\n ResourcesGrid,\n Section,\n} from './styles';\n\nconst AvatarButton = ({\n name = '',\n email = '',\n src,\n content,\n menuItems,\n subContent,\n logout,\n loadingLogout,\n}: AvatarButtonProps) => {\n const popover = usePopover();\n\n return (\n <>\n <Button data-testid=\"avatar-trigger-button\">\n <CustomAvatar\n alt={name}\n name={name}\n src={src}\n onClick={popover.onOpen}\n data-testid=\"avatar-trigger\"\n sx={{ maxWidth: 34, maxHeight: 34 }}\n />\n </Button>\n\n <MenuPopover\n open={popover.open}\n onClose={popover.onClose}\n arrow=\"top-right\"\n disableRestoreFocus\n data-testid=\"avatar-menu\"\n >\n <AccountInformations data-testid=\"avatar-account\">\n <Avatar\n sx={{\n bgcolor: theme =>\n theme.palette.mode === 'dark'\n ? alpha(theme.palette.primary.main, 0.04)\n : 'success.lighter',\n border: theme =>\n theme.palette.mode === 'dark'\n ? '1px solid rgb(255, 252, 252)'\n : 'none',\n color: theme =>\n theme.palette.mode === 'dark'\n ? 'primary.contrastText'\n : 'success.main',\n width: 60,\n height: 60,\n }}\n data-testid=\"avatar-initials\"\n >\n {name.slice(0, 2).toUpperCase()}\n </Avatar>\n\n <Stack alignItems=\"center\" textAlign=\"center\">\n <Typography variant=\"subtitle2\" color=\"text.primary\">\n {name}\n </Typography>\n\n <Typography variant=\"body2\" color=\"text.secondary\">\n {email}\n </Typography>\n </Stack>\n </AccountInformations>\n\n <Divider />\n\n {content && (\n <>\n <Section data-testid=\"avatar-content\">{content}</Section>\n <Divider />\n </>\n )}\n\n {menuItems && (\n <>\n <Section data-testid=\"avatar-menu-items\">\n {menuItems.map(item => (\n <MenuItem\n key={item.label}\n data-testid={`avatar-menu-item-${item.label\n .toLowerCase()\n .replace(/\\s+/g, '-')}`}\n startIcon={\n <Icon\n icon={item.icon}\n color={(theme: Theme) =>\n theme.palette.mode === 'dark'\n ? 'text.secondary'\n : 'primary.main'\n }\n />\n }\n {...(item.component && {\n component: item.component,\n to: item.to,\n })}\n {...(item.onClick && { onClick: item.onClick })}\n >\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n flex={1}\n gap={1}\n >\n <Typography\n variant=\"caption\"\n fontSize={13}\n color=\"text.secondary\"\n >\n {item.label}\n </Typography>\n <Icon icon=\"ARROW_RIGHT_SIMPLE\" color=\"text.primary\" />\n </Stack>\n </MenuItem>\n ))}\n </Section>\n <Divider />\n </>\n )}\n\n {subContent && (\n <>\n <Section data-testid=\"avatar-subcontent\">{subContent}</Section>\n <Divider />\n </>\n )}\n\n <Section data-testid=\"avatar-resources\">\n <ResourcesGrid>\n <ResourceItem\n data-testid=\"resource-discord\"\n onClick={() =>\n window.open('https://discord.gg/HMpBbABGVW', '_blank')\n }\n >\n <Icon icon=\"DISCORD\" color=\"primary.main\" />\n <Typography variant=\"caption\">Comunidade</Typography>\n </ResourceItem>\n\n <ResourceItem\n data-testid=\"resource-youtube\"\n onClick={() =>\n window.open(\n 'https://youtube.com/playlist?list=PLqv8txNiT9o_LReCh5wKPiQaeBTg2Q1i3&si=3nGSAU3AdcPwoa-R',\n '_blank',\n 'noopener noreferrer',\n )\n }\n >\n <Icon icon=\"YOUTUBE\" color=\"primary.main\" />\n <Typography variant=\"caption\">Videos</Typography>\n </ResourceItem>\n\n <ResourceItem\n data-testid=\"resource-ajuda\"\n onClick={() =>\n window.open(\n 'https://ajuda.zydon.com.br',\n '_blank',\n 'noopener noreferrer',\n )\n }\n >\n <Icon icon=\"HELP_CIRCLE\" color=\"primary.main\" />\n <Typography variant=\"caption\">Ajuda</Typography>\n </ResourceItem>\n\n <ResourceItem\n data-testid=\"resource-docs\"\n onClick={() =>\n window.open(\n 'https://docs.zydon.com.br',\n '_blank',\n 'noopener noreferrer',\n )\n }\n >\n <Icon icon=\"CODE_FOLDER\" color=\"primary.main\" />\n <Typography variant=\"caption\">Docs</Typography>\n </ResourceItem>\n </ResourcesGrid>\n </Section>\n\n <Divider />\n\n <Section direction=\"row\">\n <LogoutButton\n data-testid=\"logout-button\"\n startIcon={<Icon icon=\"LOGOUT_02\" />}\n size=\"small\"\n onClick={logout}\n loading={loadingLogout}\n >\n {loadingLogout ? 'Saindo...' : 'Sair'}\n </LogoutButton>\n {checkIsSpecialUser(email) && (\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Typography\n variant=\"overline\"\n fontSize={11}\n color=\"text.disabled\"\n >\n Aparência:\n </Typography>\n <ToggleTheme />\n </Stack>\n )}\n </Section>\n </MenuPopover>\n </>\n );\n};\n\nexport default AvatarButton;\n","import MuiLoadingButton from '@mui/lab/LoadingButton';\nimport MuiButton from '@mui/material/Button';\nimport Stack from '@mui/material/Stack';\nimport { alpha, styled } from '@mui/material/styles';\n\nimport CommonMenuPopover from 'components/MenuPopover';\n\nexport const Button = styled(Stack)({\n width: 40,\n height: 40,\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: '50%',\n border: '2px solid #1C1C1C',\n cursor: 'pointer',\n});\n\nexport const MenuPopover = styled(CommonMenuPopover)(({ theme }) => ({\n width: 322,\n marginTop: 20,\n\n '& .MuiPopover-paper': {\n width: 540,\n padding: 0,\n backgroundColor: theme.palette.background.paper,\n borderRadius: theme.spacing(1),\n backgroundImage: 'none',\n },\n}));\n\nexport const AccountInformations = styled(Stack)(({ theme }) => ({\n alignItems: 'center',\n justifyContent: 'center',\n gap: theme.spacing(1.5),\n padding: theme.spacing(3),\n backgroundColor: alpha(theme.palette.primary.main, 0.04),\n}));\n\nexport const Section = styled(Stack)(({ theme }) => ({\n marginLeft: theme.spacing(1.75),\n marginRight: theme.spacing(1.75),\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n gap: theme.spacing(1),\n}));\n\nexport const MenuItem = styled(MuiButton)(({ theme }) => ({\n width: '100%',\n alignItems: 'flex-start',\n justifyContent: 'flex-start',\n color: theme.palette.text.primary,\n}));\n\nexport const ResourcesGrid = styled(Stack)(({ theme }) => ({\n display: 'grid',\n gridTemplateColumns: 'repeat(4, 1fr)',\n gap: theme.spacing(2),\n cursor: 'pointer',\n}));\n\nexport const ResourceItem = styled(Stack)(({ theme }) => ({\n alignItems: 'center',\n gap: theme.spacing(0.5),\n color: theme.palette.text.secondary,\n textAlign: 'center',\n\n '&:hover': {\n color: theme.palette.primary.main,\n },\n}));\n\nexport const LogoutButton = styled(MuiLoadingButton)(({ theme }) => ({\n width: '100%',\n alignItems: 'flex-start',\n justifyContent: 'flex-start',\n color: theme.palette.error.main,\n}));\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/AvatarButton/index.tsx","../../../src/components/AvatarButton/styles.ts"],"names":["Avatar","Divider","Stack","alpha","Typography","MuiLoadingButton","MuiButton","styled","Button","MenuPopover","MenuPopover_default","theme","AccountInformations","Section","MenuItem","ResourcesGrid","ResourceItem","LogoutButton","Fragment","jsx","jsxs","AvatarButton","name","email","src","content","menuItems","subContent","logout","loadingLogout","popover","usePopover_default","CustomAvatar_default","item","Icon_default","checkIsSpecialUser","Toggle_default","AvatarButton_default"],"mappings":"woBAAA,OAAOA,MAAY,uBACnB,OAAOC,MAAa,wBACpB,OAAOC,MAAW,sBAElB,OAAS,SAAAC,MAAa,uBACtB,OAAOC,MAAgB,2BCLvB,OAAOC,MAAsB,yBAC7B,OAAOC,MAAe,uBACtB,OAAOJ,MAAW,sBAClB,OAAS,SAAAC,EAAO,UAAAI,MAAc,uBAIvB,IAAMC,EAASD,EAAOL,CAAK,EAAE,CAClC,MAAO,GACP,OAAQ,GACR,WAAY,SACZ,eAAgB,SAChB,aAAc,MACd,OAAQ,oBACR,OAAQ,SACV,CAAC,EAEYO,EAAcF,EAAOG,CAAiB,EAAE,CAAC,CAAE,MAAAC,CAAM,KAAO,CACnE,MAAO,IACP,UAAW,GAEX,sBAAuB,CACrB,MAAO,IACP,QAAS,EACT,gBAAiBA,EAAM,QAAQ,WAAW,MAC1C,aAAcA,EAAM,QAAQ,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AAS,IACP,OAAO,KACL,4BACA,SACA,qBACF,EAGF,UAAAG,EAACe,EAAA,CAAK,KAAK,cAAc,MAAM,eAAe,EAC9Cf,EAACf,EAAA,CAAW,QAAQ,UAAU,gBAAI,GACpC,GACF,EACF,EAEAe,EAAClB,EAAA,EAAQ,EAETmB,EAACP,EAAA,CAAQ,UAAU,MACjB,UAAAM,EAACF,EAAA,CACC,cAAY,gBACZ,UAAWE,EAACe,EAAA,CAAK,KAAK,YAAY,EAClC,KAAK,QACL,QAASN,EACT,QAASC,EAER,SAAAA,EAAgB,YAAc,OACjC,EACCM,EAAmBZ,CAAK,GACvBH,EAAClB,EAAA,CAAM,UAAU,MAAM,WAAW,SAAS,IAAK,EAC9C,UAAAiB,EAACf,EAAA,CACC,QAAQ,WACR,SAAU,GACV,MAAM,gBACP,yBAED,EACAe,EAACiB,EAAA,EAAY,GACf,GAEJ,GACF,GACF,CAEJ,EAEOC,GAAQhB","sourcesContent":["import Avatar from '@mui/material/Avatar';\nimport Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport type { Theme } from '@mui/material/styles';\nimport { alpha } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport CustomAvatar from 'components/CustomAvatar';\nimport Icon from 'components/Icon';\nimport ToggleTheme from 'components/ToggleTheme';\nimport usePopover from 'hooks/usePopover';\nimport { checkIsSpecialUser } from 'utils/user';\n\nimport { AvatarButtonProps } from './props';\nimport {\n AccountInformations,\n Button,\n LogoutButton,\n MenuItem,\n MenuPopover,\n ResourceItem,\n ResourcesGrid,\n Section,\n} from './styles';\n\nconst AvatarButton = ({\n name = '',\n email = '',\n src,\n content,\n menuItems,\n subContent,\n logout,\n loadingLogout,\n}: AvatarButtonProps) => {\n const popover = usePopover();\n\n return (\n <>\n <Button data-testid=\"avatar-trigger-button\">\n <CustomAvatar\n alt={name}\n name={name}\n src={src}\n onClick={popover.onOpen}\n data-testid=\"avatar-trigger\"\n sx={{ maxWidth: 34, maxHeight: 34 }}\n />\n </Button>\n\n <MenuPopover\n open={popover.open}\n onClose={popover.onClose}\n arrow=\"top-right\"\n disableRestoreFocus\n data-testid=\"avatar-menu\"\n >\n <AccountInformations data-testid=\"avatar-account\">\n <Avatar\n sx={{\n bgcolor: theme =>\n theme.palette.mode === 'dark'\n ? alpha(theme.palette.primary.main, 0.04)\n : 'success.lighter',\n border: theme =>\n theme.palette.mode === 'dark'\n ? '1px solid rgb(255, 252, 252)'\n : 'none',\n color: theme =>\n theme.palette.mode === 'dark'\n ? 'primary.contrastText'\n : 'success.main',\n width: 60,\n height: 60,\n }}\n data-testid=\"avatar-initials\"\n >\n {name.slice(0, 2).toUpperCase()}\n </Avatar>\n\n <Stack alignItems=\"center\" textAlign=\"center\">\n <Typography variant=\"subtitle2\" color=\"text.primary\">\n {name}\n </Typography>\n\n <Typography variant=\"body2\" color=\"text.secondary\">\n {email}\n </Typography>\n </Stack>\n </AccountInformations>\n\n <Divider />\n\n {content && (\n <>\n <Section data-testid=\"avatar-content\">{content}</Section>\n <Divider />\n </>\n )}\n\n {menuItems && (\n <>\n <Section data-testid=\"avatar-menu-items\">\n {menuItems.map(item => (\n <MenuItem\n key={item.label}\n data-testid={`avatar-menu-item-${item.label\n .toLowerCase()\n .replace(/\\s+/g, '-')}`}\n startIcon={\n <Icon\n icon={item.icon}\n color={(theme: Theme) =>\n theme.palette.mode === 'dark'\n ? 'text.secondary'\n : 'primary.main'\n }\n />\n }\n {...(item.component && {\n component: item.component,\n to: item.to,\n })}\n {...(item.onClick && { onClick: item.onClick })}\n >\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n flex={1}\n gap={1}\n >\n <Typography\n variant=\"caption\"\n fontSize={13}\n color=\"text.secondary\"\n >\n {item.label}\n </Typography>\n <Icon icon=\"ARROW_RIGHT_SIMPLE\" color=\"text.primary\" />\n </Stack>\n </MenuItem>\n ))}\n </Section>\n <Divider />\n </>\n )}\n\n {subContent && (\n <>\n <Section data-testid=\"avatar-subcontent\">{subContent}</Section>\n <Divider />\n </>\n )}\n\n <Section data-testid=\"avatar-resources\">\n <ResourcesGrid>\n <ResourceItem\n data-testid=\"resource-youtube\"\n onClick={() =>\n window.open(\n 'https://youtube.com/playlist?list=PLqv8txNiT9o_LReCh5wKPiQaeBTg2Q1i3&si=3nGSAU3AdcPwoa-R',\n '_blank',\n 'noopener noreferrer',\n )\n }\n >\n <Icon icon=\"YOUTUBE\" color=\"primary.main\" />\n <Typography variant=\"caption\">Videos</Typography>\n </ResourceItem>\n\n <ResourceItem\n data-testid=\"resource-ajuda\"\n onClick={() =>\n window.open(\n 'https://ajuda.zydon.com.br',\n '_blank',\n 'noopener noreferrer',\n )\n }\n >\n <Icon icon=\"HELP_CIRCLE\" color=\"primary.main\" />\n <Typography variant=\"caption\">Ajuda</Typography>\n </ResourceItem>\n\n <ResourceItem\n data-testid=\"resource-docs\"\n onClick={() =>\n window.open(\n 'https://docs.zydon.com.br',\n '_blank',\n 'noopener noreferrer',\n )\n }\n >\n <Icon icon=\"CODE_FOLDER\" color=\"primary.main\" />\n <Typography variant=\"caption\">Docs</Typography>\n </ResourceItem>\n </ResourcesGrid>\n </Section>\n\n <Divider />\n\n <Section direction=\"row\">\n <LogoutButton\n data-testid=\"logout-button\"\n startIcon={<Icon icon=\"LOGOUT_02\" />}\n size=\"small\"\n onClick={logout}\n loading={loadingLogout}\n >\n {loadingLogout ? 'Saindo...' : 'Sair'}\n </LogoutButton>\n {checkIsSpecialUser(email) && (\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Typography\n variant=\"overline\"\n fontSize={11}\n color=\"text.disabled\"\n >\n Aparência:\n </Typography>\n <ToggleTheme />\n </Stack>\n )}\n </Section>\n </MenuPopover>\n </>\n );\n};\n\nexport default AvatarButton;\n","import MuiLoadingButton from '@mui/lab/LoadingButton';\nimport MuiButton from '@mui/material/Button';\nimport Stack from '@mui/material/Stack';\nimport { alpha, styled } from '@mui/material/styles';\n\nimport CommonMenuPopover from 'components/MenuPopover';\n\nexport const Button = styled(Stack)({\n width: 40,\n height: 40,\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: '50%',\n border: '2px solid #1C1C1C',\n cursor: 'pointer',\n});\n\nexport const MenuPopover = styled(CommonMenuPopover)(({ theme }) => ({\n width: 322,\n marginTop: 20,\n\n '& .MuiPopover-paper': {\n width: 540,\n padding: 0,\n backgroundColor: theme.palette.background.paper,\n borderRadius: theme.spacing(1),\n backgroundImage: 'none',\n },\n}));\n\nexport const AccountInformations = styled(Stack)(({ theme }) => ({\n alignItems: 'center',\n justifyContent: 'center',\n gap: theme.spacing(1.5),\n padding: theme.spacing(3),\n backgroundColor: alpha(theme.palette.primary.main, 0.04),\n}));\n\nexport const Section = styled(Stack)(({ theme }) => ({\n marginLeft: theme.spacing(1.75),\n marginRight: theme.spacing(1.75),\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n gap: theme.spacing(1),\n}));\n\nexport const MenuItem = styled(MuiButton)(({ theme }) => ({\n width: '100%',\n alignItems: 'flex-start',\n justifyContent: 'flex-start',\n color: theme.palette.text.primary,\n}));\n\nexport const ResourcesGrid = styled(Stack)(({ theme }) => ({\n display: 'grid',\n gridTemplateColumns: 'repeat(3, 1fr)',\n gap: theme.spacing(2),\n cursor: 'pointer',\n}));\n\nexport const ResourceItem = styled(Stack)(({ theme }) => ({\n alignItems: 'center',\n gap: theme.spacing(0.5),\n color: theme.palette.text.secondary,\n textAlign: 'center',\n\n '&:hover': {\n color: theme.palette.primary.main,\n },\n}));\n\nexport const LogoutButton = styled(MuiLoadingButton)(({ theme }) => ({\n width: '100%',\n alignItems: 'flex-start',\n justifyContent: 'flex-start',\n color: theme.palette.error.main,\n}));\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { a } from '../../chunk-2GTD4JW2.js';
|
|
2
2
|
import '../../chunk-PBLSVXV5.js';
|
|
3
|
-
import { b } from '../../chunk-
|
|
3
|
+
import { b } from '../../chunk-AYUKIKNC.js';
|
|
4
4
|
import '../../chunk-373WGZZL.js';
|
|
5
|
+
import '../../chunk-X4F3O7PX.js';
|
|
5
6
|
import '../../chunk-Q2AVS24Z.js';
|
|
6
7
|
import '../../chunk-LNESYSHP.js';
|
|
7
|
-
import '../../chunk-WUFEPE2G.js';
|
|
8
|
-
import '../../chunk-BX2DSNRV.js';
|
|
9
|
-
import '../../chunk-X4F3O7PX.js';
|
|
10
8
|
import '../../chunk-YPL4KIKN.js';
|
|
11
9
|
import '../../chunk-HBOBTNB5.js';
|
|
10
|
+
import '../../chunk-WUFEPE2G.js';
|
|
11
|
+
import '../../chunk-BX2DSNRV.js';
|
|
12
12
|
import { k } from '../../chunk-GLRLKFPS.js';
|
|
13
13
|
import 'dayjs/locale/pt-br';
|
|
14
14
|
import _ from 'dayjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../../chunk-4P2L7UJA.js';
|
|
2
2
|
export { a as FilterOperator, b as SortType } from '../../chunk-P64QBDAO.js';
|
|
3
|
-
import { a as a$4 } from '../../chunk-WLRSUL67.js';
|
|
4
3
|
import { d, c } from '../../chunk-A7QSCOUE.js';
|
|
4
|
+
import { a as a$4 } from '../../chunk-WLRSUL67.js';
|
|
5
5
|
import { h, a as a$6 } from '../../chunk-OF6623HG.js';
|
|
6
6
|
import { d as d$1 } from '../../chunk-E4Q7LX5L.js';
|
|
7
7
|
import '../../chunk-R2BCPHRH.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { a as default } from '../../chunk-
|
|
2
|
-
import '../../chunk-KGLU4CR2.js';
|
|
1
|
+
export { a as default } from '../../chunk-CKCNZJL6.js';
|
|
3
2
|
import '../../chunk-J5B2YJSR.js';
|
|
3
|
+
import '../../chunk-KGLU4CR2.js';
|
|
4
4
|
import '../../chunk-2GTD4JW2.js';
|
|
5
5
|
import '../../chunk-PBLSVXV5.js';
|
|
6
6
|
import '../../chunk-2ZJUGM2S.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { r as ContentType, s as FileContentType, k as FileThumbnail, a as HelperText, b as MultiFilePreview, u as MultipleFileUpload, v as MultipleImageUpload, c as SingleFilePreview, w as SingleFileUpload, x as SingleImageUpload, y as UploadAvatar, z as UploadSimpleBox, n as compressImageWithoutCrop, m as convertToWebP, p as encodeFilenameForHeader, f as fileFormat, d as fileFormatByMimeType, e as fileFormatByName, i as fileNameByUrl, g as fileThumb, j as fileThumbnailClasses, h as fileTypeByUrl, o as getFileNameFromContentDisposition, l as isImageFile, q as useDropzoneUploader, t as useFileUploadService } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { r as ContentType, s as FileContentType, k as FileThumbnail, a as HelperText, b as MultiFilePreview, u as MultipleFileUpload, v as MultipleImageUpload, c as SingleFilePreview, w as SingleFileUpload, x as SingleImageUpload, y as UploadAvatar, z as UploadSimpleBox, n as compressImageWithoutCrop, m as convertToWebP, p as encodeFilenameForHeader, f as fileFormat, d as fileFormatByMimeType, e as fileFormatByName, i as fileNameByUrl, g as fileThumb, j as fileThumbnailClasses, h as fileTypeByUrl, o as getFileNameFromContentDisposition, l as isImageFile, q as useDropzoneUploader, t as useFileUploadService } from '../../chunk-45GFZNTZ.js';
|
|
2
|
+
import '../../chunk-CKCNZJL6.js';
|
|
3
|
+
import '../../chunk-J5B2YJSR.js';
|
|
3
4
|
import '../../chunk-KGLU4CR2.js';
|
|
4
5
|
import '../../chunk-SYOUADDE.js';
|
|
5
|
-
import '../../chunk-J5B2YJSR.js';
|
|
6
|
-
import '../../chunk-EN24URDV.js';
|
|
7
6
|
import '../../chunk-OF6623HG.js';
|
|
7
|
+
import '../../chunk-EN24URDV.js';
|
|
8
8
|
import '../../chunk-6U5LS7MP.js';
|
|
9
9
|
import '../../chunk-5J35UAV6.js';
|
|
10
10
|
import '../../chunk-I3B772WD.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { F as FiltersProps } from '../../props-8e304e21.js';
|
|
3
|
+
import '../../types/period.js';
|
|
4
|
+
|
|
5
|
+
declare const Filters: ({ type, value, onChange, paramKey, dataKey, label, }: FiltersProps) => react_jsx_runtime.JSX.Element;
|
|
6
|
+
|
|
7
|
+
export { Filters as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { a as a$2 } from '../../chunk-XAPSXJZO.js';
|
|
2
|
+
import { a as a$3 } from '../../chunk-J7RPKCIN.js';
|
|
3
|
+
import { c } from '../../chunk-VGTQYKAC.js';
|
|
4
|
+
import { a } from '../../chunk-CO2KQFUN.js';
|
|
5
|
+
import { a as a$6 } from '../../chunk-NAGBHM6W.js';
|
|
6
|
+
import { a as a$4 } from '../../chunk-6N456D64.js';
|
|
7
|
+
import { a as a$5 } from '../../chunk-2GTD4JW2.js';
|
|
8
|
+
import '../../chunk-PBLSVXV5.js';
|
|
9
|
+
import { a as a$7 } from '../../chunk-LQRRMVFN.js';
|
|
10
|
+
import { b } from '../../chunk-2ZJUGM2S.js';
|
|
11
|
+
import { b as b$1, a as a$1, c as c$1, e, h, g } from '../../chunk-4UECQEE3.js';
|
|
12
|
+
import '../../chunk-K3T3E52L.js';
|
|
13
|
+
import { memo, useState, useMemo, useEffect, useCallback, useRef } from 'react';
|
|
14
|
+
import p from '@mui/material/Stack';
|
|
15
|
+
import { useForm } from 'react-hook-form';
|
|
16
|
+
import me from '@mui/material/Button';
|
|
17
|
+
import de from '@mui/material/Checkbox';
|
|
18
|
+
import Y from '@mui/material/Divider';
|
|
19
|
+
import q from '@mui/material/Typography';
|
|
20
|
+
import { styled } from '@mui/material/styles';
|
|
21
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
22
|
+
|
|
23
|
+
var H=styled(a)(({theme:o})=>({marginTop:10,"& .MuiPopover-paper":{width:540,padding:o.spacing(3),backgroundColor:o.palette.background.paper,borderRadius:o.spacing(1),backgroundImage:"none",[o.breakpoints.down("sm")]:{width:"90vw",maxWidth:"calc(100vw - 32px)",padding:o.spacing(2)}}})),N=styled(c)(({theme:o})=>({"& .MuiPickersCalendarHeader-label":{textTransform:"capitalize"},[o.breakpoints.down(400)]:{"& .MuiPickersCalendarHeader-root":{padding:o.spacing(0,7)},"& .MuiDayCalendar-header, & .MuiDayCalendar-weekContainer":{gap:0},"& .MuiPickersDay-root, & .MuiDateRangePickerDay-root":{width:32,height:32},"& .MuiDayCalendar-weekDayLabel":{width:32,height:32},"& .MuiDayCalendar-slideTransition":{minHeight:210}},[o.breakpoints.down(350)]:{"& .MuiPickersDay-root, & .MuiDateRangePickerDay-root":{width:28,height:28},"& .MuiDayCalendar-weekDayLabel":{width:28,height:28},"& .MuiDayCalendar-slideTransition":{minHeight:196}}}));var pe=["D","S","T","Q","Q","S","S"],ue=({open:o,onClose:u,type:l,value:i,onApply:m})=>{let y=b("down","sm"),f=useForm({defaultValues:i}),{handleSubmit:w,getValues:D,setValue:t,watch:s,reset:S}=f,[C,d]=useState([i.initialDate,i.finalDate]),Z=s("initialDate"),K=s("finalDate"),x=s("period"),ee=!Z||!K,oe=l==="PAST",te=l==="FUTURE",c=useMemo(()=>b$1(l),[l]),M=useMemo(()=>c.map(e=>({label:a$1[e],value:e})),[c]);useEffect(()=>{o&&S(i);},[o,S,i]),useEffect(()=>{d([i.initialDate,i.finalDate]);},[i.finalDate,i.initialDate]);let I=useCallback(e=>{let{initialDate:r,finalDate:n}=c$1(e);d([r,n]),t("period",e),t("initialDate",r),t("finalDate",n);},[t]),ae=useCallback(e$1=>{if(d(e$1),e$1[0]&&t("initialDate",e$1[0]),e$1[1]&&t("finalDate",e$1[1]),e$1[0]&&e$1[1]){let r=e(e$1[0],e$1[1],c);t("period",r);}},[c,t]),ie=useCallback(e$1=>{t("initialDate",e$1);let r=D("finalDate");if(e$1&&r){let n=[e$1,r];d(n);let v=e(n[0],n[1],c);t("period",v);}},[c,D,t]),re=useCallback(e$1=>{t("finalDate",e$1);let r=D("initialDate");if(r&&e$1){let n=[r,e$1];d(n);let v=e(n[0],n[1],c);t("period",v);}},[c,D,t]),ne=useCallback(e=>{m(e),u();},[m,u]);return jsx(H,{open:o,onClose:u,arrow:y?"top-center":"top-left",disabledArrow:!0,children:jsxs(a$2,{methods:f,onSubmit:w(ne),gap:2,children:[jsx(q,{variant:"overline",color:"text.disabled",children:"Defina o per\xEDodo"}),jsxs(p,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:2,children:[jsx(a$3,{name:"initialDate",label:"In\xEDcio",onChange:ie,slotProps:{textField:{size:"small"}}}),jsx(a$3,{name:"finalDate",label:"T\xE9rmino",onChange:re,slotProps:{textField:{size:"small"}}})]}),jsx(p,{display:{xs:"block",sm:"none"},children:jsx(a$4,{name:"period",options:M,onChange:e=>e&&I(e),value:x,size:"small",disableClearable:!0,fullWidth:!0})}),jsxs(p,{direction:{xs:"column",sm:"row"},alignItems:"center",justifyContent:{xs:"center",sm:"space-between"},gap:{xs:2,sm:3},overflow:"hidden",children:[jsx(p,{display:{xs:"none",sm:"block"},children:M.map(e=>jsxs(p,{direction:"row",alignItems:"center",gap:.5,sx:{m:.4},children:[jsx(de,{id:`period_${e.value}`,name:`period_${e.value}`,icon:jsx(a$5,{icon:"CHECKMARK_CIRCLE_ROUNDED",color:"primary.main"}),checkedIcon:jsx(a$5,{icon:"CHECKMARK_CIRCLE",color:"primary.main"}),checked:x===e.value,onChange:()=>I(e.value)}),jsx(q,{component:"label",htmlFor:`period_${e.value}`,mt:.2,variant:"body2",color:"text.primary",sx:{cursor:"pointer",whiteSpace:"nowrap"},children:e.label})]},e.value))}),jsx(Y,{orientation:"vertical",flexItem:!0,sx:{display:{xs:"none",sm:"block"}}}),jsx(p,{width:{xs:"100%",sm:"auto"},alignItems:"center",justifyContent:"center",children:jsx(N,{calendars:1,value:C,onChange:ae,disableFuture:oe,disablePast:te,showDaysOutsideCurrentMonth:!0,fixedWeekNumber:6,dayOfWeekFormatter:e=>pe[e.day()],sx:{"& .MuiDateRangeCalendar-root":{width:{xs:"100%",sm:"auto"}}}})})]}),jsx(Y,{flexItem:!0}),jsxs(p,{direction:"row",alignItems:"center",justifyContent:"flex-end",gap:1,children:[jsx(me,{variant:"outlined",color:"inherit",onClick:u,children:"Cancelar"}),jsx(a$6,{actionType:"SAVE",variant:"contained",color:"primary",type:"submit",disabled:ee,children:"Aplicar"})]})]})})},G=memo(ue);var J=styled(me)(({theme:o})=>({color:o.palette.text.primary,borderColor:o.palette.divider,"&:hover":{backgroundColor:"transparent"},[o.breakpoints.down("md")]:{"&.filters-button":{minWidth:"auto",padding:"6px 8px",fontSize:0,overflow:"hidden","& .MuiButton-startIcon":{margin:0,fontSize:"1rem"}}}}));var X=typeof window>"u",Ce=({type:o="FREE",value:u,onChange:l,paramKey:i,dataKey:m,label:y="Per\xEDodo"})=>{let f=a$7(),w=useRef(!1);useEffect(()=>{if(X||!i||w.current)return;w.current=!0;let t=new URLSearchParams(window.location.search),s=h(t,{paramKey:i,dataKey:m});s&&l(s);},[m,l,i]);let D=useCallback(t=>{if(l(t),X||!i)return;let s=new URLSearchParams(window.location.search),C=g(t,{paramKey:i,dataKey:m},s).toString(),d=`${window.location.pathname}${C?`?${C}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",d);},[m,l,i]);return jsxs(Fragment,{children:[jsx(p,{alignItems:"flex-start",children:jsx(J,{variant:"outlined",endIcon:jsx(a$5,{icon:"ARROW_DOWN_SIMPLE"}),size:"small",onClick:f.onOpen,children:y})}),jsx(G,{open:f.open,onClose:f.onClose,type:o,value:u,onApply:D})]})},eo=Ce;
|
|
24
|
+
|
|
25
|
+
export { eo as default };
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Filters/index.tsx","../../../src/components/Filters/FilterPopover/index.tsx","../../../src/components/Filters/FilterPopover/styles.ts","../../../src/components/Filters/styles.ts"],"names":["useCallback","useEffect","useRef","Stack","memo","useMemo","useState","useForm","Button","Checkbox","Divider","Typography","styled","MenuPopover","MenuPopover_default","theme","ResponsiveDateRangeCalendar","DateRangeCalendar_default","jsx","jsxs","DAYS_OF_WEEK","FilterPopover","open","onClose","type","value","onApply","isMobile","useResponsive_default","methods","handleSubmit","getValues","setValue","watch","reset","dateRange","setDateRange","watchedInitialDate","watchedFinalDate","watchedPeriod","isSubmitDisabled","disableFuture","disablePast","availablePeriods","getPeriodsByType","periodOptions","period","periodLabels","onPeriodChange","next","initialDate","finalDate","getPeriodDates","handleRangeChange","newRange","matching","findMatchingPeriod","handleInitialDateChange","date","handleFinalDateChange","onSubmit","formData","Form_default","DateField_default","Autocomplete_default","option","Icon_default","day","ActionButton_default","FilterPopover_default","MUIButton","Fragment","IS_SERVER","Filters","onChange","paramKey","dataKey","label","popover","usePopover_default","hydratedRef","params","fromUrl","deserializeFilterFromSearchParams","handleApply","current","search","serializeFilterToSearchParams","url","Filters_default"],"mappings":"2hBAAA,OAAS,eAAAA,GAAa,aAAAC,GAAW,UAAAC,OAAc,QAC/C,OAAOC,OAAW,sBCDlB,OAAS,QAAAC,GAAM,eAAAJ,EAAa,aAAAC,EAAW,WAAAI,EAAS,YAAAC,OAAgB,QAChE,OAAS,WAAAC,OAAe,kBACxB,OAAOC,OAAY,uBACnB,OAAOC,OAAc,yBACrB,OAAOC,MAAa,wBACpB,OAAOP,MAAW,sBAClB,OAAOQ,MAAgB,2BCNvB,OAAS,UAAAC,MAAc,uBAKhB,IAAMC,EAAcD,EAAOE,CAAiB,EAAE,CAAC,CAAE,MAAAC,CAAM,KAAO,CACnE,UAAW,GAEX,sBAAuB,CACrB,MAAO,IACP,QAASA,EAAM,QAAQ,CAAC,EACxB,gBAAiBA,EAAM,QAAQ,WAAW,MAC1C,aAAcA,EAAM,QAAQ,CAAC,EAC7B,gBAAiB,OAEjB,CAACA,EAAM,YAAY,KAAK,IAAI,CAAC,EAAG,CAC9B,MAAO,OACP,SAAU,qBACV,QAASA,EAAM,QAAQ,CAAC,CAC1B,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AC,EAEGM,GAASR,EAASQ,CAAO,CAC/B,EAAG,CAACN,EAASF,EAAUC,CAAQ,CAAC,EAEhC,IAAMS,EAAcpF,GACjBiD,GAAsB,CAGrB,GAFAyB,EAASzB,CAAI,EAETuB,GAAa,CAACG,EAAU,OAE5B,IAAMU,EAAU,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAMpDC,EALSC,EACbtC,EACA,CAAE,SAAA0B,EAAU,QAAAC,CAAQ,EACpBS,CACF,EACsB,SAAS,EACzBG,EAAM,GAAG,OAAO,SAAS,WAC7BF,EAAS,IAAIA,IAAW,KACvB,OAAO,SAAS,OAEnB,OAAO,QAAQ,aAAa,OAAO,QAAQ,MAAO,GAAIE,CAAG,CAC3D,EACA,CAACZ,EAASF,EAAUC,CAAQ,CAC9B,EAEA,OACExD,GAAAoD,GAAA,CACE,UAAArD,EAACf,GAAA,CAAM,WAAW,aAChB,SAAAe,EAACV,EAAA,CACC,QAAQ,WACR,QAASU,EAACgD,EAAA,CAAK,yBAAkC,EACjD,KAAK,QACL,QAASY,EAAQ,OAEhB,SAAAD,EACH,EACF,EAEA3D,EAACmD,EAAA,CACC,KAAMS,EAAQ,KACd,QAASA,EAAQ,QACjB,KAAMtD,EACN,MAAOC,EACP,QAAS2D,EACX,GACF,CAEJ,EAEOK,GAAQhB","sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\nimport Stack from '@mui/material/Stack';\n\nimport Icon from 'components/Icon';\nimport usePopover from 'hooks/usePopover';\nimport { Icon as IconEnum } from 'types/icon';\nimport { FilterValue } from 'types/period';\n\nimport FilterPopover from './FilterPopover';\nimport { FiltersProps, Type } from './props';\nimport { Button } from './styles';\nimport {\n deserializeFilterFromSearchParams,\n serializeFilterToSearchParams,\n} from './utils';\n\nconst IS_SERVER = typeof window === 'undefined';\n\nconst Filters = ({\n type = Type.FREE,\n value,\n onChange,\n paramKey,\n dataKey,\n label = 'Período',\n}: FiltersProps) => {\n const popover = usePopover();\n\n const hydratedRef = useRef(false);\n\n useEffect(() => {\n if (IS_SERVER || !paramKey || hydratedRef.current) return;\n\n hydratedRef.current = true;\n\n const params = new URLSearchParams(window.location.search);\n const fromUrl = deserializeFilterFromSearchParams(params, {\n paramKey,\n dataKey,\n });\n\n if (fromUrl) onChange(fromUrl);\n }, [dataKey, onChange, paramKey]);\n\n const handleApply = useCallback(\n (next: FilterValue) => {\n onChange(next);\n\n if (IS_SERVER || !paramKey) return;\n\n const current = new URLSearchParams(window.location.search);\n const params = serializeFilterToSearchParams(\n next,\n { paramKey, dataKey },\n current,\n );\n const search = params.toString();\n const url = `${window.location.pathname}${\n search ? `?${search}` : ''\n }${window.location.hash}`;\n\n window.history.replaceState(window.history.state, '', url);\n },\n [dataKey, onChange, paramKey],\n );\n\n return (\n <>\n <Stack alignItems=\"flex-start\">\n <Button\n variant=\"outlined\"\n endIcon={<Icon icon={IconEnum.ARROW_DOWN_SIMPLE} />}\n size=\"small\"\n onClick={popover.onOpen}\n >\n {label}\n </Button>\n </Stack>\n\n <FilterPopover\n open={popover.open}\n onClose={popover.onClose}\n type={type}\n value={value}\n onApply={handleApply}\n />\n </>\n );\n};\n\nexport default Filters;\n","import { memo, useCallback, useEffect, useMemo, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport Button from '@mui/material/Button';\nimport Checkbox from '@mui/material/Checkbox';\nimport Divider from '@mui/material/Divider';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport ActionButton from 'components/ActionButton';\nimport Autocomplete from 'components/Autocomplete';\nimport DateField from 'components/form/DateField';\nimport Form from 'components/form/Form';\nimport Icon from 'components/Icon';\nimport useResponsive from 'hooks/useResponsive';\nimport { Icon as IconEnum } from 'types/icon';\nimport { FilterValue, Period } from 'types/period';\n\nimport { Type } from '../props';\nimport {\n findMatchingPeriod,\n getPeriodDates,\n getPeriodsByType,\n periodLabels,\n} from '../utils';\n\nimport { FilterPopoverProps } from './props';\nimport { MenuPopover, ResponsiveDateRangeCalendar } from './styles';\n\nconst DAYS_OF_WEEK = ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'];\n\nconst FilterPopover = ({\n open,\n onClose,\n type,\n value,\n onApply,\n}: FilterPopoverProps) => {\n const isMobile = useResponsive('down', 'sm');\n\n const methods = useForm<FilterValue>({\n defaultValues: value,\n });\n const { handleSubmit, getValues, setValue, watch, reset } = methods;\n\n const [dateRange, setDateRange] = useState<[Date | null, Date | null]>([\n value.initialDate,\n value.finalDate,\n ]);\n\n const watchedInitialDate = watch('initialDate');\n const watchedFinalDate = watch('finalDate');\n const watchedPeriod = watch('period');\n\n const isSubmitDisabled = !watchedInitialDate || !watchedFinalDate;\n const disableFuture = type === Type.PAST;\n const disablePast = type === Type.FUTURE;\n\n const availablePeriods = useMemo(() => getPeriodsByType(type), [type]);\n\n const periodOptions = useMemo(\n () =>\n availablePeriods.map(period => ({\n label: periodLabels[period],\n value: period,\n })),\n [availablePeriods],\n );\n\n useEffect(() => {\n if (open) reset(value);\n }, [open, reset, value]);\n\n useEffect(() => {\n setDateRange([value.initialDate, value.finalDate]);\n }, [value.finalDate, value.initialDate]);\n\n const onPeriodChange = useCallback(\n (next: Period) => {\n const { initialDate, finalDate } = getPeriodDates(next);\n\n setDateRange([initialDate, finalDate]);\n\n setValue('period', next);\n setValue('initialDate', initialDate);\n setValue('finalDate', finalDate);\n },\n [setValue],\n );\n\n const handleRangeChange = useCallback(\n (newRange: [Date | null, Date | null]) => {\n setDateRange(newRange);\n\n if (newRange[0]) setValue('initialDate', newRange[0]);\n if (newRange[1]) setValue('finalDate', newRange[1]);\n\n if (newRange[0] && newRange[1]) {\n const matching = findMatchingPeriod(\n newRange[0],\n newRange[1],\n availablePeriods,\n );\n\n setValue('period', matching);\n }\n },\n [availablePeriods, setValue],\n );\n\n const handleInitialDateChange = useCallback(\n (date: Date) => {\n setValue('initialDate', date);\n\n const finalDate = getValues('finalDate');\n\n if (date && finalDate) {\n const newRange: [Date, Date] = [date, finalDate];\n\n setDateRange(newRange);\n\n const matching = findMatchingPeriod(\n newRange[0],\n newRange[1],\n availablePeriods,\n );\n\n setValue('period', matching);\n }\n },\n [availablePeriods, getValues, setValue],\n );\n\n const handleFinalDateChange = useCallback(\n (date: Date) => {\n setValue('finalDate', date);\n\n const initialDate = getValues('initialDate');\n\n if (initialDate && date) {\n const newRange: [Date, Date] = [initialDate, date];\n\n setDateRange(newRange);\n\n const matching = findMatchingPeriod(\n newRange[0],\n newRange[1],\n availablePeriods,\n );\n\n setValue('period', matching);\n }\n },\n [availablePeriods, getValues, setValue],\n );\n\n const onSubmit = useCallback(\n (formData: FilterValue) => {\n onApply(formData);\n onClose();\n },\n [onApply, onClose],\n );\n\n return (\n <MenuPopover\n open={open}\n onClose={onClose}\n arrow={isMobile ? 'top-center' : 'top-left'}\n disabledArrow\n >\n <Form methods={methods} onSubmit={handleSubmit(onSubmit)} gap={2}>\n <Typography variant=\"overline\" color=\"text.disabled\">\n Defina o período\n </Typography>\n\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n gap={2}\n >\n <DateField\n name=\"initialDate\"\n label=\"Início\"\n onChange={handleInitialDateChange}\n slotProps={{ textField: { size: 'small' } }}\n />\n\n <DateField\n name=\"finalDate\"\n label=\"Término\"\n onChange={handleFinalDateChange}\n slotProps={{ textField: { size: 'small' } }}\n />\n </Stack>\n\n <Stack display={{ xs: 'block', sm: 'none' }}>\n <Autocomplete\n name=\"period\"\n options={periodOptions}\n onChange={next => next && onPeriodChange(next as Period)}\n value={watchedPeriod}\n size=\"small\"\n disableClearable\n fullWidth\n />\n </Stack>\n\n <Stack\n direction={{ xs: 'column', sm: 'row' }}\n alignItems=\"center\"\n justifyContent={{ xs: 'center', sm: 'space-between' }}\n gap={{ xs: 2, sm: 3 }}\n overflow=\"hidden\"\n >\n <Stack display={{ xs: 'none', sm: 'block' }}>\n {periodOptions.map(option => (\n <Stack\n key={option.value}\n direction=\"row\"\n alignItems=\"center\"\n gap={0.5}\n sx={{ m: 0.4 }}\n >\n <Checkbox\n id={`period_${option.value}`}\n name={`period_${option.value}`}\n icon={\n <Icon\n icon={IconEnum.CHECKMARK_CIRCLE_ROUNDED}\n color=\"primary.main\"\n />\n }\n checkedIcon={\n <Icon\n icon={IconEnum.CHECKMARK_CIRCLE}\n color=\"primary.main\"\n />\n }\n checked={watchedPeriod === option.value}\n onChange={() => onPeriodChange(option.value)}\n />\n\n <Typography\n component=\"label\"\n htmlFor={`period_${option.value}`}\n mt={0.2}\n variant=\"body2\"\n color=\"text.primary\"\n sx={{ cursor: 'pointer', whiteSpace: 'nowrap' }}\n >\n {option.label}\n </Typography>\n </Stack>\n ))}\n </Stack>\n\n <Divider\n orientation=\"vertical\"\n flexItem\n sx={{ display: { xs: 'none', sm: 'block' } }}\n />\n\n <Stack\n width={{ xs: '100%', sm: 'auto' }}\n alignItems=\"center\"\n justifyContent=\"center\"\n >\n <ResponsiveDateRangeCalendar\n calendars={1}\n value={dateRange}\n onChange={handleRangeChange}\n disableFuture={disableFuture}\n disablePast={disablePast}\n showDaysOutsideCurrentMonth\n fixedWeekNumber={6}\n dayOfWeekFormatter={day => DAYS_OF_WEEK[day.day()]}\n sx={{\n '& .MuiDateRangeCalendar-root': {\n width: { xs: '100%', sm: 'auto' },\n },\n }}\n />\n </Stack>\n </Stack>\n\n <Divider flexItem />\n\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"flex-end\"\n gap={1}\n >\n <Button variant=\"outlined\" color=\"inherit\" onClick={onClose}>\n Cancelar\n </Button>\n\n <ActionButton\n actionType=\"SAVE\"\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n disabled={isSubmitDisabled}\n >\n Aplicar\n </ActionButton>\n </Stack>\n </Form>\n </MenuPopover>\n );\n};\n\nexport default memo(FilterPopover);\n","import { styled } from '@mui/material/styles';\n\nimport CommonDateRangeCalendar from 'components/DateRangeCalendar';\nimport CommonMenuPopover from 'components/MenuPopover';\n\nexport const MenuPopover = styled(CommonMenuPopover)(({ theme }) => ({\n marginTop: 10,\n\n '& .MuiPopover-paper': {\n width: 540,\n padding: theme.spacing(3),\n backgroundColor: theme.palette.background.paper,\n borderRadius: theme.spacing(1),\n backgroundImage: 'none',\n\n [theme.breakpoints.down('sm')]: {\n width: '90vw',\n maxWidth: 'calc(100vw - 32px)',\n padding: theme.spacing(2),\n },\n },\n}));\n\nexport const ResponsiveDateRangeCalendar = styled(CommonDateRangeCalendar)(\n ({ theme }) => ({\n '& .MuiPickersCalendarHeader-label': {\n textTransform: 'capitalize',\n },\n\n [theme.breakpoints.down(400)]: {\n '& .MuiPickersCalendarHeader-root': {\n padding: theme.spacing(0, 7),\n },\n\n '& .MuiDayCalendar-header, & .MuiDayCalendar-weekContainer': {\n gap: 0,\n },\n\n '& .MuiPickersDay-root, & .MuiDateRangePickerDay-root': {\n width: 32,\n height: 32,\n },\n\n '& .MuiDayCalendar-weekDayLabel': {\n width: 32,\n height: 32,\n },\n\n '& .MuiDayCalendar-slideTransition': {\n minHeight: 210,\n },\n },\n\n [theme.breakpoints.down(350)]: {\n '& .MuiPickersDay-root, & .MuiDateRangePickerDay-root': {\n width: 28,\n height: 28,\n },\n\n '& .MuiDayCalendar-weekDayLabel': {\n width: 28,\n height: 28,\n },\n\n '& .MuiDayCalendar-slideTransition': {\n minHeight: 196,\n },\n },\n }),\n);\n","import MUIButton from '@mui/material/Button';\nimport { styled } from '@mui/material/styles';\n\nexport const Button = styled(MUIButton)(({ theme }) => ({\n color: theme.palette.text.primary,\n borderColor: theme.palette.divider,\n\n '&:hover': {\n backgroundColor: 'transparent',\n },\n\n [theme.breakpoints.down('md')]: {\n '&.filters-button': {\n minWidth: 'auto',\n padding: '6px 8px',\n fontSize: 0,\n overflow: 'hidden',\n\n '& .MuiButton-startIcon': {\n margin: 0,\n fontSize: '1rem',\n },\n },\n },\n}));\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export { a as default } from '../../chunk-UJMWTYPH.js';
|
|
2
2
|
import '../../chunk-U4I7JPER.js';
|
|
3
|
-
import '../../chunk-
|
|
3
|
+
import '../../chunk-AYUKIKNC.js';
|
|
4
4
|
import '../../chunk-373WGZZL.js';
|
|
5
|
+
import '../../chunk-X4F3O7PX.js';
|
|
5
6
|
import '../../chunk-Q2AVS24Z.js';
|
|
6
7
|
import '../../chunk-LNESYSHP.js';
|
|
7
|
-
import '../../chunk-WUFEPE2G.js';
|
|
8
|
-
import '../../chunk-BX2DSNRV.js';
|
|
9
|
-
import '../../chunk-X4F3O7PX.js';
|
|
10
8
|
import '../../chunk-YPL4KIKN.js';
|
|
11
9
|
import '../../chunk-HBOBTNB5.js';
|
|
10
|
+
import '../../chunk-WUFEPE2G.js';
|
|
11
|
+
import '../../chunk-BX2DSNRV.js';
|
|
12
12
|
import '../../chunk-GLRLKFPS.js';
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { x, u, v, w } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
1
|
+
import { x, u, v, w } from '../../../chunk-45GFZNTZ.js';
|
|
2
|
+
import '../../../chunk-CKCNZJL6.js';
|
|
3
|
+
import '../../../chunk-J5B2YJSR.js';
|
|
3
4
|
import '../../../chunk-KGLU4CR2.js';
|
|
4
5
|
import '../../../chunk-SYOUADDE.js';
|
|
5
|
-
import '../../../chunk-J5B2YJSR.js';
|
|
6
|
-
import '../../../chunk-EN24URDV.js';
|
|
7
6
|
import '../../../chunk-OF6623HG.js';
|
|
7
|
+
import '../../../chunk-EN24URDV.js';
|
|
8
8
|
import '../../../chunk-6U5LS7MP.js';
|
|
9
9
|
import '../../../chunk-5J35UAV6.js';
|
|
10
10
|
import '../../../chunk-I3B772WD.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { T as Type } from '../props-8e304e21.js';
|
|
2
|
+
import { FilterValue } from '../types/period.js';
|
|
3
|
+
|
|
4
|
+
interface UseFiltersSearchParamsOptions {
|
|
5
|
+
type?: Type;
|
|
6
|
+
paramKey?: string;
|
|
7
|
+
dataKey?: string;
|
|
8
|
+
defaultValue?: FilterValue;
|
|
9
|
+
}
|
|
10
|
+
declare const useFiltersSearchParams: ({ type, paramKey, dataKey, defaultValue, }?: UseFiltersSearchParamsOptions) => [FilterValue, (value: FilterValue) => void];
|
|
11
|
+
|
|
12
|
+
export { useFiltersSearchParams as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { d, h, g, f } from '../chunk-4UECQEE3.js';
|
|
2
|
+
import '../chunk-K3T3E52L.js';
|
|
3
|
+
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
var c=typeof window>"u",P=({type:p="FREE",paramKey:t=f.paramKey,dataKey:a=f.dataKey,defaultValue:d$1}={})=>{let[f,l]=useState(()=>{let e=d$1??d(p);if(c)return e;let r=new URLSearchParams(window.location.search);return h(r,{paramKey:t,dataKey:a})??e}),n=useRef({paramKey:t,dataKey:a});n.current={paramKey:t,dataKey:a},useEffect(()=>{if(c)return;let e=()=>{let r=new URLSearchParams(window.location.search),s=h(r,n.current);s&&l(s);};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[]);let h$1=useCallback(e=>{if(l(e),c)return;let r=new URLSearchParams(window.location.search),u=g(e,n.current,r).toString(),F=`${window.location.pathname}${u?`?${u}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",F);},[]);return [f,h$1]},v=P;
|
|
6
|
+
|
|
7
|
+
export { v as default };
|
|
8
|
+
//# sourceMappingURL=useFiltersSearchParams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useFiltersSearchParams.ts"],"names":["useCallback","useEffect","useRef","useState","IS_SERVER","useFiltersSearchParams","type","paramKey","DEFAULT_FILTER_KEYS","dataKey","defaultValue","value","setValue","fallback","buildDefaultFilter","params","deserializeFilterFromSearchParams","keysRef","handler","next","update","current","search","serializeFilterToSearchParams","url","useFiltersSearch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CAAG,CAC3D,EAAG,CAAC,CAAC,EAEL,MAAO,CAACb,EAAOS,CAAM,CACvB,EAEOK,EAAQpB","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { Type } from 'components/Filters/props';\nimport {\n buildDefaultFilter,\n DEFAULT_FILTER_KEYS,\n deserializeFilterFromSearchParams,\n serializeFilterToSearchParams,\n} from 'components/Filters/utils';\nimport { FilterValue } from 'types/period';\n\ninterface UseFiltersSearchParamsOptions {\n type?: Type;\n paramKey?: string;\n dataKey?: string;\n defaultValue?: FilterValue;\n}\n\nconst IS_SERVER = typeof window === 'undefined';\n\nconst useFiltersSearchParams = ({\n type = Type.FREE,\n paramKey = DEFAULT_FILTER_KEYS.paramKey,\n dataKey = DEFAULT_FILTER_KEYS.dataKey,\n defaultValue,\n}: UseFiltersSearchParamsOptions = {}): [\n FilterValue,\n (value: FilterValue) => void,\n] => {\n const [value, setValue] = useState<FilterValue>(() => {\n const fallback = defaultValue ?? buildDefaultFilter(type);\n\n if (IS_SERVER) return fallback;\n\n const params = new URLSearchParams(window.location.search);\n\n return (\n deserializeFilterFromSearchParams(params, { paramKey, dataKey }) ??\n fallback\n );\n });\n\n const keysRef = useRef({ paramKey, dataKey });\n keysRef.current = { paramKey, dataKey };\n\n useEffect(() => {\n if (IS_SERVER) return;\n\n const handler = () => {\n const params = new URLSearchParams(window.location.search);\n const next = deserializeFilterFromSearchParams(params, keysRef.current);\n\n if (next) setValue(next);\n };\n\n window.addEventListener('popstate', handler);\n\n return () => window.removeEventListener('popstate', handler);\n }, []);\n\n const update = useCallback((next: FilterValue) => {\n setValue(next);\n\n if (IS_SERVER) return;\n\n const current = new URLSearchParams(window.location.search);\n const params = serializeFilterToSearchParams(\n next,\n keysRef.current,\n current,\n );\n const search = params.toString();\n const url = `${window.location.pathname}${\n search ? `?${search}` : ''\n }${window.location.hash}`;\n\n window.history.replaceState(window.history.state, '', url);\n }, []);\n\n return [value, update];\n};\n\nexport default useFiltersSearchParams;\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { a as useThemeToggle } from '../chunk-U4I7JPER.js';
|
|
2
|
-
import '../chunk-
|
|
2
|
+
import '../chunk-AYUKIKNC.js';
|
|
3
3
|
import '../chunk-373WGZZL.js';
|
|
4
|
+
import '../chunk-X4F3O7PX.js';
|
|
4
5
|
import '../chunk-Q2AVS24Z.js';
|
|
5
6
|
import '../chunk-LNESYSHP.js';
|
|
6
|
-
import '../chunk-WUFEPE2G.js';
|
|
7
|
-
import '../chunk-BX2DSNRV.js';
|
|
8
|
-
import '../chunk-X4F3O7PX.js';
|
|
9
7
|
import '../chunk-YPL4KIKN.js';
|
|
10
8
|
import '../chunk-HBOBTNB5.js';
|
|
9
|
+
import '../chunk-WUFEPE2G.js';
|
|
10
|
+
import '../chunk-BX2DSNRV.js';
|
|
11
11
|
import '../chunk-GLRLKFPS.js';
|
|
12
12
|
//# sourceMappingURL=useThemeToggle.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { a as useThemeToggle } from './chunk-U4I7JPER.js';
|
|
2
|
-
export { b as ThemeProvider, a as createTheme } from './chunk-
|
|
2
|
+
export { b as ThemeProvider, a as createTheme } from './chunk-AYUKIKNC.js';
|
|
3
3
|
import './chunk-373WGZZL.js';
|
|
4
|
+
export { b as defaultFont, c as primaryFont, d as secondaryFont, a as shadows, e as typography } from './chunk-X4F3O7PX.js';
|
|
4
5
|
import './chunk-Q2AVS24Z.js';
|
|
5
6
|
import './chunk-LNESYSHP.js';
|
|
6
|
-
import './chunk-WUFEPE2G.js';
|
|
7
|
-
export { c as SettingsProvider, b as useSettingsContext } from './chunk-BX2DSNRV.js';
|
|
8
|
-
export { b as defaultFont, c as primaryFont, d as secondaryFont, a as shadows, e as typography } from './chunk-X4F3O7PX.js';
|
|
9
7
|
export { l as action, k as background, m as basePalette, p as colorSchemes, i as common, a as components, q as createShadowColor, r as customShadows, o as darkPalette, h as error, b as grey, e as info, n as lightPalette, c as primary, d as secondary, f as success, j as text, g as warning } from './chunk-YPL4KIKN.js';
|
|
10
8
|
import './chunk-HBOBTNB5.js';
|
|
9
|
+
import './chunk-WUFEPE2G.js';
|
|
10
|
+
export { c as SettingsProvider, b as useSettingsContext } from './chunk-BX2DSNRV.js';
|
|
11
11
|
export { a as THEME_CONFIG, q as bgBlur, p as bgGradient, o as borderGradient, j as createPaletteChannel, h as hexToRgbChannel, i as hexToRgbaChannel, l as hideScrollX, m as hideScrollY, r as maxLine, c as mediaQueries, t as menuItem, s as paper, f as pxToRem, e as remToPx, g as responsiveFontSizes, d as setFont, b as stylesMode, n as textGradient, k as varAlpha } from './chunk-GLRLKFPS.js';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FilterValue } from './types/period.js';
|
|
2
|
+
|
|
3
|
+
declare enum Type {
|
|
4
|
+
FREE = "FREE",
|
|
5
|
+
PAST = "PAST",
|
|
6
|
+
FUTURE = "FUTURE"
|
|
7
|
+
}
|
|
8
|
+
interface FiltersProps {
|
|
9
|
+
type?: Type;
|
|
10
|
+
value: FilterValue;
|
|
11
|
+
onChange: (value: FilterValue) => void;
|
|
12
|
+
paramKey?: string;
|
|
13
|
+
dataKey?: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { FiltersProps as F, Type as T };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { b as default } from '../chunk-
|
|
1
|
+
export { b as default } from '../chunk-AYUKIKNC.js';
|
|
2
2
|
import '../chunk-373WGZZL.js';
|
|
3
|
+
import '../chunk-X4F3O7PX.js';
|
|
3
4
|
import '../chunk-Q2AVS24Z.js';
|
|
4
5
|
import '../chunk-LNESYSHP.js';
|
|
5
|
-
import '../chunk-WUFEPE2G.js';
|
|
6
|
-
export { b as useSettingsContext } from '../chunk-BX2DSNRV.js';
|
|
7
|
-
import '../chunk-X4F3O7PX.js';
|
|
8
6
|
import '../chunk-YPL4KIKN.js';
|
|
9
7
|
import '../chunk-HBOBTNB5.js';
|
|
8
|
+
import '../chunk-WUFEPE2G.js';
|
|
9
|
+
export { b as useSettingsContext } from '../chunk-BX2DSNRV.js';
|
|
10
10
|
export { a as THEME_CONFIG } from '../chunk-GLRLKFPS.js';
|
|
11
11
|
//# sourceMappingURL=theme-provider.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare enum Period {
|
|
2
|
+
LAST_YEAR = "LAST_YEAR",
|
|
3
|
+
LAST_MONTH = "LAST_MONTH",
|
|
4
|
+
LAST_28_DAYS = "LAST_28_DAYS",
|
|
5
|
+
LAST_7_DAYS = "LAST_7_DAYS",
|
|
6
|
+
LAST_WEEK = "LAST_WEEK",
|
|
7
|
+
YESTERDAY = "YESTERDAY",
|
|
8
|
+
TODAY = "TODAY",
|
|
9
|
+
TOMORROW = "TOMORROW",
|
|
10
|
+
NEXT_7_DAYS = "NEXT_7_DAYS",
|
|
11
|
+
NEXT_30_DAYS = "NEXT_30_DAYS",
|
|
12
|
+
NEXT_90_DAYS = "NEXT_90_DAYS",
|
|
13
|
+
NEXT_MONTH = "NEXT_MONTH",
|
|
14
|
+
THIS_YEAR = "THIS_YEAR",
|
|
15
|
+
NEXT_YEAR = "NEXT_YEAR",
|
|
16
|
+
CUSTOM = "CUSTOM"
|
|
17
|
+
}
|
|
18
|
+
interface FilterValue {
|
|
19
|
+
period: Period;
|
|
20
|
+
initialDate: Date | null;
|
|
21
|
+
finalDate: Date | null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { FilterValue, Period };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|