@erpsquad/common 1.8.70 → 1.8.71

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.
Files changed (60) hide show
  1. package/dist/_virtual/index/index.esm.js +4 -2
  2. package/dist/_virtual/index/index.esm.js.map +1 -1
  3. package/dist/_virtual/index/index.esm10.js +3 -3
  4. package/dist/_virtual/index/index.esm2.js +1 -1
  5. package/dist/_virtual/index/index.esm3.js +3 -3
  6. package/dist/_virtual/index/index.esm4.js +3 -3
  7. package/dist/_virtual/index/index.esm5.js +3 -3
  8. package/dist/_virtual/index/index.esm6.js +3 -3
  9. package/dist/_virtual/index/index.esm7.js +3 -3
  10. package/dist/_virtual/index/index.esm8.js +2 -4
  11. package/dist/_virtual/index/index.esm8.js.map +1 -1
  12. package/dist/_virtual/index/index.esm9.js +3 -3
  13. package/dist/_virtual/index/index.js +1 -1
  14. package/dist/_virtual/index/index10.js +1 -1
  15. package/dist/_virtual/index/index2.js +1 -1
  16. package/dist/_virtual/index/index3.js +1 -1
  17. package/dist/_virtual/index/index4.js +1 -1
  18. package/dist/_virtual/index/index5.js +1 -1
  19. package/dist/_virtual/index/index6.js +1 -1
  20. package/dist/_virtual/index/index7.js +1 -1
  21. package/dist/_virtual/index/index8.js +1 -1
  22. package/dist/_virtual/index/index9.js +1 -1
  23. package/dist/api-client/api.hrms/api/index.esm.js +44 -0
  24. package/dist/api-client/api.hrms/api/index.esm.js.map +1 -0
  25. package/dist/api-client/api.hrms/api/index.js +2 -0
  26. package/dist/api-client/api.hrms/api/index.js.map +1 -0
  27. package/dist/api-client/api.hrms/api.d.ts +128 -0
  28. package/dist/api-client/api.rbac/api/index.esm2.js +44 -0
  29. package/dist/api-client/api.rbac/api/index.esm2.js.map +1 -0
  30. package/dist/api-client/api.rbac/api/index2.js +2 -0
  31. package/dist/api-client/api.rbac/api/index2.js.map +1 -0
  32. package/dist/api-client/api.rbac/api.d.ts +12 -5
  33. package/dist/components/searchable-select/index.esm.js +1 -1
  34. package/dist/components/searchable-select/index.esm.js.map +1 -1
  35. package/dist/components/searchable-select/index.js +8 -8
  36. package/dist/components/searchable-select/index.js.map +1 -1
  37. package/dist/hooks/useApi/index.esm.js +5 -14
  38. package/dist/hooks/useApi/index.esm.js.map +1 -1
  39. package/dist/hooks/useApi/index.js +1 -1
  40. package/dist/hooks/useApi/index.js.map +1 -1
  41. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.esm.js +1 -1
  42. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js +1 -1
  43. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js.map +1 -1
  44. package/dist/node_modules/@mui/system/colorManipulator/index.esm.js +2 -2
  45. package/dist/node_modules/@mui/system/colorManipulator/index.js +1 -1
  46. package/dist/node_modules/@mui/system/colorManipulator/index.js.map +1 -1
  47. package/dist/node_modules/@mui/system/createStyled/index.esm.js +6 -6
  48. package/dist/node_modules/@mui/system/createStyled/index.js +1 -1
  49. package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.esm.js +1 -1
  50. package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.js +1 -1
  51. package/dist/node_modules/prop-types/index/index.esm.js +1 -1
  52. package/dist/node_modules/prop-types/index/index.js +1 -1
  53. package/dist/node_modules/prop-types/index/index.js.map +1 -1
  54. package/dist/src/utils/api.d.ts +14 -0
  55. package/dist/style.css +2 -2
  56. package/dist/utils/api/index.esm.js +16 -7
  57. package/dist/utils/api/index.esm.js.map +1 -1
  58. package/dist/utils/api/index.js +1 -1
  59. package/dist/utils/api/index.js.map +1 -1
  60. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/searchable-select.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport {\n Box,\n CircularProgress,\n Divider,\n IconButton,\n InputAdornment,\n MenuItem,\n OutlinedInput,\n} from \"@mui/material\";\nimport Select from \"./select/select\";\nimport Checkbox from \"./checkbox/checkbox\";\nimport Typography from \"./typography/typography\";\nimport { Close } from \"./icons\";\nimport { debounce, sortBy } from \"lodash\";\nimport { fetchApi } from \"../utils/api\";\nimport ChipOrPlaceholder from \"./form-control/form-builder/form-builder-element/chip-or-placeholder\";\nimport { Add } from \"@mui/icons-material\";\nimport { useLanguage } from \"../hooks/useLangauge\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface IOption {\n id: string | number;\n value: string | number;\n label: string | React.ReactNode;\n disabled?: boolean;\n isGroup?: boolean;\n options?: IOption[];\n searchLabel?: string;\n}\n\ninterface IPaginationState {\n page: number;\n hasMore: boolean;\n isLoadingMore: boolean;\n total: number;\n}\n\ninterface IMenuItems {\n options: IOption[];\n multiple: boolean;\n placeholder: string;\n with_checkboxes: boolean;\n values: string | string[];\n field: any;\n disabledIds: any[];\n handleClear: () => void;\n handleChange?: (value: string | string[]) => void;\n hasParent?: boolean;\n}\n\n// Custom API fetch function type for parent components\ninterface CustomFetchApiParams {\n search?: string;\n filters?: any;\n limit: number;\n skip: number;\n select?: string;\n order?: string;\n}\n\ninterface CustomFetchApiResponse {\n data: IOption[];\n pagination?: {\n totalCount: number;\n };\n}\n\ninterface SearchableSelectProps {\n labelId: string;\n label: string;\n value: any;\n onChange?: (event: any, selectedData?: any) => void;\n options: IOption[];\n multiple?: boolean;\n placeholder?: string;\n size?: \"small\" | \"medium\";\n searchPlaceholder?: string;\n CustomDropDownIcon: React.ReactNode;\n customStyle: any;\n name?: string;\n defaultValue?: any;\n apiType?: string;\n isInternal?: boolean;\n autoFocus?: any;\n error?: any;\n disabled: any;\n customeFilter?: string;\n attributes?: string;\n getSelectedData?: (row: any) => void;\n disabledIds: any[];\n labelKey?: string;\n valueKey?: string;\n inputStyle?: any;\n onChipRemove?: (value: string) => void;\n selectedLabel?: string;\n is_loading?: boolean;\n hasParent?: boolean;\n sortOrder?: string;\n handleChange?: (value: string | string[]) => void;\n enable_footer?: boolean;\n onFooterClick?: () => void;\n showCancelButton?: boolean;\n /** Custom API function to fetch options from parent component */\n customFetchApi?: (params: CustomFetchApiParams) => Promise<CustomFetchApiResponse>;\n}\n\nconst generateMenuItems = ({\n options,\n multiple,\n placeholder,\n with_checkboxes,\n values,\n field,\n disabledIds,\n handleClear,\n handleChange,\n hasParent = false,\n}: IMenuItems) => {\n const itemDisabled = (ls: any) => disabledIds?.includes(ls);\n const items: React.ReactElement[] = [];\n\n if (!multiple) {\n items.push(\n <MenuItem disabled value='' key=\"placeholder\" sx={{ opacity: `0 !important`, height: `0 !important`, p: `0 !important`, m: `0 !important` }}>\n <Typography type='s3' color='theme.secondary.1000'>\n <em>{placeholder}</em>\n </Typography>\n </MenuItem>\n );\n }\n\n const selectedValues = Array.isArray(values) ? values?.filter((value) => value) : [];\n\n // Parent selection handlers\n const handleParentChange = (parentValue: string, childOptions: IOption[]) => {\n const childValues = childOptions.map((child) => child.value);\n const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];\n\n const isParentSelected = valueArray.includes(parentValue);\n const updatedValues = isParentSelected\n ? valueArray.filter((value) => value !== parentValue && !childValues.includes(value))\n : [...new Set([...valueArray, parentValue, ...childValues])];\n\n handleChange?.(updatedValues);\n };\n\n const isAllOptionsSelected = (parentValue: string, childOptions: IOption[]) => {\n const childValues = childOptions.map((child) => child.value);\n const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];\n return childValues.every((childValue) => valueArray.includes(childValue));\n };\n\n const isSomeOptionsSelected = (childOptions: IOption[]) => {\n const childValues = childOptions.map((child) => child.value);\n const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];\n return childValues.some((childValue) => valueArray.includes(childValue));\n };\n\n Array.isArray(options) && options?.length > 0 && options?.forEach((option) => {\n items.push(\n <MenuItem\n value={option?.value}\n key={option?.value}\n disabled={Boolean(option?.disabled) || itemDisabled(option?.value)}\n className={option?.isGroup ? 'select--MenuItemHeader' : ''}\n onClick={() => {\n if (values?.length == 1) {\n handleClear();\n }\n }}\n >\n <Box sx={{ display: 'flex', gap: 1 }}>\n {multiple && with_checkboxes && (\n <Checkbox\n checked={\n hasParent\n ? isAllOptionsSelected(option.value, option.options || [])\n : Boolean(Array.isArray(values) && values?.indexOf(option?.value) > -1)\n }\n indeterminate={\n hasParent && isSomeOptionsSelected(option.options || [])\n }\n onChange={() =>\n hasParent\n ? handleParentChange(option.value, option.options || [])\n : handleChange?.(option.value)\n }\n />\n )}\n <Typography\n type='s3'\n color='theme.secondary.1000'\n onClick={() => handleChange?.(option.value)}\n >\n {option?.label}\n </Typography>\n </Box>\n </MenuItem>\n );\n\n // Handle child options for grouped items\n if (option?.isGroup && Array.isArray(option?.options)) {\n option.options.forEach((opt) => {\n items.push(\n <MenuItem\n value={opt.value}\n disabled={Boolean(opt.disabled) || itemDisabled(opt.value)}\n sx={{ pl: 5 }}\n onClick={() => {\n if (values?.length == 1) {\n handleClear();\n }\n }}\n key={`${option.value}-${opt.value}`}\n >\n <Box sx={{ display: 'flex', gap: 1 }}>\n {multiple && with_checkboxes && (\n <Checkbox\n checked={Boolean(Array.isArray(values) && values?.indexOf(opt.value) > -1)}\n />\n )}\n <Typography\n type='s3'\n color='theme.secondary.1000'\n onClick={() => handleChange?.(String(opt.value))}\n >\n {opt.label == \"Payment Entries\" ? \"Payment and Collection Entries\" : opt.label || opt.value}\n </Typography>\n </Box>\n </MenuItem>\n );\n });\n }\n });\n\n // Footer item\n if (field.enable_footer) {\n items.push(\n <Box key=\"footer\">\n <Divider flexItem />\n <MenuItem sx={{ gap: 1 }} onClick={field.onFooterClick}>\n <Add fontSize='small' />\n <Typography type='s4' color='theme.secondary.1000'>\n Create New {field.label}\n </Typography>\n </MenuItem>\n </Box>\n );\n }\n\n // No data fallback\n if (!items.length || (items.length == 1 && !multiple)) {\n items.push(\n <MenuItem disabled key=\"no-data\">\n No data available\n </MenuItem>\n );\n }\n\n return items;\n};\n\nconst SearchableSelect: React.FC<SearchableSelectProps> = (props) => {\n const {\n labelId,\n label,\n value,\n onChange,\n options,\n multiple = false,\n size = \"small\",\n searchPlaceholder,\n placeholder,\n name,\n defaultValue,\n apiType,\n isInternal = false,\n autoFocus,\n error,\n disabled,\n customeFilter,\n attributes,\n getSelectedData,\n disabledIds,\n onChipRemove,\n selectedLabel,\n is_loading,\n customStyle = {},\n CustomDropDownIcon,\n labelKey,\n valueKey,\n inputStyle,\n hasParent = false,\n sortOrder = 'id:-1',\n handleChange,\n enable_footer = false,\n onFooterClick,\n showCancelButton = true,\n customFetchApi\n } = props;\n\n const [searchQuery, setSearchQuery] = useState(\"\");\n const [loading, setLoading] = useState<boolean>(false);\n const [dynamicOptions, setOptions] = useState<IOption[]>([]);\n const [selectedOptions, setSelectedOptions] = useState<IOption[]>([]);\n const [isAlredyLoaded, setIsAlredyLoaded] = useState(false);\n const [initailLoading, setInitialLoading] = useState(false);\n const [searchInitiate, setSearchInitiate] = useState(false);\n const [open, setOpen] = useState(false);\n const [prevFilter, setPrevFilter] = useState<any>(null);\n const { t } = useTranslation();\n\n // Pagination state\n const [pagination, setPagination] = useState<IPaginationState>({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n\n const { isRtl } = useLanguage();\n const limit = 25;\n\n const isInternalOptions = useMemo(() => {\n return isInternal || (!apiType && !customFetchApi);\n }, [isInternal, apiType, customFetchApi]);\n\n // Local search function for internal options\n const searchOptionsLocally = useCallback((searchTerm: string, value: any): IOption[] => {\n if (!searchTerm) return options || [];\n\n const lowercasedSearchTerm = searchTerm.toLowerCase();\n\n const filteredOptions = hasParent\n ? options?.reduce((acc: IOption[], opt) => {\n const searchedOptions = opt.options?.filter((item) => {\n const label = React.isValidElement(item.label) ? item.searchLabel : String(item.label);\n return label?.toLowerCase().includes(lowercasedSearchTerm);\n });\n\n if (searchedOptions?.length) {\n acc.push({ ...opt, options: searchedOptions });\n }\n\n return acc;\n }, []) || []\n : options?.filter((opt) => {\n const label = React.isValidElement(opt.label) ? opt.searchLabel : String(opt.label);\n return label?.toLowerCase().includes(lowercasedSearchTerm);\n }) || [];\n\n return sortBySelectedValues(filteredOptions, value);\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options, hasParent]);\n\n // Clear Selected Options\n const handleClear = () => {\n onChange?.({ target: { value: multiple ? [] : null } });\n if (getSelectedData && typeof getSelectedData === \"function\") {\n getSelectedData(null);\n }\n };\n\n // Get unique options\n const getUniqueOptions = useCallback((data: IOption[]): IOption[] => {\n const uniqueOptions = [\n ...new Map(data?.map(item => [item.value, item])).values()\n ];\n return uniqueOptions;\n }, []);\n\n // Sort by selected values\n const sortBySelectedValues = useCallback((arrayToSort: IOption[], value: any): IOption[] => {\n const selectedValues = Array.isArray(value) ? value : [value];\n const sortedValue = sortBy(arrayToSort, (item) => {\n const index = selectedValues.indexOf(item.id || item.value);\n return index === -1 ? Infinity : index;\n });\n return sortedValue;\n }, []);\n\n // Options with search and pagination support\n const filteredOptions = useMemo(() => {\n if (isInternalOptions) {\n return searchOptionsLocally(searchQuery, value);\n }\n return sortBySelectedValues(getUniqueOptions([...dynamicOptions, ...selectedOptions]), value);\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchQuery, dynamicOptions, options, value, isInternalOptions, selectedOptions, searchOptionsLocally, sortBySelectedValues, getUniqueOptions]);\n\n // Handle scroll pagination\n const handleScroll = useCallback((event: React.UIEvent<HTMLDivElement>) => {\n const { scrollTop, scrollHeight, clientHeight } = event.currentTarget;\n const isBottom = scrollHeight - scrollTop <= clientHeight + 10;\n\n if (isBottom && pagination.hasMore && !pagination.isLoadingMore && !isInternalOptions) {\n const nextPage = pagination.page + 1;\n fetchOptions(searchQuery, customeFilter, nextPage, true);\n }\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [pagination.hasMore, pagination.isLoadingMore, pagination.page, isInternalOptions, searchQuery, JSON.stringify(customeFilter)]);\n\n // Update Options\n const updateOptions = useCallback((newOptions: IOption[], append = false) => {\n const oldOptions = append ? dynamicOptions : selectedOptions;\n const uniqueOptions = getUniqueOptions([...oldOptions, ...newOptions]);\n setOptions(uniqueOptions);\n }, [dynamicOptions, selectedOptions, getUniqueOptions]);\n\n // Fetch Options with pagination support\n const fetchOptions = useCallback(async (searchTerm: any = '', filters = customeFilter, page = 1, append = false) => {\n // Skip if neither apiType nor customFetchApi is provided\n if (!apiType && !customFetchApi) return [];\n\n setLoading(true);\n if (page > 1) {\n setPagination(prev => ({ ...prev, isLoadingMore: true }));\n }\n\n try {\n let data: IOption[] = [];\n let paginationResult: { totalCount?: number } = {};\n\n // Use custom API if provided, otherwise use default fetchApi\n if (customFetchApi) {\n const response = await customFetchApi({\n search: searchTerm,\n filters,\n limit,\n skip: (page - 1) * limit,\n select: attributes,\n order: sortOrder\n });\n data = response?.data || [];\n paginationResult = response?.pagination || {};\n } else {\n const response = await fetchApi({\n apiKey: apiType!,\n filters: {\n limit,\n skip: (page - 1) * limit,\n search: searchTerm,\n filters,\n select: attributes,\n order: sortOrder\n },\n labelKey,\n valueKey\n });\n data = response?.data || [];\n paginationResult = response?.pagination || {};\n }\n\n if (data && Array.isArray(data)) {\n updateOptions(data, append);\n\n // Update pagination\n setPagination(prev => ({\n ...prev,\n page,\n hasMore: (paginationResult?.totalCount || 0) > (page * limit),\n total: paginationResult?.totalCount || 0,\n isLoadingMore: false\n }));\n\n if (data?.length > 0) {\n setSelectedData();\n }\n }\n\n return data || [];\n } catch (error) {\n console.error('Error fetching options:', error);\n setPagination(prev => ({ ...prev, isLoadingMore: false }));\n return [];\n } finally {\n setLoading(false);\n }\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [apiType, customFetchApi, attributes, sortOrder, limit, updateOptions]);\n\n // Search Options with debounce\n const debounceSearch = useMemo(\n () => debounce(async (searchTerm: string) => {\n if (loading) return;\n\n if (!searchTerm && !isInternalOptions && searchInitiate) {\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n await fetchOptions('', customeFilter, 1, false);\n }\n if (searchTerm?.length > 1 && !isInternalOptions) {\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n await fetchOptions(searchTerm, customeFilter, 1, false);\n }\n }, 700),\n //eslint-disable-next-line react-hooks/exhaustive-deps\n [isInternalOptions, searchInitiate, JSON.stringify(customeFilter)]\n );\n\n // Initial fetch with filter change detection\n const initialFetch = useCallback(async () => {\n const condition = JSON.stringify(customeFilter) !== JSON.stringify(prevFilter);\n\n if (condition && !isInternalOptions && !isAlredyLoaded) {\n setPrevFilter(customeFilter);\n setOptions([]);\n setIsAlredyLoaded(false);\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n }\n\n if (!isInternalOptions && !isAlredyLoaded) {\n await fetchOptions(searchQuery, customeFilter, 1, false);\n setIsAlredyLoaded(true);\n }\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [JSON.stringify(customeFilter), isInternalOptions, isAlredyLoaded]);\n\n // Set Selected Data\n const setSelectedData = useCallback(() => {\n let hasOptions = false;\n const isInOptions = filteredOptions?.filter((i: any) =>\n multiple ? value?.includes(i?.value) : i?.value == value\n );\n\n if ((Array.isArray(isInOptions) && isInOptions?.length > 0)) {\n getSelectedData?.(multiple ? isInOptions : isInOptions[0]);\n hasOptions = true;\n }\n return hasOptions;\n }, [filteredOptions, value, multiple, getSelectedData]);\n\n // Fetch Options for Selected Id\n const fetchIdOptions = useCallback(async () => {\n if (open) return;\n if (await setSelectedData()) return;\n\n const fValue = multiple ? value && value?.filter(v => Boolean(Number(v))) : Number(value) ? value : null;\n const condition = (multiple ? fValue?.length > 0 : fValue) && !isInternalOptions;\n\n if (condition) {\n setInitialLoading(true);\n await fetchOptions('', { ...customeFilter, ...{ '&id.in': fValue } }, 1, false);\n setInitialLoading(false);\n }\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, value, JSON.stringify(customeFilter)]);\n\n const hasValue = multiple\n ? Array.isArray(value) && value.length > 0\n : value !== null && value !== undefined && value !== \"\";\n\n // Effects\n useEffect(() => {\n if (open) {\n debounceSearch(searchQuery);\n }\n return () => debounceSearch.cancel();\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchQuery, JSON.stringify(customeFilter), open, isAlredyLoaded, debounceSearch]);\n\n useEffect(() => {\n setSelectedData();\n }, [setSelectedData]);\n\n useEffect(() => {\n fetchIdOptions();\n }, [fetchIdOptions]);\n\n useEffect(() => {\n if (open) {\n initialFetch();\n }\n }, [open, initialFetch]);\n\n useEffect(() => {\n const condition = JSON.stringify(customeFilter) !== JSON.stringify(prevFilter);\n if (customeFilter && condition) {\n setIsAlredyLoaded(false);\n }\n }, [customeFilter, prevFilter]);\n\n useEffect(() => {\n if (value && !open) {\n const selectedData = options?.filter((i: any) =>\n multiple ? value?.includes(i?.value) : i?.value == value\n ) || [];\n setSelectedOptions(selectedData);\n }\n setSelectedOptions(filteredOptions?.filter((i: any) =>\n multiple ? value?.includes(i?.value) : i?.value == value\n ));\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value, open, options, multiple]);\n\n const handleOnChange = (event: any) => {\n const { value } = event.target;\n if ((multiple && Array.isArray(value) && value?.filter(v => v).length == 0) || !value) return;\n\n const isSelected = (item: any) => {\n return multiple ? value?.includes(item?.value) : item?.value === value;\n };\n\n const selected = filteredOptions?.filter(isSelected);\n onChange?.(event, multiple ? selected : selected?.[0]);\n };\n\n const removeUndefine = (selectOptions: any[]) => {\n return Array.isArray(selectOptions) && selectOptions?.length > 0 && selectOptions?.filter((option) => option);\n };\n\n return (\n <Select\n labelId={labelId}\n name={name}\n defaultValue={defaultValue || (multiple ? [] : '')}\n placeholder={placeholder}\n className=\"filter-select\"\n size={size}\n onOpen={() => setOpen(true)}\n onClose={() => {\n setOpen(false);\n if (searchQuery?.length > 0) {\n setIsAlredyLoaded(false);\n }\n setSearchInitiate(false);\n setSearchQuery('');\n }}\n onChange={handleOnChange}\n showCancelButton={showCancelButton}\n multiple={multiple}\n label={t(label)}\n fullWidth\n displayEmpty\n autoFocus={autoFocus}\n error={Boolean(error)}\n disabled={disabled}\n value={initailLoading ? (multiple ? [] : '') : value?.id || value || (multiple ? [] : '')}\n searchPlaceholder={searchPlaceholder}\n CustomDropdownIcon={CustomDropDownIcon}\n sx={(multiple && value?.length) ? { ...customStyle, \"& .MuiSelect-select\": { padding: '5.5px !important' } } : customStyle}\n MenuProps={{\n PaperProps: {\n onScroll: handleScroll,\n style: { maxHeight: 295, maxWidth: 250 }\n }\n }}\n input={\n !disabled ? (\n <OutlinedInput\n label=\"\"\n sx={inputStyle}\n endAdornment={\n <InputAdornment position=\"end\">\n {loading || is_loading ? (\n <CircularProgress\n size={20}\n sx={{ mr: 3, color: \"#4AC08C\" }}\n />\n ) : (\n showCancelButton && hasValue && (\n <IconButton\n aria-label=\"clear selection\"\n onClick={handleClear}\n edge=\"end\"\n sx={isRtl ? { ml: 2.5 } : { mr: 1.5 }}\n size=\"small\"\n >\n <Close fontSize=\"small\" color='theme.primary.800' />\n </IconButton>\n )\n )}\n </InputAdornment>\n }\n />\n ) : undefined\n }\n renderValue={(selected?: string | string[]) => {\n return (\n <>\n {Array.isArray(selected) ? (\n <ChipOrPlaceholder\n selectedLabel={selectedLabel}\n data={removeUndefine(selected)}\n placeholder={placeholder}\n onDelete={onChipRemove}\n disabled={disabled}\n chipProps={{\n sx: {\n bgcolor: 'theme.primary.100',\n border: 0,\n // borderRadius: '15px',\n '& .MuiTypography-body1': {\n color: 'theme.primary.800',\n fontWeight: \"500\",\n }\n }\n }}\n />\n ) : (\n Array.isArray(filteredOptions) && filteredOptions?.length > 0 && filteredOptions?.find(\n (option: any) => option?.value == value\n )?.label || selected || placeholder\n )}\n </>\n );\n }}\n handleSearch={(text) => {\n setSearchQuery(text);\n setSearchInitiate(true);\n }}\n >\n {generateMenuItems({\n options: filteredOptions,\n multiple: Boolean(multiple),\n placeholder,\n values: value,\n with_checkboxes: true,\n field: {\n ...props,\n enable_footer,\n onFooterClick,\n label\n },\n disabledIds,\n handleClear,\n handleChange,\n hasParent,\n t: (key: string) => key\n })}\n {pagination.isLoadingMore && (\n <MenuItem disabled>\n <Box sx={{ display: 'flex', justifyContent: 'center', width: '100%' }}>\n <CircularProgress size={20} />\n </Box>\n </MenuItem>\n )}\n </Select>\n );\n};\n\nexport default SearchableSelect;"],"names":["generateMenuItems","options","multiple","placeholder","with_checkboxes","values","field","disabledIds","handleClear","handleChange","hasParent","itemDisabled","ls","includes","items","push","jsx","MenuItem","disabled","value","sx","opacity","height","p","m","children","Typography","type","color","selectedValues","Array","isArray","filter","isAllOptionsSelected","parentValue","childOptions","childValues","map","child","valueArray","every","childValue","isSomeOptionsSelected","some","length","forEach","option","Boolean","className","isGroup","onClick","jsxs","Box","display","gap","Checkbox","checked","indexOf","indeterminate","onChange","updatedValues","Set","handleParentChange","label","opt","pl","String","enable_footer","Divider","flexItem","onFooterClick","Add","fontSize","props","labelId","size","searchPlaceholder","name","defaultValue","apiType","isInternal","autoFocus","error","customeFilter","attributes","getSelectedData","onChipRemove","selectedLabel","is_loading","customStyle","CustomDropDownIcon","labelKey","valueKey","inputStyle","sortOrder","showCancelButton","customFetchApi","searchQuery","setSearchQuery","useState","loading","setLoading","dynamicOptions","setOptions","selectedOptions","setSelectedOptions","isAlredyLoaded","setIsAlredyLoaded","initailLoading","setInitialLoading","searchInitiate","setSearchInitiate","open","setOpen","prevFilter","setPrevFilter","t","useTranslation","pagination","setPagination","page","hasMore","isLoadingMore","total","isRtl","useLanguage","limit","isInternalOptions","useMemo","searchOptionsLocally","useCallback","searchTerm","lowercasedSearchTerm","toLowerCase","filteredOptions","reduce","acc","searchedOptions","_a","item","React","isValidElement","searchLabel","sortBySelectedValues","target","getUniqueOptions","data","Map","arrayToSort","sortBy","index","id","Infinity","handleScroll","event","scrollTop","scrollHeight","clientHeight","currentTarget","nextPage","fetchOptions","JSON","stringify","updateOptions","newOptions","append","uniqueOptions","async","filters","prev","paginationResult","response","search","skip","select","order","fetchApi","apiKey","totalCount","setSelectedData","debounceSearch","debounce","initialFetch","hasOptions","isInOptions","i","fetchIdOptions","fValue","v","Number","hasValue","useEffect","cancel","condition","selectedData","Select","onOpen","onClose","selected","fullWidth","displayEmpty","CustomDropdownIcon","padding","MenuProps","PaperProps","onScroll","style","maxHeight","maxWidth","input","OutlinedInput","endAdornment","InputAdornment","position","CircularProgress","mr","IconButton","edge","ml","Close","renderValue","selectOptions","Fragment","ChipOrPlaceholder","onDelete","chipProps","bgcolor","border","fontWeight","find","handleSearch","text","justifyContent","width"],"mappings":"msCA2GA,MAAMA,EAAoB,EACtBC,UACAC,WACAC,cACAC,kBACAC,SACAC,QACAC,cACAC,cACAC,eACAC,aAAY,MAEZ,MAAMC,EAAgBC,GAAY,MAAAL,OAAA,EAAAA,EAAaM,SAASD,GAClDE,EAA8B,GAE/BZ,GACDY,EAAMC;iBACFC,IAACC,EAAAA,QAAA,CAASC,UAAQ,EAACC,MAAM,GAAqBC,GAAI,CAAEC,QAAS,eAAgBC,OAAQ,eAAgBC,EAAG,eAAgBC,EAAG,gBACvHC,wBAAAT,EAAAA,IAACU,EAAAA,WAAA,CAAWC,KAAK,KAAKC,MAAM,uBACxBH,wBAAAT,EAAAA,IAAC,KAAA,CAAIS,SAAAtB,OAFmB,gBAQxC,MAAM0B,EAAiBC,MAAMC,QAAQ1B,SAAUA,WAAQ2B,OAAQb,GAAUA,GAAS,GAe5Ec,EAAuB,CAACC,EAAqBC,KAC/C,MAAMC,EAAcD,EAAaE,IAAKC,GAAUA,EAAMnB,OAChDoB,EAAaT,MAAMC,QAAQF,GAAkBA,EAAiB,CAACA,GACrE,OAAOO,EAAYI,MAAOC,GAAeF,EAAW1B,SAAS4B,KAG3DC,EAAyBP,IAC3B,MAAMC,EAAcD,EAAaE,IAAKC,GAAUA,EAAMnB,OAChDoB,EAAaT,MAAMC,QAAQF,GAAkBA,EAAiB,CAACA,GACrE,OAAOO,EAAYO,KAAMF,GAAeF,EAAW1B,SAAS4B,KAwGhE,OArGAX,MAAMC,QAAQ9B,KAAY,MAAAA,OA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tCxK,MAAMC,QAAQ8L,KAAkB,MAAAA,OAAA,EAAAA,EAAejL,QAAS,IAAK,MAAAiL,OAAA,EAAAA,EAAe7L,OAAQc,GAAWA,KA4E9E3C,cACA6N,SAAU1I,EACVpE,WACA+M,UAAW,CACP7M,GAAI,CACA8M,QAAS,oBACTC,OAAQ,EAER,yBAA0B,CACtBvM,MAAO,oBACPwM,WAAY,WAM5BtM,MAAMC,QAAQuG,MAAoB,MAAAA,QAAA,EAAAA,GAAiB1F,QAAS,IAAK,OAAA8F,EAAA,MAAAJ,QAAA,EAAAA,GAAiB+F,KAC7EvL,IAAgB,MAAAA,OAAA,EAAAA,EAAQ3B,QAASA,SAD2B,EAAAuH,EAE9D3E,QAASuI,GAAYnM,KAKxCmO,aAAeC,IACXrI,GAAeqI,GACfxH,IAAkB,IAGrBtF,SAAA,CAAAzB,EAAkB,CACfC,QAASqI,GACTpI,SAAU6C,QAAQ7C,GAClBC,cACAE,OAAQc,EACRf,iBAAiB,EACjBE,MAAO,CAEH6D,gBACAG,gBACAP,SAEJxD,cACAC,eACAC,eACAC,cAGH4G,GAAWI,8BACR1G,MAACC,EAAAA,QAAA,CAASC,UAAQ,EACdO,0BAAAT,IAACoC,EAAAA,QAAA,CAAIhC,GAAI,CAAEiC,QAAS,OAAQmL,eAAgB,SAAUC,MAAO,QACzDhN,8BAAC6L,EAAAA,QAAA,CAAiB3I,KAAM"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/searchable-select.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport {\n Box,\n CircularProgress,\n Divider,\n IconButton,\n InputAdornment,\n MenuItem,\n OutlinedInput,\n} from \"@mui/material\";\nimport Select from \"./select/select\";\nimport Checkbox from \"./checkbox/checkbox\";\nimport Typography from \"./typography/typography\";\nimport { Close } from \"./icons\";\nimport { debounce, sortBy } from \"lodash\";\nimport { fetchApi } from \"../utils/api\";\nimport ChipOrPlaceholder from \"./form-control/form-builder/form-builder-element/chip-or-placeholder\";\nimport { Add } from \"@mui/icons-material\";\nimport { useLanguage } from \"../hooks/useLangauge\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface IOption {\n id: string | number;\n value: string | number;\n label: string | React.ReactNode;\n disabled?: boolean;\n isGroup?: boolean;\n options?: IOption[];\n searchLabel?: string;\n}\n\ninterface IPaginationState {\n page: number;\n hasMore: boolean;\n isLoadingMore: boolean;\n total: number;\n}\n\ninterface IMenuItems {\n options: IOption[];\n multiple: boolean;\n placeholder: string;\n with_checkboxes: boolean;\n values: string | string[];\n field: any;\n disabledIds: any[];\n handleClear: () => void;\n handleChange?: (value: string | string[]) => void;\n hasParent?: boolean;\n}\n\n// Custom API fetch function type for parent components\ninterface CustomFetchApiParams {\n search?: string;\n filters?: any;\n limit: number;\n skip: number;\n select?: string;\n order?: string;\n}\n\ninterface CustomFetchApiResponse {\n data: IOption[];\n pagination?: {\n totalCount: number;\n };\n}\n\ninterface SearchableSelectProps {\n labelId: string;\n label: string;\n value: any;\n onChange?: (event: any, selectedData?: any) => void;\n options: IOption[];\n multiple?: boolean;\n placeholder?: string;\n size?: \"small\" | \"medium\";\n searchPlaceholder?: string;\n CustomDropDownIcon: React.ReactNode;\n customStyle: any;\n name?: string;\n defaultValue?: any;\n apiType?: string;\n isInternal?: boolean;\n autoFocus?: any;\n error?: any;\n disabled: any;\n customeFilter?: string;\n attributes?: string;\n getSelectedData?: (row: any) => void;\n disabledIds: any[];\n labelKey?: string;\n valueKey?: string;\n inputStyle?: any;\n onChipRemove?: (value: string) => void;\n selectedLabel?: string;\n is_loading?: boolean;\n hasParent?: boolean;\n sortOrder?: string;\n handleChange?: (value: string | string[]) => void;\n enable_footer?: boolean;\n onFooterClick?: () => void;\n showCancelButton?: boolean;\n /** Custom API function to fetch options from parent component */\n customFetchApi?: (params: CustomFetchApiParams) => Promise<CustomFetchApiResponse>;\n}\n\nconst generateMenuItems = ({\n options,\n multiple,\n placeholder,\n with_checkboxes,\n values,\n field,\n disabledIds,\n handleClear,\n handleChange,\n hasParent = false,\n}: IMenuItems) => {\n const itemDisabled = (ls: any) => disabledIds?.includes(ls);\n const items: React.ReactElement[] = [];\n\n if (!multiple) {\n items.push(\n <MenuItem disabled value='' key=\"placeholder\" sx={{ opacity: `0 !important`, height: `0 !important`, p: `0 !important`, m: `0 !important` }}>\n <Typography type='s3' color='theme.secondary.1000'>\n <em>{placeholder}</em>\n </Typography>\n </MenuItem>\n );\n }\n\n const selectedValues = Array.isArray(values) ? values?.filter((value) => value) : [];\n\n // Parent selection handlers\n const handleParentChange = (parentValue: string, childOptions: IOption[]) => {\n const childValues = childOptions.map((child) => child.value);\n const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];\n\n const isParentSelected = valueArray.includes(parentValue);\n const updatedValues = isParentSelected\n ? valueArray.filter((value) => value !== parentValue && !childValues.includes(value))\n : [...new Set([...valueArray, parentValue, ...childValues])];\n\n handleChange?.(updatedValues);\n };\n\n const isAllOptionsSelected = (parentValue: string, childOptions: IOption[]) => {\n const childValues = childOptions.map((child) => child.value);\n const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];\n return childValues.every((childValue) => valueArray.includes(childValue));\n };\n\n const isSomeOptionsSelected = (childOptions: IOption[]) => {\n const childValues = childOptions.map((child) => child.value);\n const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];\n return childValues.some((childValue) => valueArray.includes(childValue));\n };\n\n Array.isArray(options) && options?.length > 0 && options?.forEach((option) => {\n items.push(\n <MenuItem\n value={option?.value}\n key={option?.value}\n disabled={Boolean(option?.disabled) || itemDisabled(option?.value)}\n className={option?.isGroup ? 'select--MenuItemHeader' : ''}\n onClick={() => {\n if (values?.length == 1) {\n handleClear();\n }\n }}\n >\n <Box sx={{ display: 'flex', gap: 1 }}>\n {multiple && with_checkboxes && (\n <Checkbox\n checked={\n hasParent\n ? isAllOptionsSelected(option.value, option.options || [])\n : Boolean(Array.isArray(values) && values?.indexOf(option?.value) > -1)\n }\n indeterminate={\n hasParent && isSomeOptionsSelected(option.options || [])\n }\n onChange={() =>\n hasParent\n ? handleParentChange(option.value, option.options || [])\n : handleChange?.(option.value)\n }\n />\n )}\n <Typography\n type='s3'\n color='theme.secondary.1000'\n onClick={() => handleChange?.(option.value)}\n >\n {option?.label}\n </Typography>\n </Box>\n </MenuItem>\n );\n\n // Handle child options for grouped items\n if (option?.isGroup && Array.isArray(option?.options)) {\n option.options.forEach((opt) => {\n items.push(\n <MenuItem\n value={opt.value}\n disabled={Boolean(opt.disabled) || itemDisabled(opt.value)}\n sx={{ pl: 5 }}\n onClick={() => {\n if (values?.length == 1) {\n handleClear();\n }\n }}\n key={`${option.value}-${opt.value}`}\n >\n <Box sx={{ display: 'flex', gap: 1 }}>\n {multiple && with_checkboxes && (\n <Checkbox\n checked={Boolean(Array.isArray(values) && values?.indexOf(opt.value) > -1)}\n />\n )}\n <Typography\n type='s3'\n color='theme.secondary.1000'\n onClick={() => handleChange?.(String(opt.value))}\n >\n {opt.label == \"Payment Entries\" ? \"Payment and Collection Entries\" : opt.label || opt.value}\n </Typography>\n </Box>\n </MenuItem>\n );\n });\n }\n });\n\n // Footer item\n if (field.enable_footer) {\n items.push(\n <Box key=\"footer\">\n <Divider flexItem />\n <MenuItem sx={{ gap: 1 }} onClick={field.onFooterClick}>\n <Add fontSize='small' />\n <Typography type='s4' color='theme.secondary.1000'>\n Create New {field.label}\n </Typography>\n </MenuItem>\n </Box>\n );\n }\n\n // No data fallback\n if (!items.length || (items.length == 1 && !multiple)) {\n items.push(\n <MenuItem disabled key=\"no-data\">\n No data available\n </MenuItem>\n );\n }\n\n return items;\n};\n\nconst SearchableSelect: React.FC<SearchableSelectProps> = (props) => {\n const {\n labelId,\n label,\n value,\n onChange,\n options,\n multiple = false,\n size = \"small\",\n searchPlaceholder,\n placeholder,\n name,\n defaultValue,\n apiType,\n isInternal = false,\n autoFocus,\n error,\n disabled,\n customeFilter,\n attributes,\n getSelectedData,\n disabledIds,\n onChipRemove,\n selectedLabel,\n is_loading,\n customStyle = {},\n CustomDropDownIcon,\n labelKey,\n valueKey,\n inputStyle,\n hasParent = false,\n sortOrder = 'id:-1',\n handleChange,\n enable_footer = false,\n onFooterClick,\n showCancelButton = true,\n customFetchApi\n } = props;\n\n const [searchQuery, setSearchQuery] = useState(\"\");\n const [loading, setLoading] = useState<boolean>(false);\n const [dynamicOptions, setOptions] = useState<IOption[]>([]);\n const [selectedOptions, setSelectedOptions] = useState<IOption[]>([]);\n const [isAlredyLoaded, setIsAlredyLoaded] = useState(false);\n const [initailLoading, setInitialLoading] = useState(false);\n const [searchInitiate, setSearchInitiate] = useState(false);\n const [open, setOpen] = useState(false);\n const [prevFilter, setPrevFilter] = useState<any>(null);\n const { t } = useTranslation();\n\n // Pagination state\n const [pagination, setPagination] = useState<IPaginationState>({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n\n const { isRtl } = useLanguage();\n const limit = 25;\n\n const isInternalOptions = useMemo(() => {\n return isInternal || (!apiType && !customFetchApi);\n }, [isInternal, apiType, customFetchApi]);\n\n // Local search function for internal options\n const searchOptionsLocally = useCallback((searchTerm: string, value: any): IOption[] => {\n if (!searchTerm) return options || [];\n\n const lowercasedSearchTerm = searchTerm.toLowerCase();\n\n const filteredOptions = hasParent\n ? options?.reduce((acc: IOption[], opt) => {\n const searchedOptions = opt.options?.filter((item) => {\n const label = React.isValidElement(item.label) ? item.searchLabel : String(item.label);\n return label?.toLowerCase().includes(lowercasedSearchTerm);\n });\n\n if (searchedOptions?.length) {\n acc.push({ ...opt, options: searchedOptions });\n }\n\n return acc;\n }, []) || []\n : options?.filter((opt) => {\n const label = React.isValidElement(opt.label) ? opt.searchLabel : String(opt.label);\n return label?.toLowerCase().includes(lowercasedSearchTerm);\n }) || [];\n\n return sortBySelectedValues(filteredOptions, value);\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options, hasParent]);\n\n // Clear Selected Options\n const handleClear = () => {\n onChange?.({ target: { value: multiple ? [] : null } });\n if (getSelectedData && typeof getSelectedData === \"function\") {\n getSelectedData(null);\n }\n };\n\n // Get unique options\n const getUniqueOptions = useCallback((data: IOption[]): IOption[] => {\n const uniqueOptions = [\n ...new Map(data?.map(item => [item.value, item])).values()\n ];\n return uniqueOptions;\n }, []);\n\n // Sort by selected values\n const sortBySelectedValues = useCallback((arrayToSort: IOption[], value: any): IOption[] => {\n const selectedValues = Array.isArray(value) ? value : [value];\n const sortedValue = sortBy(arrayToSort, (item) => {\n const index = selectedValues.indexOf(item.id || item.value);\n return index === -1 ? Infinity : index;\n });\n return sortedValue;\n }, []);\n\n // Options with search and pagination support\n const filteredOptions = useMemo(() => {\n if (isInternalOptions) {\n return searchOptionsLocally(searchQuery, value);\n }\n return sortBySelectedValues(getUniqueOptions([...dynamicOptions, ...selectedOptions]), value);\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchQuery, dynamicOptions, options, value, isInternalOptions, selectedOptions, searchOptionsLocally, sortBySelectedValues, getUniqueOptions]);\n\n // Handle scroll pagination\n const handleScroll = useCallback((event: React.UIEvent<HTMLDivElement>) => {\n const { scrollTop, scrollHeight, clientHeight } = event.currentTarget;\n const isBottom = scrollHeight - scrollTop <= clientHeight + 10;\n\n if (isBottom && pagination.hasMore && !pagination.isLoadingMore && !isInternalOptions) {\n const nextPage = pagination.page + 1;\n fetchOptions(searchQuery, customeFilter, nextPage, true);\n }\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [pagination.hasMore, pagination.isLoadingMore, pagination.page, isInternalOptions, searchQuery, JSON.stringify(customeFilter)]);\n\n // Update Options\n const updateOptions = useCallback((newOptions: IOption[], append = false) => {\n const oldOptions = append ? dynamicOptions : selectedOptions;\n const uniqueOptions = getUniqueOptions([...oldOptions, ...newOptions]);\n setOptions(uniqueOptions);\n }, [dynamicOptions, selectedOptions, getUniqueOptions]);\n\n // Fetch Options with pagination support\n const fetchOptions = useCallback(async (searchTerm: any = '', filters = customeFilter, page = 1, append = false) => {\n // Skip if neither apiType nor customFetchApi is provided\n if (!apiType && !customFetchApi) return [];\n\n setLoading(true);\n if (page > 1) {\n setPagination(prev => ({ ...prev, isLoadingMore: true }));\n }\n\n try {\n let data: IOption[] = [];\n let paginationResult: { totalCount?: number } = {};\n\n // Use custom API if provided, otherwise use default fetchApi\n if (customFetchApi) {\n const response = await customFetchApi({\n search: searchTerm,\n filters,\n limit,\n skip: (page - 1) * limit,\n select: attributes,\n order: sortOrder\n });\n data = response?.data || [];\n paginationResult = response?.pagination || {};\n } else {\n const response = await fetchApi({\n apiKey: apiType!,\n filters: {\n limit,\n skip: (page - 1) * limit,\n search: searchTerm,\n filters,\n select: attributes,\n order: sortOrder\n },\n labelKey,\n valueKey\n });\n data = response?.data || [];\n paginationResult = response?.pagination || {};\n }\n\n if (data && Array.isArray(data)) {\n updateOptions(data, append);\n\n // Update pagination\n setPagination(prev => ({\n ...prev,\n page,\n hasMore: (paginationResult?.totalCount || 0) > (page * limit),\n total: paginationResult?.totalCount || 0,\n isLoadingMore: false\n }));\n\n if (data?.length > 0) {\n setSelectedData();\n }\n }\n\n return data || [];\n } catch (error) {\n console.error('Error fetching options:', error);\n setPagination(prev => ({ ...prev, isLoadingMore: false }));\n return [];\n } finally {\n setLoading(false);\n }\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [apiType, customFetchApi, attributes, sortOrder, limit, updateOptions]);\n\n // Search Options with debounce\n const debounceSearch = useMemo(\n () => debounce(async (searchTerm: string) => {\n if (loading) return;\n\n if (!searchTerm && !isInternalOptions && searchInitiate) {\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n await fetchOptions('', customeFilter, 1, false);\n }\n if (searchTerm?.length > 1 && !isInternalOptions) {\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n await fetchOptions(searchTerm, customeFilter, 1, false);\n }\n }, 700),\n //eslint-disable-next-line react-hooks/exhaustive-deps\n [isInternalOptions, searchInitiate, JSON.stringify(customeFilter)]\n );\n\n // Initial fetch with filter change detection\n const initialFetch = useCallback(async () => {\n const condition = JSON.stringify(customeFilter) !== JSON.stringify(prevFilter);\n\n if (condition && !isInternalOptions && !isAlredyLoaded) {\n setPrevFilter(customeFilter);\n setOptions([]);\n setIsAlredyLoaded(false);\n setPagination({\n page: 1,\n hasMore: true,\n isLoadingMore: false,\n total: 0\n });\n }\n\n if (!isInternalOptions && !isAlredyLoaded) {\n await fetchOptions(searchQuery, customeFilter, 1, false);\n setIsAlredyLoaded(true);\n }\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [JSON.stringify(customeFilter), isInternalOptions, isAlredyLoaded]);\n\n // Set Selected Data\n const setSelectedData = useCallback(() => {\n let hasOptions = false;\n const isInOptions = filteredOptions?.filter((i: any) =>\n multiple ? value?.includes(i?.value) : i?.value == value\n );\n\n if ((Array.isArray(isInOptions) && isInOptions?.length > 0)) {\n getSelectedData?.(multiple ? isInOptions : isInOptions[0]);\n hasOptions = true;\n }\n return hasOptions;\n }, [filteredOptions, value, multiple, getSelectedData]);\n\n // Fetch Options for Selected Id\n const fetchIdOptions = useCallback(async () => {\n if (open) return;\n if (await setSelectedData()) return;\n\n const fValue = multiple ? value && value?.filter(v => Boolean(Number(v))) : value ? value : null;\n const condition = (multiple ? fValue?.length > 0 : fValue) && !isInternalOptions;\n\n if (condition) {\n setInitialLoading(true);\n await fetchOptions('', { ...customeFilter, ...{ '&id.in': fValue } }, 1, false);\n setInitialLoading(false);\n }\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, value, JSON.stringify(customeFilter)]);\n\n const hasValue = multiple\n ? Array.isArray(value) && value.length > 0\n : value !== null && value !== undefined && value !== \"\";\n\n // Effects\n useEffect(() => {\n if (open) {\n debounceSearch(searchQuery);\n }\n return () => debounceSearch.cancel();\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [searchQuery, JSON.stringify(customeFilter), open, isAlredyLoaded, debounceSearch]);\n\n useEffect(() => {\n setSelectedData();\n }, [setSelectedData]);\n\n useEffect(() => {\n fetchIdOptions();\n }, [fetchIdOptions]);\n\n useEffect(() => {\n if (open) {\n initialFetch();\n }\n }, [open, initialFetch]);\n\n useEffect(() => {\n const condition = JSON.stringify(customeFilter) !== JSON.stringify(prevFilter);\n if (customeFilter && condition) {\n setIsAlredyLoaded(false);\n }\n }, [customeFilter, prevFilter]);\n\n useEffect(() => {\n if (value && !open) {\n const selectedData = options?.filter((i: any) =>\n multiple ? value?.includes(i?.value) : i?.value == value\n ) || [];\n setSelectedOptions(selectedData);\n }\n setSelectedOptions(filteredOptions?.filter((i: any) =>\n multiple ? value?.includes(i?.value) : i?.value == value\n ));\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value, open, options, multiple]);\n\n const handleOnChange = (event: any) => {\n const { value } = event.target;\n if ((multiple && Array.isArray(value) && value?.filter(v => v).length == 0) || !value) return;\n\n const isSelected = (item: any) => {\n return multiple ? value?.includes(item?.value) : item?.value === value;\n };\n\n const selected = filteredOptions?.filter(isSelected);\n onChange?.(event, multiple ? selected : selected?.[0]);\n };\n\n const removeUndefine = (selectOptions: any[]) => {\n return Array.isArray(selectOptions) && selectOptions?.length > 0 && selectOptions?.filter((option) => option);\n };\n\n return (\n <Select\n labelId={labelId}\n name={name}\n defaultValue={defaultValue || (multiple ? [] : '')}\n placeholder={placeholder}\n className=\"filter-select\"\n size={size}\n onOpen={() => setOpen(true)}\n onClose={() => {\n setOpen(false);\n if (searchQuery?.length > 0) {\n setIsAlredyLoaded(false);\n }\n setSearchInitiate(false);\n setSearchQuery('');\n }}\n onChange={handleOnChange}\n showCancelButton={showCancelButton}\n multiple={multiple}\n label={t(label)}\n fullWidth\n displayEmpty\n autoFocus={autoFocus}\n error={Boolean(error)}\n disabled={disabled}\n value={initailLoading ? (multiple ? [] : '') : value?.id || value || (multiple ? [] : '')}\n searchPlaceholder={searchPlaceholder}\n CustomDropdownIcon={CustomDropDownIcon}\n sx={(multiple && value?.length) ? { ...customStyle, \"& .MuiSelect-select\": { padding: '5.5px !important' } } : customStyle}\n MenuProps={{\n PaperProps: {\n onScroll: handleScroll,\n style: { maxHeight: 295, maxWidth: 250 }\n }\n }}\n input={\n !disabled ? (\n <OutlinedInput\n label=\"\"\n sx={inputStyle}\n endAdornment={\n <InputAdornment position=\"end\">\n {loading || is_loading ? (\n <CircularProgress\n size={20}\n sx={{ mr: 3, color: \"#4AC08C\" }}\n />\n ) : (\n showCancelButton && hasValue && (\n <IconButton\n aria-label=\"clear selection\"\n onClick={handleClear}\n edge=\"end\"\n sx={isRtl ? { ml: 2.5 } : { mr: 1.5 }}\n size=\"small\"\n >\n <Close fontSize=\"small\" color='theme.primary.800' />\n </IconButton>\n )\n )}\n </InputAdornment>\n }\n />\n ) : undefined\n }\n renderValue={(selected?: string | string[]) => {\n return (\n <>\n {Array.isArray(selected) ? (\n <ChipOrPlaceholder\n selectedLabel={selectedLabel}\n data={removeUndefine(selected)}\n placeholder={placeholder}\n onDelete={onChipRemove}\n disabled={disabled}\n chipProps={{\n sx: {\n bgcolor: 'theme.primary.100',\n border: 0,\n // borderRadius: '15px',\n '& .MuiTypography-body1': {\n color: 'theme.primary.800',\n fontWeight: \"500\",\n }\n }\n }}\n />\n ) : (\n Array.isArray(filteredOptions) && filteredOptions?.length > 0 && filteredOptions?.find(\n (option: any) => option?.value == value\n )?.label || selected || placeholder\n )}\n </>\n );\n }}\n handleSearch={(text) => {\n setSearchQuery(text);\n setSearchInitiate(true);\n }}\n >\n {generateMenuItems({\n options: filteredOptions,\n multiple: Boolean(multiple),\n placeholder,\n values: value,\n with_checkboxes: true,\n field: {\n ...props,\n enable_footer,\n onFooterClick,\n label\n },\n disabledIds,\n handleClear,\n handleChange,\n hasParent,\n t: (key: string) => key\n })}\n {pagination.isLoadingMore && (\n <MenuItem disabled>\n <Box sx={{ display: 'flex', justifyContent: 'center', width: '100%' }}>\n <CircularProgress size={20} />\n </Box>\n </MenuItem>\n )}\n </Select>\n );\n};\n\nexport default SearchableSelect;"],"names":["generateMenuItems","options","multiple","placeholder","with_checkboxes","values","field","disabledIds","handleClear","handleChange","hasParent","itemDisabled","ls","includes","items","push","jsx","MenuItem","disabled","value","sx","opacity","height","p","m","children","Typography","type","color","selectedValues","Array","isArray","filter","isAllOptionsSelected","parentValue","childOptions","childValues","map","child","valueArray","every","childValue","isSomeOptionsSelected","some","length","forEach","option","Boolean","className","isGroup","onClick","jsxs","Box","display","gap","Checkbox","checked","indexOf","indeterminate","onChange","updatedValues","Set","handleParentChange","label","opt","pl","String","enable_footer","Divider","flexItem","onFooterClick","Add","fontSize","props","labelId","size","searchPlaceholder","name","defaultValue","apiType","isInternal","autoFocus","error","customeFilter","attributes","getSelectedData","onChipRemove","selectedLabel","is_loading","customStyle","CustomDropDownIcon","labelKey","valueKey","inputStyle","sortOrder","showCancelButton","customFetchApi","searchQuery","setSearchQuery","useState","loading","setLoading","dynamicOptions","setOptions","selectedOptions","setSelectedOptions","isAlredyLoaded","setIsAlredyLoaded","initailLoading","setInitialLoading","searchInitiate","setSearchInitiate","open","setOpen","prevFilter","setPrevFilter","t","useTranslation","pagination","setPagination","page","hasMore","isLoadingMore","total","isRtl","useLanguage","limit","isInternalOptions","useMemo","searchOptionsLocally","useCallback","searchTerm","lowercasedSearchTerm","toLowerCase","filteredOptions","reduce","acc","searchedOptions","_a","item","React","isValidElement","searchLabel","sortBySelectedValues","target","getUniqueOptions","data","Map","arrayToSort","sortBy","index","id","Infinity","handleScroll","event","scrollTop","scrollHeight","clientHeight","currentTarget","nextPage","fetchOptions","JSON","stringify","updateOptions","newOptions","append","uniqueOptions","async","filters","prev","paginationResult","response","search","skip","select","order","fetchApi","apiKey","totalCount","setSelectedData","debounceSearch","debounce","initialFetch","hasOptions","isInOptions","i","fetchIdOptions","fValue","v","Number","hasValue","useEffect","cancel","condition","selectedData","Select","onOpen","onClose","selected","fullWidth","displayEmpty","CustomDropdownIcon","padding","MenuProps","PaperProps","onScroll","style","maxHeight","maxWidth","input","OutlinedInput","endAdornment","InputAdornment","position","CircularProgress","mr","IconButton","edge","ml","Close","renderValue","selectOptions","Fragment","ChipOrPlaceholder","onDelete","chipProps","bgcolor","border","fontWeight","find","handleSearch","text","justifyContent","width"],"mappings":"msCA2GA,MAAMA,EAAoB,EACtBC,UACAC,WACAC,cACAC,kBACAC,SACAC,QACAC,cACAC,cACAC,eACAC,aAAY,MAEZ,MAAMC,EAAgBC,GAAY,MAAAL,OAAA,EAAAA,EAAaM,SAASD,GAClDE,EAA8B,GAE/BZ,GACDY,EAAMC;iBACFC,IAACC,EAAAA,QAAA,CAASC,UAAQ,EAACC,MAAM,GAAqBC,GAAI,CAAEC,QAAS,eAAgBC,OAAQ,eAAgBC,EAAG,eAAgBC,EAAG,gBACvHC,wBAAAT,EAAAA,IAACU,EAAAA,WAAA,CAAWC,KAAK,KAAKC,MAAM,uBACxBH,wBAAAT,EAAAA,IAAC,KAAA,CAAIS,SAAAtB,OAFmB,gBAQxC,MAAM0B,EAAiBC,MAAMC,QAAQ1B,SAAUA,WAAQ2B,OAAQb,GAAUA,GAAS,GAe5Ec,EAAuB,CAACC,EAAqBC,KAC/C,MAAMC,EAAcD,EAAaE,IAAKC,GAAUA,EAAMnB,OAChDoB,EAAaT,MAAMC,QAAQF,GAAkBA,EAAiB,CAACA,GACrE,OAAOO,EAAYI,MAAOC,GAAeF,EAAW1B,SAAS4B,KAG3DC,EAAyBP,IAC3B,MAAMC,EAAcD,EAAaE,IAAKC,GAAUA,EAAMnB,OAChDoB,EAAaT,MAAMC,QAAQF,GAAkBA,EAAiB,CAACA,GACrE,OAAOO,EAAYO,KAAMF,GAAeF,EAAW1B,SAAS4B,KAwGhE,OArGAX,MAAMC,QAAQ9B,KAAY,MAAAA,OAAA,EAAAA,EAAS2C,QAAS,IAAK,MAAA3C,GAAAA,EAAS4C,QAASC,IAC/DhC,EAAMC;eACFC,EAAAA,IAACC,EAAAA,QAAA,CACGE,MAAO,MAAA2B,OAAA,EAAAA,EAAQ3B,MAEf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I,CACA8M,QAAS,oBACTC,OAAQ,EAER,yBAA0B,CACtBvM,MAAO,oBACPwM,WAAY,WAM5BtM,MAAMC,QAAQuG,MAAoB,MAAAA,QAAA,EAAAA,GAAiB1F,QAAS,IAAK,OAAA8F,EAAA,MAAAJ,QAAA,EAAAA,GAAiB+F,KAC7EvL,IAAgB,MAAAA,OAAA,EAAAA,EAAQ3B,QAASA,SAD2B,EAAAuH,EAE9D3E,QAASuI,GAAYnM,KAKxCmO,aAAeC,IACXrI,GAAeqI,GACfxH,IAAkB,IAGrBtF,SAAA,CAAAzB,EAAkB,CACfC,QAASqI,GACTpI,SAAU6C,QAAQ7C,GAClBC,cACAE,OAAQc,EACRf,iBAAiB,EACjBE,MAAO,CAEH6D,gBACAG,gBACAP,SAEJxD,cACAC,eACAC,eACAC,cAGH4G,GAAWI,8BACR1G,MAACC,EAAAA,QAAA,CAASC,UAAQ,EACdO,0BAAAT,IAACoC,EAAAA,QAAA,CAAIhC,GAAI,CAAEiC,QAAS,OAAQmL,eAAgB,SAAUC,MAAO,QACzDhN,8BAAC6L,EAAAA,QAAA,CAAiB3I,KAAM"}
