@zydon/common 2.4.73 → 2.4.74

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.
@@ -0,0 +1,9 @@
1
+ import { a as a$1 } from './chunk-KRDLTT6B.js';
2
+ import l from '@mui/material/IconButton';
3
+ import p from '@mui/material/Stack';
4
+ import { styled } from '@mui/material/styles';
5
+ import { jsx, jsxs } from 'react/jsx-runtime';
6
+
7
+ var e=styled(l)(({theme:t})=>({position:"absolute",top:0,left:-2,zIndex:1,color:t.palette.grey[500],padding:"22px 5px",cursor:"grab","&:active":{cursor:"grabbing"}})),a=styled(p)({flexDirection:"row",alignItems:"center",justifyContent:"center",width:16,height:16,overflow:"hidden",transform:"scale(0.8)"});var s=({disableDrag:t,...i})=>t?null:jsx(e,{className:"dragIcon",disableRipple:!0,"aria-label":"Arrastar para ordenar",...i,children:jsxs(a,{children:[jsx(a$1,{sx:{marginLeft:0},icon:"MORE_BOLD",width:16}),jsx(a$1,{sx:{marginLeft:"-10px"},icon:"MORE_BOLD",width:16})]})}),D=s;
8
+
9
+ export { D as a };
@@ -1,5 +1,5 @@
1
1
  import { a } from './chunk-335JAEOK.js';
2
- import { a as a$1 } from './chunk-DNLTCAWK.js';
2
+ import { a as a$1 } from './chunk-XSYQAWOD.js';
3
3
  import w from '@mui/lab/LoadingButton';
4
4
  import k from '@mui/material/Button';
5
5
  import { useState } from 'react';
