@zydon/common 2.4.21 → 2.4.22

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,9 +1,9 @@
1
- import { a } from '../../chunk-YZ6ZATKM.js';
2
- import '../../chunk-GUFT6XPG.js';
1
+ import { a } from '../../chunk-COWMZKQG.js';
3
2
  import '../../chunk-GOC7PC2S.js';
4
3
  import '../../chunk-MCT77MRN.js';
5
4
  import '../../chunk-CFVUZ4S5.js';
6
5
  import '../../chunk-CFYNJQGN.js';
6
+ import '../../chunk-GUFT6XPG.js';
7
7
  import { i } from '../../chunk-D27ND54J.js';
8
8
  import { a as a$1 } from '../../chunk-RGXSHDAI.js';
9
9
  import '../../chunk-CHLVIVDD.js';
@@ -1,7 +1,7 @@
1
- import { a as a$2 } from '../../chunk-IPOTBSM7.js';
2
1
  import { a as a$3 } from '../../chunk-H5L4ARDB.js';
3
2
  import { a } from '../../chunk-UUTAIXBZ.js';
4
3
  import { e as e$1 } from '../../chunk-ANAHA3L6.js';
4
+ import { a as a$2 } from '../../chunk-IPOTBSM7.js';
5
5
  import { e, g } from '../../chunk-QTPDCBMF.js';
6
6
  import { a as a$4 } from '../../chunk-56U7LQ3V.js';
7
7
  import '../../chunk-OR6QR7N2.js';
@@ -31,6 +31,6 @@ import ko from '@mui/material/Badge';
31
31
  import { useDropzone } from 'react-dropzone';
32
32
  import qr from '@mui/material/CircularProgress';
33
33
 