@@ -1,6 +1,7 @@
1
1
  import { enqueueSnackbar } from "../../node_modules/notistack/notistack.esm/index.esm.js";
2
2
  import { useState, useCallback } from "react";
3
3
  import { useDispatch } from "react-redux";
4
+ import { getErrorMessage } from "../../utils/common/index.esm.js";
4
5
  function apiHelper({
5
6
  res,
6
7
  callBack,
@@ -10,29 +11,19 @@ function apiHelper({
10
11
  }) {
11
12
  var _a, _b;
12
13
  if (((_a = res == null ? void 0 : res.meta) == null ? void 0 : _a.requestStatus) === "rejected") {
13
- const errorMessage = (() => {
14
- var _a2;
15
- try {
16
- return ((_a2 = res.error) == null ? void 0 : _a2.message) ? JSON.parse(res.error.message) : null;
17
- } catch {
18
- return { message: "Something went wrong" };
19
- }
20
- })();
21
- const message = ((_b = errorMessage == null ? void 0 : errorMessage.message) == null ? void 0 : _b.replace("Error:", "").trim()) || "Something went wrong";
14
+ const errorMessage = getErrorMessage((_b = res == null ? void 0 : res.error) == null ? void 0 : _b.message);
22
15
  if (showError) {
23
- enqueueSnackbar(message, {
16
+ enqueueSnackbar(errorMessage, {
24
17
  variant: "error"
25
18
  });
26
19
  }
27
20
  if (errorCallback && typeof errorCallback === "function") {
28
- errorCallback(message);
21
+ errorCallback(errorMessage);
29
22
  }
30
23
  return;
31
24
  }
32
25
  if (succsessMessage) {
33
- enqueueSnackbar(succsessMessage, {
34
- variant: "success"
35
- });
26
+ enqueueSnackbar(succsessMessage);
36
27
  }
37
28
  if (callBack && typeof callBack === "function") {
38
29
  callBack();
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../src/hooks/useApi.ts"],"sourcesContent":["import { enqueueSnackbar } from 'notistack';\nimport { useCallback, useState } from 'react';\nimport { useDispatch } from 'react-redux';\ninterface UseApiProps {\n apiFunc: any;\n onSuccess?: any;\n onError?: any;\n enableLoading?: any;\n successMessage?: string;\n errorMessage?: string | null;\n loadingState?: any;\n showError?: boolean;\n}\n\ntype ApiResponse = {\n meta?: {\n requestStatus?: string;\n };\n error?: {\n message?: string;\n };\n payload?: any\n};\n\ntype Callback = () => void;\n\nfunction apiHelper({\n res,\n callBack,\n showError = true,\n errorCallback,\n succsessMessage = null,\n}: {\n res: ApiResponse;\n callBack?: Callback;\n showError?: boolean;\n errorCallback?: (error: any) => void;\n succsessMessage?: string | null;\n}): void {\n if (res?.meta?.requestStatus === \"rejected\") {\n const errorMessage = (() => {\n try {\n return res.error?.message ? JSON.parse(res.error.message) : null;\n } catch {\n return { message: \"Something went wrong\" };\n }\n })();\n const message = errorMessage?.message?.replace(\"Error:\", \"\").trim() || \"Something went wrong\";\n if (showError) {\n enqueueSnackbar(message, {\n variant: \"error\",\n });\n }\n\n if (errorCallback && typeof errorCallback === \"function\") {\n errorCallback(message);\n }\n return;\n }\n if (succsessMessage) {\n enqueueSnackbar(succsessMessage, {\n variant: \"success\",\n });\n }\n if (callBack && typeof callBack === \"function\") {\n callBack();\n }\n}\n\n\nexport default function useApi() {\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState(null);\n const dispatch = useDispatch();\n const callApi = useCallback(async ({\n apiFunc,\n onSuccess,\n onError,\n successMessage,\n errorMessage,\n loadingState,\n enableLoading = true,\n showError = true,\n }: UseApiProps) => {\n if (enableLoading) setLoading(true);\n loadingState?.(true);\n const response = await dispatch(apiFunc);\n if (enableLoading) setLoading(false);\n loadingState?.(false);\n apiHelper(\n {\n res: response,\n callBack: () => {\n onSuccess?.(response);\n },\n errorCallback: (err) => {\n onError?.(response);\n setError(errorMessage || err);\n },\n succsessMessage: successMessage,\n showError,\n }\n )\n\n return { response, error }\n\n }, [])\n\n return { callApi, loading, error };\n}\n"],"names":["_a"],"mappings":";;;AA0BA,SAAS,UAAU;AAAA,EACf;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,kBAAkB;AACtB,GAMS;;AACL,QAAI,gCAAK,SAAL,mBAAW,mBAAkB,YAAY;AACzC,UAAM,gBAAgB,MAAM;;AACxB,UAAI;AACA,iBAAOA,MAAA,IAAI,UAAJ,gBAAAA,IAAW,WAAU,KAAK,MAAM,IAAI,MAAM,OAAO,IAAI;AAAA,MAChE,QAAQ;AACJ,eAAO,EAAE,SAAS,uBAAA;AAAA,MACtB;AAAA,IACJ,GAAA;AACA,UAAM,YAAU,kDAAc,YAAd,mBAAuB,QAAQ,UAAU,IAAI,WAAU;AACvE,QAAI,WAAW;AACX,sBAAgB,SAAS;AAAA,QACrB,SAAS;AAAA,MAAA,CACZ;AAAA,IACL;AAEA,QAAI,iBAAiB,OAAO,kBAAkB,YAAY;AACtD,oBAAc,OAAO;AAAA,IACzB;AACA;AAAA,EACJ;AACA,MAAI,iBAAiB;AACjB,oBAAgB,iBAAiB;AAAA,MAC7B,SAAS;AAAA,IAAA,CACZ;AAAA,EACL;AACA,MAAI,YAAY,OAAO,aAAa,YAAY;AAC5C,aAAA;AAAA,EACJ;AACJ;AAGA,SAAwB,SAAS;AAC7B,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,IAAI;AACvC,QAAM,WAAW,YAAA;AACjB,QAAM,UAAU,YAAY,OAAO;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,YAAY;AAAA,EAAA,MACG;AACf,QAAI,0BAA0B,IAAI;AAClC,iDAAe;AACf,UAAM,WAAW,MAAM,SAAS,OAAO;AACvC,QAAI,0BAA0B,KAAK;AACnC,iDAAe;AACf;AAAA,MACI;AAAA,QACI,KAAK;AAAA,QACL,UAAU,MAAM;AACZ,iDAAY;AAAA,QAChB;AAAA,QACA,eAAe,CAAC,QAAQ;AACpB,6CAAU;AACV,mBAAS,gBAAgB,GAAG;AAAA,QAChC;AAAA,QACA,iBAAiB;AAAA,QACjB;AAAA,MAAA;AAAA,IACJ;AAGJ,WAAO,EAAE,UAAU,MAAA;AAAA,EAEvB,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,SAAS,SAAS,MAAA;AAC/B;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../src/hooks/useApi.ts"],"sourcesContent":["import { getErrorMessage } from '@/utils';\nimport { enqueueSnackbar } from 'notistack';\nimport { useCallback, useState } from 'react';\nimport { useDispatch } from 'react-redux';\ninterface UseApiProps {\n apiFunc: any;\n onSuccess?: any;\n onError?: any;\n enableLoading?: any;\n successMessage?: string;\n errorMessage?: string | null;\n loadingState?: any;\n showError?: boolean;\n}\n\ntype ApiResponse = {\n meta?: {\n requestStatus?: string;\n };\n error?: {\n message?: string;\n };\n payload?: any\n};\n\ntype Callback = () => void;\n\nfunction apiHelper({\n res,\n callBack,\n showError = true,\n errorCallback,\n succsessMessage = null,\n}: {\n res: ApiResponse;\n callBack?: Callback;\n showError?: boolean;\n errorCallback?: (error: any) => void;\n succsessMessage?: string | null;\n}): void {\n if (res?.meta?.requestStatus === \"rejected\") {\n const errorMessage = getErrorMessage(res?.error?.message)\n if (showError) {\n enqueueSnackbar(errorMessage, {\n variant: \"error\",\n });\n }\n\n if (errorCallback && typeof errorCallback === \"function\") {\n errorCallback(errorMessage);\n }\n return;\n }\n if (succsessMessage) {\n enqueueSnackbar(succsessMessage);\n }\n if (callBack && typeof callBack === \"function\") {\n callBack();\n }\n}\n\n\nexport default function useApi() {\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState(null);\n const dispatch = useDispatch();\n const callApi = useCallback(async ({\n apiFunc,\n onSuccess,\n onError,\n successMessage,\n errorMessage,\n loadingState,\n enableLoading = true,\n showError = true,\n }: UseApiProps) => {\n if (enableLoading) setLoading(true);\n loadingState?.(true);\n const response = await dispatch(apiFunc);\n if (enableLoading) setLoading(false);\n loadingState?.(false);\n apiHelper(\n {\n res: response,\n callBack: () => {\n onSuccess?.(response);\n },\n errorCallback: (err) => {\n onError?.(response);\n setError(errorMessage || err);\n },\n succsessMessage: successMessage,\n showError,\n }\n )\n\n return { response, error }\n\n }, [])\n\n return { callApi, loading, error };\n}\n"],"names":[],"mappings":";;;;AA2BA,SAAS,UAAU;AAAA,EACf;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,kBAAkB;AACtB,GAMS;;AACL,QAAI,gCAAK,SAAL,mBAAW,mBAAkB,YAAY;AACzC,UAAM,eAAe,iBAAgB,gCAAK,UAAL,mBAAY,OAAO;AACxD,QAAI,WAAW;AACX,sBAAgB,cAAc;AAAA,QAC1B,SAAS;AAAA,MAAA,CACZ;AAAA,IACL;AAEA,QAAI,iBAAiB,OAAO,kBAAkB,YAAY;AACtD,oBAAc,YAAY;AAAA,IAC9B;AACA;AAAA,EACJ;AACA,MAAI,iBAAiB;AACjB,oBAAgB,eAAe;AAAA,EACnC;AACA,MAAI,YAAY,OAAO,aAAa,YAAY;AAC5C,aAAA;AAAA,EACJ;AACJ;AAGA,SAAwB,SAAS;AAC7B,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,IAAI;AACvC,QAAM,WAAW,YAAA;AACjB,QAAM,UAAU,YAAY,OAAO;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,YAAY;AAAA,EAAA,MACG;AACf,QAAI,0BAA0B,IAAI;AAClC,iDAAe;AACf,UAAM,WAAW,MAAM,SAAS,OAAO;AACvC,QAAI,0BAA0B,KAAK;AACnC,iDAAe;AACf;AAAA,MACI;AAAA,QACI,KAAK;AAAA,QACL,UAAU,MAAM;AACZ,iDAAY;AAAA,QAChB;AAAA,QACA,eAAe,CAAC,QAAQ;AACpB,6CAAU;AACV,mBAAS,gBAAgB,GAAG;AAAA,QAChC;AAAA,QACA,iBAAiB;AAAA,QACjB;AAAA,MAAA;AAAA,IACJ;AAGJ,WAAO,EAAE,UAAU,MAAA;AAAA,EAEvB,GAAG,CAAA,CAAE;AAEL,SAAO,EAAE,SAAS,SAAS,MAAA;AAC/B;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/notistack/notistack.esm/index.js"),r=require("react"),s=require("react-redux");exports.default=function(){const[n,a]=r.useState(!1),[o,t]=r.useState(null),u=s.useDispatch();return{callApi:r.useCallback(async({apiFunc:r,onSuccess:s,onError:n,successMessage:l,errorMessage:c,loadingState:i,enableLoading:d=!0,showError:g=!0})=>{d&&a(!0),null==i||i(!0);const v=await u(r);return d&&a(!1),null==i||i(!1),function({res:r,callBack:s,showError:n=!0,errorCallback:a,succsessMessage:o=null}){var t,u;if("rejected"===(null==(t=null==r?void 0:r.meta)?void 0:t.requestStatus)){const s=(()=>{var e;try{return(null==(e=r.error)?void 0:e.message)?JSON.parse(r.error.message):null}catch{return{message:"Something went wrong"}}})(),o=(null==(u=null==s?void 0:s.message)?void 0:u.replace("Error:","").trim())||"Something went wrong";return n&&e.enqueueSnackbar(o,{variant:"error"}),void(a&&"function"==typeof a&&a(o))}o&&e.enqueueSnackbar(o,{variant:"success"}),s&&"function"==typeof s&&s()}({res:v,callBack:()=>{null==s||s(v)},errorCallback:e=>{null==n||n(v),t(c||e)},succsessMessage:l,showError:g}),{response:v,error:o}},[]),loading:n,error:o}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/notistack/notistack.esm/index.js"),r=require("react"),s=require("react-redux"),a=require("../../utils/common/index.js");exports.default=function(){const[n,o]=r.useState(!1),[u,t]=r.useState(null),l=s.useDispatch();return{callApi:r.useCallback(async({apiFunc:r,onSuccess:s,onError:n,successMessage:c,errorMessage:i,loadingState:d,enableLoading:g=!0,showError:f=!0})=>{g&&o(!0),null==d||d(!0);const k=await l(r);return g&&o(!1),null==d||d(!1),function({res:r,callBack:s,showError:n=!0,errorCallback:o,succsessMessage:u=null}){var t,l;if("rejected"===(null==(t=null==r?void 0:r.meta)?void 0:t.requestStatus)){const s=a.getErrorMessage(null==(l=null==r?void 0:r.error)?void 0:l.message);return n&&e.enqueueSnackbar(s,{variant:"error"}),void(o&&"function"==typeof o&&o(s))}u&&e.enqueueSnackbar(u),s&&"function"==typeof s&&s()}({res:k,callBack:()=>{null==s||s(k)},errorCallback:e=>{null==n||n(k),t(i||e)},succsessMessage:c,showError:f}),{response:k,error:u}},[]),loading:n,error:u}};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/hooks/useApi.ts"],"sourcesContent":["import { enqueueSnackbar } from 'notistack';\nimport { useCallback, useState } from 'react';\nimport { useDispatch } from 'react-redux';\ninterface UseApiProps {\n apiFunc: any;\n onSuccess?: any;\n onError?: any;\n enableLoading?: any;\n successMessage?: string;\n errorMessage?: string | null;\n loadingState?: any;\n showError?: boolean;\n}\n\ntype ApiResponse = {\n meta?: {\n requestStatus?: string;\n };\n error?: {\n message?: string;\n };\n payload?: any\n};\n\ntype Callback = () => void;\n\nfunction apiHelper({\n res,\n callBack,\n showError = true,\n errorCallback,\n succsessMessage = null,\n}: {\n res: ApiResponse;\n callBack?: Callback;\n showError?: boolean;\n errorCallback?: (error: any) => void;\n succsessMessage?: string | null;\n}): void {\n if (res?.meta?.requestStatus === \"rejected\") {\n const errorMessage = (() => {\n try {\n return res.error?.message ? JSON.parse(res.error.message) : null;\n } catch {\n return { message: \"Something went wrong\" };\n }\n })();\n const message = errorMessage?.message?.replace(\"Error:\", \"\").trim() || \"Something went wrong\";\n if (showError) {\n enqueueSnackbar(message, {\n variant: \"error\",\n });\n }\n\n if (errorCallback && typeof errorCallback === \"function\") {\n errorCallback(message);\n }\n return;\n }\n if (succsessMessage) {\n enqueueSnackbar(succsessMessage, {\n variant: \"success\",\n });\n }\n if (callBack && typeof callBack === \"function\") {\n callBack();\n }\n}\n\n\nexport default function useApi() {\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState(null);\n const dispatch = useDispatch();\n const callApi = useCallback(async ({\n apiFunc,\n onSuccess,\n onError,\n successMessage,\n errorMessage,\n loadingState,\n enableLoading = true,\n showError = true,\n }: UseApiProps) => {\n if (enableLoading) setLoading(true);\n loadingState?.(true);\n const response = await dispatch(apiFunc);\n if (enableLoading) setLoading(false);\n loadingState?.(false);\n apiHelper(\n {\n res: response,\n callBack: () => {\n onSuccess?.(response);\n },\n errorCallback: (err) => {\n onError?.(response);\n setError(errorMessage || err);\n },\n succsessMessage: successMessage,\n showError,\n }\n )\n\n return { response, error }\n\n }, [])\n\n return { callApi, loading, error };\n}\n"],"names":["loading","setLoading","useState","error","setError","dispatch","useDispatch","callApi","useCallback","async","apiFunc","onSuccess","onError","successMessage","errorMessage","loadingState","enableLoading","showError","response","res","callBack","errorCallback","succsessMessage","_a","meta","requestStatus","message","JSON","parse","_b","replace","trim","enqueueSnackbar","variant","apiHelper","err"],"mappings":"qMAsEA,WACI,MAAOA,EAASC,GAAcC,EAAAA,UAAS,IAChCC,EAAOC,GAAYF,EAAAA,SAAS,MAC7BG,EAAWC,EAAAA,cAmCjB,MAAO,CAAEC,QAlCOC,EAAAA,YAAYC,OACxBC,UACAC,YACAC,UACAC,iBACAC,eACAC,eACAC,iBAAgB,EAChBC,aAAY,MAERD,MAA0B,GAC9B,MAAAD,GAAAA,GAAe,GACf,MAAMG,QAAiBb,EAASK,GAkBhC,OAjBIM,MAA0B,GAC9B,MAAAD,GAAAA,GAAe,GA9DvB,UAAmBI,IACfA,EAAAC,SACAA,EAAAH,UACAA,GAAY,EAAAI,cACZA,EAAAC,gBACAA,EAAkB,eAQlB,GAAiC,cAA7B,OAAAC,EAAA,MAAAJ,OAAA,EAAAA,EAAKK,WAAL,EAAAD,EAAWE,eAA8B,CACzC,MAAMX,cACF,IACI,OAAO,OAAAS,EAAAJ,EAAIhB,YAAJ,EAAAoB,EAAWG,SAAUC,KAAKC,MAAMT,EAAIhB,MAAMuB,SAAW,IAChE,CAAA,MACI,MAAO,CAAEA,QAAS,uBACtB,CACJ,KACMA,GAAU,OAAAG,EAAA,MAAAf,OAAA,EAAAA,EAAcY,kBAASI,QAAQ,SAAU,IAAIC,SAAU,uBAUvE,OATId,GACAe,EAAAA,gBAAgBN,EAAS,CACrBO,QAAS,eAIbZ,GAA0C,mBAAlBA,GACxBA,EAAcK,GAGtB,CACIJ,GACAU,EAAAA,gBAAgBV,EAAiB,CAC7BW,QAAS,YAGbb,GAAgC,mBAAbA,GACnBA,GAER,CAsBQc,CACI,CACIf,IAAKD,EACLE,SAAU,KACN,MAAAT,GAAAA,EAAYO,IAEhBG,cAAgBc,IACZ,MAAAvB,GAAAA,EAAUM,GACVd,EAASU,GAAgBqB,IAE7Bb,gBAAiBT,EACjBI,cAID,CAAEC,WAAUf,UAEpB,IAEeH,UAASG,QAC/B"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/hooks/useApi.ts"],"sourcesContent":["import { getErrorMessage } from '@/utils';\nimport { enqueueSnackbar } from 'notistack';\nimport { useCallback, useState } from 'react';\nimport { useDispatch } from 'react-redux';\ninterface UseApiProps {\n apiFunc: any;\n onSuccess?: any;\n onError?: any;\n enableLoading?: any;\n successMessage?: string;\n errorMessage?: string | null;\n loadingState?: any;\n showError?: boolean;\n}\n\ntype ApiResponse = {\n meta?: {\n requestStatus?: string;\n };\n error?: {\n message?: string;\n };\n payload?: any\n};\n\ntype Callback = () => void;\n\nfunction apiHelper({\n res,\n callBack,\n showError = true,\n errorCallback,\n succsessMessage = null,\n}: {\n res: ApiResponse;\n callBack?: Callback;\n showError?: boolean;\n errorCallback?: (error: any) => void;\n succsessMessage?: string | null;\n}): void {\n if (res?.meta?.requestStatus === \"rejected\") {\n const errorMessage = getErrorMessage(res?.error?.message)\n if (showError) {\n enqueueSnackbar(errorMessage, {\n variant: \"error\",\n });\n }\n\n if (errorCallback && typeof errorCallback === \"function\") {\n errorCallback(errorMessage);\n }\n return;\n }\n if (succsessMessage) {\n enqueueSnackbar(succsessMessage);\n }\n if (callBack && typeof callBack === \"function\") {\n callBack();\n }\n}\n\n\nexport default function useApi() {\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState(null);\n const dispatch = useDispatch();\n const callApi = useCallback(async ({\n apiFunc,\n onSuccess,\n onError,\n successMessage,\n errorMessage,\n loadingState,\n enableLoading = true,\n showError = true,\n }: UseApiProps) => {\n if (enableLoading) setLoading(true);\n loadingState?.(true);\n const response = await dispatch(apiFunc);\n if (enableLoading) setLoading(false);\n loadingState?.(false);\n apiHelper(\n {\n res: response,\n callBack: () => {\n onSuccess?.(response);\n },\n errorCallback: (err) => {\n onError?.(response);\n setError(errorMessage || err);\n },\n succsessMessage: successMessage,\n showError,\n }\n )\n\n return { response, error }\n\n }, [])\n\n return { callApi, loading, error };\n}\n"],"names":["loading","setLoading","useState","error","setError","dispatch","useDispatch","callApi","useCallback","async","apiFunc","onSuccess","onError","successMessage","errorMessage","loadingState","enableLoading","showError","response","res","callBack","errorCallback","succsessMessage","_a","meta","requestStatus","getErrorMessage","_b","message","enqueueSnackbar","variant","apiHelper","err"],"mappings":"8OA8DA,WACI,MAAOA,EAASC,GAAcC,EAAAA,UAAS,IAChCC,EAAOC,GAAYF,EAAAA,SAAS,MAC7BG,EAAWC,EAAAA,cAmCjB,MAAO,CAAEC,QAlCOC,EAAAA,YAAYC,OACxBC,UACAC,YACAC,UACAC,iBACAC,eACAC,eACAC,iBAAgB,EAChBC,aAAY,MAERD,MAA0B,GAC9B,MAAAD,GAAAA,GAAe,GACf,MAAMG,QAAiBb,EAASK,GAkBhC,OAjBIM,MAA0B,GAC9B,MAAAD,GAAAA,GAAe,GArDvB,UAAmBI,IACfA,EAAAC,SACAA,EAAAH,UACAA,GAAY,EAAAI,cACZA,EAAAC,gBACAA,EAAkB,eAQlB,GAAiC,cAA7B,OAAAC,EAAA,MAAAJ,OAAA,EAAAA,EAAKK,WAAL,EAAAD,EAAWE,eAA8B,CACzC,MAAMX,EAAeY,EAAAA,gBAAgB,OAAAC,EAAA,MAAAR,OAAA,EAAAA,EAAKhB,gBAAOyB,SAUjD,OATIX,GACAY,EAAAA,gBAAgBf,EAAc,CAC1BgB,QAAS,eAIbT,GAA0C,mBAAlBA,GACxBA,EAAcP,GAGtB,CACIQ,GACAO,EAAAA,gBAAgBP,GAEhBF,GAAgC,mBAAbA,GACnBA,GAER,CAsBQW,CACI,CACIZ,IAAKD,EACLE,SAAU,KACN,MAAAT,GAAAA,EAAYO,IAEhBG,cAAgBW,IACZ,MAAApB,GAAAA,EAAUM,GACVd,EAASU,GAAgBkB,IAE7BV,gBAAiBT,EACjBI,cAID,CAAEC,WAAUf,UAEpB,IAEeH,UAASG,QAC/B"}
@@ -1,5 +1,5 @@
1
1
  import { __exports as createSvgIcon } from "../../../../../_virtual/createSvgIcon/index.esm.js";
2
- import require$$0 from "../../../../../_virtual/index/index.esm10.js";
2
+ import require$$0 from "../../../../../_virtual/index/index.esm.js";
3
3
  var hasRequiredCreateSvgIcon;
4
4
  function requireCreateSvgIcon() {
5
5
  if (hasRequiredCreateSvgIcon) return createSvgIcon;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("../../../../../_virtual/createSvgIcon/index.js"),t=require("../../../../../_virtual/index/index10.js");exports.__require=function(){return e||(e=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r.createSvgIcon}});var r=t.default}(r.__exports)),r.__exports};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("../../../../../_virtual/createSvgIcon/index.js"),t=require("../../../../../_virtual/index/index.js");exports.__require=function(){return e||(e=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r.createSvgIcon}});var r=t.default}(r.__exports)),r.__exports};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../node_modules/@mui/icons-material/utils/createSvgIcon.js"],"sourcesContent":["\"use strict\";\n'use client';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function () {\n return _utils.createSvgIcon;\n }\n});\nvar _utils = require(\"@mui/material/utils\");"],"names":["Object","defineProperty","exports","value","enumerable","get","_utils","createSvgIcon","require$$0"],"mappings":"oPAGAA,OAAOC,eAAcC,EAAU,aAAc,CAC3CC,OAAO,IAETH,OAAOC,eAAeC,EAAS,UAAW,CACxCE,YAAY,EACZC,IAAK,WACH,OAAOC,EAAOC,aAClB,IAEA,IAAID,EAASE,EAAAA","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../node_modules/@mui/icons-material/utils/createSvgIcon.js"],"sourcesContent":["\"use strict\";\n'use client';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function () {\n return _utils.createSvgIcon;\n }\n});\nvar _utils = require(\"@mui/material/utils\");"],"names":["Object","defineProperty","exports","value","enumerable","get","_utils","createSvgIcon","require$$0"],"mappings":"kPAGAA,OAAOC,eAAcC,EAAU,aAAc,CAC3CC,OAAO,IAETH,OAAOC,eAAeC,EAAS,UAAW,CACxCE,YAAY,EACZC,IAAK,WACH,OAAOC,EAAOC,aAClB,IAEA,IAAID,EAASE,EAAAA","x_google_ignoreList":[0]}
