import type { ChatAttachment, ChatFileAttachment, EnvironmentId, ScopedThreadRef, SnapShotSource, } from "@t3tools/contracts"; import { formatAttachmentSize } from "@t3tools/client-runtime/state/attachments"; import { CircleAlertIcon, PaperclipIcon, PlayIcon, XIcon } from "lucide-react"; import { type ComponentProps, useLayoutEffect, useRef } from "react"; import { type ComposerFileAttachment, type ComposerImageAttachment, type DraftId, composerFileNeedsReattach, } from "../../composerDraftStore"; import { retryAttachmentUpload, useAttachmentUploadStore } from "../../lib/attachmentUploadQueue"; import { formatAttachmentUploadProgress } from "../../lib/attachmentUploadState"; import { isHeicImageFile } from "../../lib/imageCompression"; import { type PendingSnapShotAnimation, scheduleSnapShotAnimationDestination, setSnapShotAnimationDestination, shouldAnimateSnapShotArrival, } from "../../lib/snapShotAnimation"; import { cn } from "~/lib/utils"; import { getRestingComposerImagePreviewCounts } from "../composerFooterLayout"; import { RefreshIcon } from "~/components/ui/refresh-icon"; import { AttachmentFilePreview } from "../files/AttachmentFilePreview"; import { AttachmentImage } from "../media/AttachmentImage"; import { Button } from "../ui/button"; import { Dialog, DialogPopup, DialogTitle } from "../ui/dialog"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import { ComposerImageThumbnail } from "./ComposerImageThumbnail"; import { composerFloatingLayerProps } from "./composerEventScope"; import type { PreparingComposerImage } from "./preparingComposerImages"; import { attachVideoThumbnail, buildExpandedImagePreview, type ExpandedImagePreview, } from "./ExpandedImagePreview"; import { PierreEntryIcon } from "./PierreEntryIcon"; import { SNAP_SHOT_ATTACHMENT_FRAME_CLASS, SnapShotAttachmentDetails, } from "./SnapShotAttachmentDetails"; import { prepareVideoFirstFrame } from "../../lib/videoFirstFrame"; function ComposerVideoThumbnail({ file }: { file: File }) { const setVideo = (video: HTMLVideoElement | null) => { if (!video) return; return attachVideoThumbnail(video, file); }; return (