import { PERMISSIONS, getTrad } from "./chunk-ALMC553V.js"; import "./chunk-QF6GPHA4.js"; import "./chunk-JRLAXHTE.js"; import "./chunk-E4IFZ6ZT.js"; import { useMutation, useQuery } from "./chunk-QLEKUQKW.js"; import "./chunk-4J3VOWQV.js"; import "./chunk-PFI4R5WA.js"; import "./chunk-B3BGMYGX.js"; import "./chunk-W6ICJ5TB.js"; import "./chunk-IHYIPMY2.js"; import "./chunk-UWHSN2C7.js"; import "./chunk-ERK7O2GM.js"; import { useFetchClient } from "./chunk-FCIM6RNO.js"; import "./chunk-J33IXKN4.js"; import "./chunk-NP53ZCXD.js"; import "./chunk-KFLQQE5L.js"; import "./chunk-ED4XR3VQ.js"; import "./chunk-MBK4V2X7.js"; import "./chunk-5ESYXDTN.js"; import "./chunk-K65KIEAL.js"; import "./chunk-B7ZLODDO.js"; import "./chunk-PW7XKCYO.js"; import { require_set } from "./chunk-RMBEU7DO.js"; import "./chunk-RI2W2UZ6.js"; import "./chunk-IY256CNP.js"; import "./chunk-IFOFBKTA.js"; import "./chunk-XLSIZGJF.js"; import "./chunk-EGNP2T5O.js"; import "./chunk-GSN7U3BK.js"; import "./chunk-T3B5F2LV.js"; import "./chunk-YXDCVYVT.js"; import "./chunk-QIJGNK42.js"; import "./chunk-7PUJSL55.js"; import "./chunk-C2ZJTFO7.js"; import "./chunk-C75BZXCZ.js"; import "./chunk-APGTER6B.js"; import "./chunk-ZM6TT53G.js"; import "./chunk-6AXVGFVQ.js"; import "./chunk-BFLP6DBI.js"; import "./chunk-CMLQV3Z2.js"; import "./chunk-D4WYVNVM.js"; import "./chunk-MMOBCIZG.js"; import "./chunk-IGCTEXRF.js"; import { Layouts } from "./chunk-TIVRAWTC.js"; import "./chunk-PQINNV4N.js"; import { require_isEqual } from "./chunk-VYSYYPOB.js"; import { Page } from "./chunk-5CAWUBTQ.js"; import "./chunk-W2TBR6J3.js"; import "./chunk-QEGMJR7H.js"; import { require_lib } from "./chunk-LCL5TIBZ.js"; import "./chunk-WOQNBAGN.js"; import "./chunk-BHLYCXQ7.js"; import "./chunk-76QM3EFM.js"; import "./chunk-CE4VABH2.js"; import { fn } from "./chunk-5VODLFKF.js"; import { useNotification } from "./chunk-N55RVBRV.js"; import { Box, Button, Field, Flex, Grid, Toggle, Typography, useIntl } from "./chunk-7XB6XSWQ.js"; import "./chunk-5ZC4PE57.js"; import "./chunk-TUXTO2Z5.js"; import "./chunk-FOD4ENRR.js"; import { ForwardRef$4F } from "./chunk-WRD5KPDH.js"; import { require_jsx_runtime } from "./chunk-NIAJZ5MX.js"; import "./chunk-ACIMPXWY.js"; import { require_react } from "./chunk-MADUDGYZ.js"; import { __toESM } from "./chunk-PLDDJCW6.js"; // node_modules/@strapi/upload/dist/admin/pages/SettingsPage/SettingsPage.mjs var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); var React = __toESM(require_react(), 1); var import_isEqual = __toESM(require_isEqual(), 1); var import_qs = __toESM(require_lib(), 1); // node_modules/@strapi/upload/dist/admin/pages/SettingsPage/init.mjs var init = (initialState2) => { return initialState2; }; // node_modules/@strapi/upload/dist/admin/pages/SettingsPage/reducer.mjs var import_set = __toESM(require_set(), 1); var initialState = { initialData: { responsiveDimensions: true, sizeOptimization: true, autoOrientation: false, videoPreview: false }, modifiedData: { responsiveDimensions: true, sizeOptimization: true, autoOrientation: false, videoPreview: false } }; var reducer = (state, action) => fn(state, (drafState) => { switch (action.type) { case "GET_DATA_SUCCEEDED": { drafState.initialData = action.data; drafState.modifiedData = action.data; break; } case "ON_CHANGE": { (0, import_set.default)(drafState, [ "modifiedData", ...action.keys.split(".") ], action.value); break; } default: return state; } }); // node_modules/@strapi/upload/dist/admin/pages/SettingsPage/SettingsPage.mjs var SettingsPage = () => { const { formatMessage } = useIntl(); const { toggleNotification } = useNotification(); const { get, put } = useFetchClient(); const [{ initialData, modifiedData }, dispatch] = React.useReducer(reducer, initialState, init); const { data, isLoading, refetch } = useQuery({ queryKey: [ "upload", "settings" ], async queryFn() { const { data: { data: data2 } } = await get("/upload/settings"); return data2; } }); React.useEffect(() => { if (data) { dispatch({ type: "GET_DATA_SUCCEEDED", data }); } }, [ data ]); const isSaveButtonDisabled = (0, import_isEqual.default)(initialData, modifiedData); const { mutateAsync, isLoading: isSubmitting } = useMutation(async (body) => { const { data: data2 } = await put("/upload/settings", body); return data2; }, { onSuccess() { refetch(); toggleNotification({ type: "success", message: formatMessage({ id: "notification.form.success.fields" }) }); }, onError(err) { console.error(err); } }); const handleSubmit = async (e) => { e.preventDefault(); if (isSaveButtonDisabled) { return; } await mutateAsync(modifiedData); }; const handleChange = ({ target: { name, value } }) => { dispatch({ type: "ON_CHANGE", keys: name, value }); }; if (isLoading) { return (0, import_jsx_runtime.jsx)(Page.Loading, {}); } return (0, import_jsx_runtime.jsxs)(Page.Main, { tabIndex: -1, children: [ (0, import_jsx_runtime.jsx)(Page.Title, { children: formatMessage({ id: getTrad("page.title"), defaultMessage: "Settings - Media Libray" }) }), (0, import_jsx_runtime.jsxs)("form", { onSubmit: handleSubmit, children: [ (0, import_jsx_runtime.jsx)(Layouts.Header, { title: formatMessage({ id: getTrad("settings.header.label"), defaultMessage: "Media Library" }), primaryAction: (0, import_jsx_runtime.jsx)(Button, { disabled: isSaveButtonDisabled, loading: isSubmitting, type: "submit", startIcon: (0, import_jsx_runtime.jsx)(ForwardRef$4F, {}), size: "S", children: formatMessage({ id: "global.save", defaultMessage: "Save" }) }), subtitle: formatMessage({ id: getTrad("settings.sub-header.label"), defaultMessage: "Configure the settings for the Media Library" }) }), (0, import_jsx_runtime.jsx)(Layouts.Content, { children: (0, import_jsx_runtime.jsx)(Layouts.Root, { children: (0, import_jsx_runtime.jsx)(Flex, { direction: "column", alignItems: "stretch", gap: 12, children: (0, import_jsx_runtime.jsx)(Box, { background: "neutral0", padding: 6, shadow: "filterShadow", hasRadius: true, children: (0, import_jsx_runtime.jsxs)(Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [ (0, import_jsx_runtime.jsx)(Flex, { children: (0, import_jsx_runtime.jsx)(Typography, { variant: "delta", tag: "h2", children: formatMessage({ id: getTrad("settings.blockTitle"), defaultMessage: "Asset management" }) }) }), (0, import_jsx_runtime.jsxs)(Grid.Root, { gap: 6, children: [ (0, import_jsx_runtime.jsx)(Grid.Item, { col: 6, s: 12, direction: "column", alignItems: "stretch", children: (0, import_jsx_runtime.jsxs)(Field.Root, { hint: formatMessage({ id: getTrad("settings.form.responsiveDimensions.description"), defaultMessage: "Enabling this option will generate multiple formats (small, medium and large) of the uploaded asset." }), name: "responsiveDimensions", children: [ (0, import_jsx_runtime.jsx)(Field.Label, { children: formatMessage({ id: getTrad("settings.form.responsiveDimensions.label"), defaultMessage: "Responsive friendly upload" }) }), (0, import_jsx_runtime.jsx)(Toggle, { checked: modifiedData == null ? void 0 : modifiedData.responsiveDimensions, offLabel: formatMessage({ id: "app.components.ToggleCheckbox.off-label", defaultMessage: "Off" }), onLabel: formatMessage({ id: "app.components.ToggleCheckbox.on-label", defaultMessage: "On" }), onChange: (e) => { handleChange({ target: { name: "responsiveDimensions", value: e.target.checked } }); } }), (0, import_jsx_runtime.jsx)(Field.Hint, {}) ] }) }), (0, import_jsx_runtime.jsx)(Grid.Item, { col: 6, s: 12, direction: "column", alignItems: "stretch", children: (0, import_jsx_runtime.jsxs)(Field.Root, { hint: formatMessage({ id: getTrad("settings.form.sizeOptimization.description"), defaultMessage: "Enabling this option will reduce the image size and slightly reduce its quality." }), name: "sizeOptimization", children: [ (0, import_jsx_runtime.jsx)(Field.Label, { children: formatMessage({ id: getTrad("settings.form.sizeOptimization.label"), defaultMessage: "Size optimization" }) }), (0, import_jsx_runtime.jsx)(Toggle, { checked: modifiedData == null ? void 0 : modifiedData.sizeOptimization, offLabel: formatMessage({ id: "app.components.ToggleCheckbox.off-label", defaultMessage: "Off" }), onLabel: formatMessage({ id: "app.components.ToggleCheckbox.on-label", defaultMessage: "On" }), onChange: (e) => { handleChange({ target: { name: "sizeOptimization", value: e.target.checked } }); } }), (0, import_jsx_runtime.jsx)(Field.Hint, {}) ] }) }), (0, import_jsx_runtime.jsx)(Grid.Item, { col: 6, s: 12, direction: "column", alignItems: "stretch", children: (0, import_jsx_runtime.jsxs)(Field.Root, { hint: formatMessage({ id: getTrad("settings.form.autoOrientation.description"), defaultMessage: "Enabling this option will automatically rotate the image according to EXIF orientation tag." }), name: "autoOrientation", children: [ (0, import_jsx_runtime.jsx)(Field.Label, { children: formatMessage({ id: getTrad("settings.form.autoOrientation.label"), defaultMessage: "Auto orientation" }) }), (0, import_jsx_runtime.jsx)(Toggle, { checked: modifiedData == null ? void 0 : modifiedData.autoOrientation, offLabel: formatMessage({ id: "app.components.ToggleCheckbox.off-label", defaultMessage: "Off" }), onLabel: formatMessage({ id: "app.components.ToggleCheckbox.on-label", defaultMessage: "On" }), onChange: (e) => { handleChange({ target: { name: "autoOrientation", value: e.target.checked } }); } }), (0, import_jsx_runtime.jsx)(Field.Hint, {}) ] }) }) ] }) ] }) }) }) }) }) ] }) ] }); }; var ProtectedSettingsPage = () => (0, import_jsx_runtime.jsx)(Page.Protect, { permissions: PERMISSIONS.settings, children: (0, import_jsx_runtime.jsx)(SettingsPage, {}) }); export { ProtectedSettingsPage, SettingsPage }; //# sourceMappingURL=SettingsPage-RQMX2WLO.js.map