UNPKG

wcz-layout

Version:

1,554 lines (1,553 loc) 41.5 kB
import { n as RouterIconButton, t as RouterListItemButton } from "./RouterListItemButton-p9U4Z0SW.js"; import { a as fileQueryOptions, i as fileMetasQueryOptions, n as deleteFileMutationOptions, o as fileThumbnailQueryOptions, r as downloadFileMutationOptions, s as openFileMutationOptions } from "./file-DNF9kxdN.js"; import { t as useDialogs } from "./useDialogs-BQEh6of8.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] !== "9c8023a1fff996854b80705f821f262546dcf4698b35bf44797fd667c170087f") { for (let $i = 0; $i < 22; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "9c8023a1fff996854b80705f821f262546dcf4698b35bf44797fd667c170087f"; } 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] !== "a9a469a99242723a03ab2ab21b9513f8d7f393e7a397296039721f8243a94fd9") { for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "a9a469a99242723a03ab2ab21b9513f8d7f393e7a397296039721f8243a94fd9"; } 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(41); if ($[0] !== "fb1554827b634885b642536bc34fcdb79a1a0b2c0fd66f55c6785003d8dc33d4") { for (let $i = 0; $i < 41; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "fb1554827b634885b642536bc34fcdb79a1a0b2c0fd66f55c6785003d8dc33d4"; } const { meta, menu, setMenu } = t0; const { t } = useTranslation(); const { fileMetas, onDelete, actions, appName } = 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 = downloadFileMutationOptions(); $[3] = t2; } else t2 = $[3]; const { mutate: download, isPending: isDownloading } = useMutation(t2); let t3; if ($[4] === Symbol.for("react.memo_cache_sentinel")) { t3 = deleteFileMutationOptions(); $[4] = t3; } else t3 = $[4]; const { mutate: deleteFile, isPending: isDeleting } = useMutation(t3); let t4; if ($[5] !== appName || $[6] !== download || $[7] !== handleMenuClose || $[8] !== meta.fileExtension || $[9] !== meta.fileName || $[10] !== meta.id) { t4 = () => { handleMenuClose(); download({ id: meta.id, appName, fileName: meta.fileName, fileExtension: meta.fileExtension }); }; $[5] = appName; $[6] = download; $[7] = handleMenuClose; $[8] = meta.fileExtension; $[9] = meta.fileName; $[10] = meta.id; $[11] = t4; } else t4 = $[11]; const handleOnDownload = t4; let t5; if ($[12] !== appName || $[13] !== confirm || $[14] !== deleteFile || $[15] !== fileMetas || $[16] !== handleMenuClose || $[17] !== meta || $[18] !== onDelete || $[19] !== t) { t5 = async () => { if (!await confirm(t("Layout.File.AreYouSureYouWantToDelete", { fileName: meta.fileName }))) return; deleteFile({ id: meta.id, appName }); handleMenuClose(); if (onDelete) onDelete({ remainingFileMetas: fileMetas.filter((m) => m.id !== meta.id), deletedFileMeta: meta }); }; $[12] = appName; $[13] = confirm; $[14] = deleteFile; $[15] = fileMetas; $[16] = handleMenuClose; $[17] = meta; $[18] = onDelete; $[19] = t; $[20] = t5; } else t5 = $[20]; const handleOnDelete = t5; const t6 = menu !== null; let t7; if ($[21] !== menu) { t7 = menu === null ? void 0 : { top: menu.mouseY, left: menu.mouseX }; $[21] = menu; $[22] = t7; } else t7 = $[22]; let t8; if ($[23] !== actions?.download || $[24] !== handleOnDownload || $[25] !== isDownloading || $[26] !== 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") })] }); $[23] = actions?.download; $[24] = handleOnDownload; $[25] = isDownloading; $[26] = t; $[27] = t8; } else t8 = $[27]; let t9; if ($[28] !== actions?.delete || $[29] !== handleOnDelete || $[30] !== isDeleting || $[31] !== 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") })] }); $[28] = actions?.delete; $[29] = handleOnDelete; $[30] = isDeleting; $[31] = t; $[32] = t9; } else t9 = $[32]; let t10; if ($[33] !== t8 || $[34] !== t9) { t10 = /* @__PURE__ */ jsxs(List, { disablePadding: true, children: [t8, t9] }); $[33] = t8; $[34] = t9; $[35] = t10; } else t10 = $[35]; let t11; if ($[36] !== handleMenuClose || $[37] !== t10 || $[38] !== t6 || $[39] !== t7) { t11 = /* @__PURE__ */ jsx(Menu, { open: t6, onClose: handleMenuClose, anchorReference: "anchorPosition", variant: "menu", anchorPosition: t7, children: t10 }); $[36] = handleMenuClose; $[37] = t10; $[38] = t6; $[39] = t7; $[40] = t11; } else t11 = $[40]; return t11; }; //#endregion //#region src/components/file/fileViewer/FileViewerGrid.tsx const IMAGE_SIZE = 150; const FileViewerGrid = (t0) => { const $ = c(13); if ($[0] !== "2cbba638f97002bf031813b72a23cf89c270d57152720a91d49e7425cf66873e") { for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "2cbba638f97002bf031813b72a23cf89c270d57152720a91d49e7425cf66873e"; } 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(61); if ($[0] !== "2cbba638f97002bf031813b72a23cf89c270d57152720a91d49e7425cf66873e") { for (let $i = 0; $i < 61; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "2cbba638f97002bf031813b72a23cf89c270d57152720a91d49e7425cf66873e"; } const { meta, size, itemBar } = t0; const { setImageId, actions, appName } = 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] !== appName || $[5] !== meta.id) { t3 = fileThumbnailQueryOptions({ id: meta.id, appName }); $[4] = appName; $[5] = meta.id; $[6] = t3; } else t3 = $[6]; let t4; if ($[7] !== inView || $[8] !== t3) { t4 = { ...t3, enabled: inView }; $[7] = inView; $[8] = t3; $[9] = t4; } else t4 = $[9]; const { data: source } = useQuery(t4); let t5; if ($[10] === Symbol.for("react.memo_cache_sentinel")) { t5 = () => setShowItemBar(true); $[10] = t5; } else t5 = $[10]; const handleOnMouseEnter = t5; let t6; if ($[11] !== itemBar) { t6 = () => itemBar !== "always" && setShowItemBar(false); $[11] = itemBar; $[12] = t6; } else t6 = $[12]; const handleOnMouseLeave = t6; let t7; if ($[13] !== menu) { t7 = (event) => { setMenu(menu === null ? { mouseX: event.clientX, mouseY: event.clientY } : null); setTimeout(() => setShowItemBar(true)); }; $[13] = menu; $[14] = t7; } else t7 = $[14]; const openMenu = t7; let t8; if ($[15] === Symbol.for("react.memo_cache_sentinel")) { t8 = openFileMutationOptions(); $[15] = t8; } else t8 = $[15]; const { mutate: openFile } = useMutation(t8); let t9; if ($[16] === Symbol.for("react.memo_cache_sentinel")) { t9 = downloadFileMutationOptions(); $[16] = t9; } else t9 = $[16]; const { mutate: download } = useMutation(t9); let t10; if ($[17] !== appName || $[18] !== download || $[19] !== meta.fileExtension || $[20] !== meta.fileName || $[21] !== meta.id || $[22] !== meta.mediaType || $[23] !== openFile || $[24] !== setImageId) { t10 = () => { switch (meta.mediaType) { case "image": return setImageId(meta.id); case "application": return openFile({ id: meta.id, appName }); case "video": return openFile({ id: meta.id, appName }); default: return download({ id: meta.id, appName, fileName: meta.fileName, fileExtension: meta.fileExtension }); } }; $[17] = appName; $[18] = download; $[19] = meta.fileExtension; $[20] = meta.fileName; $[21] = meta.id; $[22] = meta.mediaType; $[23] = openFile; $[24] = setImageId; $[25] = t10; } else t10 = $[25]; const onClick = t10; const t11 = size ?? IMAGE_SIZE; const t12 = size ?? IMAGE_SIZE; let t13; if ($[26] !== t11 || $[27] !== t12) { t13 = { width: t11, height: t12 }; $[26] = t11; $[27] = t12; $[28] = t13; } else t13 = $[28]; const t14 = "thumbnail-" + meta.id; let t15; if ($[29] !== appName || $[30] !== meta.id || $[31] !== queryClient) { t15 = () => queryClient.prefetchQuery(fileQueryOptions({ id: meta.id, appName })); $[29] = appName; $[30] = meta.id; $[31] = queryClient; $[32] = t15; } else t15 = $[32]; const t16 = size ?? IMAGE_SIZE; const t17 = size ?? IMAGE_SIZE; let t18; if ($[33] !== t16 || $[34] !== t17) { t18 = { cursor: "pointer", objectFit: "contain", width: t16, height: t17 }; $[33] = t16; $[34] = t17; $[35] = t18; } else t18 = $[35]; let t19; if ($[36] !== onClick || $[37] !== source || $[38] !== t14 || $[39] !== t15 || $[40] !== t18) { t19 = /* @__PURE__ */ jsx(Box, { component: "img", src: source, loading: "lazy", alt: t14, onClick, onMouseEnter: t15, sx: t18 }); $[36] = onClick; $[37] = source; $[38] = t14; $[39] = t15; $[40] = t18; $[41] = t19; } else t19 = $[41]; let t20; if ($[42] !== actions || $[43] !== itemBar || $[44] !== meta.fileName || $[45] !== openMenu || $[46] !== 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, {}) }) }); $[42] = actions; $[43] = itemBar; $[44] = meta.fileName; $[45] = openMenu; $[46] = showItemBar; $[47] = t20; } else t20 = $[47]; let t21; if ($[48] !== handleOnMouseLeave || $[49] !== ref || $[50] !== t13 || $[51] !== t19 || $[52] !== t20) { t21 = /* @__PURE__ */ jsxs(ImageListItem, { sx: t13, onMouseEnter: handleOnMouseEnter, onMouseLeave: handleOnMouseLeave, ref, children: [t19, t20] }); $[48] = handleOnMouseLeave; $[49] = ref; $[50] = t13; $[51] = t19; $[52] = t20; $[53] = t21; } else t21 = $[53]; let t22; if ($[54] !== actions || $[55] !== menu || $[56] !== meta) { t22 = (actions?.download !== false || actions.delete !== false) && /* @__PURE__ */ jsx(ActionsMenu, { meta, menu, setMenu }); $[54] = actions; $[55] = menu; $[56] = meta; $[57] = t22; } else t22 = $[57]; let t23; if ($[58] !== t21 || $[59] !== t22) { t23 = /* @__PURE__ */ jsxs(Fragment, { children: [t21, t22] }); $[58] = t21; $[59] = t22; $[60] = t23; } else t23 = $[60]; return t23; }; //#endregion //#region src/components/file/fileViewer/FileViewerList.tsx const FileViewerList = (t0) => { const $ = c(6); if ($[0] !== "208130289fc464181a93daf875f18338899c896567dea7dfdec466e5e0b8819d") { for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "208130289fc464181a93daf875f18338899c896567dea7dfdec466e5e0b8819d"; } 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(41); if ($[0] !== "208130289fc464181a93daf875f18338899c896567dea7dfdec466e5e0b8819d") { for (let $i = 0; $i < 41; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "208130289fc464181a93daf875f18338899c896567dea7dfdec466e5e0b8819d"; } const { meta } = t0; const { setImageId, actions, appName } = 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 = openFileMutationOptions(); $[3] = t2; } else t2 = $[3]; const { mutate: openFile } = useMutation(t2); let t3; if ($[4] === Symbol.for("react.memo_cache_sentinel")) { t3 = downloadFileMutationOptions(); $[4] = t3; } else t3 = $[4]; const { mutate: download } = useMutation(t3); let t4; if ($[5] !== appName || $[6] !== download || $[7] !== meta.fileExtension || $[8] !== meta.fileName || $[9] !== meta.id || $[10] !== meta.mediaType || $[11] !== openFile || $[12] !== setImageId) { t4 = () => { switch (meta.mediaType) { case "image": return setImageId(meta.id); case "application": return openFile({ id: meta.id, appName }); case "video": return openFile({ id: meta.id, appName }); default: return download({ id: meta.id, appName, fileName: meta.fileName, fileExtension: meta.fileExtension }); } }; $[5] = appName; $[6] = download; $[7] = meta.fileExtension; $[8] = meta.fileName; $[9] = meta.id; $[10] = meta.mediaType; $[11] = openFile; $[12] = setImageId; $[13] = t4; } else t4 = $[13]; const onClick = t4; let t5; if ($[14] !== meta.mediaType) { t5 = () => { switch (meta.mediaType) { case "image": return /* @__PURE__ */ jsx(Image, {}); case "video": return /* @__PURE__ */ jsx(SmartDisplay, {}); default: return /* @__PURE__ */ jsx(AttachFile, {}); } }; $[14] = meta.mediaType; $[15] = t5; } else t5 = $[15]; const icon = t5; let t6; if ($[16] !== appName || $[17] !== meta.id || $[18] !== queryClient) { t6 = () => queryClient.prefetchQuery(fileQueryOptions({ id: meta.id, appName })); $[16] = appName; $[17] = meta.id; $[18] = queryClient; $[19] = t6; } else t6 = $[19]; let t7; if ($[20] !== icon) { t7 = /* @__PURE__ */ jsx(ListItemIcon, { children: icon() }); $[20] = icon; $[21] = t7; } else t7 = $[21]; const t8 = `${meta.fileName}.${meta.fileExtension}`; let t9; if ($[22] !== t8) { t9 = /* @__PURE__ */ jsx(ListItemText, { primary: t8 }); $[22] = t8; $[23] = t9; } else t9 = $[23]; let t10; if ($[24] !== actions || $[25] !== openMenu) { t10 = (actions?.download !== false || actions.delete !== false) && /* @__PURE__ */ jsx(IconButton, { edge: "end", onClick: openMenu, children: /* @__PURE__ */ jsx(MoreVert, {}) }); $[24] = actions; $[25] = openMenu; $[26] = t10; } else t10 = $[26]; let t11; if ($[27] !== meta.id || $[28] !== onClick || $[29] !== t10 || $[30] !== t6 || $[31] !== t7 || $[32] !== t9) { t11 = /* @__PURE__ */ jsxs(ListItemButton, { onClick, onMouseEnter: t6, children: [ t7, t9, t10 ] }, meta.id); $[27] = meta.id; $[28] = onClick; $[29] = t10; $[30] = t6; $[31] = t7; $[32] = t9; $[33] = t11; } else t11 = $[33]; let t12; if ($[34] !== actions || $[35] !== menu || $[36] !== meta) { t12 = (actions?.download !== false || actions.delete !== false) && /* @__PURE__ */ jsx(ActionsMenu, { meta, menu, setMenu }); $[34] = actions; $[35] = menu; $[36] = meta; $[37] = t12; } else t12 = $[37]; let t13; if ($[38] !== t11 || $[39] !== t12) { t13 = /* @__PURE__ */ jsxs(Fragment, { children: [t11, t12] }); $[38] = t11; $[39] = t12; $[40] = t13; } else t13 = $[40]; 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, appName } = useFile(); const { data: source } = useQuery(fileQueryOptions({ id: fileMetas.find((m) => m.id === metaId).id, appName })); 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(22); if ($[0] !== "e74742441ed0d6e65b5115604767bac731883258173750fb7c59c18e7608f8b0") { for (let $i = 0; $i < 22; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "e74742441ed0d6e65b5115604767bac731883258173750fb7c59c18e7608f8b0"; } const { appName, subId, onDelete, actions, children } = t0; let t1; if ($[1] !== appName || $[2] !== subId) { t1 = fileMetasQueryOptions({ appName, subId }); $[1] = appName; $[2] = subId; $[3] = t1; } else t1 = $[3]; const t2 = !!subId; let t3; if ($[4] !== t1 || $[5] !== t2) { t3 = { ...t1, enabled: t2 }; $[4] = t1; $[5] = t2; $[6] = t3; } else t3 = $[6]; const { data: t4 } = useQuery(t3); let t5; if ($[7] !== t4) { t5 = t4 === void 0 ? [] : t4; $[7] = t4; $[8] = t5; } else t5 = $[8]; const fileMetas = t5; const [imageId, setImageId] = useState(""); if (fileMetas.length === 0) return null; let t6; if ($[9] !== actions || $[10] !== appName || $[11] !== fileMetas || $[12] !== onDelete) { t6 = { appName, fileMetas, onDelete, actions, setImageId }; $[9] = actions; $[10] = appName; $[11] = fileMetas; $[12] = onDelete; $[13] = t6; } else t6 = $[13]; let t7; if ($[14] !== children) { t7 = children({ Grid: FileViewerGrid, List: FileViewerList }); $[14] = children; $[15] = t7; } else t7 = $[15]; let t8; if ($[16] !== imageId) { t8 = /* @__PURE__ */ jsx(ImageViewer, { metaId: imageId }); $[16] = imageId; $[17] = t8; } else t8 = $[17]; let t9; if ($[18] !== t6 || $[19] !== t7 || $[20] !== t8) { t9 = /* @__PURE__ */ jsxs(FileContext.Provider, { value: t6, children: [t7, t8] }); $[18] = t6; $[19] = t7; $[20] = t8; $[21] = t9; } else t9 = $[21]; return t9; }; //#endregion //#region src/components/data-grid/ChipInputCell.tsx const isArray = (value) => Array.isArray(value); const ChipInputCell = (t0) => { const $ = c(21); if ($[0] !== "8808ff69594136f018ebc4ce0aab35ef49e53d008a1bbd04540ff4298aff7091") { for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "8808ff69594136f018ebc4ce0aab35ef49e53d008a1bbd04540ff4298aff7091"; } 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] !== "bdb457850b06e9f4b51331bedaa1d869cfb69eda0cb4837374507dc5e4a28f10") { for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel"); $[0] = "bdb457850b06e9f4b51331bedaa1d869cfb69eda0cb4837374507dc5e4a28f10"; } 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