34
- var yo=({helperText:e,disabled:t,isError:r})=>e?jsx(So,{error:r,sx:a=>({mx:"14px",color:t?a.palette.grey[500]:void 0}),children:e}):null,k=memo(yo);var De=styled(ae)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),we=styled(ae)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),Ve=styled(ge,{shouldForwardProp:e=>!["isDragActive","isError","disabled"].includes(e)})(({theme:e,isDragActive:t,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:`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},...a&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}}));styled(ae)(({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 He=styled(Oo)(({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]}})),Ce=styled("div")({position:"relative",zIndex:1,"&:hover":{zIndex:2}}),Ke=styled(ae,{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(ge,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="disabled"&&e!=="hasError"})(({theme:e,isDragActive:t,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)}`,...t&&{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}})),eo=styled(ge)(({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,width:a,isLoading:i,isUploading:n})=>({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:"calc(100% - 16px)",maxHeight:"calc(160px - 16px)",backgroundColor:e.palette.background.paper,height:r,width:a,transition:"all 0.5s ease-in-out",...i||n?{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(ae)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(Mo)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var ke=styled(ge,{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(ae)({top:0,left:0,right:0,bottom:0,position:"absolute",zIndex:10,alignItems:"center",justifyContent:"center"});styled(ae)(({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(ge,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="isError"&&e!=="hasFile"})(({theme:e,isDragActive:t,disabled:r,isError:a,hasFile:i})=>({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"},...a&&{borderColor:"error.main"},...i&&{...a&&{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 zo=({onRemove:e$1,sx:t,file:r,disableDrag:a,attributes:i,listeners:n,innerWidth:l,isDragging:g$1})=>{let{key:p}=e(r);return jsx(ko,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(Je,{width:l,isDragging:g$1,"data-testid":`preview-multi-img-${p}`,...j().inUp,sx:t,children:[jsx(a$1,{disableDrag:a,...i,...n}),jsx(g,{tooltip:!0,imageView:!0,file:r}),jsx(we,{sx:{position:"absolute",right:3,top:3,zIndex:1},children:e$1&&jsx(so,{size:"small",label:"Remover arquivo",onClick:()=>e$1(r),icon:"DELETE_MARK_BUTTON_02"})})]})},`badge-${p}`)},lo=memo(zo);var Go=({file:e$2,thumbnail:t,onRemove:r,sx:a$3,disableDrag:i=!1})=>{let{key:n,name:l="",size:g$1=0}=e(e$2||""),p=typeof e$2=="string",s=i?70:80,{attributes:d,listeners:P,setNodeRef:m,transform:c,transition:I,isDragging:D}=useSortable({id:n,disabled:i}),R={transform:x.Transform.toString(c),transition:I,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${s+8}px`,height:"68px"};return t&&e$2?jsx(Ce,{ref:m,style:R,children:jsx(lo,{innerWidth:s,isDragging:D,sx:a$3,file:e$2,disableDrag:i,attributes:d,listeners:P,onRemove:r})}):jsx(Ce,{ref:m,style:{...R,height:"80px",width:`${s+38}px`},children:jsxs(Ke,{width:s+30,isDragging:D,"data-testid":`preview-multi-img-${n}`,...j().inUp,sx:a$3,children:[jsx(a$1,{disableDrag:i,...d,...P}),e$2&&jsx(g,{file:e$2}),jsxs(ae,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$2,{title:l,children:jsx(Be,{variant:"subtitle2",noWrap:!0,children:l})}),jsx(Be,{variant:"caption",sx:{color:"text.secondary"},children:p?"":e$1(g$1)})]}),jsx(we,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$2),icon:"DELETE_MARK_BUTTON_02"})})]})})},mo=memo(Go);var or=({thumbnail:e$1,files:t,onRemove:r,onReorder:a,sx:i})=>{let n=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates}));if(!t?.length)return null;let l=p=>{let{active:s,over:d}=p;if(!(!s||!d||s.id===d.id)&&a){let P=t.findIndex(c=>{let{key:I}=e(c);return I===s.id}),m=t.findIndex(c=>{let{key:I}=e(c);return I===d.id});P!==-1&&m!==-1&&a(P,m);}},g=jsx(AnimatePresence,{initial:!1,children:t.map(p=>jsx(mo,{sx:i,file:p,onRemove:r,thumbnail:e$1,disableDrag:!a},e(p).key))});return a?jsx(DndContext,{sensors:n,collisionDetection:closestCenter,onDragEnd:l,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:t.map(p=>e(p).key),strategy:horizontalListSortingStrategy,children:g})}):g},fe=memo(or);var ar=({file:e,aspectRatio:t=1,isUploading:r,isLoading:a,onLoading:i,cropSize:n})=>{let l=useRef(null),g=typeof e=="string"?e:e.name,p=typeof e=="string"?e:URL.createObjectURL(e);useEffect(()=>{l.current&&!l.current.complete?i?.(!0):i?.(!1);},[l,i]);let s=typeof n=="number"?n*t:n?.width,d=typeof n=="number"?n:n?.height;return jsxs(eo,{children:[jsx(oo,{aspectRatio:t,isLoading:a,isUploading:r,width:s,height:d,alt:g,src:p,ref:l,onLoad:()=>i?.(!1),onError:()=>i?.(!1)}),jsx(ro,{alt:g,src:p,isLoading:a,isUploading:r})]})},ze=memo(ar);var ri=e=>e.startsWith("image/"),fo=(e,t=.8)=>new Promise((r,a)=>{let i=document.createElement("canvas"),n=i.getContext("2d"),l=new Image;l.onload=()=>{i.width=l.width,i.height=l.height,n?(n.drawImage(l,0,0),i.toBlob(g=>{if(g){let p=new File([g],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});r(p);}else a(new Error("Falha ao converter para WebP"));},"image/webp",t)):a(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},l.onerror=()=>a(new Error("Falha ao carregar imagem")),l.src=URL.createObjectURL(e);});var lr=({filesToUpload:e,onFileSelect:t,onFilesSelect:r,onRemove:a,dropzoneOptions:i,enableCrop:n=!1,customAspectRatio:l,convertToWebp:g=!0,maxFiles:p,cropSize:s})=>{let{showErrorMessage:d}=a$7(),P=useMemo(()=>l||(s&&typeof s!="number"?s.width/s.height:1),[l,s]),[m,c]=useState([]),[I,D]=useState(!1),[R,f]=useState(null),[x,w]=useState(null),[u,h]=useState(""),[F,v]=useState(!1),[_,U]=useState([]),[ee,B]=useState(0),y=useMemo(()=>e&&Array.isArray(e)?e.filter(o=>o instanceof File):e&&e instanceof File?[e]:m,[e,m]),$=useMemo(()=>e&&Array.isArray(e)?null:e&&e instanceof File?e:m[0]||null,[e,m]);useEffect(()=>{e&&(Array.isArray(e)?c(e.filter(o=>o instanceof File)):e instanceof File?c([e]):e===null&&c([]));},[e]);let G=useCallback(()=>{if(_.length>0&&n){let o=_[0];f(o),B(b=>b+1);let E=new FileReader;E.onload=()=>{h(E.result),D(!0);},E.readAsDataURL(o);}},[_,n]);useEffect(()=>{G();},[G]);let oe=useCallback((o,E)=>{w(E);},[]),re=async()=>!R||!x?null:new Promise(o=>{let E=document.createElement("canvas"),b=E.getContext("2d"),j=new Image;j.onload=async()=>{let{width:ce,height:V,x:wo,y:Eo}=x,xe=ce,be=V;s&&(typeof s=="number"?(xe=s,be=s/P):(xe=s.width,be=s.height)),E.width=xe,E.height=be,b?(b.drawImage(j,wo,Eo,ce,V,0,0,xe,be),E.toBlob(async Xe=>{if(Xe){let Le=new File([Xe],R.name,{type:R.type,lastModified:Date.now()});if(g)try{Le=await fo(Le);}catch(Ro){d(Ro,"Erro ao converter para WebP");}o(Le);}else o(null);},"image/png")):o(null);},j.src=u;}),te=async()=>{if(!(!R||!x)){v(!0);try{let o=await re();if(o)if(Array.isArray(e)||e===void 0&&r){let b=p?[...y,o].slice(0,p):[...y,o];c(b),r?.(b);}else c([o]),t?.(o);let E=_.slice(1);U(E),D(!1),h(""),f(null),E.length>0&&setTimeout(()=>G(),100);}catch(o){d(o,"Erro ao processar imagem");}finally{v(!1);}}},M=()=>{D(!1),h(""),f(null),U([]),B(0);},L=useCallback(o=>{if(o.length===0)return;if(i?.accept&&Object.keys(i.accept).some(b=>b.includes("image/"))&&n)if(Array.isArray(e)||e===void 0&&r){let b=o.filter(V=>V.type.startsWith("image/")),j=y.map(V=>V.name),ce=b.filter(V=>!j.includes(V.name));if(ce.length===0){d("Todos os arquivos selecionados j\xE1 foram adicionados","Arquivos duplicados");return}U(ce),B(0);}else {let b=o[0];f(b);let j=new FileReader;j.onload=()=>{h(j.result),D(!0);},j.readAsDataURL(b);}else if(Array.isArray(e)||e===void 0&&r){let b=p?[...y,...o].slice(0,p):[...y,...o];c(b),r?.(b);}else {let b=o[0];c([b]),t?.(b);}},[e,y,t,r,n,p,i,d]),N=useCallback(o=>{if(!o.length)return;let E=o[0]?.errors[0]?.code,b=i?.maxSize||3145728;d(E==="file-too-large"?new Error(`O arquivo excede o tamanho m\xE1ximo de ${e$1(b)}`):E==="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");},[i?.maxSize,d]),{getRootProps:C,getInputProps:q,isDragActive:Z,isDragReject:_e,fileRejections:Oe}=useDropzone({onDrop:L,onDropRejected:N,...i}),Me=useCallback(o=>{if(!o){c([]),a?.(void 0);return}if(Array.isArray(e)||e===void 0&&r){let E=m.filter(b=>b.name!==o.name);c(E),a?.(o),r&&r(E);}else c([]),a?.(o);},[e,m,r,a]),Do=useCallback(()=>{c([]),Array.isArray(e)&&r?r([]):!Array.isArray(e)&&t&&t?.(null);},[e,r,t]);return {file:$,files:y,aspectRatio:P,dropzoneProps:{getRootProps:C,getInputProps:q,isDragActive:Z,isDragReject:_e,fileRejections:Oe},cropState:{cropModalOpen:I,imagePreview:u,cropLoading:F,setCropModalOpen:D,onCropInitialized:oe,handleCropSave:te,handleCropCancel:M,currentImageIndex:ee,totalPendingImages:_.length},handleRemove:Me,clearFiles:Do,setFiles:c}},z=lr;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||{}),Re=(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))(Re||{});var cr=({createFilesMutation:e,files:t,file:r})=>{let{showErrorMessage:a}=a$7(),[i,n]=useState(!1),[l,g]=useState(!1),[p,s]=useState(null),[d,P]=useState(void 0),m=useMemo(()=>d?.[0],[d]),c=useMemo(()=>r?[r]:t,[r,t]),I=useCallback(async f=>{if(!f?.length){P(void 0);return}try{g(!0);let x=await Promise.all(f.map(async({url:w,name:u})=>{let F=await(await fetch(w)).blob(),v=u||w.split("/").pop()||"image";return new File([F],v,{type:F.type})}));P(x);}catch(x){console.error("Erro ao carregar preview dos arquivos:",x),P(void 0);}finally{g(!1);}},[]),D=l||i;return useEffect(()=>{I(c);},[c,I]),{filesPreview:d,filePreview:m,uploadFiles:async f=>{if(f?.length){n(!0);try{let x=f[0].type||"application/octet-stream",w=Re[x];if(!w)throw new Error(`Tipo de arquivo n\xE3o suportado: ${x}`);let u=await e({files:[{content_type:w,name:f[0].name}]}).unwrap(),h=u.files.map(v=>v.id);return (await Promise.all(f.map(v=>fetch(u.files[0].url,{method:"PUT",headers:{"Content-Type":x},body:v})))).forEach(v=>{if(!v.ok)throw new Error(`Erro no upload: ${v.statusText}`)}),P(f),h}catch(x){throw s(x),a(x,"Erro no upload"),x}finally{n(!1);}}},isUploadingFiles:i,isLoadingPreview:l,isUploadOrLoadingFiles:D,uploadFilesError:p}},mr=cr;var ur=({sx:e,id:t,name:r,tabIndex:a,uploading:i,getRootProps:n,getInputProps:l,isDragActive:g,isError:p,disabled:s,dropZoneSxProps:d,dropZoneContent:P,children:m,...c})=>jsxs(De,{children:[i&&jsx(a$6,{"data-testid":"uploading-progress-bar"}),jsxs(ge,{sx:{width:1,position:"relative",...e},children:[jsxs(Ve,{...n(),"data-testid":"drop-zone-styled-area",isError:p,isDragActive:g,disabled:!!s,sx:d,...c,children:[jsx("input",{...l(),id:t,tabIndex:a,name:r}),P]}),m]})]}),K=ur;var xr=({header:e,description:t,sx:r,...a})=>jsxs(ae,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...r},...a,children:[jsx(a$3,{sx:{width:220}}),jsxs("div",{children:[jsx(Be,{gutterBottom:!0,variant:"h5",children:e||"Soltar ou selecionar arquivos"}),jsx(Be,{variant:"body2",sx:{color:"text.secondary"},children:t||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(Be,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),J=memo(xr);var vr=({onRemove:e,onReorder:t,onFilesSelect:r,id:a,disabled:i,error:n,helperText:l,files:g,thumbnail:p,dropZoneSxProps:s,uploading:d,tabIndex:P,maxFiles:m,...c})=>{let{files:I,dropzoneProps:D,handleRemove:R}=z({filesToUpload:g,onFilesSelect:r,onRemove:e,dropzoneOptions:{multiple:!0,disabled:i,...c},maxFiles:m}),{getRootProps:f,getInputProps:x,isDragActive:w,isDragReject:u}=D,h=!!I?.length,F=u||!!n;return jsxs(K,{id:a,uploading:d,disabled:i,dropZoneSxProps:s,tabIndex:P,getRootProps:f,getInputProps:x,isDragActive:w,isError:F,dropZoneContent:jsx(J,{}),children:[jsx(k,{disabled:i,helperText:l,isError:F}),h&&jsx(ge,{sx:{my:3},children:jsx(fe,{files:I,thumbnail:!!p,onRemove:e?R:void 0,onReorder:t})})]})},Ar=memo(vr);var Sr=({onFilesSelect:e,onRemove:t,onReorder:r,id:a,disabled:i,error:n,helperText:l,files:g,dropZoneSxProps:p,placeholderProps:s,placeholderAlt:d,uploading:P,tabIndex:m,maxFiles:c,aspectRatio:I,enableCrop:D=!0,convertToWebp:R=!0,cropSize:f,name:x,label:w,...u})=>{let{files:h,dropzoneProps:F,cropState:v,handleRemove:_,aspectRatio:U}=z({filesToUpload:g,onFilesSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:i,...u},enableCrop:D,customAspectRatio:I,convertToWebp:R,maxFiles:c,cropSize:f}),{getRootProps:ee,getInputProps:B,isDragActive:y,isDragReject:$}=F,{cropModalOpen:G,imagePreview:oe,cropLoading:re,onCropInitialized:te,handleCropSave:M,handleCropCancel:L,currentImageIndex:N,totalPendingImages:C}=v,q=!!h?.length,Z=$||!!n,_e=useMemo(()=>{let Oe=w??"Ajustar Imagem",Me=C>1?` (${N} de ${C})`:"";return `${Oe}${Me}`},[w,C,N]);return jsxs(K,{id:a,name:x,uploading:P,disabled:i,dropZoneSxProps:p,tabIndex:m,getRootProps:ee,getInputProps:B,isDragActive:y,isError:Z,dropZoneContent:jsx(Fragment,{children:d?jsx(ae,{children:d}):jsx(J,{header:s?.header,description:s?.description})}),children:[jsx(k,{disabled:i,helperText:l,isError:Z}),q&&jsx(Fragment,{children:jsx(ge,{sx:{my:3,ml:.5},children:jsx(fe,{files:h,thumbnail:!0,onRemove:_,onReorder:r})})}),jsx(a$4,{open:G,onClose:L,label:_e,imageSrc:oe,aspectRatio:U,onInitialized:te,onSave:M,loading:re,cropSize:f})]})},yr=memo(Sr);var Cr=({onFileSelect:e,onRemove:t,file:r,id:a,disabled:i,error:n,helperText:l,sx:g$1,dropZoneSxProps:p,uploading:s,tabIndex:d,...P})=>{let{file:m$1,dropzoneProps:c,handleRemove:I}=z({filesToUpload:r,onFileSelect:e,onRemove:t,dropzoneOptions:{multiple:!1,disabled:i,...P}}),{getRootProps:D,getInputProps:R,isDragActive:f,isDragReject:x}=c,w=useCallback(v=>{v.stopPropagation(),I(m$1||void 0);},[m$1,I]),u=!!m$1,h=typeof m$1=="string",F=x||!!n;return jsx(K,{id:a,uploading:s,disabled:i,dropZoneSxProps:p,tabIndex:d,getRootProps:D,getInputProps:R,isDragActive:f,isError:F,dropZoneContent:jsxs(Fragment,{children:[!u&&jsx(J,{}),u&&jsxs(ae,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:v=>`solid 1px ${v.palette.divider}`,...g$1},children:[jsx(g,{file:m$1}),jsxs(ae,{flexGrow:1,sx:{minWidth:0},children:[jsx(Be,{variant:"subtitle2",noWrap:!0,children:h?m$1:m$1.name}),jsx(Be,{variant:"caption",sx:{color:"text.secondary"},children:h?"":e$1(m$1.size)})]}),t&&jsx(a$2,{title:"Remover arquivo",children:jsx(He,{edge:"end",size:"small",disabled:i,"aria-label":"Remover arquivo",onClick:w,children:jsx(a$5,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:jsx(k,{disabled:i,helperText:l,isError:F})})},kr=memo(Cr);var Gr=({onRemove:e,onFileSelect:t,file:r,id:a,disabled:i,error:n,helperText:l,dropZoneSxProps:g,placeholderProps:p,placeholderAlt:s,uploading:d,tabIndex:P,aspectRatio:m,enableCrop:c=!0,convertToWebp:I=!0,name:D,label:R,cropSize:f,...x})=>{let[w,u]=useState(!1),{file:h,dropzoneProps:F,cropState:v,handleRemove:_,aspectRatio:U}=z({filesToUpload:r,onFileSelect:t,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:i,...x},enableCrop:c,customAspectRatio:m,convertToWebp:I,cropSize:f}),{getRootProps:ee,getInputProps:B,isDragActive:y,isDragReject:$}=F,{cropModalOpen:G,imagePreview:oe,cropLoading:re,onCropInitialized:te,handleCropSave:M,handleCropCancel:L}=v,N=useCallback(()=>{_(h||void 0);},[h,_]),C=!!h,q=$||!!n,Z=C?{opacity:0}:{opacity:1};return jsxs(De,{children:[(d||w)&&jsx(a$6,{}),jsxs(K,{id:a,uploading:d,disabled:i,dropZoneSxProps:g,tabIndex:P,getRootProps:ee,getInputProps:B,isDragActive:y,isError:q,name:D,dropZoneContent:jsxs(Fragment,{children:[s?jsx(ae,{sx:Z,children:s}):jsx(J,{sx:Z,header:p?.title,description:p?.description}),C&&jsx(ze,{file:h,cropSize:f,isLoading:w,isUploading:d,onLoading:u,aspectRatio:U})]}),children:[jsx(k,{disabled:i,helperText:l,isError:q}),C&&e&&jsx(Qe,{size:"small",onClick:N,disabled:i,label:"Remover arquivo",children:jsx(a$5,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$4,{open:G,onClose:L,label:R??"Ajustar Imagem",imageSrc:oe,aspectRatio:U,onInitialized:te,onSave:M,loading:re,cropSize:f})]})]})},Zr=memo(Gr);var Vr=({onFileSelect:e,onRemove:t,file:r,disabled:a,label:i,id:n,tabIndex:l,error:g,helperText:p,sx:s,name:d,maxSize:P,uploading:m,aspectRatio:c=1,enableCrop:I=!0,convertToWebp:D=!0,cropSize:R,...f})=>{let[x,w]=useState(!1),{file:u,dropzoneProps:h,cropState:F,handleRemove:v}=z({filesToUpload:r,onFileSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:a,maxSize:P,...f},enableCrop:I,customAspectRatio:c,convertToWebp:D,cropSize:R}),{getRootProps:_,getInputProps:U,isDragActive:ee,isDragReject:B}=h,{cropModalOpen:y,imagePreview:$,cropLoading:G,onCropInitialized:oe,handleCropSave:re,handleCropCancel:te}=F,M=B||!!g,L=x||m,N=!!t,C=useMemo(()=>u?(w(!0),URL.createObjectURL(u)):"",[u]),q=()=>{w(!1);},Z=()=>N&&u?()=>v(u):_().onClick;return jsxs(Fragment,{children:[jsxs(ao,{sx:s,isError:M,isDragActive:ee,hasFile:!!u,..._(),onClick:Z(),children:[jsxs(to,{children:[u&&jsx(no,{alt:"Avatar Preview",src:C,onLoad:q,...L&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),u&&L&&jsx(io,{children:jsx(qr,{size:135,thickness:1,color:"primary"})}),!u&&!L&&jsxs(ke,{isError:M,hasFile:!1,children:[jsx(a$5,{icon:"ADD_IMAGE",width:32}),jsx(Be,{variant:"caption",textAlign:"center",sx:{color:M?"error.main":"text.disabled"},children:"Adicionar foto"})]}),u&&!L&&jsxs(ke,{isError:M,hasFile:!0,children:[jsx(a$5,{icon:N?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(Be,{variant:"caption",textAlign:"center",sx:{color:M?"error.main":"common.white"},children:N?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:d,id:n,tabIndex:l,...U()}),jsx(ae,{spacing:.5,sx:{pt:1},children:jsx(k,{helperText:p,disabled:a,isError:M})}),u&&!L&&jsx(ae,{direction:"row",justifyContent:"center",spacing:1,sx:{pt:1,mb:-1},children:jsx(Be,{variant:"caption",component:"span",sx:{px:.75,cursor:"pointer",borderRadius:.75,color:"error.main","&:hover":{color:"error.dark",bgcolor:"background.default"}},onClick:()=>v(u),children:"Remover"})})]}),y&&$&&jsx(a$4,{open:y,onClose:te,label:i??"Ajustar Imagem",imageSrc:$,aspectRatio:c,onInitialized:oe,onSave:re,loading:G,cropSize:R,cropShape:"round"})]})},Hr=memo(Vr);var Yr=({error:e,name:t,disabled:r,sx:a,...i})=>{let{getRootProps:n,getInputProps:l,isDragActive:g,isDragReject:p}=useDropzone({disabled:r,...i}),s=p||e;return jsxs(Ye,{...n(),isDragActive:g,hasError:!!s,disabled:!!r,sx:a,"data-testid":"upload-box",children:[jsx("input",{name:t,...l()}),"Selecionar arquivo"]})},et=memo(Yr);
34
+ var yo=({helperText:e,disabled:t,isError:r})=>e?jsx(So,{error:r,sx:a=>({mx:"14px",color:t?a.palette.grey[500]:void 0}),children:e}):null,k=memo(yo);var De=styled(ae)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),we=styled(ae)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),Ve=styled(ge,{shouldForwardProp:e=>!["isDragActive","isError","disabled"].includes(e)})(({theme:e,isDragActive:t,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:`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},...a&&{opacity:.48,pointerEvents:"none"},"&:hover":{opacity:.72}}));styled(ae)(({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 He=styled(Oo)(({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]}})),Ce=styled("div")({position:"relative",zIndex:1,"&:hover":{zIndex:2}}),Ke=styled(ae,{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(ge,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="disabled"&&e!=="hasError"})(({theme:e,isDragActive:t,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)}`,...t&&{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}})),eo=styled(ge)(({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:a=1,isLoading:i,isUploading:n})=>({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:"calc(100% - 16px)",maxHeight:"calc(100% - 16px)",backgroundColor:e.palette.background.paper,height:r>=a?"100%":`calc(100% * ${t})`,width:r>a?`calc(${t} * 100%)`:"100%",transition:"all 0.5s ease-in-out",...i||n?{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(ae)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(Mo)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var ke=styled(ge,{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(ae)({top:0,left:0,right:0,bottom:0,position:"absolute",zIndex:10,alignItems:"center",justifyContent:"center"});styled(ae)(({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(ge,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="isError"&&e!=="hasFile"})(({theme:e,isDragActive:t,disabled:r,isError:a,hasFile:i})=>({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"},...a&&{borderColor:"error.main"},...i&&{...a&&{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 zo=({onRemove:e$1,sx:t,file:r,disableDrag:a,attributes:i,listeners:n,innerWidth:l,isDragging:g$1})=>{let{key:p}=e(r);return jsx(ko,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(Je,{width:l,isDragging:g$1,"data-testid":`preview-multi-img-${p}`,...j().inUp,sx:t,children:[jsx(a$1,{disableDrag:a,...i,...n}),jsx(g,{tooltip:!0,imageView:!0,file:r}),jsx(we,{sx:{position:"absolute",right:3,top:3,zIndex:1},children:e$1&&jsx(so,{size:"small",label:"Remover arquivo",onClick:()=>e$1(r),icon:"DELETE_MARK_BUTTON_02"})})]})},`badge-${p}`)},lo=memo(zo);var Go=({file:e$2,thumbnail:t,onRemove:r,sx:a$3,disableDrag:i=!1})=>{let{key:n,name:l="",size:g$1=0}=e(e$2||""),p=typeof e$2=="string",s=i?70:80,{attributes:d,listeners:P,setNodeRef:m,transform:c,transition:I,isDragging:D}=useSortable({id:n,disabled:i}),R={transform:x.Transform.toString(c),transition:I,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${s+8}px`,height:"68px"};return t&&e$2?jsx(Ce,{ref:m,style:R,children:jsx(lo,{innerWidth:s,isDragging:D,sx:a$3,file:e$2,disableDrag:i,attributes:d,listeners:P,onRemove:r})}):jsx(Ce,{ref:m,style:{...R,height:"80px",width:`${s+38}px`},children:jsxs(Ke,{width:s+30,isDragging:D,"data-testid":`preview-multi-img-${n}`,...j().inUp,sx:a$3,children:[jsx(a$1,{disableDrag:i,...d,...P}),e$2&&jsx(g,{file:e$2}),jsxs(ae,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$2,{title:l,children:jsx(Be,{variant:"subtitle2",noWrap:!0,children:l})}),jsx(Be,{variant:"caption",sx:{color:"text.secondary"},children:p?"":e$1(g$1)})]}),jsx(we,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$2),icon:"DELETE_MARK_BUTTON_02"})})]})})},mo=memo(Go);var or=({thumbnail:e$1,files:t,onRemove:r,onReorder:a,sx:i})=>{let n=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates}));if(!t?.length)return null;let l=p=>{let{active:s,over:d}=p;if(!(!s||!d||s.id===d.id)&&a){let P=t.findIndex(c=>{let{key:I}=e(c);return I===s.id}),m=t.findIndex(c=>{let{key:I}=e(c);return I===d.id});P!==-1&&m!==-1&&a(P,m);}},g=jsx(AnimatePresence,{initial:!1,children:t.map(p=>jsx(mo,{sx:i,file:p,onRemove:r,thumbnail:e$1,disableDrag:!a},e(p).key))});return a?jsx(DndContext,{sensors:n,collisionDetection:closestCenter,onDragEnd:l,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:t.map(p=>e(p).key),strategy:horizontalListSortingStrategy,children:g})}):g},fe=memo(or);var ar=({file:e,aspectRatio:t=1,isUploading:r,isLoading:a,onLoading:i,cropSize:n})=>{let l=useRef(null),g=typeof e=="string"?e:e.name,p=typeof e=="string"?e:URL.createObjectURL(e);useEffect(()=>{l.current&&!l.current.complete?i?.(!0):i?.(!1);},[l,i]);let s=typeof n=="number"?n*t:n?.width,d=typeof n=="number"?n:n?.height;return jsxs(eo,{children:[jsx(oo,{aspectRatio:t,isLoading:a,isUploading:r,height:d,width:s,alt:g,src:p,ref:l,onLoad:()=>i?.(!1),onError:()=>i?.(!1)}),jsx(ro,{alt:g,src:p,isLoading:a,isUploading:r})]})},ze=memo(ar);var ri=e=>e.startsWith("image/"),fo=(e,t=.8)=>new Promise((r,a)=>{let i=document.createElement("canvas"),n=i.getContext("2d"),l=new Image;l.onload=()=>{i.width=l.width,i.height=l.height,n?(n.drawImage(l,0,0),i.toBlob(g=>{if(g){let p=new File([g],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});r(p);}else a(new Error("Falha ao converter para WebP"));},"image/webp",t)):a(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},l.onerror=()=>a(new Error("Falha ao carregar imagem")),l.src=URL.createObjectURL(e);});var lr=({filesToUpload:e,onFileSelect:t,onFilesSelect:r,onRemove:a,dropzoneOptions:i,enableCrop:n=!1,customAspectRatio:l,convertToWebp:g=!0,maxFiles:p,cropSize:s})=>{let{showErrorMessage:d}=a$7(),P=useMemo(()=>l||(s&&typeof s!="number"?s.width/s.height:1),[l,s]),[m,c]=useState([]),[I,D]=useState(!1),[R,f]=useState(null),[x,w]=useState(null),[u,h]=useState(""),[F,v]=useState(!1),[_,U]=useState([]),[ee,B]=useState(0),y=useMemo(()=>e&&Array.isArray(e)?e.filter(o=>o instanceof File):e&&e instanceof File?[e]:m,[e,m]),X=useMemo(()=>e&&Array.isArray(e)?null:e&&e instanceof File?e:m[0]||null,[e,m]);useEffect(()=>{e&&(Array.isArray(e)?c(e.filter(o=>o instanceof File)):e instanceof File?c([e]):e===null&&c([]));},[e]);let G=useCallback(()=>{if(_.length>0&&n){let o=_[0];f(o),B(b=>b+1);let E=new FileReader;E.onload=()=>{h(E.result),D(!0);},E.readAsDataURL(o);}},[_,n]);useEffect(()=>{G();},[G]);let oe=useCallback((o,E)=>{w(E);},[]),re=async()=>!R||!x?null:new Promise(o=>{let E=document.createElement("canvas"),b=E.getContext("2d"),j=new Image;j.onload=async()=>{let{width:ce,height:V,x:wo,y:Eo}=x,xe=ce,be=V;s&&(typeof s=="number"?(xe=s,be=s/P):(xe=s.width,be=s.height)),E.width=xe,E.height=be,b?(b.drawImage(j,wo,Eo,ce,V,0,0,xe,be),E.toBlob(async $e=>{if($e){let Le=new File([$e],R.name,{type:R.type,lastModified:Date.now()});if(g)try{Le=await fo(Le);}catch(Ro){d(Ro,"Erro ao converter para WebP");}o(Le);}else o(null);},"image/png")):o(null);},j.src=u;}),te=async()=>{if(!(!R||!x)){v(!0);try{let o=await re();if(o)if(Array.isArray(e)||e===void 0&&r){let b=p?[...y,o].slice(0,p):[...y,o];c(b),r?.(b);}else c([o]),t?.(o);let E=_.slice(1);U(E),D(!1),h(""),f(null),E.length>0&&setTimeout(()=>G(),100);}catch(o){d(o,"Erro ao processar imagem");}finally{v(!1);}}},M=()=>{D(!1),h(""),f(null),U([]),B(0);},L=useCallback(o=>{if(o.length===0)return;if(i?.accept&&Object.keys(i.accept).some(b=>b.includes("image/"))&&n)if(Array.isArray(e)||e===void 0&&r){let b=o.filter(V=>V.type.startsWith("image/")),j=y.map(V=>V.name),ce=b.filter(V=>!j.includes(V.name));if(ce.length===0){d("Todos os arquivos selecionados j\xE1 foram adicionados","Arquivos duplicados");return}U(ce),B(0);}else {let b=o[0];f(b);let j=new FileReader;j.onload=()=>{h(j.result),D(!0);},j.readAsDataURL(b);}else if(Array.isArray(e)||e===void 0&&r){let b=p?[...y,...o].slice(0,p):[...y,...o];c(b),r?.(b);}else {let b=o[0];c([b]),t?.(b);}},[e,y,t,r,n,p,i,d]),N=useCallback(o=>{if(!o.length)return;let E=o[0]?.errors[0]?.code,b=i?.maxSize||3145728;d(E==="file-too-large"?new Error(`O arquivo excede o tamanho m\xE1ximo de ${e$1(b)}`):E==="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");},[i?.maxSize,d]),{getRootProps:C,getInputProps:q,isDragActive:Z,isDragReject:_e,fileRejections:Oe}=useDropzone({onDrop:L,onDropRejected:N,...i}),Me=useCallback(o=>{if(!o){c([]),a?.(void 0);return}if(Array.isArray(e)||e===void 0&&r){let E=m.filter(b=>b.name!==o.name);c(E),a?.(o),r&&r(E);}else c([]),a?.(o);},[e,m,r,a]),Do=useCallback(()=>{c([]),Array.isArray(e)&&r?r([]):!Array.isArray(e)&&t&&t?.(null);},[e,r,t]);return {file:X,files:y,aspectRatio:P,dropzoneProps:{getRootProps:C,getInputProps:q,isDragActive:Z,isDragReject:_e,fileRejections:Oe},cropState:{cropModalOpen:I,imagePreview:u,cropLoading:F,setCropModalOpen:D,onCropInitialized:oe,handleCropSave:te,handleCropCancel:M,currentImageIndex:ee,totalPendingImages:_.length},handleRemove:Me,clearFiles:Do,setFiles:c}},z=lr;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||{}),Re=(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))(Re||{});var cr=({createFilesMutation:e,files:t,file:r})=>{let{showErrorMessage:a}=a$7(),[i,n]=useState(!1),[l,g]=useState(!1),[p,s]=useState(null),[d,P]=useState(void 0),m=useMemo(()=>d?.[0],[d]),c=useMemo(()=>r?[r]:t,[r,t]),I=useCallback(async f=>{if(!f?.length){P(void 0);return}try{g(!0);let x=await Promise.all(f.map(async({url:w,name:u})=>{let F=await(await fetch(w)).blob(),v=u||w.split("/").pop()||"image";return new File([F],v,{type:F.type})}));P(x);}catch(x){console.error("Erro ao carregar preview dos arquivos:",x),P(void 0);}finally{g(!1);}},[]),D=l||i;return useEffect(()=>{I(c);},[c,I]),{filesPreview:d,filePreview:m,uploadFiles:async f=>{if(f?.length){n(!0);try{let x=f[0].type||"application/octet-stream",w=Re[x];if(!w)throw new Error(`Tipo de arquivo n\xE3o suportado: ${x}`);let u=await e({files:[{content_type:w,name:f[0].name}]}).unwrap(),h=u.files.map(v=>v.id);return (await Promise.all(f.map(v=>fetch(u.files[0].url,{method:"PUT",headers:{"Content-Type":x},body:v})))).forEach(v=>{if(!v.ok)throw new Error(`Erro no upload: ${v.statusText}`)}),P(f),h}catch(x){throw s(x),a(x,"Erro no upload"),x}finally{n(!1);}}},isUploadingFiles:i,isLoadingPreview:l,isUploadOrLoadingFiles:D,uploadFilesError:p}},mr=cr;var ur=({sx:e,id:t,name:r,tabIndex:a,uploading:i,getRootProps:n,getInputProps:l,isDragActive:g,isError:p,disabled:s,dropZoneSxProps:d,dropZoneContent:P,children:m,...c})=>jsxs(De,{children:[i&&jsx(a$6,{"data-testid":"uploading-progress-bar"}),jsxs(ge,{sx:{width:1,position:"relative",...e},children:[jsxs(Ve,{...n(),"data-testid":"drop-zone-styled-area",isError:p,isDragActive:g,disabled:!!s,sx:d,...c,children:[jsx("input",{...l(),id:t,tabIndex:a,name:r}),P]}),m]})]}),K=ur;var xr=({header:e,description:t,sx:r,...a})=>jsxs(ae,{spacing:5,alignItems:"center",justifyContent:"center",direction:{xs:"column",md:"row"},sx:{width:1,textAlign:{xs:"center",md:"left"},...r},...a,children:[jsx(a$3,{sx:{width:220}}),jsxs("div",{children:[jsx(Be,{gutterBottom:!0,variant:"h5",children:e||"Soltar ou selecionar arquivos"}),jsx(Be,{variant:"body2",sx:{color:"text.secondary"},children:t||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(Be,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),J=memo(xr);var vr=({onRemove:e,onReorder:t,onFilesSelect:r,id:a,disabled:i,error:n,helperText:l,files:g,thumbnail:p,dropZoneSxProps:s,uploading:d,tabIndex:P,maxFiles:m,...c})=>{let{files:I,dropzoneProps:D,handleRemove:R}=z({filesToUpload:g,onFilesSelect:r,onRemove:e,dropzoneOptions:{multiple:!0,disabled:i,...c},maxFiles:m}),{getRootProps:f,getInputProps:x,isDragActive:w,isDragReject:u}=D,h=!!I?.length,F=u||!!n;return jsxs(K,{id:a,uploading:d,disabled:i,dropZoneSxProps:s,tabIndex:P,getRootProps:f,getInputProps:x,isDragActive:w,isError:F,dropZoneContent:jsx(J,{}),children:[jsx(k,{disabled:i,helperText:l,isError:F}),h&&jsx(ge,{sx:{my:3},children:jsx(fe,{files:I,thumbnail:!!p,onRemove:e?R:void 0,onReorder:t})})]})},Ar=memo(vr);var Sr=({onFilesSelect:e,onRemove:t,onReorder:r,id:a,disabled:i,error:n,helperText:l,files:g,dropZoneSxProps:p,placeholderProps:s,placeholderAlt:d,uploading:P,tabIndex:m,maxFiles:c,aspectRatio:I,enableCrop:D=!0,convertToWebp:R=!0,cropSize:f,name:x,label:w,...u})=>{let{files:h,dropzoneProps:F,cropState:v,handleRemove:_,aspectRatio:U}=z({filesToUpload:g,onFilesSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:i,...u},enableCrop:D,customAspectRatio:I,convertToWebp:R,maxFiles:c,cropSize:f}),{getRootProps:ee,getInputProps:B,isDragActive:y,isDragReject:X}=F,{cropModalOpen:G,imagePreview:oe,cropLoading:re,onCropInitialized:te,handleCropSave:M,handleCropCancel:L,currentImageIndex:N,totalPendingImages:C}=v,q=!!h?.length,Z=X||!!n,_e=useMemo(()=>{let Oe=w??"Ajustar Imagem",Me=C>1?` (${N} de ${C})`:"";return `${Oe}${Me}`},[w,C,N]);return jsxs(K,{id:a,name:x,uploading:P,disabled:i,dropZoneSxProps:p,tabIndex:m,getRootProps:ee,getInputProps:B,isDragActive:y,isError:Z,dropZoneContent:jsx(Fragment,{children:d?jsx(ae,{children:d}):jsx(J,{header:s?.header,description:s?.description})}),children:[jsx(k,{disabled:i,helperText:l,isError:Z}),q&&jsx(Fragment,{children:jsx(ge,{sx:{my:3,ml:.5},children:jsx(fe,{files:h,thumbnail:!0,onRemove:_,onReorder:r})})}),jsx(a$4,{open:G,onClose:L,label:_e,imageSrc:oe,aspectRatio:U,onInitialized:te,onSave:M,loading:re,cropSize:f})]})},yr=memo(Sr);var Cr=({onFileSelect:e,onRemove:t,file:r,id:a,disabled:i,error:n,helperText:l,sx:g$1,dropZoneSxProps:p,uploading:s,tabIndex:d,...P})=>{let{file:m$1,dropzoneProps:c,handleRemove:I}=z({filesToUpload:r,onFileSelect:e,onRemove:t,dropzoneOptions:{multiple:!1,disabled:i,...P}}),{getRootProps:D,getInputProps:R,isDragActive:f,isDragReject:x}=c,w=useCallback(v=>{v.stopPropagation(),I(m$1||void 0);},[m$1,I]),u=!!m$1,h=typeof m$1=="string",F=x||!!n;return jsx(K,{id:a,uploading:s,disabled:i,dropZoneSxProps:p,tabIndex:d,getRootProps:D,getInputProps:R,isDragActive:f,isError:F,dropZoneContent:jsxs(Fragment,{children:[!u&&jsx(J,{}),u&&jsxs(ae,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:v=>`solid 1px ${v.palette.divider}`,...g$1},children:[jsx(g,{file:m$1}),jsxs(ae,{flexGrow:1,sx:{minWidth:0},children:[jsx(Be,{variant:"subtitle2",noWrap:!0,children:h?m$1:m$1.name}),jsx(Be,{variant:"caption",sx:{color:"text.secondary"},children:h?"":e$1(m$1.size)})]}),t&&jsx(a$2,{title:"Remover arquivo",children:jsx(He,{edge:"end",size:"small",disabled:i,"aria-label":"Remover arquivo",onClick:w,children:jsx(a$5,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:jsx(k,{disabled:i,helperText:l,isError:F})})},kr=memo(Cr);var Gr=({onRemove:e,onFileSelect:t,file:r,id:a,disabled:i,error:n,helperText:l,dropZoneSxProps:g,placeholderProps:p,placeholderAlt:s,uploading:d,tabIndex:P,aspectRatio:m,enableCrop:c=!0,convertToWebp:I=!0,name:D,label:R,cropSize:f,...x})=>{let[w,u]=useState(!1),{file:h,dropzoneProps:F,cropState:v,handleRemove:_,aspectRatio:U}=z({filesToUpload:r,onFileSelect:t,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:i,...x},enableCrop:c,customAspectRatio:m,convertToWebp:I,cropSize:f}),{getRootProps:ee,getInputProps:B,isDragActive:y,isDragReject:X}=F,{cropModalOpen:G,imagePreview:oe,cropLoading:re,onCropInitialized:te,handleCropSave:M,handleCropCancel:L}=v,N=useCallback(()=>{_(h||void 0);},[h,_]),C=!!h,q=X||!!n,Z=C?{opacity:0}:{opacity:1};return jsxs(De,{children:[(d||w)&&jsx(a$6,{}),jsxs(K,{id:a,uploading:d,disabled:i,dropZoneSxProps:g,tabIndex:P,getRootProps:ee,getInputProps:B,isDragActive:y,isError:q,name:D,dropZoneContent:jsxs(Fragment,{children:[s?jsx(ae,{sx:Z,children:s}):jsx(J,{sx:Z,header:p?.title,description:p?.description}),C&&jsx(ze,{file:h,cropSize:f,isLoading:w,isUploading:d,onLoading:u,aspectRatio:U})]}),children:[jsx(k,{disabled:i,helperText:l,isError:q}),C&&e&&jsx(Qe,{size:"small",onClick:N,disabled:i,label:"Remover arquivo",children:jsx(a$5,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$4,{open:G,onClose:L,label:R??"Ajustar Imagem",imageSrc:oe,aspectRatio:U,onInitialized:te,onSave:M,loading:re,cropSize:f})]})]})},Zr=memo(Gr);var Vr=({onFileSelect:e,onRemove:t,file:r,disabled:a,label:i,id:n,tabIndex:l,error:g,helperText:p,sx:s,name:d,maxSize:P,uploading:m,aspectRatio:c=1,enableCrop:I=!0,convertToWebp:D=!0,cropSize:R,...f})=>{let[x,w]=useState(!1),{file:u,dropzoneProps:h,cropState:F,handleRemove:v}=z({filesToUpload:r,onFileSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:a,maxSize:P,...f},enableCrop:I,customAspectRatio:c,convertToWebp:D,cropSize:R}),{getRootProps:_,getInputProps:U,isDragActive:ee,isDragReject:B}=h,{cropModalOpen:y,imagePreview:X,cropLoading:G,onCropInitialized:oe,handleCropSave:re,handleCropCancel:te}=F,M=B||!!g,L=x||m,N=!!t,C=useMemo(()=>u?(w(!0),URL.createObjectURL(u)):"",[u]),q=()=>{w(!1);},Z=()=>N&&u?()=>v(u):_().onClick;return jsxs(Fragment,{children:[jsxs(ao,{sx:s,isError:M,isDragActive:ee,hasFile:!!u,..._(),onClick:Z(),children:[jsxs(to,{children:[u&&jsx(no,{alt:"Avatar Preview",src:C,onLoad:q,...L&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),u&&L&&jsx(io,{children:jsx(qr,{size:135,thickness:1,color:"primary"})}),!u&&!L&&jsxs(ke,{isError:M,hasFile:!1,children:[jsx(a$5,{icon:"ADD_IMAGE",width:32}),jsx(Be,{variant:"caption",textAlign:"center",sx:{color:M?"error.main":"text.disabled"},children:"Adicionar foto"})]}),u&&!L&&jsxs(ke,{isError:M,hasFile:!0,children:[jsx(a$5,{icon:N?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(Be,{variant:"caption",textAlign:"center",sx:{color:M?"error.main":"common.white"},children:N?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:d,id:n,tabIndex:l,...U()}),jsx(ae,{spacing:.5,sx:{pt:1},children:jsx(k,{helperText:p,disabled:a,isError:M})}),u&&!L&&jsx(ae,{direction:"row",justifyContent:"center",spacing:1,sx:{pt:1,mb:-1},children:jsx(Be,{variant:"caption",component:"span",sx:{px:.75,cursor:"pointer",borderRadius:.75,color:"error.main","&:hover":{color:"error.dark",bgcolor:"background.default"}},onClick:()=>v(u),children:"Remover"})})]}),y&&X&&jsx(a$4,{open:y,onClose:te,label:i??"Ajustar Imagem",imageSrc:X,aspectRatio:c,onInitialized:oe,onSave:re,loading:G,cropSize:R,cropShape:"round"})]})},Hr=memo(Vr);var Yr=({error:e,name:t,disabled:r,sx:a,...i})=>{let{getRootProps:n,getInputProps:l,isDragActive:g,isDragReject:p}=useDropzone({disabled:r,...i}),s=p||e;return jsxs(Ye,{...n(),isDragActive:g,hasError:!!s,disabled:!!r,sx:a,"data-testid":"upload-box",children:[jsx("input",{name:t,...l()}),"Selecionar arquivo"]})},et=memo(Yr);
35
35
 
36
36
  export { Ne as ContentType, Re as FileContentType, k as HelperText, fe as MultiFilePreview, Ar as MultipleFileUpload, yr as MultipleImageUpload, ze as SingleFilePreview, kr as SingleFileUpload, Zr as SingleImageUpload, Hr as UploadAvatar, et as UploadSimpleBox, fo as convertToWebP, ri as isImageFile, z as useDropzoneUploader, mr as useFileUploadService };
@@ -0,0 +1,14 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { TooltipProps } from '@mui/material/Tooltip';
3
+ import { Icon } from '../../types/icon.js';
4
+
5
+ interface InfoCircleProps extends Omit<TooltipProps, 'title' | 'children'> {
6
+ text: React.ReactNode | string;
7
+ icon?: keyof typeof Icon;
8
+ width?: number;
9
+ color?: string;
10
+ }
11
+
12
+ declare const InfoCircle: ({ text, icon, width, color, ...props }: InfoCircleProps) => react_jsx_runtime.JSX.Element;
13
+
14
+ export { InfoCircle as default };
@@ -0,0 +1,8 @@
1
+ import { a } from '../../chunk-IPOTBSM7.js';
2
+ import { a as a$1 } from '../../chunk-RGXSHDAI.js';
3
+ import '../../chunk-CHLVIVDD.js';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ var f=({text:i,icon:l="INFO_CIRCLE",width:p,color:c="text.secondary",...e})=>jsx(a,{title:i,...e,children:jsx(a$1,{icon:l,width:p,color:c})}),m=f;
7
+
8
+ export { m as default };
@@ -0,0 +1,10 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { TypographyProps } from '@mui/material/Typography';
3
+
4
+ interface SmartTextProps extends TypographyProps {
5
+ text: string;
6
+ }
7
+
8
+ declare const SmartText: ({ text, component, ...other }: SmartTextProps) => react_jsx_runtime.JSX.Element;
9
+
10
+ export { SmartText as default };
@@ -0,0 +1,6 @@
1
+ import t from '@mui/material/Typography';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ var a=e=>{try{return new URL(e),!0}catch{return !1}},d=({text:e,component:n="div",...o})=>{let r=a(e);return jsx(t,{...o,component:r?"a":n,href:r?e:void 0,target:r?"_blank":void 0,rel:r?"noopener noreferrer":void 0,color:r?"primary":void 0,underline:r?"always":void 0,children:e})},f=d;
5
+
6
+ export { f as default };
@@ -1,5 +1,5 @@
1
- import { a as a$2 } from '../../../chunk-M4APIAYD.js';
2
1
  import { a as a$1 } from '../../../chunk-2NMLQNWC.js';
2
+ import { a as a$2 } from '../../../chunk-M4APIAYD.js';
3
3
  import { a as a$3 } from '../../../chunk-RVTKAY5D.js';
4
4
  import '../../../chunk-ORLVNXTG.js';
5
5
  import '../../../chunk-FQKQM7BC.js';
@@ -1,7 +1,7 @@
1
- export { a as default } from '../chunk-YZ6ZATKM.js';
2
- import '../chunk-GUFT6XPG.js';
1
+ export { a as default } from '../chunk-COWMZKQG.js';
3
2
  import '../chunk-GOC7PC2S.js';
4
3
  import '../chunk-MCT77MRN.js';
5
4
  import '../chunk-CFVUZ4S5.js';
6
5
  import '../chunk-CFYNJQGN.js';
6
+ import '../chunk-GUFT6XPG.js';
7
7
  import '../chunk-D27ND54J.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.4.21",
3
+ "version": "2.4.22",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -1,7 +1,7 @@
1
- import { a } from './chunk-GUFT6XPG.js';
2
1
  import { a as a$1, e } from './chunk-GOC7PC2S.js';
3
2
  import { a as a$3, b as b$1 } from './chunk-MCT77MRN.js';
4
3
  import { q, s, a as a$2 } from './chunk-CFYNJQGN.js';
4
+ import { a } from './chunk-GUFT6XPG.js';
5
5
  import { c } from './chunk-D27ND54J.js';
6
6
  import A from '@mui/material/CssBaseline';
7
7
  import { Experimental_CssVarsProvider, experimental_extendTheme, lighten, darken } from '@mui/material/styles';