@zydon/common 2.4.37 → 2.4.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { a as a$
|
|
1
|
+
import { a as a$4 } from '../../chunk-H5L4ARDB.js';
|
|
2
2
|
import { a } from '../../chunk-AV36ZLPF.js';
|
|
3
3
|
import { e } from '../../chunk-ANAHA3L6.js';
|
|
4
4
|
import { a as a$2 } from '../../chunk-IPOTBSM7.js';
|
|
5
5
|
import { f } from '../../chunk-IOF7MNRL.js';
|
|
6
|
-
import { a as a$
|
|
6
|
+
import { a as a$5 } from '../../chunk-6VHUXLMC.js';
|
|
7
7
|
import '../../chunk-4WWRGU3D.js';
|
|
8
8
|
import '../../chunk-DNLTCAWK.js';
|
|
9
9
|
import { a as a$1 } from '../../chunk-UMQQZM4U.js';
|
|
10
10
|
import { x } from '../../chunk-2P4CXK3O.js';
|
|
11
|
-
import { a as a$
|
|
11
|
+
import { a as a$7 } from '../../chunk-FK7DDO5L.js';
|
|
12
12
|
import { j } from '../../chunk-DMQW3LDF.js';
|
|
13
|
-
import { a as a$
|
|
13
|
+
import { a as a$6 } from '../../chunk-YQ6K2DEP.js';
|
|
14
14
|
import '../../chunk-CHLVIVDD.js';
|
|
15
15
|
import '../../chunk-ILHUUK4X.js';
|
|
16
|
-
import { a as a$
|
|
17
|
-
import { a as a$
|
|
18
|
-
import { memo, useRef, useMemo, useCallback,
|
|
16
|
+
import { a as a$3 } from '../../chunk-S7QQBC4I.js';
|
|
17
|
+
import { a as a$8 } from '../../chunk-ONZBWH3C.js';
|
|
18
|
+
import { memo, forwardRef, useState, useLayoutEffect, useRef, useMemo, useCallback, useEffect } from 'react';
|
|
19
19
|
import _o from '@mui/material/FormHelperText';
|
|
20
20
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
21
21
|
import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from '@dnd-kit/core';
|
|
@@ -25,13 +25,13 @@ import { m, AnimatePresence } from 'framer-motion';
|
|
|
25
25
|
import ie from '@mui/material/Stack';
|
|
26
26
|
import ke from '@mui/material/Typography';
|
|
27
27
|
import me from '@mui/material/Box';
|
|
28
|
-
import
|
|
28
|
+
import Lo from '@mui/material/IconButton';
|
|
29
29
|
import Co from '@mui/material/Paper';
|
|
30
30
|
import { styled, alpha } from '@mui/material/styles';
|
|
31
31
|
import No from '@mui/material/Badge';
|
|
32
32
|
import { useDropzone } from 'react-dropzone';
|
|
33
|
-
import
|
|
33
|
+
import Yr from '@mui/material/CircularProgress';
|
|
34
34
|
|
|
35
|
-
var Oo=({helperText:e,disabled:t,isError:r})=>e?jsx(_o,{error:r,sx:i=>({mx:"14px",color:t?i.palette.grey[500]:void 0}),children:e}):null,N=memo(Oo);var Ae=styled(ie)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),Ee=styled(ie)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),Xe=styled(me,{shouldForwardProp:e=>!["isDragActive","isError","disabled"].includes(e)})(({theme:e,isDragActive:t,isError:r,disabled:i})=>({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:`1px dashed ${alpha(e.palette.grey[500],.32)}`,...t&&{opacity:.72},...r&&{color:e.palette.error.main,backgroundColor:e.palette.error.lighter,borderColor:e.palette.error.light},...i&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}}));styled(ie)(({theme:e})=>({display:"none",position:"absolute",alignItems:"center",justifyContent:"center",flexDirection:"row",gap:12,width:"100%",height:"100%",backgroundColor:alpha(e.palette.primary.main,.9),zIndex:999,button:{"&, &:hover, &:focus":{backgroundColor:"#fff"}}}));var Ve=styled(Mo)(({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]}})),Me=styled("div")({position:"relative",zIndex:1,"&:hover":{zIndex:2}}),Ke=styled(ie,{shouldForwardProp:e=>!["isDragging"].includes(e)})(({theme:e,width:t,isDragging:r})=>({width:t,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)"})),Je=styled(m.div)(({theme:e,width:t,isDragging:r})=>({width:t,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)"})),Qe=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)}})),Ye=styled(me,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="disabled"&&e!=="hasError"})(({theme:e,isDragActive:t,disabled:r,hasError:i})=>({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)}`,...t&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...i&&{color:e.palette.error.main,borderColor:e.palette.error.main,backgroundColor:alpha(e.palette.error.main,.08)},"&:hover":{opacity:.72}})),eo=styled(me)(({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":{filter:"blur(3px)"}})),oo=styled("img",{shouldForwardProp:e=>e!=="aspectRatio"&&e!=="isLoading"&&e!=="isUploading"})(({theme:e,aspectRatio:t,height:r=1,width:i=1,maxWidth:a,maxHeight:l,isLoading:p,isUploading:m})=>({borderRadius:e.shape.borderRadius,objectFit:"cover",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%) scale(1)",filter:"blur(0)",zIndex:1,aspectRatio:t,maxWidth:a,maxHeight:l,backgroundColor:e.palette.background.paper,height:r>=i?"100%":`calc(100% * ${t})`,width:r>i?`calc(${t} * 100%)`:"100%",transition:"all 0.5s ease-in-out",...p||m?{opacity:0,filter:"blur(1.5rem)",transform:"translate(-50%, -50%) scale(0.7)"}:{},"&:hover":{transition:"all 0.2s ease-in-out"}})),ro=styled("img",{shouldForwardProp:e=>e!=="isLoading"&&e!=="isUploading"})(({isLoading:e,isUploading:t})=>({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},...t&&{opacity:.7,filter:"blur(2rem)"}})),to=styled(ie)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(Co)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var Ce=styled(me,{shouldForwardProp:e=>e!=="isError"&&e!=="hasFile"})(({theme:e,isError:t,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},...t&&{color:e.palette.error.main},...r&&{zIndex:9,opacity:0,color:e.palette.common.white,backgroundColor:alpha(e.palette.common.black,.54)}})),io=styled(ie)({top:0,left:0,right:0,bottom:0,position:"absolute",zIndex:10,alignItems:"center",justifyContent:"center"});styled(ie)(({theme:e})=>({padding:20,justifyContent:"center",alignItems:"center",gap:4,alignSelf:"stretch",borderRadius:12,background:e.palette.grey[200],color:e.palette.text.disabled,height:160}));var ao=styled(me,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="isError"&&e!=="hasFile"})(({theme:e,isDragActive:t,disabled:r,isError:i,hasFile:a})=>({padding:1,margin:"auto",width:144,height:144,cursor:"pointer",overflow:"hidden",borderRadius:"50%",border:`1px dashed ${alpha(e.palette.grey[500],.2)}`,...t&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...i&&{borderColor:"error.main"},...a&&{...i&&{bgcolor:alpha(e.palette.error.main,.08)},"&:hover .upload-placeholder":{opacity:1},"& img":{filter:"blur(0)"},"&:hover img":{filter:"blur(3px)"}}})),no=styled("img")({width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",transition:"all 0.3s ease-in-out"}),so=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 To=({onRemove:e,sx:t,file:r,disableDrag:i,attributes:a,listeners:l,innerWidth:p,isDragging:m})=>{let n=r?.id||r?.url;return n?jsx(No,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(Je,{width:p,isDragging:m,"data-testid":`preview-multi-img-${n}`,...j().inUp,sx:t,children:[jsx(a$1,{disableDrag:i,...a,...l}),jsx(f,{tooltip:!0,imageView:!0,file:r}),jsx(Ee,{sx:{position:"absolute",right:3,top:3,zIndex:1},children:e&&jsx(so,{size:"small",label:"Remover arquivo",onClick:()=>e(r),icon:"DELETE_MARK_BUTTON_02"})})]})},`badge-${n}`):null},lo=memo(To);var jo=({file:e$1,thumbnail:t,onRemove:r,sx:i,disableDrag:a$3=!1})=>{let l=e$1?.size||0,p=e$1?.name||e$1?.url||e$1?.id,m=e$1?.id||e$1?.url||"",n=typeof e$1=="string",s=a$3?70:80,{attributes:d,listeners:f$1,setNodeRef:c,transform:g,transition:D,isDragging:b}=useSortable({id:m,disabled:a$3}),E={transform:x.Transform.toString(g),transition:D,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${s+8}px`,height:"68px"};return t&&e$1?jsx(Me,{ref:c,style:E,children:jsx(lo,{innerWidth:s,isDragging:b,sx:i,file:e$1,disableDrag:a$3,attributes:d,listeners:f$1,onRemove:r})}):jsx(Me,{ref:c,style:{...E,height:"80px",width:`${s+38}px`},children:jsxs(Ke,{width:s+30,isDragging:b,"data-testid":`preview-multi-img-${m}`,...j().inUp,sx:i,children:[jsx(a$1,{disableDrag:a$3,...d,...f$1}),e$1&&jsx(f,{file:e$1}),jsxs(ie,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$2,{title:p,children:jsx(ke,{variant:"subtitle2",noWrap:!0,children:p})}),jsx(ke,{variant:"caption",sx:{color:"text.secondary"},children:n?"":e(l)})]}),jsx(Ee,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$1),icon:"DELETE_MARK_BUTTON_02"})})]})})},mo=memo(jo);var tr=({thumbnail:e,files:t,onRemove:r,onReorder:i,sx:a})=>{let l=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates}));if(!t?.length)return null;let p=n=>{let{active:s,over:d}=n;if(!(!s||!d||s.id===d.id)&&i){let f=t.findIndex(({id:g})=>g===s.id),c=t.findIndex(({id:g})=>g===d.id);f!==-1&&c!==-1&&i(f,c);}},m=jsx(AnimatePresence,{initial:!1,children:t.map(n=>jsx(mo,{sx:a,file:n,onRemove:r,thumbnail:e,disableDrag:!i},n.id))});return i?jsx(DndContext,{sensors:l,collisionDetection:closestCenter,onDragEnd:p,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:t.map(n=>n.id),strategy:horizontalListSortingStrategy,children:m})}):m},ue=memo(tr);var ir=({onLoading:e,width:t,height:r,ref:i,...a})=>{let[l,p]=useState("calc(100% - 16px)"),[m,n]=useState("calc(100% - 16px)");a$8(()=>{e?.(!i?.current?.complete);});function s(){let d=i?.current;if(d){let{width:f,height:c}=d.getBoundingClientRect();p(`calc(${f||t}px - 16px)`),n(`calc(${c||r}px - 16px)`);}e?.(!1);}return jsx(oo,{...a,ref:i,maxWidth:l,maxHeight:m,onLoad:s,onError:s})},fo=ir;var pr=({file:e,aspectRatio:t=1,isUploading:r,isLoading:i,onLoading:a,cropSize:l})=>{let p=useRef(null),m=e?.name||e?.url||e?.id,n=e?.url||URL.createObjectURL(e),s=typeof l=="number"?l*t:l?.width,d=typeof l=="number"?l:l?.height,f=useMemo(()=>`image-preview-${n}-${i}-${r}-rnd-${Math.random()}`,[n,i,r]);return jsxs(eo,{children:[jsx(fo,{aspectRatio:t,isLoading:i,isUploading:r,height:d,width:s,alt:m,src:n,ref:p,loading:"lazy",onLoading:a},f),jsx(ro,{alt:m,src:n,isLoading:i,isUploading:r})]})},ze=memo(pr);var mi=e=>e.startsWith("image/"),Po=(e,t=.8)=>new Promise((r,i)=>{let a=document.createElement("canvas"),l=a.getContext("2d"),p=new Image;p.onload=()=>{a.width=p.width,a.height=p.height,l?(l.drawImage(p,0,0),a.toBlob(m=>{if(m){let n=new File([m],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});r(n);}else i(new Error("Falha ao converter para WebP"));},"image/webp",t)):i(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},p.onerror=()=>i(new Error("Falha ao carregar imagem")),p.src=URL.createObjectURL(e);});var mr=({filesToUpload:e$1,onFileSelect:t,onFilesSelect:r,onRemove:i,dropzoneOptions:a,enableCrop:l=!1,customAspectRatio:p,convertToWebp:m=!0,maxFiles:n,cropSize:s})=>{let{showErrorMessage:d}=a$7(),f=useMemo(()=>p||(s&&typeof s!="number"?s.width/s.height:1),[p,s]),[c,g]=useState([]),[D,b]=useState(!1),[E,R]=useState(null),[h,x]=useState(null),[u,P]=useState(""),[F,S]=useState(!1),[v,L]=useState([]),[G,_]=useState(0),O=useMemo(()=>e$1&&Array.isArray(e$1)?e$1.filter(o=>o instanceof File):e$1&&e$1 instanceof File?[e$1]:c,[e$1,c]),q=useMemo(()=>e$1&&Array.isArray(e$1)?null:e$1&&e$1 instanceof File?e$1:c[0]||null,[e$1,c]);useEffect(()=>{e$1&&(Array.isArray(e$1)?g(e$1.filter(o=>o instanceof File)):e$1 instanceof File?g([e$1]):e$1===null&&g([]));},[e$1]);let Z=useCallback(()=>{if(v.length>0&&l){let o=v[0];R(o),_(I=>I+1);let w=new FileReader;w.onload=()=>{P(w.result),b(!0);},w.readAsDataURL(o);}},[v,l]);useEffect(()=>{Z();},[Z]);let ee=useCallback((o,w)=>{x(w);},[]),oe=async()=>!E||!h?null:new Promise(o=>{let w=document.createElement("canvas"),I=w.getContext("2d"),W=new Image;W.onload=async()=>{let{width:de,height:X,x:Ro,y:Fo}=h,xe=de,Pe=X;s&&(typeof s=="number"?(xe=s,Pe=s/f):(xe=s.width,Pe=s.height)),w.width=xe,w.height=Pe,I?(I.drawImage(W,Ro,Fo,de,X,0,0,xe,Pe),w.toBlob(async We=>{if(We){let Le=new File([We],E.name,{type:E.type,lastModified:Date.now()});if(m)try{Le=await Po(Le);}catch(So){d(So,"Erro ao converter para WebP");}o(Le);}else o(null);},"image/png")):o(null);},W.src=u;}),re=async()=>{if(!(!E||!h)){S(!0);try{let o=await oe();if(o)if(Array.isArray(e$1)||e$1===void 0&&r){let I=n?[...O,o].slice(0,n):[...O,o];g(I),r?.(I);}else g([o]),t?.(o);let w=v.slice(1);L(w),b(!1),P(""),R(null),w.length>0&&setTimeout(()=>Z(),100);}catch(o){d(o,"Erro ao processar imagem");}finally{S(!1);}}},C=()=>{b(!1),P(""),R(null),L([]),_(0);},z=useCallback(o=>{if(o.length===0)return;if(a?.accept&&Object.keys(a.accept).some(I=>I.includes("image/"))&&l)if(Array.isArray(e$1)||e$1===void 0&&r){let I=o.filter(X=>X.type.startsWith("image/")),W=O.map(X=>X.name),de=I.filter(X=>!W.includes(X.name));if(de.length===0){d("Todos os arquivos selecionados j\xE1 foram adicionados","Arquivos duplicados");return}L(de),_(0);}else {let I=o[0];R(I);let W=new FileReader;W.onload=()=>{P(W.result),b(!0);},W.readAsDataURL(I);}else if(Array.isArray(e$1)||e$1===void 0&&r){let I=n?[...O,...o].slice(0,n):[...O,...o];g(I),r?.(I);}else {let I=o[0];g([I]),t?.(I);}},[e$1,O,t,r,l,n,a,d]),k=useCallback(o=>{if(!o.length)return;let w=o[0]?.errors[0]?.code,I=a?.maxSize||3145728;d(w==="file-too-large"?new Error(`O arquivo excede o tamanho m\xE1ximo de ${e(I)}`):w==="file-invalid-type"?new Error("Formato de arquivo n\xE3o suportado"):o[0]?.errors[0]||new Error("Erro ao enviar arquivo"),"Erro ao fazer upload");},[a?.maxSize,d]),{getRootProps:U,getInputProps:H,isDragActive:j,isDragReject:ye,fileRejections:_e}=useDropzone({onDrop:z,onDropRejected:k,...a}),Oe=useCallback(o=>{if(!o){g([]),i?.(void 0);return}if(Array.isArray(e$1)||e$1===void 0&&r){let w=c.filter(I=>I.name!==o.name);g(w),i?.(o),r&&r(w);}else g([]),i?.(o);},[e$1,c,r,i]),Do=useCallback(()=>{g([]),Array.isArray(e$1)&&r?r([]):!Array.isArray(e$1)&&t&&t?.(null);},[e$1,r,t]);return {file:q,files:O,aspectRatio:f,dropzoneProps:{getRootProps:U,getInputProps:H,isDragActive:j,isDragReject:ye,fileRejections:_e},cropState:{cropModalOpen:D,imagePreview:u,cropLoading:F,setCropModalOpen:b,onCropInitialized:ee,handleCropSave:re,handleCropCancel:C,currentImageIndex:G,totalPendingImages:v.length},handleRemove:Oe,clearFiles:Do,setFiles:g}},T=mr;var Ne=(o=>(o.APPLICATION_OCTET_STREAM="application/octet-stream",o.IMAGE_JPEG="image/jpeg",o.IMAGE_JPG="image/jpg",o.IMAGE_PNG="image/png",o.IMAGE_GIF="image/gif",o.IMAGE_WEBP="image/webp",o.IMAGE_SVG="image/svg+xml",o.IMAGE_BMP="image/bmp",o.IMAGE_TIFF="image/tiff",o.IMAGE_ICO="image/x-icon",o.IMAGE_AVIF="image/avif",o.APPLICATION_PDF="application/pdf",o.TEXT_PLAIN="text/plain",o.TEXT_CSV="text/csv",o.APPLICATION_RTF="application/rtf",o.APPLICATION_MSWORD="application/msword",o.APPLICATION_DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",o.APPLICATION_MSEXCEL="application/vnd.ms-excel",o.APPLICATION_XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",o.APPLICATION_MSPOWERPOINT="application/vnd.ms-powerpoint",o.APPLICATION_PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",o.APPLICATION_ODT="application/vnd.oasis.opendocument.text",o.APPLICATION_ODS="application/vnd.oasis.opendocument.spreadsheet",o.APPLICATION_ODP="application/vnd.oasis.opendocument.presentation",o.APPLICATION_XML="application/xml",o.TEXT_XML="text/xml",o.TEXT_HTML="text/html",o.TEXT_CSS="text/css",o.APPLICATION_JSON="application/json",o.TEXT_JAVASCRIPT="text/javascript",o.APPLICATION_ZIP="application/zip",o.APPLICATION_GZIP="application/gzip",o.APPLICATION_RAR="application/vnd.rar",o.APPLICATION_7Z="application/x-7z-compressed",o.AUDIO_MPEG="audio/mpeg",o.AUDIO_WAV="audio/wav",o.AUDIO_OGG="audio/ogg",o.AUDIO_WEBM="audio/webm",o.AUDIO_AAC="audio/aac",o.VIDEO_MP4="video/mp4",o.VIDEO_MPEG="video/mpeg",o.VIDEO_OGG="video/ogg",o.VIDEO_WEBM="video/webm",o.VIDEO_QUICKTIME="video/quicktime",o))(Ne||{}),De=(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))(De||{});var fr=({createFilesMutation:e,files:t,file:r,skip:i})=>{let{showErrorMessage:a}=a$7(),[l,p]=useState(!1),[m,n]=useState(!1),[s,d]=useState(null),[f,c]=useState(void 0),g=useMemo(()=>f?.[0],[f]),D=useMemo(()=>{if(!i)return r?[r]:t},[r,t,i]),b=useCallback(async h=>{if(!h?.length){c(void 0);return}try{n(!0);let x=await Promise.all(h.map(async({url:u,name:P,id:F},S)=>{let L=await(await fetch(u)).blob(),G=P||u.split("/").pop()||"image",_=new File([L],G,{type:L.type});return _.id=F,_.url=u,_.index=S,_}));c(x);}catch(x){console.error("Erro ao carregar preview dos arquivos:",x),c(void 0);}finally{n(!1);}},[]),E=m||l;return useEffect(()=>{b(D);},[D,b]),{filesPreview:f,filePreview:g,uploadFiles:async h=>{if(h?.length){p(!0);try{let x=h[0].type||"application/octet-stream",u=De[x];if(!u)throw new Error(`Tipo de arquivo n\xE3o suportado: ${x}`);let P=await e({files:[{content_type:u,name:h[0].name}]}).unwrap(),F=P.files.map(v=>v.id);return (await Promise.all(h.map(v=>fetch(P.files[0].url,{method:"PUT",headers:{"Content-Type":x},body:v})))).forEach(v=>{if(!v.ok)throw new Error(`Erro no upload: ${v.statusText}`)}),b(P.files),F}catch(x){throw d(x),a(x,"Erro no upload"),x}finally{p(!1);}}},isUploadingFiles:l,isLoadingPreview:m,isUploadOrLoadingFiles:E,uploadFilesError:s}},xr=fr;var Ir=({sx:e,id:t,name:r,tabIndex:i,uploading:a,getRootProps:l,getInputProps:p,isDragActive:m,isError:n,disabled:s,dropZoneSxProps:d,dropZoneContent:f,children:c,...g})=>jsxs(Ae,{children:[a&&jsx(a$6,{"data-testid":"uploading-progress-bar"}),jsxs(me,{sx:{width:1,position:"relative",...e},children:[jsxs(Xe,{...l(),"data-testid":"drop-zone-styled-area",isError:n,isDragActive:m,disabled:!!s,sx:d,...g,children:[jsx("input",{...p(),id:t,tabIndex:i,name:r}),f]}),c]})]}),K=Ir;var vr=({header:e,description:t,sx:r,...i})=>jsxs(ie,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...r},...i,children:[jsx(a$3,{sx:{width:220}}),jsxs("div",{children:[jsx(ke,{gutterBottom:!0,variant:"h5",children:e||"Soltar ou selecionar arquivos"}),jsx(ke,{variant:"body2",sx:{color:"text.secondary"},children:t||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(ke,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),J=memo(vr);var Dr=({onRemove:e,onReorder:t,onFilesSelect:r,id:i,disabled:a,error:l,helperText:p,files:m,thumbnail:n,dropZoneSxProps:s,uploading:d,tabIndex:f,maxFiles:c,...g})=>{let{files:D,dropzoneProps:b,handleRemove:E}=T({filesToUpload:m,onFilesSelect:r,onRemove:e,dropzoneOptions:{multiple:!0,disabled:a,...g},maxFiles:c}),{getRootProps:R,getInputProps:h,isDragActive:x,isDragReject:u}=b,P=!!D?.length,F=u||!!l;return jsxs(K,{id:i,uploading:d,disabled:a,dropZoneSxProps:s,tabIndex:f,getRootProps:R,getInputProps:h,isDragActive:x,isError:F,dropZoneContent:jsx(J,{}),children:[jsx(N,{disabled:a,helperText:p,isError:F}),P&&jsx(me,{sx:{my:3},children:jsx(ue,{files:D,thumbnail:!!n,onRemove:e?E:void 0,onReorder:t})})]})},Rr=memo(Dr);var Lr=({onFilesSelect:e,onRemove:t,onReorder:r,id:i,disabled:a,error:l,helperText:p,files:m,dropZoneSxProps:n,placeholderProps:s,placeholderAlt:d,uploading:f,tabIndex:c,maxFiles:g,aspectRatio:D,enableCrop:b=!0,convertToWebp:E=!0,cropSize:R,name:h,label:x,...u})=>{let{files:P,dropzoneProps:F,cropState:S,handleRemove:v,aspectRatio:L}=T({filesToUpload:m,onFilesSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:a,...u},enableCrop:b,customAspectRatio:D,convertToWebp:E,maxFiles:g,cropSize:R}),{getRootProps:G,getInputProps:_,isDragActive:O,isDragReject:q}=F,{cropModalOpen:Z,imagePreview:ee,cropLoading:oe,onCropInitialized:re,handleCropSave:C,handleCropCancel:z,currentImageIndex:k,totalPendingImages:U}=S,H=!!P?.length,j=q||!!l,ye=useMemo(()=>{let _e=x??"Ajustar Imagem",Oe=U>1?` (${k} de ${U})`:"";return `${_e}${Oe}`},[x,U,k]);return jsxs(K,{id:i,name:h,uploading:f,disabled:a,dropZoneSxProps:n,tabIndex:c,getRootProps:G,getInputProps:_,isDragActive:O,isError:j,dropZoneContent:jsx(Fragment,{children:d?jsx(ie,{children:d}):jsx(J,{header:s?.header,description:s?.description})}),children:[jsx(N,{disabled:a,helperText:p,isError:j}),H&&jsx(Fragment,{children:jsx(me,{sx:{my:3,ml:.5},children:jsx(ue,{files:P,thumbnail:!0,onRemove:v,onReorder:r})})}),jsx(a$4,{open:Z,onClose:z,label:ye,imageSrc:ee,aspectRatio:L,onInitialized:re,onSave:C,loading:oe,cropSize:R})]})},Mr=memo(Lr);var Tr=({onFileSelect:e$1,onRemove:t,file:r,id:i,disabled:a,error:l,helperText:p,sx:m$1,dropZoneSxProps:n,uploading:s,tabIndex:d,...f$1})=>{let{file:c,dropzoneProps:g,handleRemove:D}=T({filesToUpload:r,onFileSelect:e$1,onRemove:t,dropzoneOptions:{multiple:!1,disabled:a,...f$1}}),{getRootProps:b,getInputProps:E,isDragActive:R,isDragReject:h}=g,x=useCallback(S=>{S.stopPropagation(),D(c||void 0);},[c,D]),u=!!c,P=typeof c=="string",F=h||!!l;return jsx(K,{id:i,uploading:s,disabled:a,dropZoneSxProps:n,tabIndex:d,getRootProps:b,getInputProps:E,isDragActive:R,isError:F,dropZoneContent:jsxs(Fragment,{children:[!u&&jsx(J,{}),u&&jsxs(ie,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:S=>`solid 1px ${S.palette.divider}`,...m$1},children:[jsx(f,{file:c}),jsxs(ie,{flexGrow:1,sx:{minWidth:0},children:[jsx(ke,{variant:"subtitle2",noWrap:!0,children:P?c:c.name}),jsx(ke,{variant:"caption",sx:{color:"text.secondary"},children:P?"":e(c.size)})]}),t&&jsx(a$2,{title:"Remover arquivo",children:jsx(Ve,{edge:"end",size:"small",disabled:a,"aria-label":"Remover arquivo",onClick:x,children:jsx(a$5,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:jsx(N,{disabled:a,helperText:p,isError:F})})},kr=memo(Tr);var $r=({onRemove:e,onFileSelect:t,file:r,id:i,disabled:a,error:l,helperText:p,dropZoneSxProps:m,placeholderProps:n,placeholderAlt:s,uploading:d,tabIndex:f,aspectRatio:c,enableCrop:g=!0,convertToWebp:D=!0,name:b,label:E,cropSize:R,...h})=>{let[x,u]=useState(!1),{file:P,dropzoneProps:F,cropState:S,handleRemove:v,aspectRatio:L}=T({filesToUpload:r,onFileSelect:t,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:a,...h},enableCrop:g,customAspectRatio:c,convertToWebp:D,cropSize:R}),{getRootProps:G,getInputProps:_,isDragActive:O,isDragReject:q}=F,{cropModalOpen:Z,imagePreview:ee,cropLoading:oe,onCropInitialized:re,handleCropSave:C,handleCropCancel:z}=S,k=useCallback(()=>{v(P||void 0);},[P,v]),U=!!P,H=q||!!l,j=U?{opacity:0}:{opacity:1};return jsxs(Ae,{children:[(d||x)&&jsx(a$6,{}),jsxs(K,{id:i,uploading:d,disabled:a,dropZoneSxProps:m,tabIndex:f,getRootProps:G,getInputProps:_,isDragActive:O,isError:H,name:b,dropZoneContent:jsxs(Fragment,{children:[s?jsx(ie,{sx:j,children:s}):jsx(J,{sx:j,header:n?.title,description:n?.description}),U&&jsx(ze,{file:P,cropSize:R,isLoading:x,isUploading:d,onLoading:u,aspectRatio:L})]}),children:[jsx(N,{disabled:a,helperText:p,isError:H}),U&&e&&jsx(Qe,{size:"small",onClick:k,disabled:a,label:"Remover arquivo",children:jsx(a$5,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$4,{open:Z,onClose:z,label:E??"Ajustar Imagem",imageSrc:ee,aspectRatio:L,onInitialized:re,onSave:C,loading:oe,cropSize:R})]})]})},qr=memo($r);var Qr=({onFileSelect:e,onRemove:t,file:r,disabled:i,label:a,id:l,tabIndex:p,error:m,helperText:n,sx:s,name:d,maxSize:f,uploading:c,aspectRatio:g=1,enableCrop:D=!0,convertToWebp:b=!0,cropSize:E,...R})=>{let[h,x]=useState(!1),{file:u,dropzoneProps:P,cropState:F,handleRemove:S}=T({filesToUpload:r,onFileSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:i,maxSize:f,...R},enableCrop:D,customAspectRatio:g,convertToWebp:b,cropSize:E}),{getRootProps:v,getInputProps:L,isDragActive:G,isDragReject:_}=P,{cropModalOpen:O,imagePreview:q,cropLoading:Z,onCropInitialized:ee,handleCropSave:oe,handleCropCancel:re}=F,C=_||!!m,z=h||c,k=!!t,U=useMemo(()=>u?(x(!0),URL.createObjectURL(u)):"",[u]),H=()=>{x(!1);},j=()=>k&&u?()=>S(u):v().onClick;return jsxs(Fragment,{children:[jsxs(ao,{sx:s,isError:C,isDragActive:G,hasFile:!!u,...v(),onClick:j(),children:[jsxs(to,{children:[u&&jsx(no,{alt:"Avatar Preview",src:U,onLoad:H,...z&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),u&&z&&jsx(io,{children:jsx(Jr,{size:135,thickness:1,color:"primary"})}),!u&&!z&&jsxs(Ce,{isError:C,hasFile:!1,children:[jsx(a$5,{icon:"ADD_IMAGE",width:32}),jsx(ke,{variant:"caption",textAlign:"center",sx:{color:C?"error.main":"text.disabled"},children:"Adicionar foto"})]}),u&&!z&&jsxs(Ce,{isError:C,hasFile:!0,children:[jsx(a$5,{icon:k?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(ke,{variant:"caption",textAlign:"center",sx:{color:C?"error.main":"common.white"},children:k?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:d,id:l,tabIndex:p,...L()}),jsx(ie,{spacing:.5,sx:{pt:1},children:jsx(N,{helperText:n,disabled:i,isError:C})}),u&&!z&&jsx(ie,{direction:"row",justifyContent:"center",spacing:1,sx:{pt:1,mb:-1},children:jsx(ke,{variant:"caption",component:"span",sx:{px:.75,cursor:"pointer",borderRadius:.75,color:"error.main","&:hover":{color:"error.dark",bgcolor:"background.default"}},onClick:()=>S(u),children:"Remover"})})]}),O&&q&&jsx(a$4,{open:O,onClose:re,label:a??"Ajustar Imagem",imageSrc:q,aspectRatio:g,onInitialized:ee,onSave:oe,loading:Z,cropSize:E,cropShape:"round"})]})},Yr=memo(Qr);var tt=({error:e,name:t,disabled:r,sx:i,...a})=>{let{getRootProps:l,getInputProps:p,isDragActive:m,isDragReject:n}=useDropzone({disabled:r,...a}),s=n||e;return jsxs(Ye,{...l(),isDragActive:m,hasError:!!s,disabled:!!r,sx:i,"data-testid":"upload-box",children:[jsx("input",{name:t,...p()}),"Selecionar arquivo"]})},it=memo(tt);
|
|
35
|
+
var Oo=({helperText:e,disabled:t,isError:r})=>e?jsx(_o,{error:r,sx:i=>({mx:"14px",color:t?i.palette.grey[500]:void 0}),children:e}):null,N=memo(Oo);var Ae=styled(ie)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),Ee=styled(ie)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),Xe=styled(me,{shouldForwardProp:e=>!["isDragActive","isError","disabled"].includes(e)})(({theme:e,isDragActive:t,isError:r,disabled:i})=>({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:`1px dashed ${alpha(e.palette.grey[500],.32)}`,...t&&{opacity:.72},...r&&{color:e.palette.error.main,backgroundColor:e.palette.error.lighter,borderColor:e.palette.error.light},...i&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}}));styled(ie)(({theme:e})=>({display:"none",position:"absolute",alignItems:"center",justifyContent:"center",flexDirection:"row",gap:12,width:"100%",height:"100%",backgroundColor:alpha(e.palette.primary.main,.9),zIndex:999,button:{"&, &:hover, &:focus":{backgroundColor:"#fff"}}}));var Ve=styled(Lo)(({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]}})),Le=styled("div")({position:"relative",zIndex:1,"&:hover":{zIndex:2}}),Ke=styled(ie,{shouldForwardProp:e=>!["isDragging"].includes(e)})(({theme:e,width:t,isDragging:r})=>({width:t,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)"})),Je=styled(m.div)(({theme:e,width:t,isDragging:r})=>({width:t,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)"})),Qe=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)}})),Ye=styled(me,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="disabled"&&e!=="hasError"})(({theme:e,isDragActive:t,disabled:r,hasError:i})=>({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)}`,...t&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...i&&{color:e.palette.error.main,borderColor:e.palette.error.main,backgroundColor:alpha(e.palette.error.main,.08)},"&:hover":{opacity:.72}})),eo=styled(me)(({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":{filter:"blur(3px)"}})),oo=styled("img",{shouldForwardProp:e=>e!=="aspectRatio"&&e!=="isLoading"&&e!=="isUploading"&&e!=="maxWidth"&&e!=="maxHeight"})(({theme:e,aspectRatio:t,height:r=1,width:i=1,maxWidth:a,maxHeight:l,isLoading:p,isUploading:m})=>({borderRadius:e.shape.borderRadius,objectFit:"cover",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%) scale(1)",filter:"blur(0)",zIndex:1,aspectRatio:t,maxWidth:a,maxHeight:l,backgroundColor:e.palette.background.paper,height:r>=i?"100%":`calc(100% * ${t})`,width:r>i?`calc(${t} * 100%)`:"100%",transition:"all 0.5s ease-in-out",...p||m?{opacity:0,filter:"blur(1.5rem)",transform:"translate(-50%, -50%) scale(0.7)"}:{},"&:hover":{transition:"all 0.2s ease-in-out"}})),ro=styled("img",{shouldForwardProp:e=>e!=="isLoading"&&e!=="isUploading"})(({isLoading:e,isUploading:t})=>({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},...t&&{opacity:.7,filter:"blur(2rem)"}})),to=styled(ie)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(Co)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var Ce=styled(me,{shouldForwardProp:e=>e!=="isError"&&e!=="hasFile"})(({theme:e,isError:t,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},...t&&{color:e.palette.error.main},...r&&{zIndex:9,opacity:0,color:e.palette.common.white,backgroundColor:alpha(e.palette.common.black,.54)}})),io=styled(ie)({top:0,left:0,right:0,bottom:0,position:"absolute",zIndex:10,alignItems:"center",justifyContent:"center"});styled(ie)(({theme:e})=>({padding:20,justifyContent:"center",alignItems:"center",gap:4,alignSelf:"stretch",borderRadius:12,background:e.palette.grey[200],color:e.palette.text.disabled,height:160}));var ao=styled(me,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="isError"&&e!=="hasFile"})(({theme:e,isDragActive:t,disabled:r,isError:i,hasFile:a})=>({padding:1,margin:"auto",width:144,height:144,cursor:"pointer",overflow:"hidden",borderRadius:"50%",border:`1px dashed ${alpha(e.palette.grey[500],.2)}`,...t&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...i&&{borderColor:"error.main"},...a&&{...i&&{bgcolor:alpha(e.palette.error.main,.08)},"&:hover .upload-placeholder":{opacity:1},"& img":{filter:"blur(0)"},"&:hover img":{filter:"blur(3px)"}}})),no=styled("img")({width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",transition:"all 0.3s ease-in-out"}),so=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 To=({onRemove:e,sx:t,file:r,disableDrag:i,attributes:a,listeners:l,innerWidth:p,isDragging:m})=>{let n=r?.id||r?.url;return n?jsx(No,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(Je,{width:p,isDragging:m,"data-testid":`preview-multi-img-${n}`,...j().inUp,sx:t,children:[jsx(a$1,{disableDrag:i,...a,...l}),jsx(f,{tooltip:!0,imageView:!0,file:r}),jsx(Ee,{sx:{position:"absolute",right:3,top:3,zIndex:1},children:e&&jsx(so,{size:"small",label:"Remover arquivo",onClick:()=>e(r),icon:"DELETE_MARK_BUTTON_02"})})]})},`badge-${n}`):null},lo=memo(To);var jo=({file:e$1,thumbnail:t,onRemove:r,sx:i,disableDrag:a$3=!1})=>{let l=e$1?.size||0,p=e$1?.name||e$1?.url||e$1?.id,m=e$1?.id||e$1?.url||"",n=typeof e$1=="string",s=a$3?70:80,{attributes:d,listeners:f$1,setNodeRef:c,transform:g,transition:D,isDragging:b}=useSortable({id:m,disabled:a$3}),E={transform:x.Transform.toString(g),transition:D,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${s+8}px`,height:"68px"};return t&&e$1?jsx(Le,{ref:c,style:E,children:jsx(lo,{innerWidth:s,isDragging:b,sx:i,file:e$1,disableDrag:a$3,attributes:d,listeners:f$1,onRemove:r})}):jsx(Le,{ref:c,style:{...E,height:"80px",width:`${s+38}px`},children:jsxs(Ke,{width:s+30,isDragging:b,"data-testid":`preview-multi-img-${m}`,...j().inUp,sx:i,children:[jsx(a$1,{disableDrag:a$3,...d,...f$1}),e$1&&jsx(f,{file:e$1}),jsxs(ie,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$2,{title:p,children:jsx(ke,{variant:"subtitle2",noWrap:!0,children:p})}),jsx(ke,{variant:"caption",sx:{color:"text.secondary"},children:n?"":e(l)})]}),jsx(Ee,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$1),icon:"DELETE_MARK_BUTTON_02"})})]})})},mo=memo(jo);var tr=({thumbnail:e,files:t,onRemove:r,onReorder:i,sx:a})=>{let l=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates}));if(!t?.length)return null;let p=n=>{let{active:s,over:d}=n;if(!(!s||!d||s.id===d.id)&&i){let f=t.findIndex(({id:g})=>g===s.id),c=t.findIndex(({id:g})=>g===d.id);f!==-1&&c!==-1&&i(f,c);}},m=jsx(AnimatePresence,{initial:!1,children:t.map(n=>jsx(mo,{sx:a,file:n,onRemove:r,thumbnail:e,disableDrag:!i},n.id))});return i?jsx(DndContext,{sensors:l,collisionDetection:closestCenter,onDragEnd:p,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:t.map(n=>n.id),strategy:horizontalListSortingStrategy,children:m})}):m},ue=memo(tr);var nr=({onLoading:e,width:t,height:r,ref:i,...a})=>{let[l,p]=useState("calc(100% - 16px)"),[m,n]=useState("calc(100% - 16px)");a$3(()=>{e?.(!0);}),useLayoutEffect(()=>{i?.current?e?.(!i?.current?.complete):e?.(!1);},[i,e]);function s(){let d=i?.current;if(d){let{width:f,height:c}=d.getBoundingClientRect();p(`calc(${f||t}px - 16px)`),n(`calc(${c||r}px - 16px)`);}e?.(!1);}return jsx(oo,{...a,ref:i,maxWidth:l,maxHeight:m,onLoad:s,onError:s})},fo=forwardRef(nr);var cr=({file:e,aspectRatio:t=1,isUploading:r,isLoading:i,onLoading:a,cropSize:l})=>{let p=useRef(null),m=e?.name||e?.url||e?.id,n=e?.url||URL.createObjectURL(e),s=typeof l=="number"?l*t:l?.width,d=typeof l=="number"?l:l?.height,f=useMemo(()=>`image-preview-${n}-${i}-${r}-rnd-${Math.random()}`,[n,i,r]);return jsxs(eo,{children:[jsx(fo,{aspectRatio:t,isLoading:i,isUploading:r,height:d,width:s,alt:m,src:n,ref:p,loading:"lazy",onLoading:a},f),jsx(ro,{alt:m,src:n,isLoading:i,isUploading:r})]})},ze=memo(cr);var ui=e=>e.startsWith("image/"),Po=(e,t=.8)=>new Promise((r,i)=>{let a=document.createElement("canvas"),l=a.getContext("2d"),p=new Image;p.onload=()=>{a.width=p.width,a.height=p.height,l?(l.drawImage(p,0,0),a.toBlob(m=>{if(m){let n=new File([m],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});r(n);}else i(new Error("Falha ao converter para WebP"));},"image/webp",t)):i(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},p.onerror=()=>i(new Error("Falha ao carregar imagem")),p.src=URL.createObjectURL(e);});var ur=({filesToUpload:e$1,onFileSelect:t,onFilesSelect:r,onRemove:i,dropzoneOptions:a,enableCrop:l=!1,customAspectRatio:p,convertToWebp:m=!0,maxFiles:n,cropSize:s})=>{let{showErrorMessage:d}=a$8(),f=useMemo(()=>p||(s&&typeof s!="number"?s.width/s.height:1),[p,s]),[c,g]=useState([]),[D,b]=useState(!1),[E,F]=useState(null),[h,x]=useState(null),[u,P]=useState(""),[R,S]=useState(!1),[v,M]=useState([]),[G,_]=useState(0),O=useMemo(()=>e$1&&Array.isArray(e$1)?e$1.filter(o=>o instanceof File):e$1&&e$1 instanceof File?[e$1]:c,[e$1,c]),H=useMemo(()=>e$1&&Array.isArray(e$1)?null:e$1&&e$1 instanceof File?e$1:c[0]||null,[e$1,c]);useEffect(()=>{e$1&&(Array.isArray(e$1)?g(e$1.filter(o=>o instanceof File)):e$1 instanceof File?g([e$1]):e$1===null&&g([]));},[e$1]);let Z=useCallback(()=>{if(v.length>0&&l){let o=v[0];F(o),_(I=>I+1);let w=new FileReader;w.onload=()=>{P(w.result),b(!0);},w.readAsDataURL(o);}},[v,l]);useEffect(()=>{Z();},[Z]);let ee=useCallback((o,w)=>{x(w);},[]),oe=async()=>!E||!h?null:new Promise(o=>{let w=document.createElement("canvas"),I=w.getContext("2d"),W=new Image;W.onload=async()=>{let{width:de,height:X,x:Fo,y:Ro}=h,xe=de,Pe=X;s&&(typeof s=="number"?(xe=s,Pe=s/f):(xe=s.width,Pe=s.height)),w.width=xe,w.height=Pe,I?(I.drawImage(W,Fo,Ro,de,X,0,0,xe,Pe),w.toBlob(async We=>{if(We){let Me=new File([We],E.name,{type:E.type,lastModified:Date.now()});if(m)try{Me=await Po(Me);}catch(So){d(So,"Erro ao converter para WebP");}o(Me);}else o(null);},"image/png")):o(null);},W.src=u;}),re=async()=>{if(!(!E||!h)){S(!0);try{let o=await oe();if(o)if(Array.isArray(e$1)||e$1===void 0&&r){let I=n?[...O,o].slice(0,n):[...O,o];g(I),r?.(I);}else g([o]),t?.(o);let w=v.slice(1);M(w),b(!1),P(""),F(null),w.length>0&&setTimeout(()=>Z(),100);}catch(o){d(o,"Erro ao processar imagem");}finally{S(!1);}}},C=()=>{b(!1),P(""),F(null),M([]),_(0);},z=useCallback(o=>{if(o.length===0)return;if(a?.accept&&Object.keys(a.accept).some(I=>I.includes("image/"))&&l)if(Array.isArray(e$1)||e$1===void 0&&r){let I=o.filter(X=>X.type.startsWith("image/")),W=O.map(X=>X.name),de=I.filter(X=>!W.includes(X.name));if(de.length===0){d("Todos os arquivos selecionados j\xE1 foram adicionados","Arquivos duplicados");return}M(de),_(0);}else {let I=o[0];F(I);let W=new FileReader;W.onload=()=>{P(W.result),b(!0);},W.readAsDataURL(I);}else if(Array.isArray(e$1)||e$1===void 0&&r){let I=n?[...O,...o].slice(0,n):[...O,...o];g(I),r?.(I);}else {let I=o[0];g([I]),t?.(I);}},[e$1,O,t,r,l,n,a,d]),k=useCallback(o=>{if(!o.length)return;let w=o[0]?.errors[0]?.code,I=a?.maxSize||3145728;d(w==="file-too-large"?new Error(`O arquivo excede o tamanho m\xE1ximo de ${e(I)}`):w==="file-invalid-type"?new Error("Formato de arquivo n\xE3o suportado"):o[0]?.errors[0]||new Error("Erro ao enviar arquivo"),"Erro ao fazer upload");},[a?.maxSize,d]),{getRootProps:U,getInputProps:q,isDragActive:j,isDragReject:ye,fileRejections:_e}=useDropzone({onDrop:z,onDropRejected:k,...a}),Oe=useCallback(o=>{if(!o){g([]),i?.(void 0);return}if(Array.isArray(e$1)||e$1===void 0&&r){let w=c.filter(I=>I.name!==o.name);g(w),i?.(o),r&&r(w);}else g([]),i?.(o);},[e$1,c,r,i]),Do=useCallback(()=>{g([]),Array.isArray(e$1)&&r?r([]):!Array.isArray(e$1)&&t&&t?.(null);},[e$1,r,t]);return {file:H,files:O,aspectRatio:f,dropzoneProps:{getRootProps:U,getInputProps:q,isDragActive:j,isDragReject:ye,fileRejections:_e},cropState:{cropModalOpen:D,imagePreview:u,cropLoading:R,setCropModalOpen:b,onCropInitialized:ee,handleCropSave:re,handleCropCancel:C,currentImageIndex:G,totalPendingImages:v.length},handleRemove:Oe,clearFiles:Do,setFiles:g}},T=ur;var Ne=(o=>(o.APPLICATION_OCTET_STREAM="application/octet-stream",o.IMAGE_JPEG="image/jpeg",o.IMAGE_JPG="image/jpg",o.IMAGE_PNG="image/png",o.IMAGE_GIF="image/gif",o.IMAGE_WEBP="image/webp",o.IMAGE_SVG="image/svg+xml",o.IMAGE_BMP="image/bmp",o.IMAGE_TIFF="image/tiff",o.IMAGE_ICO="image/x-icon",o.IMAGE_AVIF="image/avif",o.APPLICATION_PDF="application/pdf",o.TEXT_PLAIN="text/plain",o.TEXT_CSV="text/csv",o.APPLICATION_RTF="application/rtf",o.APPLICATION_MSWORD="application/msword",o.APPLICATION_DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",o.APPLICATION_MSEXCEL="application/vnd.ms-excel",o.APPLICATION_XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",o.APPLICATION_MSPOWERPOINT="application/vnd.ms-powerpoint",o.APPLICATION_PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",o.APPLICATION_ODT="application/vnd.oasis.opendocument.text",o.APPLICATION_ODS="application/vnd.oasis.opendocument.spreadsheet",o.APPLICATION_ODP="application/vnd.oasis.opendocument.presentation",o.APPLICATION_XML="application/xml",o.TEXT_XML="text/xml",o.TEXT_HTML="text/html",o.TEXT_CSS="text/css",o.APPLICATION_JSON="application/json",o.TEXT_JAVASCRIPT="text/javascript",o.APPLICATION_ZIP="application/zip",o.APPLICATION_GZIP="application/gzip",o.APPLICATION_RAR="application/vnd.rar",o.APPLICATION_7Z="application/x-7z-compressed",o.AUDIO_MPEG="audio/mpeg",o.AUDIO_WAV="audio/wav",o.AUDIO_OGG="audio/ogg",o.AUDIO_WEBM="audio/webm",o.AUDIO_AAC="audio/aac",o.VIDEO_MP4="video/mp4",o.VIDEO_MPEG="video/mpeg",o.VIDEO_OGG="video/ogg",o.VIDEO_WEBM="video/webm",o.VIDEO_QUICKTIME="video/quicktime",o))(Ne||{}),De=(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))(De||{});var Pr=({createFilesMutation:e,files:t,file:r,skip:i})=>{let{showErrorMessage:a}=a$8(),[l,p]=useState(!1),[m,n]=useState(!1),[s,d]=useState(null),[f,c]=useState(void 0),g=useMemo(()=>f?.[0],[f]),D=useMemo(()=>{if(!i)return r?[r]:t},[r,t,i]),b=useCallback(async h=>{if(!h?.length){c(void 0);return}try{n(!0);let x=await Promise.all(h.map(async({url:u,name:P,id:R},S)=>{let M=await(await fetch(u)).blob(),G=P||u.split("/").pop()||"image",_=new File([M],G,{type:M.type});return _.id=R,_.url=u,_.index=S,_}));c(x);}catch(x){console.error("Erro ao carregar preview dos arquivos:",x),c(void 0);}finally{n(!1);}},[]),E=m||l;return useEffect(()=>{b(D);},[D,b]),{filesPreview:f,filePreview:g,uploadFiles:async h=>{if(h?.length){p(!0);try{let x=h[0].type||"application/octet-stream",u=De[x];if(!u)throw new Error(`Tipo de arquivo n\xE3o suportado: ${x}`);let P=await e({files:[{content_type:u,name:h[0].name}]}).unwrap(),R=P.files.map(v=>v.id);return (await Promise.all(h.map(v=>fetch(P.files[0].url,{method:"PUT",headers:{"Content-Type":x},body:v})))).forEach(v=>{if(!v.ok)throw new Error(`Erro no upload: ${v.statusText}`)}),b(P.files),R}catch(x){throw d(x),a(x,"Erro no upload"),x}finally{p(!1);}}},isUploadingFiles:l,isLoadingPreview:m,isUploadOrLoadingFiles:E,uploadFilesError:s}},Ir=Pr;var hr=({sx:e,id:t,name:r,tabIndex:i,uploading:a,getRootProps:l,getInputProps:p,isDragActive:m,isError:n,disabled:s,dropZoneSxProps:d,dropZoneContent:f,children:c,...g})=>jsxs(Ae,{children:[a&&jsx(a$7,{"data-testid":"uploading-progress-bar"}),jsxs(me,{sx:{width:1,position:"relative",...e},children:[jsxs(Xe,{...l(),"data-testid":"drop-zone-styled-area",isError:n,isDragActive:m,disabled:!!s,sx:d,...g,children:[jsx("input",{...p(),id:t,tabIndex:i,name:r}),f]}),c]})]}),K=hr;var Er=({header:e,description:t,sx:r,...i})=>jsxs(ie,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...r},...i,children:[jsx(a$4,{sx:{width:220}}),jsxs("div",{children:[jsx(ke,{gutterBottom:!0,variant:"h5",children:e||"Soltar ou selecionar arquivos"}),jsx(ke,{variant:"body2",sx:{color:"text.secondary"},children:t||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(ke,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),J=memo(Er);var Rr=({onRemove:e,onReorder:t,onFilesSelect:r,id:i,disabled:a,error:l,helperText:p,files:m,thumbnail:n,dropZoneSxProps:s,uploading:d,tabIndex:f,maxFiles:c,...g})=>{let{files:D,dropzoneProps:b,handleRemove:E}=T({filesToUpload:m,onFilesSelect:r,onRemove:e,dropzoneOptions:{multiple:!0,disabled:a,...g},maxFiles:c}),{getRootProps:F,getInputProps:h,isDragActive:x,isDragReject:u}=b,P=!!D?.length,R=u||!!l;return jsxs(K,{id:i,uploading:d,disabled:a,dropZoneSxProps:s,tabIndex:f,getRootProps:F,getInputProps:h,isDragActive:x,isError:R,dropZoneContent:jsx(J,{}),children:[jsx(N,{disabled:a,helperText:p,isError:R}),P&&jsx(me,{sx:{my:3},children:jsx(ue,{files:D,thumbnail:!!n,onRemove:e?E:void 0,onReorder:t})})]})},Sr=memo(Rr);var Cr=({onFilesSelect:e,onRemove:t,onReorder:r,id:i,disabled:a,error:l,helperText:p,files:m,dropZoneSxProps:n,placeholderProps:s,placeholderAlt:d,uploading:f,tabIndex:c,maxFiles:g,aspectRatio:D,enableCrop:b=!0,convertToWebp:E=!0,cropSize:F,name:h,label:x,...u})=>{let{files:P,dropzoneProps:R,cropState:S,handleRemove:v,aspectRatio:M}=T({filesToUpload:m,onFilesSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:a,...u},enableCrop:b,customAspectRatio:D,convertToWebp:E,maxFiles:g,cropSize:F}),{getRootProps:G,getInputProps:_,isDragActive:O,isDragReject:H}=R,{cropModalOpen:Z,imagePreview:ee,cropLoading:oe,onCropInitialized:re,handleCropSave:C,handleCropCancel:z,currentImageIndex:k,totalPendingImages:U}=S,q=!!P?.length,j=H||!!l,ye=useMemo(()=>{let _e=x??"Ajustar Imagem",Oe=U>1?` (${k} de ${U})`:"";return `${_e}${Oe}`},[x,U,k]);return jsxs(K,{id:i,name:h,uploading:f,disabled:a,dropZoneSxProps:n,tabIndex:c,getRootProps:G,getInputProps:_,isDragActive:O,isError:j,dropZoneContent:jsx(Fragment,{children:d?jsx(ie,{children:d}):jsx(J,{header:s?.header,description:s?.description})}),children:[jsx(N,{disabled:a,helperText:p,isError:j}),q&&jsx(Fragment,{children:jsx(me,{sx:{my:3,ml:.5},children:jsx(ue,{files:P,thumbnail:!0,onRemove:v,onReorder:r})})}),jsx(a$5,{open:Z,onClose:z,label:ye,imageSrc:ee,aspectRatio:M,onInitialized:re,onSave:C,loading:oe,cropSize:F})]})},zr=memo(Cr);var Br=({onFileSelect:e$1,onRemove:t,file:r,id:i,disabled:a,error:l,helperText:p,sx:m$1,dropZoneSxProps:n,uploading:s,tabIndex:d,...f$1})=>{let{file:c,dropzoneProps:g,handleRemove:D}=T({filesToUpload:r,onFileSelect:e$1,onRemove:t,dropzoneOptions:{multiple:!1,disabled:a,...f$1}}),{getRootProps:b,getInputProps:E,isDragActive:F,isDragReject:h}=g,x=useCallback(S=>{S.stopPropagation(),D(c||void 0);},[c,D]),u=!!c,P=typeof c=="string",R=h||!!l;return jsx(K,{id:i,uploading:s,disabled:a,dropZoneSxProps:n,tabIndex:d,getRootProps:b,getInputProps:E,isDragActive:F,isError:R,dropZoneContent:jsxs(Fragment,{children:[!u&&jsx(J,{}),u&&jsxs(ie,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:S=>`solid 1px ${S.palette.divider}`,...m$1},children:[jsx(f,{file:c}),jsxs(ie,{flexGrow:1,sx:{minWidth:0},children:[jsx(ke,{variant:"subtitle2",noWrap:!0,children:P?c:c.name}),jsx(ke,{variant:"caption",sx:{color:"text.secondary"},children:P?"":e(c.size)})]}),t&&jsx(a$2,{title:"Remover arquivo",children:jsx(Ve,{edge:"end",size:"small",disabled:a,"aria-label":"Remover arquivo",onClick:x,children:jsx(a$6,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:jsx(N,{disabled:a,helperText:p,isError:R})})},Gr=memo(Br);var qr=({onRemove:e,onFileSelect:t,file:r,id:i,disabled:a,error:l,helperText:p,dropZoneSxProps:m,placeholderProps:n,placeholderAlt:s,uploading:d,tabIndex:f,aspectRatio:c,enableCrop:g=!0,convertToWebp:D=!0,name:b,label:E,cropSize:F,...h})=>{let[x,u]=useState(!1),{file:P,dropzoneProps:R,cropState:S,handleRemove:v,aspectRatio:M}=T({filesToUpload:r,onFileSelect:t,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:a,...h},enableCrop:g,customAspectRatio:c,convertToWebp:D,cropSize:F}),{getRootProps:G,getInputProps:_,isDragActive:O,isDragReject:H}=R,{cropModalOpen:Z,imagePreview:ee,cropLoading:oe,onCropInitialized:re,handleCropSave:C,handleCropCancel:z}=S,k=useCallback(()=>{v(P||void 0);},[P,v]),U=!!P,q=H||!!l,j=U?{opacity:0}:{opacity:1};return jsxs(Ae,{children:[(d||x)&&jsx(a$7,{}),jsxs(K,{id:i,uploading:d,disabled:a,dropZoneSxProps:m,tabIndex:f,getRootProps:G,getInputProps:_,isDragActive:O,isError:q,name:b,dropZoneContent:jsxs(Fragment,{children:[s?jsx(ie,{sx:j,children:s}):jsx(J,{sx:j,header:n?.title,description:n?.description}),U&&jsx(ze,{file:P,cropSize:F,isLoading:x,isUploading:d,onLoading:u,aspectRatio:M})]}),children:[jsx(N,{disabled:a,helperText:p,isError:q}),U&&e&&jsx(Qe,{size:"small",onClick:k,disabled:a,label:"Remover arquivo",children:jsx(a$6,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$5,{open:Z,onClose:z,label:E??"Ajustar Imagem",imageSrc:ee,aspectRatio:M,onInitialized:re,onSave:C,loading:oe,cropSize:F})]})]})},Xr=memo(qr);var et=({onFileSelect:e,onRemove:t,file:r,disabled:i,label:a,id:l,tabIndex:p,error:m,helperText:n,sx:s,name:d,maxSize:f,uploading:c,aspectRatio:g=1,enableCrop:D=!0,convertToWebp:b=!0,cropSize:E,...F})=>{let[h,x]=useState(!1),{file:u,dropzoneProps:P,cropState:R,handleRemove:S}=T({filesToUpload:r,onFileSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:i,maxSize:f,...F},enableCrop:D,customAspectRatio:g,convertToWebp:b,cropSize:E}),{getRootProps:v,getInputProps:M,isDragActive:G,isDragReject:_}=P,{cropModalOpen:O,imagePreview:H,cropLoading:Z,onCropInitialized:ee,handleCropSave:oe,handleCropCancel:re}=R,C=_||!!m,z=h||c,k=!!t,U=useMemo(()=>u?(x(!0),URL.createObjectURL(u)):"",[u]),q=()=>{x(!1);},j=()=>k&&u?()=>S(u):v().onClick;return jsxs(Fragment,{children:[jsxs(ao,{sx:s,isError:C,isDragActive:G,hasFile:!!u,...v(),onClick:j(),children:[jsxs(to,{children:[u&&jsx(no,{alt:"Avatar Preview",src:U,onLoad:q,...z&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),u&&z&&jsx(io,{children:jsx(Yr,{size:135,thickness:1,color:"primary"})}),!u&&!z&&jsxs(Ce,{isError:C,hasFile:!1,children:[jsx(a$6,{icon:"ADD_IMAGE",width:32}),jsx(ke,{variant:"caption",textAlign:"center",sx:{color:C?"error.main":"text.disabled"},children:"Adicionar foto"})]}),u&&!z&&jsxs(Ce,{isError:C,hasFile:!0,children:[jsx(a$6,{icon:k?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(ke,{variant:"caption",textAlign:"center",sx:{color:C?"error.main":"common.white"},children:k?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:d,id:l,tabIndex:p,...M()}),jsx(ie,{spacing:.5,sx:{pt:1},children:jsx(N,{helperText:n,disabled:i,isError:C})}),u&&!z&&jsx(ie,{direction:"row",justifyContent:"center",spacing:1,sx:{pt:1,mb:-1},children:jsx(ke,{variant:"caption",component:"span",sx:{px:.75,cursor:"pointer",borderRadius:.75,color:"error.main","&:hover":{color:"error.dark",bgcolor:"background.default"}},onClick:()=>S(u),children:"Remover"})})]}),O&&H&&jsx(a$5,{open:O,onClose:re,label:a??"Ajustar Imagem",imageSrc:H,aspectRatio:g,onInitialized:ee,onSave:oe,loading:Z,cropSize:E,cropShape:"round"})]})},ot=memo(et);var at=({error:e,name:t,disabled:r,sx:i,...a})=>{let{getRootProps:l,getInputProps:p,isDragActive:m,isDragReject:n}=useDropzone({disabled:r,...a}),s=n||e;return jsxs(Ye,{...l(),isDragActive:m,hasError:!!s,disabled:!!r,sx:i,"data-testid":"upload-box",children:[jsx("input",{name:t,...p()}),"Selecionar arquivo"]})},nt=memo(at);
|
|
36
36
|
|
|
37
|
-
export { Ne as ContentType, De as FileContentType, N as HelperText, ue as MultiFilePreview,
|
|
37
|
+
export { Ne as ContentType, De as FileContentType, N as HelperText, ue as MultiFilePreview, Sr as MultipleFileUpload, zr as MultipleImageUpload, ze as SingleFilePreview, Gr as SingleFileUpload, Xr as SingleImageUpload, ot as UploadAvatar, nt as UploadSimpleBox, Po as convertToWebP, ui as isImageFile, T as useDropzoneUploader, Ir as useFileUploadService };
|
|
@@ -443,7 +443,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
|
|
|
443
443
|
wordWrap?: csstype.Property.WordWrap | readonly NonNullable<csstype.Property.WordWrap | undefined>[] | readonly csstype.Property.WordWrap[] | undefined;
|
|
444
444
|
writingMode?: csstype.Property.WritingMode | readonly NonNullable<csstype.Property.WritingMode | undefined>[] | readonly csstype.Property.WritingMode[] | undefined;
|
|
445
445
|
zIndex?: csstype.Property.ZIndex | readonly NonNullable<csstype.Property.ZIndex | undefined>[] | readonly ((string & {}) | csstype.Globals | "auto")[] | undefined;
|
|
446
|
-
zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal"
|
|
446
|
+
zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly ("reset" | (string & {}) | csstype.Globals | "normal")[] | undefined;
|
|
447
447
|
all?: csstype.Globals | readonly NonNullable<csstype.Globals | undefined>[] | readonly csstype.Globals[] | undefined;
|
|
448
448
|
animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "auto" | "none" | "both" | "alternate" | "alternate-reverse" | "backwards" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start" | "linear")[] | undefined;
|
|
449
449
|
animationRange?: csstype.Property.AnimationRange<string | number> | readonly NonNullable<csstype.Property.AnimationRange<string | number> | undefined>[] | readonly (string | (string & {}))[] | undefined;
|