@@ -2,7 +2,7 @@ import { c, g, p, n, d, e as e$1, a as a$6, b, h, i as i$1, l, m as m$1, j as j$
2
2
  import { a as a$5 } from './chunk-C63Z77ED.js';
3
3
  import { a as a$1 } from './chunk-H5L4ARDB.js';
4
4
  import { e } from './chunk-ANAHA3L6.js';
5
- import { a as a$7 } from './chunk-SERHPCUI.js';
5
+ import { a as a$7 } from './chunk-4DCG2MKR.js';
6
6
  import { x } from './chunk-2P4CXK3O.js';
7
7
  import { a as a$4 } from './chunk-FK7DDO5L.js';
8
8
  import { i, o } from './chunk-D27ND54J.js';
@@ -0,0 +1,7 @@
1
+ import { useFormContext, Controller } from 'react-hook-form';
2
+ import b from '@mui/material/TextField';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var g=({name:l,helperText:n,rules:s,onChange:o,tabIndex:u,className:d,id:r,...e})=>{let{control:f}=useFormContext();return jsx(Controller,{name:l,control:f,rules:s,render:({field:{ref:m,value:F,...t},fieldState:{error:p}})=>jsx(b,{...t,value:F??"",onChange:a=>{t.onChange(a),o&&o(a);},inputRef:m,fullWidth:!0,error:!!p,helperText:p?.message||n,"data-intercom-target":l,...e,InputLabelProps:{...e.InputLabelProps,htmlFor:r},inputProps:{...e.inputProps,tabIndex:u,"aria-label":e.label,id:r},className:`field-${l} ${d}`})})},I=g;
6
+
7
+ export { I as a };
@@ -0,0 +1,9 @@
1
+ import { useMemo } from 'react';
2
+ import I from 'react-easy-crop';
3
+ import b from '@mui/material/Stack';
4
+ import { styled, alpha } from '@mui/material/styles';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ var m=styled(b)(({theme:t})=>({"& .reactEasyCrop_Container":{position:"relative"},"& .reactEasyCrop_CropArea":{border:`2px solid ${t.palette.primary.main}`,borderColor:alpha(t.palette.primary.main,.75)},"& .reactEasyCrop_CropAreaRound":{border:`2px solid ${t.palette.primary.main}`,borderColor:alpha(t.palette.primary.main,.75)}}));var P=({onInitialized:t,aspectRatio:n=1,imageSrc:C="",zoom:s=1,crop:f,cropShape:d="rect",cropSize:o,rotation:y=0,onZoomChange:i,onCropChange:h,onRotationChange:c})=>{let g=r=>{if(r>4){i(4);return}if(r<.1){i(.1);return}i(r);},u=useMemo(()=>{let r=typeof o=="number"?o:o?.width,e=typeof o=="number"?o:o?.height;if(r=r||550,e=e||550,(r||e)<=550)return {width:r,height:e};let a=n>1;return r=a?550:550*n,e=a?550/n:550,{width:r,height:e}},[n,o]);return jsx(m,{children:jsx(I,{image:C,crop:f,zoom:s,aspect:n,onCropChange:h,onZoomChange:g,onCropComplete:t,restrictPosition:!1,cropSize:u,cropShape:d,zoomWithScroll:!1,objectFit:"contain",minZoom:.1,maxZoom:4,style:{containerStyle:{minHeight:"550px",position:"relative"}},rotation:y,onRotationChange:c})})},$=P;
8
+
9
+ export { $ as a };
@@ -1,3 +1,3 @@
1
- export { a as default } from '../../chunk-SERHPCUI.js';
1
+ export { a as default } from '../../chunk-4DCG2MKR.js';
2
2
  import '../../chunk-KRDLTT6B.js';
3
3
  import '../../chunk-RHNLFJOX.js';
@@ -1 +1 @@
1
- export { a as default } from '../../chunk-DNLTCAWK.js';
1
+ export { a as default } from '../../chunk-XSYQAWOD.js';
@@ -1,5 +1,5 @@
1
- export { a as default } from '../../chunk-XRT3S634.js';
1
+ export { a as default } from '../../chunk-AWS647XK.js';
2
2
  import '../../chunk-335JAEOK.js';
3
- import '../../chunk-DNLTCAWK.js';
3
+ import '../../chunk-XSYQAWOD.js';
4
4
  import '../../chunk-KRDLTT6B.js';
5
5
  import '../../chunk-RHNLFJOX.js';
@@ -1,8 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { F as FileThumbnailProps } from '../../types-0e4f1933.js';
2
+ import { F as FileThumbnailProps } from '../../types-ba102ece.js';
3
3
  import '@mui/material/Stack';
4
4
  import '@mui/material/styles';
5
5
  import 'react-dropzone';
6
+ import 'react-easy-crop';
6
7
  import '@dnd-kit/core';
7
8
 
8
9
  declare const fileThumbnailClasses: {
@@ -1,85 +1,45 @@
1
1
  import * as react from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { H as HelperTextProps, M as MultiFilePreviewProps, S as SingleFilePreviewProps, a as FileUploadProps, E as ExtendFile, b as MultiFileUploadProps, c as MultiImageUploadProps, d as SingleFileUploadProps, e as SingleImageUploadProps } from '../../types-0e4f1933.js';
4
- export { C as ContentType, i as CreateFilesMutation, h as CropSize, D as DropZoneProps, f as FileContentType, j as FileCreateRequest, k as FileCreateResponse, n as FileGetResponse, l as FileQueryRequest, m as FileQueryResponse, g as FileUpload, L as LoadingPreviewImageProps, P as PlaceholderProps, R as RejectionFilesProps, o as SortableItemProps, p as StyledDropZoneProps, q as StyledDropZonePropsType, T as ThumbnailBadgeProps } from '../../types-0e4f1933.js';
5
- import { DropzoneOptions, useDropzone, FileRejection } from 'react-dropzone';
6
- import { Area } from 'react-easy-crop';
3
+ import { H as HelperTextProps, M as MultiFilePreviewProps, S as SingleFilePreviewProps, U as UseDropzoneUploaderProps, a as UseDropzoneUploaderReturn, b as FileUploadProps, E as ExtendFile, c as MultiFileUploadProps, d as MultiImageUploadProps, e as SingleFileUploadProps, f as SingleImageUploadProps } from '../../types-ba102ece.js';
4
+ export { C as ContentType, j as CreateFilesMutation, i as CropSize, D as DropZoneProps, g as FileContentType, k as FileCreateRequest, l as FileCreateResponse, o as FileGetResponse, m as FileQueryRequest, n as FileQueryResponse, h as FileUpload, L as LoadingPreviewImageProps, P as PlaceholderProps, R as RejectionFilesProps, p as SortableItemProps, q as StyledDropZoneProps, r as StyledDropZonePropsType, T as ThumbnailBadgeProps } from '../../types-ba102ece.js';
7
5
  import '@mui/material/Stack';
8
6
  import '@mui/material/styles';
7
+ import 'react-dropzone';
8
+ import 'react-easy-crop';
9
9
  import '@dnd-kit/core';
10
10
 
11
11
  declare const _default$8: react.MemoExoticComponent<({ helperText, disabled, isError }: HelperTextProps) => react_jsx_runtime.JSX.Element | null>;
12
12
 
13
- declare const _default$7: react.MemoExoticComponent<({ thumbnail, files, onRemove, onReorder, sx, }: MultiFilePreviewProps) => react_jsx_runtime.JSX.Element | null>;
13
+ declare const _default$7: react.MemoExoticComponent<({ thumbnail, files, onRemove, onReorder, sx, }: MultiFilePreviewProps) => react_jsx_runtime.JSX.Element>;
14
14
 
15
- declare const _default$6: react.MemoExoticComponent<({ file, aspectRatio, isUploading, isLoading, onLoading, cropSize, }: SingleFilePreviewProps) => react_jsx_runtime.JSX.Element | null>;
15
+ declare const _default$6: react.MemoExoticComponent<({ file, aspectRatio, isUploading, isLoading, onLoading, cropSize, maxWidth, maxHeight, }: SingleFilePreviewProps) => react_jsx_runtime.JSX.Element | null>;
16
16
 
17
- interface UseDropzoneUploaderProps {
18
- onFileSelect?: (file: File) => void;
19
- onFilesSelect?: (files: File[]) => void;
20
- onRemove?: (file?: File) => void;
21
- filesToUpload?: File | File[] | null;
22
- dropzoneOptions?: Omit<DropzoneOptions, 'onDrop' | 'onDropRejected'>;
23
- enableCrop?: boolean;
24
- customAspectRatio?: number;
25
- convertToWebp?: boolean;
26
- maxFiles?: number;
27
- cropSize?: {
28
- width: number;
29
- height: number;
30
- } | number;
31
- }
32
- interface UseDropzoneUploaderReturn {
33
- file: File | null;
34
- files: File[];
35
- aspectRatio: number;
36
- dropzoneProps: {
37
- getRootProps: ReturnType<typeof useDropzone>['getRootProps'];
38
- getInputProps: ReturnType<typeof useDropzone>['getInputProps'];
39
- isDragActive: boolean;
40
- isDragReject: boolean;
41
- fileRejections: readonly FileRejection[];
42
- };
43
- cropState: {
44
- cropModalOpen: boolean;
45
- imagePreview: string;
46
- cropLoading: boolean;
47
- setCropModalOpen: React.Dispatch<React.SetStateAction<boolean>>;
48
- onCropInitialized: (croppedArea: Area, croppedAreaPixels: Area) => void;
49
- handleCropSave: () => Promise<void>;
50
- handleCropCancel: () => void;
51
- currentImageIndex: number;
52
- totalPendingImages: number;
53
- };
54
- handleRemove: (fileToRemove?: File) => void;
55
- clearFiles: () => void;
56
- setFiles: React.Dispatch<React.SetStateAction<File[]>>;
57
- }
58
- declare const useDropzoneUploader: ({ filesToUpload, onFileSelect, onFilesSelect, onRemove, dropzoneOptions, enableCrop, customAspectRatio, convertToWebp, maxFiles, cropSize, }: UseDropzoneUploaderProps) => UseDropzoneUploaderReturn;
17
+ declare const useDropzoneUploader: ({ onFilesSelect, onFileSelect, onReorder, onRemove, filesPreview, dropzoneOptions, enableCrop, customAspectRatio, convertToWebp, cropSize, maxFiles, }: UseDropzoneUploaderProps) => UseDropzoneUploaderReturn;
59
18
 
60
- declare const useFileUploadService: ({ createFilesMutation, queryFiles, fileIds, files, file, skip, }: FileUploadProps) => {
19
+ declare const useFileUploadService: ({ createFilesMutation, filesUrl, }: FileUploadProps) => {
61
20
  filesPreview: ExtendFile[] | undefined;
62
21
  filePreview: ExtendFile | undefined;
63
- uploadFiles: (files: File[]) => Promise<string[] | undefined>;
22
+ uploadFiles: (files: Array<File>, callback?: ((files: ExtendFile[]) => void) | undefined) => Promise<string[] | undefined>;
23
+ setFilesPreview: react.Dispatch<react.SetStateAction<ExtendFile[] | undefined>>;
64
24
  isUploadingFiles: boolean;
65
25
  isLoadingPreview: boolean;
66
26
  isUploadOrLoadingFiles: boolean;
67
27
  uploadFilesError: unknown;
68
28
  };
69
29
 
70
- declare const _default$5: react.MemoExoticComponent<({ onRemove, onReorder, onFilesSelect, id, disabled, error, helperText, files: filesToUpload, thumbnail, dropZoneSxProps, uploading, tabIndex, maxFiles, ...other }: MultiFileUploadProps) => react_jsx_runtime.JSX.Element>;
30
+ declare const _default$5: react.MemoExoticComponent<({ onRemove, onReorder, onFilesSelect, id, disabled, error, helperText, files: filesPreview, thumbnail, dropZoneSxProps, uploading, tabIndex, maxFiles, placeholderAlt, placeholderProps, ...other }: MultiFileUploadProps) => react_jsx_runtime.JSX.Element>;
71
31
 
72
- declare const _default$4: react.MemoExoticComponent<({ onFilesSelect, onRemove, onReorder, id, disabled, error, helperText, files: filesToUpload, dropZoneSxProps, placeholderProps, placeholderAlt, uploading, tabIndex, maxFiles, aspectRatio: customAspectRatio, enableCrop, convertToWebp, cropSize, name, label: customLabel, ...other }: MultiImageUploadProps) => react_jsx_runtime.JSX.Element>;
32
+ declare const _default$4: react.MemoExoticComponent<({ onFilesSelect, onRemove, onReorder, id, disabled, error, helperText, files: filesPreview, dropZoneSxProps, placeholderProps, placeholderAlt, uploading, tabIndex, maxFiles, aspectRatio: customAspectRatio, enableCrop, convertToWebp, cropSize, name, label: customLabel, ...other }: MultiImageUploadProps) => react_jsx_runtime.JSX.Element>;
73
33
 
74
- declare const _default$3: react.MemoExoticComponent<({ onFileSelect, onRemove, file: filesToUpload, id, disabled, error, helperText, sx, dropZoneSxProps, uploading, tabIndex, ...other }: SingleFileUploadProps) => react_jsx_runtime.JSX.Element>;
34
+ declare const _default$3: react.MemoExoticComponent<({ onFileSelect, onRemove, file: filePreview, id, disabled, error, helperText, sx, dropZoneSxProps, uploading, tabIndex, ...other }: SingleFileUploadProps) => react_jsx_runtime.JSX.Element>;
75
35
 
76
- declare const _default$2: react.MemoExoticComponent<({ onRemove, onFileSelect, file: filesToUpload, id, disabled, error, helperText, dropZoneSxProps, placeholderProps, placeholderAlt, uploading, tabIndex, aspectRatio: customAspectRatio, enableCrop, convertToWebp, name, label, cropSize, ...other }: SingleImageUploadProps) => react_jsx_runtime.JSX.Element>;
36
+ declare const _default$2: react.MemoExoticComponent<({ onRemove, onFileSelect, file: filePreview, id, disabled, error, helperText, dropZoneSxProps, placeholderProps, placeholderAlt, uploading, tabIndex, aspectRatio: customAspectRatio, enableCrop, convertToWebp, name, label, cropSize, sx, maxWidth, maxHeight, ...other }: SingleImageUploadProps) => react_jsx_runtime.JSX.Element>;
77
37
 
78
- declare const _default$1: react.MemoExoticComponent<({ onFileSelect, onRemove, file: filesToUpload, disabled, label, id, tabIndex, error, helperText, sx, name, maxSize, uploading, aspectRatio, enableCrop, convertToWebp, cropSize, ...other }: SingleImageUploadProps) => react_jsx_runtime.JSX.Element>;
38
+ declare const _default$1: react.MemoExoticComponent<({ onFileSelect, onRemove, file: filePreview, disabled, label, id, tabIndex, error, helperText, sx, name, maxSize, uploading, aspectRatio, enableCrop, convertToWebp, cropSize, ...other }: SingleImageUploadProps) => react_jsx_runtime.JSX.Element>;
79
39
 
80
40
  declare const _default: react.MemoExoticComponent<({ error, name, disabled, sx, ...other }: SingleFileUploadProps) => react_jsx_runtime.JSX.Element>;
81
41
 
82
42
  declare const isImageFile: (mimeType: string) => boolean;
83
43
  declare const convertToWebP: (file: File, quality?: number) => Promise<File>;
84
44
 
85
- export { ExtendFile, FileUploadProps, _default$8 as HelperText, HelperTextProps, _default$7 as MultiFilePreview, MultiFilePreviewProps, MultiFileUploadProps, MultiImageUploadProps, _default$5 as MultipleFileUpload, _default$4 as MultipleImageUpload, _default$6 as SingleFilePreview, SingleFilePreviewProps, _default$3 as SingleFileUpload, SingleFileUploadProps, _default$2 as SingleImageUpload, SingleImageUploadProps, _default$1 as UploadAvatar, _default as UploadSimpleBox, convertToWebP, isImageFile, useDropzoneUploader, useFileUploadService };
45
+ export { ExtendFile, FileUploadProps, _default$8 as HelperText, HelperTextProps, _default$7 as MultiFilePreview, MultiFilePreviewProps, MultiFileUploadProps, MultiImageUploadProps, _default$5 as MultipleFileUpload, _default$4 as MultipleImageUpload, _default$6 as SingleFilePreview, SingleFilePreviewProps, _default$3 as SingleFileUpload, SingleFileUploadProps, _default$2 as SingleImageUpload, SingleImageUploadProps, _default$1 as UploadAvatar, _default as UploadSimpleBox, UseDropzoneUploaderProps, UseDropzoneUploaderReturn, convertToWebP, isImageFile, useDropzoneUploader, useFileUploadService };
@@ -3,35 +3,35 @@ import { e } from '../../chunk-ANAHA3L6.js';
3
3
  import { a as a$3 } from '../../chunk-IPOTBSM7.js';
4
4
  import { a } from '../../chunk-QYOUZR4G.js';
5
5
  import { f } from '../../chunk-VDUKGO7K.js';
6
- import { a as a$5 } from '../../chunk-XRT3S634.js';
6
+ import { a as a$5 } from '../../chunk-AWS647XK.js';
7
7
  import '../../chunk-335JAEOK.js';
8
- import '../../chunk-DNLTCAWK.js';
9
- import { a as a$2 } from '../../chunk-SERHPCUI.js';
8
+ import '../../chunk-XSYQAWOD.js';
9
+ import { a as a$2 } from '../../chunk-4DCG2MKR.js';
10
10
  import { x } from '../../chunk-2P4CXK3O.js';
11
11
  import { a as a$7 } from '../../chunk-FK7DDO5L.js';
12
- import { j } from '../../chunk-DMQW3LDF.js';
12
+ import { j as j$1 } from '../../chunk-DMQW3LDF.js';
13
13
  import { a as a$6 } from '../../chunk-KRDLTT6B.js';
14
14
  import '../../chunk-RHNLFJOX.js';
15
15
  import '../../chunk-ILHUUK4X.js';
16
16
  import { a as a$1 } from '../../chunk-S7QQBC4I.js';
17
17
  import { a as a$8 } from '../../chunk-ONZBWH3C.js';
18
- import { memo, forwardRef, useState, useLayoutEffect, useMemo, useCallback, useRef, useEffect } from 'react';
19
- import Mo from '@mui/material/FormHelperText';
18
+ import { memo, forwardRef, useMemo, useLayoutEffect, useCallback, useRef, useState, useEffect } from 'react';
19
+ import Ro 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';
22
22
  import { restrictToHorizontalAxis, restrictToParentElement, restrictToWindowEdges } from '@dnd-kit/modifiers';
23
23
  import { useSortable, sortableKeyboardCoordinates, SortableContext, horizontalListSortingStrategy } from '@dnd-kit/sortable';
24
24
  import { m, AnimatePresence } from 'framer-motion';
25
- import ae from '@mui/material/Stack';
26
- import Ge from '@mui/material/Typography';
25
+ import le from '@mui/material/Stack';
26
+ import Ne from '@mui/material/Typography';
27
27
  import xe from '@mui/material/Box';
28
- import Uo from '@mui/material/IconButton';
29
- import ko from '@mui/material/Paper';
28
+ import _o from '@mui/material/IconButton';
29
+ import Oo from '@mui/material/Paper';
30
30
  import { styled, alpha } from '@mui/material/styles';
31
- import Bo from '@mui/material/Badge';
31
+ import Mo from '@mui/material/Badge';
32
32
  import { useDropzone } from 'react-dropzone';
33
33
  import at from '@mui/material/CircularProgress';
34
34
 
35
- var Co=({helperText:e,disabled:t,isError:r})=>e?jsx(Mo,{error:r,sx:a=>({mx:"14px",color:t?a.palette.grey[500]:void 0}),children:e}):null,W=memo(Co);var Fe=styled(ae)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),Re=styled(ae)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),Ke=styled(xe,{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 Je=styled(Uo)(({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}}),Qe=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)"})),Ye=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)"})),eo=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)}})),oo=styled(xe,{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}})),ro=styled(xe)(({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)"}})),to=styled("img",{shouldForwardProp:e=>e!=="aspectRatio"&&e!=="isLoading"&&e!=="isUploading"&&e!=="maxWidth"&&e!=="maxHeight"})(({theme:e,aspectRatio:t,height:r=1,width:a=1,maxWidth:i,maxHeight:l,isLoading:s,isUploading:g})=>({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:i,maxHeight:l,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",...s||g?{opacity:0,filter:"blur(1.5rem)",transform:"translate(-50%, -50%) scale(0.7)"}:{},"&:hover":{transition:"all 0.2s ease-in-out"}})),io=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)"}})),ao=styled(ae)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(ko)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var ze=styled(xe,{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)}})),no=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 so=styled(xe,{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)"}}})),lo=styled("img")({width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover",transition:"all 0.3s ease-in-out"}),po=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 Go=({onRemove:e,sx:t,file:r,disableDrag:a,attributes:i,listeners:l,innerWidth:s,isDragging:g})=>{let d=r?.id||r?.url;return d?jsx(Bo,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(Ye,{width:s,isDragging:g,"data-testid":`preview-multi-img-${d}`,...j().inUp,sx:t,children:[jsx(a$2,{disableDrag:a,...i,...l}),jsx(f,{tooltip:!0,imageView:!0,file:r}),jsx(Re,{sx:{position:"absolute",right:3,top:3,zIndex:1},children:e&&jsx(po,{size:"small",label:"Remover arquivo",onClick:()=>e(r),icon:"DELETE_MARK_BUTTON_02"})})]})},`badge-${d}`):null},co=memo(Go);var Ho=({file:e$1,thumbnail:t,onRemove:r,sx:a$1,disableDrag:i=!1})=>{let l=e$1?.size||0,s=e$1?.name||e$1?.url||e$1?.id,g=e$1?.id||e$1?.url||"",d=typeof e$1=="string",n=i?70:80,{attributes:p,listeners:h,setNodeRef:m,transform:c,transition:v,isDragging:E}=useSortable({id:g,disabled:i}),y={transform:x.Transform.toString(c),transition:v,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${n+8}px`,height:"68px"};return t&&e$1?jsx(Ce,{ref:m,style:y,children:jsx(co,{innerWidth:n,isDragging:E,sx:a$1,file:e$1,disableDrag:i,attributes:p,listeners:h,onRemove:r})}):jsx(Ce,{ref:m,style:{...y,height:"80px",width:`${n+38}px`},children:jsxs(Qe,{width:n+30,isDragging:E,"data-testid":`preview-multi-img-${g}`,...j().inUp,sx:a$1,children:[jsx(a$2,{disableDrag:i,...p,...h}),e$1&&jsx(f,{file:e$1}),jsxs(ae,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$3,{title:s,children:jsx(Ge,{variant:"subtitle2",noWrap:!0,children:s})}),jsx(Ge,{variant:"caption",sx:{color:"text.secondary"},children:d?"":e(l)})]}),jsx(Re,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$1),icon:"DELETE_MARK_BUTTON_02"})})]})})},uo=memo(Ho);var lr=({thumbnail:e,files:t,onRemove:r,onReorder:a,sx:i})=>{let l=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),s=useMemo(()=>t.map((n,p)=>(n.id||(n.id=`${Date.now()}-${p}`),n)),[t]),g=useCallback(n=>{let{active:p,over:h}=n;if(!(!p||!h||p.id===h.id)&&a){let m=s.findIndex(({id:v})=>v===p.id),c=s.findIndex(({id:v})=>v===h.id);m!==-1&&c!==-1&&a(m,c,s);}},[s,a]);if(!s?.length)return null;let d=jsx(AnimatePresence,{initial:!1,children:s.map(n=>jsx(uo,{sx:i,id:`preview-file-${n.id}`,file:n,onRemove:r,thumbnail:e,disableDrag:!a},`preview-file-${n.id}`))});return a?jsx(DndContext,{sensors:l,collisionDetection:closestCenter,onDragEnd:g,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:s.map(n=>n.id),strategy:horizontalListSortingStrategy,children:d})}):d},be=memo(lr);var Po=forwardRef(({onLoading:e,width:t,height:r,...a},i)=>{let[l,s]=useState("calc(100% - 16px)"),[g,d]=useState("calc(100% - 16px)");a$1(()=>{e?.(!0);}),useLayoutEffect(()=>{typeof i=="object"&&i?.current?e?.(!i.current.complete):e?.(!1);},[i,e]);function n(){if(typeof i=="object"&&i?.current&&t&&r){let{width:p,height:h}=i.current.getBoundingClientRect(),m=Number(t)<p?t:p,c=Number(r)<h?r:h;s(`calc(${m}px - 16px)`),d(`calc(${c}px - 16px)`);}e?.(!1);}return jsx(to,{...a,ref:i,maxWidth:l,maxHeight:g,onLoad:n,onError:n})});Po.displayName="LoadingPreviewImage";var bo=Po;var fr=({file:e,aspectRatio:t=1,isUploading:r,isLoading:a,onLoading:i,cropSize:l})=>{let s=useRef(null),g=e?.id||e?.url||e?.name,d=e?.name||e?.url||e?.id,n=e?.url||URL.createObjectURL(e),p=typeof l=="number"?l*t:l?.width,h=typeof l=="number"?l:l?.height,m=useMemo(()=>`image-preview-${g}-${r}`,[g,r]);return g?jsxs(ro,{children:[jsx(bo,{aspectRatio:t,isLoading:a,isUploading:r,height:h,width:p,alt:d,src:n,ref:s,loading:"lazy",onLoading:i},m),jsx(io,{alt:d,src:n,isLoading:a,isUploading:r})]}):null},Ue=memo(fr);var hi=e=>e.startsWith("image/"),ho=(e,t=.8)=>new Promise((r,a)=>{let i=document.createElement("canvas"),l=i.getContext("2d"),s=new Image;s.onload=()=>{i.width=s.width,i.height=s.height,l?(l.drawImage(s,0,0),i.toBlob(g=>{if(g){let d=new File([g],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});r(d);}else a(new Error("Falha ao converter para WebP"));},"image/webp",t)):a(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},s.onerror=()=>a(new Error("Falha ao carregar imagem")),s.src=URL.createObjectURL(e);});var br=({filesToUpload:e$1,onFileSelect:t,onFilesSelect:r,onRemove:a,dropzoneOptions:i,enableCrop:l=!1,customAspectRatio:s,convertToWebp:g=!0,maxFiles:d,cropSize:n})=>{let{showErrorMessage:p}=a$8(),h=useMemo(()=>s||(n&&typeof n!="number"?n.width/n.height:1),[s,n]),[m,c]=useState([]),[v,E]=useState(!1),[y,F]=useState(null),[R,L]=useState(null),[b,f]=useState(""),[x,P]=useState(!1),[u,A]=useState([]),[O,w]=useState(0),_=useMemo(()=>e$1&&Array.isArray(e$1)?e$1.filter(o=>o instanceof File):e$1&&e$1 instanceof File?[e$1]:m,[e$1,m]),C=useMemo(()=>e$1&&Array.isArray(e$1)?null:e$1&&e$1 instanceof File?e$1:m[0]||null,[e$1,m]);useEffect(()=>{e$1&&(Array.isArray(e$1)?c(e$1.filter(o=>o instanceof File)):e$1 instanceof File?c([e$1]):e$1===null&&c([]));},[e$1]);let B=useCallback(()=>{if(u.length>0&&l){let o=u[0];F(o),w(I=>I+1);let D=new FileReader;D.onload=()=>{f(D.result),E(!0);},D.readAsDataURL(o);}},[u,l]);useEffect(()=>{B();},[B]);let U=useCallback((o,D)=>{L(D);},[]),oe=async()=>!y||!R?null:new Promise(o=>{let D=document.createElement("canvas"),I=D.getContext("2d"),j=new Image;j.onload=async()=>{let{width:ue,height:V,x:yo,y:_o}=R,he=ue,ve=V;n&&(typeof n=="number"?(he=n,ve=n/h):(he=n.width,ve=n.height)),D.width=he,D.height=ve,I?(I.drawImage(j,yo,_o,ue,V,0,0,he,ve),D.toBlob(async He=>{if(He){let Me=new File([He],y.name,{type:y.type,lastModified:Date.now()});if(g)try{Me=await ho(Me);}catch(Oo){p(Oo,"Erro ao converter para WebP");}o(Me);}else o(null);},"image/png")):o(null);},j.src=b;}),re=async()=>{if(!(!y||!R)){P(!0);try{let o=await oe();if(o)if(Array.isArray(e$1)||e$1===void 0&&r){let I=d?[..._,o].slice(-d):[..._,o];c(I),r?.(I);}else c([o]),t?.(o);let D=u.slice(1);A(D),E(!1),f(""),F(null),D.length>0&&setTimeout(()=>B(),100);}catch(o){p(o,"Erro ao processar imagem");}finally{P(!1);}}},k=()=>{E(!1),f(""),F(null),A([]),w(0);},G=useCallback(o=>{if(o.length===0)return;if(i?.accept&&Object.keys(i.accept).some(I=>I.includes("image/"))&&l)if(Array.isArray(e$1)||e$1===void 0&&r){let I=o.filter(V=>V.type.startsWith("image/")),j=_.map(V=>V.name),ue=I.filter(V=>!j.includes(V.name));if(ue.length===0){p("Todos os arquivos selecionados j\xE1 foram adicionados","Arquivos duplicados");return}A(ue),w(0);}else {let I=o[0];F(I);let j=new FileReader;j.onload=()=>{f(j.result),E(!0);},j.readAsDataURL(I);}else if(Array.isArray(e$1)||e$1===void 0&&r){let I=d?[..._,...o].slice(-d):[..._,...o];c(I),r?.(I);}else {let I=o[0];c([I]),t?.(I);}},[e$1,_,t,r,l,d,i,p]),H=useCallback(o=>{if(!o.length)return;let D=o[0]?.errors[0]?.code,I=i?.maxSize||3145728;p(D==="file-too-large"?new Error(`O arquivo excede o tamanho m\xE1ximo de ${e(I)}`):D==="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,p]),{getRootProps:N,getInputProps:T,isDragActive:q,isDragReject:ge,fileRejections:te}=useDropzone({onDrop:G,onDropRejected:H,...i}),ne=useCallback(o=>{if(!o){c([]),a?.(void 0);return}if(Array.isArray(e$1)||e$1===void 0&&r){let D=m.filter(I=>I.name!==o.name);c(D),a?.(o),r&&r(D);}else c([]),a?.(o);},[e$1,m,r,a]),se=useCallback(()=>{c([]),Array.isArray(e$1)&&r?r([]):!Array.isArray(e$1)&&t&&t?.(null);},[e$1,r,t]);return {file:C,files:_,aspectRatio:h,dropzoneProps:{getRootProps:N,getInputProps:T,isDragActive:q,isDragReject:ge,fileRejections:te},cropState:{cropModalOpen:v,imagePreview:b,cropLoading:x,setCropModalOpen:E,onCropInitialized:U,handleCropSave:re,handleCropCancel:k,currentImageIndex:O,totalPendingImages:u.length},handleRemove:ne,clearFiles:se,setFiles:c}},Z=br;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||{}),ye=(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))(ye||{});var vr=({createFilesMutation:e,queryFiles:t,fileIds:r,files:a,file:i,skip:l})=>{let{showErrorMessage:s}=a$8(),[g,d]=useState(!1),[n,p]=useState(!1),[h,m]=useState(null),[c,v]=useState(void 0),E=useRef([]),y=useMemo(()=>c?.[0],[c]),F=useMemo(()=>{if(!l)return i?[i]:a},[i,a,l]),R=useCallback(async(f,x)=>{if(!f?.length){x?.append||v(void 0),p(!1);return}try{p(!0);let P=await Promise.all(f.map(async({url:u,name:A,id:O},w)=>{let C=await(await fetch(u)).blob(),B=A||u.split("/").pop()||"image",U=new File([C],B,{type:C.type});return U.id=O,U.url=u,U.index=w,U}));v(u=>{let A=x?.append?[...u||[],...P]:P;return x?.order?x.order.map(O=>A.find(w=>w.id===O)).filter(O=>!!O):A});}catch(P){console.error("Erro ao carregar preview dos arquivos:",P),x?.append||v(void 0);}finally{p(!1);}},[]);useEffect(()=>{(!r?.length||!t)&&(R(void 0),E.current=[]);},[r,t,R]),useEffect(()=>{if(!r?.length||!t)return;let f=r.filter(x=>!E.current.includes(x));if(!f.length){c?.every((P,u)=>P.id===r[u])||v(P=>P&&r.map(u=>P.find(A=>A.id===u)).filter(u=>!!u)),E.current=r;return}t({ids:f}).unwrap().then(({files:x})=>{let P=f.map(u=>x.find(A=>A.id===u)).filter(u=>!!u);R(P,{append:!0,order:r}),E.current=r;});},[r,t,R,c]);let L=n||g;return useEffect(()=>{R(F);},[F,R]),{filesPreview:c,filePreview:y,uploadFiles:async f=>{if(f?.length){d(!0);try{let x=f[0].type||"application/octet-stream",P=ye[x];if(!P)throw new Error(`Tipo de arquivo n\xE3o suportado: ${x}`);let u=await e({files:[{content_type:P,name:f[0].name}]}).unwrap(),A=u.files.map(w=>w.id);return (await Promise.all(f.map(w=>fetch(u.files[0].url,{method:"PUT",headers:{"Content-Type":x},body:w})))).forEach(w=>{if(!w.ok)throw new Error(`Erro no upload: ${w.statusText}`)}),R(u.files),A}catch(x){throw m(x),s(x,"Erro no upload"),x}finally{d(!1);}}},isUploadingFiles:g,isLoadingPreview:n,isUploadOrLoadingFiles:L,uploadFilesError:h}},Ar=vr;var wr=({sx:e,id:t,name:r,tabIndex:a,uploading:i,getRootProps:l,getInputProps:s,isDragActive:g,isError:d,disabled:n,dropZoneSxProps:p,dropZoneContent:h,children:m,...c})=>jsxs(Fe,{children:[i&&jsx(a$7,{"data-testid":"uploading-progress-bar"}),jsxs(xe,{sx:{width:1,position:"relative",...e},children:[jsxs(Ke,{...l(),"data-testid":"drop-zone-styled-area",isError:d,isDragActive:g,disabled:!!n,sx:p,...c,children:[jsx("input",{...s(),id:t,tabIndex:a,name:r}),h]}),m]})]}),J=wr;var Rr=({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$4,{sx:{width:220}}),jsxs("div",{children:[jsx(Ge,{gutterBottom:!0,variant:"h5",children:e||"Soltar ou selecionar arquivos"}),jsx(Ge,{variant:"body2",sx:{color:"text.secondary"},children:t||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(Ge,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),Q=memo(Rr);var Lr=({onRemove:e,onReorder:t,onFilesSelect:r,id:a,disabled:i,error:l,helperText:s,files:g,thumbnail:d,dropZoneSxProps:n,uploading:p,tabIndex:h,maxFiles:m,...c})=>{let{files:v,dropzoneProps:E,handleRemove:y,setFiles:F}=Z({filesToUpload:g,onFilesSelect:r,onRemove:e,dropzoneOptions:{multiple:!0,disabled:i,...c},maxFiles:m}),{getRootProps:R,getInputProps:L,isDragActive:b,isDragReject:f}=E,x=useCallback((A,O)=>{F(w=>{let _=[...w],[C]=_.splice(A,1);return _.splice(O,0,C),t?.(A,O,_),_});},[t,F]),P=!!v?.length,u=f||!!l;return jsxs(J,{id:a,uploading:p,disabled:i,dropZoneSxProps:n,tabIndex:h,getRootProps:R,getInputProps:L,isDragActive:b,isError:u,dropZoneContent:jsx(Q,{}),children:[jsx(W,{disabled:i,helperText:s,isError:u}),P&&jsx(xe,{sx:{my:3},children:jsx(be,{files:v,thumbnail:!!d,onRemove:e?y:void 0,onReorder:t?x:void 0})})]})},Mr=memo(Lr);var Br=({onFilesSelect:e,onRemove:t,onReorder:r,id:a,disabled:i,error:l,helperText:s,files:g,dropZoneSxProps:d,placeholderProps:n,placeholderAlt:p,uploading:h,tabIndex:m,maxFiles:c,aspectRatio:v,enableCrop:E=!0,convertToWebp:y=!0,cropSize:F,name:R,label:L,...b})=>{let{files:f,dropzoneProps:x,cropState:P,handleRemove:u,aspectRatio:A,setFiles:O}=Z({filesToUpload:g,onFilesSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:i,...b},enableCrop:E,customAspectRatio:v,convertToWebp:y,maxFiles:c,cropSize:F}),{getRootProps:w,getInputProps:_,isDragActive:C,isDragReject:B}=x,{cropModalOpen:U,imagePreview:oe,cropLoading:re,onCropInitialized:k,handleCropSave:G,handleCropCancel:H,currentImageIndex:N,totalPendingImages:T}=P,q=useCallback((se,o)=>{O(D=>{let I=[...D],[j]=I.splice(se,1);return I.splice(o,0,j),r?.(se,o,I),I});},[r,O]),ge=!!f?.length,te=B||!!l,ne=useMemo(()=>{let se=L??"Ajustar Imagem",o=T>1?` (${N} de ${T})`:"";return `${se}${o}`},[L,T,N]);return jsxs(J,{id:a,name:R,uploading:h,disabled:i,dropZoneSxProps:d,tabIndex:m,getRootProps:w,getInputProps:_,isDragActive:C,isError:te,dropZoneContent:jsx(Fragment,{children:p?jsx(ae,{children:p}):jsx(Q,{header:n?.header,description:n?.description})}),children:[jsx(W,{disabled:i,helperText:s,isError:te}),ge&&jsx(Fragment,{children:jsx(xe,{sx:{my:3,ml:.5},children:jsx(be,{files:f,thumbnail:!0,onRemove:u,onReorder:r?q:void 0})})}),jsx(a$5,{open:U,onClose:H,label:ne,imageSrc:oe,aspectRatio:A,onInitialized:k,onSave:G,loading:re,cropSize:F})]})},Gr=memo(Br);var Hr=({onFileSelect:e$1,onRemove:t,file:r,id:a,disabled:i,error:l,helperText:s,sx:g,dropZoneSxProps:d,uploading:n,tabIndex:p,...h})=>{let{file:m$1,dropzoneProps:c,handleRemove:v}=Z({filesToUpload:r,onFileSelect:e$1,onRemove:t,dropzoneOptions:{multiple:!1,disabled:i,...h}}),{getRootProps:E,getInputProps:y,isDragActive:F,isDragReject:R}=c,L=useCallback(P=>{P.stopPropagation(),v(m$1||void 0);},[m$1,v]),b=!!m$1,f$1=typeof m$1=="string",x=R||!!l;return jsx(J,{id:a,uploading:n,disabled:i,dropZoneSxProps:d,tabIndex:p,getRootProps:E,getInputProps:y,isDragActive:F,isError:x,dropZoneContent:jsxs(Fragment,{children:[!b&&jsx(Q,{}),b&&jsxs(ae,{component:m.div,...j().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:P=>`solid 1px ${P.palette.divider}`,...g},children:[jsx(f,{file:m$1}),jsxs(ae,{flexGrow:1,sx:{minWidth:0},children:[jsx(Ge,{variant:"subtitle2",noWrap:!0,children:f$1?m$1:m$1.name}),jsx(Ge,{variant:"caption",sx:{color:"text.secondary"},children:f$1?"":e(m$1.size)})]}),t&&jsx(a$3,{title:"Remover arquivo",children:jsx(Je,{edge:"end",size:"small",disabled:i,"aria-label":"Remover arquivo",onClick:L,children:jsx(a$6,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:jsx(W,{disabled:i,helperText:s,isError:x})})},Xr=memo(Hr);var Yr=({onRemove:e,onFileSelect:t,file:r,id:a,disabled:i,error:l,helperText:s,dropZoneSxProps:g,placeholderProps:d,placeholderAlt:n,uploading:p,tabIndex:h,aspectRatio:m,enableCrop:c=!0,convertToWebp:v=!0,name:E,label:y,cropSize:F,...R})=>{let[L,b]=useState(!1),{file:f,dropzoneProps:x,cropState:P,handleRemove:u,aspectRatio:A}=Z({filesToUpload:r,onFileSelect:t,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:i,...R},enableCrop:c,customAspectRatio:m,convertToWebp:v,cropSize:F}),{getRootProps:O,getInputProps:w,isDragActive:_,isDragReject:C}=x,{cropModalOpen:B,imagePreview:U,cropLoading:oe,onCropInitialized:re,handleCropSave:k,handleCropCancel:G}=P,H=useCallback(()=>{u(f||void 0);},[f,u]),N=!!f,T=C||!!l,q=N?{opacity:0}:{opacity:1};return jsxs(Fe,{children:[(p||L)&&jsx(a$7,{}),jsxs(J,{id:a,uploading:p,disabled:i,dropZoneSxProps:g,tabIndex:h,getRootProps:O,getInputProps:w,isDragActive:_,isError:T,name:E,dropZoneContent:jsxs(Fragment,{children:[n?jsx(ae,{sx:q,children:n}):jsx(Q,{sx:q,header:d?.title,description:d?.description}),N&&jsx(Ue,{file:f,cropSize:F,isLoading:L,isUploading:p,onLoading:b,aspectRatio:A})]}),children:[jsx(W,{disabled:i,helperText:s,isError:T}),N&&e&&jsx(eo,{size:"small",onClick:H,disabled:i,label:"Remover arquivo",children:jsx(a$6,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$5,{open:B,onClose:G,label:y??"Ajustar Imagem",imageSrc:U,aspectRatio:A,onInitialized:re,onSave:k,loading:oe,cropSize:F})]})]})},et=memo(Yr);var nt=({onFileSelect:e,onRemove:t,file:r,disabled:a,label:i,id:l,tabIndex:s,error:g,helperText:d,sx:n,name:p,maxSize:h,uploading:m,aspectRatio:c=1,enableCrop:v=!0,convertToWebp:E=!0,cropSize:y,...F})=>{let[R,L]=useState(!1),{file:b,dropzoneProps:f,cropState:x,handleRemove:P}=Z({filesToUpload:r,onFileSelect:e,onRemove:t,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:a,maxSize:h,...F},enableCrop:v,customAspectRatio:c,convertToWebp:E,cropSize:y}),{getRootProps:u,getInputProps:A,isDragActive:O,isDragReject:w}=f,{cropModalOpen:_,imagePreview:C,cropLoading:B,onCropInitialized:U,handleCropSave:oe,handleCropCancel:re}=x,k=w||!!g,G=R||m,H=!!t,N=useRef(""),T=useRef();useEffect(()=>{if(!b){N.current="",T.current=void 0;return}let te=b.id??`${b.name}-${b.size}-${b.lastModified}`;if(T.current===te)return;T.current=te,L(!0);let ne=URL.createObjectURL(b);return N.current=ne,()=>{URL.revokeObjectURL(ne);}},[b]);let q=()=>{L(!1);},ge=()=>H&&b?()=>P(b):u().onClick;return jsxs(Fragment,{children:[jsxs(so,{sx:n,isError:k,isDragActive:O,hasFile:!!b,...u(),onClick:ge(),children:[jsxs(ao,{children:[b&&jsx(lo,{alt:"Avatar Preview",src:N.current,onLoad:q,...G&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),b&&G&&jsx(no,{children:jsx(at,{size:135,thickness:1,color:"primary"})}),!b&&!G&&jsxs(ze,{isError:k,hasFile:!1,children:[jsx(a$6,{icon:"ADD_IMAGE",width:32}),jsx(Ge,{variant:"caption",textAlign:"center",sx:{color:k?"error.main":"text.disabled"},children:"Adicionar foto"})]}),b&&!G&&jsxs(ze,{isError:k,hasFile:!0,children:[jsx(a$6,{icon:H?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(Ge,{variant:"caption",textAlign:"center",sx:{color:k?"error.main":"common.white"},children:H?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:p,id:l,tabIndex:s,...A()}),jsx(ae,{spacing:.5,sx:{pt:1},children:jsx(W,{helperText:d,disabled:a,isError:k})}),b&&!G&&jsx(ae,{direction:"row",justifyContent:"center",spacing:1,sx:{pt:1,mb:-1},children:jsx(Ge,{variant:"caption",component:"span",sx:{px:.75,cursor:"pointer",borderRadius:.75,color:"error.main","&:hover":{color:"error.dark",bgcolor:"background.default"}},onClick:()=>P(b),children:"Remover"})})]}),_&&C&&jsx(a$5,{open:_,onClose:re,label:i??"Ajustar Imagem",imageSrc:C,aspectRatio:c,onInitialized:U,onSave:oe,loading:B,cropSize:y,cropShape:"round"})]})},st=memo(nt);var ct=({error:e,name:t,disabled:r,sx:a,...i})=>{let{getRootProps:l,getInputProps:s,isDragActive:g,isDragReject:d}=useDropzone({disabled:r,...i}),n=d||e;return jsxs(oo,{...l(),isDragActive:g,hasError:!!n,disabled:!!r,sx:a,"data-testid":"upload-box",children:[jsx("input",{name:t,...s()}),"Selecionar arquivo"]})},mt=memo(ct);
35
+ var So=({helperText:e,disabled:o,isError:r})=>e?jsx(Ro,{error:r,sx:i=>({mx:"14px",color:o?i.palette.grey[500]:void 0}),children:e}):null,j=memo(So);var Re=styled(le)({position:"relative",width:"100%",borderRadius:8,overflow:"hidden","&:hover .actions":{display:"flex"}}),Se=styled(le)({position:"absolute",top:4,right:4,gap:.5,"& svg":{width:16,height:16}}),qe=styled(xe,{shouldForwardProp:e=>!["isDragActive","isError","disabled"].includes(e)})(({theme:e,isDragActive:o,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)}`,...o&&{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(le)(({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(_o)(({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(le,{shouldForwardProp:e=>!["isDragging"].includes(e)})(({theme:e,width:o,isDragging:r})=>({width:o,height:100,alignItems:"center",display:"inline-flex",justifyContent:"center",margin:e.spacing(.5),padding:e.spacing(2,1,2,1),gap:e.spacing(1),borderRadius:e.spacing(1.25),overflow:"hidden",position:"relative",border:`solid 1px ${e.palette.divider}`,backgroundColor:e.palette.common.white,zIndex:1,transition:"box-shadow 150ms ease-in-out",boxShadow:r?`0 0 0 2px ${e.palette.primary.main}, ${e.customShadows.z8}, inset 0 0 0 1000px ${alpha(e.palette.primary.main,.06)}`:"0px 0px 0px 0px rgba(0, 0, 0, 0)"})),Je=styled(m.div)(({theme:e,width:o,isDragging:r})=>({width:o,height:60,alignItems:"center",display:"inline-flex",justifyContent:"center",margin:e.spacing(.5),padding:e.spacing(2),borderRadius:e.spacing(1.25),overflow:"hidden",position:"relative",border:`solid 1px ${e.palette.divider}`,backgroundColor:e.palette.common.white,zIndex:1,transition:"box-shadow 150ms ease-in-out",boxShadow:r?`0 0 0 2px ${e.palette.primary.main}, ${e.customShadows.z8}, inset 0 0 0 1000px ${alpha(e.palette.primary.main,.06)}`:"0px 0px 0px 0px rgba(0, 0, 0, 0)"})),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(xe,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="disabled"&&e!=="hasError"})(({theme:e,isDragActive:o,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)}`,...o&&{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(xe)(({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"&&e!=="cropSize"})(({theme:e,aspectRatio:o,maxWidth:r,maxHeight:i,isLoading:t,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,maxWidth:r,maxHeight:i,backgroundColor:e.palette.background.paper,width:o>1?"calc(100% - 16px)":void 0,height:o>1?void 0:"calc(100% - 16px)",aspectRatio:o,transition:"all 0.5s ease-in-out",...t||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:o})=>({width:"100%",height:"100%",objectFit:"cover",top:0,left:0,filter:"blur(1.5rem)",transform:"scale(1.1)",position:"absolute",zIndex:0,transition:"opacity 0.3s ease-in-out",...e&&{opacity:0},...o&&{opacity:.7,filter:"blur(2rem)"}})),to=styled(le)({width:"100%",height:"100%",position:"relative",overflow:"hidden",borderRadius:"50%",justifyContent:"center",alignItems:"center"});styled(Oo)(({theme:e})=>({py:1,px:2,mt:3,textAlign:"left",borderStyle:"dashed",borderColor:"error.main",backgroundColor:alpha(e.palette.error.main,.08)}));var Te=styled(xe,{shouldForwardProp:e=>e!=="isError"&&e!=="hasFile"})(({theme:e,isError:o,hasFile:r})=>({top:0,gap:e.spacing(1),left:0,width:"100%",height:"100%",zIndex:9,display:"flex",borderRadius:"50%",position:"absolute",alignItems:"center",color:e.palette.text.disabled,flexDirection:"column",justifyContent:"center",backgroundColor:alpha(e.palette.grey[500],.08),transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.shorter}),"&:hover":{opacity:.92},...o&&{color:e.palette.error.main},...r&&{zIndex:9,opacity:0,color:e.palette.common.white,backgroundColor:alpha(e.palette.common.black,.54)}})),io=styled(le)({top:0,left:0,right:0,bottom:0,position:"absolute",zIndex:10,alignItems:"center",justifyContent:"center"});styled(le)(({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(xe,{shouldForwardProp:e=>e!=="isDragActive"&&e!=="isError"&&e!=="hasFile"})(({theme:e,isDragActive:o,disabled:r,isError:i,hasFile:t})=>({padding:1,margin:"auto",width:144,height:144,cursor:"pointer",overflow:"hidden",borderRadius:"50%",border:`1px dashed ${alpha(e.palette.grey[500],.2)}`,...o&&{opacity:.72},...r&&{opacity:.48,pointerEvents:"none"},...i&&{borderColor:"error.main"},...t&&{...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:o,file:r,disableDrag:i,attributes:t,listeners:m,innerWidth:s,isDragging:p})=>{let d=r?.id||r?.url;return d?jsx(Mo,{anchorOrigin:{vertical:"top",horizontal:"left"},children:jsxs(Je,{width:s,isDragging:p,"data-testid":`preview-multi-img-${d}`,...j$1().inUp,sx:o,children:[jsx(a$2,{disableDrag:i,...t,...m}),jsx(f,{tooltip:!0,imageView:!0,file:r}),jsx(Se,{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-${d}`):null},lo=memo(To);var Bo=({file:e$1,thumbnail:o,onRemove:r,sx:i,disableDrag:t=!1})=>{let m=e$1?.size||0,s=e$1?.name||e$1?.url||e$1?.id,p=e$1?.id||e$1?.url||"",d=typeof e$1=="string",n=t?70:80,{attributes:g,listeners:x$1,setNodeRef:E,transform:u,transition:b,isDragging:_}=useSortable({id:p,disabled:t}),P={transform:x.Transform.toString(u),transition:b,display:"inline-block",alignItems:"center",justifyContent:"center",width:`${n+8}px`,height:"68px"};return o&&e$1?jsx(Me,{ref:E,style:P,children:jsx(lo,{innerWidth:n,isDragging:_,sx:i,file:e$1,disableDrag:t,attributes:g,listeners:x$1,onRemove:r})}):jsx(Me,{ref:E,style:{...P,height:"80px",width:`${n+38}px`},children:jsxs(Ke,{width:n+30,isDragging:_,"data-testid":`preview-multi-img-${p}`,...j$1().inUp,sx:i,children:[jsx(a$2,{disableDrag:t,...g,...x$1}),e$1&&jsx(f,{file:e$1}),jsxs(le,{flexGrow:1,sx:{width:"100%"},children:[jsx(a$3,{title:s,children:jsx(Ne,{variant:"subtitle2",noWrap:!0,children:s})}),jsx(Ne,{variant:"caption",sx:{color:"text.secondary"},children:d?"":e(m)})]}),jsx(Se,{children:r&&jsx(a,{size:"small",label:"Remover arquivo",onClick:()=>r(e$1),icon:"DELETE_MARK_BUTTON_02"})})]})})},co=memo(Bo);var or=({thumbnail:e,files:o,onRemove:r,onReorder:i,sx:t})=>{let m=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),s=useCallback(d=>{let{active:n,over:g}=d;if(!(!n||!g||n.id===g.id)&&i){let x=o.findIndex(({id:u})=>u===n.id),E=o.findIndex(({id:u})=>u===g.id);x!==-1&&E!==-1&&i(x,E,o);}},[o,i]),p=jsx(AnimatePresence,{initial:!1,children:o.map(d=>jsx(co,{sx:t,id:`preview-file-${d.id}`,file:d,onRemove:r,thumbnail:e,disableDrag:!i},`preview-file-${d.id}`))});return i?jsx(DndContext,{sensors:m,collisionDetection:closestCenter,onDragEnd:s,modifiers:[restrictToHorizontalAxis,restrictToParentElement,restrictToWindowEdges],children:jsx(SortableContext,{items:o.map(d=>d.id),strategy:horizontalListSortingStrategy,children:p})}):p},be=memo(or);var uo=forwardRef(({onLoading:e,aspectRatio:o,cropSize:r,...i},t)=>{let{maxWidth:m,maxHeight:s}=useMemo(()=>r&&typeof r=="object"?{maxWidth:r.width,maxHeight:r.height}:r&&typeof r=="number"?{maxWidth:r,maxHeight:r}:{maxWidth:"100%",maxHeight:"100%"},[r]);a$1(()=>{e?.(!0);}),useLayoutEffect(()=>{typeof t=="object"&&t?.current?e?.(!t.current.complete):e?.(!1);},[t,e]);function p(){e?.(!1);}return jsx(oo,{...i,maxWidth:m,maxHeight:s,ref:t,aspectRatio:o,onLoad:p,onError:p})});uo.displayName="LoadingPreviewImage";var fo=uo;var pr=({file:e,aspectRatio:o=1,isUploading:r,isLoading:i,onLoading:t,cropSize:m,maxWidth:s,maxHeight:p})=>{let d=useRef(null),n=e?.id||e?.url||e?.name,g=e?.name||e?.url||e?.id,x=URL.createObjectURL(e)||e?.url,E=useMemo(()=>`image-preview-${n}`,[n]);return n?jsxs(eo,{className:"single-file-preview-box",children:[jsx(fo,{className:"single-file-preview-img",aspectRatio:o,cropSize:m,isLoading:i,isUploading:r,alt:g,src:x,ref:d,loading:"lazy",onLoading:t,onLoad:()=>t?.(!1),onError:()=>t?.(!1),maxWidth:s,maxHeight:p},E),jsx(ro,{className:"single-file-preview-bg",alt:g,src:x,isLoading:i,isUploading:r})]}):null},Ce=memo(pr);var hi=e=>e.startsWith("image/"),Po=(e,o=.8)=>new Promise((r,i)=>{let t=document.createElement("canvas"),m=t.getContext("2d"),s=new Image;s.onload=()=>{t.width=s.width,t.height=s.height,m?(m.drawImage(s,0,0),t.toBlob(p=>{if(p){let d=new File([p],e.name.replace(/\.[^/.]+$/,".webp"),{type:"image/webp",lastModified:Date.now()});r(d);}else i(new Error("Falha ao converter para WebP"));},"image/webp",o)):i(new Error("N\xE3o foi poss\xEDvel obter contexto do canvas"));},s.onerror=()=>i(new Error("Falha ao carregar imagem")),s.src=URL.createObjectURL(e);});var ur=({onFilesSelect:e$1,onFileSelect:o,onReorder:r,onRemove:i,filesPreview:t,dropzoneOptions:m,enableCrop:s=!1,customAspectRatio:p,convertToWebp:d=!0,cropSize:n,maxFiles:g})=>{let{showErrorMessage:x}=a$8(),E=useMemo(()=>p||(n&&typeof n!="number"?n.width/n.height:1),[p,n]),[u,b]=useState([]),[_,P]=useState(!1),[I,S]=useState(null),[f,F]=useState(null),[l,D]=useState(""),[A,R]=useState(!1),[h,M]=useState([]),[T,H]=useState(0),[X,q]=useState(0),Y=c=>{if(c.length<1)return;let v=c[0];S(v),H(y=>y+1);let O=new FileReader;O.onload=()=>{D(O.result),P(!0);},O.readAsDataURL(v);},ie=(c,v)=>{F(v);},ae=async()=>!I||!f?null:new Promise(c=>{let v=document.createElement("canvas"),O=v.getContext("2d"),y=new Image;y.onload=async()=>{let{width:U,height:he,x:Ao,y:wo}=f,ve=U,Ee=he;n&&(typeof n=="number"?(ve=n,Ee=n/E):(ve=n.width,Ee=n.height)),v.width=ve,v.height=Ee,O?(O.drawImage(y,Ao,wo,U,he,0,0,ve,Ee),v.toBlob(async Ze=>{if(Ze){let Ue=new File([Ze],I.name,{type:I.type,lastModified:Date.now()});if(d)try{Ue=await Po(Ue);}catch(Do){x(Do,"Erro ao converter para WebP");}c(Ue);}else c(null);},"image/png")):c(null);},y.src=l;}),ne=async()=>{if(!(!I||!f)){R(!0);try{let c=await ae();c&&e$1?e$1([c],b):c&&o&&o(c,b),P(!1),R(!1),D(""),S(null);let v=h.slice(1);M(v),Y(v);}catch(c){x(c,"Erro ao processar imagem");}}},z=()=>{P(!1),R(!1),D(""),S(null),M([]),H(0),q(0);},k=c=>{if(c.length===0)return;let v=Object.keys(m?.accept||{}).some(y=>y.includes("image/")),O=u.length+c.length;if(g&&O>g){x(new Error(`M\xE1ximo de ${g} arquivos`),"Erro ao fazer upload");return}if(v&&s){let y=c.filter(U=>U.type.startsWith("image/"));q(y.length),H(0),M(y),Y(y);}else if(e$1)e$1(c,b);else if(o){let y=c[0];o(y,b);}},N=c=>{if(!c.length)return;let v=c[0]?.errors[0]?.code,O=m?.maxSize||3145728;h.length,v==="file-too-large"?x(new Error(`O arquivo excede o tamanho m\xE1ximo de ${e(O)}`),"Erro ao fazer upload"):v==="file-invalid-type"?x(new Error("Formato de arquivo n\xE3o suportado"),"Erro ao fainternalFiles.length > 0zer upload"):x(c[0]?.errors[0]||new Error("Erro ao enviar arquivo"),"Erro ao fazer upload");},{getRootProps:B,getInputProps:V,isDragActive:ee,isDragReject:G,fileRejections:W}=useDropzone({onDrop:k,onDropRejected:N,...m}),K=c=>{if(!c){b([]),i?.(void 0);return}if(e$1){let v=u.filter(O=>O.id!==c.id);b(v),i?.(c);}else b([]),i?.(c);},a=(c,v,O)=>{b(y=>{let U=[...y],[he]=U.splice(c,1);return U.splice(v,0,he),r?.(c,v,O),U});};return useEffect(()=>{let c=t||[];b(v=>{let O=JSON.stringify(v?.map(U=>U.id||U.name)),y=JSON.stringify(c?.map(U=>U.id||U.name));return O===y?v:c});},[t]),{file:u?.[0],files:u,aspectRatio:E,dropzoneProps:{getRootProps:B,getInputProps:V,isDragActive:ee,isDragReject:G,fileRejections:W},cropState:{cropModalOpen:_,imagePreview:l,cropLoading:A,setCropModalOpen:P,onCropInitialized:ie,handleCropSave:ne,handleCropCancel:z,currentImageIndex:T,totalPendingImages:X},setInitialFiles:b,handleRemove:K,handleReorder:a}},Z=ur;var ze=(a=>(a.APPLICATION_OCTET_STREAM="application/octet-stream",a.IMAGE_JPEG="image/jpeg",a.IMAGE_JPG="image/jpg",a.IMAGE_PNG="image/png",a.IMAGE_GIF="image/gif",a.IMAGE_WEBP="image/webp",a.IMAGE_SVG="image/svg+xml",a.IMAGE_BMP="image/bmp",a.IMAGE_TIFF="image/tiff",a.IMAGE_ICO="image/x-icon",a.IMAGE_AVIF="image/avif",a.APPLICATION_PDF="application/pdf",a.TEXT_PLAIN="text/plain",a.TEXT_CSV="text/csv",a.APPLICATION_RTF="application/rtf",a.APPLICATION_MSWORD="application/msword",a.APPLICATION_DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",a.APPLICATION_MSEXCEL="application/vnd.ms-excel",a.APPLICATION_XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",a.APPLICATION_MSPOWERPOINT="application/vnd.ms-powerpoint",a.APPLICATION_PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",a.APPLICATION_ODT="application/vnd.oasis.opendocument.text",a.APPLICATION_ODS="application/vnd.oasis.opendocument.spreadsheet",a.APPLICATION_ODP="application/vnd.oasis.opendocument.presentation",a.APPLICATION_XML="application/xml",a.TEXT_XML="text/xml",a.TEXT_HTML="text/html",a.TEXT_CSS="text/css",a.APPLICATION_JSON="application/json",a.TEXT_JAVASCRIPT="text/javascript",a.APPLICATION_ZIP="application/zip",a.APPLICATION_GZIP="application/gzip",a.APPLICATION_RAR="application/vnd.rar",a.APPLICATION_7Z="application/x-7z-compressed",a.AUDIO_MPEG="audio/mpeg",a.AUDIO_WAV="audio/wav",a.AUDIO_OGG="audio/ogg",a.AUDIO_WEBM="audio/webm",a.AUDIO_AAC="audio/aac",a.VIDEO_MP4="video/mp4",a.VIDEO_MPEG="video/mpeg",a.VIDEO_OGG="video/ogg",a.VIDEO_WEBM="video/webm",a.VIDEO_QUICKTIME="video/quicktime",a))(ze||{}),_e=(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))(_e||{});var Ir=({createFilesMutation:e,filesUrl:o})=>{let{showErrorMessage:r}=a$8(),[i,t]=useState(!1),[m,s]=useState(!1),[p,d]=useState(null),[n,g]=useState(),x=useMemo(()=>n?.[0],[n]),E=m||i,u=useCallback(async P=>{if(!P?.length){g(void 0),s(!1);return}s(!0);try{let S=(await Promise.all(P.map(async(f,F)=>{try{if(!o[F])return null;let l=await fetch(o[F]);if(!l.ok)throw new Error(l.statusText);let D=await l.blob(),A=new File([D],f,{type:D.type});return A.id=f,A.url=URL.createObjectURL(A),A.index=F,A}catch{return null}}))).filter(f=>f!==null);g(S);}catch(I){r(I,"Erro ao carregar preview dos arquivos"),g(void 0);}finally{s(!1);}},[o,r]),b=useRef("");return useEffect(()=>{let P=JSON.stringify(o||[]);if(P===b.current)return;b.current=P;let I=!1;return (async()=>{if(o.length){let f=o.filter(Boolean);if(await u(f),I)return}else g(void 0),s(!1);})(),()=>{I=!0;}},[o,u]),{filesPreview:n,filePreview:x,uploadFiles:async(P,I)=>{if(P.filter(f=>f instanceof File)?.length){t(!0);try{let f=P[0].type||"application/octet-stream",F=_e[f];if(!F)throw new Error(`Tipo de arquivo n\xE3o suportado: ${f}`);let l=await e({files:P.map(h=>({content_type:F,name:h.name}))}).unwrap(),D=l.files.map(h=>h.id),A=[];return (await Promise.all(l.files.map((h,M)=>{let T=P[M];return T.id=h.id,T.url=URL.createObjectURL(T),A.push(T),fetch(h.url,{method:"PUT",headers:{"Content-Type":f},body:T})}))).forEach(h=>{if(!h.ok)throw new Error(`Erro no upload: ${h.statusText}`)}),I?.(A),D}catch(f){throw d(f),r(f,"Erro no upload"),f}finally{t(!1);}}},setFilesPreview:g,isUploadingFiles:i,isLoadingPreview:m,isUploadOrLoadingFiles:E,uploadFilesError:p}},hr=Ir;var Er=({sx:e,id:o,name:r,tabIndex:i,uploading:t,getRootProps:m,getInputProps:s,isDragActive:p,isError:d,disabled:n,dropZoneSxProps:g,dropZoneContent:x,children:E,...u})=>jsxs(Re,{children:[t&&jsx(a$7,{"data-testid":"uploading-progress-bar",sx:{zIndex:1}}),jsxs(xe,{sx:{width:1,position:"relative",...e},children:[jsxs(qe,{...m(),"data-testid":"drop-zone-styled-area",isError:d,isDragActive:p,disabled:!!n,sx:g,...u,children:[jsx("input",{...s(),id:o,tabIndex:i,name:r}),x]}),E]})]}),oe=Er;var Dr=({header:e,description:o,sx:r,...i})=>jsxs(le,{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(Ne,{gutterBottom:!0,variant:"h5",children:e||"Soltar ou selecionar arquivos"}),jsx(Ne,{variant:"body2",sx:{color:"text.secondary"},children:o||jsxs(Fragment,{children:["Solte os arquivos aqui ou clique",jsx(Ne,{variant:"body2",component:"span",sx:{mx:.5,color:"primary.main",textDecoration:"underline"},children:"procurar"}),"na sua m\xE1quina"]})})]})]}),re=memo(Dr);var _r=({onRemove:e,onReorder:o,onFilesSelect:r,id:i,disabled:t,error:m,helperText:s,files:p,thumbnail:d,dropZoneSxProps:n,uploading:g,tabIndex:x,maxFiles:E,placeholderAlt:u,placeholderProps:b,..._})=>{let{files:P,dropzoneProps:I,handleRemove:S,handleReorder:f}=Z({onFilesSelect:r,onReorder:o,onRemove:e,filesPreview:p,dropzoneOptions:{multiple:!0,disabled:t,..._},maxFiles:E}),{getRootProps:F,getInputProps:l,isDragActive:D,isDragReject:A}=I,R=!!P?.filter(M=>!!M.id).length,h=A||!!m;return jsxs(oe,{id:i,uploading:g,disabled:t,dropZoneSxProps:n,tabIndex:x,getRootProps:F,getInputProps:l,isDragActive:D,isError:h,dropZoneContent:jsx(Fragment,{children:u?jsx(le,{children:u}):jsx(re,{header:b?.header,description:b?.description})}),children:[jsx(j,{disabled:t,helperText:s,isError:h}),R&&jsx(xe,{sx:{my:3},children:jsx(be,{files:P,thumbnail:!!d,onRemove:e?S:void 0,onReorder:o?f:void 0})})]})},Or=memo(_r);var kr=({onFilesSelect:e,onRemove:o,onReorder:r,id:i,disabled:t,error:m,helperText:s,files:p,dropZoneSxProps:d,placeholderProps:n,placeholderAlt:g,uploading:x,tabIndex:E,maxFiles:u,aspectRatio:b,enableCrop:_=!0,convertToWebp:P=!0,cropSize:I,name:S,label:f,...F})=>{let{files:l,dropzoneProps:D,cropState:A,aspectRatio:R,handleRemove:h,handleReorder:M}=Z({onFilesSelect:e,onReorder:r,onRemove:o,filesPreview:p,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!0,disabled:t,...F},enableCrop:_,customAspectRatio:b,convertToWebp:P,maxFiles:u,cropSize:I,uploading:x}),{getRootProps:T,getInputProps:H,isDragActive:X,isDragReject:q}=D,{cropModalOpen:Y,imagePreview:ie,cropLoading:ae,onCropInitialized:ne,handleCropSave:z,handleCropCancel:k,currentImageIndex:N,totalPendingImages:B}=A,V=!!l?.filter(W=>!!W.id).length,ee=q||!!m,G=useMemo(()=>{let W=f??"Ajustar Imagem",K=B>1||N>1?` (${N} de ${B})`:"";return `${W}${K}`},[f,B,N]);return jsxs(oe,{id:i,name:S,uploading:x,disabled:t,dropZoneSxProps:d,tabIndex:E,getRootProps:T,getInputProps:H,isDragActive:X,isError:ee,dropZoneContent:jsx(Fragment,{children:g?jsx(le,{children:g}):jsx(re,{header:n?.header,description:n?.description})}),children:[jsx(j,{disabled:t,helperText:s,isError:ee}),V&&jsx(xe,{sx:{my:3,ml:.5},children:jsx(be,{files:l,thumbnail:!0,onRemove:h,onReorder:r?M:void 0})}),jsx(a$5,{open:Y,onClose:k,label:G,imageSrc:ie,aspectRatio:R,onInitialized:ne,onSave:z,loading:ae,cropSize:I})]})},Nr=memo(kr);var Hr=({onFileSelect:e$1,onRemove:o,file:r,id:i,disabled:t,error:m$1,helperText:s,sx:p,dropZoneSxProps:d,uploading:n,tabIndex:g,...x})=>{let E=r?[r]:[],{file:u,dropzoneProps:b,handleRemove:_}=Z({onFileSelect:e$1,onRemove:o,filesPreview:E,dropzoneOptions:{multiple:!1,disabled:t,...x}}),{getRootProps:P,getInputProps:I,isDragActive:S,isDragReject:f$1}=b,F=useCallback(R=>{R.stopPropagation(),_(u||void 0);},[u,_]),l=!!u,D=typeof u=="string",A=f$1||!!m$1;return jsx(oe,{id:i,uploading:n,disabled:t,dropZoneSxProps:d,tabIndex:g,getRootProps:P,getInputProps:I,isDragActive:S,isError:A,dropZoneContent:jsxs(Fragment,{children:[!l&&jsx(re,{}),l&&jsxs(le,{component:m.div,...j$1().inUp,spacing:2,direction:"row",alignItems:"center",sx:{my:1,px:1,py:.75,borderRadius:.75,border:R=>`solid 1px ${R.palette.divider}`,...p},children:[jsx(f,{file:u}),jsxs(le,{flexGrow:1,sx:{minWidth:0},children:[jsx(Ne,{variant:"subtitle2",noWrap:!0,children:D?u:u.name}),jsx(Ne,{variant:"caption",sx:{color:"text.secondary"},children:D?"":e(u.size)})]}),o&&jsx(a$3,{title:"Remover arquivo",children:jsx(Ve,{edge:"end",size:"small",disabled:t,"aria-label":"Remover arquivo",onClick:F,children:jsx(a$6,{icon:"DELETE_MARK_BUTTON_02",width:16})})})]})]}),children:jsx(j,{disabled:t,helperText:s,isError:A})})},$r=memo(Hr);var Yr=({onRemove:e,onFileSelect:o,file:r,id:i,disabled:t,error:m,helperText:s,dropZoneSxProps:p,placeholderProps:d,placeholderAlt:n,uploading:g,tabIndex:x,aspectRatio:E,enableCrop:u=!0,convertToWebp:b=!0,name:_,label:P,cropSize:I,sx:S,maxWidth:f,maxHeight:F,...l})=>{let D=r?[r]:[],[A,R]=useState(!1),{file:h,dropzoneProps:M,cropState:T,handleRemove:H,aspectRatio:X}=Z({onFileSelect:o,onRemove:e,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:t,...l},filesPreview:D,enableCrop:u,customAspectRatio:E,convertToWebp:b,cropSize:I}),{getRootProps:q,getInputProps:Y,isDragActive:ie,isDragReject:ae}=M,{cropModalOpen:ne,imagePreview:z,cropLoading:k,onCropInitialized:N,handleCropSave:B,handleCropCancel:V}=T,ee=useCallback(()=>{H(h||void 0);},[h,H]),G=!!h,W=ae||!!m,K=G?{opacity:0}:{opacity:1},a=p?.width;return useEffect(()=>{G||R(!1);},[G]),jsxs(Re,{sx:{...S,...a&&{width:a}},children:[(g||A)&&jsx(a$7,{}),jsxs(oe,{id:i,uploading:g,disabled:t,dropZoneSxProps:p,tabIndex:x,getRootProps:q,getInputProps:Y,isDragActive:ie,isError:W,name:_,dropZoneContent:jsxs(Fragment,{children:[n?jsx(le,{sx:K,children:n}):jsx(re,{sx:K,header:d?.title,description:d?.description}),G&&jsx(Ce,{file:h,cropSize:I,isLoading:A,isUploading:g,onLoading:R,aspectRatio:X,maxWidth:f,maxHeight:F})]}),children:[jsx(j,{disabled:t,helperText:s,isError:W}),G&&e&&jsx(Qe,{size:"small",onClick:ee,disabled:t,label:"Remover arquivo",children:jsx(a$6,{icon:"DELETE_MARK_BUTTON_02",width:16})}),jsx(a$5,{open:ne,onClose:V,label:P??"Ajustar Imagem",imageSrc:z,aspectRatio:X,onInitialized:N,onSave:B,loading:k,cropSize:I})]})]})},et=memo(Yr);var nt=({onFileSelect:e,onRemove:o,file:r,disabled:i,label:t,id:m,tabIndex:s,error:p,helperText:d,sx:n,name:g,maxSize:x,uploading:E,aspectRatio:u=1,enableCrop:b=!0,convertToWebp:_=!0,cropSize:P,...I})=>{let[S,f]=useState(!1),F=r?[r]:[],{file:l,dropzoneProps:D,cropState:A,handleRemove:R}=Z({filesPreview:F,onFileSelect:e,onRemove:o,dropzoneOptions:{accept:{"image/*":[".jpeg",".jpg",".png",".gif",".webp"]},multiple:!1,disabled:i,maxSize:x,...I},enableCrop:b,customAspectRatio:u,convertToWebp:_,cropSize:P}),{getRootProps:h,getInputProps:M,isDragActive:T,isDragReject:H}=D,{cropModalOpen:X,imagePreview:q,cropLoading:Y,onCropInitialized:ie,handleCropSave:ae,handleCropCancel:ne}=A,z=H||!!p,k=S||E,N=!!o,B=useRef(""),V=useRef();useEffect(()=>{if(!l){B.current="",V.current=void 0;return}let W=l.id??`${l.name}-${l.size}-${l.lastModified}`;if(V.current===W)return;V.current=W,f(!0);let K=URL.createObjectURL(l);return B.current=K,()=>{URL.revokeObjectURL(K);}},[l]);let ee=()=>{f(!1);},G=()=>N&&l?()=>R(l):h().onClick;return jsxs(Fragment,{children:[jsxs(ao,{sx:n,isError:z,isDragActive:T,hasFile:!!l,...h(),onClick:G(),children:[jsxs(to,{children:[l&&jsx(no,{alt:"Avatar Preview",src:B.current,onLoad:ee,...k&&{sx:{filter:"blur(5px) !important",scale:1.2,opacity:.7}}}),l&&k&&jsx(io,{children:jsx(at,{size:135,thickness:1,color:"primary"})}),!l&&!k&&jsxs(Te,{isError:z,hasFile:!1,children:[jsx(a$6,{icon:"ADD_IMAGE",width:32}),jsx(Ne,{variant:"caption",textAlign:"center",sx:{color:z?"error.main":"text.disabled"},children:"Adicionar foto"})]}),l&&!k&&jsxs(Te,{isError:z,hasFile:!0,children:[jsx(a$6,{icon:N?"DELETE_MARK_BUTTON_02":"ADD_IMAGE",width:32}),jsx(Ne,{variant:"caption",textAlign:"center",sx:{color:z?"error.main":"common.white"},children:N?"Remover foto":"Alterar foto"})]})]}),jsx("input",{name:g,id:m,tabIndex:s,...M()}),jsx(le,{spacing:.5,sx:{pt:1},children:jsx(j,{helperText:d,disabled:i,isError:z})}),l&&!k&&jsx(le,{direction:"row",justifyContent:"center",spacing:1,sx:{pt:1,mb:-1},children:jsx(Ne,{variant:"caption",component:"span",sx:{px:.75,cursor:"pointer",borderRadius:.75,color:"error.main","&:hover":{color:"error.dark",bgcolor:"background.default"}},onClick:()=>R(l),children:"Remover"})})]}),X&&q&&jsx(a$5,{open:X,onClose:ne,label:t??"Ajustar Imagem",imageSrc:q,aspectRatio:u,onInitialized:ie,onSave:ae,loading:Y,cropSize:P,cropShape:"round"})]})},st=memo(nt);var mt=({error:e,name:o,disabled:r,sx:i,...t})=>{let{getRootProps:m,getInputProps:s,isDragActive:p,isDragReject:d}=useDropzone({disabled:r,...t}),n=d||e;return jsxs(Ye,{...m(),isDragActive:p,hasError:!!n,disabled:!!r,sx:i,"data-testid":"upload-box",children:[jsx("input",{name:o,...s()}),"Selecionar arquivo"]})},ct=memo(mt);
36
36
 
37
- export { Ne as ContentType, ye as FileContentType, W as HelperText, be as MultiFilePreview, Mr as MultipleFileUpload, Gr as MultipleImageUpload, Ue as SingleFilePreview, Xr as SingleFileUpload, et as SingleImageUpload, st as UploadAvatar, mt as UploadSimpleBox, ho as convertToWebP, hi as isImageFile, Z as useDropzoneUploader, Ar as useFileUploadService };
37
+ export { ze as ContentType, _e as FileContentType, j as HelperText, be as MultiFilePreview, Or as MultipleFileUpload, Nr as MultipleImageUpload, Ce as SingleFilePreview, $r as SingleFileUpload, et as SingleImageUpload, st as UploadAvatar, ct as UploadSimpleBox, Po as convertToWebP, hi as isImageFile, Z as useDropzoneUploader, hr as useFileUploadService };
@@ -1,5 +1,5 @@
1
1
  import { a as a$1 } from '../../../chunk-2NMLQNWC.js';
2
- import { a as a$2 } from '../../../chunk-M4APIAYD.js';
2
+ import { a as a$2 } from '../../../chunk-PXDNVNBO.js';
3
3
  import { a as a$3 } from '../../../chunk-IAUEQ5ZQ.js';
4
4
  import '../../../chunk-ORLVNXTG.js';
5
5
  import '../../../chunk-P5CQYMD2.js';
@@ -1 +1 @@
1
- export { a as default } from '../../../chunk-M4APIAYD.js';
1
+ export { a as default } from '../../../chunk-PXDNVNBO.js';
@@ -1,4 +1,4 @@
1
- import { a } from '../../../chunk-M4APIAYD.js';
1
+ import { a } from '../../../chunk-PXDNVNBO.js';
2
2
  import { d } from '../../../chunk-KOELUX3V.js';
3
3
  import { a as a$1 } from '../../../chunk-KRDLTT6B.js';
4
4
  import '../../../chunk-RHNLFJOX.js';
@@ -1,11 +1,11 @@
1
- import { e } from '../../../chunk-VS6FCARX.js';
1
+ import { e } from '../../../chunk-EIOOIGOV.js';
2
2
  import '../../../chunk-4VAXJ4XM.js';
3
3
  import '../../../chunk-C63Z77ED.js';
4
4
  import '../../../chunk-T7I256S6.js';
5
5
  import '../../../chunk-H5L4ARDB.js';
6
6
  import '../../../chunk-ANAHA3L6.js';
7
7
  import '../../../chunk-335JAEOK.js';
8
- import '../../../chunk-SERHPCUI.js';
8
+ import '../../../chunk-4DCG2MKR.js';
9
9
  import '../../../chunk-2P4CXK3O.js';
10
10
  import '../../../chunk-FK7DDO5L.js';
11
11
  import '../../../chunk-D27ND54J.js';
@@ -1,4 +1,4 @@
1
- import { a } from '../../../chunk-M4APIAYD.js';
1
+ import { a } from '../../../chunk-PXDNVNBO.js';
2
2
  import { a as a$2 } from '../../../chunk-IAUEQ5ZQ.js';
3
3
  import { a as a$3 } from '../../../chunk-YLXSO2U5.js';
4
4
  import '../../../chunk-P5CQYMD2.js';
@@ -1,5 +1,5 @@
1
1
  export { a as UploadAvatar, b as UploadAvatarWithCrop } from '../../chunk-U2GP3HDI.js';
2
- export { c as DeleteButton, a as MultiFilePreview, b as SingleFilePreview, d as Upload, e as UploadWithCrop } from '../../chunk-VS6FCARX.js';
2
+ export { c as DeleteButton, a as MultiFilePreview, b as SingleFilePreview, d as Upload, e as UploadWithCrop } from '../../chunk-EIOOIGOV.js';
3
3
  import { o } from '../../chunk-4VAXJ4XM.js';
4
4
  export { p as RejectionFiles } from '../../chunk-4VAXJ4XM.js';
5
5
  import '../../chunk-C63Z77ED.js';
@@ -7,7 +7,7 @@ import '../../chunk-T7I256S6.js';
7
7
  import '../../chunk-H5L4ARDB.js';
8
8
  import '../../chunk-ANAHA3L6.js';
9
9
  import '../../chunk-335JAEOK.js';
10
- import '../../chunk-SERHPCUI.js';
10
+ import '../../chunk-4DCG2MKR.js';
11
11
  import '../../chunk-2P4CXK3O.js';
12
12
  import '../../chunk-FK7DDO5L.js';
13
13
  import '../../chunk-D27ND54J.js';
@@ -1,6 +1,7 @@
1
1
  import { StackProps } from '@mui/material/Stack';
2
2
  import { SxProps, Theme } from '@mui/material/styles';
3
- import { DropzoneOptions, DropzoneRootProps, FileRejection, DropzoneInputProps } from 'react-dropzone';
3
+ import { DropzoneOptions, DropzoneRootProps, FileRejection, DropzoneInputProps, useDropzone } from 'react-dropzone';
4
+ import { Area } from 'react-easy-crop';
4
5
  import { DraggableAttributes, DraggableSyntheticListeners } from '@dnd-kit/core';
5
6
 
6
7
  interface ExtendFile extends File {
@@ -78,11 +79,11 @@ interface SingleFilePreviewProps extends StackProps {
78
79
  cropSize?: CropSize;
79
80
  onLoading?: (isLoading: boolean) => void;
80
81
  isUploading?: boolean;
82
+ maxWidth?: number;
83
+ maxHeight?: number;
81
84
  }
82
85
  interface LoadingPreviewImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
83
86
  aspectRatio: number;
84
- height?: number | string;
85
- width?: number | string;
86
87
  maxWidth?: number | string;
87
88
  maxHeight?: number | string;
88
89
  isLoading?: boolean;
@@ -98,7 +99,7 @@ interface PlaceholderProps extends StackProps {
98
99
  description?: React.ReactNode;
99
100
  }
100
101
  interface SingleFileUploadProps extends DropzoneOptions {
101
- onFileSelect: (file?: ExtendFile) => void;
102
+ onFileSelect: (file: ExtendFile, callback: (files: ExtendFile[]) => void) => void;
102
103
  onRemove?: (file?: ExtendFile) => void;
103
104
  placeholderProps?: PlaceholderProps;
104
105
  placeholderAlt?: React.ReactNode;
@@ -110,7 +111,7 @@ interface SingleFileUploadProps extends DropzoneOptions {
110
111
  error?: string;
111
112
  helperText?: string | React.ReactNode;
112
113
  sx?: SxProps<Theme>;
113
- dropZoneSxProps?: SxProps;
114
+ dropZoneSxProps?: SxProps<Theme>;
114
115
  uploading?: boolean;
115
116
  tabIndex?: number;
116
117
  maxSize?: number;
@@ -120,11 +121,13 @@ interface SingleImageUploadProps extends SingleFileUploadProps {
120
121
  enableCrop?: boolean;
121
122
  convertToWebp?: boolean;
122
123
  cropSize?: CropSize;
124
+ maxWidth?: number;
125
+ maxHeight?: number;
123
126
  }
124
127
  interface MultiFileUploadProps extends Omit<SingleFileUploadProps, 'file' | 'onFileSelect'> {
125
- onFilesSelect: (files?: ExtendFile[]) => void;
126
- onRemoveAll?: (files?: ExtendFile[]) => void;
127
- onReorder?: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
128
+ onFilesSelect: (files: File[], callback?: (files: ExtendFile[]) => void) => void;
129
+ onRemoveAll?: (files?: File | ExtendFile[]) => void;
130
+ onReorder?: (oldIndex: number, newIndex: number, files: File | ExtendFile[]) => void;
128
131
  files?: ExtendFile[];
129
132
  maxFiles?: number;
130
133
  thumbnail?: boolean;
@@ -134,6 +137,8 @@ interface MultiImageUploadProps extends MultiFileUploadProps {
134
137
  enableCrop?: boolean;
135
138
  convertToWebp?: boolean;
136
139
  cropSize?: CropSize;
140
+ maxWidth?: number;
141
+ maxHeight?: number;
137
142
  }
138
143
  interface SortableItemProps extends StackProps {
139
144
  onRemove?: (file?: ExtendFile) => void;
@@ -181,7 +186,7 @@ interface DropZoneProps {
181
186
  isDragActive: boolean;
182
187
  isError: boolean;
183
188
  disabled?: boolean;
184
- dropZoneSxProps?: SxProps;
189
+ dropZoneSxProps?: SxProps<Theme>;
185
190
  dropZoneContent?: React.ReactNode;
186
191
  children?: React.ReactNode;
187
192
  name?: string;
@@ -190,19 +195,56 @@ interface FileUploadProps {
190
195
  createFilesMutation: (params: FileCreateRequest) => {
191
196
  unwrap: () => Promise<FileCreateResponse>;
192
197
  };
193
- queryFiles?: (params: FileQueryRequest) => {
194
- unwrap: () => Promise<FileQueryResponse>;
195
- };
196
- fileIds?: string[];
197
- files?: FileGetResponse[];
198
- file?: FileGetResponse;
199
- skip?: boolean;
198
+ filesUrl: Array<string | undefined>;
200
199
  }
201
200
  interface HelperTextProps {
202
201
  helperText?: string | React.ReactNode;
203
202
  disabled?: boolean;
204
203
  isError?: boolean;
205
204
  }
205
+ interface UseDropzoneUploaderProps {
206
+ onReorder?: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
207
+ onFileSelect?: (file: File, callback: (files: ExtendFile[]) => void) => void;
208
+ onFilesSelect?: (files: File[], callback: (files: ExtendFile[]) => void) => void;
209
+ onRemove?: (file?: ExtendFile) => void;
210
+ filesPreview?: ExtendFile[];
211
+ dropzoneOptions?: Omit<DropzoneOptions, 'onDrop' | 'onDropRejected'>;
212
+ enableCrop?: boolean;
213
+ customAspectRatio?: number;
214
+ convertToWebp?: boolean;
215
+ maxFiles?: number;
216
+ cropSize?: {
217
+ width: number;
218
+ height: number;
219
+ } | number;
220
+ uploading?: boolean;
221
+ }
222
+ interface UseDropzoneUploaderReturn {
223
+ file: ExtendFile | null;
224
+ files: ExtendFile[];
225
+ aspectRatio: number;
226
+ dropzoneProps: {
227
+ getRootProps: ReturnType<typeof useDropzone>['getRootProps'];
228
+ getInputProps: ReturnType<typeof useDropzone>['getInputProps'];
229
+ isDragActive: boolean;
230
+ isDragReject: boolean;
231
+ fileRejections: readonly FileRejection[];
232
+ };
233
+ cropState: {
234
+ cropModalOpen: boolean;
235
+ imagePreview: string;
236
+ cropLoading: boolean;
237
+ setCropModalOpen: React.Dispatch<React.SetStateAction<boolean>>;
238
+ onCropInitialized: (croppedArea: Area, croppedAreaPixels: Area) => void;
239
+ handleCropSave: () => Promise<void>;
240
+ handleCropCancel: () => void;
241
+ currentImageIndex: number;
242
+ totalPendingImages: number;
243
+ };
244
+ setInitialFiles?: (files: ExtendFile[]) => void;
245
+ handleRemove: (fileToRemove?: ExtendFile) => void;
246
+ handleReorder: (oldIndex: number, newIndex: number, files: ExtendFile[]) => void;
247
+ }
206
248
  declare enum ContentType {
207
249
  APPLICATION_OCTET_STREAM = "application/octet-stream",
208
250
  IMAGE_JPEG = "image/jpeg",
@@ -311,4 +353,4 @@ type FileThumbnailProps = StackProps & {
311
353
  };
312
354
  };
313
355
 
314
- export { ContentType as C, DropZoneProps as D, ExtendFile as E, FileThumbnailProps as F, HelperTextProps as H, LoadingPreviewImageProps as L, MultiFilePreviewProps as M, PlaceholderProps as P, RejectionFilesProps as R, SingleFilePreviewProps as S, ThumbnailBadgeProps as T, FileUploadProps as a, MultiFileUploadProps as b, MultiImageUploadProps as c, SingleFileUploadProps as d, SingleImageUploadProps as e, FileContentType as f, FileUpload as g, CropSize as h, CreateFilesMutation as i, FileCreateRequest as j, FileCreateResponse as k, FileQueryRequest as l, FileQueryResponse as m, FileGetResponse as n, SortableItemProps as o, StyledDropZoneProps as p, StyledDropZonePropsType as q };
356
+ export { ContentType as C, DropZoneProps as D, ExtendFile as E, FileThumbnailProps as F, HelperTextProps as H, LoadingPreviewImageProps as L, MultiFilePreviewProps as M, PlaceholderProps as P, RejectionFilesProps as R, SingleFilePreviewProps as S, ThumbnailBadgeProps as T, UseDropzoneUploaderProps as U, UseDropzoneUploaderReturn as a, FileUploadProps as b, MultiFileUploadProps as c, MultiImageUploadProps as d, SingleFileUploadProps as e, SingleImageUploadProps as f, FileContentType as g, FileUpload as h, CropSize as i, CreateFilesMutation as j, FileCreateRequest as k, FileCreateResponse as l, FileQueryRequest as m, FileQueryResponse as n, FileGetResponse as o, SortableItemProps as p, StyledDropZoneProps as q, StyledDropZonePropsType as r };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.4.73",
3
+ "version": "2.4.74",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -1,9 +0,0 @@
1
- import { useMemo } from 'react';
2
- import P from 'react-easy-crop';
3
- import E from '@mui/material/Stack';
4
- import { styled, alpha } from '@mui/material/styles';
5
- import { jsx } from 'react/jsx-runtime';
6
-
7
- var s=styled(E)(({theme:r})=>({"& .reactEasyCrop_Container":{position:"relative"},"& .reactEasyCrop_CropArea":{border:`2px solid ${r.palette.primary.main}`,borderColor:alpha(r.palette.primary.main,.75)},"& .reactEasyCrop_CropAreaRound":{border:`2px solid ${r.palette.primary.main}`,borderColor:alpha(r.palette.primary.main,.75)}}));var W=({onInitialized:r,aspectRatio:e=1,imageSrc:C="",zoom:c=1,crop:h,cropShape:d="rect",cropSize:o,rotation:f=0,onZoomChange:i,onCropChange:g,onRotationChange:y})=>{let b=t=>{if(t>4){i(4);return}if(t<.1){i(.1);return}i(t);},u=useMemo(()=>{let t=typeof o=="number"?o:o?.width,x=typeof o=="number"?o:o?.height,n=t||550,a=x||550,p=n<=550?n:550,w=a<=550?a:p/e;return {width:p,height:w}},[e,o]);return jsx(s,{children:jsx(P,{image:C,crop:h,zoom:c,aspect:e,onCropChange:g,onZoomChange:b,onCropComplete:r,restrictPosition:!1,cropSize:u,cropShape:d,zoomWithScroll:!1,objectFit:"contain",minZoom:.1,maxZoom:4,style:{containerStyle:{minHeight:"550px",position:"relative"}},rotation:f,onRotationChange:y})})},k=W;
8
-
9
- export { k as a };
@@ -1,7 +0,0 @@
1
- import { useFormContext, Controller } from 'react-hook-form';
2
- import c from '@mui/material/TextField';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- var b=({name:l,helperText:a,rules:s,onChange:o,tabIndex:d,className:f,id:r,...e})=>{let{control:m}=useFormContext();return jsx(Controller,{name:l,control:m,rules:s,render:({field:{ref:u,...t},fieldState:{error:p}})=>jsx(c,{...t,onChange:i=>{t.onChange(i),o&&o(i);},inputRef:u,fullWidth:!0,error:!!p,helperText:p?.message||a,"data-intercom-target":l,...e,InputLabelProps:{...e.InputLabelProps,htmlFor:r},inputProps:{...e.inputProps,tabIndex:d,"aria-label":e.label,id:r},className:`field-${l} ${f}`})})},C=b;
6
-
7
- export { C as a };
@@ -1,9 +0,0 @@
1
- import { a as a$1 } from './chunk-KRDLTT6B.js';
2
- import l from '@mui/material/IconButton';
3
- import s from '@mui/material/Stack';
4
- import { styled } from '@mui/material/styles';
5
- import { jsx, jsxs } from 'react/jsx-runtime';
6
-
7
- var e=styled(l)(({theme:t})=>({position:"absolute",top:14,left:-2,zIndex:1,color:t.palette.grey[500],cursor:"grab","&:active":{cursor:"grabbing"}})),a=styled(s)({flexDirection:"row",alignItems:"center",justifyContent:"center",width:16,height:16,overflow:"hidden",transform:"scale(0.8)"});var c=({disableDrag:t,...i})=>t?null:jsx(e,{className:"dragIcon",disableRipple:!0,"aria-label":"Arrastar para ordenar",...i,children:jsxs(a,{children:[jsx(a$1,{sx:{marginLeft:0},icon:"MORE_BOLD",width:16}),jsx(a$1,{sx:{marginLeft:"-10px"},icon:"MORE_BOLD",width:16})]})}),D=c;
8
-
9
- export { D as a };