UNPKG

wcz-layout

Version:

1,515 lines (1,514 loc) 40.3 kB
import { n as RouterIconButton, t as RouterListItemButton } from "./RouterListItemButton-rcdkgOXQ.js"; import { t as useDialogs } from "./useDialogs-BaxhulU9.js"; import { t as query } from "./queries-JPqCc5Tb.js"; import { c } from "react/compiler-runtime"; import { Box, Button, Chip, Dialog, Divider, Fab, IconButton, ImageListItem, ImageListItemBar, Link, List, ListItemButton, ListItemIcon, ListItemText, Menu, Stack, Tab, Tooltip, Typography, useTheme } from "@mui/material"; import React, { Fragment, createContext, useContext, useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { createLink } from "@tanstack/react-router"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { jsx, jsxs } from "react/jsx-runtime"; import CloudUpload from "@mui/icons-material/CloudUpload"; import { useDropzone } from "react-dropzone"; import MoreVert from "@mui/icons-material/MoreVert"; import { grey } from "@mui/material/colors"; import { useInView } from "react-intersection-observer"; import Delete from "@mui/icons-material/Delete"; import FileDownload from "@mui/icons-material/FileDownload"; import AttachFile from "@mui/icons-material/AttachFile"; import Image from "@mui/icons-material/Image"; import SmartDisplay from "@mui/icons-material/SmartDisplay"; import Close from "@mui/icons-material/Close"; import Edit from "@mui/icons-material/Edit"; import { GridActionsCellItem } from "@mui/x-data-grid-premium"; //#region src/components/core/TypographyWithIcon.tsx const TypographyWithIcon = (t0) => { const $ = c(22); if ($[0] !== "c907f878079ab2aaf6c4f1ddc11a48963df3a6aab19bcf04c50580ea956cba1f") { for (let $i = 0; $i < 22; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "c907f878079ab2aaf6c4f1ddc11a48963df3a6aab19bcf04c50580ea956cba1f"; } let children; let endIcon; let props; let startIcon; let sx; let t1; if ($[1] !== t0) { ({startIcon, endIcon, children, gap: t1, sx, ...props} = t0); $[1] = t0; $[2] = children; $[3] = endIcon; $[4] = props; $[5] = startIcon; $[6] = sx; $[7] = t1; } else { children = $[2]; endIcon = $[3]; props = $[4]; startIcon = $[5]; sx = $[6]; t1 = $[7]; } const gap = t1 === void 0 ? 1 : t1; let t2; if ($[8] === Symbol.for("react.memo_cache_sentinel")) { t2 = { display: "block", flexShrink: 0 }; $[8] = t2; } else t2 = $[8]; let t3; if ($[9] !== gap) { t3 = { display: "inline-flex", alignItems: "center", verticalAlign: "middle", gap, "& > svg": t2 }; $[9] = gap; $[10] = t3; } else t3 = $[10]; let t4; if ($[11] !== sx) { t4 = Array.isArray(sx) ? sx : [sx]; $[11] = sx; $[12] = t4; } else t4 = $[12]; let t5; if ($[13] !== t3 || $[14] !== t4) { t5 = [t3, ...t4]; $[13] = t3; $[14] = t4; $[15] = t5; } else t5 = $[15]; let t6; if ($[16] !== children || $[17] !== endIcon || $[18] !== props || $[19] !== startIcon || $[20] !== t5) { t6 = /* @__PURE__ */ jsxs(Typography, { component: "span", sx: t5, ...props, children: [ startIcon, children, endIcon ] }); $[16] = children; $[17] = endIcon; $[18] = props; $[19] = startIcon; $[20] = t5; $[21] = t6; } else t6 = $[21]; return t6; }; //#endregion //#region src/components/core/Fullscreen.tsx const Fullscreen = (t0) => { const $ = c(16); if ($[0] !== "2243979894039564df2fd1f70562faf7a7d5878eaeea3b472ad974fd8b0c233e") { for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "2243979894039564df2fd1f70562faf7a7d5878eaeea3b472ad974fd8b0c233e"; } let children; let props; let sx; if ($[1] !== t0) { ({children, sx, ...props} = t0); $[1] = t0; $[2] = children; $[3] = props; $[4] = sx; } else { children = $[2]; props = $[3]; sx = $[4]; } const reference = useRef(null); const [height, setHeight] = useState(); let t1; if ($[5] === Symbol.for("react.memo_cache_sentinel")) { t1 = () => { if (!reference.current) return; const top = reference.current.getBoundingClientRect().top; const viewportHeight = window.visualViewport?.height ?? window.innerHeight; setHeight(Math.max(0, Math.floor(viewportHeight - top))); }; $[5] = t1; } else t1 = $[5]; const recompute = useEffectEvent(t1); let t2; if ($[6] !== recompute) { t2 = () => { const element = reference.current; if (!element) return; recompute(); window.addEventListener("resize", recompute); const ro = new ResizeObserver(recompute); ro.observe(document.documentElement); ro.observe(document.body); ro.observe(element); return () => { window.removeEventListener("resize", recompute); ro.disconnect(); }; }; $[6] = recompute; $[7] = t2; } else t2 = $[7]; let t3; if ($[8] === Symbol.for("react.memo_cache_sentinel")) { t3 = []; $[8] = t3; } else t3 = $[8]; useLayoutEffect(t2, t3); let t4; if ($[9] !== height || $[10] !== sx) { t4 = { display: "flex", flexDirection: "column", boxSizing: "border-box", minHeight: 0, width: "100%", overflow: "auto", height, ...sx }; $[9] = height; $[10] = sx; $[11] = t4; } else t4 = $[11]; let t5; if ($[12] !== children || $[13] !== props || $[14] !== t4) { t5 = /* @__PURE__ */ jsx(Box, { ref: reference, sx: t4, ...props, children }); $[12] = children; $[13] = props; $[14] = t4; $[15] = t5; } else t5 = $[15]; return t5; }; //#endregion //#region src/components/file/Dropzone.tsx const baseStyle = { flex: 1, display: "flex", flexDirection: "column", alignItems: "center", padding: "20px", borderWidth: 2, borderRadius: 2, borderStyle: "dashed", outline: "none", transition: "border .24s ease-in-out", cursor: "pointer" }; const Dropzone = (t0) => { const $ = c(28); if ($[0] !== "a5cc9eacf700dc99d6fa09d79a30e7ee2585596689730acf08a56fb43f1c5490") { for (let $i = 0; $i < 28; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "a5cc9eacf700dc99d6fa09d79a30e7ee2585596689730acf08a56fb43f1c5490"; } let props; let sx; if ($[1] !== t0) { ({sx, ...props} = t0); $[1] = t0; $[2] = props; $[3] = sx; } else { props = $[2]; sx = $[3]; } const { getRootProps, getInputProps, isFocused, isDragAccept, isDragReject } = useDropzone(props); const { t } = useTranslation(); const theme = useTheme(); const t1 = theme.vars || theme; let T0; let t2; if ($[4] !== getRootProps || $[5] !== isDragAccept || $[6] !== isDragReject || $[7] !== isFocused || $[8] !== t1.palette.text.disabled || $[9] !== theme) { const style = { ...baseStyle, borderColor: t1.palette.text.disabled, ...isFocused ? { borderColor: (theme.vars || theme).palette.primary.main } : {}, ...isDragAccept ? { borderColor: (theme.vars || theme).palette.success.main } : {}, ...isDragReject ? { borderColor: (theme.vars || theme).palette.error.main } : {} }; T0 = Box; t2 = getRootProps({ style }); $[4] = getRootProps; $[5] = isDragAccept; $[6] = isDragReject; $[7] = isFocused; $[8] = t1.palette.text.disabled; $[9] = theme; $[10] = T0; $[11] = t2; } else { T0 = $[10]; t2 = $[11]; } let t3; if ($[12] !== getInputProps) { t3 = getInputProps(); $[12] = getInputProps; $[13] = t3; } else t3 = $[13]; let t4; if ($[14] === Symbol.for("react.memo_cache_sentinel")) { t4 = { display: "none" }; $[14] = t4; } else t4 = $[14]; let t5; if ($[15] !== t3) { t5 = /* @__PURE__ */ jsx("input", { ...t3, style: t4 }); $[15] = t3; $[16] = t5; } else t5 = $[16]; let t6; if ($[17] === Symbol.for("react.memo_cache_sentinel")) { t6 = /* @__PURE__ */ jsx(CloudUpload, {}); $[17] = t6; } else t6 = $[17]; let t7; if ($[18] !== t) { t7 = t("Layout.File.DragSomeFilesHereOrClickToSelectThem"); $[18] = t; $[19] = t7; } else t7 = $[19]; let t8; if ($[20] !== t7) { t8 = /* @__PURE__ */ jsx(Typography, { children: t7 }); $[20] = t7; $[21] = t8; } else t8 = $[21]; let t9; if ($[22] !== T0 || $[23] !== sx || $[24] !== t2 || $[25] !== t5 || $[26] !== t8) { t9 = /* @__PURE__ */ jsxs(T0, { ...t2, sx, children: [ t5, t6, t8 ] }); $[22] = T0; $[23] = sx; $[24] = t2; $[25] = t5; $[26] = t8; $[27] = t9; } else t9 = $[27]; return t9; }; //#endregion //#region src/contexts/FileContext.ts const FileContext = createContext(null); const useFile = () => { const $ = c(1); if ($[0] !== "193c0b45a7883bd131e17408cdd051a0ae7aea9ba1a5ba0d64ffd3abfdd90e7e") { for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "193c0b45a7883bd131e17408cdd051a0ae7aea9ba1a5ba0d64ffd3abfdd90e7e"; } const context = useContext(FileContext); if (!context) throw new Error("FileViewer components must be used within FileViewer"); return context; }; //#endregion //#region src/components/file/fileViewer/common/ActionsMenu.tsx const ActionsMenu = (t0) => { const $ = c(37); if ($[0] !== "b35696825eb8b28a7bdd276de406f40ec37c9c341f84e48336cf4684164d76da") { for (let $i = 0; $i < 37; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "b35696825eb8b28a7bdd276de406f40ec37c9c341f84e48336cf4684164d76da"; } const { meta, menu, setMenu } = t0; const { t } = useTranslation(); const { fileMetas, onDelete, actions } = useFile(); const { confirm } = useDialogs(); let t1; if ($[1] !== setMenu) { t1 = () => { setMenu(null); }; $[1] = setMenu; $[2] = t1; } else t1 = $[2]; const handleMenuClose = t1; let t2; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { t2 = query.file.download(); $[3] = t2; } else t2 = $[3]; const { mutate: download, isPending: isDownloading } = useMutation(t2); let t3; if ($[4] === Symbol.for("react.memo_cache_sentinel")) { t3 = query.file.delete(); $[4] = t3; } else t3 = $[4]; const { mutate: deleteFile, isPending: isDeleting } = useMutation(t3); let t4; if ($[5] !== download || $[6] !== handleMenuClose || $[7] !== meta) { t4 = () => { handleMenuClose(); download(meta); }; $[5] = download; $[6] = handleMenuClose; $[7] = meta; $[8] = t4; } else t4 = $[8]; const handleOnDownload = t4; let t5; if ($[9] !== confirm || $[10] !== deleteFile || $[11] !== fileMetas || $[12] !== handleMenuClose || $[13] !== meta || $[14] !== onDelete || $[15] !== t) { t5 = async () => { if (!await confirm(t("Layout.File.AreYouSureYouWantToDelete", { fileName: meta.fileName }))) return; deleteFile(meta); handleMenuClose(); if (onDelete) onDelete({ remainingFileMetas: fileMetas.filter((m) => m.id !== meta.id), deletedFileMeta: meta }); }; $[9] = confirm; $[10] = deleteFile; $[11] = fileMetas; $[12] = handleMenuClose; $[13] = meta; $[14] = onDelete; $[15] = t; $[16] = t5; } else t5 = $[16]; const handleOnDelete = t5; const t6 = menu !== null; let t7; if ($[17] !== menu) { t7 = menu === null ? void 0 : { top: menu.mouseY, left: menu.mouseX }; $[17] = menu; $[18] = t7; } else t7 = $[18]; let t8; if ($[19] !== actions?.download || $[20] !== handleOnDownload || $[21] !== isDownloading || $[22] !== t) { t8 = actions?.download !== false && /* @__PURE__ */ jsxs(ListItemButton, { onClick: handleOnDownload, disabled: isDownloading, children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(FileDownload, {}) }), /* @__PURE__ */ jsx(ListItemText, { children: t("Layout.File.Download") })] }); $[19] = actions?.download; $[20] = handleOnDownload; $[21] = isDownloading; $[22] = t; $[23] = t8; } else t8 = $[23]; let t9; if ($[24] !== actions?.delete || $[25] !== handleOnDelete || $[26] !== isDeleting || $[27] !== t) { t9 = actions?.delete !== false && /* @__PURE__ */ jsxs(ListItemButton, { onClick: handleOnDelete, disabled: isDeleting, children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Delete, {}) }), /* @__PURE__ */ jsx(ListItemText, { children: t("Layout.File.Delete") })] }); $[24] = actions?.delete; $[25] = handleOnDelete; $[26] = isDeleting; $[27] = t; $[28] = t9; } else t9 = $[28]; let t10; if ($[29] !== t8 || $[30] !== t9) { t10 = /* @__PURE__ */ jsxs(List, { disablePadding: true, children: [t8, t9] }); $[29] = t8; $[30] = t9; $[31] = t10; } else t10 = $[31]; let t11; if ($[32] !== handleMenuClose || $[33] !== t10 || $[34] !== t6 || $[35] !== t7) { t11 = /* @__PURE__ */ jsx(Menu, { open: t6, onClose: handleMenuClose, anchorReference: "anchorPosition", variant: "menu", anchorPosition: t7, children: t10 }); $[32] = handleMenuClose; $[33] = t10; $[34] = t6; $[35] = t7; $[36] = t11; } else t11 = $[36]; return t11; }; //#endregion //#region src/components/file/fileViewer/FileViewerGrid.tsx const IMAGE_SIZE = 150; const FileViewerGrid = (t0) => { const $ = c(13); if ($[0] !== "aa3240322f961e4de8656d3cbe3b3ed5b13d366ee38a8345dd8610ea4e3bb457") { for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "aa3240322f961e4de8656d3cbe3b3ed5b13d366ee38a8345dd8610ea4e3bb457"; } const { sx, size, itemBar } = t0; const { fileMetas } = useFile(); let t1; if ($[1] !== sx) { t1 = { overflow: "auto", ...sx }; $[1] = sx; $[2] = t1; } else t1 = $[2]; let t2; if ($[3] !== fileMetas || $[4] !== itemBar || $[5] !== size) { let t3; if ($[7] !== itemBar || $[8] !== size) { t3 = (fileMeta) => /* @__PURE__ */ jsx(GridFileViewerItem, { meta: fileMeta, size, itemBar }, fileMeta.id); $[7] = itemBar; $[8] = size; $[9] = t3; } else t3 = $[9]; t2 = fileMetas.map(t3); $[3] = fileMetas; $[4] = itemBar; $[5] = size; $[6] = t2; } else t2 = $[6]; let t3; if ($[10] !== t1 || $[11] !== t2) { t3 = /* @__PURE__ */ jsx(Stack, { direction: "row", spacing: 1, sx: t1, children: t2 }); $[10] = t1; $[11] = t2; $[12] = t3; } else t3 = $[12]; return t3; }; const GridFileViewerItem = (t0) => { const $ = c(55); if ($[0] !== "aa3240322f961e4de8656d3cbe3b3ed5b13d366ee38a8345dd8610ea4e3bb457") { for (let $i = 0; $i < 55; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "aa3240322f961e4de8656d3cbe3b3ed5b13d366ee38a8345dd8610ea4e3bb457"; } const { meta, size, itemBar } = t0; const { setImageId, actions } = useFile(); const [showItemBar, setShowItemBar] = useState(itemBar === "always"); const [menu, setMenu] = useState(null); const { ref, inView } = useInView(); const queryClient = useQueryClient(); let t1; let t2; if ($[1] !== itemBar) { t1 = () => { setShowItemBar(itemBar === "always"); }; t2 = [itemBar]; $[1] = itemBar; $[2] = t1; $[3] = t2; } else { t1 = $[2]; t2 = $[3]; } useEffect(t1, t2); let t3; if ($[4] !== meta) { t3 = query.file.thumbnail({ meta }); $[4] = meta; $[5] = t3; } else t3 = $[5]; let t4; if ($[6] !== inView || $[7] !== t3) { t4 = { ...t3, enabled: inView }; $[6] = inView; $[7] = t3; $[8] = t4; } else t4 = $[8]; const { data: source } = useQuery(t4); let t5; if ($[9] === Symbol.for("react.memo_cache_sentinel")) { t5 = () => setShowItemBar(true); $[9] = t5; } else t5 = $[9]; const handleOnMouseEnter = t5; let t6; if ($[10] !== itemBar) { t6 = () => itemBar !== "always" && setShowItemBar(false); $[10] = itemBar; $[11] = t6; } else t6 = $[11]; const handleOnMouseLeave = t6; let t7; if ($[12] !== menu) { t7 = (event) => { setMenu(menu === null ? { mouseX: event.clientX, mouseY: event.clientY } : null); setTimeout(() => setShowItemBar(true)); }; $[12] = menu; $[13] = t7; } else t7 = $[13]; const openMenu = t7; let t8; if ($[14] === Symbol.for("react.memo_cache_sentinel")) { t8 = query.file.open(); $[14] = t8; } else t8 = $[14]; const { mutate: openFile } = useMutation(t8); let t9; if ($[15] === Symbol.for("react.memo_cache_sentinel")) { t9 = query.file.download(); $[15] = t9; } else t9 = $[15]; const { mutate: download } = useMutation(t9); let t10; if ($[16] !== download || $[17] !== meta || $[18] !== openFile || $[19] !== setImageId) { t10 = () => { switch (meta.mediaType) { case "image": return setImageId(meta.id); case "application": return openFile(meta); case "video": return openFile(meta); default: return download(meta); } }; $[16] = download; $[17] = meta; $[18] = openFile; $[19] = setImageId; $[20] = t10; } else t10 = $[20]; const onClick = t10; const t11 = size ?? IMAGE_SIZE; const t12 = size ?? IMAGE_SIZE; let t13; if ($[21] !== t11 || $[22] !== t12) { t13 = { width: t11, height: t12 }; $[21] = t11; $[22] = t12; $[23] = t13; } else t13 = $[23]; const t14 = "thumbnail-" + meta.id; let t15; if ($[24] !== meta || $[25] !== queryClient) { t15 = () => queryClient.prefetchQuery(query.file.getOne({ meta })); $[24] = meta; $[25] = queryClient; $[26] = t15; } else t15 = $[26]; const t16 = size ?? IMAGE_SIZE; const t17 = size ?? IMAGE_SIZE; let t18; if ($[27] !== t16 || $[28] !== t17) { t18 = { cursor: "pointer", objectFit: "contain", width: t16, height: t17 }; $[27] = t16; $[28] = t17; $[29] = t18; } else t18 = $[29]; let t19; if ($[30] !== onClick || $[31] !== source || $[32] !== t14 || $[33] !== t15 || $[34] !== t18) { t19 = /* @__PURE__ */ jsx(Box, { component: "img", src: source, loading: "lazy", alt: t14, onClick, onMouseEnter: t15, sx: t18 }); $[30] = onClick; $[31] = source; $[32] = t14; $[33] = t15; $[34] = t18; $[35] = t19; } else t19 = $[35]; let t20; if ($[36] !== actions || $[37] !== itemBar || $[38] !== meta.fileName || $[39] !== openMenu || $[40] !== showItemBar) { t20 = itemBar !== "hidden" && showItemBar && /* @__PURE__ */ jsx(ImageListItemBar, { title: /* @__PURE__ */ jsx(Tooltip, { title: meta.fileName, children: /* @__PURE__ */ jsx(Box, { children: meta.fileName }) }), actionIcon: (actions?.download !== false || actions.delete !== false) && /* @__PURE__ */ jsx(IconButton, { sx: { color: grey[100] }, onClick: openMenu, children: /* @__PURE__ */ jsx(MoreVert, {}) }) }); $[36] = actions; $[37] = itemBar; $[38] = meta.fileName; $[39] = openMenu; $[40] = showItemBar; $[41] = t20; } else t20 = $[41]; let t21; if ($[42] !== handleOnMouseLeave || $[43] !== ref || $[44] !== t13 || $[45] !== t19 || $[46] !== t20) { t21 = /* @__PURE__ */ jsxs(ImageListItem, { sx: t13, onMouseEnter: handleOnMouseEnter, onMouseLeave: handleOnMouseLeave, ref, children: [t19, t20] }); $[42] = handleOnMouseLeave; $[43] = ref; $[44] = t13; $[45] = t19; $[46] = t20; $[47] = t21; } else t21 = $[47]; let t22; if ($[48] !== actions || $[49] !== menu || $[50] !== meta) { t22 = (actions?.download !== false || actions.delete !== false) && /* @__PURE__ */ jsx(ActionsMenu, { meta, menu, setMenu }); $[48] = actions; $[49] = menu; $[50] = meta; $[51] = t22; } else t22 = $[51]; let t23; if ($[52] !== t21 || $[53] !== t22) { t23 = /* @__PURE__ */ jsxs(Fragment, { children: [t21, t22] }); $[52] = t21; $[53] = t22; $[54] = t23; } else t23 = $[54]; return t23; }; //#endregion //#region src/components/file/fileViewer/FileViewerList.tsx const FileViewerList = (t0) => { const $ = c(6); if ($[0] !== "47bf83cf7b96aca451496f16de43f8c285d7726133fe1863d9d137acb1d5dd3e") { for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "47bf83cf7b96aca451496f16de43f8c285d7726133fe1863d9d137acb1d5dd3e"; } const { sx } = t0; const { fileMetas } = useFile(); let t1; if ($[1] !== fileMetas) { t1 = fileMetas.map(_temp); $[1] = fileMetas; $[2] = t1; } else t1 = $[2]; let t2; if ($[3] !== sx || $[4] !== t1) { t2 = /* @__PURE__ */ jsx(List, { dense: true, sx, children: t1 }); $[3] = sx; $[4] = t1; $[5] = t2; } else t2 = $[5]; return t2; }; const ListFileViewerItem = (t0) => { const $ = c(36); if ($[0] !== "47bf83cf7b96aca451496f16de43f8c285d7726133fe1863d9d137acb1d5dd3e") { for (let $i = 0; $i < 36; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "47bf83cf7b96aca451496f16de43f8c285d7726133fe1863d9d137acb1d5dd3e"; } const { meta } = t0; const { setImageId, actions } = useFile(); const [menu, setMenu] = useState(null); const queryClient = useQueryClient(); let t1; if ($[1] !== menu) { t1 = (event) => { event.stopPropagation(); setMenu(menu === null ? { mouseX: event.clientX, mouseY: event.clientY } : null); }; $[1] = menu; $[2] = t1; } else t1 = $[2]; const openMenu = t1; let t2; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { t2 = query.file.open(); $[3] = t2; } else t2 = $[3]; const { mutate: openFile } = useMutation(t2); let t3; if ($[4] === Symbol.for("react.memo_cache_sentinel")) { t3 = query.file.download(); $[4] = t3; } else t3 = $[4]; const { mutate: download } = useMutation(t3); let t4; if ($[5] !== download || $[6] !== meta || $[7] !== openFile || $[8] !== setImageId) { t4 = () => { switch (meta.mediaType) { case "image": return setImageId(meta.id); case "application": return openFile(meta); case "video": return openFile(meta); default: return download(meta); } }; $[5] = download; $[6] = meta; $[7] = openFile; $[8] = setImageId; $[9] = t4; } else t4 = $[9]; const onClick = t4; let t5; if ($[10] !== meta.mediaType) { t5 = () => { switch (meta.mediaType) { case "image": return /* @__PURE__ */ jsx(Image, {}); case "video": return /* @__PURE__ */ jsx(SmartDisplay, {}); default: return /* @__PURE__ */ jsx(AttachFile, {}); } }; $[10] = meta.mediaType; $[11] = t5; } else t5 = $[11]; const icon = t5; let t6; if ($[12] !== meta || $[13] !== queryClient) { t6 = () => queryClient.prefetchQuery(query.file.getOne({ meta })); $[12] = meta; $[13] = queryClient; $[14] = t6; } else t6 = $[14]; let t7; if ($[15] !== icon) { t7 = /* @__PURE__ */ jsx(ListItemIcon, { children: icon() }); $[15] = icon; $[16] = t7; } else t7 = $[16]; const t8 = `${meta.fileName}.${meta.fileExtension}`; let t9; if ($[17] !== t8) { t9 = /* @__PURE__ */ jsx(ListItemText, { primary: t8 }); $[17] = t8; $[18] = t9; } else t9 = $[18]; let t10; if ($[19] !== actions || $[20] !== openMenu) { t10 = (actions?.download !== false || actions.delete !== false) && /* @__PURE__ */ jsx(IconButton, { edge: "end", onClick: openMenu, children: /* @__PURE__ */ jsx(MoreVert, {}) }); $[19] = actions; $[20] = openMenu; $[21] = t10; } else t10 = $[21]; let t11; if ($[22] !== meta.id || $[23] !== onClick || $[24] !== t10 || $[25] !== t6 || $[26] !== t7 || $[27] !== t9) { t11 = /* @__PURE__ */ jsxs(ListItemButton, { onClick, onMouseEnter: t6, children: [ t7, t9, t10 ] }, meta.id); $[22] = meta.id; $[23] = onClick; $[24] = t10; $[25] = t6; $[26] = t7; $[27] = t9; $[28] = t11; } else t11 = $[28]; let t12; if ($[29] !== actions || $[30] !== menu || $[31] !== meta) { t12 = (actions?.download !== false || actions.delete !== false) && /* @__PURE__ */ jsx(ActionsMenu, { meta, menu, setMenu }); $[29] = actions; $[30] = menu; $[31] = meta; $[32] = t12; } else t12 = $[32]; let t13; if ($[33] !== t11 || $[34] !== t12) { t13 = /* @__PURE__ */ jsxs(Fragment, { children: [t11, t12] }); $[33] = t11; $[34] = t12; $[35] = t13; } else t13 = $[35]; return t13; }; function _temp(fileMeta) { return /* @__PURE__ */ jsx(ListFileViewerItem, { meta: fileMeta }, fileMeta.id); } //#endregion //#region src/components/file/fileViewer/ImageViewer.tsx const ImageViewer = ({ metaId }) => { const { fileMetas, setImageId } = useFile(); const meta = fileMetas.find((m) => m.id === metaId); const { data: source } = useQuery(query.file.getOne({ meta })); useEffect(() => { if (metaId) globalThis.addEventListener("keydown", handleOnKeydown); return () => { globalThis.removeEventListener("keydown", handleOnKeydown); }; }, [metaId]); const handleOnKeydown = (event) => { const images = fileMetas.filter((m_0) => m_0.mediaType === "image"); const imageIndex = images.findIndex((m_1) => m_1.id === metaId); switch (event.key) { case "ArrowLeft": return handleOnArrowLeft(images, imageIndex); case "ArrowRight": return handleOnArrowRight(images, imageIndex); case "Backspace": case "Escape": event.preventDefault(); return onClose(); } }; const handleOnArrowLeft = (images_0, index) => { if (index > 0) { const previousFile = images_0[index - 1]; setImageId(previousFile.id); } }; const handleOnArrowRight = (images_1, index_0) => { if (index_0 < images_1.length - 1) { const nextFile = images_1[index_0 + 1]; setImageId(nextFile.id); } }; const onClose = () => setImageId(""); if (!metaId) return null; return /* @__PURE__ */ jsxs(Dialog, { open: true, onClose, maxWidth: "xl", children: [/* @__PURE__ */ jsx(Box, { component: "img", src: source, alt: metaId, sx: { maxWidth: "100vw", maxHeight: { xs: "calc(100vh - 56px)", sm: "calc(100vh - 64px)" } } }), /* @__PURE__ */ jsx(Fab, { size: "medium", onClick: onClose, sx: { position: "fixed", top: 8, right: 8 }, children: /* @__PURE__ */ jsx(Close, {}) })] }); }; //#endregion //#region src/components/file/FileViewer.tsx const FileViewer = (t0) => { const $ = c(27); if ($[0] !== "1fc590339866fd082bb6bd43ba68c115aa74351506f0ea013495a119fe115495") { for (let $i = 0; $i < 27; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "1fc590339866fd082bb6bd43ba68c115aa74351506f0ea013495a119fe115495"; } const { subId, onDelete, actions, children } = t0; let t1; if ($[1] !== subId) { t1 = query.file.metas({ subId }); $[1] = subId; $[2] = t1; } else t1 = $[2]; const t2 = !!subId; let t3; if ($[3] !== t1 || $[4] !== t2) { t3 = { ...t1, enabled: t2 }; $[3] = t1; $[4] = t2; $[5] = t3; } else t3 = $[5]; const { data: t4 } = useQuery(t3); let t5; if ($[6] !== t4) { t5 = t4 === void 0 ? [] : t4; $[6] = t4; $[7] = t5; } else t5 = $[7]; const fileMetas = t5; const [imageId, setImageId] = useState(""); let T0; let t6; let t7; let t8; if ($[8] !== actions || $[9] !== children || $[10] !== fileMetas || $[11] !== onDelete) { t8 = Symbol.for("react.early_return_sentinel"); bb0: { const components = { Grid: FileViewerGrid, List: FileViewerList }; if (fileMetas.length === 0) { t8 = null; break bb0; } T0 = FileContext.Provider; if ($[16] !== actions || $[17] !== fileMetas || $[18] !== onDelete) { t6 = { fileMetas, onDelete, actions, setImageId }; $[16] = actions; $[17] = fileMetas; $[18] = onDelete; $[19] = t6; } else t6 = $[19]; t7 = children(components); } $[8] = actions; $[9] = children; $[10] = fileMetas; $[11] = onDelete; $[12] = T0; $[13] = t6; $[14] = t7; $[15] = t8; } else { T0 = $[12]; t6 = $[13]; t7 = $[14]; t8 = $[15]; } if (t8 !== Symbol.for("react.early_return_sentinel")) return t8; let t9; if ($[20] !== imageId) { t9 = /* @__PURE__ */ jsx(ImageViewer, { metaId: imageId }); $[20] = imageId; $[21] = t9; } else t9 = $[21]; let t10; if ($[22] !== T0 || $[23] !== t6 || $[24] !== t7 || $[25] !== t9) { t10 = /* @__PURE__ */ jsxs(T0, { value: t6, children: [t7, t9] }); $[22] = T0; $[23] = t6; $[24] = t7; $[25] = t9; $[26] = t10; } else t10 = $[26]; return t10; }; //#endregion //#region src/components/data-grid/ChipInputCell.tsx const isArray = (value) => Array.isArray(value); const ChipInputCell = (t0) => { const $ = c(21); if ($[0] !== "ebd026ef7b2b058bdb41c547491f28ac20bf350e7dcbb4d506fa4c0ec63a0b52") { for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "ebd026ef7b2b058bdb41c547491f28ac20bf350e7dcbb4d506fa4c0ec63a0b52"; } const { params, slotProps, getLabel } = t0; if (!params.value) return null; let t1; if ($[1] !== getLabel) { t1 = (value) => { if (getLabel) return getLabel(value); return value; }; $[1] = getLabel; $[2] = t1; } else t1 = $[2]; const getLabelValue = t1; if (isArray(params.value)) { let t2; if ($[3] !== params.colDef.computedWidth) { t2 = { alignItems: "center", gap: 1, overflowX: "auto", height: "100%", width: params.colDef.computedWidth }; $[3] = params.colDef.computedWidth; $[4] = t2; } else t2 = $[4]; let t3; if ($[5] !== getLabelValue || $[6] !== params.value || $[7] !== slotProps) { let t4; if ($[9] !== getLabelValue || $[10] !== slotProps) { t4 = (value_0, index) => /* @__PURE__ */ jsx(Chip, { label: getLabelValue(value_0), ...slotProps }, `${index + 1}-chip-input-cell`); $[9] = getLabelValue; $[10] = slotProps; $[11] = t4; } else t4 = $[11]; t3 = params.value.map(t4); $[5] = getLabelValue; $[6] = params.value; $[7] = slotProps; $[8] = t3; } else t3 = $[8]; let t4; if ($[12] !== t2 || $[13] !== t3) { t4 = /* @__PURE__ */ jsx(Stack, { direction: "row", sx: t2, children: t3 }); $[12] = t2; $[13] = t3; $[14] = t4; } else t4 = $[14]; return t4; } let t2; if ($[15] !== getLabelValue || $[16] !== params.value) { t2 = getLabelValue(params.value); $[15] = getLabelValue; $[16] = params.value; $[17] = t2; } else t2 = $[17]; let t3; if ($[18] !== slotProps || $[19] !== t2) { t3 = /* @__PURE__ */ jsx(Chip, { label: t2, ...slotProps }); $[18] = slotProps; $[19] = t2; $[20] = t3; } else t3 = $[20]; return t3; }; //#endregion //#region src/components/data-grid/EditableColumnHeader.tsx const EditableColumnHeader = (t0) => { const $ = c(4); if ($[0] !== "6a15ed1416d709da03e45c16a891abdc148cf158eccf7a8f811dad6581ee54b2") { for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "6a15ed1416d709da03e45c16a891abdc148cf158eccf7a8f811dad6581ee54b2"; } const { colDef } = t0; let t1; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { t1 = /* @__PURE__ */ jsx(Edit, { color: "disabled", fontSize: "small" }); $[1] = t1; } else t1 = $[1]; let t2; if ($[2] !== colDef.headerName) { t2 = /* @__PURE__ */ jsx(TypographyWithIcon, { endIcon: t1, variant: "body2", className: "MuiDataGrid-columnHeaderTitle", children: colDef.headerName }); $[2] = colDef.headerName; $[3] = t2; } else t2 = $[3]; return t2; }; //#endregion //#region src/components/router/RouterButton.tsx const CreatedComponent$4 = createLink(React.forwardRef(function ButtonComponent(props, reference) { const $ = c(4); if ($[0] !== "ac6204c9fa419bc8efad3ebea0df725f19f2cc476a09c695e535caec26527133") { for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "ac6204c9fa419bc8efad3ebea0df725f19f2cc476a09c695e535caec26527133"; } let t0; if ($[1] !== props || $[2] !== reference) { t0 = /* @__PURE__ */ jsx(Button, { ref: reference, component: "a", ...props }); $[1] = props; $[2] = reference; $[3] = t0; } else t0 = $[3]; return t0; })); const RouterButton = (props) => { const $ = c(3); if ($[0] !== "ac6204c9fa419bc8efad3ebea0df725f19f2cc476a09c695e535caec26527133") { for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "ac6204c9fa419bc8efad3ebea0df725f19f2cc476a09c695e535caec26527133"; } let t0; if ($[1] !== props) { t0 = /* @__PURE__ */ jsx(CreatedComponent$4, { ...props }); $[1] = props; $[2] = t0; } else t0 = $[2]; return t0; }; //#endregion //#region src/components/router/RouterFab.tsx const CreatedComponent$3 = createLink(React.forwardRef(function FabComponent(props, reference) { const $ = c(4); if ($[0] !== "ecf406c2f1df75bd8d4f8cc1e2a0841119cda75e807b28c7c03400a2d927c16b") { for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "ecf406c2f1df75bd8d4f8cc1e2a0841119cda75e807b28c7c03400a2d927c16b"; } let t0; if ($[1] !== props || $[2] !== reference) { t0 = /* @__PURE__ */ jsx(Fab, { ref: reference, component: "a", ...props }); $[1] = props; $[2] = reference; $[3] = t0; } else t0 = $[3]; return t0; })); const RouterFab = (props) => { const $ = c(3); if ($[0] !== "ecf406c2f1df75bd8d4f8cc1e2a0841119cda75e807b28c7c03400a2d927c16b") { for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "ecf406c2f1df75bd8d4f8cc1e2a0841119cda75e807b28c7c03400a2d927c16b"; } let t0; if ($[1] !== props) { t0 = /* @__PURE__ */ jsx(CreatedComponent$3, { ...props }); $[1] = props; $[2] = t0; } else t0 = $[2]; return t0; }; //#endregion //#region src/components/router/RouterGridActionsCellItem.tsx const CreatedComponent$2 = createLink(React.forwardRef(function GridActionsCellItemComponent(props, reference) { const $ = c(4); if ($[0] !== "fe0074f677567d6263d3c9001c809e24912c6a92680ef5ea22c5d1aebd696958") { for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "fe0074f677567d6263d3c9001c809e24912c6a92680ef5ea22c5d1aebd696958"; } let t0; if ($[1] !== props || $[2] !== reference) { t0 = /* @__PURE__ */ jsx(GridActionsCellItem, { ref: reference, component: "a", ...props }); $[1] = props; $[2] = reference; $[3] = t0; } else t0 = $[3]; return t0; })); const RouterGridActionsCellItem = (props) => { const $ = c(3); if ($[0] !== "fe0074f677567d6263d3c9001c809e24912c6a92680ef5ea22c5d1aebd696958") { for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "fe0074f677567d6263d3c9001c809e24912c6a92680ef5ea22c5d1aebd696958"; } let t0; if ($[1] !== props) { t0 = /* @__PURE__ */ jsx(CreatedComponent$2, { ...props }); $[1] = props; $[2] = t0; } else t0 = $[2]; return t0; }; //#endregion //#region src/components/router/RouterLink.tsx const CreatedComponent$1 = createLink(React.forwardRef(function LinkComponent(props, reference) { const $ = c(4); if ($[0] !== "b12e87e18a050ab0e29a4efcc3bd2a9fa6915db983e56ea2dc68853a7dc4b979") { for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "b12e87e18a050ab0e29a4efcc3bd2a9fa6915db983e56ea2dc68853a7dc4b979"; } let t0; if ($[1] !== props || $[2] !== reference) { t0 = /* @__PURE__ */ jsx(Link, { ref: reference, ...props }); $[1] = props; $[2] = reference; $[3] = t0; } else t0 = $[3]; return t0; })); const RouterLink = (props) => { const $ = c(3); if ($[0] !== "b12e87e18a050ab0e29a4efcc3bd2a9fa6915db983e56ea2dc68853a7dc4b979") { for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "b12e87e18a050ab0e29a4efcc3bd2a9fa6915db983e56ea2dc68853a7dc4b979"; } let t0; if ($[1] !== props) { t0 = /* @__PURE__ */ jsx(CreatedComponent$1, { ...props }); $[1] = props; $[2] = t0; } else t0 = $[2]; return t0; }; //#endregion //#region src/components/router/RouterTab.tsx const CreatedComponent = createLink(React.forwardRef(function TabComponent(props, reference) { const $ = c(4); if ($[0] !== "219e07108be3e229bc6eb53840beb65505cbaaf46f02d872937e7895165a73de") { for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "219e07108be3e229bc6eb53840beb65505cbaaf46f02d872937e7895165a73de"; } let t0; if ($[1] !== props || $[2] !== reference) { t0 = /* @__PURE__ */ jsx(Tab, { ref: reference, component: "a", ...props }); $[1] = props; $[2] = reference; $[3] = t0; } else t0 = $[3]; return t0; })); const RouterTab = (props) => { const $ = c(3); if ($[0] !== "219e07108be3e229bc6eb53840beb65505cbaaf46f02d872937e7895165a73de") { for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "219e07108be3e229bc6eb53840beb65505cbaaf46f02d872937e7895165a73de"; } let t0; if ($[1] !== props) { t0 = /* @__PURE__ */ jsx(CreatedComponent, { ...props }); $[1] = props; $[2] = t0; } else t0 = $[2]; return t0; }; //#endregion //#region src/components/router/RouterNotFound.tsx function RouterNotFound() { const $ = c(9); if ($[0] !== "a2fff6f270e5984a013a333cd77bf760bd02234c9fba174ec98da467b3cc7c39") { for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "a2fff6f270e5984a013a333cd77bf760bd02234c9fba174ec98da467b3cc7c39"; } const { t } = useTranslation(); let t0; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { t0 = { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2 }; $[1] = t0; } else t0 = $[1]; let t1; if ($[2] === Symbol.for("react.memo_cache_sentinel")) { t1 = { display: "flex", alignItems: "center", mb: 4 }; $[2] = t1; } else t1 = $[2]; let t2; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { t2 = /* @__PURE__ */ jsx(Typography, { variant: "h3", component: "span", sx: { fontWeight: 500, lineHeight: 1 }, children: "404" }); $[3] = t2; } else t2 = $[3]; let t3; if ($[4] === Symbol.for("react.memo_cache_sentinel")) { t3 = /* @__PURE__ */ jsx(Divider, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }); $[4] = t3; } else t3 = $[4]; let t4; if ($[5] !== t) { t4 = t("Layout.ThisPageCouldNotBeFound"); $[5] = t; $[6] = t4; } else t4 = $[6]; let t5; if ($[7] !== t4) { t5 = /* @__PURE__ */ jsx(Box, { sx: t0, children: /* @__PURE__ */ jsxs(Box, { sx: t1, children: [ t2, t3, /* @__PURE__ */ jsx(Typography, { variant: "h5", component: "span", children: t4 }) ] }) }); $[7] = t4; $[8] = t5; } else t5 = $[8]; return t5; } //#endregion //#region src/components/router/RouterError.tsx const RouterError = (t0) => { const $ = c(12); if ($[0] !== "cf071e5896b5a38250f396768818719aba3f257e614991b086e2337a7a292d24") { for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "cf071e5896b5a38250f396768818719aba3f257e614991b086e2337a7a292d24"; } const { error } = t0; let t1; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { t1 = { height: "100vh", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", px: 2 }; $[1] = t1; } else t1 = $[1]; let t2; if ($[2] === Symbol.for("react.memo_cache_sentinel")) { t2 = { display: "flex", alignItems: "center", mb: 4 }; $[2] = t2; } else t2 = $[2]; let t3; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { t3 = { fontWeight: 500, lineHeight: 1 }; $[3] = t3; } else t3 = $[3]; const t4 = error.name || "500"; let t5; if ($[4] !== t4) { t5 = /* @__PURE__ */ jsx(Typography, { variant: "h3", component: "span", sx: t3, children: t4 }); $[4] = t4; $[5] = t5; } else t5 = $[5]; let t6; if ($[6] === Symbol.for("react.memo_cache_sentinel")) { t6 = /* @__PURE__ */ jsx(Divider, { orientation: "vertical", flexItem: true, sx: { mx: 3 } }); $[6] = t6; } else t6 = $[6]; let t7; if ($[7] !== error.message) { t7 = /* @__PURE__ */ jsx(Typography, { variant: "h5", component: "span", children: error.message }); $[7] = error.message; $[8] = t7; } else t7 = $[8]; let t8; if ($[9] !== t5 || $[10] !== t7) { t8 = /* @__PURE__ */ jsx(Box, { sx: t1, children: /* @__PURE__ */ jsxs(Box, { sx: t2, children: [ t5, t6, t7 ] }) }); $[9] = t5; $[10] = t7; $[11] = t8; } else t8 = $[11]; return t8; }; //#endregion export { ChipInputCell, Dropzone, EditableColumnHeader, FileViewer, Fullscreen, RouterButton, RouterError, RouterFab, RouterGridActionsCellItem, RouterIconButton, RouterLink, RouterListItemButton, RouterNotFound, RouterTab, TypographyWithIcon }; //# sourceMappingURL=components.js.map