@@ -1,6 +1,6 @@
1
1
  import { __exports as colorManipulator } from "../../../../_virtual/colorManipulator/index.esm.js";
2
- import require$$1 from "../../../../_virtual/index/index.esm2.js";
3
- import require$$2 from "../../../../_virtual/index/index.esm3.js";
2
+ import require$$1 from "../../../../_virtual/index/index.esm9.js";
3
+ import require$$2 from "../../../../_virtual/index/index.esm10.js";
4
4
  import { i as interopRequireDefaultExports } from "../../../@babel/runtime/helpers/interopRequireDefault/index.esm.js";
5
5
  var _interopRequireDefault = interopRequireDefaultExports;
6
6
  Object.defineProperty(colorManipulator, "__esModule", {
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/colorManipulator/index.js"),r=require("../../../../_virtual/index/index2.js"),t=require("../../../../_virtual/index/index3.js"),n=require("../../../@babel/runtime/helpers/interopRequireDefault/index.js").interopRequireDefaultExports;Object.defineProperty(e.__exports,"__esModule",{value:!0});var o=e.__exports.alpha=g;e.__exports.blend=function(e,r,t,n=1){const o=(e,r)=>Math.round((e**(1/n)*(1-t)+r**(1/n)*t)**n),s=_(e),a=_(r);return x({type:"rgb",values:[o(s.values[0],a.values[0]),o(s.values[1],a.values[1]),o(s.values[2],a.values[2])]})},e.__exports.colorChannel=void 0;var s=e.__exports.darken=y;e.__exports.decomposeColor=_;var a=e.__exports.emphasize=O,l=e.__exports.getContrastRatio=function(e,r){const t=d(e),n=d(r);return(Math.max(t,n)+.05)/(Math.min(t,n)+.05)};e.__exports.getLuminance=d,e.__exports.hexToRgb=f,e.__exports.hslToRgb=v;var p=e.__exports.lighten=b;e.__exports.private_safeAlpha=function(e,r,t){try{return g(e,r)}catch(n){return t&&process.env.NODE_ENV,e}},e.__exports.private_safeColorChannel=void 0,e.__exports.private_safeDarken=function(e,r,t){try{return y(e,r)}catch(n){return t&&process.env.NODE_ENV,e}},e.__exports.private_safeEmphasize=function(e,r,t){try{return O(e,r)}catch(n){return t&&process.env.NODE_ENV,e}},e.__exports.private_safeLighten=function(e,r,t){try{return b(e,r)}catch(n){return t&&process.env.NODE_ENV,e}},e.__exports.recomposeColor=x,e.__exports.rgbToHex=function(e){if(0===e.indexOf("#"))return e;const{values:r}=_(e);return`#${r.map((e,r)=>function(e){const r=e.toString(16);return 1===r.length?`0${r}`:r}(3===r?Math.round(255*e):e)).join("")}`};var u=n(r.default),i=n(t.default);function c(e,r=0,t=1){return process.env.NODE_ENV,(0,i.default)(e,r,t)}function f(e){e=e.slice(1);const r=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let t=e.match(r);return t&&1===t[0].length&&(t=t.map(e=>e+e)),t?`rgb${4===t.length?"a":""}(${t.map((e,r)=>r<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3).join(", ")})`:""}function _(e){if(e.type)return e;if("#"===e.charAt(0))return _(f(e));const r=e.indexOf("("),t=e.substring(0,r);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(t))throw new Error("production"!==process.env.NODE_ENV?`MUI: Unsupported \`${e}\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:(0,u.default)(9,e));let n,o=e.substring(r+1,e.length-1);if("color"===t){if(o=o.split(" "),n=o.shift(),4===o.length&&"/"===o[3].charAt(0)&&(o[3]=o[3].slice(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(n))throw new Error("production"!==process.env.NODE_ENV?`MUI: unsupported \`${n}\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:(0,u.default)(10,n))}else o=o.split(",");return o=o.map(e=>parseFloat(e)),{type:t,values:o,colorSpace:n}}const h=e=>{const r=_(e);return r.values.slice(0,3).map((e,t)=>-1!==r.type.indexOf("hsl")&&0!==t?`${e}%`:e).join(" ")};function x(e){const{type:r,colorSpace:t}=e;let{values:n}=e;return-1!==r.indexOf("rgb")?n=n.map((e,r)=>r<3?parseInt(e,10):e):-1!==r.indexOf("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),n=-1!==r.indexOf("color")?`${t} ${n.join(" ")}`:`${n.join(", ")}`,`${r}(${n})`}function v(e){e=_(e);const{values:r}=e,t=r[0],n=r[1]/100,o=r[2]/100,s=n*Math.min(o,1-o),a=(e,r=(e+t/30)%12)=>o-s*Math.max(Math.min(r-3,9-r,1),-1);let l="rgb";const p=[Math.round(255*a(0)),Math.round(255*a(8)),Math.round(255*a(4))];return"hsla"===e.type&&(l+="a",p.push(r[3])),x({type:l,values:p})}function d(e){let r="hsl"===(e=_(e)).type||"hsla"===e.type?_(v(e)).values:e.values;return r=r.map(r=>("color"!==e.type&&(r/=255),r<=.03928?r/12.92:((r+.055)/1.055)**2.4)),Number((.2126*r[0]+.7152*r[1]+.0722*r[2]).toFixed(3))}function g(e,r){return e=_(e),r=c(r),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${r}`:e.values[3]=r,x(e)}function y(e,r){if(e=_(e),r=c(r),-1!==e.type.indexOf("hsl"))e.values[2]*=1-r;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let t=0;t<3;t+=1)e.values[t]*=1-r;return x(e)}function b(e,r){if(e=_(e),r=c(r),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*r;else if(-1!==e.type.indexOf("rgb"))for(let t=0;t<3;t+=1)e.values[t]+=(255-e.values[t])*r;else if(-1!==e.type.indexOf("color"))for(let t=0;t<3;t+=1)e.values[t]+=(1-e.values[t])*r;return x(e)}function O(e,r=.15){return d(e)>.5?y(e,r):b(e,r)}e.__exports.colorChannel=h,e.__exports.private_safeColorChannel=(e,r)=>{try{return h(e)}catch(t){return r&&process.env.NODE_ENV,e}},exports.default=e.__exports,exports.alpha=o,exports.darken=s,exports.emphasize=a,exports.getContrastRatio=l,exports.lighten=p;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/colorManipulator/index.js"),r=require("../../../../_virtual/index/index9.js"),t=require("../../../../_virtual/index/index10.js"),n=require("../../../@babel/runtime/helpers/interopRequireDefault/index.js").interopRequireDefaultExports;Object.defineProperty(e.__exports,"__esModule",{value:!0});var o=e.__exports.alpha=g;e.__exports.blend=function(e,r,t,n=1){const o=(e,r)=>Math.round((e**(1/n)*(1-t)+r**(1/n)*t)**n),s=_(e),a=_(r);return x({type:"rgb",values:[o(s.values[0],a.values[0]),o(s.values[1],a.values[1]),o(s.values[2],a.values[2])]})},e.__exports.colorChannel=void 0;var s=e.__exports.darken=y;e.__exports.decomposeColor=_;var a=e.__exports.emphasize=O,l=e.__exports.getContrastRatio=function(e,r){const t=d(e),n=d(r);return(Math.max(t,n)+.05)/(Math.min(t,n)+.05)};e.__exports.getLuminance=d,e.__exports.hexToRgb=f,e.__exports.hslToRgb=v;var p=e.__exports.lighten=b;e.__exports.private_safeAlpha=function(e,r,t){try{return g(e,r)}catch(n){return t&&process.env.NODE_ENV,e}},e.__exports.private_safeColorChannel=void 0,e.__exports.private_safeDarken=function(e,r,t){try{return y(e,r)}catch(n){return t&&process.env.NODE_ENV,e}},e.__exports.private_safeEmphasize=function(e,r,t){try{return O(e,r)}catch(n){return t&&process.env.NODE_ENV,e}},e.__exports.private_safeLighten=function(e,r,t){try{return b(e,r)}catch(n){return t&&process.env.NODE_ENV,e}},e.__exports.recomposeColor=x,e.__exports.rgbToHex=function(e){if(0===e.indexOf("#"))return e;const{values:r}=_(e);return`#${r.map((e,r)=>function(e){const r=e.toString(16);return 1===r.length?`0${r}`:r}(3===r?Math.round(255*e):e)).join("")}`};var u=n(r.default),i=n(t.default);function c(e,r=0,t=1){return process.env.NODE_ENV,(0,i.default)(e,r,t)}function f(e){e=e.slice(1);const r=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let t=e.match(r);return t&&1===t[0].length&&(t=t.map(e=>e+e)),t?`rgb${4===t.length?"a":""}(${t.map((e,r)=>r<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3).join(", ")})`:""}function _(e){if(e.type)return e;if("#"===e.charAt(0))return _(f(e));const r=e.indexOf("("),t=e.substring(0,r);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(t))throw new Error("production"!==process.env.NODE_ENV?`MUI: Unsupported \`${e}\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:(0,u.default)(9,e));let n,o=e.substring(r+1,e.length-1);if("color"===t){if(o=o.split(" "),n=o.shift(),4===o.length&&"/"===o[3].charAt(0)&&(o[3]=o[3].slice(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(n))throw new Error("production"!==process.env.NODE_ENV?`MUI: unsupported \`${n}\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:(0,u.default)(10,n))}else o=o.split(",");return o=o.map(e=>parseFloat(e)),{type:t,values:o,colorSpace:n}}const h=e=>{const r=_(e);return r.values.slice(0,3).map((e,t)=>-1!==r.type.indexOf("hsl")&&0!==t?`${e}%`:e).join(" ")};function x(e){const{type:r,colorSpace:t}=e;let{values:n}=e;return-1!==r.indexOf("rgb")?n=n.map((e,r)=>r<3?parseInt(e,10):e):-1!==r.indexOf("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),n=-1!==r.indexOf("color")?`${t} ${n.join(" ")}`:`${n.join(", ")}`,`${r}(${n})`}function v(e){e=_(e);const{values:r}=e,t=r[0],n=r[1]/100,o=r[2]/100,s=n*Math.min(o,1-o),a=(e,r=(e+t/30)%12)=>o-s*Math.max(Math.min(r-3,9-r,1),-1);let l="rgb";const p=[Math.round(255*a(0)),Math.round(255*a(8)),Math.round(255*a(4))];return"hsla"===e.type&&(l+="a",p.push(r[3])),x({type:l,values:p})}function d(e){let r="hsl"===(e=_(e)).type||"hsla"===e.type?_(v(e)).values:e.values;return r=r.map(r=>("color"!==e.type&&(r/=255),r<=.03928?r/12.92:((r+.055)/1.055)**2.4)),Number((.2126*r[0]+.7152*r[1]+.0722*r[2]).toFixed(3))}function g(e,r){return e=_(e),r=c(r),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${r}`:e.values[3]=r,x(e)}function y(e,r){if(e=_(e),r=c(r),-1!==e.type.indexOf("hsl"))e.values[2]*=1-r;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let t=0;t<3;t+=1)e.values[t]*=1-r;return x(e)}function b(e,r){if(e=_(e),r=c(r),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*r;else if(-1!==e.type.indexOf("rgb"))for(let t=0;t<3;t+=1)e.values[t]+=(255-e.values[t])*r;else if(-1!==e.type.indexOf("color"))for(let t=0;t<3;t+=1)e.values[t]+=(1-e.values[t])*r;return x(e)}function O(e,r=.15){return d(e)>.5?y(e,r):b(e,r)}e.__exports.colorChannel=h,e.__exports.private_safeColorChannel=(e,r)=>{try{return h(e)}catch(t){return r&&process.env.NODE_ENV,e}},exports.default=e.__exports,exports.alpha=o,exports.darken=s,exports.emphasize=a,exports.getContrastRatio=l,exports.lighten=p;
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../node_modules/@mui/system/colorManipulator.js"],"sourcesContent":["\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.alpha = alpha;\nexports.blend = blend;\nexports.colorChannel = void 0;\nexports.darken = darken;\nexports.decomposeColor = decomposeColor;\nexports.emphasize = emphasize;\nexports.getContrastRatio = getContrastRatio;\nexports.getLuminance = getLuminance;\nexports.hexToRgb = hexToRgb;\nexports.hslToRgb = hslToRgb;\nexports.lighten = lighten;\nexports.private_safeAlpha = private_safeAlpha;\nexports.private_safeColorChannel = void 0;\nexports.private_safeDarken = private_safeDarken;\nexports.private_safeEmphasize = private_safeEmphasize;\nexports.private_safeLighten = private_safeLighten;\nexports.recomposeColor = recomposeColor;\nexports.rgbToHex = rgbToHex;\nvar _formatMuiErrorMessage2 = _interopRequireDefault(require(\"@mui/utils/formatMuiErrorMessage\"));\nvar _clamp = _interopRequireDefault(require(\"@mui/utils/clamp\"));\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n * Returns a number whose value is limited to the given range.\n * @param {number} value The value to be clamped\n * @param {number} min The lower boundary of the output range\n * @param {number} max The upper boundary of the output range\n * @returns {number} A number in the range [min, max]\n */\nfunction clampWrapper(value, min = 0, max = 1) {\n if (process.env.NODE_ENV !== 'production') {\n if (value < min || value > max) {\n console.error(`MUI: The value provided ${value} is out of range [${min}, ${max}].`);\n }\n }\n return (0, _clamp.default)(value, min, max);\n}\n\n/**\n * Converts a color from CSS hex format to CSS rgb format.\n * @param {string} color - Hex color, i.e. #nnn or #nnnnnn\n * @returns {string} A CSS rgb color string\n */\nfunction hexToRgb(color) {\n color = color.slice(1);\n const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g');\n let colors = color.match(re);\n if (colors && colors[0].length === 1) {\n colors = colors.map(n => n + n);\n }\n return colors ? `rgb${colors.length === 4 ? 'a' : ''}(${colors.map((n, index) => {\n return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1000) / 1000;\n }).join(', ')})` : '';\n}\nfunction intToHex(int) {\n const hex = int.toString(16);\n return hex.length === 1 ? `0${hex}` : hex;\n}\n\n/**\n * Returns an object with the type and values of a color.\n *\n * Note: Does not support rgb % values.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @returns {object} - A MUI color object: {type: string, values: number[]}\n */\nfunction decomposeColor(color) {\n // Idempotent\n if (color.type) {\n return color;\n }\n if (color.charAt(0) === '#') {\n return decomposeColor(hexToRgb(color));\n }\n const marker = color.indexOf('(');\n const type = color.substring(0, marker);\n if (['rgb', 'rgba', 'hsl', 'hsla', 'color'].indexOf(type) === -1) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? `MUI: Unsupported \\`${color}\\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` : (0, _formatMuiErrorMessage2.default)(9, color));\n }\n let values = color.substring(marker + 1, color.length - 1);\n let colorSpace;\n if (type === 'color') {\n values = values.split(' ');\n colorSpace = values.shift();\n if (values.length === 4 && values[3].charAt(0) === '/') {\n values[3] = values[3].slice(1);\n }\n if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? `MUI: unsupported \\`${colorSpace}\\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.` : (0, _formatMuiErrorMessage2.default)(10, colorSpace));\n }\n } else {\n values = values.split(',');\n }\n values = values.map(value => parseFloat(value));\n return {\n type,\n values,\n colorSpace\n };\n}\n\n/**\n * Returns a channel created from the input color.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @returns {string} - The channel for the color, that can be used in rgba or hsla colors\n */\nconst colorChannel = color => {\n const decomposedColor = decomposeColor(color);\n return decomposedColor.values.slice(0, 3).map((val, idx) => decomposedColor.type.indexOf('hsl') !== -1 && idx !== 0 ? `${val}%` : val).join(' ');\n};\nexports.colorChannel = colorChannel;\nconst private_safeColorChannel = (color, warning) => {\n try {\n return colorChannel(color);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n};\n\n/**\n * Converts a color object with type and values to a string.\n * @param {object} color - Decomposed color\n * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color'\n * @param {array} color.values - [n,n,n] or [n,n,n,n]\n * @returns {string} A CSS color string\n */\nexports.private_safeColorChannel = private_safeColorChannel;\nfunction recomposeColor(color) {\n const {\n type,\n colorSpace\n } = color;\n let {\n values\n } = color;\n if (type.indexOf('rgb') !== -1) {\n // Only convert the first 3 values to int (i.e. not alpha)\n values = values.map((n, i) => i < 3 ? parseInt(n, 10) : n);\n } else if (type.indexOf('hsl') !== -1) {\n values[1] = `${values[1]}%`;\n values[2] = `${values[2]}%`;\n }\n if (type.indexOf('color') !== -1) {\n values = `${colorSpace} ${values.join(' ')}`;\n } else {\n values = `${values.join(', ')}`;\n }\n return `${type}(${values})`;\n}\n\n/**\n * Converts a color from CSS rgb format to CSS hex format.\n * @param {string} color - RGB color, i.e. rgb(n, n, n)\n * @returns {string} A CSS rgb color string, i.e. #nnnnnn\n */\nfunction rgbToHex(color) {\n // Idempotent\n if (color.indexOf('#') === 0) {\n return color;\n }\n const {\n values\n } = decomposeColor(color);\n return `#${values.map((n, i) => intToHex(i === 3 ? Math.round(255 * n) : n)).join('')}`;\n}\n\n/**\n * Converts a color from hsl format to rgb format.\n * @param {string} color - HSL color values\n * @returns {string} rgb color values\n */\nfunction hslToRgb(color) {\n color = decomposeColor(color);\n const {\n values\n } = color;\n const h = values[0];\n const s = values[1] / 100;\n const l = values[2] / 100;\n const a = s * Math.min(l, 1 - l);\n const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n let type = 'rgb';\n const rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];\n if (color.type === 'hsla') {\n type += 'a';\n rgb.push(values[3]);\n }\n return recomposeColor({\n type,\n values: rgb\n });\n}\n/**\n * The relative brightness of any point in a color space,\n * normalized to 0 for darkest black and 1 for lightest white.\n *\n * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @returns {number} The relative brightness of the color in the range 0 - 1\n */\nfunction getLuminance(color) {\n color = decomposeColor(color);\n let rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values;\n rgb = rgb.map(val => {\n if (color.type !== 'color') {\n val /= 255; // normalized\n }\n return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;\n });\n\n // Truncate at 3 digits\n return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));\n}\n\n/**\n * Calculates the contrast ratio between two colors.\n *\n * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests\n * @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @returns {number} A contrast ratio value in the range 0 - 21.\n */\nfunction getContrastRatio(foreground, background) {\n const lumA = getLuminance(foreground);\n const lumB = getLuminance(background);\n return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);\n}\n\n/**\n * Sets the absolute transparency of a color.\n * Any existing alpha values are overwritten.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} value - value to set the alpha channel to in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction alpha(color, value) {\n color = decomposeColor(color);\n value = clampWrapper(value);\n if (color.type === 'rgb' || color.type === 'hsl') {\n color.type += 'a';\n }\n if (color.type === 'color') {\n color.values[3] = `/${value}`;\n } else {\n color.values[3] = value;\n }\n return recomposeColor(color);\n}\nfunction private_safeAlpha(color, value, warning) {\n try {\n return alpha(color, value);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Darkens a color.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} coefficient - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction darken(color, coefficient) {\n color = decomposeColor(color);\n coefficient = clampWrapper(coefficient);\n if (color.type.indexOf('hsl') !== -1) {\n color.values[2] *= 1 - coefficient;\n } else if (color.type.indexOf('rgb') !== -1 || color.type.indexOf('color') !== -1) {\n for (let i = 0; i < 3; i += 1) {\n color.values[i] *= 1 - coefficient;\n }\n }\n return recomposeColor(color);\n}\nfunction private_safeDarken(color, coefficient, warning) {\n try {\n return darken(color, coefficient);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Lightens a color.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} coefficient - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction lighten(color, coefficient) {\n color = decomposeColor(color);\n coefficient = clampWrapper(coefficient);\n if (color.type.indexOf('hsl') !== -1) {\n color.values[2] += (100 - color.values[2]) * coefficient;\n } else if (color.type.indexOf('rgb') !== -1) {\n for (let i = 0; i < 3; i += 1) {\n color.values[i] += (255 - color.values[i]) * coefficient;\n }\n } else if (color.type.indexOf('color') !== -1) {\n for (let i = 0; i < 3; i += 1) {\n color.values[i] += (1 - color.values[i]) * coefficient;\n }\n }\n return recomposeColor(color);\n}\nfunction private_safeLighten(color, coefficient, warning) {\n try {\n return lighten(color, coefficient);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Darken or lighten a color, depending on its luminance.\n * Light colors are darkened, dark colors are lightened.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} coefficient=0.15 - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction emphasize(color, coefficient = 0.15) {\n return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient);\n}\nfunction private_safeEmphasize(color, coefficient, warning) {\n try {\n return emphasize(color, coefficient);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Blend a transparent overlay color with a background color, resulting in a single\n * RGB color.\n * @param {string} background - CSS color\n * @param {string} overlay - CSS color\n * @param {number} opacity - Opacity multiplier in the range 0 - 1\n * @param {number} [gamma=1.0] - Gamma correction factor. For gamma-correct blending, 2.2 is usual.\n */\nfunction blend(background, overlay, opacity, gamma = 1.0) {\n const blendChannel = (b, o) => Math.round((b ** (1 / gamma) * (1 - opacity) + o ** (1 / gamma) * opacity) ** gamma);\n const backgroundColor = decomposeColor(background);\n const overlayColor = decomposeColor(overlay);\n const rgb = [blendChannel(backgroundColor.values[0], overlayColor.values[0]), blendChannel(backgroundColor.values[1], overlayColor.values[1]), blendChannel(backgroundColor.values[2], overlayColor.values[2])];\n return recomposeColor({\n type: 'rgb',\n values: rgb\n });\n}"],"names":["_interopRequireDefault","require$$0","Object","defineProperty","colorManipulator","value","alpha_1","alpha","blend","background","overlay","opacity","gamma","blendChannel","b","o","Math","round","backgroundColor","decomposeColor","overlayColor","recomposeColor","type","values","colorChannel","darken_1","darken","emphasize_1","emphasize","getContrastRatio_1","getContrastRatio","foreground","lumA","getLuminance","lumB","max","min","hexToRgb","hslToRgb","lighten_1","lighten","private_safeAlpha","color","warning","error","process","env","NODE_ENV","private_safeColorChannel","private_safeDarken","coefficient","private_safeEmphasize","private_safeLighten","rgbToHex","indexOf","map","n","i","int","hex","toString","length","intToHex","join","_formatMuiErrorMessage2","require$$1","_clamp","require$$2","clampWrapper","default","slice","re","RegExp","colors","match","index","parseInt","charAt","marker","substring","Error","colorSpace","split","shift","parseFloat","decomposedColor","val","idx","h","s","l","a","f","k","rgb","push","Number","toFixed"],"mappings":"wOAEIA,4EAAyBC,6BAC7BC,OAAOC,eAAeC,EAAAA,UAAS,aAAc,CAC3CC,OAAO,IAET,IAAAC,EAAAF,EAAAA,UAAAG,MAAgBA,EAChBH,EAAAA,UAAAI,MAmWA,SAAeC,EAAYC,EAASC,EAASC,EAAQ,GACnD,MAAMC,EAAe,CAACC,EAAGC,IAAMC,KAAKC,OAAOH,IAAM,EAAIF,IAAU,EAAID,GAAWI,IAAM,EAAIH,GAASD,IAAYC,GACvGM,EAAkBC,EAAeV,GACjCW,EAAeD,EAAeT,GAEpC,OAAOW,EAAe,CACpBC,KAAM,MACNC,OAHU,CAACV,EAAaK,EAAgBK,OAAO,GAAIH,EAAaG,OAAO,IAAKV,EAAaK,EAAgBK,OAAO,GAAIH,EAAaG,OAAO,IAAKV,EAAaK,EAAgBK,OAAO,GAAIH,EAAaG,OAAO,MAK7M,EA3WAnB,EAAAA,UAAAoB,kBAAuB,EACvB,IAAAC,EAAArB,EAAAA,UAAAsB,OAAiBA,EACjBtB,EAAAA,UAAAe,eAAyBA,EACzB,IAAAQ,EAAAvB,EAAAA,UAAAwB,UAAoBA,EACpBC,EAAAzB,EAAAA,UAAA0B,iBA8NA,SAA0BC,EAAYtB,GACpC,MAAMuB,EAAOC,EAAaF,GACpBG,EAAOD,EAAaxB,GAC1B,OAAQO,KAAKmB,IAAIH,EAAME,GAAQ,MAASlB,KAAKoB,IAAIJ,EAAME,GAAQ,IACjE,EAjOA9B,EAAAA,UAAA6B,aAAuBA,EACvB7B,EAAAA,UAAAiC,SAAmBA,EACnBjC,EAAAA,UAAAkC,SAAmBA,EACnB,IAAAC,EAAAnC,EAAAA,UAAAoC,QAAkBA,EAClBpC,EAAAA,UAAAqC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B,EAAalB,IACO,IAA9BR,EAAMpB,KAAKgC,QAAQ,OACrBZ,EAAMnB,OAAO,KAAO,IAAMmB,EAAMnB,OAAO,IAAM2B,WACN,IAA9BR,EAAMpB,KAAKgC,QAAQ,OAC5B,IAAA,IAASG,EAAI,EAAGA,EAAI,EAAGA,GAAK,EAC1Bf,EAAMnB,OAAOkC,KAAO,IAAMf,EAAMnB,OAAOkC,IAAMP,WAEN,IAAhCR,EAAMpB,KAAKgC,QAAQ,SAC5B,IAAA,IAASG,EAAI,EAAGA,EAAI,EAAGA,GAAK,EAC1Bf,EAAMnB,OAAOkC,KAAO,EAAIf,EAAMnB,OAAOkC,IAAMP,EAG/C,OAAO7B,EAAeqB,EACxB,CAmBA,SAASd,EAAUc,EAAOQ,EAAc,KACtC,OAAOjB,EAAaS,GAAS,GAAMhB,EAAOgB,EAAOQ,GAAeV,EAAQE,EAAOQ,EACjF,CA/NA9C,EAAAA,UAAAoB,aAAuBA,EAmBvBpB,EAAAA,UAAA4C,yBAlBiC,CAACN,EAAOC,KACvC,IACE,OAAOnB,EAAakB,EACxB,OAAWE,GAIP,OAHID,GAAWE,QAAQC,IAAIC,SAGpBL,CACX","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.js","sources":["../../../../../node_modules/@mui/system/colorManipulator.js"],"sourcesContent":["\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.alpha = alpha;\nexports.blend = blend;\nexports.colorChannel = void 0;\nexports.darken = darken;\nexports.decomposeColor = decomposeColor;\nexports.emphasize = emphasize;\nexports.getContrastRatio = getContrastRatio;\nexports.getLuminance = getLuminance;\nexports.hexToRgb = hexToRgb;\nexports.hslToRgb = hslToRgb;\nexports.lighten = lighten;\nexports.private_safeAlpha = private_safeAlpha;\nexports.private_safeColorChannel = void 0;\nexports.private_safeDarken = private_safeDarken;\nexports.private_safeEmphasize = private_safeEmphasize;\nexports.private_safeLighten = private_safeLighten;\nexports.recomposeColor = recomposeColor;\nexports.rgbToHex = rgbToHex;\nvar _formatMuiErrorMessage2 = _interopRequireDefault(require(\"@mui/utils/formatMuiErrorMessage\"));\nvar _clamp = _interopRequireDefault(require(\"@mui/utils/clamp\"));\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n * Returns a number whose value is limited to the given range.\n * @param {number} value The value to be clamped\n * @param {number} min The lower boundary of the output range\n * @param {number} max The upper boundary of the output range\n * @returns {number} A number in the range [min, max]\n */\nfunction clampWrapper(value, min = 0, max = 1) {\n if (process.env.NODE_ENV !== 'production') {\n if (value < min || value > max) {\n console.error(`MUI: The value provided ${value} is out of range [${min}, ${max}].`);\n }\n }\n return (0, _clamp.default)(value, min, max);\n}\n\n/**\n * Converts a color from CSS hex format to CSS rgb format.\n * @param {string} color - Hex color, i.e. #nnn or #nnnnnn\n * @returns {string} A CSS rgb color string\n */\nfunction hexToRgb(color) {\n color = color.slice(1);\n const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g');\n let colors = color.match(re);\n if (colors && colors[0].length === 1) {\n colors = colors.map(n => n + n);\n }\n return colors ? `rgb${colors.length === 4 ? 'a' : ''}(${colors.map((n, index) => {\n return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1000) / 1000;\n }).join(', ')})` : '';\n}\nfunction intToHex(int) {\n const hex = int.toString(16);\n return hex.length === 1 ? `0${hex}` : hex;\n}\n\n/**\n * Returns an object with the type and values of a color.\n *\n * Note: Does not support rgb % values.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @returns {object} - A MUI color object: {type: string, values: number[]}\n */\nfunction decomposeColor(color) {\n // Idempotent\n if (color.type) {\n return color;\n }\n if (color.charAt(0) === '#') {\n return decomposeColor(hexToRgb(color));\n }\n const marker = color.indexOf('(');\n const type = color.substring(0, marker);\n if (['rgb', 'rgba', 'hsl', 'hsla', 'color'].indexOf(type) === -1) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? `MUI: Unsupported \\`${color}\\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` : (0, _formatMuiErrorMessage2.default)(9, color));\n }\n let values = color.substring(marker + 1, color.length - 1);\n let colorSpace;\n if (type === 'color') {\n values = values.split(' ');\n colorSpace = values.shift();\n if (values.length === 4 && values[3].charAt(0) === '/') {\n values[3] = values[3].slice(1);\n }\n if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? `MUI: unsupported \\`${colorSpace}\\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.` : (0, _formatMuiErrorMessage2.default)(10, colorSpace));\n }\n } else {\n values = values.split(',');\n }\n values = values.map(value => parseFloat(value));\n return {\n type,\n values,\n colorSpace\n };\n}\n\n/**\n * Returns a channel created from the input color.\n *\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @returns {string} - The channel for the color, that can be used in rgba or hsla colors\n */\nconst colorChannel = color => {\n const decomposedColor = decomposeColor(color);\n return decomposedColor.values.slice(0, 3).map((val, idx) => decomposedColor.type.indexOf('hsl') !== -1 && idx !== 0 ? `${val}%` : val).join(' ');\n};\nexports.colorChannel = colorChannel;\nconst private_safeColorChannel = (color, warning) => {\n try {\n return colorChannel(color);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n};\n\n/**\n * Converts a color object with type and values to a string.\n * @param {object} color - Decomposed color\n * @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color'\n * @param {array} color.values - [n,n,n] or [n,n,n,n]\n * @returns {string} A CSS color string\n */\nexports.private_safeColorChannel = private_safeColorChannel;\nfunction recomposeColor(color) {\n const {\n type,\n colorSpace\n } = color;\n let {\n values\n } = color;\n if (type.indexOf('rgb') !== -1) {\n // Only convert the first 3 values to int (i.e. not alpha)\n values = values.map((n, i) => i < 3 ? parseInt(n, 10) : n);\n } else if (type.indexOf('hsl') !== -1) {\n values[1] = `${values[1]}%`;\n values[2] = `${values[2]}%`;\n }\n if (type.indexOf('color') !== -1) {\n values = `${colorSpace} ${values.join(' ')}`;\n } else {\n values = `${values.join(', ')}`;\n }\n return `${type}(${values})`;\n}\n\n/**\n * Converts a color from CSS rgb format to CSS hex format.\n * @param {string} color - RGB color, i.e. rgb(n, n, n)\n * @returns {string} A CSS rgb color string, i.e. #nnnnnn\n */\nfunction rgbToHex(color) {\n // Idempotent\n if (color.indexOf('#') === 0) {\n return color;\n }\n const {\n values\n } = decomposeColor(color);\n return `#${values.map((n, i) => intToHex(i === 3 ? Math.round(255 * n) : n)).join('')}`;\n}\n\n/**\n * Converts a color from hsl format to rgb format.\n * @param {string} color - HSL color values\n * @returns {string} rgb color values\n */\nfunction hslToRgb(color) {\n color = decomposeColor(color);\n const {\n values\n } = color;\n const h = values[0];\n const s = values[1] / 100;\n const l = values[2] / 100;\n const a = s * Math.min(l, 1 - l);\n const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n let type = 'rgb';\n const rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];\n if (color.type === 'hsla') {\n type += 'a';\n rgb.push(values[3]);\n }\n return recomposeColor({\n type,\n values: rgb\n });\n}\n/**\n * The relative brightness of any point in a color space,\n * normalized to 0 for darkest black and 1 for lightest white.\n *\n * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @returns {number} The relative brightness of the color in the range 0 - 1\n */\nfunction getLuminance(color) {\n color = decomposeColor(color);\n let rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values;\n rgb = rgb.map(val => {\n if (color.type !== 'color') {\n val /= 255; // normalized\n }\n return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;\n });\n\n // Truncate at 3 digits\n return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));\n}\n\n/**\n * Calculates the contrast ratio between two colors.\n *\n * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests\n * @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()\n * @returns {number} A contrast ratio value in the range 0 - 21.\n */\nfunction getContrastRatio(foreground, background) {\n const lumA = getLuminance(foreground);\n const lumB = getLuminance(background);\n return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);\n}\n\n/**\n * Sets the absolute transparency of a color.\n * Any existing alpha values are overwritten.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} value - value to set the alpha channel to in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction alpha(color, value) {\n color = decomposeColor(color);\n value = clampWrapper(value);\n if (color.type === 'rgb' || color.type === 'hsl') {\n color.type += 'a';\n }\n if (color.type === 'color') {\n color.values[3] = `/${value}`;\n } else {\n color.values[3] = value;\n }\n return recomposeColor(color);\n}\nfunction private_safeAlpha(color, value, warning) {\n try {\n return alpha(color, value);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Darkens a color.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} coefficient - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction darken(color, coefficient) {\n color = decomposeColor(color);\n coefficient = clampWrapper(coefficient);\n if (color.type.indexOf('hsl') !== -1) {\n color.values[2] *= 1 - coefficient;\n } else if (color.type.indexOf('rgb') !== -1 || color.type.indexOf('color') !== -1) {\n for (let i = 0; i < 3; i += 1) {\n color.values[i] *= 1 - coefficient;\n }\n }\n return recomposeColor(color);\n}\nfunction private_safeDarken(color, coefficient, warning) {\n try {\n return darken(color, coefficient);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Lightens a color.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} coefficient - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction lighten(color, coefficient) {\n color = decomposeColor(color);\n coefficient = clampWrapper(coefficient);\n if (color.type.indexOf('hsl') !== -1) {\n color.values[2] += (100 - color.values[2]) * coefficient;\n } else if (color.type.indexOf('rgb') !== -1) {\n for (let i = 0; i < 3; i += 1) {\n color.values[i] += (255 - color.values[i]) * coefficient;\n }\n } else if (color.type.indexOf('color') !== -1) {\n for (let i = 0; i < 3; i += 1) {\n color.values[i] += (1 - color.values[i]) * coefficient;\n }\n }\n return recomposeColor(color);\n}\nfunction private_safeLighten(color, coefficient, warning) {\n try {\n return lighten(color, coefficient);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Darken or lighten a color, depending on its luminance.\n * Light colors are darkened, dark colors are lightened.\n * @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n * @param {number} coefficient=0.15 - multiplier in the range 0 - 1\n * @returns {string} A CSS color string. Hex input values are returned as rgb\n */\nfunction emphasize(color, coefficient = 0.15) {\n return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient);\n}\nfunction private_safeEmphasize(color, coefficient, warning) {\n try {\n return emphasize(color, coefficient);\n } catch (error) {\n if (warning && process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n return color;\n }\n}\n\n/**\n * Blend a transparent overlay color with a background color, resulting in a single\n * RGB color.\n * @param {string} background - CSS color\n * @param {string} overlay - CSS color\n * @param {number} opacity - Opacity multiplier in the range 0 - 1\n * @param {number} [gamma=1.0] - Gamma correction factor. For gamma-correct blending, 2.2 is usual.\n */\nfunction blend(background, overlay, opacity, gamma = 1.0) {\n const blendChannel = (b, o) => Math.round((b ** (1 / gamma) * (1 - opacity) + o ** (1 / gamma) * opacity) ** gamma);\n const backgroundColor = decomposeColor(background);\n const overlayColor = decomposeColor(overlay);\n const rgb = [blendChannel(backgroundColor.values[0], overlayColor.values[0]), blendChannel(backgroundColor.values[1], overlayColor.values[1]), blendChannel(backgroundColor.values[2], overlayColor.values[2])];\n return recomposeColor({\n type: 'rgb',\n values: rgb\n });\n}"],"names":["_interopRequireDefault","require$$0","Object","defineProperty","colorManipulator","value","alpha_1","alpha","blend","background","overlay","opacity","gamma","blendChannel","b","o","Math","round","backgroundColor","decomposeColor","overlayColor","recomposeColor","type","values","colorChannel","darken_1","darken","emphasize_1","emphasize","getContrastRatio_1","getContrastRatio","foreground","lumA","getLuminance","lumB","max","min","hexToRgb","hslToRgb","lighten_1","lighten","private_safeAlpha","color","warning","error","process","env","NODE_ENV","private_safeColorChannel","private_safeDarken","coefficient","private_safeEmphasize","private_safeLighten","rgbToHex","indexOf","map","n","i","int","hex","toString","length","intToHex","join","_formatMuiErrorMessage2","require$$1","_clamp","require$$2","clampWrapper","default","slice","re","RegExp","colors","match","index","parseInt","charAt","marker","substring","Error","colorSpace","split","shift","parseFloat","decomposedColor","val","idx","h","s","l","a","f","k","rgb","push","Number","toFixed"],"mappings":"yOAEIA,4EAAyBC,6BAC7BC,OAAOC,eAAeC,EAAAA,UAAS,aAAc,CAC3CC,OAAO,IAET,IAAAC,EAAAF,EAAAA,UAAAG,MAAg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,QAAQ,SAC5B,IAAA,IAASG,EAAI,EAAGA,EAAI,EAAGA,GAAK,EAC1Bf,EAAMnB,OAAOkC,KAAO,EAAIf,EAAMnB,OAAOkC,IAAMP,EAG/C,OAAO7B,EAAeqB,EACxB,CAmBA,SAASd,EAAUc,EAAOQ,EAAc,KACtC,OAAOjB,EAAaS,GAAS,GAAMhB,EAAOgB,EAAOQ,GAAeV,EAAQE,EAAOQ,EACjF,CA/NA9C,EAAAA,UAAAoB,aAAuBA,EAmBvBpB,EAAAA,UAAA4C,yBAlBiC,CAACN,EAAOC,KACvC,IACE,OAAOnB,EAAakB,EACxB,OAAWE,GAIP,OAHID,GAAWE,QAAQC,IAAIC,SAGpBL,CACX","x_google_ignoreList":[0]}
@@ -1,12 +1,12 @@
1
1
  import { __exports as createStyled$1 } from "../../../../_virtual/createStyled/index.esm.js";
2
2
  import { __require as require_extends } from "../../../@babel/runtime/helpers/extends/index.esm.js";
3
3
  import { __require as requireObjectWithoutPropertiesLoose } from "../../../@babel/runtime/helpers/objectWithoutPropertiesLoose/index.esm.js";
4
- import require$$1 from "../../../../_virtual/index/index.esm4.js";
5
- import require$$4 from "../../../../_virtual/index/index.esm5.js";
6
- import require$$5 from "../../../../_virtual/index/index.esm6.js";
7
- import require$$6 from "../../../../_virtual/index/index.esm7.js";
8
- import require$$7 from "../../../../_virtual/index/index.esm8.js";
9
- import require$$8 from "../../../../_virtual/index/index.esm9.js";
4
+ import require$$1 from "../../../../_virtual/index/index.esm2.js";
5
+ import require$$4 from "../../../../_virtual/index/index.esm3.js";
6
+ import require$$5 from "../../../../_virtual/index/index.esm4.js";
7
+ import require$$6 from "../../../../_virtual/index/index.esm5.js";
8
+ import require$$7 from "../../../../_virtual/index/index.esm6.js";
9
+ import require$$8 from "../../../../_virtual/index/index.esm7.js";
10
10
  import { i as interopRequireDefaultExports } from "../../../@babel/runtime/helpers/interopRequireDefault/index.esm.js";
11
11
  var _interopRequireDefault = interopRequireDefaultExports;
12
12
  Object.defineProperty(createStyled$1, "__esModule", {
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/createStyled/index.js"),t=require("../../../@babel/runtime/helpers/extends/index.js"),r=require("../../../@babel/runtime/helpers/objectWithoutPropertiesLoose/index.js"),o=require("../../../../_virtual/index/index4.js"),n=require("../../../../_virtual/index/index5.js"),s=require("../../../../_virtual/index/index6.js"),a=require("../../../../_virtual/index/index7.js"),i=require("../../../../_virtual/index/index8.js"),u=require("../../../../_virtual/index/index9.js"),l=require("../../../@babel/runtime/helpers/interopRequireDefault/index.js").interopRequireDefaultExports;Object.defineProperty(e.__exports,"__esModule",{value:!0});var d=e.__exports.default=function(e={}){const{themeId:t,defaultTheme:r=q,rootShouldForwardProp:o=S,slotShouldForwardProp:n=S}=e,s=e=>(0,v.default)((0,f.default)({},e,{theme:g((0,f.default)({},e,{defaultTheme:r,themeId:t}))}));return s.__mui_systemSx=!0,(e,a={})=>{(0,c.internal_processStyles)(e,e=>e.filter(e=>!(null!=e&&e.__mui_systemSx)));const{name:i,slot:u,skipVariantsResolver:l,skipSx:d,overridesResolver:_=A(P(u))}=a,v=(0,p.default)(a,w),x=i&&i.startsWith("Mui")||u?"components":"custom",j=void 0!==l?l:u&&"Root"!==u&&"root"!==u||!1,b=d||!1;let O;"production"!==process.env.NODE_ENV&&i&&(O=`${i}-${P(u||"Root")}`);let q=S;"Root"===u||"root"===u?q=o:u?q=n:function(e){return"string"==typeof e&&e.charCodeAt(0)>96}(e)&&(q=void 0);const R=(0,c.default)(e,(0,f.default)({shouldForwardProp:q,label:O},v)),C=e=>"function"==typeof e&&e.__emotion_real!==e||(0,m.isPlainObject)(e)?o=>{const n=g({theme:o.theme,defaultTheme:r,themeId:t});return k(e,(0,f.default)({},o,{theme:n}),n.modularCssLayers?x:void 0)}:e,D=(o,...n)=>{let a=C(o);const l=n?n.map(C):[];i&&_&&l.push(e=>{const o=g((0,f.default)({},e,{defaultTheme:r,themeId:t}));if(!o.components||!o.components[i]||!o.components[i].styleOverrides)return null;const n=o.components[i].styleOverrides,s={};return Object.entries(n).forEach(([t,r])=>{s[t]=k(r,(0,f.default)({},e,{theme:o}),o.modularCssLayers?"theme":void 0)}),_(e,s)}),i&&!j&&l.push(e=>{var o;const n=g((0,f.default)({},e,{defaultTheme:r,themeId:t}));return k({variants:null==n||null==(o=n.components)||null==(o=o[i])?void 0:o.variants},(0,f.default)({},e,{theme:n}),n.modularCssLayers?"theme":void 0)}),b||l.push(s);const d=l.length-n.length;if(Array.isArray(o)&&d>0){const e=new Array(d).fill("");a=[...o,...e],a.raw=[...o.raw,...e]}const p=R(a,...l);if("production"!==process.env.NODE_ENV){let t;i&&(t=`${i}${(0,y.default)(u||"")}`),void 0===t&&(t=`Styled(${(0,h.default)(e)})`),p.displayName=t}return e.muiName&&(p.muiName=e.muiName),p};return R.withConfig&&(D.withConfig=R.withConfig),D}};e.__exports.shouldForwardProp=S,e.__exports.systemDefaultTheme=void 0;var f=l(t.__require()),p=l(r.__require()),c=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=b(void 0);if(t&&t.has(e))return t.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if("default"!==n&&Object.prototype.hasOwnProperty.call(e,n)){var s=o?Object.getOwnPropertyDescriptor(e,n):null;s&&(s.get||s.set)?Object.defineProperty(r,n,s):r[n]=e[n]}return r.default=e,t&&t.set(e,r),r}(o.default),m=n.default,y=l(s.default),h=l(a.default),_=l(i.default),v=l(u.default);const x=["ownerState"],j=["variants"],w=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function b(e){if("function"!=typeof WeakMap)return null;var t=/* @__PURE__ */new WeakMap,r=/* @__PURE__ */new WeakMap;return(b=function(e){return e?r:t})(e)}function S(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}function O(e,t){return t&&e&&"object"==typeof e&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}const q=e.__exports.systemDefaultTheme=(0,_.default)(),P=e=>e?e.charAt(0).toLowerCase()+e.slice(1):e;function g({defaultTheme:e,theme:t,themeId:r}){return o=t,0===Object.keys(o).length?e:t[r]||t;var o}function A(e){return e?(t,r)=>r[e]:null}function k(e,t,r){let{ownerState:o}=t,n=(0,p.default)(t,x);const s="function"==typeof e?e((0,f.default)({ownerState:o},n)):e;if(Array.isArray(s))return s.flatMap(e=>k(e,(0,f.default)({ownerState:o},n),r));if(s&&"object"==typeof s&&Array.isArray(s.variants)){const{variants:e=[]}=s;let t=(0,p.default)(s,j);return e.forEach(e=>{let s=!0;if("function"==typeof e.props?s=e.props((0,f.default)({ownerState:o},n,o)):Object.keys(e.props).forEach(t=>{(null==o?void 0:o[t])!==e.props[t]&&n[t]!==e.props[t]&&(s=!1)}),s){Array.isArray(t)||(t=[t]);const s="function"==typeof e.style?e.style((0,f.default)({ownerState:o},n,o)):e.style;t.push(r?O((0,c.internal_serializeStyles)(s),r):s)}}),t}return r?O((0,c.internal_serializeStyles)(s),r):s}exports.default=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/createStyled/index.js"),t=require("../../../@babel/runtime/helpers/extends/index.js"),r=require("../../../@babel/runtime/helpers/objectWithoutPropertiesLoose/index.js"),o=require("../../../../_virtual/index/index2.js"),n=require("../../../../_virtual/index/index3.js"),s=require("../../../../_virtual/index/index4.js"),a=require("../../../../_virtual/index/index5.js"),i=require("../../../../_virtual/index/index6.js"),u=require("../../../../_virtual/index/index7.js"),l=require("../../../@babel/runtime/helpers/interopRequireDefault/index.js").interopRequireDefaultExports;Object.defineProperty(e.__exports,"__esModule",{value:!0});var d=e.__exports.default=function(e={}){const{themeId:t,defaultTheme:r=q,rootShouldForwardProp:o=S,slotShouldForwardProp:n=S}=e,s=e=>(0,v.default)((0,f.default)({},e,{theme:g((0,f.default)({},e,{defaultTheme:r,themeId:t}))}));return s.__mui_systemSx=!0,(e,a={})=>{(0,c.internal_processStyles)(e,e=>e.filter(e=>!(null!=e&&e.__mui_systemSx)));const{name:i,slot:u,skipVariantsResolver:l,skipSx:d,overridesResolver:_=A(P(u))}=a,v=(0,p.default)(a,w),x=i&&i.startsWith("Mui")||u?"components":"custom",j=void 0!==l?l:u&&"Root"!==u&&"root"!==u||!1,b=d||!1;let O;"production"!==process.env.NODE_ENV&&i&&(O=`${i}-${P(u||"Root")}`);let q=S;"Root"===u||"root"===u?q=o:u?q=n:function(e){return"string"==typeof e&&e.charCodeAt(0)>96}(e)&&(q=void 0);const R=(0,c.default)(e,(0,f.default)({shouldForwardProp:q,label:O},v)),C=e=>"function"==typeof e&&e.__emotion_real!==e||(0,m.isPlainObject)(e)?o=>{const n=g({theme:o.theme,defaultTheme:r,themeId:t});return k(e,(0,f.default)({},o,{theme:n}),n.modularCssLayers?x:void 0)}:e,D=(o,...n)=>{let a=C(o);const l=n?n.map(C):[];i&&_&&l.push(e=>{const o=g((0,f.default)({},e,{defaultTheme:r,themeId:t}));if(!o.components||!o.components[i]||!o.components[i].styleOverrides)return null;const n=o.components[i].styleOverrides,s={};return Object.entries(n).forEach(([t,r])=>{s[t]=k(r,(0,f.default)({},e,{theme:o}),o.modularCssLayers?"theme":void 0)}),_(e,s)}),i&&!j&&l.push(e=>{var o;const n=g((0,f.default)({},e,{defaultTheme:r,themeId:t}));return k({variants:null==n||null==(o=n.components)||null==(o=o[i])?void 0:o.variants},(0,f.default)({},e,{theme:n}),n.modularCssLayers?"theme":void 0)}),b||l.push(s);const d=l.length-n.length;if(Array.isArray(o)&&d>0){const e=new Array(d).fill("");a=[...o,...e],a.raw=[...o.raw,...e]}const p=R(a,...l);if("production"!==process.env.NODE_ENV){let t;i&&(t=`${i}${(0,y.default)(u||"")}`),void 0===t&&(t=`Styled(${(0,h.default)(e)})`),p.displayName=t}return e.muiName&&(p.muiName=e.muiName),p};return R.withConfig&&(D.withConfig=R.withConfig),D}};e.__exports.shouldForwardProp=S,e.__exports.systemDefaultTheme=void 0;var f=l(t.__require()),p=l(r.__require()),c=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=b(void 0);if(t&&t.has(e))return t.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if("default"!==n&&Object.prototype.hasOwnProperty.call(e,n)){var s=o?Object.getOwnPropertyDescriptor(e,n):null;s&&(s.get||s.set)?Object.defineProperty(r,n,s):r[n]=e[n]}return r.default=e,t&&t.set(e,r),r}(o.default),m=n.default,y=l(s.default),h=l(a.default),_=l(i.default),v=l(u.default);const x=["ownerState"],j=["variants"],w=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function b(e){if("function"!=typeof WeakMap)return null;var t=/* @__PURE__ */new WeakMap,r=/* @__PURE__ */new WeakMap;return(b=function(e){return e?r:t})(e)}function S(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}function O(e,t){return t&&e&&"object"==typeof e&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}const q=e.__exports.systemDefaultTheme=(0,_.default)(),P=e=>e?e.charAt(0).toLowerCase()+e.slice(1):e;function g({defaultTheme:e,theme:t,themeId:r}){return o=t,0===Object.keys(o).length?e:t[r]||t;var o}function A(e){return e?(t,r)=>r[e]:null}function k(e,t,r){let{ownerState:o}=t,n=(0,p.default)(t,x);const s="function"==typeof e?e((0,f.default)({ownerState:o},n)):e;if(Array.isArray(s))return s.flatMap(e=>k(e,(0,f.default)({ownerState:o},n),r));if(s&&"object"==typeof s&&Array.isArray(s.variants)){const{variants:e=[]}=s;let t=(0,p.default)(s,j);return e.forEach(e=>{let s=!0;if("function"==typeof e.props?s=e.props((0,f.default)({ownerState:o},n,o)):Object.keys(e.props).forEach(t=>{(null==o?void 0:o[t])!==e.props[t]&&n[t]!==e.props[t]&&(s=!1)}),s){Array.isArray(t)||(t=[t]);const s="function"==typeof e.style?e.style((0,f.default)({ownerState:o},n,o)):e.style;t.push(r?O((0,c.internal_serializeStyles)(s),r):s)}}),t}return r?O((0,c.internal_serializeStyles)(s),r):s}exports.default=d;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { __exports as useThemeWithoutDefault } from "../../../../_virtual/useThemeWithoutDefault/index.esm.js";
2
- import require$$1 from "../../../../_virtual/index/index.esm4.js";
2
+ import require$$1 from "../../../../_virtual/index/index.esm2.js";
3
3
  import React__default from "react";
4
4
  Object.defineProperty(useThemeWithoutDefault, "__esModule", {
5
5
  value: true
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/useThemeWithoutDefault/index.js"),t=require("../../../../_virtual/index/index4.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/* @__PURE__ */r(require("react"));Object.defineProperty(e.__exports,"__esModule",{value:!0}),exports.default=e.__exports.default=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=a(void 0);if(t&&t.has(e))return t.get(e);var r={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if("default"!==n&&Object.prototype.hasOwnProperty.call(e,n)){var o=u?Object.getOwnPropertyDescriptor(e,n):null;o&&(o.get||o.set)?Object.defineProperty(r,n,o):r[n]=e[n]}return r.default=e,t&&t.set(e,r),r}(u.default),o=t.default;function a(e){if("function"!=typeof WeakMap)return null;var t=/* @__PURE__ */new WeakMap,r=/* @__PURE__ */new WeakMap;return(a=function(e){return e?r:t})(e)}exports.default=e.__exports.default=function(e=null){const t=n.useContext(o.ThemeContext);return t&&(r=t,0!==Object.keys(r).length)?t:e;var r};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/useThemeWithoutDefault/index.js"),t=require("../../../../_virtual/index/index2.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/* @__PURE__ */r(require("react"));Object.defineProperty(e.__exports,"__esModule",{value:!0}),exports.default=e.__exports.default=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=a(void 0);if(t&&t.has(e))return t.get(e);var r={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if("default"!==n&&Object.prototype.hasOwnProperty.call(e,n)){var o=u?Object.getOwnPropertyDescriptor(e,n):null;o&&(o.get||o.set)?Object.defineProperty(r,n,o):r[n]=e[n]}return r.default=e,t&&t.set(e,r),r}(u.default),o=t.default;function a(e){if("function"!=typeof WeakMap)return null;var t=/* @__PURE__ */new WeakMap,r=/* @__PURE__ */new WeakMap;return(a=function(e){return e?r:t})(e)}exports.default=e.__exports.default=function(e=null){const t=n.useContext(o.ThemeContext);return t&&(r=t,0!==Object.keys(r).length)?t:e;var r};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { getDefaultExportFromCjs } from "../../../_virtual/_commonjsHelpers/index.esm.js";
2
- import { __module as propTypes } from "../../../_virtual/index/index.esm.js";
2
+ import { __module as propTypes } from "../../../_virtual/index/index.esm8.js";
3
3
  import { __require as requireFactoryWithTypeCheckers } from "../factoryWithTypeCheckers/index.esm.js";
4
4
  import { __require as requireFactoryWithThrowingShims } from "../factoryWithThrowingShims/index.esm.js";
5
5
  import require$$0 from "react-is";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_commonjsHelpers/index.js"),r=require("../../../_virtual/index/index.js"),t=require("../factoryWithTypeCheckers/index.js"),i=require("../factoryWithThrowingShims/index.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/* @__PURE__ */o(require("react-is"));if("production"!==process.env.NODE_ENV){var s=u.default;r.__module.exports=t.__require()(s.isElement,!0)}else r.__module.exports=i.__require()();var _=r.__module.exports,a=/* @__PURE__ */e.getDefaultExportFromCjs(_);exports.default=a;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_commonjsHelpers/index.js"),r=require("../../../_virtual/index/index8.js"),t=require("../factoryWithTypeCheckers/index.js"),i=require("../factoryWithThrowingShims/index.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/* @__PURE__ */o(require("react-is"));if("production"!==process.env.NODE_ENV){var s=u.default;r.__module.exports=t.__require()(s.isElement,!0)}else r.__module.exports=i.__require()();var _=r.__module.exports,a=/* @__PURE__ */e.getDefaultExportFromCjs(_);exports.default=a;
2
2
  //# sourceMappingURL=index.js.map