"use client"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { useEffect, useRef, useState, type ReactNode } from "react"; import { BackButton } from "@/components/common/back-button"; import { pickPlayletCardTags } from "@/components/common/card-tags"; import { DecryptedImage } from "@/components/common/decrypted-image"; import { dramaDetailHref, playHref, totalEpisodeOf, updateStatusLabel, type DramaDetail, type RelatedDrama, } from "@/components/drama-detail/data"; import { openAppDownload } from "@/components/download/download-dialog"; import { EpisodeDirectory } from "@/components/media-page/episode-directory"; import { DramaRecommend, HlAction, TagLinks, tagLinkItems } from "@/components/media-page/parts"; import { playbackRates, XgPlayer, type XgPlayerInstance } from "@/components/player/xg-player"; import { CheckIcon, ChevronIcon } from "./icons"; type Sheet = "speed" | null; /** 播完自动下一集倒计时(秒) */ const AUTO_NEXT_SECONDS = 3; /** 切集后自动起播标记(sessionStorage) */ const AUTOPLAY_NEXT_KEY = "hjsq-drama-autoplay-next"; function consumeAutoplayFlag() { if (typeof window === "undefined") return false; try { if (sessionStorage.getItem(AUTOPLAY_NEXT_KEY) !== "1") return false; sessionStorage.removeItem(AUTOPLAY_NEXT_KEY); return true; } catch { return false; } } function markAutoplayNext() { try { sessionStorage.setItem(AUTOPLAY_NEXT_KEY, "1"); } catch { /* ignore */ } } type H5PlayProps = { detail: DramaDetail; episode: number; src: string; locked: boolean; liked: boolean; /** 点赞数 displayCountLike */ displayCountLike?: number; collected: boolean; /** 收藏数 countCollect */ countCollect?: number; related?: RelatedDrama[]; onLike: () => void; onCollect: () => void; onShare: () => void; onPlaySuccess?: () => void; }; function LockedNotice() { return (

本集暂未在官网开放

); } function formatCount(value: number) { return value >= 10000 ? `${(value / 10000).toFixed(1)}w` : String(value); } function BottomSheet({ open, onClose, label, className = "", children, }: { open: boolean; onClose: () => void; label: string; className?: string; children: ReactNode; }) { return ( <>