一分钟搭建影视站,支持Docker等部署方式
feat(libretv-next): 重构为 Next.js 15 全栈应用
bestZweib4af7b55331d
diff --git a/libretv-next/.env.example b/libretv-next/.env.examplenew file mode 100644index 0000000..644f122--- /dev/null+++ b/libretv-next/.env.example@@ -0,0 +1,12 @@+# 必填:访问密码(不设置时站点会提示管理员配置后再可用)+PASSWORD=change-me++# 可选:会话/代理签名密钥;不设置时从 PASSWORD 派生+# PROXY_SECRET=++# 可选:代理请求上游的超时与重试+REQUEST_TIMEOUT=8000+MAX_RETRIES=1++# 可选:调试+DEBUG=falsediff --git a/libretv-next/.gitignore b/libretv-next/.gitignorenew file mode 100644index 0000000..81b1fe3--- /dev/null+++ b/libretv-next/.gitignore@@ -0,0 +1,6 @@+node_modules/+.next/+out/+.env*.local+*.tsbuildinfo+vitest-results.jsondiff --git a/libretv-next/Dockerfile b/libretv-next/Dockerfilenew file mode 100644index 0000000..37fe68b--- /dev/null+++ b/libretv-next/Dockerfile@@ -0,0 +1,32 @@+# ---- 构建阶段 ----+FROM node:22-alpine AS builder+WORKDIR /app++COPY package.json package-lock.json* ./+RUN npm ci --no-audit --no-fund++COPY . .+ENV DOCKER_BUILD=1+ENV NEXT_TELEMETRY_DISABLED=1+RUN npm run build++# ---- 运行阶段 ----+FROM node:22-alpine AS runner+WORKDIR /app++ENV NODE_ENV=production+ENV NEXT_TELEMETRY_DISABLED=1+ENV PORT=8080+ENV HOSTNAME=0.0.0.0++# 非 root 用户+RUN addgroup -S nodejs && adduser -S nextjs -G nodejs++COPY --from=builder /app/.next/standalone ./+COPY --from=builder /app/.next/static ./.next/static+COPY --from=builder /app/public ./public++USER nextjs++EXPOSE 8080+CMD ["node", "server.js"]diff --git a/libretv-next/README.md b/libretv-next/README.mdnew file mode 100644index 0000000..5eef3fc--- /dev/null+++ b/libretv-next/README.md@@ -0,0 +1,75 @@+# LibreTV Next++LibreTV 的 Next.js 重构版:免费在线视频聚合搜索与观看平台。基于 Next.js 15(App Router)+ TypeScript + Tailwind CSS,播放内核为 ArtPlayer + hls.js,支持亮暗双主题。++> 📖 **完整文档(Wiki)**:[docs/](docs/Home) — [架构](docs/Architecture) · [部署](docs/Deployment) · [配置](docs/Configuration) · [数据源](docs/Data-Sources) · [播放器](docs/Player) · [代理与安全](docs/Proxy-Security) · [FAQ](docs/FAQ)++## 与旧版的主要差异++| 方面 | 旧版 | 本版 |+| --- | --- | --- |+| 架构 | 静态 HTML + 全局脚本 + Express | Next.js App Router + React 组件 + Route Handlers |+| 聚合搜索 | 浏览器内并行请求采集站(暴露用户 IP) | 服务端并行聚合 + 失败隔离 + 关键词过滤 |+| 鉴权 | 页面下发 sha256(password),哈希即凭证 | httpOnly Cookie 会话(HMAC 签名),登录走 POST + 速率限制 |+| m3u8 代理 | 分片重写后丢失鉴权参数导致 401 | Cookie 同源自动携带,分片天然通过鉴权 |+| 播放入口 | watch.html → player.html 跳转链 | 单一 `/watch` 路由,URL 即状态,可分享/后退 |+| 播放失败 | 只能换源 | 直连失败自动回退内置代理重试 |+| 历史与进度 | localStorage 存全集 URL(易撑爆配额) | IndexedDB 只存定位信息,进入播放页按需拉详情 |+| 播放器加载 | Tailwind 运行时编译 | Tailwind 构建期编译 |+| 主题 | 仅深色 | 亮 / 暗 / 跟随系统三态切换,无首屏闪烁 |++## 部署++### Docker(推荐)++```bash+# 在 .env 中设置 PASSWORD+echo "PASSWORD=your-password" > .env+docker compose up -d -b+```++### 手动运行++```bash+npm install+PASSWORD=your-password npm run build+PASSWORD=your-password npm start # 监听 8080+```++### 环境变量++| 变量 | 必填 | 说明 |+| --- | --- | --- |+| `PASSWORD` | 是 | 访问密码;未设置时站点会提示管理员配置 |+| `PROXY_SECRET` | 否 | 会话/代理签名密钥;不设置时从 PASSWORD 派生(多实例部署建议显式设置) |+| `REQUEST_TIMEOUT` | 否 | 代理上游请求超时(毫秒),默认 8000 |+| `MAX_RETRIES` | 否 | 代理请求重试次数,默认 1 |+| `DEBUG` | 否 | 调试日志 |++## 使用说明++1. **添加数据源**:设置 → 添加 API,填入 Apple CMS 采集站地址(如 `https://example.com/api.php/provide/vod`),可选填详情页地址(部分源需要爬详情页提取播放地址)。+2. **搜索**:勾选数据源后输入片名;搜索通过服务端聚合,个别源失败不影响整体结果。+3. **播放**:详情弹窗选择剧集进入 `/watch`;支持快捷键(空格/←→/↑↓/F/Alt+←→)、移动端长按 3 倍速、自动连播、换源测速。+4. **进度与历史**:自动保存在本设备 IndexedDB,仅定位信息入库,播放时自动同步最新剧集。+5. **配置迁移**:设置 → 导出/导入配置(兼容旧版 LibreTV-Settings JSON 的历史记录迁移)。++## 开发++```bash+npm install+PASSWORD=dev-password npm run dev # http://localhost:8080+npm test # 核心库单元测试(cms-parser / m3u8 / ssrf)+npm run typecheck+```++## 安全说明++- 密码只保存在服务端环境变量中,前端不持有任何可重放凭证。+- 登录接口有 IP 速率限制(10 次 / 10 分钟)。+- 代理内置 SSRF 防护:拒绝内网/保留地址(含 DNS 解析后校验),仅放行 http(s)。+- 未登录会话仅允许代理图片类目标(豆瓣封面防盗链需要)。++## 免责声明++本项目不存储、不制作任何视频内容,仅提供第三方公开接口的聚合与播放能力,内容的合法性由对应数据源负责。diff --git a/libretv-next/docker-compose.yml b/libretv-next/docker-compose.ymlnew file mode 100644index 0000000..206b554--- /dev/null+++ b/libretv-next/docker-compose.yml@@ -0,0 +1,15 @@+services:+ libretv:+ build: .+ container_name: libretv-next+ restart: unless-stopped+ ports:+ - "8080:8080"+ environment:+ # 必填:访问密码+ - PASSWORD=${PASSWORD:?请在 .env 中设置 PASSWORD}+ # 可选:会话/代理签名密钥(多实例部署建议显式设置)+ # - PROXY_SECRET=your-secret+ # - REQUEST_TIMEOUT=8000+ # - MAX_RETRIES=1+ # - DEBUG=falsediff --git a/libretv-next/docs/Architecture.md b/libretv-next/docs/Architecture.mdnew file mode 100644index 0000000..35171a6--- /dev/null+++ b/libretv-next/docs/Architecture.md@@ -0,0 +1,114 @@+# 架构++## 技术栈++| 层 | 技术 | 说明 |+| --- | --- | --- |+| 框架 | Next.js 15(App Router)+ React 19 | 服务端 API Routes 与客户端页面同仓 |+| 语言 | TypeScript(strict) | 全量类型覆盖 |+| 样式 | Tailwind CSS(构建期编译)+ CSS 变量主题 | 亮暗双主题,`darkMode: 'class'` |+| 数据获取 | TanStack Query | 搜索/详情/豆瓣的缓存、重试、失效 |+| 客户端状态 | Zustand(persist → localStorage) | 数据源列表与播放设置 |+| 持久化 | Dexie(IndexedDB) | 观看历史、播放进度、搜索历史 |+| 播放 | ArtPlayer + hls.js | 广告过滤 loader、代理回退 |++## 目录结构++```+libretv-next/+├── src/+│ ├── app/+│ │ ├── page.tsx # 首页:搜索 + 豆瓣推荐(?s= URL 驱动)+│ │ ├── watch/page.tsx # 播放页(唯一入口,URL 即状态)+│ │ ├── about/page.tsx+│ │ ├── layout.tsx # 主题无闪烁内联脚本 + Providers+│ │ ├── manifest.ts # PWA manifest+│ │ └── api/ # 服务端 Route Handlers+│ │ ├── auth/route.ts # 登录/登出/会话状态+│ │ ├── status/route.ts # 站点状态(客户端据此弹登录框)+│ │ ├── search/route.ts # 聚合搜索(并行 + 失败隔离 + 过滤)+│ │ ├── detail/route.ts # 详情(列表接口 → 详情页 HTML 降级)+│ │ ├── douban/route.ts # 豆瓣推荐(直连 + 缓存 + 代理降级)+│ │ └── proxy/[url]/route.ts# 流式代理(SSRF 防护 + m3u8 重写)+│ ├── components/ # UI 组件(见下)+│ └── lib/ # 纯逻辑库(可单元测试)+│ ├── cms-parser.ts # Apple CMS 解析(列表/详情/详情页爬取)+│ ├── m3u8.ts # m3u8 重写与广告过滤+│ ├── ssrf.ts # 内网地址识别与 DNS 校验+│ ├── auth.ts # 会话签名/校验、登录限流+│ ├── douban.ts # 豆瓣数据获取(降级链 + TTL 缓存)+│ ├── fetch-utils.ts # 超时/重试/内存缓存+│ ├── db.ts # Dexie schema 与历史/进度 CRUD+│ ├── store.ts # Zustand 全局设置+│ ├── client-api.ts # 客户端 API 封装(401 → 全局登录框)+│ └── utils.ts # 时间格式化、图片代理 URL、sha256 等+├── docs/ # 本 Wiki+├── Dockerfile / docker-compose.yml+└── README.md+```++## 组件一览++| 组件 | 职责 |+| --- | --- |+| `providers.tsx` | QueryClient + Theme + Toast + Auth 四层 Provider 嵌套 |+| `theme.tsx` | 亮暗主题上下文与三态切换按钮(light/dark/system) |+| `auth.tsx` | 认证上下文;监听全局 401 事件弹出登录框 |+| `header.tsx` | 顶部导航 + 通用抽屉(Drawer)骨架 |+| `search`(page.tsx 内联) | 搜索框、历史 chips、结果网格、空态引导 |+| `douban-section.tsx` | 豆瓣推荐(分类/标签/分页加载) |+| `video-card.tsx` | 搜索结果卡片 / 豆瓣卡片(封面多级降级) |+| `detail-modal.tsx` | 详情弹窗(海报 + 元信息 + 剧集 + 复制链接) |+| `source-manager.tsx` | 设置抽屉:数据源 CRUD、过滤开关、封面加载方式、配置导入导出 |+| `history-panel.tsx` | 观看历史抽屉(Dexie liveQuery 实时刷新) |+| `player-shell.tsx` | ArtPlayer/HLS 封装:广告过滤、快捷键、长按倍速、代理回退 |+| `switch-source.tsx` | 换源面板:跨源搜索 → 同名匹配 → 测速排序 → 切换 |+| `toast.tsx` | 并行堆叠 Toast + 全局 Loading 遮罩 |++## 数据流++### 搜索++```+浏览器 服务端 上游+ │ POST /api/search │ │+ │ {wd, sources[], filter} │── 并行 fetch(8s 超时)────→│ 采集站 ×N+ │ │← JSON ─────────────────────│+ │← {list, failures[]} ──────│ 合并/去重/排序/成人过滤 │+```++- 客户端把自定义数据源配置随请求上传(数据源配置仅存于用户浏览器);+- 单源失败进入 `failures`,不影响其他源结果;+- React Query 以 `['search', wd, selectedKeys, filter]` 为缓存键。++### 播放++```+/watch?source=key&id=vodId&index=n&title=..&sourceUrl=..+ │+ ├─ resolveSource(): 从 Zustand store 取数据源配置(URL 参数兜底,支持分享链接)+ ├─ GET /api/detail → episodes[] → 当前集 URL+ └─ PlayerShell(ArtPlayer+hls)+ ├─ 直连 m3u8+ └─ 致命网络错误 → /api/proxy/<url> 重试一次(cookie 鉴权)+```++进度:`video:timeupdate`(5s 节流)+ 暂停 + 卸载 → IndexedDB `progress`;+历史:进入播放页 2s 后 upsert,仅存定位信息(`sourceKey + vodId + episodeIndex`),不存全集 URL。++### 换源++`switch-source.tsx` → `POST /api/search`(按标题)→ 每源取完全同名结果(否则第一条)→ `GET /api/detail` 并发测速(接口耗时)→ 按速度排序展示 → 切换时保留集数索引。++## 与旧版的架构差异++| 维度 | 旧版 | 本版 |+| --- | --- | --- |+| API 层 | 浏览器内 monkey-patch `window.fetch` 假装 `/api/*` | 真实服务端 Route Handlers |+| 聚合搜索位置 | 用户浏览器(IP 暴露、无法缓存) | 服务端 |+| 鉴权 | 页面下发 sha256(password),`auth=` 哈希即凭证 | httpOnly cookie + HMAC 签名会话 |+| m3u8 分片 | 重写为 `/proxy/...` 但丢失鉴权参数 → 401 | cookie 同源自动携带,天然通过 |+| 页面间状态 | URL + localStorage 双总线(10+ key) | URL 即状态 + IndexedDB |+| 播放入口 | watch.html → player.html 跳转链 | 单一 `/watch` 路由 |+| 转义 | 4 种手工转义函数,存在 XSS 缺口 | React 自动转义,无 innerHTML |+| 主题 | 无 | CSS 变量 + class 策略,三态切换 |diff --git a/libretv-next/docs/Configuration.md b/libretv-next/docs/Configuration.mdnew file mode 100644index 0000000..ba69623--- /dev/null+++ b/libretv-next/docs/Configuration.md@@ -0,0 +1,60 @@+# 配置++## 环境变量++| 变量 | 必填 | 默认 | 说明 |+| --- | --- | --- | --- |+| `PASSWORD` | **是** | — | 访问密码。未设置时站点可用但所有功能接口返回 503,并提示管理员配置 |+| `PROXY_SECRET` | 否 | 从 PASSWORD 派生 | 会话与代理签名密钥。单实例可不设;多实例/负载均衡部署必须显式设置,否则各实例会话互不认账 |+| `REQUEST_TIMEOUT` | 否 | `8000` | 代理上游请求超时(毫秒) |+| `MAX_RETRIES` | 否 | `1` | 代理请求重试次数 |+| `USER_AGENT` | 否 | Chrome UA | 代理请求使用的 UA(豆瓣防盗链等场景) |+| `DEBUG` | 否 | `false` | 调试日志 |++> 旧版的 `CORS_ORIGIN`、`CACHE_MAX_AGE`、`BLOCKED_HOSTS`、`BLOCKED_IP_PREFIXES`、`FILTERED_HEADERS` 在重构版中已内化为安全默认值,不再需要配置。++## 运行时设置(用户级)++以下设置保存在每个用户浏览器的 localStorage(键 `libretv-settings`),通过「设置」抽屉修改:++### 数据源++- **自定义 API 列表**:名称、API 地址、详情页地址(可选)、成人标记;+- **勾选参与搜索的源**:仅勾选的源会参与聚合搜索与换源。++### 播放与过滤++| 开关 | 默认 | 说明 |+| --- | --- | --- |+| 成人内容过滤 | 开 | 服务端按分类关键词过滤(伦理片/福利片等) |+| 广告过滤 | 开 | hls.js loader 剔除 m3u8 中的 `#EXT-X-DISCONTINUITY` 广告片段 |+| 自动连播 | 开 | 单集结束自动播放下一集 |+| 豆瓣推荐 | 开 | 首页展示豆瓣热门影视 |++### 封面图加载方式++| 方式 | 说明 |+| --- | --- |+| 直连(默认) | 浏览器直接加载豆瓣/采集站封面,最快;部分网络下豆瓣图会 418 |+| 内置代理 | 经 `/api/proxy/` 转发(带豆瓣 Referer 伪装),豆瓣图不再被拒 |+| 自定义代理 | 模板字符串,`{url}` 为编码后的原图地址;不含占位符则直接拼接 |++### 主题++- 头部太阳/月亮/显示器图标,点击在 **浅色 → 深色 → 跟随系统** 间循环;+- 存储于 `localStorage['libretv-theme']`;+- 页面 HTML 内有同步脚本,刷新无闪烁;+- 跟随系统模式下监听 `prefers-color-scheme` 变化实时切换。++### 配置导入导出++- **导出**:生成 `LibreTV-Settings_<时间戳>.json`(数据源、播放设置、观看历史、搜索历史);+- **导入**:兼容旧版 LibreTV 导出的配置文件;旧版观看历史(含全集 URL 列表)会自动迁移为定位信息格式。++## 存储结构(IndexedDB `libretv-next`)++| 表 | 主键 | 字段 | 说明 |+| --- | --- | --- | --- |+| `history` | `id = sourceKey_vodId` | title, pic, episodeIndex, totalEpisodes, playbackPosition, duration, timestamp | 上限 100 条,超出淘汰最旧 |+| `progress` | `key = sourceKey_vodId_index` | position, duration, updatedAt | 每集一条,看完清除 |+| `searchHistory` | `text` | timestamp | 上限 10 条 |diff --git a/libretv-next/docs/Data-Sources.md b/libretv-next/docs/Data-Sources.mdnew file mode 100644index 0000000..1da1b5b--- /dev/null+++ b/libretv-next/docs/Data-Sources.md@@ -0,0 +1,59 @@+# 数据源++LibreTV 采用**空壳设计**:不内置任何采集站,由部署者/用户自行添加,避免内置源失效与合规风险。++## 支持的数据源类型++Apple CMS(苹果CMS)标准采集接口,即提供以下接口的资源站:++```+搜索:{api}?ac=videolist&wd={关键词}+详情:{api}?ac=videolist&ids={vod_id}+```++## 添加数据源++设置 → 数据源 → 「+ 添加 API」:++| 字段 | 必填 | 说明 |+| --- | --- | --- |+| 名称 | 是 | 显示用名称 |+| API 地址 | 是 | 形如 `https://example.com/api.php/provide/vod`,结尾 `/` 会自动去除 |+| 详情页地址 | 否 | 形如 `https://example.com`;部分源列表接口不返回播放地址,需要爬取详情页 HTML 提取 m3u8 |+| 成人标记 | 否 | 标记后受「成人内容过滤」开关控制 |++添加后默认自动勾选参与搜索。++## 详情页爬取(特殊源)++当标准详情接口拿不到播放地址时,服务端自动降级:++1. 请求 `{detail}/index.php/vod/detail/id/{id}.html`;+2. 通用正则提取 `\$https://...m3u8`;+3. 若无结果,尝试非凡影视特征路径模式(`/日期/哈希/index.m3u8`);+4. 去重后作为剧集列表。++## 服务端聚合行为++- 所有勾选的源**并行**搜索,单源 8 秒超时;+- 任一源失败不影响整体,失败源在结果区顶部以名称列出;+- 结果按「源内去重(sourceKey+vodId)→ 名称排序(zh-CN)」合并;+- 成人过滤在服务端执行,关键词包括:伦理片、福利、里番动漫、无码、SWAG 等。++## 自定义源的数据流++数据源配置**只保存在用户浏览器**(localStorage),服务端不存储。每次搜索/详情请求会把用到的源配置随请求上传,因此:++- 同一部署的不同用户可以有不同的数据源集合;+- 分享播放链接时 URL 会携带 `sourceUrl` 参数,接收者即使未配置同名的源也能播放(见 [Player](Player))。++## 常见问题++**Q: 添加源后搜索无结果?**+用浏览器直接访问 `{api}?ac=videolist&wd=test` 验证是否返回 JSON。部分源校验 Referer/UA 或已停更。++**Q: 搜索成功但详情提示"未找到播放资源"?**+该源的播放地址可能需要详情页爬取,请补填「详情页地址」;或该影片在源内本身无 m3u8 地址。++**Q: 可以批量导入吗?**+旧版支持逗号分隔的多个 API 地址一次性导入(`?urls=` 参数)。重构版暂未移植该入口,可通过「导出/导入配置」迁移。diff --git a/libretv-next/docs/Deployment.md b/libretv-next/docs/Deployment.mdnew file mode 100644index 0000000..7fe2d23--- /dev/null+++ b/libretv-next/docs/Deployment.md@@ -0,0 +1,86 @@+# 部署++## Docker(推荐)++```bash+git clone <本仓库>+cd libretv-next++# 设置密码+echo "PASSWORD=your-strong-password" > .env++docker compose up -d --build+# 访问 http://localhost:8080+```++镜像为多阶段构建(`DOCKER_BUILD=1` 时输出 standalone),运行容器不包含构建工具,体积小。++### docker-compose.yml++```yaml+services:+ libretv:+ build: .+ ports: ["8080:8080"]+ environment:+ - PASSWORD=${PASSWORD:?请在 .env 中设置 PASSWORD}+ # - PROXY_SECRET=your-secret+```++## 手动部署++要求 Node.js ≥ 20(推荐 22):++```bash+npm ci+PASSWORD=your-password npm run build+PASSWORD=your-password npm start # 默认 8080 端口+```++> 注意:`output: 'standalone'` 仅在 `DOCKER_BUILD=1` 时启用,本地 `next start` 无需(也不兼容)standalone。++### 生产建议++- 使用反向代理(Nginx / Caddy)终结 HTTPS,转发到 8080;+- 会话 Cookie 在生产环境(`NODE_ENV=production`)下自动启用 `Secure`,需 HTTPS 访问;+- 设置 `PROXY_SECRET` 而非依赖 PASSWORD 派生,避免更换密码导致全员会话失效以外的副作用。++## 环境变量++完整列表见 [Configuration](Configuration)。最小可运行配置只有一个 `PASSWORD`。++## 健康检查与验证++```bash+curl http://localhost:8080/api/status+# {"passwordRequired":true,"verified":false,"version":"2.0.0"}++# 未登录访问受保护接口应返回 401+curl -X POST http://localhost:8080/api/search -d '{}' -H 'Content-Type: application/json' -i | head -1+# HTTP/1.1 401 Unauthorized++# SSRF 防护应拦截内网地址+curl -i "http://localhost:8080/api/proxy/http%3A%2F%2F127.0.0.1%3A8080%2F" | head -1+# HTTP/1.1 400/403+```++## 升级++1. `git pull`+2. `npm ci && npm run build`(或 `docker compose up -d --build`)+3. 用户数据(历史/进度/设置)在浏览器端,升级无感迁移。++## 从旧版迁移++- 旧版打开「设置 → 配置文件 → 导出」,新版「设置 → 配置 → 导入配置」选择同一文件即可迁移数据源与观看历史;+- 旧版 localStorage 各零散 key 不会被读取,仅识别标准导出 JSON;+- 旧版的 `PASSWORD` 环境变量直接沿用(明文比对改为服务端恒定时间比较,用户无感知)。++## 开发++```bash+npm install+PASSWORD=dev-password npm dev # http://localhost:8080+npm run typecheck # TypeScript 检查+npm test # 单元测试(cms-parser / m3u8 / ssrf)+```diff --git a/libretv-next/docs/FAQ.md b/libretv-next/docs/FAQ.mdnew file mode 100644index 0000000..5c605f6--- /dev/null+++ b/libretv-next/docs/FAQ.md@@ -0,0 +1,60 @@+# FAQ++## 部署相关++**Q: 打开站点一直提示"需要配置密码"?**+服务器未设置 `PASSWORD` 环境变量。Docker 部署检查 `.env`;手动部署确认启动命令中带 `PASSWORD=...`。设置后需重启服务。++**Q: 登录后刷新又要求输入密码?**+- 生产环境(HTTPS)下 Cookie 为 `Secure`,用 HTTP 访问生产构建会导致 Cookie 无法保存——请配置 HTTPS 或以开发模式运行;+- 多实例部署未设置 `PROXY_SECRET`:各实例派生密钥不同,会话互不认账。++**Q: 忘记密码怎么办?**+修改 `PASSWORD` 环境变量并重启。旧会话立即全部失效(密钥随之改变)。++## 搜索相关++**Q: 搜索提示"请先添加数据源" / "尚未勾选数据源"?**+本项目不内置采集站。到「设置 → 数据源」添加 Apple CMS 采集站地址并勾选。++**Q: 某个源一直搜索失败?**+结果区顶部会列出失败源名称。直接浏览器访问 `{api}?ac=videolist&wd=test` 判断是源挂了还是网络不通;不用的源可以取消勾选或删除。++**Q: 搜索结果为什么按名称排序?**+跨源聚合后按影片名(zh-CN locale)排序、同名片按源名排序,便于对比同一影片在不同源的画质/集数。++## 播放相关++**Q: 视频一直"正在加载"?**+按顺序尝试:① 点「切换资源」换其他源;② 设置中切换封面/直连相关配置确认网络;③ 该源分片可能仅允许特定地区/Referer,代理回退通常能自动解决,若仍失败请换源。++**Q: 出现"直连失败,改用代理重试"后播放正常,但快进卡顿?**+代理播放的带宽受限于服务器。属预期行为,建议优先寻找可直连的源。++**Q: 自动跳到下一集后从头播放了?**+确认「自动连播」开关已打开(播放页操作栏或设置中)。++**Q: 换源后集数对不上?**+换源按集数索引对齐,目标源集数少于当前集数时会回到第 1 集。++## 数据相关++**Q: 换浏览器/设备后历史和进度还在吗?**+不在。历史与进度保存在本机 IndexedDB,不上传服务器。可用「设置 → 导出配置」手动迁移。++**Q: 观看历史里某条记录播放时提示"数据源不存在"?**+该记录的来源源已被删除。重新在设置中添加同名 API 地址(key 一致即可恢复),或删除该历史。++**Q: IndexedDB 数据会占多少空间?**+仅存定位信息(不含全集 URL),100 条历史通常 < 100KB。++## 安全相关++**Q: 密码是明文传输吗?**+登录请求把密码放在 POST body 中,生产环境务必启用 HTTPS 防止传输层被窃听。++**Q: 代理会被滥用吗?**+代理需要登录会话;未登录仅放行图片类目标且同样受 SSRF 校验约束。公网部署建议在反代层再加 IP 级限流。++**Q: 为什么不给站点加注册/多用户?**+LibreTV 定位为轻量自托管工具,单密码门禁 + 本机数据即可满足场景;多用户会引入服务端存储与隐私复杂度。diff --git a/libretv-next/docs/Home.md b/libretv-next/docs/Home.mdnew file mode 100644index 0000000..f28b23e--- /dev/null+++ b/libretv-next/docs/Home.md@@ -0,0 +1,42 @@+# LibreTV Next Wiki++欢迎来到 LibreTV Next 的项目文档。LibreTV 是一个免费的在线视频聚合搜索与观看平台,基于 Next.js 15 重构。++## 文档目录++| 文档 | 内容 |+| --- | --- |+| [Architecture](Architecture) | 系统架构、目录结构、数据流、技术选型说明 |+| [Deployment](Deployment) | Docker / 手动部署、环境变量、升级指南 |+| [Configuration](Configuration) | 环境变量详解、主题系统、数据源管理、配置导入导出 |+| [Data-Sources](Data-Sources) | 采集站(Apple CMS)接入说明、自定义 API 格式、常见问题源 |+| [Player](Player) | 播放器功能、快捷键、广告过滤、代理回退、进度与历史 |+| [Proxy-Security](Proxy-Security) | 代理鉴权设计、SSRF 防护、安全模型与旧版对比 |+| [FAQ](FAQ) | 常见问题排查 |++## 快速开始++```bash+# Docker 部署(推荐)+echo "PASSWORD=your-password" > .env+docker compose up -d++# 本地开发+npm install+PASSWORD=dev-password npm run dev # http://localhost:8080+```++## 核心特性++- **聚合搜索**:多采集站服务端并行搜索,单源失败不影响整体,用户 IP 不暴露给第三方+- **HLS 播放**:ArtPlayer + hls.js,广告分片过滤、自动连播、倍速、快捷键、移动端长按 3 倍速+- **智能回退**:视频直连失败(CORS / 防盗链)时自动改走内置代理重试+- **进度同步**:播放进度与观看历史存于本机 IndexedDB,精确到秒的续播+- **换源测速**:跨源搜索同名资源并测速排序,一键切换保留集数位置+- **豆瓣推荐**:电影 / 剧集分类浏览,服务端直连避免公共 CORS 代理+- **亮暗主题**:跟随系统 / 手动切换,无首屏闪烁+- **PWA**:可安装到桌面 / 主屏幕++## 与旧版(静态 HTML + Express)的关系++本项目是 [LibreTV 旧版](https://github.com/bestZwei/LibreTV)的完整重构。功能对齐的同时修复了旧版的多项问题(历史记录 XSS、m3u8 分片鉴权丢失、密码哈希暴露等),架构差异详见 [Architecture](Architecture)。diff --git a/libretv-next/docs/Player.md b/libretv-next/docs/Player.mdnew file mode 100644index 0000000..caf0e2a--- /dev/null+++ b/libretv-next/docs/Player.md@@ -0,0 +1,52 @@+# 播放器++播放器基于 ArtPlayer + hls.js,封装在 `src/components/player-shell.tsx`,页面入口为 `/watch` 路由。++## 播放链接格式++```+/watch?source=custom_0&id=20717&index=0&title=流浪地球&sourceUrl=https://..+ └─数据源 key └─影片 id └─集数 └─标题 └─数据源地址(分享链接兜底)+```++- `source` + `id` 存在时:从 `/api/detail` 拉取剧集列表,`index` 指定当前集;+- 仅 `url` 参数时(直连分享):直接播放该地址,无剧集列表;+- URL 即状态:刷新/分享/前进后退均无损。++## 功能++| 功能 | 说明 |+| --- | --- |+| 自动连播 | 单集结束 0.8s 后自动下一集;片尾自动清除该集进度 |+| 进度恢复 | 优先 URL `position` 参数,否则读 IndexedDB;>10s 且非片尾(95%)时恢复并提示"已从 XX:XX 继续播放" |+| 换源 | 「切换资源」→ 跨源搜索同名影片 → 详情接口测速 → 按速度排序;切换后保留当前集数索引 |+| 集数倒序 | 倒序排列按钮,激活集自动滚动进可视区 |+| 广告过滤 | 自定义 hls.js loader 对 manifest/level 文本剔除 `#EXT-X-DISCONTINUITY` 广告分段(设置中可关) |+| 错误恢复 | HLS 网络错误自动 `startLoad`,媒体错误自动 `recoverMediaError`;多次失败显示错误面板 |+| 代理回退 | 直连致命网络错误(CORS/防盗链/分片被拒)时,自动改走 `/api/proxy/`(cookie 鉴权)重试一次 |+| 画中画 / 截图 / 网页全屏 / 倍速 | ArtPlayer 原生能力 |++## 快捷键++| 按键 | 功能 |+| --- | --- |+| `空格` | 播放 / 暂停 |+| `←` / `→` | 快退 / 快进 5 秒 |+| `↑` / `↓` | 音量 ±10% |+| `F` | 全屏切换 |+| `Alt + ←` / `Alt + →` | 上一集 / 下一集 |+| 双击 | 全屏切换 |+| 移动端长按 | 3 倍速播放(松开恢复) |++## 播放进度与历史++- **进度**:`video:timeupdate` 每 5 秒节流保存 + 暂停/页面隐藏/组件卸载时强制保存 → IndexedDB `progress` 表;+- **历史**:进入播放页 2 秒后写入 `history` 表(仅 `sourceKey + vodId + episodeIndex` 定位信息),播放中增量更新进度;+- **剧集同步**:从历史进入播放页时重新拉取详情,天然获得最新剧集列表(旧版需专门的同步逻辑)。++## 播放失败的排查顺序++1. **换源**:点击「切换资源」,选择测速绿色(低延迟)的其他源;+2. **观察回退提示**:若出现"直连失败,改用代理重试"说明该源分片有防盗链,代理通常可解;+3. **关广告过滤**:个别源本身依赖 DISCONTINUITY 做多码率切换,误过滤会黑屏;+4. **直接验证**:浏览器访问详情返回的 m3u8 地址确认源本身可用。diff --git a/libretv-next/docs/Proxy-Security.md b/libretv-next/docs/Proxy-Security.mdnew file mode 100644index 0000000..7e4b61a--- /dev/null+++ b/libretv-next/docs/Proxy-Security.md@@ -0,0 +1,61 @@+# 代理与安全++本项目的服务端承担三类安全职责:**访问鉴权**、**代理防护(SSRF)**、**上游伪装(防盗链)**。++## 鉴权模型++### 会话++- 登录:`POST /api/auth`,body 携带明文密码(**不走 URL**,避免进访问日志);+- 服务端用 SHA-256 摘要做**恒定时间比较**(`crypto.timingSafeEqual`),不暴露时序信息;+- 通过后签发会话 Cookie:`ltv_session = <过期时间戳>.<HMAC-SHA256(密钥, 时间戳)>`;+ - `httpOnly`(JS 不可读)、`SameSite=Lax`、生产环境 `Secure`、有效期 90 天;+ - 密钥 = `PROXY_SECRET`,未设置时从 `PASSWORD` 派生;+- 所有 `/api/*`(除 status/登录外)通过 `guardRequest` 校验会话,未登录返回 401,客户端全局弹出登录框。++### 速率限制++登录接口按 IP 限流:**10 次 / 10 分钟**,超限返回 429。内存实现,适合单实例部署。++### 与旧版的安全差异++| 问题 | 旧版 | 本版 |+| --- | --- | --- |+| 密码哈希下发 | 页面源码含 `sha256(PASSWORD)` | 服务端独享,前端零凭证 |+| 哈希即凭证 | `?auth=<哈希>` 可无限重放代理请求 | 已移除该兼容模式 |+| 明文密码上 URL | `GET /api/proxy-token?password=...` | `POST /api/auth` body |+| 登录限流 | 无 | 10 次 / 10 分钟 |+| token 轮换 | 10 分钟短时效 token(需手工附参) | 会话 Cookie,m3u8 分片同源自动携带 |++## 代理(`GET /api/proxy/<encoded-url>`)++### 访问规则++- **已登录**:可代理任意符合 SSRF 校验的目标(视频分片、key、JSON、图片);+- **未登录**:仅放行图片类目标(`.jpg/.png/...` 或 `doubanio.com` 域),用于登录页前的封面展示;其余一律 401。++### SSRF 防护(双层)++1. **字面量校验**(请求前):协议白名单 http/https;主机名黑名单(localhost 等);IPv4/IPv6 字面量直接比对私有段;+2. **DNS 解析校验**(请求前):域名解析出的所有地址逐一检查,拦截解析到内网的域名(防 DNS rebinding 基础形态)。++被拦截的地址段:回环(127.0.0.0/8, ::1)、私有(10/8, 172.16/12, 192.168/16)、链路本地(169.254/16,含云元数据 169.254.169.254)、CGNAT(100.64/10)、协议保留(192.0.0.0/24)、唯一本地(fc00::/7)、链路本地 v6(fe80::/10)。++### 行为++- **流式透传**:视频分片 / 图片 / key 不落盘,直接 pipe;+- **m3u8 重写**:manifest/level 文本中的分片、`#EXT-X-KEY`、`#EXT-X-MAP` 地址全部改写为 `/api/proxy/<encoded>`(递归深度 ≤5),嵌套播放列表同样经代理,规避上游 CORS 限制;+- **响应头净化**:剔除 CSP/Cookie/Set-Cookie/X-Frame-Options/CORS 头与 Content-Encoding/Length(fetch 已解压,防止二次解压乱码);+- **Range 透传**:保留 `Range`/`Content-Range`,支持拖动;+- **重试**:上游失败按 `MAX_RETRIES` 重试。++### 上游伪装++- 目标为 `doubanio.com` 时自动携带 `Referer: https://movie.douban.com/`,绕过豆瓣图片 418 防盗链;+- 统一携带 Chrome UA。++## 已知边界++- 速率限制为内存实现,多实例部署需换共享存储(Redis);+- SSRF 的 DNS 校验存在理论上的 TOCTOU 窗口(校验后、请求前 DNS 记录变更);对公网部署建议叠加网络层出口限制;+- 会话无法服务端主动吊销(无状态签名);更换 `PROXY_SECRET` 或 `PASSWORD` 可使全部会话失效。diff --git a/libretv-next/next-env.d.ts b/libretv-next/next-env.d.tsnew file mode 100644index 0000000..830fb59--- /dev/null+++ b/libretv-next/next-env.d.ts@@ -0,0 +1,6 @@+/// <reference types="next" />+/// <reference types="next/image-types/global" />+/// <reference path="./.next/types/routes.d.ts" />++// NOTE: This file should not be edited+// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.diff --git a/libretv-next/next.config.ts b/libretv-next/next.config.tsnew file mode 100644index 0000000..4c19938--- /dev/null+++ b/libretv-next/next.config.ts@@ -0,0 +1,13 @@+import type { NextConfig } from 'next';++const nextConfig: NextConfig = {+ // standalone 输出仅供 Docker 镜像构建使用(DOCKER_BUILD=1);+ // 本地 next start 在 standalone 模式下不受支持,故按环境切换+ output: process.env.DOCKER_BUILD === '1' ? 'standalone' : undefined,+ reactStrictMode: true,+ // 采集站/豆瓣等上游地址在运行时由用户配置,构建期无法枚举,关闭图片优化改用 <img>+ images: { unoptimized: true },+ eslint: { ignoreDuringBuilds: true },+};++export default nextConfig;diff --git a/libretv-next/package-lock.json b/libretv-next/package-lock.jsonnew file mode 100644index 0000000..4dcce44--- /dev/null+++ b/libretv-next/package-lock.json@@ -0,0 +1,3574 @@+{+ "name": "libretv-next",+ "version": "2.0.0",+ "lockfileVersion": 3,+ "requires": true,+ "packages": {+ "": {+ "name": "libretv-next",+ "version": "2.0.0",+ "license": "Apache-2.0",+ "dependencies": {+ "@tanstack/react-query": "^5.59.0",+ "artplayer": "^5.2.3",+ "dexie": "^4.0.8",+ "dexie-react-hooks": "^1.1.7",+ "hls.js": "^1.5.17",+ "next": "^15.1.0",+ "react": "^19.0.0",+ "react-dom": "^19.0.0",+ "zustand": "^5.0.2"+ },+ "devDependencies": {+ "@types/node": "^22.10.0",+ "@types/react": "^19.0.0",+ "@types/react-dom": "^19.0.0",+ "autoprefixer": "^10.4.20",+ "postcss": "^8.4.49",+ "tailwindcss": "^3.4.15",+ "typescript": "^5.7.2",+ "vitest": "^2.1.8"+ }+ },+ "node_modules/@alloc/quick-lru": {+ "version": "5.3.0",+ "resolved": "https://registry.npmmirror.com/@alloc/quick-lru/-/quick-lru-5.3.0.tgz",+ "integrity": "sha512-U4+70Pc5ZS9osnCBCE5Jha/ciHM+Yp+CNMNC/7HvYbNRk1Ldd+f7qO65W5qfhu/TCv+/ozljlXXe9Nj8419DMA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/@emnapi/runtime": {+ "version": "1.11.3",+ "resolved": "https://registry.npmmirror.com/@emnapi/runtime/-/runtime-1.11.3.tgz",+ "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==",+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "tslib": "^2.4.0"+ }+ },+ "node_modules/@esbuild/aix-ppc64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",+ "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "aix"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/android-arm": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz",+ "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/android-arm64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz",+ "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/android-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz",+ "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/darwin-arm64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz",+ "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/darwin-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz",+ "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/freebsd-arm64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz",+ "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/freebsd-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz",+ "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-arm": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz",+ "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-arm64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz",+ "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-ia32": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz",+ "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==",+ "cpu": [+ "ia32"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-loong64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz",+ "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==",+ "cpu": [+ "loong64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-mips64el": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz",+ "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==",+ "cpu": [+ "mips64el"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-ppc64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz",+ "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-riscv64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz",+ "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==",+ "cpu": [+ "riscv64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-s390x": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz",+ "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==",+ "cpu": [+ "s390x"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz",+ "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/netbsd-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",+ "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/openbsd-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz",+ "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/sunos-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz",+ "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "sunos"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/win32-arm64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz",+ "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/win32-ia32": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz",+ "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==",+ "cpu": [+ "ia32"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/win32-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz",+ "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@img/colour": {+ "version": "1.1.0",+ "resolved": "https://registry.npmmirror.com/@img/colour/-/colour-1.1.0.tgz",+ "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==",+ "license": "MIT",+ "optional": true,+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@img/sharp-darwin-arm64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.4.tgz",+ "integrity": "sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-darwin-arm64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-darwin-x64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.4.tgz",+ "integrity": "sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-darwin-x64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-freebsd-wasm32": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.4.tgz",+ "integrity": "sha512-lIsKw/BU+kjB4eZjxrYrZmwOJYi3Ajrv66iAlBmUPyKc3HpnloevB1g3wxGD9P/5BbQ1brBGl65VRRrCvQDEqA==",+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "dependencies": {+ "@img/sharp-wasm32": "0.35.4"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-darwin-arm64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.3.tgz",+ "integrity": "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg==",+ "cpu": [+ "arm64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "darwin"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-darwin-x64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.3.tgz",+ "integrity": "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw==",+ "cpu": [+ "x64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "darwin"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-arm": {+ "version": "1.3.3",+ "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.3.tgz",+ "integrity": "sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA==",+ "cpu": [+ "arm"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-arm64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.3.tgz",+ "integrity": "sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A==",+ "cpu": [+ "arm64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-ppc64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.3.tgz",+ "integrity": "sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w==",+ "cpu": [+ "ppc64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-riscv64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.3.tgz",+ "integrity": "sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ==",+ "cpu": [+ "riscv64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-s390x": {+ "version": "1.3.3",+ "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.3.tgz",+ "integrity": "sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q==",+ "cpu": [+ "s390x"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-x64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.3.tgz",+ "integrity": "sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA==",+ "cpu": [+ "x64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linuxmusl-arm64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.3.tgz",+ "integrity": "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw==",+ "cpu": [+ "arm64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linuxmusl-x64": {+ "version": "1.3.3",+ "resolved": "https://registry.npmmirror.com/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.3.tgz",+ "integrity": "sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw==",+ "cpu": [+ "x64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-linux-arm": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.4.tgz",+ "integrity": "sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A==",+ "cpu": [+ "arm"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-arm": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linux-arm64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.4.tgz",+ "integrity": "sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-arm64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linux-ppc64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.4.tgz",+ "integrity": "sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ==",+ "cpu": [+ "ppc64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-ppc64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linux-riscv64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.4.tgz",+ "integrity": "sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA==",+ "cpu": [+ "riscv64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-riscv64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linux-s390x": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.4.tgz",+ "integrity": "sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ==",+ "cpu": [+ "s390x"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-s390x": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linux-x64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.4.tgz",+ "integrity": "sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-x64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linuxmusl-arm64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.4.tgz",+ "integrity": "sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linuxmusl-arm64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-linuxmusl-x64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.4.tgz",+ "integrity": "sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linuxmusl-x64": "1.3.3"+ }+ },+ "node_modules/@img/sharp-wasm32": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-wasm32/-/sharp-wasm32-0.35.4.tgz",+ "integrity": "sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA==",+ "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT",+ "optional": true,+ "dependencies": {+ "@emnapi/runtime": "^1.11.3"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-webcontainers-wasm32": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.4.tgz",+ "integrity": "sha512-ESfNkywmCfPNyaZjxooddJQiQ+l/nTpGEOGthxiLnIHXC/CmcBixnfwUleX9mCz9ovrUUvKMap/pm8RYbzfwaA==",+ "cpu": [+ "wasm32"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "dependencies": {+ "@img/sharp-wasm32": "0.35.4"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-arm64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.4.tgz",+ "integrity": "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-ia32": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.4.tgz",+ "integrity": "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw==",+ "cpu": [+ "ia32"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": "^20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-x64": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.4.tgz",+ "integrity": "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@jridgewell/gen-mapping": {+ "version": "0.3.13",+ "resolved": "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/sourcemap-codec": "^1.5.0",+ "@jridgewell/trace-mapping": "^0.3.24"+ }+ },+ "node_modules/@jridgewell/resolve-uri": {+ "version": "3.1.2",+ "resolved": "https://registry.npmmirror.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/@jridgewell/sourcemap-codec": {+ "version": "1.6.0",+ "resolved": "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz",+ "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@jridgewell/trace-mapping": {+ "version": "0.3.31",+ "resolved": "https://registry.npmmirror.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/resolve-uri": "^3.1.0",+ "@jridgewell/sourcemap-codec": "^1.4.14"+ }+ },+ "node_modules/@napi-rs/lzma-linux-x64-gnu": {+ "version": "1.5.1",+ "resolved": "https://registry.npmmirror.com/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz",+ "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": "^22.20 || ^24.12 || >=25"+ }+ },+ "node_modules/@next/env": {+ "version": "15.5.25",+ "resolved": "https://registry.npmmirror.com/@next/env/-/env-15.5.25.tgz",+ "integrity": "sha512-42h1lLr07vl4gawALP1hsgRZjHB1xYa58JfUfHwr0f7jG/zhPakh5GHkADHXOC9ZxUvlQFOPIrp7s6qX4DezPQ==",+ "license": "MIT"+ },+ "node_modules/@next/swc-darwin-arm64": {+ "version": "15.5.25",+ "resolved": "https://registry.npmmirror.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.5.25.tgz",+ "integrity": "sha512-w+RR0v/QuApnWEjRGm1z6gcObKwGMb5YPA7V3bzBEVSBpMFUXprer0tS27UxjUcEnqbhL7Zuzohej79B6rYmBg==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-darwin-x64": {+ "version": "15.5.25",+ "resolved": "https://registry.npmmirror.com/@next/swc-darwin-x64/-/swc-darwin-x64-15.5.25.tgz",+ "integrity": "sha512-QiGGBUSakt8S1H4Lt9Ehsh6Ja87axiBnQQgysOObvCbI7iUfJnRGntF1P64S4/ijuHFnSB8KLsEddkY3nN26uw==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-linux-arm64-gnu": {+ "version": "15.5.25",+ "resolved": "https://registry.npmmirror.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.5.25.tgz",+ "integrity": "sha512-ehLos/66zo0d/mJCU5u96a/VDcr01aaUrX0o/i16UdInxz8qPTCDSxGtjk/Lps1sIr1RJFdiX3hxc0fxJo+cPA==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-linux-arm64-musl": {+ "version": "15.5.25",+ "resolved": "https://registry.npmmirror.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.5.25.tgz",+ "integrity": "sha512-ZVMrqLiJ7DiChgmbkQwFtdhAnUkSH/4p7tB29QY+giATb0Q/XGHNRSKAb/B8XGDHRUaA67NepOW5W8u3ZRJBAA==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-linux-x64-gnu": {+ "version": "15.5.25",+ "resolved": "https://registry.npmmirror.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.5.25.tgz",+ "integrity": "sha512-UOewtDGkTMJTiODrEdeLZ50yGb59xCZSriNpXkfPMxRRgwDkGc7i8mLWqV5076wEdb+Ca/XN7MhJyM3CupyNyQ==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-linux-x64-musl": {+ "version": "15.5.25",+ "resolved": "https://registry.npmmirror.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.5.25.tgz",+ "integrity": "sha512-UBHwA8AhkCZgtRfU1aJpunuAJe/6gZv6jDESQe4p5MjTb5V0YEeJBWCdNqx15Vj3x+5jmauRfeMJSjfQj9HGFQ==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-win32-arm64-msvc": {+ "version": "15.5.25",+ "resolved": "https://registry.npmmirror.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.5.25.tgz",+ "integrity": "sha512-QcFcPRr16djk5IqK5+e8O80eZfgWzIvVBXfitIq0tQ/uc+eyfdoZ0NmKc0cnbIJyfVwREapKuG97YcxWA9gcpA==",+ "cpu": [+ "arm64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@next/swc-win32-x64-msvc": {+ "version": "15.5.25",+ "resolved": "https://registry.npmmirror.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.5.25.tgz",+ "integrity": "sha512-zREeykps3ndWr9egJgvJKqVkkDuaw6Zrrg23cYBos0ygydFkAWYU4+PaPVwXzP1eAYQJe53ShSK45iDM529BOg==",+ "cpu": [+ "x64"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">= 10"+ }+ },+ "node_modules/@nodelib/fs.scandir": {+ "version": "2.1.5",+ "resolved": "https://registry.npmmirror.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@nodelib/fs.stat": "2.0.5",+ "run-parallel": "^1.1.9"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/@nodelib/fs.stat": {+ "version": "2.0.5",+ "resolved": "https://registry.npmmirror.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/@nodelib/fs.walk": {+ "version": "1.2.8",+ "resolved": "https://registry.npmmirror.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",+ "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@nodelib/fs.scandir": "2.1.5",+ "fastq": "^1.6.0"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/@rollup/rollup-android-arm-eabi": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.1.tgz",+ "integrity": "sha512-UZ8sUxPTiHWYX9QNdJedb1kDZSpS1t/VPWBWGSgqHNi9w3Cu6IXvu2mzbhiTiPvtrqgTQJ+zqiAq2iPIPilpaQ==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ]+ },+ "node_modules/@rollup/rollup-android-arm64": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.1.tgz",+ "integrity": "sha512-cQ4nFQABN5cDvDpbvJ7bMStCpnaVxynZrRMfUJYgxcIk9Sh54FIO1vtfkg0B69REjER77ioZ/ov+eAApx/KmLQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ]+ },+ "node_modules/@rollup/rollup-darwin-arm64": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.1.tgz",+ "integrity": "sha512-FQNqd1lRy/0QhDk3xeRIkSBiCpXCiDnZO3YLVdcDKN1UBiKToNftCzcXYNLshmPDUMlu2TdeS8tGcsU6f3YF1Q==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ]+ },+ "node_modules/@rollup/rollup-darwin-x64": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.1.tgz",+ "integrity": "sha512-pvD16V939D3CloK0+qikpGaxiPrDUXTe7Y5cWOMkMSy7m1cawa8EGy/kXYi/G/cKAC4HDAbSnzCIk1WmsoOKXg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ]+ },+ "node_modules/@rollup/rollup-freebsd-arm64": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.1.tgz",+ "integrity": "sha512-pcFGeL2345VwdTnJhA6zLbew+YgWB0qBG2+dMtXjCicf6+rm6kO6cOoh5VnTe0ZMrMRgRyuHmCJxZWrIdzYuOw==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ]+ },+ "node_modules/@rollup/rollup-freebsd-x64": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.1.tgz",+ "integrity": "sha512-mRJlqSRulVzcKq/LKA6ICSIc3K/l4fzlVn/gePn2nXIHy8seRi5z/eeRE0d/XMBxcMldiXtQTSpRj0tkkC3g8Q==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.1.tgz",+ "integrity": "sha512-YDUNvVM85TI3g/1OpnqKP1h4NeW/j64DfWMf+G3M809xNk1bJSnpFp4sh83NpmVE5DXnkh8ULor4LTVZKoYLHw==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.1.tgz",+ "integrity": "sha512-7Mcn71p9ZuQFAj+h+dhQXy/yeLePRS2yKRnmW1DijA9thKO5qap0GNOIQK4yQ6iP3SU0Mrb/yWo8h8vgRba8lw==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm64-gnu": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.1.tgz",+ "integrity": "sha512-4YiLQTX6U4CSl0L9cluep9A9W6UmTfqBDc2/CH6wlu54pl4E7Jn3cOD8oxzvBDEGk/JMKgJ47C8g+radF7mwvg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm64-musl": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.1.tgz",+ "integrity": "sha512-2ra8F7w8OquwZN9z2/fKFnli69wa8PLwaVzRMIPGb13ByMJwC28Fbp8YcVGoUhlYMTt7j5j9bNgpysrN2UM+vw==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-loong64-gnu": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.1.tgz",+ "integrity": "sha512-Sy20ncyhjmBP0Ml+UvQbimjlk6VFgjW5uNP+qqwHB00mTE8Bl2C1TuHTlRwK2YoXeZbee5lP2XevBWVkAQAtSQ==",+ "cpu": [+ "loong64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-loong64-musl": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.1.tgz",+ "integrity": "sha512-noITLp8oNjYliPnGWmLyelIHwULGqbHloQHGw1rtxbWhTuWooRpnZarZQJ1y9EUC4szuCusCc+HEpUtxpIwYvA==",+ "cpu": [+ "loong64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.1.tgz",+ "integrity": "sha512-hlxxXd+F1mWiAcaFR7Sv9ZQT6m6UfI8+Vy/kFJzztq2pDMU/0wZ9sish0iszNZvsQDo8Gc0i5yuFEOz5dDf6fA==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-ppc64-musl": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.1.tgz",+ "integrity": "sha512-EF7OpqQTQ/BvGqLzUi4rEHuagCV9MugAUXSHemwPW5vxZ75RR+jxO/2j95Ph2dalMpFHSVECjRoioHZgA9zOYA==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.1.tgz",+ "integrity": "sha512-wQO3JesW9PRkwlabQ27y7sPfVOOTLRG73I4F2UYHG5PXun3J9U3y+b7ezVKSYbsvSKGQ1k1cq8Qlun4C9kLt3w==",+ "cpu": [+ "riscv64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-riscv64-musl": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.1.tgz",+ "integrity": "sha512-ouAGwhO6wHRXdnOVCOsB0tRFkA7nhNB2Nwax6oECXN0YiN8EYUTBAOudADOB1PI+yDL61TeNx/u7MVCzksNbkQ==",+ "cpu": [+ "riscv64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-s390x-gnu": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.1.tgz",+ "integrity": "sha512-q2R38Sn+1J8RxhfJ+T54wSWmyKXWec+9jgDfqO2AtArEqHO5R2aeayp5H5OYLr5UYDVGsVaZPEFUooMhYCdz5A==",+ "cpu": [+ "s390x"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-x64-gnu": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.1.tgz",+ "integrity": "sha512-gfI5T24WLLuFfSKw7Go/zDXjAAV0fny0swTaDv+WjK7vqcw4cRhFfdsyKL1n+ukI+ooBxn3bVQnyrn06WpI50w==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-x64-musl": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.1.tgz",+ "integrity": "sha512-4h6XqthmB4Hspji84wvgk+ElodTsGj+dbZqHJHHtKxj4mYq0ANSEEPX9ys3moJueqsRjwpaJYH7874Itwnj2ow==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-openbsd-x64": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.1.tgz",+ "integrity": "sha512-dlfCOa87o1VAYegLQ9EKilx2JCeRofiyPGhTCmqnuXZ6bMPiycO1rq1+sKoulAp7pGLIsTIw+1x5R+zgh5LhhA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ]+ },+ "node_modules/@rollup/rollup-openharmony-arm64": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.1.tgz",+ "integrity": "sha512-cjkLbOlfcm3QGhMM1J5zaZjsw1GggbN6rw9UTSSRrPrR1KkcXnN7Uq9rPw34xImQ9VOY9GN+6u2Zj80B9ptkcw==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openharmony"+ ]+ },+ "node_modules/@rollup/rollup-win32-arm64-msvc": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.1.tgz",+ "integrity": "sha512-Li1KdUnWGE4N3e1F/B4RTB1ms+nG4WBgjByO46pkeBVX/2UBsY53xf5vK9WygVmnH3RwncIST7lkSdLSY6P9lg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-ia32-msvc": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.1.tgz",+ "integrity": "sha512-t4ZYOSoLTgwhuFMrmTMLx/+i1DQVK7HYqMc6kY46EApwi8X0nIVphzdNoThU3xt6n+N5urG1/gxBdCaKDLavfg==",+ "cpu": [+ "ia32"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-x64-gnu": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.1.tgz",+ "integrity": "sha512-RgroPfMmKlD1RzSDxvwgcPiy2HNQKoYV7OmwIXDsk73uKW5t6B/V8KIy27SMv/FNXFo/oSBtWc9J0X7t91ezZg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-x64-msvc": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.1.tgz",+ "integrity": "sha512-at8QVep6S3h5Y6gSbdGU06bRY5WJkf6WUduM9YtvYMbYhB1MOFfUgc6kehitQXzOtMSaT70q7f9ydPhpqu821w==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@swc/helpers": {+ "version": "0.5.15",+ "resolved": "https://registry.npmmirror.com/@swc/helpers/-/helpers-0.5.15.tgz",+ "integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==",+ "license": "Apache-2.0",+ "dependencies": {+ "tslib": "^2.8.0"+ }+ },+ "node_modules/@tanstack/query-core": {+ "version": "5.102.8",+ "resolved": "https://registry.npmmirror.com/@tanstack/query-core/-/query-core-5.102.8.tgz",+ "integrity": "sha512-ZNjkJ33CqvPNec/6lZBnHqLc3EVGPZ9ySLhYahU9TcuRFdmwXewuj0c4hwSWcGHqEUwcSrKeZ+oGcvPBqXcQcg==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/tannerlinsley"+ }+ },+ "node_modules/@tanstack/react-query": {+ "version": "5.102.8",+ "resolved": "https://registry.npmmirror.com/@tanstack/react-query/-/react-query-5.102.8.tgz",+ "integrity": "sha512-TYBea4OuXWD7MhaSHq069TWbFe7rcwWN6kzT7JF0OKi1K6c1gTv2IzD6A6ExJsCMozdkqBWeuIUZmu4KQg0O5A==",+ "license": "MIT",+ "dependencies": {+ "@tanstack/query-core": "5.102.8"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/tannerlinsley"+ },+ "peerDependencies": {+ "react": "^18 || ^19"+ }+ },+ "node_modules/@types/estree": {+ "version": "1.0.9",+ "resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.9.tgz",+ "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/@types/node": {+ "version": "22.20.1",+ "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.20.1.tgz",+ "integrity": "sha512-EANqOCF9QFyra+4pfxUcX9STKJpCLjMbObVzljIJomAWSnuSIEAvyzEU53GaajbXJEgdh0iEcPL+DGvpUd4k1Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "undici-types": "~6.21.0"+ }+ },+ "node_modules/@types/react": {+ "version": "19.2.18",+ "resolved": "https://registry.npmmirror.com/@types/react/-/react-19.2.18.tgz",+ "integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==",+ "license": "MIT",+ "dependencies": {+ "csstype": "^3.2.2"+ }+ },+ "node_modules/@types/react-dom": {+ "version": "19.2.5",+ "resolved": "https://registry.npmmirror.com/@types/react-dom/-/react-dom-19.2.5.tgz",+ "integrity": "sha512-fMPwH9v7r/pp43yUd2/Mbiex5KouJwwR3dzHkhLREUC6764VyDsqxhAxv6OFEYR1RhjOyD1naqba8ECDBe7ZQg==",+ "dev": true,+ "license": "MIT",+ "peerDependencies": {+ "@types/react": "^19.2.0"+ }+ },+ "node_modules/@vitest/expect": {+ "version": "2.1.9",+ "resolved": "https://registry.npmmirror.com/@vitest/expect/-/expect-2.1.9.tgz",+ "integrity": "sha512-UJCIkTBenHeKT1TTlKMJWy1laZewsRIzYighyYiJKZreqtdxSos/S1t+ktRMQWu2CKqaarrkeszJx1cgC5tGZw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/spy": "2.1.9",+ "@vitest/utils": "2.1.9",+ "chai": "^5.1.2",+ "tinyrainbow": "^1.2.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/mocker": {+ "version": "2.1.9",+ "resolved": "https://registry.npmmirror.com/@vitest/mocker/-/mocker-2.1.9.tgz",+ "integrity": "sha512-tVL6uJgoUdi6icpxmdrn5YNo3g3Dxv+IHJBr0GXHaEdTcw3F+cPKnsXFhli6nO+f/6SDKPHEK1UN+k+TQv0Ehg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/spy": "2.1.9",+ "estree-walker": "^3.0.3",+ "magic-string": "^0.30.12"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ },+ "peerDependencies": {+ "msw": "^2.4.9",+ "vite": "^5.0.0"+ },+ "peerDependenciesMeta": {+ "msw": {+ "optional": true+ },+ "vite": {+ "optional": true+ }+ }+ },+ "node_modules/@vitest/pretty-format": {+ "version": "2.1.9",+ "resolved": "https://registry.npmmirror.com/@vitest/pretty-format/-/pretty-format-2.1.9.tgz",+ "integrity": "sha512-KhRIdGV2U9HOUzxfiHmY8IFHTdqtOhIzCpd8WRdJiE7D/HUcZVD0EgQCVjm+Q9gkUXWgBvMmTtZgIG48wq7sOQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "tinyrainbow": "^1.2.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/runner": {+ "version": "2.1.9",+ "resolved": "https://registry.npmmirror.com/@vitest/runner/-/runner-2.1.9.tgz",+ "integrity": "sha512-ZXSSqTFIrzduD63btIfEyOmNcBmQvgOVsPNPe0jYtESiXkhd8u2erDLnMxmGrDCwHCCHE7hxwRDCT3pt0esT4g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/utils": "2.1.9",+ "pathe": "^1.1.2"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/snapshot": {+ "version": "2.1.9",+ "resolved": "https://registry.npmmirror.com/@vitest/snapshot/-/snapshot-2.1.9.tgz",+ "integrity": "sha512-oBO82rEjsxLNJincVhLhaxxZdEtV0EFHMK5Kmx5sJ6H9L183dHECjiefOAdnqpIgT5eZwT04PoggUnW88vOBNQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/pretty-format": "2.1.9",+ "magic-string": "^0.30.12",+ "pathe": "^1.1.2"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/spy": {+ "version": "2.1.9",+ "resolved": "https://registry.npmmirror.com/@vitest/spy/-/spy-2.1.9.tgz",+ "integrity": "sha512-E1B35FwzXXTs9FHNK6bDszs7mtydNi5MIfUWpceJ8Xbfb1gBMscAnwLbEu+B44ed6W3XjL9/ehLPHR1fkf1KLQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "tinyspy": "^3.0.2"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/utils": {+ "version": "2.1.9",+ "resolved": "https://registry.npmmirror.com/@vitest/utils/-/utils-2.1.9.tgz",+ "integrity": "sha512-v0psaMSkNJ3A2NMrUEHFRzJtDPFn+/VWZ5WxImB21T9fjucJRmS7xCS3ppEnARb9y11OAzaD+P2Ps+b+BGX5iQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/pretty-format": "2.1.9",+ "loupe": "^3.1.2",+ "tinyrainbow": "^1.2.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/any-promise": {+ "version": "1.3.0",+ "resolved": "https://registry.npmmirror.com/any-promise/-/any-promise-1.3.0.tgz",+ "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/anymatch": {+ "version": "3.1.3",+ "resolved": "https://registry.npmmirror.com/anymatch/-/anymatch-3.1.3.tgz",+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "normalize-path": "^3.0.0",+ "picomatch": "^2.0.4"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/arg": {+ "version": "5.0.2",+ "resolved": "https://registry.npmmirror.com/arg/-/arg-5.0.2.tgz",+ "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/artplayer": {+ "version": "5.4.0",+ "resolved": "https://registry.npmmirror.com/artplayer/-/artplayer-5.4.0.tgz",+ "integrity": "sha512-2B+plbx8N2yNsjK4nJU3+EOG8TULm1LRZk/QPkWRAMEX2Ee/MSnZG/WJYz8kcoZxZuLKcQ3uXifqLuPxZOH29A==",+ "license": "MIT",+ "dependencies": {+ "option-validator": "^2.0.6"+ }+ },+ "node_modules/assertion-error": {+ "version": "2.0.1",+ "resolved": "https://registry.npmmirror.com/assertion-error/-/assertion-error-2.0.1.tgz",+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/autoprefixer": {+ "version": "10.5.4",+ "resolved": "https://registry.npmmirror.com/autoprefixer/-/autoprefixer-10.5.4.tgz",+ "integrity": "sha512-MaU0U/za7N3r6brxD4YB/l4NSrFzLPlANv6wEuQVaIPlD3L4W9rFcQPbL/EilY9BHhHvhfcz3gInDLrEtWT4EA==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/autoprefixer"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "browserslist": "^4.28.6",+ "caniuse-lite": "^1.0.30001806",+ "fraction.js": "^5.3.4",+ "picocolors": "^1.1.1",+ "postcss-value-parser": "^4.2.0"+ },+ "bin": {+ "autoprefixer": "bin/autoprefixer"+ },+ "engines": {+ "node": "^10 || ^12 || >=14"+ },+ "peerDependencies": {+ "postcss": "^8.1.0"+ }+ },+ "node_modules/baseline-browser-mapping": {+ "version": "2.11.20",+ "resolved": "https://registry.npmmirror.com/baseline-browser-mapping/-/baseline-browser-mapping-2.11.20.tgz",+ "integrity": "sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw==",+ "dev": true,+ "license": "Apache-2.0",+ "bin": {+ "baseline-browser-mapping": "dist/cli.cjs"+ },+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/binary-extensions": {+ "version": "2.3.0",+ "resolved": "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.3.0.tgz",+ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/braces": {+ "version": "3.0.3",+ "resolved": "https://registry.npmmirror.com/braces/-/braces-3.0.3.tgz",+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "fill-range": "^7.1.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/browserslist": {+ "version": "4.28.8",+ "resolved": "https://registry.npmmirror.com/browserslist/-/browserslist-4.28.8.tgz",+ "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/browserslist"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/browserslist"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "baseline-browser-mapping": "^2.11.12",+ "caniuse-lite": "^1.0.30001809",+ "electron-to-chromium": "^1.5.402",+ "node-releases": "^2.0.53",+ "update-browserslist-db": "^1.3.0"+ },+ "bin": {+ "browserslist": "cli.js"+ },+ "engines": {+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"+ }+ },+ "node_modules/cac": {+ "version": "6.7.14",+ "resolved": "https://registry.npmmirror.com/cac/-/cac-6.7.14.tgz",+ "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/camelcase-css": {+ "version": "2.0.1",+ "resolved": "https://registry.npmmirror.com/camelcase-css/-/camelcase-css-2.0.1.tgz",+ "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/caniuse-lite": {+ "version": "1.0.30001810",+ "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz",+ "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==",+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/browserslist"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "CC-BY-4.0"+ },+ "node_modules/chai": {+ "version": "5.3.3",+ "resolved": "https://registry.npmmirror.com/chai/-/chai-5.3.3.tgz",+ "integrity": "sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "assertion-error": "^2.0.1",+ "check-error": "^2.1.1",+ "deep-eql": "^5.0.1",+ "loupe": "^3.1.0",+ "pathval": "^2.0.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/check-error": {+ "version": "2.1.3",+ "resolved": "https://registry.npmmirror.com/check-error/-/check-error-2.1.3.tgz",+ "integrity": "sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 16"+ }+ },+ "node_modules/chokidar": {+ "version": "3.6.0",+ "resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.6.0.tgz",+ "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "anymatch": "~3.1.2",+ "braces": "~3.0.2",+ "glob-parent": "~5.1.2",+ "is-binary-path": "~2.1.0",+ "is-glob": "~4.0.1",+ "normalize-path": "~3.0.0",+ "readdirp": "~3.6.0"+ },+ "engines": {+ "node": ">= 8.10.0"+ },+ "funding": {+ "url": "https://paulmillr.com/funding/"+ },+ "optionalDependencies": {+ "fsevents": "~2.3.2"+ }+ },+ "node_modules/chokidar/node_modules/glob-parent": {+ "version": "5.1.2",+ "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz",+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "is-glob": "^4.0.1"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/client-only": {+ "version": "0.0.1",+ "resolved": "https://registry.npmmirror.com/client-only/-/client-only-0.0.1.tgz",+ "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==",+ "license": "MIT"+ },+ "node_modules/commander": {+ "version": "4.1.1",+ "resolved": "https://registry.npmmirror.com/commander/-/commander-4.1.1.tgz",+ "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/cssesc": {+ "version": "3.0.0",+ "resolved": "https://registry.npmmirror.com/cssesc/-/cssesc-3.0.0.tgz",+ "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",+ "dev": true,+ "license": "MIT",+ "bin": {+ "cssesc": "bin/cssesc"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/csstype": {+ "version": "3.2.3",+ "resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.2.3.tgz",+ "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",+ "license": "MIT"+ },+ "node_modules/debug": {+ "version": "4.4.3",+ "resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.3.tgz",+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "ms": "^2.1.3"+ },+ "engines": {+ "node": ">=6.0"+ },+ "peerDependenciesMeta": {+ "supports-color": {+ "optional": true+ }+ }+ },+ "node_modules/deep-eql": {+ "version": "5.0.2",+ "resolved": "https://registry.npmmirror.com/deep-eql/-/deep-eql-5.0.2.tgz",+ "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/detect-libc": {+ "version": "2.1.2",+ "resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.1.2.tgz",+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",+ "license": "Apache-2.0",+ "optional": true,+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/dexie": {+ "version": "4.4.5",+ "resolved": "https://registry.npmmirror.com/dexie/-/dexie-4.4.5.tgz",+ "integrity": "sha512-wWCHdihT3dmlUSuNhn5mMZDWSpG0suxjAni7YjjiZdzabZcKmy3uNZGZ7AeYYXBoLbpSXX35fikPLkPC44Osiw==",+ "license": "Apache-2.0"+ },+ "node_modules/dexie-react-hooks": {+ "version": "1.1.7",+ "resolved": "https://registry.npmmirror.com/dexie-react-hooks/-/dexie-react-hooks-1.1.7.tgz",+ "integrity": "sha512-Lwv5W0Hk+uOW3kGnsU9GZoR1er1B7WQ5DSdonoNG+focTNeJbHW6vi6nBoX534VKI3/uwHebYzSw1fwY6a7mTw==",+ "license": "Apache-2.0",+ "peerDependencies": {+ "@types/react": ">=16",+ "dexie": "^3.2 || ^4.0.1-alpha",+ "react": ">=16"+ }+ },+ "node_modules/didyoumean": {+ "version": "1.2.2",+ "resolved": "https://registry.npmmirror.com/didyoumean/-/didyoumean-1.2.2.tgz",+ "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",+ "dev": true,+ "license": "Apache-2.0"+ },+ "node_modules/dlv": {+ "version": "1.1.3",+ "resolved": "https://registry.npmmirror.com/dlv/-/dlv-1.1.3.tgz",+ "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/electron-to-chromium": {+ "version": "1.5.418",+ "resolved": "https://registry.npmmirror.com/electron-to-chromium/-/electron-to-chromium-1.5.418.tgz",+ "integrity": "sha512-UzS26r3AEbG5wSoGVpJKqwHIU9zwQN7LHdVIThDrJpS0I5KdlXFMEb8543fhc9dVnIIAST6ar8rhwa00AL5MlA==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/es-errors": {+ "version": "1.3.0",+ "resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz",+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-module-lexer": {+ "version": "1.7.0",+ "resolved": "https://registry.npmmirror.com/es-module-lexer/-/es-module-lexer-1.7.0.tgz",+ "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/esbuild": {+ "version": "0.21.5",+ "resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.21.5.tgz",+ "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "bin": {+ "esbuild": "bin/esbuild"+ },+ "engines": {+ "node": ">=12"+ },+ "optionalDependencies": {+ "@esbuild/aix-ppc64": "0.21.5",+ "@esbuild/android-arm": "0.21.5",+ "@esbuild/android-arm64": "0.21.5",+ "@esbuild/android-x64": "0.21.5",+ "@esbuild/darwin-arm64": "0.21.5",+ "@esbuild/darwin-x64": "0.21.5",+ "@esbuild/freebsd-arm64": "0.21.5",+ "@esbuild/freebsd-x64": "0.21.5",+ "@esbuild/linux-arm": "0.21.5",+ "@esbuild/linux-arm64": "0.21.5",+ "@esbuild/linux-ia32": "0.21.5",+ "@esbuild/linux-loong64": "0.21.5",+ "@esbuild/linux-mips64el": "0.21.5",+ "@esbuild/linux-ppc64": "0.21.5",+ "@esbuild/linux-riscv64": "0.21.5",+ "@esbuild/linux-s390x": "0.21.5",+ "@esbuild/linux-x64": "0.21.5",+ "@esbuild/netbsd-x64": "0.21.5",+ "@esbuild/openbsd-x64": "0.21.5",+ "@esbuild/sunos-x64": "0.21.5",+ "@esbuild/win32-arm64": "0.21.5",+ "@esbuild/win32-ia32": "0.21.5",+ "@esbuild/win32-x64": "0.21.5"+ }+ },+ "node_modules/escalade": {+ "version": "3.2.0",+ "resolved": "https://registry.npmmirror.com/escalade/-/escalade-3.2.0.tgz",+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/estree-walker": {+ "version": "3.0.3",+ "resolved": "https://registry.npmmirror.com/estree-walker/-/estree-walker-3.0.3.tgz",+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0"+ }+ },+ "node_modules/expect-type": {+ "version": "1.4.0",+ "resolved": "https://registry.npmmirror.com/expect-type/-/expect-type-1.4.0.tgz",+ "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": ">=12.0.0"+ }+ },+ "node_modules/fast-glob": {+ "version": "3.3.3",+ "resolved": "https://registry.npmmirror.com/fast-glob/-/fast-glob-3.3.3.tgz",+ "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@nodelib/fs.stat": "^2.0.2",+ "@nodelib/fs.walk": "^1.2.3",+ "glob-parent": "^5.1.2",+ "merge2": "^1.3.0",+ "micromatch": "^4.0.8"+ },+ "engines": {+ "node": ">=8.6.0"+ }+ },+ "node_modules/fast-glob/node_modules/glob-parent": {+ "version": "5.1.2",+ "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz",+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "is-glob": "^4.0.1"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/fastq": {+ "version": "1.20.3",+ "resolved": "https://registry.npmmirror.com/fastq/-/fastq-1.20.3.tgz",+ "integrity": "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "reusify": "^1.0.4"+ }+ },+ "node_modules/fill-range": {+ "version": "7.1.1",+ "resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.1.1.tgz",+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "to-regex-range": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/fraction.js": {+ "version": "5.3.4",+ "resolved": "https://registry.npmmirror.com/fraction.js/-/fraction.js-5.3.4.tgz",+ "integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "*"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/rawify"+ }+ },+ "node_modules/fsevents": {+ "version": "2.3.3",+ "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz",+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"+ }+ },+ "node_modules/function-bind": {+ "version": "1.1.2",+ "resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",+ "dev": true,+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/glob-parent": {+ "version": "6.0.2",+ "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-6.0.2.tgz",+ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",+ "dev": true,+ "license": "ISC",+ "dependencies": {+ "is-glob": "^4.0.3"+ },+ "engines": {+ "node": ">=10.13.0"+ }+ },+ "node_modules/hasown": {+ "version": "2.0.4",+ "resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.4.tgz",+ "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/hls.js": {+ "version": "1.7.1",+ "resolved": "https://registry.npmmirror.com/hls.js/-/hls.js-1.7.1.tgz",+ "integrity": "sha512-DlzIkeBAS9IIQ432k3BUf3HlwbsR0+trB1i2lDdN2gUkNkrehFurh0/48M5c1/EjlDkdGng1gwZIpwyPxvdZ/g==",+ "license": "Apache-2.0"+ },+ "node_modules/is-binary-path": {+ "version": "2.1.0",+ "resolved": "https://registry.npmmirror.com/is-binary-path/-/is-binary-path-2.1.0.tgz",+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "binary-extensions": "^2.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/is-core-module": {+ "version": "2.16.2",+ "resolved": "https://registry.npmmirror.com/is-core-module/-/is-core-module-2.16.2.tgz",+ "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "hasown": "^2.0.3"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/is-extglob": {+ "version": "2.1.1",+ "resolved": "https://registry.npmmirror.com/is-extglob/-/is-extglob-2.1.1.tgz",+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/is-glob": {+ "version": "4.0.3",+ "resolved": "https://registry.npmmirror.com/is-glob/-/is-glob-4.0.3.tgz",+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "is-extglob": "^2.1.1"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/is-number": {+ "version": "7.0.0",+ "resolved": "https://registry.npmmirror.com/is-number/-/is-number-7.0.0.tgz",+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.12.0"+ }+ },+ "node_modules/jiti": {+ "version": "1.21.7",+ "resolved": "https://registry.npmmirror.com/jiti/-/jiti-1.21.7.tgz",+ "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==",+ "dev": true,+ "license": "MIT",+ "bin": {+ "jiti": "bin/jiti.js"+ }+ },+ "node_modules/kind-of": {+ "version": "6.0.3",+ "resolved": "https://registry.npmmirror.com/kind-of/-/kind-of-6.0.3.tgz",+ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/lilconfig": {+ "version": "3.1.3",+ "resolved": "https://registry.npmmirror.com/lilconfig/-/lilconfig-3.1.3.tgz",+ "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=14"+ },+ "funding": {+ "url": "https://github.com/sponsors/antonk52"+ }+ },+ "node_modules/lines-and-columns": {+ "version": "1.2.4",+ "resolved": "https://registry.npmmirror.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz",+ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/loupe": {+ "version": "3.2.1",+ "resolved": "https://registry.npmmirror.com/loupe/-/loupe-3.2.1.tgz",+ "integrity": "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/magic-string": {+ "version": "0.30.21",+ "resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.21.tgz",+ "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/sourcemap-codec": "^1.5.5"+ }+ },+ "node_modules/merge2": {+ "version": "1.4.1",+ "resolved": "https://registry.npmmirror.com/merge2/-/merge2-1.4.1.tgz",+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/micromatch": {+ "version": "4.0.8",+ "resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.8.tgz",+ "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "braces": "^3.0.3",+ "picomatch": "^2.3.1"+ },+ "engines": {+ "node": ">=8.6"+ }+ },+ "node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/mz": {+ "version": "2.7.0",+ "resolved": "https://registry.npmmirror.com/mz/-/mz-2.7.0.tgz",+ "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "any-promise": "^1.0.0",+ "object-assign": "^4.0.1",+ "thenify-all": "^1.0.0"+ }+ },+ "node_modules/nanoid": {+ "version": "3.3.18",+ "resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.18.tgz",+ "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "bin": {+ "nanoid": "bin/nanoid.cjs"+ },+ "engines": {+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"+ }+ },+ "node_modules/next": {+ "version": "15.5.25",+ "resolved": "https://registry.npmmirror.com/next/-/next-15.5.25.tgz",+ "integrity": "sha512-OMWNulIIqKM2ykvC2qMjIt0IoavB4UB2SCs4iXJ6z6847FvyH8jBmBWcvrF5iuhTu8Przh20Fo/aoszIdqx4PA==",+ "license": "MIT",+ "dependencies": {+ "@next/env": "15.5.25",+ "@swc/helpers": "0.5.15",+ "caniuse-lite": "^1.0.30001579",+ "postcss": "8.4.31",+ "styled-jsx": "5.1.6"+ },+ "bin": {+ "next": "dist/bin/next"+ },+ "engines": {+ "node": "^18.18.0 || ^19.8.0 || >= 20.0.0"+ },+ "optionalDependencies": {+ "@next/swc-darwin-arm64": "15.5.25",+ "@next/swc-darwin-x64": "15.5.25",+ "@next/swc-linux-arm64-gnu": "15.5.25",+ "@next/swc-linux-arm64-musl": "15.5.25",+ "@next/swc-linux-x64-gnu": "15.5.25",+ "@next/swc-linux-x64-musl": "15.5.25",+ "@next/swc-win32-arm64-msvc": "15.5.25",+ "@next/swc-win32-x64-msvc": "15.5.25",+ "sharp": "^0.34.3 || ^0.35.4"+ },+ "peerDependencies": {+ "@opentelemetry/api": "^1.1.0",+ "@playwright/test": "^1.51.1",+ "babel-plugin-react-compiler": "*",+ "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",+ "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",+ "sass": "^1.3.0"+ },+ "peerDependenciesMeta": {+ "@opentelemetry/api": {+ "optional": true+ },+ "@playwright/test": {+ "optional": true+ },+ "babel-plugin-react-compiler": {+ "optional": true+ },+ "sass": {+ "optional": true+ }+ }+ },+ "node_modules/next/node_modules/postcss": {+ "version": "8.4.31",+ "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.31.tgz",+ "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/postcss"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "nanoid": "^3.3.6",+ "picocolors": "^1.0.0",+ "source-map-js": "^1.0.2"+ },+ "engines": {+ "node": "^10 || ^12 || >=14"+ }+ },+ "node_modules/node-releases": {+ "version": "2.0.54",+ "resolved": "https://registry.npmmirror.com/node-releases/-/node-releases-2.0.54.tgz",+ "integrity": "sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/normalize-path": {+ "version": "3.0.0",+ "resolved": "https://registry.npmmirror.com/normalize-path/-/normalize-path-3.0.0.tgz",+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/object-assign": {+ "version": "4.1.1",+ "resolved": "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz",+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/object-hash": {+ "version": "3.0.0",+ "resolved": "https://registry.npmmirror.com/object-hash/-/object-hash-3.0.0.tgz",+ "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/option-validator": {+ "version": "2.0.6",+ "resolved": "https://registry.npmmirror.com/option-validator/-/option-validator-2.0.6.tgz",+ "integrity": "sha512-tmZDan2LRIRQyhUGvkff68/O0R8UmF+Btmiiz0SmSw2ng3CfPZB9wJlIjHpe/MKUZqyIZkVIXCrwr1tIN+0Dzg==",+ "license": "MIT",+ "dependencies": {+ "kind-of": "^6.0.3"+ }+ },+ "node_modules/path-parse": {+ "version": "1.0.7",+ "resolved": "https://registry.npmmirror.com/path-parse/-/path-parse-1.0.7.tgz",+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/pathe": {+ "version": "1.1.2",+ "resolved": "https://registry.npmmirror.com/pathe/-/pathe-1.1.2.tgz",+ "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/pathval": {+ "version": "2.0.1",+ "resolved": "https://registry.npmmirror.com/pathval/-/pathval-2.0.1.tgz",+ "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 14.16"+ }+ },+ "node_modules/picocolors": {+ "version": "1.1.1",+ "resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz",+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",+ "license": "ISC"+ },+ "node_modules/picomatch": {+ "version": "2.3.2",+ "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.2.tgz",+ "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8.6"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/pirates": {+ "version": "4.0.7",+ "resolved": "https://registry.npmmirror.com/pirates/-/pirates-4.0.7.tgz",+ "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/postcss": {+ "version": "8.5.26",+ "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.26.tgz",+ "integrity": "sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/postcss"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "nanoid": "^3.3.17",+ "picocolors": "^1.1.1",+ "source-map-js": "^1.2.1"+ },+ "engines": {+ "node": "^10 || ^12 || >=14"+ }+ },+ "node_modules/postcss-import": {+ "version": "15.1.0",+ "resolved": "https://registry.npmmirror.com/postcss-import/-/postcss-import-15.1.0.tgz",+ "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "postcss-value-parser": "^4.0.0",+ "read-cache": "^1.0.0",+ "resolve": "^1.1.7"+ },+ "engines": {+ "node": ">=14.0.0"+ },+ "peerDependencies": {+ "postcss": "^8.0.0"+ }+ },+ "node_modules/postcss-js": {+ "version": "4.1.0",+ "resolved": "https://registry.npmmirror.com/postcss-js/-/postcss-js-4.1.0.tgz",+ "integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "camelcase-css": "^2.0.1"+ },+ "engines": {+ "node": "^12 || ^14 || >= 16"+ },+ "peerDependencies": {+ "postcss": "^8.4.21"+ }+ },+ "node_modules/postcss-load-config": {+ "version": "6.0.1",+ "resolved": "https://registry.npmmirror.com/postcss-load-config/-/postcss-load-config-6.0.1.tgz",+ "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "lilconfig": "^3.1.1"+ },+ "engines": {+ "node": ">= 18"+ },+ "peerDependencies": {+ "jiti": ">=1.21.0",+ "postcss": ">=8.0.9",+ "tsx": "^4.8.1",+ "yaml": "^2.4.2"+ },+ "peerDependenciesMeta": {+ "jiti": {+ "optional": true+ },+ "postcss": {+ "optional": true+ },+ "tsx": {+ "optional": true+ },+ "yaml": {+ "optional": true+ }+ }+ },+ "node_modules/postcss-nested": {+ "version": "6.2.0",+ "resolved": "https://registry.npmmirror.com/postcss-nested/-/postcss-nested-6.2.0.tgz",+ "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "postcss-selector-parser": "^6.1.1"+ },+ "engines": {+ "node": ">=12.0"+ },+ "peerDependencies": {+ "postcss": "^8.2.14"+ }+ },+ "node_modules/postcss-selector-parser": {+ "version": "6.1.4",+ "resolved": "https://registry.npmmirror.com/postcss-selector-parser/-/postcss-selector-parser-6.1.4.tgz",+ "integrity": "sha512-bIoJLOmjCO1S9XdY/DcnR5hJxvrDir1PbGChrzXG3vw0/FOliy/fA3dmdhQ441kah4gKv+TwckGzex6wNS5cnQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "cssesc": "^3.0.0",+ "util-deprecate": "^1.0.2"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/postcss-value-parser": {+ "version": "4.2.0",+ "resolved": "https://registry.npmmirror.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",+ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/queue-microtask": {+ "version": "1.2.3",+ "resolved": "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz",+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT"+ },+ "node_modules/react": {+ "version": "19.2.8",+ "resolved": "https://registry.npmmirror.com/react/-/react-19.2.8.tgz",+ "integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/react-dom": {+ "version": "19.2.8",+ "resolved": "https://registry.npmmirror.com/react-dom/-/react-dom-19.2.8.tgz",+ "integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==",+ "license": "MIT",+ "dependencies": {+ "scheduler": "^0.27.0"+ },+ "peerDependencies": {+ "react": "^19.2.8"+ }+ },+ "node_modules/read-cache": {+ "version": "1.0.2",+ "resolved": "https://registry.npmmirror.com/read-cache/-/read-cache-1.0.2.tgz",+ "integrity": "sha512-/peqiBB/n07gQGLsWaHho3WfvUyRscw0gYTsEFMhrIe/nWLkYaf5SbKYjGYqtRV3aPwykJgF2VEMo1ac4bnsGA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/readdirp": {+ "version": "3.6.0",+ "resolved": "https://registry.npmmirror.com/readdirp/-/readdirp-3.6.0.tgz",+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "picomatch": "^2.2.1"+ },+ "engines": {+ "node": ">=8.10.0"+ }+ },+ "node_modules/resolve": {+ "version": "1.22.12",+ "resolved": "https://registry.npmmirror.com/resolve/-/resolve-1.22.12.tgz",+ "integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "is-core-module": "^2.16.1",+ "path-parse": "^1.0.7",+ "supports-preserve-symlinks-flag": "^1.0.0"+ },+ "bin": {+ "resolve": "bin/resolve"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/reusify": {+ "version": "1.1.0",+ "resolved": "https://registry.npmmirror.com/reusify/-/reusify-1.1.0.tgz",+ "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "iojs": ">=1.0.0",+ "node": ">=0.10.0"+ }+ },+ "node_modules/rollup": {+ "version": "4.63.1",+ "resolved": "https://registry.npmmirror.com/rollup/-/rollup-4.63.1.tgz",+ "integrity": "sha512-3Df9jsstwhccuEfmAMi9l8XUh/GOkVObmFTU7CCVBysEbcOZLl84jCtaAZMcPiMz2EGKsATzQcU+Xr3n/wU6cg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/estree": "1.0.9"+ },+ "bin": {+ "rollup": "dist/bin/rollup"+ },+ "engines": {+ "node": ">=18.0.0",+ "npm": ">=8.0.0"+ },+ "optionalDependencies": {+ "@napi-rs/lzma-linux-x64-gnu": "1.5.1",+ "@rollup/rollup-android-arm-eabi": "4.63.1",+ "@rollup/rollup-android-arm64": "4.63.1",+ "@rollup/rollup-darwin-arm64": "4.63.1",+ "@rollup/rollup-darwin-x64": "4.63.1",+ "@rollup/rollup-freebsd-arm64": "4.63.1",+ "@rollup/rollup-freebsd-x64": "4.63.1",+ "@rollup/rollup-linux-arm-gnueabihf": "4.63.1",+ "@rollup/rollup-linux-arm-musleabihf": "4.63.1",+ "@rollup/rollup-linux-arm64-gnu": "4.63.1",+ "@rollup/rollup-linux-arm64-musl": "4.63.1",+ "@rollup/rollup-linux-loong64-gnu": "4.63.1",+ "@rollup/rollup-linux-loong64-musl": "4.63.1",+ "@rollup/rollup-linux-ppc64-gnu": "4.63.1",+ "@rollup/rollup-linux-ppc64-musl": "4.63.1",+ "@rollup/rollup-linux-riscv64-gnu": "4.63.1",+ "@rollup/rollup-linux-riscv64-musl": "4.63.1",+ "@rollup/rollup-linux-s390x-gnu": "4.63.1",+ "@rollup/rollup-linux-x64-gnu": "4.63.1",+ "@rollup/rollup-linux-x64-musl": "4.63.1",+ "@rollup/rollup-openbsd-x64": "4.63.1",+ "@rollup/rollup-openharmony-arm64": "4.63.1",+ "@rollup/rollup-win32-arm64-msvc": "4.63.1",+ "@rollup/rollup-win32-ia32-msvc": "4.63.1",+ "@rollup/rollup-win32-x64-gnu": "4.63.1",+ "@rollup/rollup-win32-x64-msvc": "4.63.1",+ "fsevents": "~2.3.2"+ }+ },+ "node_modules/run-parallel": {+ "version": "1.2.0",+ "resolved": "https://registry.npmmirror.com/run-parallel/-/run-parallel-1.2.0.tgz",+ "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "queue-microtask": "^1.2.2"+ }+ },+ "node_modules/scheduler": {+ "version": "0.27.0",+ "resolved": "https://registry.npmmirror.com/scheduler/-/scheduler-0.27.0.tgz",+ "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==",+ "license": "MIT"+ },+ "node_modules/semver": {+ "version": "7.8.5",+ "resolved": "https://registry.npmmirror.com/semver/-/semver-7.8.5.tgz",+ "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",+ "license": "ISC",+ "optional": true,+ "bin": {+ "semver": "bin/semver.js"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/sharp": {+ "version": "0.35.4",+ "resolved": "https://registry.npmmirror.com/sharp/-/sharp-0.35.4.tgz",+ "integrity": "sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA==",+ "license": "Apache-2.0",+ "optional": true,+ "dependencies": {+ "@img/colour": "^1.1.0",+ "detect-libc": "^2.1.2",+ "semver": "^7.8.5"+ },+ "engines": {+ "node": ">=20.9.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-darwin-arm64": "0.35.4",+ "@img/sharp-darwin-x64": "0.35.4",+ "@img/sharp-freebsd-wasm32": "0.35.4",+ "@img/sharp-libvips-darwin-arm64": "1.3.3",+ "@img/sharp-libvips-darwin-x64": "1.3.3",+ "@img/sharp-libvips-linux-arm": "1.3.3",+ "@img/sharp-libvips-linux-arm64": "1.3.3",+ "@img/sharp-libvips-linux-ppc64": "1.3.3",+ "@img/sharp-libvips-linux-riscv64": "1.3.3",+ "@img/sharp-libvips-linux-s390x": "1.3.3",+ "@img/sharp-libvips-linux-x64": "1.3.3",+ "@img/sharp-libvips-linuxmusl-arm64": "1.3.3",+ "@img/sharp-libvips-linuxmusl-x64": "1.3.3",+ "@img/sharp-linux-arm": "0.35.4",+ "@img/sharp-linux-arm64": "0.35.4",+ "@img/sharp-linux-ppc64": "0.35.4",+ "@img/sharp-linux-riscv64": "0.35.4",+ "@img/sharp-linux-s390x": "0.35.4",+ "@img/sharp-linux-x64": "0.35.4",+ "@img/sharp-linuxmusl-arm64": "0.35.4",+ "@img/sharp-linuxmusl-x64": "0.35.4",+ "@img/sharp-webcontainers-wasm32": "0.35.4",+ "@img/sharp-win32-arm64": "0.35.4",+ "@img/sharp-win32-ia32": "0.35.4",+ "@img/sharp-win32-x64": "0.35.4"+ },+ "peerDependenciesMeta": {+ "@types/node": {+ "optional": true+ }+ }+ },+ "node_modules/siginfo": {+ "version": "2.0.0",+ "resolved": "https://registry.npmmirror.com/siginfo/-/siginfo-2.0.0.tgz",+ "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/source-map-js": {+ "version": "1.2.1",+ "resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.1.tgz",+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/stackback": {+ "version": "0.0.2",+ "resolved": "https://registry.npmmirror.com/stackback/-/stackback-0.0.2.tgz",+ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/std-env": {+ "version": "3.10.0",+ "resolved": "https://registry.npmmirror.com/std-env/-/std-env-3.10.0.tgz",+ "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/styled-jsx": {+ "version": "5.1.6",+ "resolved": "https://registry.npmmirror.com/styled-jsx/-/styled-jsx-5.1.6.tgz",+ "integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==",+ "license": "MIT",+ "dependencies": {+ "client-only": "0.0.1"+ },+ "engines": {+ "node": ">= 12.0.0"+ },+ "peerDependencies": {+ "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0"+ },+ "peerDependenciesMeta": {+ "@babel/core": {+ "optional": true+ },+ "babel-plugin-macros": {+ "optional": true+ }+ }+ },+ "node_modules/sucrase": {+ "version": "3.35.1",+ "resolved": "https://registry.npmmirror.com/sucrase/-/sucrase-3.35.1.tgz",+ "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/gen-mapping": "^0.3.2",+ "commander": "^4.0.0",+ "lines-and-columns": "^1.1.6",+ "mz": "^2.7.0",+ "pirates": "^4.0.1",+ "tinyglobby": "^0.2.11",+ "ts-interface-checker": "^0.1.9"+ },+ "bin": {+ "sucrase": "bin/sucrase",+ "sucrase-node": "bin/sucrase-node"+ },+ "engines": {+ "node": ">=16 || 14 >=14.17"+ }+ },+ "node_modules/supports-preserve-symlinks-flag": {+ "version": "1.0.0",+ "resolved": "https://registry.npmmirror.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/tailwindcss": {+ "version": "3.4.19",+ "resolved": "https://registry.npmmirror.com/tailwindcss/-/tailwindcss-3.4.19.tgz",+ "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@alloc/quick-lru": "^5.2.0",+ "arg": "^5.0.2",+ "chokidar": "^3.6.0",+ "didyoumean": "^1.2.2",+ "dlv": "^1.1.3",+ "fast-glob": "^3.3.2",+ "glob-parent": "^6.0.2",+ "is-glob": "^4.0.3",+ "jiti": "^1.21.7",+ "lilconfig": "^3.1.3",+ "micromatch": "^4.0.8",+ "normalize-path": "^3.0.0",+ "object-hash": "^3.0.0",+ "picocolors": "^1.1.1",+ "postcss": "^8.4.47",+ "postcss-import": "^15.1.0",+ "postcss-js": "^4.0.1",+ "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0",+ "postcss-nested": "^6.2.0",+ "postcss-selector-parser": "^6.1.2",+ "resolve": "^1.22.8",+ "sucrase": "^3.35.0"+ },+ "bin": {+ "tailwind": "lib/cli.js",+ "tailwindcss": "lib/cli.js"+ },+ "engines": {+ "node": ">=14.0.0"+ }+ },+ "node_modules/thenify": {+ "version": "3.3.1",+ "resolved": "https://registry.npmmirror.com/thenify/-/thenify-3.3.1.tgz",+ "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "any-promise": "^1.0.0"+ }+ },+ "node_modules/thenify-all": {+ "version": "1.6.0",+ "resolved": "https://registry.npmmirror.com/thenify-all/-/thenify-all-1.6.0.tgz",+ "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "thenify": ">= 3.1.0 < 4"+ },+ "engines": {+ "node": ">=0.8"+ }+ },+ "node_modules/tinybench": {+ "version": "2.9.0",+ "resolved": "https://registry.npmmirror.com/tinybench/-/tinybench-2.9.0.tgz",+ "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/tinyexec": {+ "version": "0.3.2",+ "resolved": "https://registry.npmmirror.com/tinyexec/-/tinyexec-0.3.2.tgz",+ "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/tinyglobby": {+ "version": "0.2.17",+ "resolved": "https://registry.npmmirror.com/tinyglobby/-/tinyglobby-0.2.17.tgz",+ "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "fdir": "^6.5.0",+ "picomatch": "^4.0.4"+ },+ "engines": {+ "node": ">=12.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/SuperchupuDev"+ }+ },+ "node_modules/tinyglobby/node_modules/fdir": {+ "version": "6.5.0",+ "resolved": "https://registry.npmmirror.com/fdir/-/fdir-6.5.0.tgz",+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12.0.0"+ },+ "peerDependencies": {+ "picomatch": "^3 || ^4"+ },+ "peerDependenciesMeta": {+ "picomatch": {+ "optional": true+ }+ }+ },+ "node_modules/tinyglobby/node_modules/picomatch": {+ "version": "4.0.7",+ "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-4.0.7.tgz",+ "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/tinypool": {+ "version": "1.1.1",+ "resolved": "https://registry.npmmirror.com/tinypool/-/tinypool-1.1.1.tgz",+ "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "^18.0.0 || >=20.0.0"+ }+ },+ "node_modules/tinyrainbow": {+ "version": "1.2.0",+ "resolved": "https://registry.npmmirror.com/tinyrainbow/-/tinyrainbow-1.2.0.tgz",+ "integrity": "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=14.0.0"+ }+ },+ "node_modules/tinyspy": {+ "version": "3.0.2",+ "resolved": "https://registry.npmmirror.com/tinyspy/-/tinyspy-3.0.2.tgz",+ "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=14.0.0"+ }+ },+ "node_modules/to-regex-range": {+ "version": "5.0.1",+ "resolved": "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz",+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "is-number": "^7.0.0"+ },+ "engines": {+ "node": ">=8.0"+ }+ },+ "node_modules/ts-interface-checker": {+ "version": "0.1.13",+ "resolved": "https://registry.npmmirror.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",+ "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==",+ "dev": true,+ "license": "Apache-2.0"+ },+ "node_modules/tslib": {+ "version": "2.8.1",+ "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz",+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",+ "license": "0BSD"+ },+ "node_modules/typescript": {+ "version": "5.9.3",+ "resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.9.3.tgz",+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",+ "dev": true,+ "license": "Apache-2.0",+ "bin": {+ "tsc": "bin/tsc",+ "tsserver": "bin/tsserver"+ },+ "engines": {+ "node": ">=14.17"+ }+ },+ "node_modules/undici-types": {+ "version": "6.21.0",+ "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.21.0.tgz",+ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/update-browserslist-db": {+ "version": "1.3.2",+ "resolved": "https://registry.npmmirror.com/update-browserslist-db/-/update-browserslist-db-1.3.2.tgz",+ "integrity": "sha512-UQ+MSxlhRm1bzjhU+DcuXfjFO1FzNtqhK5+9Yvlp90ItDLk5vT932A0rFu619nf7RVS+Y/VeaUW1jaRDqZ8VJw==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/browserslist"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/browserslist"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "escalade": "^3.2.0",+ "picocolors": "^1.1.1"+ },+ "bin": {+ "update-browserslist-db": "cli.js"+ },+ "peerDependencies": {+ "browserslist": ">= 4.21.0"+ }+ },+ "node_modules/util-deprecate": {+ "version": "1.0.2",+ "resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz",+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/vite": {+ "version": "5.4.21",+ "resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.21.tgz",+ "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "esbuild": "^0.21.3",+ "postcss": "^8.4.43",+ "rollup": "^4.20.0"+ },+ "bin": {+ "vite": "bin/vite.js"+ },+ "engines": {+ "node": "^18.0.0 || >=20.0.0"+ },+ "funding": {+ "url": "https://github.com/vitejs/vite?sponsor=1"+ },+ "optionalDependencies": {+ "fsevents": "~2.3.3"+ },+ "peerDependencies": {+ "@types/node": "^18.0.0 || >=20.0.0",+ "less": "*",+ "lightningcss": "^1.21.0",+ "sass": "*",+ "sass-embedded": "*",+ "stylus": "*",+ "sugarss": "*",+ "terser": "^5.4.0"+ },+ "peerDependenciesMeta": {+ "@types/node": {+ "optional": true+ },+ "less": {+ "optional": true+ },+ "lightningcss": {+ "optional": true+ },+ "sass": {+ "optional": true+ },+ "sass-embedded": {+ "optional": true+ },+ "stylus": {+ "optional": true+ },+ "sugarss": {+ "optional": true+ },+ "terser": {+ "optional": true+ }+ }+ },+ "node_modules/vite-node": {+ "version": "2.1.9",+ "resolved": "https://registry.npmmirror.com/vite-node/-/vite-node-2.1.9.tgz",+ "integrity": "sha512-AM9aQ/IPrW/6ENLQg3AGY4K1N2TGZdR5e4gu/MmmR2xR3Ll1+dib+nook92g4TV3PXVyeyxdWwtaCAiUL0hMxA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "cac": "^6.7.14",+ "debug": "^4.3.7",+ "es-module-lexer": "^1.5.4",+ "pathe": "^1.1.2",+ "vite": "^5.0.0"+ },+ "bin": {+ "vite-node": "vite-node.mjs"+ },+ "engines": {+ "node": "^18.0.0 || >=20.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/vitest": {+ "version": "2.1.9",+ "resolved": "https://registry.npmmirror.com/vitest/-/vitest-2.1.9.tgz",+ "integrity": "sha512-MSmPM9REYqDGBI8439mA4mWhV5sKmDlBKWIYbA3lRb2PTHACE0mgKwA8yQ2xq9vxDTuk4iPrECBAEW2aoFXY0Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/expect": "2.1.9",+ "@vitest/mocker": "2.1.9",+ "@vitest/pretty-format": "^2.1.9",+ "@vitest/runner": "2.1.9",+ "@vitest/snapshot": "2.1.9",+ "@vitest/spy": "2.1.9",+ "@vitest/utils": "2.1.9",+ "chai": "^5.1.2",+ "debug": "^4.3.7",+ "expect-type": "^1.1.0",+ "magic-string": "^0.30.12",+ "pathe": "^1.1.2",+ "std-env": "^3.8.0",+ "tinybench": "^2.9.0",+ "tinyexec": "^0.3.1",+ "tinypool": "^1.0.1",+ "tinyrainbow": "^1.2.0",+ "vite": "^5.0.0",+ "vite-node": "2.1.9",+ "why-is-node-running": "^2.3.0"+ },+ "bin": {+ "vitest": "vitest.mjs"+ },+ "engines": {+ "node": "^18.0.0 || >=20.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ },+ "peerDependencies": {+ "@edge-runtime/vm": "*",+ "@types/node": "^18.0.0 || >=20.0.0",+ "@vitest/browser": "2.1.9",+ "@vitest/ui": "2.1.9",+ "happy-dom": "*",+ "jsdom": "*"+ },+ "peerDependenciesMeta": {+ "@edge-runtime/vm": {+ "optional": true+ },+ "@types/node": {+ "optional": true+ },+ "@vitest/browser": {+ "optional": true+ },+ "@vitest/ui": {+ "optional": true+ },+ "happy-dom": {+ "optional": true+ },+ "jsdom": {+ "optional": true+ }+ }+ },+ "node_modules/why-is-node-running": {+ "version": "2.3.0",+ "resolved": "https://registry.npmmirror.com/why-is-node-running/-/why-is-node-running-2.3.0.tgz",+ "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "siginfo": "^2.0.0",+ "stackback": "0.0.2"+ },+ "bin": {+ "why-is-node-running": "cli.js"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/zustand": {+ "version": "5.0.15",+ "resolved": "https://registry.npmmirror.com/zustand/-/zustand-5.0.15.tgz",+ "integrity": "sha512-MpSEjRiBkA9crSYeOUH32rJC7SVqAbm0Fqcqge/bUi2PPoLcBWKOsG+C8mevmpr8TwXHBVkChbbJiyvkE+i/3A==",+ "license": "MIT",+ "engines": {+ "node": ">=12.20.0"+ },+ "peerDependencies": {+ "@types/react": ">=18.0.0",+ "immer": ">=9.0.6",+ "react": ">=18.0.0",+ "use-sync-external-store": ">=1.2.0"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ },+ "immer": {+ "optional": true+ },+ "react": {+ "optional": true+ },+ "use-sync-external-store": {+ "optional": true+ }+ }+ }+ }+}diff --git a/libretv-next/package.json b/libretv-next/package.jsonnew file mode 100644index 0000000..3bd5135--- /dev/null+++ b/libretv-next/package.json@@ -0,0 +1,35 @@+{+ "name": "libretv-next",+ "version": "2.0.0",+ "private": true,+ "description": "免费在线视频搜索与观看平台(Next.js 重构版)",+ "license": "Apache-2.0",+ "scripts": {+ "dev": "next dev -p 8080",+ "build": "next build",+ "start": "next start -p 8080",+ "typecheck": "tsc --noEmit",+ "test": "vitest run"+ },+ "dependencies": {+ "@tanstack/react-query": "^5.59.0",+ "artplayer": "^5.2.3",+ "dexie": "^4.0.8",+ "dexie-react-hooks": "^1.1.7",+ "hls.js": "^1.5.17",+ "next": "^15.1.0",+ "react": "^19.0.0",+ "react-dom": "^19.0.0",+ "zustand": "^5.0.2"+ },+ "devDependencies": {+ "@types/node": "^22.10.0",+ "@types/react": "^19.0.0",+ "@types/react-dom": "^19.0.0",+ "autoprefixer": "^10.4.20",+ "postcss": "^8.4.49",+ "tailwindcss": "^3.4.15",+ "typescript": "^5.7.2",+ "vitest": "^2.1.8"+ }+}diff --git a/libretv-next/postcss.config.mjs b/libretv-next/postcss.config.mjsnew file mode 100644index 0000000..a982c64--- /dev/null+++ b/libretv-next/postcss.config.mjs@@ -0,0 +1,8 @@+const config = {+ plugins: {+ tailwindcss: {},+ autoprefixer: {},+ },+};++export default config;diff --git a/libretv-next/public/favicon.svg b/libretv-next/public/favicon.svgnew file mode 100644index 0000000..6bf63e1--- /dev/null+++ b/libretv-next/public/favicon.svg@@ -0,0 +1,4 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">+ <rect width="64" height="64" rx="14" fill="#111111"/>+ <path d="M22 18v28h20" fill="none" stroke="#23ade5" stroke-width="7" stroke-linecap="round" stroke-linejoin="round"/>+</svg>diff --git a/libretv-next/public/robots.txt b/libretv-next/public/robots.txtnew file mode 100644index 0000000..c2a49f4--- /dev/null+++ b/libretv-next/public/robots.txt@@ -0,0 +1,2 @@+User-agent: *+Allow: /diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.json b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.jsonnew file mode 100644index 0000000..347c777--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.json@@ -0,0 +1 @@+{"touched":["F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\components\\header.tsx","F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\components\\auth.tsx","F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\components\\toast.tsx","F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\components\\player-shell.tsx","F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\components\\video-card.tsx","F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\components\\history-panel.tsx","F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\components\\source-manager.tsx","F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\components\\detail-modal.tsx","F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\components\\douban-section.tsx","F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\components\\switch-source.tsx","F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\app\\page.tsx","F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\app\\watch\\page.tsx","F:\\git\\bestzwei\\LibreTV-Project\\LibreTV\\libretv-next\\src\\app\\about\\page.tsx"],"bashMutation":false,"reportedFindings":[],"findingEvents":[],"baseline":{"storageId":"mtiy5v8r-24984-7970f41ca4","createdAt":"2026-09-01T17:34:29.739Z","files":{"components/header.tsx":{"existed":true,"snapshot":"cf7e29e4902dea0aa000da86f34225ba6d7a6d13c982343f255b15f827269199.source"},"components/auth.tsx":{"existed":true,"snapshot":"e2bf0c29de09f20b0bcbf1781174fd635a68e6f9399827a6f2b9ea8ee734f34f.source"},"components/toast.tsx":{"existed":true,"snapshot":"3f66283da3f5e012a1a9d6276811bb4567dc296a737184ea09f42739b5970ddf.source"},"components/player-shell.tsx":{"existed":true,"snapshot":"2c2e07604ba8605b927025abca6058c51e6938561431132eb180f7b4f9b49252.source"},"components/video-card.tsx":{"existed":true,"snapshot":"c0edcbf68c2c69873fdf45e29857bc1b97ff875c49a34fb1ef82bcf9bfafdd6c.source"},"components/history-panel.tsx":{"existed":true,"snapshot":"b43fdff72d3f4851a308a7e25bfb25e5089cdff996639f04a08c39caae434cbd.source"},"components/source-manager.tsx":{"existed":true,"snapshot":"56215c6f4e4447dc9e57a4b127ec12f1708efd0e3f6dae17a636041d99e29bab.source"},"components/detail-modal.tsx":{"existed":true,"snapshot":"6c3ef330762d14573273534ef2c143548a0a2735a3e816e55bf186167ec75d1f.source"},"components/douban-section.tsx":{"existed":true,"snapshot":"d3cb66a01d282f3068e543d01cb615fb05fb9f322b80ca36b2aeece6d833da23.source"},"components/switch-source.tsx":{"existed":true,"snapshot":"91d91840c4d075907471114c7df24ba3d14f64a0347e7608d714ba0057d53f1c.source"},"app/page.tsx":{"existed":true,"snapshot":"6efdf509a785a0658b2e31a8c33d298de14321d9672179370e99cc76241c1eb0.source"},"app/watch/page.tsx":{"existed":true,"snapshot":"4d11f641228247e8d951ce9207cdfb266a2b24ad259b7e448f835dbbb85fd409.source"},"app/about/page.tsx":{"existed":true,"snapshot":"06f49e3158547ee7b6e5ad074bcb5d474ecd3b8d7b1418c4ab1d89973e22c5ed.source"}},"complete":false,"candidateLimit":5000,"discoveredFiles":0,"capturedFiles":13,"truncated":false,"omittedAtLeast":0,"firstOmitted":"","errors":[{"stage":"baseline-capture","target":".","reason":"global task baseline was unavailable; captured only the touched file"}]},"stateErrors":[],"omittedReportedFindings":0,"omittedFindingEvents":0,"processing":null,"updatedAt":"2026-09-01T17:38:02.199Z"}\ No newline at end of filediff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/06f49e3158547ee7b6e5ad074bcb5d474ecd3b8d7b1418c4ab1d89973e22c5ed.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/06f49e3158547ee7b6e5ad074bcb5d474ecd3b8d7b1418c4ab1d89973e22c5ed.sourcenew file mode 100644index 0000000..9e95b4e--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/06f49e3158547ee7b6e5ad074bcb5d474ecd3b8d7b1418c4ab1d89973e22c5ed.source@@ -0,0 +1,51 @@+'use client';++import { Header } from '@/components/header';++export default function AboutPage() {+ return (+ <div className="min-h-screen flex flex-col">+ <Header />+ <main className="flex-1 max-w-2xl w-full mx-auto px-4 py-10 space-y-8">+ <section>+ <h1 className="text-xl font-bold text-white mb-3">关于 LibreTV</h1>+ <p className="text-sm text-gray-400 leading-relaxed">+ LibreTV 是一个免费的在线视频搜索与观看平台。输入片名即可在多个数据源中聚合搜索,+ 无需注册、无内嵌广告、不存储任何视频文件。所有播放内容均来自第三方公开接口。+ </p>+ </section>++ <section>+ <h2 className="text-base font-semibold text-white mb-2.5">快捷键</h2>+ <ul className="text-sm text-gray-400 space-y-1.5 list-disc list-inside">+ <li><code className="text-accent">空格</code> 播放 / 暂停</li>+ <li><code className="text-accent">←</code> / <code className="text-accent">→</code> 快退 / 快进 5 秒</li>+ <li><code className="text-accent">↑</code> / <code className="text-accent">↓</code> 音量调节</li>+ <li><code className="text-accent">F</code> 切换全屏</li>+ <li><code className="text-accent">Alt + ←/→</code> 上一集 / 下一集</li>+ <li>移动端长按视频可 3 倍速播放</li>+ </ul>+ </section>++ <section>+ <h2 className="text-base font-semibold text-white mb-2.5">隐私与数据</h2>+ <p className="text-sm text-gray-400 leading-relaxed">+ 你的搜索历史、观看进度等数据仅保存在本设备浏览器中(IndexedDB),不会上传到服务器。+ 聚合搜索请求由服务端代理转发,第三方数据源不会看到你的 IP 地址。+ </p>+ </section>++ <section>+ <h2 className="text-base font-semibold text-white mb-2.5">免责声明</h2>+ <p className="text-sm text-gray-500 leading-relaxed">+ 本项目不存储、不制作任何视频内容,仅提供第三方公开接口的聚合与播放能力。+ 请尊重版权,所有内容的合法性由对应数据源负责。+ </p>+ </section>+ </main>+ <footer className="border-t border-[#2a2a2a] py-4">+ <p className="text-center text-xs text-gray-600">LibreTV v2.0 · Apache-2.0 License</p>+ </footer>+ </div>+ );+}diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/2c2e07604ba8605b927025abca6058c51e6938561431132eb180f7b4f9b49252.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/2c2e07604ba8605b927025abca6058c51e6938561431132eb180f7b4f9b49252.sourcenew file mode 100644index 0000000..2db8e70--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/2c2e07604ba8605b927025abca6058c51e6938561431132eb180f7b4f9b49252.source@@ -0,0 +1,368 @@+'use client';++import { useEffect, useRef, useState } from 'react';+import Artplayer from 'artplayer';+import Hls, { type HlsConfig } from 'hls.js';+import { filterAdsFromM3u8 } from '@/lib/m3u8';+import { formatTime } from '@/lib/utils';++/**+ * 播放器外壳:ArtPlayer + hls.js(旧版 player.js 的 React 化)。+ * 保留:广告分片过滤、自动连播回调、进度回调、快捷键、移动端长按倍速、错误恢复。+ * 移除:DOM 手工操作、watch.html 跳转链、localStorage 状态总线。+ */++// 广告过滤 loader:拦截 manifest/level 响应文本,剔除 DISCONTINUITY 广告片段+class CustomHlsJsLoader extends Hls.DefaultConfig.loader {+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ constructor(config: any) {+ super(config);+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ const load = this.load.bind(this);+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ this.load = function (context: any, config: any, callbacks: any) {+ if (context.type === 'manifest' || context.type === 'level') {+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ const onSuccess = callbacks.onSuccess;+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ callbacks.onSuccess = function (response: any, stats: any, ctx: any, networkDetails: any) {+ if (response.data && typeof response.data === 'string') {+ response.data = filterAdsFromM3u8(response.data);+ }+ return onSuccess(response, stats, ctx, networkDetails);+ };+ }+ load(context, config, callbacks);+ };+ }+}++interface PlayerShellProps {+ url: string;+ title: string;+ adFilter: boolean;+ autoplayNext: boolean;+ /** 进度恢复:优先 URL position,其次查询该回调(返回 0 表示无记录) */+ getRestorePosition?: () => number | Promise<number>;+ onTimeUpdate?: (position: number, duration: number) => void;+ onEnded?: () => void;+ onPause?: (position: number, duration: number) => void;+}++export function PlayerShell({+ url,+ title,+ adFilter,+ autoplayNext,+ getRestorePosition,+ onTimeUpdate,+ onEnded,+ onPause,+}: PlayerShellProps) {+ const containerRef = useRef<HTMLDivElement>(null);+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ const artRef = useRef<any>(null);+ const hlsRef = useRef<Hls | null>(null);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState('');+ const [hint, setHint] = useState('');+ const hintTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ // 用 ref 持有最新回调,避免重建播放器+ const cbs = useRef({ onTimeUpdate, onEnded, onPause, getRestorePosition });+ cbs.current = { onTimeUpdate, onEnded, onPause, getRestorePosition };+ const autoplayRef = useRef(autoplayNext);+ autoplayRef.current = autoplayNext;++ useEffect(() => {+ if (!containerRef.current || !url) return;+ setLoading(true);+ setError('');++ let disposed = false;+ let lastSave = 0;+ let playbackStarted = false;+ let errorCount = 0;++ const showHint = (text: string) => {+ setHint(text);+ if (hintTimerRef.current) clearTimeout(hintTimerRef.current);+ hintTimerRef.current = setTimeout(() => setHint(''), 2500);+ };++ const hlsConfig: Partial<HlsConfig> = {+ debug: false,+ enableWorker: true,+ backBufferLength: 90,+ maxBufferLength: 30,+ maxMaxBufferLength: 60,+ maxBufferSize: 30 * 1000 * 1000,+ maxBufferHole: 0.5,+ fragLoadingMaxRetry: 6,+ fragLoadingRetryDelay: 1000,+ manifestLoadingMaxRetry: 3,+ manifestLoadingRetryDelay: 1000,+ startLevel: -1,+ abrEwmaDefaultEstimate: 500_000,+ appendErrorMaxRetry: 5,+ };+ if (adFilter) hlsConfig.loader = CustomHlsJsLoader as unknown as HlsConfig['loader'];++ /**+ * 初始化 HLS。allowProxyFallback:直连致命网络错误(CORS/防盗链/分片被拒)时,+ * 自动改走同源 cookie 鉴权的 /api/proxy 重试一次。+ */+ const setupHls = (video: HTMLVideoElement, mediaUrl: string, allowProxyFallback: boolean) => {+ hlsRef.current?.destroy();+ const hls = new Hls(hlsConfig);+ hlsRef.current = hls;++ hls.loadSource(mediaUrl);+ hls.attachMedia(video);++ hls.on(Hls.Events.MANIFEST_PARSED, () => {+ video.play().catch(() => {});+ });+ hls.on(Hls.Events.FRAG_LOADED, () => setLoading(false));+ hls.on(Hls.Events.ERROR, (_evt, data) => {+ errorCount++;+ if (data.fatal && !playbackStarted) {+ switch (data.type) {+ case Hls.ErrorTypes.NETWORK_ERROR:+ if (+ allowProxyFallback &&+ !mediaUrl.startsWith('/api/proxy/') &&+ (errorCount >= 2 || data.details === 'manifestLoadError')+ ) {+ showHint('直连失败,改用代理重试...');+ setupHls(video, `/api/proxy/${encodeURIComponent(mediaUrl)}`, false);+ return;+ }+ hls.startLoad();+ break;+ case Hls.ErrorTypes.MEDIA_ERROR:+ hls.recoverMediaError();+ break;+ default:+ if (errorCount > 3) {+ setLoading(false);+ setError('视频加载失败,可能是格式不兼容或源不可用,请尝试其他视频源');+ }+ }+ }+ });+ };++ const art = new Artplayer({+ container: containerRef.current,+ url,+ type: 'm3u8',+ volume: 0.8,+ autoplay: true,+ pip: true,+ autoMini: true,+ screenshot: true,+ setting: true,+ playbackRate: true,+ aspectRatio: true,+ fullscreen: true,+ fullscreenWeb: true,+ miniProgressBar: true,+ mutex: true,+ backdrop: true,+ playsInline: true,+ airplay: true,+ hotkey: false,+ theme: '#23ade5',+ lang: navigator.language.toLowerCase().startsWith('zh') ? 'zh-cn' : 'en',+ moreVideoAttr: { crossOrigin: 'anonymous', playsInline: true },+ customType: {+ m3u8: (video: HTMLVideoElement, mediaUrl: string) => {+ setupHls(video, mediaUrl, true);+ },+ },+ });+ artRef.current = art;+ art.on('video:loadedmetadata', () => {+ // ArtPlayer 运行时支持 title 选项(类型定义未覆盖),用于界面标题展示+ try {+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ (art as any).title = title;+ } catch { /* 忽略 */ }+ });++ art.on('ready', () => {+ // 进度恢复+ const restore = async () => {+ const saved = (await cbs.current.getRestorePosition?.()) ?? 0;+ const duration = art.duration || 0;+ if (saved > 10 && duration > 0 && saved < duration - 2) {+ art.currentTime = saved;+ showHint(`已从 ${formatTime(saved)} 继续播放`);+ }+ };+ restore();+ });++ art.on('video:playing', () => {+ playbackStarted = true;+ setLoading(false);+ setError('');+ });+ art.on('video:loadedmetadata', () => setLoading(false));+ art.on('video:error', () => {+ setLoading(false);+ setError('视频播放失败,请尝试其他视频源');+ });+ art.on('video:timeupdate', () => {+ const now = Date.now();+ if (now - lastSave > 5000) {+ lastSave = now;+ cbs.current.onTimeUpdate?.(art.currentTime, art.duration);+ }+ });+ art.on('video:pause', () => {+ cbs.current.onPause?.(art.currentTime, art.duration);+ });+ art.on('video:ended', () => {+ cbs.current.onEnded?.();+ });++ // —— 键盘快捷键(旧版 hotkey:false + 自定义逻辑的移植) ——+ const shortcuts = (e: KeyboardEvent) => {+ const target = e.target as HTMLElement;+ if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') return;+ const current = artRef.current;+ if (!current) return;+ if (e.altKey && e.key === 'ArrowLeft') { e.preventDefault(); return; } // 由父层处理集数切换+ if (e.altKey && e.key === 'ArrowRight') { e.preventDefault(); return; }+ switch (e.key) {+ case 'ArrowLeft':+ if (current.currentTime > 5) { current.currentTime -= 5; showHint('快退 5s'); e.preventDefault(); }+ break;+ case 'ArrowRight':+ if (current.duration - current.currentTime > 5) { current.currentTime += 5; showHint('快进 5s'); e.preventDefault(); }+ break;+ case 'ArrowUp':+ if (current.volume < 1) { current.volume = Math.min(1, current.volume + 0.1); showHint(`音量 ${Math.round(current.volume * 100)}%`); e.preventDefault(); }+ break;+ case 'ArrowDown':+ if (current.volume > 0) { current.volume = Math.max(0, current.volume - 0.1); showHint(`音量 ${Math.round(current.volume * 100)}%`); e.preventDefault(); }+ break;+ case ' ':+ current.toggle(); showHint('播放/暂停'); e.preventDefault();+ break;+ case 'f': case 'F':+ current.fullscreen = !current.fullscreen; e.preventDefault();+ break;+ }+ };+ document.addEventListener('keydown', shortcuts);++ // —— 移动端长按 3 倍速 ——+ let longPressTimer: ReturnType<typeof setTimeout> | null = null;+ let isLongPress = false;+ let originalRate = 1.0;+ const el = containerRef.current;++ const onTouchStart = (e: TouchEvent) => {+ if (art.video?.paused) return;+ originalRate = art.video.playbackRate;+ longPressTimer = setTimeout(() => {+ if (art.video?.paused) return;+ art.video.playbackRate = 3.0;+ isLongPress = true;+ showHint('3 倍速');+ e.preventDefault();+ }, 500);+ };+ const onTouchEnd = () => {+ if (longPressTimer) { clearTimeout(longPressTimer); longPressTimer = null; }+ if (isLongPress) {+ art.video.playbackRate = originalRate;+ isLongPress = false;+ showHint(`${originalRate} 倍速`);+ }+ };+ const onTouchMove = (e: TouchEvent) => {+ if (isLongPress) e.preventDefault();+ };+ el?.addEventListener('touchstart', onTouchStart, { passive: false });+ el?.addEventListener('touchend', onTouchEnd);+ el?.addEventListener('touchcancel', onTouchEnd);+ el?.addEventListener('touchmove', onTouchMove, { passive: false });++ // 双击全屏+ art.on('video:dblclick', () => {+ art.fullscreen = !art.fullscreen;+ });++ // 卸载与页面隐藏时保存进度+ const saveOnHide = () => {+ if (document.visibilityState === 'hidden') {+ cbs.current.onPause?.(art.currentTime, art.duration);+ }+ };+ document.addEventListener('visibilitychange', saveOnHide);++ return () => {+ disposed = true;+ void disposed;+ // 卸载前刷一次最终进度,避免丢失最后几秒+ try {+ cbs.current.onPause?.(art.currentTime, art.duration);+ } catch { /* 忽略 */ }+ document.removeEventListener('keydown', shortcuts);+ document.removeEventListener('visibilitychange', saveOnHide);+ if (hintTimerRef.current) clearTimeout(hintTimerRef.current);+ el?.removeEventListener('touchstart', onTouchStart);+ el?.removeEventListener('touchend', onTouchEnd);+ el?.removeEventListener('touchcancel', onTouchEnd);+ el?.removeEventListener('touchmove', onTouchMove);+ hlsRef.current?.destroy();+ hlsRef.current = null;+ art.destroy();+ artRef.current = null;+ };+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [url, adFilter]);++ // 暴露实例给父组件做集数切换(换集时用 art.switch,避免整页重建)+ useEffect(() => {+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ (window as any).__libretv_player = artRef;+ return () => {+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ delete (window as any).__libretv_player;+ };+ }, []);++ return (+ <div className="relative w-full h-full">+ <div ref={containerRef} className="w-full h-full" />+ {loading && !error && (+ <div className="absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/60 pointer-events-none">+ <div className="h-9 w-9 rounded-full border-4 border-[#3a3a3a] border-t-accent animate-spin" />+ <p className="text-sm text-gray-300">正在加载视频...</p>+ </div>+ )}+ {error && (+ <div className="absolute inset-0 flex flex-col items-center justify-center gap-2 bg-black/80">+ <p className="text-red-400 text-sm">{error}</p>+ <button className="btn-ghost text-xs" onClick={() => location.reload()}>+ 重新加载+ </button>+ </div>+ )}+ {hint && (+ <div className="absolute top-4 left-1/2 -translate-x-1/2 bg-black/70 text-white text-sm px-3 py-1.5 rounded-full pointer-events-none animate-fade-in">+ {hint}+ </div>+ )}+ {autoplayNext && !error && (+ <div className="absolute bottom-16 right-3 text-[10px] text-gray-400 bg-black/50 px-2 py-0.5 rounded pointer-events-none">+ 自动连播已开启+ </div>+ )}+ </div>+ );+}diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/3f66283da3f5e012a1a9d6276811bb4567dc296a737184ea09f42739b5970ddf.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/3f66283da3f5e012a1a9d6276811bb4567dc296a737184ea09f42739b5970ddf.sourcenew file mode 100644index 0000000..a6b9ef0--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/3f66283da3f5e012a1a9d6276811bb4567dc296a737184ea09f42739b5970ddf.source@@ -0,0 +1,75 @@+'use client';++import { createContext, useCallback, useContext, useRef, useState, type ReactNode } from 'react';+import { cn } from '@/lib/utils';++// —— Toast —— 替代旧版 3 秒/条串行队列,支持并行堆叠与自动过期++interface ToastItem {+ id: number;+ message: string;+ type: 'error' | 'success' | 'info' | 'warning';+}++interface ToastContextValue {+ toast: (message: string, type?: ToastItem['type']) => void;+}++const ToastContext = createContext<ToastContextValue>({ toast: () => {} });++export function useToast(): ToastContextValue {+ return useContext(ToastContext);+}++const TYPE_STYLES: Record<ToastItem['type'], string> = {+ error: 'bg-red-500',+ success: 'bg-green-600',+ info: 'bg-blue-500',+ warning: 'bg-yellow-600',+};++export function ToastProvider({ children }: { children: ReactNode }) {+ const [items, setItems] = useState<ToastItem[]>([]);+ const idRef = useRef(0);++ const toast = useCallback((message: string, type: ToastItem['type'] = 'info') => {+ const id = ++idRef.current;+ setItems((prev) => [...prev.slice(-3), { id, message, type }]);+ setTimeout(() => {+ setItems((prev) => prev.filter((t) => t.id !== id));+ }, 3000);+ }, []);++ return (+ <ToastContext.Provider value={{ toast }}>+ {children}+ <div className="fixed top-4 left-1/2 -translate-x-1/2 z-[100] flex flex-col gap-2 items-center pointer-events-none">+ {items.map((t) => (+ <div+ key={t.id}+ className={cn(+ 'px-4 py-2.5 rounded-lg shadow-lg text-white text-sm max-w-md animate-slide-up',+ TYPE_STYLES[t.type]+ )}+ >+ {t.message}+ </div>+ ))}+ </div>+ </ToastContext.Provider>+ );+}++// —— Loading 遮罩 ——(带 30s 自动解除,防无限 loading)++export function LoadingOverlay({ show, message = '加载中...' }: { show: boolean; message?: string }) {+ if (!show) return null;+ return (+ <div className="fixed inset-0 z-[90] flex items-center justify-center bg-black/70 animate-fade-in">+ <div className="flex flex-col items-center gap-3">+ <div className="h-10 w-10 rounded-full border-4 border-[#3a3a3a] border-t-accent animate-spin" />+ <p className="text-sm text-gray-300">{message}</p>+ </div>+ </div>+ );+}diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/4d11f641228247e8d951ce9207cdfb266a2b24ad259b7e448f835dbbb85fd409.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/4d11f641228247e8d951ce9207cdfb266a2b24ad259b7e448f835dbbb85fd409.sourcenew file mode 100644index 0000000..e508e66--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/4d11f641228247e8d951ce9207cdfb266a2b24ad259b7e448f835dbbb85fd409.source@@ -0,0 +1,345 @@+'use client';++import { Suspense, useCallback, useEffect, useMemo, useRef, useState } from 'react';+import { useRouter, useSearchParams } from 'next/navigation';+import Link from 'next/link';+import { useQuery } from '@tanstack/react-query';+import { api } from '@/lib/client-api';+import { PlayerShell } from '@/components/player-shell';+import { SwitchSourceModal } from '@/components/switch-source';+import { useAuth } from '@/components/auth';+import { resolveSource, useAppStore } from '@/lib/store';+import {+ clearProgress,+ progressKeyOf,+ saveProgress,+ updateHistoryProgress,+ upsertHistory,+ db,+} from '@/lib/db';+import { cn } from '@/lib/utils';++/**+ * 播放页(唯一入口,替代旧版 watch.html → player.html 跳转链)。+ * 状态全部由 URL 驱动:/watch?source=xx&id=..&index=..&title=..+ * 集数列表由服务端详情接口获取;进度与历史走 IndexedDB。+ */+export default function WatchPage() {+ return (+ <Suspense>+ <WatchContent />+ </Suspense>+ );+}++function WatchContent() {+ const searchParams = useSearchParams();+ const router = useRouter();+ const store = useAppStore();+ const { verified } = useAuth();++ const sourceKey = searchParams.get('source') || '';+ const vodId = searchParams.get('id') || '';+ const directUrl = searchParams.get('url') || '';+ const titleParam = searchParams.get('title') || '';+ const indexParam = parseInt(searchParams.get('index') || '0', 10) || 0;++ const [reversed, setReversed] = useState(false);+ const [switchOpen, setSwitchOpen] = useState(false);++ const source = resolveSource(store, sourceKey, {+ url: searchParams.get('sourceUrl') || undefined,+ detail: searchParams.get('detail') || undefined,+ });++ // 详情查询:无 id(纯直连链接分享)时跳过+ const detailQuery = useQuery({+ queryKey: ['detail', sourceKey, vodId, source?.url],+ queryFn: ({ signal }) => api.detail(vodId, source!, signal),+ enabled: Boolean(source && vodId && verified),+ staleTime: 5 * 60_000,+ });++ const episodes = detailQuery.data?.episodes ?? [];+ const videoTitle = titleParam || detailQuery.data?.videoInfo?.title || '未知视频';++ // 当前播放地址:优先取剧集列表中的当前集,其次直连 URL 参数+ const currentUrl = useMemo(() => {+ if (episodes.length > 0) {+ const idx = Math.min(Math.max(indexParam, 0), episodes.length - 1);+ return episodes[idx] || directUrl;+ }+ return directUrl;+ }, [episodes, indexParam, directUrl]);++ const currentIndex = useMemo(() => {+ if (episodes.length > 0) return Math.min(Math.max(indexParam, 0), episodes.length - 1);+ return indexParam;+ }, [episodes, indexParam]);++ const goEpisode = useCallback(+ (index: number) => {+ const sp = new URLSearchParams(searchParams.toString());+ sp.set('index', String(index));+ sp.set('url', episodes[index] || directUrl);+ sp.delete('position');+ router.replace(`/watch?${sp.toString()}`, { scroll: false });+ },+ [router, searchParams, episodes, directUrl]+ );++ // 进度恢复优先级:URL position 参数 > IndexedDB 记录+ const getRestorePosition = useCallback(async () => {+ const urlPos = parseInt(searchParams.get('position') || '0', 10) || 0;+ if (urlPos > 0) return urlPos;+ if (!vodId) return 0;+ const entry = await db.progress.get(progressKeyOf(sourceKey, vodId, currentIndex));+ return entry?.position ?? 0;+ }, [searchParams, sourceKey, vodId, currentIndex]);++ // 写入观看历史(进入页面即记录,进度后续增量更新)+ useEffect(() => {+ if (!verified || !sourceKey || !currentUrl) return;+ const timer = setTimeout(() => {+ upsertHistory({+ sourceKey,+ sourceUrl: source?.url,+ vodId: vodId || currentUrl,+ title: videoTitle,+ pic: detailQuery.data?.videoInfo?.cover,+ episodeIndex: currentIndex,+ totalEpisodes: episodes.length,+ playbackPosition: 0,+ duration: 0,+ timestamp: Date.now(),+ }).catch(() => {});+ }, 2000);+ return () => clearTimeout(timer);+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [verified, sourceKey, vodId, currentIndex, videoTitle, currentUrl]);++ const handleTimeUpdate = useCallback(+ (position: number, duration: number) => {+ if (vodId) {+ saveProgress(sourceKey, vodId, currentIndex, position, duration).catch(() => {});+ updateHistoryProgress(sourceKey, vodId || currentUrl, position, duration).catch(() => {});+ }+ },+ [sourceKey, vodId, currentIndex, currentUrl]+ );++ const handlePause = useCallback(+ (position: number, duration: number) => {+ if (vodId) {+ saveProgress(sourceKey, vodId, currentIndex, position, duration).catch(() => {});+ updateHistoryProgress(sourceKey, vodId || currentUrl, position, duration).catch(() => {});+ }+ },+ [sourceKey, vodId, currentIndex, currentUrl]+ );++ const handleEnded = useCallback(() => {+ if (vodId) clearProgress(sourceKey, vodId, currentIndex).catch(() => {});+ if (store.autoplayNext && currentIndex < episodes.length - 1) {+ setTimeout(() => goEpisode(currentIndex + 1), 800);+ }+ }, [store.autoplayNext, currentIndex, episodes.length, goEpisode, sourceKey, vodId]);++ // Alt+←/→ 集数切换快捷键+ useEffect(() => {+ const handler = (e: KeyboardEvent) => {+ if (!e.altKey) return;+ if (e.key === 'ArrowLeft' && currentIndex > 0) {+ e.preventDefault();+ goEpisode(currentIndex - 1);+ } else if (e.key === 'ArrowRight' && currentIndex < episodes.length - 1) {+ e.preventDefault();+ goEpisode(currentIndex + 1);+ }+ };+ document.addEventListener('keydown', handler);+ return () => document.removeEventListener('keydown', handler);+ }, [currentIndex, episodes.length, goEpisode]);++ const orderedEpisodes = reversed ? [...episodes].map((_, i) => episodes.length - 1 - i) : episodes.map((_, i) => i);++ if (!verified) {+ return (+ <div className="min-h-screen flex items-center justify-center">+ <p className="text-gray-500 text-sm">等待访问验证...</p>+ </div>+ );+ }++ if (!source) {+ return (+ <div className="min-h-screen flex items-center justify-center px-4">+ <div className="text-center max-w-md">+ <h1 className="text-white font-medium mb-2">数据源不存在</h1>+ <p className="text-sm text-gray-400 mb-4">+ 该视频来自数据源「{sourceKey}」,但它可能已被删除。请在设置中重新添加后重试。+ </p>+ <Link href="/" className="btn-primary">返回首页</Link>+ </div>+ </div>+ );+ }++ return (+ <div className="min-h-screen flex flex-col">+ <header className="sticky top-0 z-40 bg-surface/90 backdrop-blur border-b border-[#2a2a2a]">+ <div className="max-w-7xl mx-auto px-4 h-14 flex items-center gap-3">+ <BackButton />+ <div className="min-w-0">+ <h1 className="text-sm font-medium text-white truncate">{videoTitle}</h1>+ <p className="text-xs text-gray-500">+ {source.name}+ {episodes.length > 0 && ` · 第 ${currentIndex + 1}/${episodes.length} 集`}+ </p>+ </div>+ <div className="ml-auto flex items-center gap-2">+ <button className="btn-ghost !py-1.5 text-xs" onClick={() => setSwitchOpen(true)}>+ 切换资源+ </button>+ </div>+ </div>+ </header>++ <main className="flex-1 max-w-7xl w-full mx-auto px-4 py-4">+ <div className="grid grid-cols-1 lg:grid-cols-[1fr_300px] gap-4">+ <div>+ <div className="aspect-video bg-black rounded-lg overflow-hidden">+ {currentUrl ? (+ <PlayerShell+ url={currentUrl}+ title={videoTitle}+ adFilter={store.adFilter}+ autoplayNext={store.autoplayNext}+ getRestorePosition={getRestorePosition}+ onTimeUpdate={handleTimeUpdate}+ onPause={handlePause}+ onEnded={handleEnded}+ />+ ) : (+ <div className="w-full h-full flex items-center justify-center">+ {detailQuery.isLoading ? (+ <div className="h-9 w-9 rounded-full border-4 border-[#3a3a3a] border-t-accent animate-spin" />+ ) : (+ <p className="text-gray-500 text-sm">+ {detailQuery.isError ? '视频加载失败,请尝试其他资源' : '无可用播放地址'}+ </p>+ )}+ </div>+ )}+ </div>++ {/* 操作栏 */}+ <div className="flex flex-wrap items-center gap-2 mt-3">+ <button+ className="btn-ghost !py-1.5 text-xs"+ disabled={currentIndex <= 0}+ onClick={() => goEpisode(currentIndex - 1)}+ >+ 上一集+ </button>+ <button+ className="btn-ghost !py-1.5 text-xs"+ disabled={episodes.length === 0 || currentIndex >= episodes.length - 1}+ onClick={() => goEpisode(currentIndex + 1)}+ >+ 下一集+ </button>+ <button className="btn-ghost !py-1.5 text-xs" onClick={() => setReversed((v) => !v)}>+ {reversed ? '正序排列' : '倒序排列'}+ </button>+ <label className="flex items-center gap-1.5 text-xs text-gray-400 ml-auto cursor-pointer">+ <input+ type="checkbox"+ className="h-3.5 w-3.5 accent-[#23ade5]"+ checked={store.autoplayNext}+ onChange={(e) => store.updateSettings({ autoplayNext: e.target.checked })}+ />+ 自动连播+ </label>+ </div>+ </div>++ {/* 剧集侧栏 */}+ <aside className="bg-surface-raised rounded-lg p-3 h-fit">+ <div className="flex items-center justify-between mb-2.5">+ <h2 className="text-sm font-semibold text-gray-300">+ 剧集列表{episodes.length > 0 && `(${episodes.length})`}+ </h2>+ </div>+ {episodes.length === 0 ? (+ <p className="text-center text-xs text-gray-500 py-8">+ {detailQuery.isLoading ? '加载中...' : detailQuery.isError ? '获取剧集失败' : '暂无剧集信息'}+ </p>+ ) : (+ <div className="grid grid-cols-5 lg:grid-cols-4 gap-1.5 max-h-[65vh] overflow-y-auto scrollbar-thin pr-1">+ {orderedEpisodes.map((realIndex) => (+ <EpisodeButton+ key={realIndex}+ index={realIndex}+ active={realIndex === currentIndex}+ onClick={() => goEpisode(realIndex)}+ />+ ))}+ </div>+ )}+ <p className="hidden md:block text-[10px] text-gray-600 mt-3 leading-relaxed">+ 快捷键:空格 播放/暂停 · ←/→ 快退/快进 5s · ↑/↓ 音量 · F 全屏 · Alt+←/→ 切换集数+ </p>+ </aside>+ </div>+ </main>++ {switchOpen && (+ <SwitchSourceModal+ currentTitle={videoTitle}+ currentSourceKey={sourceKey}+ currentVodId={vodId}+ currentIndex={currentIndex}+ onClose={() => setSwitchOpen(false)}+ />+ )}+ </div>+ );+}++/** 集数按钮:激活时自动滚动进可视区(长剧列表) */+function EpisodeButton({ index, active, onClick }: { index: number; active: boolean; onClick: () => void }) {+ const ref = useRef<HTMLButtonElement>(null);++ useEffect(() => {+ if (active) ref.current?.scrollIntoView({ block: 'nearest' });+ }, [active]);++ return (+ <button+ ref={ref}+ className={cn('btn !px-1 text-xs !py-1.5', active ? 'episode-active' : 'btn-ghost')}+ onClick={onClick}+ >+ {index + 1}+ </button>+ );+}++function BackButton() {+ const router = useRouter();+ return (+ <button+ className="p-2 -ml-2 rounded-md text-gray-400 hover:text-white hover:bg-surface-hover transition-colors"+ onClick={() => {+ if (window.history.length > 1) router.back();+ else router.push('/');+ }}+ aria-label="返回"+ >+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />+ </svg>+ </button>+ );+}diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/56215c6f4e4447dc9e57a4b127ec12f1708efd0e3f6dae17a636041d99e29bab.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/56215c6f4e4447dc9e57a4b127ec12f1708efd0e3f6dae17a636041d99e29bab.sourcenew file mode 100644index 0000000..163b8d2--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/56215c6f4e4447dc9e57a4b127ec12f1708efd0e3f6dae17a636041d99e29bab.source@@ -0,0 +1,373 @@+'use client';++import { useEffect, useState } from 'react';+import { Drawer } from './header';+import { useAppStore } from '@/lib/store';+import { useToast } from './toast';+import { validateSourceUrl, cn } from '@/lib/utils';+import { exportConfig, importConfig } from '@/lib/db';+import { useAuth } from './auth';++/**+ * 设置抽屉:数据源管理 + 播放/过滤选项 + 配置导入导出。+ * 替代旧版散落在设置面板里的各处 DOM 拼接逻辑。+ */++export function SourceManagerDrawer({ open, onClose }: { open: boolean; onClose: () => void }) {+ const store = useAppStore();+ const [editing, setEditing] = useState<string | null>(null);++ return (+ <Drawer open={open} onClose={onClose} title="设置">+ <section className="mb-6">+ <SectionTitle+ title="数据源"+ extra={+ <button className="btn-primary !py-1 !px-2.5 text-xs" onClick={() => setEditing('__new__')}>+ + 添加 API+ </button>+ }+ />+ <SourceForm+ visible={editing === '__new__'}+ onCancel={() => setEditing(null)}+ onSubmit={(data) => {+ store.addCustomApi(data);+ setEditing(null);+ }}+ />+ {store.customAPIs.length === 0 && editing !== '__new__' ? (+ <EmptySourceGuide onAdd={() => setEditing('__new__')} />+ ) : (+ <ul className="space-y-2">+ {store.customAPIs.map((api) => (+ <li key={api.key} className="bg-[#1e1e1e] rounded-lg p-3">+ {editing === api.key ? (+ <SourceForm+ visible+ initial={api}+ onCancel={() => setEditing(null)}+ onSubmit={(data) => {+ store.updateCustomApi(api.key, data);+ setEditing(null);+ }}+ />+ ) : (+ <div className="flex items-center gap-2">+ <input+ type="checkbox"+ className="h-4 w-4 accent-[#23ade5]"+ checked={store.selectedKeys.includes(api.key)}+ onChange={() => store.toggleSourceSelected(api.key)}+ aria-label={`选择 ${api.name}`}+ />+ <div className="flex-1 min-w-0">+ <div className="text-sm font-medium text-white truncate">+ {api.name}+ {api.isAdult && <span className="text-pink-400 text-xs ml-1">(18+)</span>}+ </div>+ <div className="text-xs text-gray-500 truncate">{api.url}</div>+ </div>+ <button+ className="text-gray-400 hover:text-accent text-xs px-1.5"+ onClick={() => setEditing(api.key)}+ aria-label="编辑"+ >+ ✎+ </button>+ <button+ className="text-gray-400 hover:text-red-400 text-xs px-1.5"+ onClick={() => store.removeCustomApi(api.key)}+ aria-label="删除"+ >+ ✕+ </button>+ </div>+ )}+ </li>+ ))}+ </ul>+ )}+ </section>++ <section className="mb-6">+ <SectionTitle title="播放与过滤" />+ <div className="space-y-3">+ <ToggleRow+ label="成人内容过滤"+ description="过滤“伦理片”等分类的结果"+ checked={store.yellowFilter}+ onChange={(v) => store.updateSettings({ yellowFilter: v })}+ />+ <ToggleRow+ label="广告过滤"+ description="过滤 m3u8 中的广告分片"+ checked={store.adFilter}+ onChange={(v) => store.updateSettings({ adFilter: v })}+ />+ <ToggleRow+ label="自动连播"+ description="单集播放结束后自动播放下一集"+ checked={store.autoplayNext}+ onChange={(v) => store.updateSettings({ autoplayNext: v })}+ />+ <ToggleRow+ label="豆瓣推荐"+ description="在首页展示豆瓣热门影视"+ checked={store.doubanEnabled}+ onChange={(v) => store.updateSettings({ doubanEnabled: v })}+ />+ </div>+ </section>++ <section className="mb-6">+ <SectionTitle title="封面图加载" />+ <div className="space-y-2">+ <SelectRow+ label="加载方式"+ value={store.imageProxyMode}+ onChange={(v) => store.updateSettings({ imageProxyMode: v as 'direct' | 'proxy' | 'custom' })}+ options={[+ { value: 'direct', label: '直连(默认)' },+ { value: 'proxy', label: '内置代理' },+ { value: 'custom', label: '自定义代理' },+ ]}+ />+ {store.imageProxyMode === 'custom' && (+ <input+ className="input w-full"+ placeholder="代理模板,如 https://p.example.com/?url={url}"+ value={store.customImageProxy}+ onChange={(e) => store.updateSettings({ customImageProxy: e.target.value })}+ />+ )}+ <p className="text-xs text-gray-500">豆瓣封面在某些网络下直连会被拒绝,可切换为内置代理。</p>+ </div>+ </section>++ <section>+ <SectionTitle title="配置" />+ <ConfigIoButtons />+ </section>+ </Drawer>+ );+}++function SectionTitle({ title, extra }: { title: string; extra?: React.ReactNode }) {+ return (+ <div className="flex items-center justify-between mb-2.5">+ <h3 className="text-sm font-semibold text-gray-300">{title}</h3>+ {extra}+ </div>+ );+}++function EmptySourceGuide({ onAdd }: { onAdd: () => void }) {+ return (+ <div className="border border-dashed border-[#3a3a3a] rounded-lg p-5 text-center">+ <p className="text-sm text-gray-400 mb-1">还没有添加任何数据源</p>+ <p className="text-xs text-gray-500 mb-3">添加一个 Apple CMS 采集站 API 即可开始搜索影片</p>+ <button className="btn-primary text-xs" onClick={onAdd}>+ 添加第一个数据源+ </button>+ </div>+ );+}++function SourceForm({+ visible,+ initial,+ onCancel,+ onSubmit,+}: {+ visible: boolean;+ initial?: { key: string; name: string; url: string; detail?: string; isAdult?: boolean };+ onCancel: () => void;+ onSubmit: (data: { name: string; url: string; detail?: string; isAdult?: boolean }) => void;+}) {+ const [name, setName] = useState(initial?.name ?? '');+ const [url, setUrl] = useState(initial?.url ?? '');+ const [detail, setDetail] = useState(initial?.detail ?? '');+ const [isAdult, setIsAdult] = useState(initial?.isAdult ?? false);+ const { toast } = useToast();++ useEffect(() => {+ if (visible) {+ setName(initial?.name ?? '');+ setUrl(initial?.url ?? '');+ setDetail(initial?.detail ?? '');+ setIsAdult(initial?.isAdult ?? false);+ }+ }, [visible, initial]);++ if (!visible) return null;++ const submit = () => {+ const n = name.trim();+ const u = url.trim().replace(/\/+$/, '');+ if (!n || !u) {+ toast('请输入 API 名称和链接', 'warning');+ return;+ }+ if (!validateSourceUrl(u)) {+ toast('API 链接需以 http:// 或 https:// 开头', 'warning');+ return;+ }+ onSubmit({ name: n, url: u, detail: detail.trim() || undefined, isAdult });+ };++ return (+ <div className="space-y-2 border border-[#3a3a3a] rounded-lg p-3 bg-[#1a1a1a]">+ <input className="input w-full" placeholder="名称" value={name} onChange={(e) => setName(e.target.value)} />+ <input+ className="input w-full"+ placeholder="API 地址,如 https://example.com/api.php/provide/vod"+ value={url}+ onChange={(e) => setUrl(e.target.value)}+ />+ <input+ className="input w-full"+ placeholder="详情页地址(可选),如 https://example.com"+ value={detail}+ onChange={(e) => setDetail(e.target.value)}+ />+ <label className="flex items-center gap-2 text-xs text-gray-400">+ <input type="checkbox" className="h-3.5 w-3.5 accent-pink-500" checked={isAdult} onChange={(e) => setIsAdult(e.target.checked)} />+ 标记为成人内容源(受成人过滤控制)+ </label>+ <div className="flex gap-2 justify-end">+ <button className="btn-ghost !py-1 text-xs" onClick={onCancel}>+ 取消+ </button>+ <button className="btn-primary !py-1 text-xs" onClick={submit}>+ {initial ? '更新' : '添加'}+ </button>+ </div>+ </div>+ );+}++function ToggleRow({+ label,+ description,+ checked,+ onChange,+}: {+ label: string;+ description: string;+ checked: boolean;+ onChange: (v: boolean) => void;+}) {+ return (+ <div className="flex items-center justify-between gap-4">+ <div>+ <div className="text-sm text-white">{label}</div>+ <div className="text-xs text-gray-500">{description}</div>+ </div>+ <button+ role="switch"+ aria-checked={checked}+ aria-label={label}+ className={cn(+ 'relative h-6 w-11 rounded-full transition-colors shrink-0',+ checked ? 'bg-accent' : 'bg-[#3a3a3a]'+ )}+ onClick={() => onChange(!checked)}+ >+ <span+ className={cn(+ 'absolute top-0.5 h-5 w-5 rounded-full bg-white transition-transform',+ checked ? 'translate-x-[22px]' : 'translate-x-0.5'+ )}+ />+ </button>+ </div>+ );+}++function SelectRow({+ label,+ value,+ onChange,+ options,+}: {+ label: string;+ value: string;+ onChange: (v: string) => void;+ options: { value: string; label: string }[];+}) {+ return (+ <div className="flex items-center justify-between gap-4">+ <span className="text-sm text-white">{label}</span>+ <select+ className="input !py-1.5 !px-2 text-xs"+ value={value}+ onChange={(e) => onChange(e.target.value)}+ aria-label={label}+ >+ {options.map((o) => (+ <option key={o.value} value={o.value}>+ {o.label}+ </option>+ ))}+ </select>+ </div>+ );+}++function ConfigIoButtons() {+ const { toast } = useToast();+ const { verified, openLogin } = useAuth();++ const doExport = async () => {+ if (verified === false) {+ openLogin();+ return;+ }+ try {+ const json = await exportConfig();+ const blob = new Blob([json], { type: 'application/json' });+ const url = URL.createObjectURL(blob);+ const a = document.createElement('a');+ a.href = url;+ a.download = `LibreTV-Settings_${Date.now()}.json`;+ a.click();+ URL.revokeObjectURL(url);+ toast('配置已导出', 'success');+ } catch {+ toast('导出失败', 'error');+ }+ };++ const doImport = async (file: File) => {+ try {+ const content = await file.text();+ await importConfig(content);+ toast('配置导入成功,即将刷新页面', 'success');+ setTimeout(() => window.location.reload(), 1500);+ } catch (err) {+ toast(err instanceof Error ? err.message : '导入失败', 'error');+ }+ };++ return (+ <div className="flex gap-2">+ <button className="btn-ghost flex-1 text-xs" onClick={doExport}>+ 导出配置+ </button>+ <label className="btn-ghost flex-1 text-xs cursor-pointer">+ 导入配置+ <input+ type="file"+ accept=".json,application/json"+ className="hidden"+ onChange={(e) => {+ const f = e.target.files?.[0];+ if (f) doImport(f);+ e.target.value = '';+ }}+ />+ </label>+ </div>+ );+}diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/6c3ef330762d14573273534ef2c143548a0a2735a3e816e55bf186167ec75d1f.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/6c3ef330762d14573273534ef2c143548a0a2735a3e816e55bf186167ec75d1f.sourcenew file mode 100644index 0000000..4efb895--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/6c3ef330762d14573273534ef2c143548a0a2735a3e816e55bf186167ec75d1f.source@@ -0,0 +1,235 @@+'use client';++import { useEffect, useRef, useState } from 'react';+import { useRouter } from 'next/navigation';+import { api } from '@/lib/client-api';+import type { SearchResultItem, VideoDetail } from '@/lib/types';+import { buildImageUrl, buildWatchUrl } from '@/lib/utils';+import { useAppStore, resolveSource } from '@/lib/store';+import { useToast } from './toast';+import { cn } from '@/lib/utils';+import { addSearchHistory } from '@/lib/db';++/**+ * 详情弹窗:剧集列表 + 排序 + 复制链接。+ * 剧集点击 → /watch 路由(URL 携带定位参数,可分享、可后退)。+ */++export function DetailModal({ item, onClose }: { item: SearchResultItem | null; onClose: () => void }) {+ const store = useAppStore();+ const router = useRouter();+ const { toast } = useToast();+ const [detail, setDetail] = useState<VideoDetail | null>(null);+ const [loading, setLoading] = useState(false);+ const [error, setError] = useState('');+ const [reversed, setReversed] = useState(false);+ const [posterFailed, setPosterFailed] = useState(false);+ const abortRef = useRef<AbortController | null>(null);+ const poster = buildImageUrl(item?.pic, store.imageProxyMode, store.customImageProxy);++ useEffect(() => setPosterFailed(false), [poster]);++ // 弹窗打开期间锁定背景滚动+ useEffect(() => {+ if (!item) return;+ const prev = document.body.style.overflow;+ document.body.style.overflow = 'hidden';+ return () => {+ document.body.style.overflow = prev;+ };+ }, [item]);++ useEffect(() => {+ if (!item) {+ setDetail(null);+ setError('');+ return;+ }+ const source = resolveSource(store, item.sourceKey, {+ url: item.sourceUrl,+ name: item.sourceName,+ });+ if (!source) {+ setError('数据源配置不存在(可能已被删除),请在设置中重新添加');+ return;+ }+ setLoading(true);+ setError('');+ abortRef.current?.abort();+ const controller = new AbortController();+ abortRef.current = controller;+ api+ .detail(item.vodId, source, controller.signal)+ .then((d) => setDetail(d))+ .catch((err) => {+ if (err instanceof DOMException && err.name === 'AbortError') return;+ setError(err instanceof Error ? err.message : '获取详情失败');+ })+ .finally(() => setLoading(false));+ return () => controller.abort();+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [item]);++ useEffect(() => {+ if (!item) return;+ const handler = (e: KeyboardEvent) => {+ if (e.key === 'Escape') onClose();+ };+ window.addEventListener('keydown', handler);+ return () => window.removeEventListener('keydown', handler);+ }, [item, onClose]);++ if (!item) return null;++ const episodes = detail ? (reversed ? [...detail.episodes].reverse() : detail.episodes) : [];+ const info = detail?.videoInfo;++ const play = (index: number) => {+ if (!detail || !detail.episodes[index]) return;+ addSearchHistory(item.name).catch(() => {});+ router.push(+ buildWatchUrl({+ sourceKey: item.sourceKey,+ vodId: item.vodId,+ index,+ title: item.name,+ sourceUrl: item.sourceUrl,+ })+ );+ };++ const copyLinks = async () => {+ if (!detail) return;+ try {+ await navigator.clipboard.writeText(detail.episodes.join('\n'));+ toast('播放链接已复制', 'success');+ } catch {+ toast('复制失败,请检查浏览器权限', 'error');+ }+ };++ const metaRows = [+ info?.typeName && ['类型', info.typeName],+ info?.year && ['年份', info.year],+ info?.area && ['地区', info.area],+ info?.director && ['导演', info.director],+ info?.actor && ['主演', info.actor],+ info?.remarks && ['备注', info.remarks],+ ].filter(Boolean) as [string, string][];++ return (+ <div+ className="fixed inset-0 z-[60] flex items-start justify-center overflow-y-auto bg-black/80 py-10 px-4 animate-fade-in"+ onClick={(e) => {+ if (e.target === e.currentTarget) onClose();+ }}+ >+ <div className="bg-surface-raised rounded-xl w-full max-w-3xl shadow-2xl animate-slide-up" role="dialog" aria-modal>+ <div className="flex items-start justify-between gap-4 p-5 pb-3 border-b border-[#2a2a2a]">+ <div className="min-w-0">+ <h2 className="text-lg font-semibold text-white break-words">{item.name}</h2>+ <span className="text-sm text-gray-500">{item.sourceName}</span>+ </div>+ <button+ className="p-1.5 rounded-md text-gray-400 hover:text-white hover:bg-surface-hover shrink-0"+ onClick={onClose}+ aria-label="关闭"+ >+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />+ </svg>+ </button>+ </div>++ <div className="p-5 pt-4">+ {loading && (+ <div className="flex flex-col items-center py-10 gap-3">+ <div className="h-8 w-8 rounded-full border-4 border-[#3a3a3a] border-t-accent animate-spin" />+ <p className="text-sm text-gray-400">正在获取剧集信息...</p>+ </div>+ )}++ {!loading && error && (+ <div className="text-center py-8">+ <div className="text-red-400 mb-1.5">❌ 获取失败</div>+ <div className="text-sm text-gray-500">{error}</div>+ </div>+ )}++ {!loading && !error && detail && (+ <>+ <div className="flex flex-col sm:flex-row gap-4 mb-4">+ {poster && !posterFailed && (+ // eslint-disable-next-line @next/next/no-img-element+ <img+ src={poster}+ alt={item.name}+ className="w-24 sm:w-32 aspect-[2/3] object-cover rounded-lg bg-[#222] shrink-0 self-center sm:self-start"+ onError={() => setPosterFailed(true)}+ />+ )}+ <div className="min-w-0 space-y-3">+ {metaRows.length > 0 && (+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-1.5 text-sm">+ {metaRows.map(([k, v]) => (+ <div key={k} className="truncate">+ <span className="text-gray-500">{k}:</span>{' '}+ <span className="text-gray-300">{v}</span>+ </div>+ ))}+ </div>+ )}+ {info?.desc && (+ <p className="text-sm text-gray-400 leading-relaxed line-clamp-3">{info.desc}</p>+ )}+ </div>+ </div>++ {episodes.length > 0 ? (+ <>+ <div className="flex flex-wrap items-center justify-between gap-2 mb-3">+ <div className="flex items-center gap-2">+ <button+ className="btn-ghost !py-1.5 text-xs"+ onClick={() => setReversed((v) => !v)}+ aria-label={reversed ? '切换为正序' : '切换为倒序'}+ >+ <svg className={cn('w-3.5 h-3.5 transition-transform', reversed && 'rotate-180')} fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 14l-7 7m0 0l-7-7m7 7V3" />+ </svg>+ {reversed ? '正序排列' : '倒序排列'}+ </button>+ <span className="text-sm text-gray-500">共 {episodes.length} 集</span>+ </div>+ <button className="btn-primary !py-1.5 text-xs" onClick={copyLinks}>+ 复制链接+ </button>+ </div>+ <div className="grid grid-cols-3 sm:grid-cols-5 md:grid-cols-7 gap-2 max-h-[40vh] overflow-y-auto scrollbar-thin pr-1">+ {episodes.map((_, i) => {+ const realIndex = reversed ? detail.episodes.length - 1 - i : i;+ return (+ <button+ key={realIndex}+ className="btn-ghost !px-1 text-center"+ onClick={() => play(realIndex)}+ >+ {realIndex + 1}+ </button>+ );+ })}+ </div>+ </>+ ) : (+ <div className="text-center py-8">+ <div className="text-red-400 mb-1.5">❌ 未找到播放资源</div>+ <div className="text-sm text-gray-500">该视频可能暂时无法播放,请尝试其他视频</div>+ </div>+ )}+ </>+ )}+ </div>+ </div>+ </div>+ );+}diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/6efdf509a785a0658b2e31a8c33d298de14321d9672179370e99cc76241c1eb0.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/6efdf509a785a0658b2e31a8c33d298de14321d9672179370e99cc76241c1eb0.sourcenew file mode 100644index 0000000..51a94ec--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/6efdf509a785a0658b2e31a8c33d298de14321d9672179370e99cc76241c1eb0.source@@ -0,0 +1,269 @@+'use client';++import { Suspense, useEffect, useMemo, useRef, useState } from 'react';+import { useRouter, useSearchParams } from 'next/navigation';+import { useQuery } from '@tanstack/react-query';+import { Header } from '@/components/header';+import { DoubanSection } from '@/components/douban-section';+import { DetailModal } from '@/components/detail-modal';+import { VideoCard } from '@/components/video-card';+import { useAppStore, resolveSource } from '@/lib/store';+import { api } from '@/lib/client-api';+import type { SearchResultItem } from '@/lib/types';+import { addSearchHistory, db, removeSearchHistory } from '@/lib/db';+import { cn, validateSourceUrl } from '@/lib/utils';+import { useToast } from '@/components/toast';++/**+ * 首页:搜索(URL ?s= 驱动,可后退/分享)+ 豆瓣推荐。+ * 搜索状态由 React Query 管理,失败源在结果区顶部以非阻塞方式展示。+ */+export default function HomePage() {+ return (+ <Suspense>+ <HomeContent />+ </Suspense>+ );+}++function HomeContent() {+ const searchParams = useSearchParams();+ const router = useRouter();+ const { toast } = useToast();+ const urlQuery = searchParams.get('s') || '';+ const store = useAppStore();+ const [input, setInput] = useState(urlQuery);+ const [detailItem, setDetailItem] = useState<SearchResultItem | null>(null);+ const inputRef = useRef<HTMLInputElement>(null);++ // URL 驱动搜索:?s= 变化时回填输入框+ useEffect(() => {+ if (urlQuery) setInput(urlQuery);+ }, [urlQuery]);++ const selectedSources = useMemo(+ () =>+ store.selectedKeys+ .map((key) => resolveSource(store, key))+ .filter((s): s is NonNullable<typeof s> => Boolean(s) && validateSourceUrl(s!.url)),+ [store]+ );++ const searchQuery = useQuery({+ queryKey: ['search', urlQuery, store.selectedKeys, store.yellowFilter],+ queryFn: ({ signal }) => api.search(urlQuery, selectedSources, store.yellowFilter, signal),+ enabled: Boolean(urlQuery) && selectedSources.length > 0,+ staleTime: 60_000,+ });++ const searchHistory = useQuery({+ queryKey: ['searchHistory'],+ queryFn: () => db.searchHistory.orderBy('timestamp').reverse().limit(10).toArray(),+ });++ const runSearch = (q: string) => {+ const query = q.trim().slice(0, 100);+ if (!query) {+ toast('请输入搜索内容', 'info');+ inputRef.current?.focus();+ return;+ }+ if (selectedSources.length === 0) {+ toast('请先在设置中添加并勾选数据源', 'warning');+ return;+ }+ router.push(`/?s=${encodeURIComponent(query)}`, { scroll: false });+ addSearchHistory(query).catch(() => {});+ };++ const list = searchQuery.data?.list ?? [];+ const failures = searchQuery.data?.failures ?? [];+ // 失败源显示友好名称而非裸 key+ const failureNames = failures.map(+ (f) => store.customAPIs.find((a) => a.key === f.sourceKey)?.name ?? f.sourceKey+ );++ return (+ <div className="min-h-screen flex flex-col">+ <Header />++ <main className="relative flex-1 max-w-6xl w-full mx-auto px-4 py-6">+ {/* 首屏氛围渐变 */}+ {!urlQuery && (+ <div+ aria-hidden+ className="pointer-events-none absolute inset-x-0 top-0 h-[420px] -z-10"+ style={{+ background:+ 'radial-gradient(60% 60% at 50% 0%, rgba(35,173,229,0.10) 0%, rgba(35,173,229,0.03) 45%, transparent 75%)',+ }}+ />+ )}++ {/* 搜索区 */}+ <section className={cn('flex flex-col items-center', urlQuery ? 'mb-6' : 'mt-10 mb-14')}>+ {!urlQuery && (+ <header className="text-center mb-6">+ <h1 className="text-2xl sm:text-3xl font-bold text-white">免费在线视频搜索</h1>+ <p className="mt-2 text-sm text-gray-500">多源聚合 · 免注册 · 无广告 · 播放进度本机保存</p>+ </header>+ )}+ {urlQuery && <h1 className="sr-only">LibreTV 视频搜索</h1>}+ <form+ className="w-full max-w-2xl flex gap-2"+ onSubmit={(e) => {+ e.preventDefault();+ runSearch(input);+ }}+ >+ <div className="relative flex-1">+ <input+ ref={inputRef}+ className="input w-full h-11 pr-10"+ placeholder="输入影片名称..."+ value={input}+ maxLength={100}+ onChange={(e) => setInput(e.target.value)}+ aria-label="搜索影片"+ />+ {input && (+ <button+ type="button"+ className="absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white"+ onClick={() => {+ setInput('');+ inputRef.current?.focus();+ }}+ aria-label="清空"+ >+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />+ </svg>+ </button>+ )}+ </div>+ <button type="submit" className="btn-primary h-11 px-5">+ 搜索+ </button>+ </form>++ {/* 最近搜索 */}+ {(searchHistory.data?.length ?? 0) > 0 && (+ <div className="flex flex-wrap items-center gap-1.5 mt-3 justify-center">+ <span className="text-xs text-gray-500">最近搜索:</span>+ {searchHistory.data!.map((h) => (+ <span key={h.text} className="inline-flex items-center bg-[#1e1e1e] rounded-full text-xs">+ <button+ className="pl-2.5 pr-1 py-1 text-gray-300 hover:text-accent"+ onClick={() => {+ setInput(h.text);+ runSearch(h.text);+ }}+ >+ {h.text}+ </button>+ <button+ className="pr-2 py-1 text-gray-600 hover:text-red-400"+ aria-label={`删除搜索记录 ${h.text}`}+ onClick={() => removeSearchHistory(h.text).then(() => searchHistory.refetch())}+ >+ ✕+ </button>+ </span>+ ))}+ </div>+ )}+ </section>++ {/* 搜索结果 */}+ {urlQuery && (+ <section aria-label="搜索结果" className="mb-10">+ <div className="flex items-center justify-between mb-3">+ <h2 className="text-sm text-gray-400">+ “<span className="text-white">{urlQuery}</span>” 的搜索结果+ {searchQuery.data && (+ <span className="text-gray-500">({list.length} 条{failures.length > 0 && `,${failures.length} 个源失败`})</span>+ )}+ </h2>+ </div>++ {failures.length > 0 && (+ <div className="mb-3 text-xs text-gray-500 bg-[#1a1a1a] rounded-lg px-3 py-2">+ 部分数据源请求失败:{failureNames.join('、')}+ </div>+ )}++ {searchQuery.isLoading ? (+ <ResultsSkeleton />+ ) : selectedSources.length === 0 ? (+ <NoSourceGuide hasSources={store.customAPIs.length > 0} />+ ) : list.length === 0 ? (+ <div className="text-center py-16">+ <svg className="mx-auto h-10 w-10 text-gray-600 mb-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5}+ d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />+ </svg>+ <h3 className="text-base text-gray-400">没有找到匹配的结果</h3>+ <p className="text-sm text-gray-500 mt-1">请尝试其他关键词或更换数据源</p>+ </div>+ ) : (+ <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3">+ {list.map((item) => (+ <VideoCard key={`${item.sourceKey}_${item.vodId}`} item={item} onClick={() => setDetailItem(item)} />+ ))}+ </div>+ )}+ </section>+ )}++ {/* 豆瓣推荐(有搜索时隐藏) */}+ {!urlQuery && (+ <DoubanSection+ onPick={(title) => {+ setInput(title);+ runSearch(title);+ }}+ />+ )}+ </main>++ <footer className="border-t border-[#2a2a2a] py-4">+ <p className="text-center text-xs text-gray-600">+ LibreTV v2.0 · 数据来源为第三方公开接口,本站不存储任何视频文件+ </p>+ </footer>++ <DetailModal item={detailItem} onClose={() => setDetailItem(null)} />+ </div>+ );+}++function ResultsSkeleton() {+ return (+ <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3">+ {Array.from({ length: 6 }).map((_, i) => (+ <div key={i} className="card h-28 animate-pulse bg-surface-card" />+ ))}+ </div>+ );+}++/** 无数据源 / 未勾选数据源时的引导(替代旧版首屏静默空白) */+function NoSourceGuide({ hasSources = false }: { hasSources?: boolean }) {+ return (+ <div className="border border-dashed border-[#3a3a3a] rounded-xl p-10 text-center max-w-lg mx-auto">+ <h3 className="text-white font-medium mb-2">{hasSources ? '尚未勾选数据源' : '先添加一个数据源'}</h3>+ <p className="text-sm text-gray-400 leading-relaxed">+ {hasSources ? (+ <>点击右上角「设置」,勾选要参与搜索的数据源后重新搜索。</>+ ) : (+ <>+ LibreTV 不内置任何采集站。点击右上角「设置 → 添加 API」,填入一个+ Apple CMS 采集站地址(如 <code className="text-accent text-xs">https://example.com/api.php/provide/vod</code>),+ 勾选后即可开始搜索。+ </>+ )}+ </p>+ </div>+ );+}diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/91d91840c4d075907471114c7df24ba3d14f64a0347e7608d714ba0057d53f1c.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/91d91840c4d075907471114c7df24ba3d14f64a0347e7608d714ba0057d53f1c.sourcenew file mode 100644index 0000000..ba20c57--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/91d91840c4d075907471114c7df24ba3d14f64a0347e7608d714ba0057d53f1c.source@@ -0,0 +1,203 @@+'use client';++import { useEffect, useMemo, useState } from 'react';+import { useRouter } from 'next/navigation';+import { api } from '@/lib/client-api';+import type { SourceConfig, SearchResultItem, VideoDetail } from '@/lib/types';+import { buildImageUrl, buildWatchUrl, cn } from '@/lib/utils';+import { useAppStore, resolveSource } from '@/lib/store';+import { useToast } from './toast';++/**+ * 换源面板:跨源按标题搜索 → 匹配同名资源 → 并发测速(详情接口耗时)→ 按速度排序展示。+ * 切换时保留当前集数索引(旧版 switchToResource 逻辑的去 DOM 化重写)。+ */++interface Candidate {+ source: SourceConfig;+ result: SearchResultItem;+ ms?: number;+ ok?: boolean;+ episodes?: number;+}++export function SwitchSourceModal({+ currentTitle,+ currentSourceKey,+ currentVodId,+ currentIndex,+ onClose,+}: {+ currentTitle: string;+ currentSourceKey: string;+ currentVodId: string;+ currentIndex: number;+ onClose: () => void;+}) {+ const store = useAppStore();+ const router = useRouter();+ const { toast } = useToast();+ const [candidates, setCandidates] = useState<Candidate[]>([]);+ const [phase, setPhase] = useState<'searching' | 'testing' | 'done'>('searching');++ const sources = useMemo(+ () => store.selectedKeys.map((key) => resolveSource(store, key)).filter(Boolean) as SourceConfig[],+ [store]+ );++ useEffect(() => {+ // 弹窗打开期间锁定背景滚动+ const prev = document.body.style.overflow;+ document.body.style.overflow = 'hidden';+ return () => {+ document.body.style.overflow = prev;+ };+ }, []);++ useEffect(() => {+ let cancelled = false;++ (async () => {+ // 1) 并行搜索所有选中源+ setPhase('searching');+ try {+ const { list } = await api.search(currentTitle, sources, false);+ if (cancelled) return;++ // 每个源取完全同名结果,否则取第一个+ const matched: Candidate[] = [];+ for (const s of sources) {+ const hits = list.filter((r) => r.sourceKey === s.key);+ const exact = hits.find((r) => r.name === currentTitle) || hits[0];+ if (exact) matched.push({ source: s, result: exact });+ }++ // 2) 并发测速(详情接口耗时)并获取集数+ setPhase('testing');+ await Promise.all(+ matched.map(async (c) => {+ const r = await api.detailSpeed(c.result.vodId, c.source);+ if (cancelled) return;+ c.ok = r.ok;+ c.ms = r.ms;+ c.episodes = r.detail?.episodes.length ?? 0;+ })+ );+ if (cancelled) return;+ setCandidates(matched);+ setPhase('done');+ } catch (err) {+ if (!cancelled) {+ toast(err instanceof Error ? err.message : '换源搜索失败', 'error');+ setPhase('done');+ }+ }+ })();++ return () => {+ cancelled = true;+ };+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [currentTitle]);++ const sorted = [...candidates].sort((a, b) => {+ const aCurrent = a.source.key === currentSourceKey && String(a.result.vodId) === String(currentVodId);+ const bCurrent = b.source.key === currentSourceKey && String(b.result.vodId) === String(currentVodId);+ if (aCurrent !== bCurrent) return aCurrent ? -1 : 1;+ const msA = a.ok ? a.ms ?? 99_999 : 99_999;+ const msB = b.ok ? b.ms ?? 99_999 : 99_999;+ return msA - msB;+ });++ const switchTo = (c: Candidate) => {+ if (!c.episodes) {+ toast('该源无可用播放资源', 'warning');+ return;+ }+ const targetIndex = currentIndex < c.episodes ? currentIndex : 0;+ onClose(); // 先关闭面板,避免路由参数变化后弹窗残留旧数据+ router.push(+ buildWatchUrl({+ sourceKey: c.source.key,+ vodId: c.result.vodId,+ index: targetIndex,+ title: c.result.name || currentTitle,+ sourceUrl: c.source.url,+ detail: c.source.detail,+ })+ );+ };++ return (+ <div+ className="fixed inset-0 z-[65] flex items-start justify-center overflow-y-auto bg-black/80 py-10 px-4 animate-fade-in"+ onClick={(e) => {+ if (e.target === e.currentTarget) onClose();+ }}+ >+ <div className="bg-surface-raised rounded-xl w-full max-w-3xl shadow-2xl p-5 animate-slide-up" role="dialog" aria-modal>+ <div className="flex items-center justify-between mb-4">+ <div className="min-w-0">+ <h2 className="text-lg font-semibold text-white truncate">{currentTitle}</h2>+ <p className="text-xs text-gray-500">+ {phase === 'searching' ? '正在搜索各资源...' : phase === 'testing' ? '正在测试各资源速率...' : `共 ${sorted.length} 个可用资源`}+ </p>+ </div>+ <button className="p-1.5 rounded-md text-gray-400 hover:text-white hover:bg-surface-hover" onClick={onClose} aria-label="关闭">+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />+ </svg>+ </button>+ </div>++ {phase !== 'done' ? (+ <div className="flex flex-col items-center py-10 gap-3">+ <div className="h-8 w-8 rounded-full border-4 border-[#3a3a3a] border-t-accent animate-spin" />+ <p className="text-sm text-gray-400">{phase === 'searching' ? '搜索各资源中...' : '测速中...'}</p>+ </div>+ ) : sorted.length === 0 ? (+ <p className="text-center text-sm text-gray-500 py-8">其他数据源未找到同名资源</p>+ ) : (+ <div className="grid grid-cols-2 sm:grid-cols-4 gap-3">+ {sorted.map((c) => {+ const isCurrent = c.source.key === currentSourceKey && String(c.result.vodId) === String(currentVodId);+ const img = buildImageUrl(c.result.pic, store.imageProxyMode, store.customImageProxy);+ return (+ <button+ key={c.source.key}+ className={cn('text-left group relative rounded-lg overflow-hidden bg-[#1e1e1e] transition-transform', !isCurrent && 'hover:scale-[1.03] cursor-pointer', isCurrent && 'cursor-default')}+ onClick={() => !isCurrent && switchTo(c)}+ disabled={isCurrent}+ >+ <div className="relative aspect-[2/3] bg-[#222]">+ {img ? (+ // eslint-disable-next-line @next/next/no-img-element+ <img src={img} alt={c.result.name} className="w-full h-full object-cover" loading="lazy" />+ ) : (+ <div className="w-full h-full flex items-center justify-center text-gray-600 text-xs">无封面</div>+ )}+ <span+ className={cn(+ 'absolute top-1.5 right-1.5 tag',+ !c.ok ? 'bg-red-500/80 text-white' : c.ms! > 2000 ? 'bg-yellow-600/80 text-white' : 'bg-green-600/80 text-white'+ )}+ >+ {!c.ok ? '失败' : `${c.ms}ms`}+ </span>+ {isCurrent && (+ <span className="absolute inset-x-0 bottom-0 bg-accent/90 text-white text-xs text-center py-1">当前播放</span>+ )}+ </div>+ <div className="p-2">+ <div className="text-xs font-medium text-gray-200 truncate">{c.source.name}</div>+ <div className="text-[10px] text-gray-500 mt-0.5">{c.episodes ? `${c.episodes} 集` : '无资源'}</div>+ </div>+ </button>+ );+ })}+ </div>+ )}+ </div>+ </div>+ );+}diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/b43fdff72d3f4851a308a7e25bfb25e5089cdff996639f04a08c39caae434cbd.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/b43fdff72d3f4851a308a7e25bfb25e5089cdff996639f04a08c39caae434cbd.sourcenew file mode 100644index 0000000..fce2c20--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/b43fdff72d3f4851a308a7e25bfb25e5089cdff996639f04a08c39caae434cbd.source@@ -0,0 +1,128 @@+'use client';++import { useState } from 'react';+import { useLiveQuery } from 'dexie-react-hooks';+import Link from 'next/link';+import { Drawer } from './header';+import { db, clearAllHistory, removeHistory, upsertHistory, type HistoryEntry } from '@/lib/db';+import { buildWatchUrl, buildImageUrl, cn, formatRelativeTime, formatTime } from '@/lib/utils';+import { useToast } from './toast';+import { resolveSource, useAppStore } from '@/lib/store';++/**+ * 观看历史面板(IndexedDB 实时查询)。+ * 与旧版的区别:播放前按需重新拉取剧集详情,不再依赖历史记录里冗余存储的全集 URL。+ */++export function HistoryPanel({ open, onClose }: { open: boolean; onClose: () => void }) {+ const history = useLiveQuery(() => db.history.orderBy('timestamp').reverse().limit(50).toArray(), [open]);+ const { toast } = useToast();++ return (+ <Drawer open={open} onClose={onClose} title="观看历史" width="max-w-lg">+ {!history ? (+ <p className="text-center text-gray-500 py-8 text-sm">加载中...</p>+ ) : history.length === 0 ? (+ <p className="text-center text-gray-500 py-8 text-sm">暂无观看记录</p>+ ) : (+ <>+ <div className="flex justify-end mb-2">+ <button+ className="text-xs text-gray-500 hover:text-red-400 transition-colors"+ onClick={() => {+ clearAllHistory().then(() => toast('观看历史已清空', 'success'));+ }}+ >+ 清空历史+ </button>+ </div>+ <ul className="space-y-2">+ {history.map((item) => (+ <HistoryItem key={`${item.sourceKey}_${item.vodId}`} item={item} />+ ))}+ </ul>+ </>+ )}+ </Drawer>+ );+}++function HistoryItem({ item }: { item: HistoryEntry }) {+ const store = useAppStore();+ const { toast } = useToast();+ const [imgFailed, setImgFailed] = useState(false);+ const pic = buildImageUrl(item.pic, store.imageProxyMode, store.customImageProxy);++ const hasPercent =+ item.playbackPosition > 10 && item.duration > 0 && item.playbackPosition < item.duration * 0.95;+ const percent = hasPercent ? Math.round((item.playbackPosition / item.duration) * 100) : 0;++ const href = buildWatchUrl({+ sourceKey: item.sourceKey,+ vodId: item.vodId,+ index: item.episodeIndex,+ title: item.title,+ sourceUrl: resolveSource(store, item.sourceKey)?.url,+ detail: resolveSource(store, item.sourceKey)?.detail,+ });++ return (+ <li className="relative group">+ <Link+ href={href}+ onClick={(e) => {+ // 点击即同步一次时间戳,置顶最近观看+ upsertHistory({ ...item, timestamp: Date.now() }).catch(() => {});+ }}+ className="block bg-[#1e1e1e] hover:bg-surface-hover rounded-lg p-3 pr-10 transition-colors"+ >+ <div className="flex items-center gap-3">+ {pic && !imgFailed ? (+ // eslint-disable-next-line @next/next/no-img-element+ <img+ src={pic}+ alt=""+ className="w-10 h-14 object-cover rounded bg-[#222]"+ loading="lazy"+ onError={() => setImgFailed(true)}+ />+ ) : (+ <div className="w-10 h-14 rounded bg-[#262626] flex items-center justify-center shrink-0">+ <svg className="w-4 h-4 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M7 4v16m10-16v16M7 8h10M7 12h10" />+ </svg>+ </div>+ )}+ <div className="min-w-0 flex-1">+ <div className="text-sm font-medium text-white truncate">{item.title}</div>+ <div className="text-xs text-gray-500 mt-0.5 flex items-center gap-1.5 flex-wrap">+ {item.totalEpisodes > 0 && <span>第 {item.episodeIndex + 1}/{item.totalEpisodes} 集</span>}+ {hasPercent && <span>· {formatTime(item.playbackPosition)}</span>}+ <span>· {formatRelativeTime(item.timestamp)}</span>+ </div>+ {hasPercent && (+ <div className="mt-1.5 h-1 bg-[#333] rounded-full overflow-hidden">+ <div className="h-full bg-accent" style={{ width: `${percent}%` }} />+ </div>+ )}+ </div>+ </div>+ </Link>+ <button+ className={cn(+ 'absolute right-2 top-2 p-1.5 rounded-full text-gray-500 hover:text-red-400',+ 'opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity'+ )}+ aria-label="删除记录"+ title="删除记录"+ onClick={() => {+ removeHistory(item.sourceKey, item.vodId).then(() => toast('已删除该记录', 'success'));+ }}+ >+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />+ </svg>+ </button>+ </li>+ );+}diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/c0edcbf68c2c69873fdf45e29857bc1b97ff875c49a34fb1ef82bcf9bfafdd6c.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/c0edcbf68c2c69873fdf45e29857bc1b97ff875c49a34fb1ef82bcf9bfafdd6c.sourcenew file mode 100644index 0000000..467325a--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/c0edcbf68c2c69873fdf45e29857bc1b97ff875c49a34fb1ef82bcf9bfafdd6c.source@@ -0,0 +1,118 @@+'use client';++import { useEffect, useState } from 'react';+import type { SearchResultItem } from '@/lib/types';+import { buildImageUrl } from '@/lib/utils';+import { useAppStore } from '@/lib/store';+import { cn } from '@/lib/utils';++/** 影片卡片:封面加载失败时逐级降级到占位图 */+export function VideoCard({ item, onClick }: { item: SearchResultItem; onClick: () => void }) {+ const imageProxyMode = useAppStore((s) => s.imageProxyMode);+ const customImageProxy = useAppStore((s) => s.customImageProxy);+ const [imgFailed, setImgFailed] = useState(false);+ const primary = buildImageUrl(item.pic, imageProxyMode, customImageProxy);+ // 加载方式变化时重置失败状态,允许新地址重试+ useEffect(() => setImgFailed(false), [primary]);+ const showImg = primary && !imgFailed;++ return (+ <div+ className="card cursor-pointer hover:scale-[1.02] hover:shadow-md h-full"+ role="button"+ tabIndex={0}+ onClick={onClick}+ onKeyDown={(e) => {+ if (e.key === 'Enter' || e.key === ' ') onClick();+ }}+ >+ <div className="flex h-full">+ {showImg ? (+ <div className="relative flex-shrink-0 w-[105px] sm:w-[120px] bg-[#222]">+ {/* eslint-disable-next-line @next/next/no-img-element */}+ <img+ src={primary}+ alt={item.name}+ className="h-full w-full object-cover"+ loading="lazy"+ onError={() => setImgFailed(true)}+ />+ <div className="absolute inset-0 bg-gradient-to-r from-black/30 to-transparent" />+ </div>+ ) : (+ <div className="flex-shrink-0 w-[105px] sm:w-[120px] bg-gradient-to-br from-[#1d1d1d] to-[#161616] flex items-center justify-center">+ <svg className="w-8 h-8 text-gray-700" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M7 4v16m10-16v16M3 6a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm4 0a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1h-1a1 1 0 01-1-1V6zm8 0a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1h-1a1 1 0 01-1-1V6zm4 0a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1h-1a1 1 0 01-1-1V6z" />+ </svg>+ </div>+ )}++ <div className="p-2.5 flex flex-col flex-grow min-w-0">+ <div className="flex-grow">+ <h3 className="font-semibold text-sm text-white mb-1.5 line-clamp-2" title={item.name}>+ {item.name}+ </h3>+ <div className="flex flex-wrap gap-1 mb-1.5">+ {item.typeName && <span className="tag bg-blue-500/20 text-blue-300">{item.typeName}</span>}+ {item.year && <span className="tag bg-purple-500/20 text-purple-300">{item.year}</span>}+ </div>+ <p className="text-xs text-gray-400 line-clamp-2 mb-2">{item.remarks || '暂无介绍'}</p>+ </div>+ <div className="flex items-center justify-between mt-auto pt-1.5 border-t border-[#2a2a2a]">+ <span className="tag bg-[#2a2a2a] text-gray-400 truncate max-w-[80%]">{item.sourceName}</span>+ </div>+ </div>+ </div>+ </div>+ );+}++/** 豆瓣推荐卡片(无来源徽章,点击直接搜索) */+export function DoubanCard({ item, onClick }: { item: { title: string; cover: string; rating?: string }; onClick: () => void }) {+ const imageProxyMode = useAppStore((s) => s.imageProxyMode);+ const customImageProxy = useAppStore((s) => s.customImageProxy);+ const [imgFailed, setImgFailed] = useState(false);+ const primary = buildImageUrl(item.cover, imageProxyMode, customImageProxy);+ useEffect(() => setImgFailed(false), [primary]);++ return (+ <div+ className="card cursor-pointer hover:scale-[1.03] hover:shadow-md"+ role="button"+ tabIndex={0}+ onClick={onClick}+ onKeyDown={(e) => {+ if (e.key === 'Enter' || e.key === ' ') onClick();+ }}+ >+ <div className="relative aspect-[2/3] bg-[#1a1a1a]">+ {primary && !imgFailed ? (+ // eslint-disable-next-line @next/next/no-img-element+ <img+ src={primary}+ alt={item.title}+ className="w-full h-full object-cover"+ loading="lazy"+ onError={() => setImgFailed(true)}+ />+ ) : (+ <div className="w-full h-full flex items-center justify-center bg-gradient-to-br from-[#1d1d1d] to-[#161616]">+ <svg className="w-9 h-9 text-gray-700" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M7 4v16m10-16v16M3 6a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm4 0a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1h-1a1 1 0 01-1-1V6zm8 0a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1h-1a1 1 0 01-1-1V6zm4 0a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1h-1a1 1 0 01-1-1V6z" />+ </svg>+ </div>+ )}+ {item.rating && (+ <span className={cn('absolute top-1.5 right-1.5 tag bg-black/70 text-yellow-400 font-medium')}>+ ★ {item.rating}+ </span>+ )}+ </div>+ <div className="p-2">+ <div className="text-xs font-medium text-gray-200 truncate" title={item.title}>+ {item.title}+ </div>+ </div>+ </div>+ );+}diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/cf7e29e4902dea0aa000da86f34225ba6d7a6d13c982343f255b15f827269199.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/cf7e29e4902dea0aa000da86f34225ba6d7a6d13c982343f255b15f827269199.sourcenew file mode 100644index 0000000..d486019--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/cf7e29e4902dea0aa000da86f34225ba6d7a6d13c982343f255b15f827269199.source@@ -0,0 +1,154 @@+'use client';++import Link from 'next/link';+import { useEffect, useRef, useState } from 'react';+import { usePathname, useRouter } from 'next/navigation';+import { useAppStore } from '@/lib/store';+import { useAuth } from './auth';+import { ThemeToggle } from './theme';+import { SourceManagerDrawer } from './source-manager';+import { HistoryPanel } from './history-panel';+import { cn } from '@/lib/utils';++/** 顶部导航:Logo、搜索框(首页外)、历史、设置 */+export function Header({ showSearch = false }: { showSearch?: boolean }) {+ const router = useRouter();+ const pathname = usePathname();+ const [settingsOpen, setSettingsOpen] = useState(false);+ const [historyOpen, setHistoryOpen] = useState(false);+ const [query, setQuery] = useState('');++ return (+ <>+ <header className="sticky top-0 z-40 bg-surface/90 backdrop-blur border-b border-[#2a2a2a]">+ <div className="max-w-6xl mx-auto px-4 h-14 flex items-center gap-3">+ <Link href="/" className="flex items-center gap-2 shrink-0">+ <span className="text-lg font-bold text-accent">LibreTV</span>+ </Link>++ {showSearch && (+ <form+ className="flex-1 max-w-xl hidden sm:block"+ onSubmit={(e) => {+ e.preventDefault();+ if (query.trim()) router.push(`/?s=${encodeURIComponent(query.trim())}`);+ }}+ >+ <input+ className="input w-full h-9"+ placeholder="搜索影片..."+ value={query}+ onChange={(e) => setQuery(e.target.value)}+ />+ </form>+ )}++ <div className="flex-1 sm:hidden" />++ <nav className="flex items-center gap-1 ml-auto">+ <HeaderLink href="/about" active={pathname === '/about'}>+ 关于+ </HeaderLink>+ <ThemeToggle />+ <IconButton label="观看历史" onClick={() => setHistoryOpen(true)}>+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />+ </svg>+ </IconButton>+ <IconButton label="设置" onClick={() => setSettingsOpen(true)}>+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />+ </svg>+ </IconButton>+ </nav>+ </div>+ </header>++ <SourceManagerDrawer open={settingsOpen} onClose={() => setSettingsOpen(false)} />+ <HistoryPanel open={historyOpen} onClose={() => setHistoryOpen(false)} />+ </>+ );+}++function HeaderLink({ href, active, children }: { href: string; active: boolean; children: React.ReactNode }) {+ return (+ <Link+ href={href}+ className={cn(+ 'px-2.5 py-1.5 rounded-md text-sm transition-colors',+ active ? 'text-white bg-surface-hover' : 'text-gray-400 hover:text-white'+ )}+ >+ {children}+ </Link>+ );+}++function IconButton({ label, onClick, children }: { label: string; onClick: () => void; children: React.ReactNode }) {+ return (+ <button+ className="p-2 rounded-md text-gray-400 hover:text-white hover:bg-surface-hover transition-colors"+ title={label}+ aria-label={label}+ onClick={onClick}+ >+ {children}+ </button>+ );+}++/** 面板通用骨架:右侧抽屉 */+export function Drawer({+ open,+ onClose,+ title,+ children,+ width = 'max-w-md',+}: {+ open: boolean;+ onClose: () => void;+ title: string;+ children: React.ReactNode;+ width?: string;+}) {+ const ref = useRef<HTMLDivElement>(null);+ useEffect(() => {+ if (!open) return;+ const handler = (e: KeyboardEvent) => {+ if (e.key === 'Escape') onClose();+ };+ window.addEventListener('keydown', handler);+ return () => window.removeEventListener('keydown', handler);+ }, [open, onClose]);++ if (!open) return null;+ return (+ <div className="fixed inset-0 z-50">+ <div className="absolute inset-0 bg-black/60 animate-fade-in" onClick={onClose} />+ <div+ ref={ref}+ className={cn(+ 'absolute right-0 top-0 h-full w-full bg-surface-raised border-l border-[#2a2a2a] overflow-y-auto scrollbar-thin animate-slide-up',+ width+ )}+ role="dialog"+ aria-label={title}+ >+ <div className="sticky top-0 bg-surface-raised px-4 py-3.5 border-b border-[#2a2a2a] flex items-center justify-between z-10">+ <h2 className="font-semibold text-white">{title}</h2>+ <button+ className="p-1.5 rounded-md text-gray-400 hover:text-white hover:bg-surface-hover"+ onClick={onClose}+ aria-label="关闭"+ >+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />+ </svg>+ </button>+ </div>+ <div className="p-4">{children}</div>+ </div>+ </div>+ );+}diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/d3cb66a01d282f3068e543d01cb615fb05fb9f322b80ca36b2aeece6d833da23.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/d3cb66a01d282f3068e543d01cb615fb05fb9f322b80ca36b2aeece6d833da23.sourcenew file mode 100644index 0000000..437854e--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/d3cb66a01d282f3068e543d01cb615fb05fb9f322b80ca36b2aeece6d833da23.source@@ -0,0 +1,112 @@+'use client';++import { useState } from 'react';+import { useQuery } from '@tanstack/react-query';+import { api } from '@/lib/client-api';+import { DoubanCard } from './video-card';+import { useAppStore } from '@/lib/store';+import { cn } from '@/lib/utils';++const MOVIE_TAGS = ['热门', '最新', '经典', '豆瓣高分', '冷门佳片', '华语', '欧美', '韩国', '日本', '动画'];+const TV_TAGS = ['热门', '美剧', '英剧', '韩剧', '日剧', '国产剧', '港剧', '日本动画', '综艺', '纪录片'];++/** 豆瓣推荐区:影视切换 + 标签筛选 + 分页加载 */+export function DoubanSection({ onPick }: { onPick: (title: string) => void }) {+ const doubanEnabled = useAppStore((s) => s.doubanEnabled);+ const [type, setType] = useState<'movie' | 'tv'>('movie');+ const [tag, setTag] = useState('热门');+ const [visibleCount, setVisibleCount] = useState(25);++ const query = useQuery({+ queryKey: ['douban', type, tag],+ queryFn: ({ signal }) => api.douban(type, tag, 0, 50, signal),+ });++ if (!doubanEnabled) return null;++ const tags = type === 'movie' ? MOVIE_TAGS : TV_TAGS;+ const items = query.data?.items ?? [];+ const shown = items.slice(0, visibleCount);++ const switchType = (t: 'movie' | 'tv') => {+ if (t === type) return;+ setType(t);+ setTag(t === 'movie' ? '热门' : '热门');+ setVisibleCount(25);+ };++ return (+ <section aria-label="豆瓣推荐">+ <div className="flex items-center justify-between mb-3">+ <div className="flex items-center gap-2">+ <div className="flex bg-[#1e1e1e] rounded-lg p-0.5">+ <TypeButton active={type === 'movie'} onClick={() => switchType('movie')}>+ 电影+ </TypeButton>+ <TypeButton active={type === 'tv'} onClick={() => switchType('tv')}>+ 剧集+ </TypeButton>+ </div>+ </div>+ </div>++ <div className="flex flex-wrap gap-1.5 mb-4">+ {tags.map((t) => (+ <button+ key={t}+ className={cn(+ 'px-2.5 py-1 rounded-full text-xs transition-colors',+ t === tag ? 'bg-accent text-white' : 'bg-[#1e1e1e] text-gray-400 hover:text-white hover:bg-surface-hover'+ )}+ onClick={() => {+ setTag(t);+ setVisibleCount(25);+ }}+ >+ {t}+ </button>+ ))}+ </div>++ {query.isError ? (+ <p className="text-center text-sm text-gray-500 py-8">豆瓣推荐加载失败,可稍后重试或在设置中关闭</p>+ ) : query.isLoading ? (+ <div className="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 gap-2.5">+ {Array.from({ length: 16 }).map((_, i) => (+ <div key={i}>+ <div className="aspect-[2/3] rounded-lg bg-[#1a1a1a] animate-pulse" />+ <div className="h-3 mt-2 rounded bg-[#1a1a1a] animate-pulse" />+ </div>+ ))}+ </div>+ ) : (+ <>+ <div className="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 gap-2.5">+ {shown.map((item) => (+ <DoubanCard key={item.id} item={item} onClick={() => onPick(item.title)} />+ ))}+ </div>+ {visibleCount < items.length && (+ <div className="text-center mt-4">+ <button className="btn-ghost" onClick={() => setVisibleCount((v) => v + 25)}>+ 加载更多+ </button>+ </div>+ )}+ </>+ )}+ </section>+ );+}++function TypeButton({ active, onClick, children }: { active: boolean; onClick: () => void; children: React.ReactNode }) {+ return (+ <button+ className={cn('px-3.5 py-1.5 rounded-md text-sm transition-colors', active ? 'bg-accent text-white' : 'text-gray-400 hover:text-white')}+ onClick={onClick}+ aria-pressed={active}+ >+ {children}+ </button>+ );+}diff --git a/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/e2bf0c29de09f20b0bcbf1781174fd635a68e6f9399827a6f2b9ea8ee734f34f.source b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/e2bf0c29de09f20b0bcbf1781174fd635a68e6f9399827a6f2b9ea8ee734f34f.sourcenew file mode 100644index 0000000..50f1fbd--- /dev/null+++ b/libretv-next/src/.mimosa/hook-state/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0.mtiy5v8r-24984-7970f41ca4.baseline/e2bf0c29de09f20b0bcbf1781174fd635a68e6f9399827a6f2b9ea8ee734f34f.source@@ -0,0 +1,191 @@+'use client';++import { createContext, useCallback, useContext, useEffect, useRef, useState, type ReactNode } from 'react';+import { useQueryClient } from '@tanstack/react-query';+import { api, onUnauthorized } from '@/lib/client-api';+import { useToast } from './toast';++/**+ * 认证上下文:+ * - 页面加载时查询 /api/status 判断会话有效性;+ * - 任何 API 返回 401/503 时全局打开登录框(客户端 API 层统一触发,不再散落检查)。+ */++type SetupRequired = boolean;++interface AuthContextValue {+ checked: boolean;+ verified: boolean;+ /** 服务器未设置 PASSWORD,需要管理员配置 */+ setupRequired: SetupRequired;+ openLogin: () => void;+ logout: () => Promise<void>;+}++const AuthContext = createContext<AuthContextValue>({+ checked: false,+ verified: false,+ setupRequired: false,+ openLogin: () => {},+ logout: async () => {},+});++export function useAuth(): AuthContextValue {+ return useContext(AuthContext);+}++export function AuthProvider({ children }: { children: ReactNode }) {+ const [checked, setChecked] = useState(false);+ const [verified, setVerified] = useState(false);+ const [setupRequired, setSetupRequired] = useState(false);+ const [modalOpen, setModalOpen] = useState(false);+ const { toast } = useToast();+ const queryClient = useQueryClient();++ useEffect(() => {+ api+ .status()+ .then((s) => {+ setVerified(s.verified);+ setSetupRequired(!s.passwordRequired);+ setChecked(true);+ })+ .catch(() => setChecked(true));+ }, []);++ useEffect(+ () =>+ onUnauthorized((event) => {+ const setup = (event as CustomEvent).detail === 'setup';+ setSetupRequired(setup);+ setVerified(false);+ setModalOpen(true);+ }),+ []+ );++ const openLogin = useCallback(() => setModalOpen(true), []);++ const logout = useCallback(async () => {+ try {+ await api.logout();+ } finally {+ setVerified(false);+ toast('已退出登录', 'info');+ }+ }, [toast]);++ const handleLoginSuccess = useCallback(() => {+ setVerified(true);+ setSetupRequired(false);+ setModalOpen(false);+ // 登录前以 401 失败的查询(如豆瓣推荐)需要重新拉取+ queryClient.invalidateQueries();+ toast('验证成功', 'success');+ }, [toast, queryClient]);++ return (+ <AuthContext.Provider value={{ checked, verified, setupRequired, openLogin, logout }}>+ {children}+ {modalOpen && (+ <LoginModal+ setupRequired={setupRequired}+ onSuccess={handleLoginSuccess}+ onClose={() => setModalOpen(false)}+ />+ )}+ </AuthContext.Provider>+ );+}++function LoginModal({+ setupRequired,+ onSuccess,+ onClose,+}: {+ setupRequired: boolean;+ onSuccess: () => void;+ onClose: () => void;+}) {+ const [password, setPassword] = useState('');+ const [error, setError] = useState('');+ const [loading, setLoading] = useState(false);+ const inputRef = useRef<HTMLInputElement>(null);+ const { toast } = useToast();++ useEffect(() => {+ inputRef.current?.focus();+ }, []);++ useEffect(() => {+ const handler = (e: KeyboardEvent) => {+ if (e.key === 'Escape') onClose();+ };+ window.addEventListener('keydown', handler);+ return () => window.removeEventListener('keydown', handler);+ }, [onClose]);++ const submit = async () => {+ if (!password.trim() || loading) return;+ setLoading(true);+ setError('');+ try {+ await api.login(password);+ onSuccess();+ } catch (err) {+ const msg = err instanceof Error ? err.message : '验证失败';+ setError(msg === '需要登录' ? '密码错误' : msg);+ setPassword('');+ inputRef.current?.focus();+ void toast;+ } finally {+ setLoading(false);+ }+ };++ return (+ <div+ className="fixed inset-0 z-[95] flex items-center justify-center bg-black/80 animate-fade-in"+ onClick={(e) => {+ if (e.target === e.currentTarget) onClose();+ }}+ >+ <div className="bg-surface-raised rounded-xl p-6 w-full max-w-sm mx-4 shadow-2xl">+ {setupRequired ? (+ <>+ <h2 className="text-lg font-semibold text-white mb-3">需要配置密码</h2>+ <p className="text-sm text-gray-400 leading-relaxed">+ 为确保安全,必须设置 <code className="text-accent">PASSWORD</code> 环境变量才能使用本服务。+ 请联系管理员在部署配置中添加该变量后重启服务。+ </p>+ </>+ ) : (+ <>+ <h2 className="text-lg font-semibold text-white mb-1">访问验证</h2>+ <p className="text-sm text-gray-400 mb-4">请输入密码继续访问</p>+ <form+ onSubmit={(e) => {+ e.preventDefault();+ submit();+ }}+ >+ <input+ ref={inputRef}+ type="password"+ value={password}+ onChange={(e) => setPassword(e.target.value)}+ className="input w-full"+ placeholder="密码"+ autoComplete="current-password"+ />+ {error && <p className="mt-2 text-sm text-red-400">{error}</p>}+ <button type="submit" className="btn-primary w-full mt-4" disabled={loading || !password.trim()}>+ {loading ? '验证中...' : '进入'}+ </button>+ </form>+ </>+ )}+ </div>+ </div>+ );+}diff --git a/libretv-next/src/.mimosa/hook-status/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0-aff7222d8e.json b/libretv-next/src/.mimosa/hook-status/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0-aff7222d8e.jsonnew file mode 100644index 0000000..42f8e69--- /dev/null+++ b/libretv-next/src/.mimosa/hook-status/sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0-aff7222d8e.json@@ -0,0 +1,37 @@+{+ "schemaVersion": "mimosa-hook-status/v1",+ "recordedAt": "2026-09-01T17:38:02.702Z",+ "sessionId": "sess_f62c5a03-d4af-4158-a7cd-9931bdf90fd0",+ "event": "PreToolUse",+ "toolName": "Edit",+ "file": "components/switch-source.tsx",+ "outcome": "inconclusive",+ "coverage": "partial",+ "findingCount": 0,+ "durationMs": 510,+ "telemetry": {+ "schemaVersion": "mimosa-gate-telemetry/v1",+ "profile": "gate",+ "operation": "PreToolUse",+ "outcome": "partial/INCONCLUSIVE",+ "latencyMs": 510,+ "peakMemoryBytes": 137363456,+ "memoryMeasurement": "max-observed-process-rss",+ "scannedFiles": 1,+ "cache": {+ "hits": 0,+ "misses": 1,+ "measurement": "not-applicable"+ },+ "denyCount": 0,+ "tokens": {+ "input": 0,+ "output": 0,+ "total": 0,+ "modelCalls": 0,+ "measurement": "known-zero"+ }+ },+ "hostState": "hook_complete_waiting_host_tool_decision",+ "reportHint": ".mimosa/reports/"+}diff --git a/libretv-next/src/app/about/page.tsx b/libretv-next/src/app/about/page.tsxnew file mode 100644index 0000000..def6b6c--- /dev/null+++ b/libretv-next/src/app/about/page.tsx@@ -0,0 +1,51 @@+'use client';++import { Header } from '@/components/header';++export default function AboutPage() {+ return (+ <div className="min-h-screen flex flex-col">+ <Header />+ <main className="flex-1 max-w-2xl w-full mx-auto px-4 py-10 space-y-8">+ <section>+ <h1 className="text-xl font-bold text-content mb-3">关于 LibreTV</h1>+ <p className="text-sm text-muted leading-relaxed">+ LibreTV 是一个免费的在线视频搜索与观看平台。输入片名即可在多个数据源中聚合搜索,+ 无需注册、无内嵌广告、不存储任何视频文件。所有播放内容均来自第三方公开接口。+ </p>+ </section>++ <section>+ <h2 className="text-base font-semibold text-content mb-2.5">快捷键</h2>+ <ul className="text-sm text-muted space-y-1.5 list-disc list-inside">+ <li><code className="text-accent">空格</code> 播放 / 暂停</li>+ <li><code className="text-accent">←</code> / <code className="text-accent">→</code> 快退 / 快进 5 秒</li>+ <li><code className="text-accent">↑</code> / <code className="text-accent">↓</code> 音量调节</li>+ <li><code className="text-accent">F</code> 切换全屏</li>+ <li><code className="text-accent">Alt + ←/→</code> 上一集 / 下一集</li>+ <li>移动端长按视频可 3 倍速播放</li>+ </ul>+ </section>++ <section>+ <h2 className="text-base font-semibold text-content mb-2.5">隐私与数据</h2>+ <p className="text-sm text-muted leading-relaxed">+ 你的搜索历史、观看进度等数据仅保存在本设备浏览器中(IndexedDB),不会上传到服务器。+ 聚合搜索请求由服务端代理转发,第三方数据源不会看到你的 IP 地址。+ </p>+ </section>++ <section>+ <h2 className="text-base font-semibold text-content mb-2.5">免责声明</h2>+ <p className="text-sm text-faint leading-relaxed">+ 本项目不存储、不制作任何视频内容,仅提供第三方公开接口的聚合与播放能力。+ 请尊重版权,所有内容的合法性由对应数据源负责。+ </p>+ </section>+ </main>+ <footer className="border-t border-line py-4">+ <p className="text-center text-xs text-faint">LibreTV v2.0 · Apache-2.0 License</p>+ </footer>+ </div>+ );+}diff --git a/libretv-next/src/app/api/auth/route.ts b/libretv-next/src/app/api/auth/route.tsnew file mode 100644index 0000000..91c0120--- /dev/null+++ b/libretv-next/src/app/api/auth/route.ts@@ -0,0 +1,58 @@+import { NextResponse } from 'next/server';+import { SESSION_COOKIE, checkRateLimit, sessionFromCookieHeader, signSession, checkPassword, clearRateLimit, isPasswordConfigured } from '@/lib/auth';++export const runtime = 'nodejs';++export async function POST(req: Request) {+ if (!isPasswordConfigured()) {+ return NextResponse.json(+ { success: false, error: '服务器未设置 PASSWORD 环境变量,请联系管理员配置' },+ { status: 503 }+ );+ }++ const ip = req.headers.get('x-forwarded-for')?.split(',')[0]?.trim() || req.headers.get('x-real-ip') || 'unknown';+ if (!checkRateLimit(ip)) {+ return NextResponse.json(+ { success: false, error: '尝试次数过多,请 10 分钟后再试' },+ { status: 429 }+ );+ }++ let password = '';+ try {+ const body = (await req.json()) as { password?: string };+ password = String(body.password ?? '');+ } catch {+ return NextResponse.json({ success: false, error: '请求格式错误' }, { status: 400 });+ }++ if (!checkPassword(password)) {+ return NextResponse.json({ success: false, error: '密码错误' }, { status: 401 });+ }++ clearRateLimit(ip);+ const { token, expiresAt } = signSession();+ const res = NextResponse.json({ success: true });+ res.cookies.set(SESSION_COOKIE, token, {+ httpOnly: true,+ sameSite: 'lax',+ secure: process.env.NODE_ENV === 'production',+ maxAge: Math.floor((expiresAt - Date.now()) / 1000),+ path: '/',+ });+ return res;+}++/** GET:查询当前会话状态 */+export async function GET(req: Request) {+ const verified = sessionFromCookieHeader(req.headers.get('cookie'));+ return NextResponse.json({ success: true, verified });+}++/** DELETE:登出 */+export async function DELETE() {+ const res = NextResponse.json({ success: true });+ res.cookies.set(SESSION_COOKIE, '', { httpOnly: true, maxAge: 0, path: '/' });+ return res;+}diff --git a/libretv-next/src/app/api/detail/route.ts b/libretv-next/src/app/api/detail/route.tsnew file mode 100644index 0000000..1710748--- /dev/null+++ b/libretv-next/src/app/api/detail/route.ts@@ -0,0 +1,79 @@+import { NextResponse } from 'next/server';+import { guardRequest } from '@/lib/api-guard';+import { cmsRequestHeaders, parseDetail, parseDetailPageHtml } from '@/lib/cms-parser';+import { fetchUpstream } from '@/lib/fetch-utils';+import type { SourceConfig } from '@/lib/types';++export const runtime = 'nodejs';++function parseSource(raw: string | null): SourceConfig | null {+ if (!raw) return null;+ try {+ const obj = JSON.parse(raw) as SourceConfig;+ if (!obj || !/^https?:\/\//.test(obj.url || '')) return null;+ return obj;+ } catch {+ return null;+ }+}++/**+ * 视频详情:优先走列表接口 ?ac=videolist&ids=,+ * 拿不到播放地址时(部分源需要爬详情页)降级到 detail 页 HTML 提取。+ */+export async function GET(req: Request) {+ const guarded = guardRequest(req);+ if (guarded) return guarded;++ const url = new URL(req.url);+ const id = (url.searchParams.get('id') || '').trim();+ const source = parseSource(url.searchParams.get('source'));+ const baseUrl = (url.searchParams.get('baseUrl') || '').trim(); // 可选:详情页根地址++ if (!id || !/^[\w-]+$/.test(id)) {+ return NextResponse.json({ error: '无效的视频ID' }, { status: 400 });+ }+ if (!source) {+ return NextResponse.json({ error: '无效的数据源配置' }, { status: 400 });+ }++ try {+ // 1) 标准列表接口+ const api = `${source.url.replace(/\/+$/, '')}?ac=videolist&ids=${encodeURIComponent(id)}`;+ const res = await fetchUpstream(api, { timeoutMs: 10000, headers: cmsRequestHeaders() });+ if (res.ok) {+ const data = await res.json();+ try {+ const detail = parseDetail(data, source);+ if (detail.episodes.length > 0) {+ return NextResponse.json(detail);+ }+ // 有详情但无播放地址 → 继续尝试详情页+ } catch {+ // 列表接口无内容 → 继续尝试详情页+ }+ }++ // 2) 详情页 HTML 提取(detail 地址优先,否则用 API 地址推导)+ const detailRoot = (source.detail || baseUrl || '').replace(/\/+$/, '');+ if (detailRoot && /^https?:\/\//.test(detailRoot)) {+ const detailUrl = `${detailRoot}/index.php/vod/detail/id/${id}.html`;+ const detailRes = await fetchUpstream(detailUrl, {+ timeoutMs: 10000,+ headers: { 'User-Agent': cmsRequestHeaders()['User-Agent'] },+ });+ if (detailRes.ok) {+ const html = await detailRes.text();+ const detail = parseDetailPageHtml(html, source);+ return NextResponse.json(detail);+ }+ }++ return NextResponse.json({ error: '未找到播放资源' }, { status: 404 });+ } catch (err) {+ return NextResponse.json(+ { error: err instanceof Error ? err.message : '获取详情失败' },+ { status: 502 }+ );+ }+}diff --git a/libretv-next/src/app/api/douban/route.ts b/libretv-next/src/app/api/douban/route.tsnew file mode 100644index 0000000..5a4f86c--- /dev/null+++ b/libretv-next/src/app/api/douban/route.ts@@ -0,0 +1,27 @@+import { NextResponse } from 'next/server';+import { guardRequest } from '@/lib/api-guard';+import { fetchDoubanRecommend } from '@/lib/douban';++export const runtime = 'nodejs';++/** 豆瓣推荐:服务端直连 + 缓存,替代旧版浏览器经公共 CORS 代理的方案 */+export async function GET(req: Request) {+ const guarded = guardRequest(req);+ if (guarded) return guarded;++ const url = new URL(req.url);+ const type = url.searchParams.get('type') === 'tv' ? 'tv' : 'movie';+ const tag = (url.searchParams.get('tag') || '热门').slice(0, 20);+ const pageStart = Math.max(0, parseInt(url.searchParams.get('pageStart') || '0', 10) || 0);+ const pageSize = Math.min(50, Math.max(1, parseInt(url.searchParams.get('pageSize') || '25', 10) || 25));++ try {+ const items = await fetchDoubanRecommend(type, tag, pageStart, pageSize);+ return NextResponse.json({ items });+ } catch (err) {+ return NextResponse.json(+ { error: err instanceof Error ? err.message : '豆瓣推荐获取失败' },+ { status: 502 }+ );+ }+}diff --git a/libretv-next/src/app/api/proxy/[url]/route.ts b/libretv-next/src/app/api/proxy/[url]/route.tsnew file mode 100644index 0000000..9cd920c--- /dev/null+++ b/libretv-next/src/app/api/proxy/[url]/route.ts@@ -0,0 +1,104 @@+import { NextResponse } from 'next/server';+import { guardRequest } from '@/lib/api-guard';+import { isBlockedByDNS, isValidProxyUrl } from '@/lib/ssrf';+import { rewriteM3u8 } from '@/lib/m3u8';+import { fetchUpstream } from '@/lib/fetch-utils';++export const runtime = 'nodejs';++const TIMEOUT_MS = parseInt(process.env.REQUEST_TIMEOUT || '8000', 10);+const MAX_RETRIES = parseInt(process.env.MAX_RETRIES || '1', 10);+const UA =+ process.env.USER_AGENT ||+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36';++// 未鉴权的图片等资源也允许走代理(豆瓣防盗链需要 Referer 伪装);+// 但为防止被当作开放代理滥用,仅放行图片类目标,其余必须已登录。+function looksLikeImageUrl(target: string): boolean {+ if (/\.(jpe?g|png|gif|webp|avif)(\?|$)/i.test(target)) return true;+ const host = (() => {+ try { return new URL(target).hostname; } catch { return ''; }+ })();+ return host.endsWith('doubanio.com') || host.endsWith('douban.com');+}++/**+ * 通用流式代理:+ * - 已登录会话(httpOnly cookie)→ m3u8 重写后的分片同源请求自动携带,不再有旧版丢鉴权参数的问题;+ * - 未登录仅放行图片目标(豆瓣封面等),且同样受 SSRF 防护约束;+ * - m3u8 文本重写为代理路径,分片/key/map 全部经本站转发,规避上游 CORS。+ */+export async function GET(req: Request, ctx: { params: Promise<{ url: string }> }) {+ const { url: encodedUrl } = await ctx.params;+ const targetUrl = (() => {+ try { return decodeURIComponent(encodedUrl); } catch { return encodedUrl; }+ })();++ const guarded = guardRequest(req);+ if (guarded && !looksLikeImageUrl(targetUrl)) return guarded;++ if (!isValidProxyUrl(targetUrl)) {+ return new NextResponse('无效的 URL', { status: 400 });+ }+ if (await isBlockedByDNS(targetUrl)) {+ return new NextResponse('不允许访问私有/保留网络地址', { status: 403 });+ }++ const headers: Record<string, string> = { 'User-Agent': UA, Accept: '*/*' };+ try {+ if (new URL(targetUrl).hostname.endsWith('doubanio.com')) {+ headers.Referer = 'https://movie.douban.com/';+ }+ } catch { /* 忽略非法 URL */ }++ const range = req.headers.get('range');+ if (range) headers.Range = range;++ let response: Response;+ try {+ response = await fetchUpstream(targetUrl, {+ timeoutMs: TIMEOUT_MS,+ retries: MAX_RETRIES,+ headers,+ redirect: 'follow',+ });+ } catch (err) {+ return new NextResponse(+ `代理请求失败: ${err instanceof Error ? err.message : '未知错误'}`,+ { status: 502 }+ );+ }++ const contentType = response.headers.get('content-type') || '';+ const isM3u8 =+ contentType.includes('mpegurl') || contentType.includes('x-mpegurl') ||+ targetUrl.toLowerCase().endsWith('.m3u8');++ // m3u8 文本:重写为代理路径+ if (isM3u8) {+ const text = await response.text();+ return new NextResponse(rewriteM3u8(text, targetUrl), {+ status: response.status,+ headers: {+ 'Content-Type': 'application/vnd.apple.mpegurl',+ 'Cache-Control': 'no-store',+ 'Access-Control-Allow-Origin': '*',+ },+ });+ }++ // 其余(图片 / JSON / 分片 / key)流式透传+ const outHeaders = new Headers();+ for (const name of ['content-type', 'accept-ranges', 'content-range', 'etag', 'last-modified']) {+ const v = response.headers.get(name);+ if (v) outHeaders.set(name, v);+ }+ // fetch 会自动解压,转发时必须去掉长度相关头避免浏览器二次解压+ outHeaders.set('Cache-Control', 'public, max-age=3600');+ outHeaders.set('Access-Control-Allow-Origin', '*');++ return new NextResponse(response.body, {+ status: response.status,+ headers: outHeaders,+ });+}diff --git a/libretv-next/src/app/api/search/route.ts b/libretv-next/src/app/api/search/route.tsnew file mode 100644index 0000000..71fa2f2--- /dev/null+++ b/libretv-next/src/app/api/search/route.ts@@ -0,0 +1,88 @@+import { NextResponse } from 'next/server';+import { guardRequest } from '@/lib/api-guard';+import { cmsRequestHeaders, filterAdultResults, parseSearchList } from '@/lib/cms-parser';+import { fetchUpstream } from '@/lib/fetch-utils';+import type { SourceConfig, SourceSearchOutcome } from '@/lib/types';++export const runtime = 'nodejs';++interface SearchBody {+ wd: string;+ sources: SourceConfig[];+ filterAdult?: boolean;+}++/**+ * 服务端聚合搜索:并行请求所有选中源,任一源失败不影响整体。+ * 旧版在浏览器里打满 N 个请求(暴露用户 IP、无法缓存、超时失控),现全部上移。+ */+export async function POST(req: Request) {+ const guarded = guardRequest(req);+ if (guarded) return guarded;++ let body: SearchBody;+ try {+ body = (await req.json()) as SearchBody;+ } catch {+ return NextResponse.json({ error: '请求格式错误' }, { status: 400 });+ }++ const wd = (body.wd || '').trim();+ if (!wd || wd.length > 100) {+ return NextResponse.json({ error: '搜索关键词无效' }, { status: 400 });+ }+ if (!Array.isArray(body.sources) || body.sources.length === 0) {+ return NextResponse.json({ error: '请至少选择一个数据源' }, { status: 400 });+ }+ const sources = body.sources.slice(0, 50);++ const outcomes: SourceSearchOutcome[] = await Promise.all(+ sources.map(async (source): Promise<SourceSearchOutcome> => {+ if (!/^https?:\/\//.test(source.url || '')) {+ return { sourceKey: source.key, ok: false, list: [], error: '无效的源地址' };+ }+ const api = `${source.url.replace(/\/+$/, '')}?ac=videolist&wd=${encodeURIComponent(wd)}`;+ try {+ const res = await fetchUpstream(api, {+ timeoutMs: 8000,+ headers: cmsRequestHeaders(),+ });+ if (!res.ok) throw new Error(`HTTP ${res.status}`);+ const data = await res.json();+ const list = parseSearchList(data, source);+ return { sourceKey: source.key, ok: true, list };+ } catch (err) {+ return {+ sourceKey: source.key,+ ok: false,+ list: [],+ error: err instanceof Error ? err.message : '请求失败',+ };+ }+ })+ );++ // 合并 + 跨源去重(同源同 vodId 视为重复)+ const seen = new Set<string>();+ let list = outcomes.flatMap((o) => o.list).filter((item) => {+ const key = `${item.sourceKey}_${item.vodId}`;+ if (seen.has(key)) return false;+ seen.add(key);+ return true;+ });++ list = filterAdultResults(list, body.filterAdult !== false);++ // 按名称排序(与旧版一致),名称相同按源名+ list.sort((a, b) => {+ const nameCompare = (a.name || '').localeCompare(b.name || '', 'zh-Hans-CN');+ if (nameCompare !== 0) return nameCompare;+ return (a.sourceName || '').localeCompare(b.sourceName || '', 'zh-Hans-CN');+ });++ const failures = outcomes+ .filter((o) => !o.ok)+ .map((o) => ({ sourceKey: o.sourceKey, error: o.error || '请求失败' }));++ return NextResponse.json({ list, failures });+}diff --git a/libretv-next/src/app/api/status/route.ts b/libretv-next/src/app/api/status/route.tsnew file mode 100644index 0000000..183fdec--- /dev/null+++ b/libretv-next/src/app/api/status/route.ts@@ -0,0 +1,15 @@+import { NextResponse } from 'next/server';+import { isPasswordConfigured, sessionFromCookieHeader } from '@/lib/auth';++export const runtime = 'nodejs';++/** 站点状态:客户端据此决定是否弹出登录框 / 提示管理员配置密码 */+export async function GET(req: Request) {+ const passwordRequired = isPasswordConfigured();+ const verified = passwordRequired && sessionFromCookieHeader(req.headers.get('cookie'));+ return NextResponse.json({+ passwordRequired,+ verified,+ version: '2.0.0',+ });+}diff --git a/libretv-next/src/app/globals.css b/libretv-next/src/app/globals.cssnew file mode 100644index 0000000..eb0e952--- /dev/null+++ b/libretv-next/src/app/globals.css@@ -0,0 +1,89 @@+@tailwind base;+@tailwind components;+@tailwind utilities;++/*+ * 语义化配色(RGB 三元组,供 Tailwind 以 <alpha-value> 注入透明度):+ * 深色主题沿用旧版 LibreTV 配色;浅色主题为对应的白底变体。+ */+:root {+ --c-page: 246 247 249; /* #f6f7f9 */+ --c-surface: 255 255 255; /* #ffffff */+ --c-surface-raised: 255 255 255;+ --c-card: 255 255 255;+ --c-chip: 238 240 243; /* #eef0f3 */+ --c-hover: 233 236 240; /* #e9ecf0 */+ --c-line: 224 227 232; /* #e0e3e8 */+ --c-content: 26 26 26; /* #1a1a1a */+ --c-muted: 95 99 104; /* #5f6368 */+ --c-faint: 138 143 152; /* #8a8f98 */+ --c-accent: 37 99 235; /* blue-600 */+ --c-accent-hover: 29 78 216; /* blue-700 */+ color-scheme: light;+}++.dark {+ --c-page: 17 17 17; /* #111111 旧版页面底色 */+ --c-surface: 25 25 25; /* #191919 旧版弹窗/抽屉底色 */+ --c-surface-raised: 25 25 25;+ --c-card: 30 30 30; /* #1e1e1e */+ --c-chip: 34 34 34; /* #222222 旧版卡片/输入框底色 */+ --c-hover: 38 38 38; /* #262626 */+ --c-line: 48 48 48; /* #303030 */+ --c-content: 231 231 231; /* #e7e7e7 */+ --c-muted: 155 155 155; /* #9b9b9b */+ --c-faint: 122 122 122; /* #7a7a7a */+ --c-accent: 37 99 235;+ --c-accent-hover: 29 78 216;+ color-scheme: dark;+}++html,+body {+ @apply bg-page text-content antialiased;+}++body {+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC',+ 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;+}++@layer components {+ .card {+ @apply bg-card border border-line rounded-lg overflow-hidden transition-all duration-200;+ }+ .btn {+ @apply inline-flex items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-sm transition-colors disabled:opacity-40 disabled:cursor-not-allowed;+ }+ .btn-primary {+ @apply btn bg-accent text-white hover:bg-accent-hover;+ }+ .btn-ghost {+ @apply btn bg-chip text-muted hover:bg-hover hover:text-content border border-line;+ }+ .input {+ @apply bg-chip border border-line rounded-md px-3 py-2 text-sm text-content placeholder:text-faint focus:outline-none focus:ring-1 focus:ring-accent focus:border-accent;+ }+ .tag {+ @apply inline-block text-xs px-1.5 py-0.5 rounded-full;+ }+ .scrollbar-thin::-webkit-scrollbar {+ width: 6px;+ height: 6px;+ }+ .scrollbar-thin::-webkit-scrollbar-thumb {+ @apply bg-line rounded-full;+ }+}++/* 行数截断 */+.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }+.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }+.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }++/* 播放器集数激活态 */+.episode-active {+ background: rgb(var(--c-accent)) !important;+ border-color: rgb(var(--c-accent)) !important;+ color: #fff;+}diff --git a/libretv-next/src/app/layout.tsx b/libretv-next/src/app/layout.tsxnew file mode 100644index 0000000..673c1d4--- /dev/null+++ b/libretv-next/src/app/layout.tsx@@ -0,0 +1,41 @@+import type { Metadata, Viewport } from 'next';+import './globals.css';+import { Providers } from '@/components/providers';++export const metadata: Metadata = {+ title: {+ default: 'LibreTV - 免费在线视频搜索与观看平台',+ template: '%s - LibreTV',+ },+ description:+ 'LibreTV 是一个免费的在线视频搜索平台,无广告、安全,提供来自多个视频源的内容搜索与观看服务,无需注册即可使用。',+ manifest: '/manifest.webmanifest',+ icons: {+ icon: '/favicon.svg',+ },+};++export const viewport: Viewport = {+ themeColor: '#111111',+ width: 'device-width',+ initialScale: 1,+};++export default function RootLayout({ children }: { children: React.ReactNode }) {+ return (+ <html lang="zh-CN" suppressHydrationWarning>+ <head>+ {/* 首屏前同步主题,避免亮暗闪烁 */}+ <script+ dangerouslySetInnerHTML={{+ __html:+ "(function(){try{var t=localStorage.getItem('libretv-theme')||'system';var d=t==='dark'||(t==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);document.documentElement.classList.toggle('dark',d);}catch(e){}})()",+ }}+ />+ </head>+ <body>+ <Providers>{children}</Providers>+ </body>+ </html>+ );+}diff --git a/libretv-next/src/app/manifest.ts b/libretv-next/src/app/manifest.tsnew file mode 100644index 0000000..762f512--- /dev/null+++ b/libretv-next/src/app/manifest.ts@@ -0,0 +1,21 @@+import type { MetadataRoute } from 'next';++export default function manifest(): MetadataRoute.Manifest {+ return {+ name: 'LibreTV - 免费在线视频搜索与观看平台',+ short_name: 'LibreTV',+ description: '免费在线视频搜索与观看平台',+ start_url: '/',+ display: 'standalone',+ background_color: '#111111',+ theme_color: '#111111',+ icons: [+ {+ src: '/favicon.svg',+ sizes: 'any',+ type: 'image/svg+xml',+ purpose: 'any',+ },+ ],+ };+}diff --git a/libretv-next/src/app/page.tsx b/libretv-next/src/app/page.tsxnew file mode 100644index 0000000..27aebb9--- /dev/null+++ b/libretv-next/src/app/page.tsx@@ -0,0 +1,269 @@+'use client';++import { Suspense, useEffect, useMemo, useRef, useState } from 'react';+import { useRouter, useSearchParams } from 'next/navigation';+import { useQuery } from '@tanstack/react-query';+import { Header } from '@/components/header';+import { DoubanSection } from '@/components/douban-section';+import { DetailModal } from '@/components/detail-modal';+import { VideoCard } from '@/components/video-card';+import { useAppStore, resolveSource } from '@/lib/store';+import { api } from '@/lib/client-api';+import type { SearchResultItem } from '@/lib/types';+import { addSearchHistory, db, removeSearchHistory } from '@/lib/db';+import { cn, validateSourceUrl } from '@/lib/utils';+import { useToast } from '@/components/toast';++/**+ * 首页:搜索(URL ?s= 驱动,可后退/分享)+ 豆瓣推荐。+ * 搜索状态由 React Query 管理,失败源在结果区顶部以非阻塞方式展示。+ */+export default function HomePage() {+ return (+ <Suspense>+ <HomeContent />+ </Suspense>+ );+}++function HomeContent() {+ const searchParams = useSearchParams();+ const router = useRouter();+ const { toast } = useToast();+ const urlQuery = searchParams.get('s') || '';+ const store = useAppStore();+ const [input, setInput] = useState(urlQuery);+ const [detailItem, setDetailItem] = useState<SearchResultItem | null>(null);+ const inputRef = useRef<HTMLInputElement>(null);++ // URL 驱动搜索:?s= 变化时回填输入框+ useEffect(() => {+ if (urlQuery) setInput(urlQuery);+ }, [urlQuery]);++ const selectedSources = useMemo(+ () =>+ store.selectedKeys+ .map((key) => resolveSource(store, key))+ .filter((s): s is NonNullable<typeof s> => Boolean(s) && validateSourceUrl(s!.url)),+ [store]+ );++ const searchQuery = useQuery({+ queryKey: ['search', urlQuery, store.selectedKeys, store.yellowFilter],+ queryFn: ({ signal }) => api.search(urlQuery, selectedSources, store.yellowFilter, signal),+ enabled: Boolean(urlQuery) && selectedSources.length > 0,+ staleTime: 60_000,+ });++ const searchHistory = useQuery({+ queryKey: ['searchHistory'],+ queryFn: () => db.searchHistory.orderBy('timestamp').reverse().limit(10).toArray(),+ });++ const runSearch = (q: string) => {+ const query = q.trim().slice(0, 100);+ if (!query) {+ toast('请输入搜索内容', 'info');+ inputRef.current?.focus();+ return;+ }+ if (selectedSources.length === 0) {+ toast('请先在设置中添加并勾选数据源', 'warning');+ return;+ }+ router.push(`/?s=${encodeURIComponent(query)}`, { scroll: false });+ addSearchHistory(query).catch(() => {});+ };++ const list = searchQuery.data?.list ?? [];+ const failures = searchQuery.data?.failures ?? [];+ // 失败源显示友好名称而非裸 key+ const failureNames = failures.map(+ (f) => store.customAPIs.find((a) => a.key === f.sourceKey)?.name ?? f.sourceKey+ );++ return (+ <div className="min-h-screen flex flex-col">+ <Header />++ <main className="relative flex-1 max-w-6xl w-full mx-auto px-4 py-6">+ {/* 首屏氛围渐变 */}+ {!urlQuery && (+ <div+ aria-hidden+ className="pointer-events-none absolute inset-x-0 top-0 h-[420px] -z-10"+ style={{+ background:+ 'radial-gradient(60% 60% at 50% 0%, rgba(35,173,229,0.10) 0%, rgba(35,173,229,0.03) 45%, transparent 75%)',+ }}+ />+ )}++ {/* 搜索区 */}+ <section className={cn('flex flex-col items-center', urlQuery ? 'mb-6' : 'mt-10 mb-14')}>+ {!urlQuery && (+ <header className="text-center mb-6">+ <h1 className="text-2xl sm:text-3xl font-bold text-content">免费在线视频搜索</h1>+ <p className="mt-2 text-sm text-faint">多源聚合 · 免注册 · 无广告 · 播放进度本机保存</p>+ </header>+ )}+ {urlQuery && <h1 className="sr-only">LibreTV 视频搜索</h1>}+ <form+ className="w-full max-w-2xl flex gap-2"+ onSubmit={(e) => {+ e.preventDefault();+ runSearch(input);+ }}+ >+ <div className="relative flex-1">+ <input+ ref={inputRef}+ className="input w-full h-11 pr-10"+ placeholder="输入影片名称..."+ value={input}+ maxLength={100}+ onChange={(e) => setInput(e.target.value)}+ aria-label="搜索影片"+ />+ {input && (+ <button+ type="button"+ className="absolute right-2.5 top-1/2 -translate-y-1/2 text-faint hover:text-content"+ onClick={() => {+ setInput('');+ inputRef.current?.focus();+ }}+ aria-label="清空"+ >+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />+ </svg>+ </button>+ )}+ </div>+ <button type="submit" className="btn-primary h-11 px-5">+ 搜索+ </button>+ </form>++ {/* 最近搜索 */}+ {(searchHistory.data?.length ?? 0) > 0 && (+ <div className="flex flex-wrap items-center gap-1.5 mt-3 justify-center">+ <span className="text-xs text-faint">最近搜索:</span>+ {searchHistory.data!.map((h) => (+ <span key={h.text} className="inline-flex items-center bg-card rounded-full text-xs">+ <button+ className="pl-2.5 pr-1 py-1 text-content hover:text-accent"+ onClick={() => {+ setInput(h.text);+ runSearch(h.text);+ }}+ >+ {h.text}+ </button>+ <button+ className="pr-2 py-1 text-faint hover:text-red-400"+ aria-label={`删除搜索记录 ${h.text}`}+ onClick={() => removeSearchHistory(h.text).then(() => searchHistory.refetch())}+ >+ ✕+ </button>+ </span>+ ))}+ </div>+ )}+ </section>++ {/* 搜索结果 */}+ {urlQuery && (+ <section aria-label="搜索结果" className="mb-10">+ <div className="flex items-center justify-between mb-3">+ <h2 className="text-sm text-muted">+ “<span className="text-content">{urlQuery}</span>” 的搜索结果+ {searchQuery.data && (+ <span className="text-faint">({list.length} 条{failures.length > 0 && `,${failures.length} 个源失败`})</span>+ )}+ </h2>+ </div>++ {failures.length > 0 && (+ <div className="mb-3 text-xs text-faint bg-chip rounded-lg px-3 py-2">+ 部分数据源请求失败:{failureNames.join('、')}+ </div>+ )}++ {searchQuery.isLoading ? (+ <ResultsSkeleton />+ ) : selectedSources.length === 0 ? (+ <NoSourceGuide hasSources={store.customAPIs.length > 0} />+ ) : list.length === 0 ? (+ <div className="text-center py-16">+ <svg className="mx-auto h-10 w-10 text-faint mb-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5}+ d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />+ </svg>+ <h3 className="text-base text-muted">没有找到匹配的结果</h3>+ <p className="text-sm text-faint mt-1">请尝试其他关键词或更换数据源</p>+ </div>+ ) : (+ <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3">+ {list.map((item) => (+ <VideoCard key={`${item.sourceKey}_${item.vodId}`} item={item} onClick={() => setDetailItem(item)} />+ ))}+ </div>+ )}+ </section>+ )}++ {/* 豆瓣推荐(有搜索时隐藏) */}+ {!urlQuery && (+ <DoubanSection+ onPick={(title) => {+ setInput(title);+ runSearch(title);+ }}+ />+ )}+ </main>++ <footer className="border-t border-line py-4">+ <p className="text-center text-xs text-faint">+ LibreTV v2.0 · 数据来源为第三方公开接口,本站不存储任何视频文件+ </p>+ </footer>++ <DetailModal item={detailItem} onClose={() => setDetailItem(null)} />+ </div>+ );+}++function ResultsSkeleton() {+ return (+ <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3">+ {Array.from({ length: 6 }).map((_, i) => (+ <div key={i} className="card h-28 animate-pulse bg-card" />+ ))}+ </div>+ );+}++/** 无数据源 / 未勾选数据源时的引导(替代旧版首屏静默空白) */+function NoSourceGuide({ hasSources = false }: { hasSources?: boolean }) {+ return (+ <div className="border border-dashed border-line rounded-xl p-10 text-center max-w-lg mx-auto">+ <h3 className="text-content font-medium mb-2">{hasSources ? '尚未勾选数据源' : '先添加一个数据源'}</h3>+ <p className="text-sm text-muted leading-relaxed">+ {hasSources ? (+ <>点击右上角「设置」,勾选要参与搜索的数据源后重新搜索。</>+ ) : (+ <>+ LibreTV 不内置任何采集站。点击右上角「设置 → 添加 API」,填入一个+ Apple CMS 采集站地址(如 <code className="text-accent text-xs">https://example.com/api.php/provide/vod</code>),+ 勾选后即可开始搜索。+ </>+ )}+ </p>+ </div>+ );+}diff --git a/libretv-next/src/app/watch/page.tsx b/libretv-next/src/app/watch/page.tsxnew file mode 100644index 0000000..91ebdfe--- /dev/null+++ b/libretv-next/src/app/watch/page.tsx@@ -0,0 +1,345 @@+'use client';++import { Suspense, useCallback, useEffect, useMemo, useRef, useState } from 'react';+import { useRouter, useSearchParams } from 'next/navigation';+import Link from 'next/link';+import { useQuery } from '@tanstack/react-query';+import { api } from '@/lib/client-api';+import { PlayerShell } from '@/components/player-shell';+import { SwitchSourceModal } from '@/components/switch-source';+import { useAuth } from '@/components/auth';+import { resolveSource, useAppStore } from '@/lib/store';+import {+ clearProgress,+ progressKeyOf,+ saveProgress,+ updateHistoryProgress,+ upsertHistory,+ db,+} from '@/lib/db';+import { cn } from '@/lib/utils';++/**+ * 播放页(唯一入口,替代旧版 watch.html → player.html 跳转链)。+ * 状态全部由 URL 驱动:/watch?source=xx&id=..&index=..&title=..+ * 集数列表由服务端详情接口获取;进度与历史走 IndexedDB。+ */+export default function WatchPage() {+ return (+ <Suspense>+ <WatchContent />+ </Suspense>+ );+}++function WatchContent() {+ const searchParams = useSearchParams();+ const router = useRouter();+ const store = useAppStore();+ const { verified } = useAuth();++ const sourceKey = searchParams.get('source') || '';+ const vodId = searchParams.get('id') || '';+ const directUrl = searchParams.get('url') || '';+ const titleParam = searchParams.get('title') || '';+ const indexParam = parseInt(searchParams.get('index') || '0', 10) || 0;++ const [reversed, setReversed] = useState(false);+ const [switchOpen, setSwitchOpen] = useState(false);++ const source = resolveSource(store, sourceKey, {+ url: searchParams.get('sourceUrl') || undefined,+ detail: searchParams.get('detail') || undefined,+ });++ // 详情查询:无 id(纯直连链接分享)时跳过+ const detailQuery = useQuery({+ queryKey: ['detail', sourceKey, vodId, source?.url],+ queryFn: ({ signal }) => api.detail(vodId, source!, signal),+ enabled: Boolean(source && vodId && verified),+ staleTime: 5 * 60_000,+ });++ const episodes = detailQuery.data?.episodes ?? [];+ const videoTitle = titleParam || detailQuery.data?.videoInfo?.title || '未知视频';++ // 当前播放地址:优先取剧集列表中的当前集,其次直连 URL 参数+ const currentUrl = useMemo(() => {+ if (episodes.length > 0) {+ const idx = Math.min(Math.max(indexParam, 0), episodes.length - 1);+ return episodes[idx] || directUrl;+ }+ return directUrl;+ }, [episodes, indexParam, directUrl]);++ const currentIndex = useMemo(() => {+ if (episodes.length > 0) return Math.min(Math.max(indexParam, 0), episodes.length - 1);+ return indexParam;+ }, [episodes, indexParam]);++ const goEpisode = useCallback(+ (index: number) => {+ const sp = new URLSearchParams(searchParams.toString());+ sp.set('index', String(index));+ sp.set('url', episodes[index] || directUrl);+ sp.delete('position');+ router.replace(`/watch?${sp.toString()}`, { scroll: false });+ },+ [router, searchParams, episodes, directUrl]+ );++ // 进度恢复优先级:URL position 参数 > IndexedDB 记录+ const getRestorePosition = useCallback(async () => {+ const urlPos = parseInt(searchParams.get('position') || '0', 10) || 0;+ if (urlPos > 0) return urlPos;+ if (!vodId) return 0;+ const entry = await db.progress.get(progressKeyOf(sourceKey, vodId, currentIndex));+ return entry?.position ?? 0;+ }, [searchParams, sourceKey, vodId, currentIndex]);++ // 写入观看历史(进入页面即记录,进度后续增量更新)+ useEffect(() => {+ if (!verified || !sourceKey || !currentUrl) return;+ const timer = setTimeout(() => {+ upsertHistory({+ sourceKey,+ sourceUrl: source?.url,+ vodId: vodId || currentUrl,+ title: videoTitle,+ pic: detailQuery.data?.videoInfo?.cover,+ episodeIndex: currentIndex,+ totalEpisodes: episodes.length,+ playbackPosition: 0,+ duration: 0,+ timestamp: Date.now(),+ }).catch(() => {});+ }, 2000);+ return () => clearTimeout(timer);+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [verified, sourceKey, vodId, currentIndex, videoTitle, currentUrl]);++ const handleTimeUpdate = useCallback(+ (position: number, duration: number) => {+ if (vodId) {+ saveProgress(sourceKey, vodId, currentIndex, position, duration).catch(() => {});+ updateHistoryProgress(sourceKey, vodId || currentUrl, position, duration).catch(() => {});+ }+ },+ [sourceKey, vodId, currentIndex, currentUrl]+ );++ const handlePause = useCallback(+ (position: number, duration: number) => {+ if (vodId) {+ saveProgress(sourceKey, vodId, currentIndex, position, duration).catch(() => {});+ updateHistoryProgress(sourceKey, vodId || currentUrl, position, duration).catch(() => {});+ }+ },+ [sourceKey, vodId, currentIndex, currentUrl]+ );++ const handleEnded = useCallback(() => {+ if (vodId) clearProgress(sourceKey, vodId, currentIndex).catch(() => {});+ if (store.autoplayNext && currentIndex < episodes.length - 1) {+ setTimeout(() => goEpisode(currentIndex + 1), 800);+ }+ }, [store.autoplayNext, currentIndex, episodes.length, goEpisode, sourceKey, vodId]);++ // Alt+←/→ 集数切换快捷键+ useEffect(() => {+ const handler = (e: KeyboardEvent) => {+ if (!e.altKey) return;+ if (e.key === 'ArrowLeft' && currentIndex > 0) {+ e.preventDefault();+ goEpisode(currentIndex - 1);+ } else if (e.key === 'ArrowRight' && currentIndex < episodes.length - 1) {+ e.preventDefault();+ goEpisode(currentIndex + 1);+ }+ };+ document.addEventListener('keydown', handler);+ return () => document.removeEventListener('keydown', handler);+ }, [currentIndex, episodes.length, goEpisode]);++ const orderedEpisodes = reversed ? [...episodes].map((_, i) => episodes.length - 1 - i) : episodes.map((_, i) => i);++ if (!verified) {+ return (+ <div className="min-h-screen flex items-center justify-center">+ <p className="text-faint text-sm">等待访问验证...</p>+ </div>+ );+ }++ if (!source) {+ return (+ <div className="min-h-screen flex items-center justify-center px-4">+ <div className="text-center max-w-md">+ <h1 className="text-content font-medium mb-2">数据源不存在</h1>+ <p className="text-sm text-muted mb-4">+ 该视频来自数据源「{sourceKey}」,但它可能已被删除。请在设置中重新添加后重试。+ </p>+ <Link href="/" className="btn-primary">返回首页</Link>+ </div>+ </div>+ );+ }++ return (+ <div className="min-h-screen flex flex-col">+ <header className="sticky top-0 z-40 bg-surface/90 backdrop-blur border-b border-line">+ <div className="max-w-7xl mx-auto px-4 h-14 flex items-center gap-3">+ <BackButton />+ <div className="min-w-0">+ <h1 className="text-sm font-medium text-content truncate">{videoTitle}</h1>+ <p className="text-xs text-faint">+ {source.name}+ {episodes.length > 0 && ` · 第 ${currentIndex + 1}/${episodes.length} 集`}+ </p>+ </div>+ <div className="ml-auto flex items-center gap-2">+ <button className="btn-ghost !py-1.5 text-xs" onClick={() => setSwitchOpen(true)}>+ 切换资源+ </button>+ </div>+ </div>+ </header>++ <main className="flex-1 max-w-7xl w-full mx-auto px-4 py-4">+ <div className="grid grid-cols-1 lg:grid-cols-[1fr_300px] gap-4">+ <div>+ <div className="aspect-video bg-black rounded-lg overflow-hidden">+ {currentUrl ? (+ <PlayerShell+ url={currentUrl}+ title={videoTitle}+ adFilter={store.adFilter}+ autoplayNext={store.autoplayNext}+ getRestorePosition={getRestorePosition}+ onTimeUpdate={handleTimeUpdate}+ onPause={handlePause}+ onEnded={handleEnded}+ />+ ) : (+ <div className="w-full h-full flex items-center justify-center">+ {detailQuery.isLoading ? (+ <div className="h-9 w-9 rounded-full border-4 border-line border-t-accent animate-spin" />+ ) : (+ <p className="text-faint text-sm">+ {detailQuery.isError ? '视频加载失败,请尝试其他资源' : '无可用播放地址'}+ </p>+ )}+ </div>+ )}+ </div>++ {/* 操作栏 */}+ <div className="flex flex-wrap items-center gap-2 mt-3">+ <button+ className="btn-ghost !py-1.5 text-xs"+ disabled={currentIndex <= 0}+ onClick={() => goEpisode(currentIndex - 1)}+ >+ 上一集+ </button>+ <button+ className="btn-ghost !py-1.5 text-xs"+ disabled={episodes.length === 0 || currentIndex >= episodes.length - 1}+ onClick={() => goEpisode(currentIndex + 1)}+ >+ 下一集+ </button>+ <button className="btn-ghost !py-1.5 text-xs" onClick={() => setReversed((v) => !v)}>+ {reversed ? '正序排列' : '倒序排列'}+ </button>+ <label className="flex items-center gap-1.5 text-xs text-muted ml-auto cursor-pointer">+ <input+ type="checkbox"+ className="h-3.5 w-3.5 accent-[#2563eb]"+ checked={store.autoplayNext}+ onChange={(e) => store.updateSettings({ autoplayNext: e.target.checked })}+ />+ 自动连播+ </label>+ </div>+ </div>++ {/* 剧集侧栏 */}+ <aside className="bg-surface-raised rounded-lg p-3 h-fit">+ <div className="flex items-center justify-between mb-2.5">+ <h2 className="text-sm font-semibold text-content">+ 剧集列表{episodes.length > 0 && `(${episodes.length})`}+ </h2>+ </div>+ {episodes.length === 0 ? (+ <p className="text-center text-xs text-faint py-8">+ {detailQuery.isLoading ? '加载中...' : detailQuery.isError ? '获取剧集失败' : '暂无剧集信息'}+ </p>+ ) : (+ <div className="grid grid-cols-5 lg:grid-cols-4 gap-1.5 max-h-[65vh] overflow-y-auto scrollbar-thin pr-1">+ {orderedEpisodes.map((realIndex) => (+ <EpisodeButton+ key={realIndex}+ index={realIndex}+ active={realIndex === currentIndex}+ onClick={() => goEpisode(realIndex)}+ />+ ))}+ </div>+ )}+ <p className="hidden md:block text-[10px] text-faint mt-3 leading-relaxed">+ 快捷键:空格 播放/暂停 · ←/→ 快退/快进 5s · ↑/↓ 音量 · F 全屏 · Alt+←/→ 切换集数+ </p>+ </aside>+ </div>+ </main>++ {switchOpen && (+ <SwitchSourceModal+ currentTitle={videoTitle}+ currentSourceKey={sourceKey}+ currentVodId={vodId}+ currentIndex={currentIndex}+ onClose={() => setSwitchOpen(false)}+ />+ )}+ </div>+ );+}++/** 集数按钮:激活时自动滚动进可视区(长剧列表) */+function EpisodeButton({ index, active, onClick }: { index: number; active: boolean; onClick: () => void }) {+ const ref = useRef<HTMLButtonElement>(null);++ useEffect(() => {+ if (active) ref.current?.scrollIntoView({ block: 'nearest' });+ }, [active]);++ return (+ <button+ ref={ref}+ className={cn('btn !px-1 text-xs !py-1.5', active ? 'episode-active' : 'btn-ghost')}+ onClick={onClick}+ >+ {index + 1}+ </button>+ );+}++function BackButton() {+ const router = useRouter();+ return (+ <button+ className="p-2 -ml-2 rounded-md text-muted hover:text-content hover:bg-surface-hover transition-colors"+ onClick={() => {+ if (window.history.length > 1) router.back();+ else router.push('/');+ }}+ aria-label="返回"+ >+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />+ </svg>+ </button>+ );+}diff --git a/libretv-next/src/components/auth.tsx b/libretv-next/src/components/auth.tsxnew file mode 100644index 0000000..dc42529--- /dev/null+++ b/libretv-next/src/components/auth.tsx@@ -0,0 +1,191 @@+'use client';++import { createContext, useCallback, useContext, useEffect, useRef, useState, type ReactNode } from 'react';+import { useQueryClient } from '@tanstack/react-query';+import { api, onUnauthorized } from '@/lib/client-api';+import { useToast } from './toast';++/**+ * 认证上下文:+ * - 页面加载时查询 /api/status 判断会话有效性;+ * - 任何 API 返回 401/503 时全局打开登录框(客户端 API 层统一触发,不再散落检查)。+ */++type SetupRequired = boolean;++interface AuthContextValue {+ checked: boolean;+ verified: boolean;+ /** 服务器未设置 PASSWORD,需要管理员配置 */+ setupRequired: SetupRequired;+ openLogin: () => void;+ logout: () => Promise<void>;+}++const AuthContext = createContext<AuthContextValue>({+ checked: false,+ verified: false,+ setupRequired: false,+ openLogin: () => {},+ logout: async () => {},+});++export function useAuth(): AuthContextValue {+ return useContext(AuthContext);+}++export function AuthProvider({ children }: { children: ReactNode }) {+ const [checked, setChecked] = useState(false);+ const [verified, setVerified] = useState(false);+ const [setupRequired, setSetupRequired] = useState(false);+ const [modalOpen, setModalOpen] = useState(false);+ const { toast } = useToast();+ const queryClient = useQueryClient();++ useEffect(() => {+ api+ .status()+ .then((s) => {+ setVerified(s.verified);+ setSetupRequired(!s.passwordRequired);+ setChecked(true);+ })+ .catch(() => setChecked(true));+ }, []);++ useEffect(+ () =>+ onUnauthorized((event) => {+ const setup = (event as CustomEvent).detail === 'setup';+ setSetupRequired(setup);+ setVerified(false);+ setModalOpen(true);+ }),+ []+ );++ const openLogin = useCallback(() => setModalOpen(true), []);++ const logout = useCallback(async () => {+ try {+ await api.logout();+ } finally {+ setVerified(false);+ toast('已退出登录', 'info');+ }+ }, [toast]);++ const handleLoginSuccess = useCallback(() => {+ setVerified(true);+ setSetupRequired(false);+ setModalOpen(false);+ // 登录前以 401 失败的查询(如豆瓣推荐)需要重新拉取+ queryClient.invalidateQueries();+ toast('验证成功', 'success');+ }, [toast, queryClient]);++ return (+ <AuthContext.Provider value={{ checked, verified, setupRequired, openLogin, logout }}>+ {children}+ {modalOpen && (+ <LoginModal+ setupRequired={setupRequired}+ onSuccess={handleLoginSuccess}+ onClose={() => setModalOpen(false)}+ />+ )}+ </AuthContext.Provider>+ );+}++function LoginModal({+ setupRequired,+ onSuccess,+ onClose,+}: {+ setupRequired: boolean;+ onSuccess: () => void;+ onClose: () => void;+}) {+ const [password, setPassword] = useState('');+ const [error, setError] = useState('');+ const [loading, setLoading] = useState(false);+ const inputRef = useRef<HTMLInputElement>(null);+ const { toast } = useToast();++ useEffect(() => {+ inputRef.current?.focus();+ }, []);++ useEffect(() => {+ const handler = (e: KeyboardEvent) => {+ if (e.key === 'Escape') onClose();+ };+ window.addEventListener('keydown', handler);+ return () => window.removeEventListener('keydown', handler);+ }, [onClose]);++ const submit = async () => {+ if (!password.trim() || loading) return;+ setLoading(true);+ setError('');+ try {+ await api.login(password);+ onSuccess();+ } catch (err) {+ const msg = err instanceof Error ? err.message : '验证失败';+ setError(msg === '需要登录' ? '密码错误' : msg);+ setPassword('');+ inputRef.current?.focus();+ void toast;+ } finally {+ setLoading(false);+ }+ };++ return (+ <div+ className="fixed inset-0 z-[95] flex items-center justify-center bg-black/80 animate-fade-in"+ onClick={(e) => {+ if (e.target === e.currentTarget) onClose();+ }}+ >+ <div className="bg-surface-raised rounded-xl p-6 w-full max-w-sm mx-4 shadow-2xl">+ {setupRequired ? (+ <>+ <h2 className="text-lg font-semibold text-content mb-3">需要配置密码</h2>+ <p className="text-sm text-muted leading-relaxed">+ 为确保安全,必须设置 <code className="text-accent">PASSWORD</code> 环境变量才能使用本服务。+ 请联系管理员在部署配置中添加该变量后重启服务。+ </p>+ </>+ ) : (+ <>+ <h2 className="text-lg font-semibold text-content mb-1">访问验证</h2>+ <p className="text-sm text-muted mb-4">请输入密码继续访问</p>+ <form+ onSubmit={(e) => {+ e.preventDefault();+ submit();+ }}+ >+ <input+ ref={inputRef}+ type="password"+ value={password}+ onChange={(e) => setPassword(e.target.value)}+ className="input w-full"+ placeholder="密码"+ autoComplete="current-password"+ />+ {error && <p className="mt-2 text-sm text-red-400">{error}</p>}+ <button type="submit" className="btn-primary w-full mt-4" disabled={loading || !password.trim()}>+ {loading ? '验证中...' : '进入'}+ </button>+ </form>+ </>+ )}+ </div>+ </div>+ );+}diff --git a/libretv-next/src/components/detail-modal.tsx b/libretv-next/src/components/detail-modal.tsxnew file mode 100644index 0000000..03eb178--- /dev/null+++ b/libretv-next/src/components/detail-modal.tsx@@ -0,0 +1,235 @@+'use client';++import { useEffect, useRef, useState } from 'react';+import { useRouter } from 'next/navigation';+import { api } from '@/lib/client-api';+import type { SearchResultItem, VideoDetail } from '@/lib/types';+import { buildImageUrl, buildWatchUrl } from '@/lib/utils';+import { useAppStore, resolveSource } from '@/lib/store';+import { useToast } from './toast';+import { cn } from '@/lib/utils';+import { addSearchHistory } from '@/lib/db';++/**+ * 详情弹窗:剧集列表 + 排序 + 复制链接。+ * 剧集点击 → /watch 路由(URL 携带定位参数,可分享、可后退)。+ */++export function DetailModal({ item, onClose }: { item: SearchResultItem | null; onClose: () => void }) {+ const store = useAppStore();+ const router = useRouter();+ const { toast } = useToast();+ const [detail, setDetail] = useState<VideoDetail | null>(null);+ const [loading, setLoading] = useState(false);+ const [error, setError] = useState('');+ const [reversed, setReversed] = useState(false);+ const [posterFailed, setPosterFailed] = useState(false);+ const abortRef = useRef<AbortController | null>(null);+ const poster = buildImageUrl(item?.pic, store.imageProxyMode, store.customImageProxy);++ useEffect(() => setPosterFailed(false), [poster]);++ // 弹窗打开期间锁定背景滚动+ useEffect(() => {+ if (!item) return;+ const prev = document.body.style.overflow;+ document.body.style.overflow = 'hidden';+ return () => {+ document.body.style.overflow = prev;+ };+ }, [item]);++ useEffect(() => {+ if (!item) {+ setDetail(null);+ setError('');+ return;+ }+ const source = resolveSource(store, item.sourceKey, {+ url: item.sourceUrl,+ name: item.sourceName,+ });+ if (!source) {+ setError('数据源配置不存在(可能已被删除),请在设置中重新添加');+ return;+ }+ setLoading(true);+ setError('');+ abortRef.current?.abort();+ const controller = new AbortController();+ abortRef.current = controller;+ api+ .detail(item.vodId, source, controller.signal)+ .then((d) => setDetail(d))+ .catch((err) => {+ if (err instanceof DOMException && err.name === 'AbortError') return;+ setError(err instanceof Error ? err.message : '获取详情失败');+ })+ .finally(() => setLoading(false));+ return () => controller.abort();+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [item]);++ useEffect(() => {+ if (!item) return;+ const handler = (e: KeyboardEvent) => {+ if (e.key === 'Escape') onClose();+ };+ window.addEventListener('keydown', handler);+ return () => window.removeEventListener('keydown', handler);+ }, [item, onClose]);++ if (!item) return null;++ const episodes = detail ? (reversed ? [...detail.episodes].reverse() : detail.episodes) : [];+ const info = detail?.videoInfo;++ const play = (index: number) => {+ if (!detail || !detail.episodes[index]) return;+ addSearchHistory(item.name).catch(() => {});+ router.push(+ buildWatchUrl({+ sourceKey: item.sourceKey,+ vodId: item.vodId,+ index,+ title: item.name,+ sourceUrl: item.sourceUrl,+ })+ );+ };++ const copyLinks = async () => {+ if (!detail) return;+ try {+ await navigator.clipboard.writeText(detail.episodes.join('\n'));+ toast('播放链接已复制', 'success');+ } catch {+ toast('复制失败,请检查浏览器权限', 'error');+ }+ };++ const metaRows = [+ info?.typeName && ['类型', info.typeName],+ info?.year && ['年份', info.year],+ info?.area && ['地区', info.area],+ info?.director && ['导演', info.director],+ info?.actor && ['主演', info.actor],+ info?.remarks && ['备注', info.remarks],+ ].filter(Boolean) as [string, string][];++ return (+ <div+ className="fixed inset-0 z-[60] flex items-start justify-center overflow-y-auto bg-black/80 py-10 px-4 animate-fade-in"+ onClick={(e) => {+ if (e.target === e.currentTarget) onClose();+ }}+ >+ <div className="bg-surface-raised rounded-xl w-full max-w-3xl shadow-2xl animate-slide-up" role="dialog" aria-modal>+ <div className="flex items-start justify-between gap-4 p-5 pb-3 border-b border-line">+ <div className="min-w-0">+ <h2 className="text-lg font-semibold text-content break-words">{item.name}</h2>+ <span className="text-sm text-faint">{item.sourceName}</span>+ </div>+ <button+ className="p-1.5 rounded-md text-muted hover:text-content hover:bg-surface-hover shrink-0"+ onClick={onClose}+ aria-label="关闭"+ >+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />+ </svg>+ </button>+ </div>++ <div className="p-5 pt-4">+ {loading && (+ <div className="flex flex-col items-center py-10 gap-3">+ <div className="h-8 w-8 rounded-full border-4 border-line border-t-accent animate-spin" />+ <p className="text-sm text-muted">正在获取剧集信息...</p>+ </div>+ )}++ {!loading && error && (+ <div className="text-center py-8">+ <div className="text-red-400 mb-1.5">❌ 获取失败</div>+ <div className="text-sm text-faint">{error}</div>+ </div>+ )}++ {!loading && !error && detail && (+ <>+ <div className="flex flex-col sm:flex-row gap-4 mb-4">+ {poster && !posterFailed && (+ // eslint-disable-next-line @next/next/no-img-element+ <img+ src={poster}+ alt={item.name}+ className="w-24 sm:w-32 aspect-[2/3] object-cover rounded-lg bg-chip shrink-0 self-center sm:self-start"+ onError={() => setPosterFailed(true)}+ />+ )}+ <div className="min-w-0 space-y-3">+ {metaRows.length > 0 && (+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-1.5 text-sm">+ {metaRows.map(([k, v]) => (+ <div key={k} className="truncate">+ <span className="text-faint">{k}:</span>{' '}+ <span className="text-content">{v}</span>+ </div>+ ))}+ </div>+ )}+ {info?.desc && (+ <p className="text-sm text-muted leading-relaxed line-clamp-3">{info.desc}</p>+ )}+ </div>+ </div>++ {episodes.length > 0 ? (+ <>+ <div className="flex flex-wrap items-center justify-between gap-2 mb-3">+ <div className="flex items-center gap-2">+ <button+ className="btn-ghost !py-1.5 text-xs"+ onClick={() => setReversed((v) => !v)}+ aria-label={reversed ? '切换为正序' : '切换为倒序'}+ >+ <svg className={cn('w-3.5 h-3.5 transition-transform', reversed && 'rotate-180')} fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 14l-7 7m0 0l-7-7m7 7V3" />+ </svg>+ {reversed ? '正序排列' : '倒序排列'}+ </button>+ <span className="text-sm text-faint">共 {episodes.length} 集</span>+ </div>+ <button className="btn-primary !py-1.5 text-xs" onClick={copyLinks}>+ 复制链接+ </button>+ </div>+ <div className="grid grid-cols-3 sm:grid-cols-5 md:grid-cols-7 gap-2 max-h-[40vh] overflow-y-auto scrollbar-thin pr-1">+ {episodes.map((_, i) => {+ const realIndex = reversed ? detail.episodes.length - 1 - i : i;+ return (+ <button+ key={realIndex}+ className="btn-ghost !px-1 text-center"+ onClick={() => play(realIndex)}+ >+ {realIndex + 1}+ </button>+ );+ })}+ </div>+ </>+ ) : (+ <div className="text-center py-8">+ <div className="text-red-400 mb-1.5">❌ 未找到播放资源</div>+ <div className="text-sm text-faint">该视频可能暂时无法播放,请尝试其他视频</div>+ </div>+ )}+ </>+ )}+ </div>+ </div>+ </div>+ );+}diff --git a/libretv-next/src/components/douban-section.tsx b/libretv-next/src/components/douban-section.tsxnew file mode 100644index 0000000..3a7fed4--- /dev/null+++ b/libretv-next/src/components/douban-section.tsx@@ -0,0 +1,112 @@+'use client';++import { useState } from 'react';+import { useQuery } from '@tanstack/react-query';+import { api } from '@/lib/client-api';+import { DoubanCard } from './video-card';+import { useAppStore } from '@/lib/store';+import { cn } from '@/lib/utils';++const MOVIE_TAGS = ['热门', '最新', '经典', '豆瓣高分', '冷门佳片', '华语', '欧美', '韩国', '日本', '动画'];+const TV_TAGS = ['热门', '美剧', '英剧', '韩剧', '日剧', '国产剧', '港剧', '日本动画', '综艺', '纪录片'];++/** 豆瓣推荐区:影视切换 + 标签筛选 + 分页加载 */+export function DoubanSection({ onPick }: { onPick: (title: string) => void }) {+ const doubanEnabled = useAppStore((s) => s.doubanEnabled);+ const [type, setType] = useState<'movie' | 'tv'>('movie');+ const [tag, setTag] = useState('热门');+ const [visibleCount, setVisibleCount] = useState(25);++ const query = useQuery({+ queryKey: ['douban', type, tag],+ queryFn: ({ signal }) => api.douban(type, tag, 0, 50, signal),+ });++ if (!doubanEnabled) return null;++ const tags = type === 'movie' ? MOVIE_TAGS : TV_TAGS;+ const items = query.data?.items ?? [];+ const shown = items.slice(0, visibleCount);++ const switchType = (t: 'movie' | 'tv') => {+ if (t === type) return;+ setType(t);+ setTag(t === 'movie' ? '热门' : '热门');+ setVisibleCount(25);+ };++ return (+ <section aria-label="豆瓣推荐">+ <div className="flex items-center justify-between mb-3">+ <div className="flex items-center gap-2">+ <div className="flex bg-chip rounded-lg p-0.5">+ <TypeButton active={type === 'movie'} onClick={() => switchType('movie')}>+ 电影+ </TypeButton>+ <TypeButton active={type === 'tv'} onClick={() => switchType('tv')}>+ 剧集+ </TypeButton>+ </div>+ </div>+ </div>++ <div className="flex flex-wrap gap-1.5 mb-4">+ {tags.map((t) => (+ <button+ key={t}+ className={cn(+ 'px-2.5 py-1 rounded-full text-xs transition-colors',+ t === tag ? 'bg-accent text-white' : 'bg-chip text-muted hover:text-content hover:bg-hover'+ )}+ onClick={() => {+ setTag(t);+ setVisibleCount(25);+ }}+ >+ {t}+ </button>+ ))}+ </div>++ {query.isError ? (+ <p className="text-center text-sm text-faint py-8">豆瓣推荐加载失败,可稍后重试或在设置中关闭</p>+ ) : query.isLoading ? (+ <div className="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 gap-2.5">+ {Array.from({ length: 16 }).map((_, i) => (+ <div key={i}>+ <div className="aspect-[2/3] rounded-lg bg-chip animate-pulse" />+ <div className="h-3 mt-2 rounded bg-chip animate-pulse" />+ </div>+ ))}+ </div>+ ) : (+ <>+ <div className="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 gap-2.5">+ {shown.map((item) => (+ <DoubanCard key={item.id} item={item} onClick={() => onPick(item.title)} />+ ))}+ </div>+ {visibleCount < items.length && (+ <div className="text-center mt-4">+ <button className="btn-ghost" onClick={() => setVisibleCount((v) => v + 25)}>+ 加载更多+ </button>+ </div>+ )}+ </>+ )}+ </section>+ );+}++function TypeButton({ active, onClick, children }: { active: boolean; onClick: () => void; children: React.ReactNode }) {+ return (+ <button+ className={cn('px-3.5 py-1.5 rounded-md text-sm transition-colors', active ? 'bg-accent text-white' : 'text-muted hover:text-content')}+ onClick={onClick}+ aria-pressed={active}+ >+ {children}+ </button>+ );+}diff --git a/libretv-next/src/components/header.tsx b/libretv-next/src/components/header.tsxnew file mode 100644index 0000000..4073214--- /dev/null+++ b/libretv-next/src/components/header.tsx@@ -0,0 +1,154 @@+'use client';++import Link from 'next/link';+import { useEffect, useRef, useState } from 'react';+import { usePathname, useRouter } from 'next/navigation';+import { useAppStore } from '@/lib/store';+import { useAuth } from './auth';+import { ThemeToggle } from './theme';+import { SourceManagerDrawer } from './source-manager';+import { HistoryPanel } from './history-panel';+import { cn } from '@/lib/utils';++/** 顶部导航:Logo、搜索框(首页外)、历史、设置 */+export function Header({ showSearch = false }: { showSearch?: boolean }) {+ const router = useRouter();+ const pathname = usePathname();+ const [settingsOpen, setSettingsOpen] = useState(false);+ const [historyOpen, setHistoryOpen] = useState(false);+ const [query, setQuery] = useState('');++ return (+ <>+ <header className="sticky top-0 z-40 bg-surface/90 backdrop-blur border-b border-line">+ <div className="max-w-6xl mx-auto px-4 h-14 flex items-center gap-3">+ <Link href="/" className="flex items-center gap-2 shrink-0">+ <span className="text-lg font-bold text-accent">LibreTV</span>+ </Link>++ {showSearch && (+ <form+ className="flex-1 max-w-xl hidden sm:block"+ onSubmit={(e) => {+ e.preventDefault();+ if (query.trim()) router.push(`/?s=${encodeURIComponent(query.trim())}`);+ }}+ >+ <input+ className="input w-full h-9"+ placeholder="搜索影片..."+ value={query}+ onChange={(e) => setQuery(e.target.value)}+ />+ </form>+ )}++ <div className="flex-1 sm:hidden" />++ <nav className="flex items-center gap-1 ml-auto">+ <HeaderLink href="/about" active={pathname === '/about'}>+ 关于+ </HeaderLink>+ <ThemeToggle />+ <IconButton label="观看历史" onClick={() => setHistoryOpen(true)}>+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />+ </svg>+ </IconButton>+ <IconButton label="设置" onClick={() => setSettingsOpen(true)}>+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />+ </svg>+ </IconButton>+ </nav>+ </div>+ </header>++ <SourceManagerDrawer open={settingsOpen} onClose={() => setSettingsOpen(false)} />+ <HistoryPanel open={historyOpen} onClose={() => setHistoryOpen(false)} />+ </>+ );+}++function HeaderLink({ href, active, children }: { href: string; active: boolean; children: React.ReactNode }) {+ return (+ <Link+ href={href}+ className={cn(+ 'px-2.5 py-1.5 rounded-md text-sm transition-colors',+ active ? 'text-content bg-surface-hover' : 'text-muted hover:text-content'+ )}+ >+ {children}+ </Link>+ );+}++function IconButton({ label, onClick, children }: { label: string; onClick: () => void; children: React.ReactNode }) {+ return (+ <button+ className="p-2 rounded-md text-muted hover:text-content hover:bg-surface-hover transition-colors"+ title={label}+ aria-label={label}+ onClick={onClick}+ >+ {children}+ </button>+ );+}++/** 面板通用骨架:右侧抽屉 */+export function Drawer({+ open,+ onClose,+ title,+ children,+ width = 'max-w-md',+}: {+ open: boolean;+ onClose: () => void;+ title: string;+ children: React.ReactNode;+ width?: string;+}) {+ const ref = useRef<HTMLDivElement>(null);+ useEffect(() => {+ if (!open) return;+ const handler = (e: KeyboardEvent) => {+ if (e.key === 'Escape') onClose();+ };+ window.addEventListener('keydown', handler);+ return () => window.removeEventListener('keydown', handler);+ }, [open, onClose]);++ if (!open) return null;+ return (+ <div className="fixed inset-0 z-50">+ <div className="absolute inset-0 bg-black/60 animate-fade-in" onClick={onClose} />+ <div+ ref={ref}+ className={cn(+ 'absolute right-0 top-0 h-full w-full bg-surface-raised border-l border-line overflow-y-auto scrollbar-thin animate-slide-up',+ width+ )}+ role="dialog"+ aria-label={title}+ >+ <div className="sticky top-0 bg-surface-raised px-4 py-3.5 border-b border-line flex items-center justify-between z-10">+ <h2 className="font-semibold text-content">{title}</h2>+ <button+ className="p-1.5 rounded-md text-muted hover:text-content hover:bg-surface-hover"+ onClick={onClose}+ aria-label="关闭"+ >+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />+ </svg>+ </button>+ </div>+ <div className="p-4">{children}</div>+ </div>+ </div>+ );+}diff --git a/libretv-next/src/components/history-panel.tsx b/libretv-next/src/components/history-panel.tsxnew file mode 100644index 0000000..0d0489a--- /dev/null+++ b/libretv-next/src/components/history-panel.tsx@@ -0,0 +1,128 @@+'use client';++import { useState } from 'react';+import { useLiveQuery } from 'dexie-react-hooks';+import Link from 'next/link';+import { Drawer } from './header';+import { db, clearAllHistory, removeHistory, upsertHistory, type HistoryEntry } from '@/lib/db';+import { buildWatchUrl, buildImageUrl, cn, formatRelativeTime, formatTime } from '@/lib/utils';+import { useToast } from './toast';+import { resolveSource, useAppStore } from '@/lib/store';++/**+ * 观看历史面板(IndexedDB 实时查询)。+ * 与旧版的区别:播放前按需重新拉取剧集详情,不再依赖历史记录里冗余存储的全集 URL。+ */++export function HistoryPanel({ open, onClose }: { open: boolean; onClose: () => void }) {+ const history = useLiveQuery(() => db.history.orderBy('timestamp').reverse().limit(50).toArray(), [open]);+ const { toast } = useToast();++ return (+ <Drawer open={open} onClose={onClose} title="观看历史" width="max-w-lg">+ {!history ? (+ <p className="text-center text-faint py-8 text-sm">加载中...</p>+ ) : history.length === 0 ? (+ <p className="text-center text-faint py-8 text-sm">暂无观看记录</p>+ ) : (+ <>+ <div className="flex justify-end mb-2">+ <button+ className="text-xs text-faint hover:text-red-400 transition-colors"+ onClick={() => {+ clearAllHistory().then(() => toast('观看历史已清空', 'success'));+ }}+ >+ 清空历史+ </button>+ </div>+ <ul className="space-y-2">+ {history.map((item) => (+ <HistoryItem key={`${item.sourceKey}_${item.vodId}`} item={item} />+ ))}+ </ul>+ </>+ )}+ </Drawer>+ );+}++function HistoryItem({ item }: { item: HistoryEntry }) {+ const store = useAppStore();+ const { toast } = useToast();+ const [imgFailed, setImgFailed] = useState(false);+ const pic = buildImageUrl(item.pic, store.imageProxyMode, store.customImageProxy);++ const hasPercent =+ item.playbackPosition > 10 && item.duration > 0 && item.playbackPosition < item.duration * 0.95;+ const percent = hasPercent ? Math.round((item.playbackPosition / item.duration) * 100) : 0;++ const href = buildWatchUrl({+ sourceKey: item.sourceKey,+ vodId: item.vodId,+ index: item.episodeIndex,+ title: item.title,+ sourceUrl: resolveSource(store, item.sourceKey)?.url,+ detail: resolveSource(store, item.sourceKey)?.detail,+ });++ return (+ <li className="relative group">+ <Link+ href={href}+ onClick={(e) => {+ // 点击即同步一次时间戳,置顶最近观看+ upsertHistory({ ...item, timestamp: Date.now() }).catch(() => {});+ }}+ className="block bg-card hover:bg-surface-hover rounded-lg p-3 pr-10 transition-colors"+ >+ <div className="flex items-center gap-3">+ {pic && !imgFailed ? (+ // eslint-disable-next-line @next/next/no-img-element+ <img+ src={pic}+ alt=""+ className="w-10 h-14 object-cover rounded bg-chip"+ loading="lazy"+ onError={() => setImgFailed(true)}+ />+ ) : (+ <div className="w-10 h-14 rounded bg-chip flex items-center justify-center shrink-0">+ <svg className="w-4 h-4 text-faint" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M7 4v16m10-16v16M7 8h10M7 12h10" />+ </svg>+ </div>+ )}+ <div className="min-w-0 flex-1">+ <div className="text-sm font-medium text-content truncate">{item.title}</div>+ <div className="text-xs text-faint mt-0.5 flex items-center gap-1.5 flex-wrap">+ {item.totalEpisodes > 0 && <span>第 {item.episodeIndex + 1}/{item.totalEpisodes} 集</span>}+ {hasPercent && <span>· {formatTime(item.playbackPosition)}</span>}+ <span>· {formatRelativeTime(item.timestamp)}</span>+ </div>+ {hasPercent && (+ <div className="mt-1.5 h-1 bg-hover rounded-full overflow-hidden">+ <div className="h-full bg-accent" style={{ width: `${percent}%` }} />+ </div>+ )}+ </div>+ </div>+ </Link>+ <button+ className={cn(+ 'absolute right-2 top-2 p-1.5 rounded-full text-faint hover:text-red-400',+ 'opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity'+ )}+ aria-label="删除记录"+ title="删除记录"+ onClick={() => {+ removeHistory(item.sourceKey, item.vodId).then(() => toast('已删除该记录', 'success'));+ }}+ >+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />+ </svg>+ </button>+ </li>+ );+}diff --git a/libretv-next/src/components/player-shell.tsx b/libretv-next/src/components/player-shell.tsxnew file mode 100644index 0000000..989f127--- /dev/null+++ b/libretv-next/src/components/player-shell.tsx@@ -0,0 +1,368 @@+'use client';++import { useEffect, useRef, useState } from 'react';+import Artplayer from 'artplayer';+import Hls, { type HlsConfig } from 'hls.js';+import { filterAdsFromM3u8 } from '@/lib/m3u8';+import { formatTime } from '@/lib/utils';++/**+ * 播放器外壳:ArtPlayer + hls.js(旧版 player.js 的 React 化)。+ * 保留:广告分片过滤、自动连播回调、进度回调、快捷键、移动端长按倍速、错误恢复。+ * 移除:DOM 手工操作、watch.html 跳转链、localStorage 状态总线。+ */++// 广告过滤 loader:拦截 manifest/level 响应文本,剔除 DISCONTINUITY 广告片段+class CustomHlsJsLoader extends Hls.DefaultConfig.loader {+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ constructor(config: any) {+ super(config);+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ const load = this.load.bind(this);+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ this.load = function (context: any, config: any, callbacks: any) {+ if (context.type === 'manifest' || context.type === 'level') {+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ const onSuccess = callbacks.onSuccess;+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ callbacks.onSuccess = function (response: any, stats: any, ctx: any, networkDetails: any) {+ if (response.data && typeof response.data === 'string') {+ response.data = filterAdsFromM3u8(response.data);+ }+ return onSuccess(response, stats, ctx, networkDetails);+ };+ }+ load(context, config, callbacks);+ };+ }+}++interface PlayerShellProps {+ url: string;+ title: string;+ adFilter: boolean;+ autoplayNext: boolean;+ /** 进度恢复:优先 URL position,其次查询该回调(返回 0 表示无记录) */+ getRestorePosition?: () => number | Promise<number>;+ onTimeUpdate?: (position: number, duration: number) => void;+ onEnded?: () => void;+ onPause?: (position: number, duration: number) => void;+}++export function PlayerShell({+ url,+ title,+ adFilter,+ autoplayNext,+ getRestorePosition,+ onTimeUpdate,+ onEnded,+ onPause,+}: PlayerShellProps) {+ const containerRef = useRef<HTMLDivElement>(null);+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ const artRef = useRef<any>(null);+ const hlsRef = useRef<Hls | null>(null);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState('');+ const [hint, setHint] = useState('');+ const hintTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ // 用 ref 持有最新回调,避免重建播放器+ const cbs = useRef({ onTimeUpdate, onEnded, onPause, getRestorePosition });+ cbs.current = { onTimeUpdate, onEnded, onPause, getRestorePosition };+ const autoplayRef = useRef(autoplayNext);+ autoplayRef.current = autoplayNext;++ useEffect(() => {+ if (!containerRef.current || !url) return;+ setLoading(true);+ setError('');++ let disposed = false;+ let lastSave = 0;+ let playbackStarted = false;+ let errorCount = 0;++ const showHint = (text: string) => {+ setHint(text);+ if (hintTimerRef.current) clearTimeout(hintTimerRef.current);+ hintTimerRef.current = setTimeout(() => setHint(''), 2500);+ };++ const hlsConfig: Partial<HlsConfig> = {+ debug: false,+ enableWorker: true,+ backBufferLength: 90,+ maxBufferLength: 30,+ maxMaxBufferLength: 60,+ maxBufferSize: 30 * 1000 * 1000,+ maxBufferHole: 0.5,+ fragLoadingMaxRetry: 6,+ fragLoadingRetryDelay: 1000,+ manifestLoadingMaxRetry: 3,+ manifestLoadingRetryDelay: 1000,+ startLevel: -1,+ abrEwmaDefaultEstimate: 500_000,+ appendErrorMaxRetry: 5,+ };+ if (adFilter) hlsConfig.loader = CustomHlsJsLoader as unknown as HlsConfig['loader'];++ /**+ * 初始化 HLS。allowProxyFallback:直连致命网络错误(CORS/防盗链/分片被拒)时,+ * 自动改走同源 cookie 鉴权的 /api/proxy 重试一次。+ */+ const setupHls = (video: HTMLVideoElement, mediaUrl: string, allowProxyFallback: boolean) => {+ hlsRef.current?.destroy();+ const hls = new Hls(hlsConfig);+ hlsRef.current = hls;++ hls.loadSource(mediaUrl);+ hls.attachMedia(video);++ hls.on(Hls.Events.MANIFEST_PARSED, () => {+ video.play().catch(() => {});+ });+ hls.on(Hls.Events.FRAG_LOADED, () => setLoading(false));+ hls.on(Hls.Events.ERROR, (_evt, data) => {+ errorCount++;+ if (data.fatal && !playbackStarted) {+ switch (data.type) {+ case Hls.ErrorTypes.NETWORK_ERROR:+ if (+ allowProxyFallback &&+ !mediaUrl.startsWith('/api/proxy/') &&+ (errorCount >= 2 || data.details === 'manifestLoadError')+ ) {+ showHint('直连失败,改用代理重试...');+ setupHls(video, `/api/proxy/${encodeURIComponent(mediaUrl)}`, false);+ return;+ }+ hls.startLoad();+ break;+ case Hls.ErrorTypes.MEDIA_ERROR:+ hls.recoverMediaError();+ break;+ default:+ if (errorCount > 3) {+ setLoading(false);+ setError('视频加载失败,可能是格式不兼容或源不可用,请尝试其他视频源');+ }+ }+ }+ });+ };++ const art = new Artplayer({+ container: containerRef.current,+ url,+ type: 'm3u8',+ volume: 0.8,+ autoplay: true,+ pip: true,+ autoMini: true,+ screenshot: true,+ setting: true,+ playbackRate: true,+ aspectRatio: true,+ fullscreen: true,+ fullscreenWeb: true,+ miniProgressBar: true,+ mutex: true,+ backdrop: true,+ playsInline: true,+ airplay: true,+ hotkey: false,+ theme: '#23ade5',+ lang: navigator.language.toLowerCase().startsWith('zh') ? 'zh-cn' : 'en',+ moreVideoAttr: { crossOrigin: 'anonymous', playsInline: true },+ customType: {+ m3u8: (video: HTMLVideoElement, mediaUrl: string) => {+ setupHls(video, mediaUrl, true);+ },+ },+ });+ artRef.current = art;+ art.on('video:loadedmetadata', () => {+ // ArtPlayer 运行时支持 title 选项(类型定义未覆盖),用于界面标题展示+ try {+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ (art as any).title = title;+ } catch { /* 忽略 */ }+ });++ art.on('ready', () => {+ // 进度恢复+ const restore = async () => {+ const saved = (await cbs.current.getRestorePosition?.()) ?? 0;+ const duration = art.duration || 0;+ if (saved > 10 && duration > 0 && saved < duration - 2) {+ art.currentTime = saved;+ showHint(`已从 ${formatTime(saved)} 继续播放`);+ }+ };+ restore();+ });++ art.on('video:playing', () => {+ playbackStarted = true;+ setLoading(false);+ setError('');+ });+ art.on('video:loadedmetadata', () => setLoading(false));+ art.on('video:error', () => {+ setLoading(false);+ setError('视频播放失败,请尝试其他视频源');+ });+ art.on('video:timeupdate', () => {+ const now = Date.now();+ if (now - lastSave > 5000) {+ lastSave = now;+ cbs.current.onTimeUpdate?.(art.currentTime, art.duration);+ }+ });+ art.on('video:pause', () => {+ cbs.current.onPause?.(art.currentTime, art.duration);+ });+ art.on('video:ended', () => {+ cbs.current.onEnded?.();+ });++ // —— 键盘快捷键(旧版 hotkey:false + 自定义逻辑的移植) ——+ const shortcuts = (e: KeyboardEvent) => {+ const target = e.target as HTMLElement;+ if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') return;+ const current = artRef.current;+ if (!current) return;+ if (e.altKey && e.key === 'ArrowLeft') { e.preventDefault(); return; } // 由父层处理集数切换+ if (e.altKey && e.key === 'ArrowRight') { e.preventDefault(); return; }+ switch (e.key) {+ case 'ArrowLeft':+ if (current.currentTime > 5) { current.currentTime -= 5; showHint('快退 5s'); e.preventDefault(); }+ break;+ case 'ArrowRight':+ if (current.duration - current.currentTime > 5) { current.currentTime += 5; showHint('快进 5s'); e.preventDefault(); }+ break;+ case 'ArrowUp':+ if (current.volume < 1) { current.volume = Math.min(1, current.volume + 0.1); showHint(`音量 ${Math.round(current.volume * 100)}%`); e.preventDefault(); }+ break;+ case 'ArrowDown':+ if (current.volume > 0) { current.volume = Math.max(0, current.volume - 0.1); showHint(`音量 ${Math.round(current.volume * 100)}%`); e.preventDefault(); }+ break;+ case ' ':+ current.toggle(); showHint('播放/暂停'); e.preventDefault();+ break;+ case 'f': case 'F':+ current.fullscreen = !current.fullscreen; e.preventDefault();+ break;+ }+ };+ document.addEventListener('keydown', shortcuts);++ // —— 移动端长按 3 倍速 ——+ let longPressTimer: ReturnType<typeof setTimeout> | null = null;+ let isLongPress = false;+ let originalRate = 1.0;+ const el = containerRef.current;++ const onTouchStart = (e: TouchEvent) => {+ if (art.video?.paused) return;+ originalRate = art.video.playbackRate;+ longPressTimer = setTimeout(() => {+ if (art.video?.paused) return;+ art.video.playbackRate = 3.0;+ isLongPress = true;+ showHint('3 倍速');+ e.preventDefault();+ }, 500);+ };+ const onTouchEnd = () => {+ if (longPressTimer) { clearTimeout(longPressTimer); longPressTimer = null; }+ if (isLongPress) {+ art.video.playbackRate = originalRate;+ isLongPress = false;+ showHint(`${originalRate} 倍速`);+ }+ };+ const onTouchMove = (e: TouchEvent) => {+ if (isLongPress) e.preventDefault();+ };+ el?.addEventListener('touchstart', onTouchStart, { passive: false });+ el?.addEventListener('touchend', onTouchEnd);+ el?.addEventListener('touchcancel', onTouchEnd);+ el?.addEventListener('touchmove', onTouchMove, { passive: false });++ // 双击全屏+ art.on('video:dblclick', () => {+ art.fullscreen = !art.fullscreen;+ });++ // 卸载与页面隐藏时保存进度+ const saveOnHide = () => {+ if (document.visibilityState === 'hidden') {+ cbs.current.onPause?.(art.currentTime, art.duration);+ }+ };+ document.addEventListener('visibilitychange', saveOnHide);++ return () => {+ disposed = true;+ void disposed;+ // 卸载前刷一次最终进度,避免丢失最后几秒+ try {+ cbs.current.onPause?.(art.currentTime, art.duration);+ } catch { /* 忽略 */ }+ document.removeEventListener('keydown', shortcuts);+ document.removeEventListener('visibilitychange', saveOnHide);+ if (hintTimerRef.current) clearTimeout(hintTimerRef.current);+ el?.removeEventListener('touchstart', onTouchStart);+ el?.removeEventListener('touchend', onTouchEnd);+ el?.removeEventListener('touchcancel', onTouchEnd);+ el?.removeEventListener('touchmove', onTouchMove);+ hlsRef.current?.destroy();+ hlsRef.current = null;+ art.destroy();+ artRef.current = null;+ };+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [url, adFilter]);++ // 暴露实例给父组件做集数切换(换集时用 art.switch,避免整页重建)+ useEffect(() => {+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ (window as any).__libretv_player = artRef;+ return () => {+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ delete (window as any).__libretv_player;+ };+ }, []);++ return (+ <div className="relative w-full h-full">+ <div ref={containerRef} className="w-full h-full" />+ {loading && !error && (+ <div className="absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/60 pointer-events-none">+ <div className="h-9 w-9 rounded-full border-4 border-line border-t-accent animate-spin" />+ <p className="text-sm text-content">正在加载视频...</p>+ </div>+ )}+ {error && (+ <div className="absolute inset-0 flex flex-col items-center justify-center gap-2 bg-black/80">+ <p className="text-red-400 text-sm">{error}</p>+ <button className="btn-ghost text-xs" onClick={() => location.reload()}>+ 重新加载+ </button>+ </div>+ )}+ {hint && (+ <div className="absolute top-4 left-1/2 -translate-x-1/2 bg-black/70 text-white text-sm px-3 py-1.5 rounded-full pointer-events-none animate-fade-in">+ {hint}+ </div>+ )}+ {autoplayNext && !error && (+ <div className="absolute bottom-16 right-3 text-[10px] text-muted bg-black/50 px-2 py-0.5 rounded pointer-events-none">+ 自动连播已开启+ </div>+ )}+ </div>+ );+}diff --git a/libretv-next/src/components/providers.tsx b/libretv-next/src/components/providers.tsxnew file mode 100644index 0000000..f95da26--- /dev/null+++ b/libretv-next/src/components/providers.tsx@@ -0,0 +1,28 @@+'use client';++import { QueryClient, QueryClientProvider } from '@tanstack/react-query';+import { useState, type ReactNode } from 'react';+import { ToastProvider } from './toast';+import { AuthProvider } from './auth';+import { ThemeProvider } from './theme';++export function Providers({ children }: { children: ReactNode }) {+ const [queryClient] = useState(+ () =>+ new QueryClient({+ defaultOptions: {+ queries: { retry: 1, refetchOnWindowFocus: false, staleTime: 60_000 },+ },+ })+ );++ return (+ <QueryClientProvider client={queryClient}>+ <ThemeProvider>+ <ToastProvider>+ <AuthProvider>{children}</AuthProvider>+ </ToastProvider>+ </ThemeProvider>+ </QueryClientProvider>+ );+}diff --git a/libretv-next/src/components/source-manager.tsx b/libretv-next/src/components/source-manager.tsxnew file mode 100644index 0000000..cfad3e7--- /dev/null+++ b/libretv-next/src/components/source-manager.tsx@@ -0,0 +1,373 @@+'use client';++import { useEffect, useState } from 'react';+import { Drawer } from './header';+import { useAppStore } from '@/lib/store';+import { useToast } from './toast';+import { validateSourceUrl, cn } from '@/lib/utils';+import { exportConfig, importConfig } from '@/lib/db';+import { useAuth } from './auth';++/**+ * 设置抽屉:数据源管理 + 播放/过滤选项 + 配置导入导出。+ * 替代旧版散落在设置面板里的各处 DOM 拼接逻辑。+ */++export function SourceManagerDrawer({ open, onClose }: { open: boolean; onClose: () => void }) {+ const store = useAppStore();+ const [editing, setEditing] = useState<string | null>(null);++ return (+ <Drawer open={open} onClose={onClose} title="设置">+ <section className="mb-6">+ <SectionTitle+ title="数据源"+ extra={+ <button className="btn-primary !py-1 !px-2.5 text-xs" onClick={() => setEditing('__new__')}>+ + 添加 API+ </button>+ }+ />+ <SourceForm+ visible={editing === '__new__'}+ onCancel={() => setEditing(null)}+ onSubmit={(data) => {+ store.addCustomApi(data);+ setEditing(null);+ }}+ />+ {store.customAPIs.length === 0 && editing !== '__new__' ? (+ <EmptySourceGuide onAdd={() => setEditing('__new__')} />+ ) : (+ <ul className="space-y-2">+ {store.customAPIs.map((api) => (+ <li key={api.key} className="bg-card rounded-lg p-3">+ {editing === api.key ? (+ <SourceForm+ visible+ initial={api}+ onCancel={() => setEditing(null)}+ onSubmit={(data) => {+ store.updateCustomApi(api.key, data);+ setEditing(null);+ }}+ />+ ) : (+ <div className="flex items-center gap-2">+ <input+ type="checkbox"+ className="h-4 w-4 accent-[#2563eb]"+ checked={store.selectedKeys.includes(api.key)}+ onChange={() => store.toggleSourceSelected(api.key)}+ aria-label={`选择 ${api.name}`}+ />+ <div className="flex-1 min-w-0">+ <div className="text-sm font-medium text-content truncate">+ {api.name}+ {api.isAdult && <span className="text-pink-400 text-xs ml-1">(18+)</span>}+ </div>+ <div className="text-xs text-faint truncate">{api.url}</div>+ </div>+ <button+ className="text-muted hover:text-accent text-xs px-1.5"+ onClick={() => setEditing(api.key)}+ aria-label="编辑"+ >+ ✎+ </button>+ <button+ className="text-muted hover:text-red-400 text-xs px-1.5"+ onClick={() => store.removeCustomApi(api.key)}+ aria-label="删除"+ >+ ✕+ </button>+ </div>+ )}+ </li>+ ))}+ </ul>+ )}+ </section>++ <section className="mb-6">+ <SectionTitle title="播放与过滤" />+ <div className="space-y-3">+ <ToggleRow+ label="成人内容过滤"+ description="过滤“伦理片”等分类的结果"+ checked={store.yellowFilter}+ onChange={(v) => store.updateSettings({ yellowFilter: v })}+ />+ <ToggleRow+ label="广告过滤"+ description="过滤 m3u8 中的广告分片"+ checked={store.adFilter}+ onChange={(v) => store.updateSettings({ adFilter: v })}+ />+ <ToggleRow+ label="自动连播"+ description="单集播放结束后自动播放下一集"+ checked={store.autoplayNext}+ onChange={(v) => store.updateSettings({ autoplayNext: v })}+ />+ <ToggleRow+ label="豆瓣推荐"+ description="在首页展示豆瓣热门影视"+ checked={store.doubanEnabled}+ onChange={(v) => store.updateSettings({ doubanEnabled: v })}+ />+ </div>+ </section>++ <section className="mb-6">+ <SectionTitle title="封面图加载" />+ <div className="space-y-2">+ <SelectRow+ label="加载方式"+ value={store.imageProxyMode}+ onChange={(v) => store.updateSettings({ imageProxyMode: v as 'direct' | 'proxy' | 'custom' })}+ options={[+ { value: 'direct', label: '直连(默认)' },+ { value: 'proxy', label: '内置代理' },+ { value: 'custom', label: '自定义代理' },+ ]}+ />+ {store.imageProxyMode === 'custom' && (+ <input+ className="input w-full"+ placeholder="代理模板,如 https://p.example.com/?url={url}"+ value={store.customImageProxy}+ onChange={(e) => store.updateSettings({ customImageProxy: e.target.value })}+ />+ )}+ <p className="text-xs text-faint">豆瓣封面在某些网络下直连会被拒绝,可切换为内置代理。</p>+ </div>+ </section>++ <section>+ <SectionTitle title="配置" />+ <ConfigIoButtons />+ </section>+ </Drawer>+ );+}++function SectionTitle({ title, extra }: { title: string; extra?: React.ReactNode }) {+ return (+ <div className="flex items-center justify-between mb-2.5">+ <h3 className="text-sm font-semibold text-content">{title}</h3>+ {extra}+ </div>+ );+}++function EmptySourceGuide({ onAdd }: { onAdd: () => void }) {+ return (+ <div className="border border-dashed border-line rounded-lg p-5 text-center">+ <p className="text-sm text-muted mb-1">还没有添加任何数据源</p>+ <p className="text-xs text-faint mb-3">添加一个 Apple CMS 采集站 API 即可开始搜索影片</p>+ <button className="btn-primary text-xs" onClick={onAdd}>+ 添加第一个数据源+ </button>+ </div>+ );+}++function SourceForm({+ visible,+ initial,+ onCancel,+ onSubmit,+}: {+ visible: boolean;+ initial?: { key: string; name: string; url: string; detail?: string; isAdult?: boolean };+ onCancel: () => void;+ onSubmit: (data: { name: string; url: string; detail?: string; isAdult?: boolean }) => void;+}) {+ const [name, setName] = useState(initial?.name ?? '');+ const [url, setUrl] = useState(initial?.url ?? '');+ const [detail, setDetail] = useState(initial?.detail ?? '');+ const [isAdult, setIsAdult] = useState(initial?.isAdult ?? false);+ const { toast } = useToast();++ useEffect(() => {+ if (visible) {+ setName(initial?.name ?? '');+ setUrl(initial?.url ?? '');+ setDetail(initial?.detail ?? '');+ setIsAdult(initial?.isAdult ?? false);+ }+ }, [visible, initial]);++ if (!visible) return null;++ const submit = () => {+ const n = name.trim();+ const u = url.trim().replace(/\/+$/, '');+ if (!n || !u) {+ toast('请输入 API 名称和链接', 'warning');+ return;+ }+ if (!validateSourceUrl(u)) {+ toast('API 链接需以 http:// 或 https:// 开头', 'warning');+ return;+ }+ onSubmit({ name: n, url: u, detail: detail.trim() || undefined, isAdult });+ };++ return (+ <div className="space-y-2 border border-line rounded-lg p-3 bg-chip">+ <input className="input w-full" placeholder="名称" value={name} onChange={(e) => setName(e.target.value)} />+ <input+ className="input w-full"+ placeholder="API 地址,如 https://example.com/api.php/provide/vod"+ value={url}+ onChange={(e) => setUrl(e.target.value)}+ />+ <input+ className="input w-full"+ placeholder="详情页地址(可选),如 https://example.com"+ value={detail}+ onChange={(e) => setDetail(e.target.value)}+ />+ <label className="flex items-center gap-2 text-xs text-muted">+ <input type="checkbox" className="h-3.5 w-3.5 accent-pink-500" checked={isAdult} onChange={(e) => setIsAdult(e.target.checked)} />+ 标记为成人内容源(受成人过滤控制)+ </label>+ <div className="flex gap-2 justify-end">+ <button className="btn-ghost !py-1 text-xs" onClick={onCancel}>+ 取消+ </button>+ <button className="btn-primary !py-1 text-xs" onClick={submit}>+ {initial ? '更新' : '添加'}+ </button>+ </div>+ </div>+ );+}++function ToggleRow({+ label,+ description,+ checked,+ onChange,+}: {+ label: string;+ description: string;+ checked: boolean;+ onChange: (v: boolean) => void;+}) {+ return (+ <div className="flex items-center justify-between gap-4">+ <div>+ <div className="text-sm text-content">{label}</div>+ <div className="text-xs text-faint">{description}</div>+ </div>+ <button+ role="switch"+ aria-checked={checked}+ aria-label={label}+ className={cn(+ 'relative h-6 w-11 rounded-full transition-colors shrink-0',+ checked ? 'bg-accent' : 'bg-line'+ )}+ onClick={() => onChange(!checked)}+ >+ <span+ className={cn(+ 'absolute top-0.5 h-5 w-5 rounded-full bg-white transition-transform',+ checked ? 'translate-x-[22px]' : 'translate-x-0.5'+ )}+ />+ </button>+ </div>+ );+}++function SelectRow({+ label,+ value,+ onChange,+ options,+}: {+ label: string;+ value: string;+ onChange: (v: string) => void;+ options: { value: string; label: string }[];+}) {+ return (+ <div className="flex items-center justify-between gap-4">+ <span className="text-sm text-content">{label}</span>+ <select+ className="input !py-1.5 !px-2 text-xs"+ value={value}+ onChange={(e) => onChange(e.target.value)}+ aria-label={label}+ >+ {options.map((o) => (+ <option key={o.value} value={o.value}>+ {o.label}+ </option>+ ))}+ </select>+ </div>+ );+}++function ConfigIoButtons() {+ const { toast } = useToast();+ const { verified, openLogin } = useAuth();++ const doExport = async () => {+ if (verified === false) {+ openLogin();+ return;+ }+ try {+ const json = await exportConfig();+ const blob = new Blob([json], { type: 'application/json' });+ const url = URL.createObjectURL(blob);+ const a = document.createElement('a');+ a.href = url;+ a.download = `LibreTV-Settings_${Date.now()}.json`;+ a.click();+ URL.revokeObjectURL(url);+ toast('配置已导出', 'success');+ } catch {+ toast('导出失败', 'error');+ }+ };++ const doImport = async (file: File) => {+ try {+ const content = await file.text();+ await importConfig(content);+ toast('配置导入成功,即将刷新页面', 'success');+ setTimeout(() => window.location.reload(), 1500);+ } catch (err) {+ toast(err instanceof Error ? err.message : '导入失败', 'error');+ }+ };++ return (+ <div className="flex gap-2">+ <button className="btn-ghost flex-1 text-xs" onClick={doExport}>+ 导出配置+ </button>+ <label className="btn-ghost flex-1 text-xs cursor-pointer">+ 导入配置+ <input+ type="file"+ accept=".json,application/json"+ className="hidden"+ onChange={(e) => {+ const f = e.target.files?.[0];+ if (f) doImport(f);+ e.target.value = '';+ }}+ />+ </label>+ </div>+ );+}diff --git a/libretv-next/src/components/switch-source.tsx b/libretv-next/src/components/switch-source.tsxnew file mode 100644index 0000000..46f0c4b--- /dev/null+++ b/libretv-next/src/components/switch-source.tsx@@ -0,0 +1,203 @@+'use client';++import { useEffect, useMemo, useState } from 'react';+import { useRouter } from 'next/navigation';+import { api } from '@/lib/client-api';+import type { SourceConfig, SearchResultItem, VideoDetail } from '@/lib/types';+import { buildImageUrl, buildWatchUrl, cn } from '@/lib/utils';+import { useAppStore, resolveSource } from '@/lib/store';+import { useToast } from './toast';++/**+ * 换源面板:跨源按标题搜索 → 匹配同名资源 → 并发测速(详情接口耗时)→ 按速度排序展示。+ * 切换时保留当前集数索引(旧版 switchToResource 逻辑的去 DOM 化重写)。+ */++interface Candidate {+ source: SourceConfig;+ result: SearchResultItem;+ ms?: number;+ ok?: boolean;+ episodes?: number;+}++export function SwitchSourceModal({+ currentTitle,+ currentSourceKey,+ currentVodId,+ currentIndex,+ onClose,+}: {+ currentTitle: string;+ currentSourceKey: string;+ currentVodId: string;+ currentIndex: number;+ onClose: () => void;+}) {+ const store = useAppStore();+ const router = useRouter();+ const { toast } = useToast();+ const [candidates, setCandidates] = useState<Candidate[]>([]);+ const [phase, setPhase] = useState<'searching' | 'testing' | 'done'>('searching');++ const sources = useMemo(+ () => store.selectedKeys.map((key) => resolveSource(store, key)).filter(Boolean) as SourceConfig[],+ [store]+ );++ useEffect(() => {+ // 弹窗打开期间锁定背景滚动+ const prev = document.body.style.overflow;+ document.body.style.overflow = 'hidden';+ return () => {+ document.body.style.overflow = prev;+ };+ }, []);++ useEffect(() => {+ let cancelled = false;++ (async () => {+ // 1) 并行搜索所有选中源+ setPhase('searching');+ try {+ const { list } = await api.search(currentTitle, sources, false);+ if (cancelled) return;++ // 每个源取完全同名结果,否则取第一个+ const matched: Candidate[] = [];+ for (const s of sources) {+ const hits = list.filter((r) => r.sourceKey === s.key);+ const exact = hits.find((r) => r.name === currentTitle) || hits[0];+ if (exact) matched.push({ source: s, result: exact });+ }++ // 2) 并发测速(详情接口耗时)并获取集数+ setPhase('testing');+ await Promise.all(+ matched.map(async (c) => {+ const r = await api.detailSpeed(c.result.vodId, c.source);+ if (cancelled) return;+ c.ok = r.ok;+ c.ms = r.ms;+ c.episodes = r.detail?.episodes.length ?? 0;+ })+ );+ if (cancelled) return;+ setCandidates(matched);+ setPhase('done');+ } catch (err) {+ if (!cancelled) {+ toast(err instanceof Error ? err.message : '换源搜索失败', 'error');+ setPhase('done');+ }+ }+ })();++ return () => {+ cancelled = true;+ };+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [currentTitle]);++ const sorted = [...candidates].sort((a, b) => {+ const aCurrent = a.source.key === currentSourceKey && String(a.result.vodId) === String(currentVodId);+ const bCurrent = b.source.key === currentSourceKey && String(b.result.vodId) === String(currentVodId);+ if (aCurrent !== bCurrent) return aCurrent ? -1 : 1;+ const msA = a.ok ? a.ms ?? 99_999 : 99_999;+ const msB = b.ok ? b.ms ?? 99_999 : 99_999;+ return msA - msB;+ });++ const switchTo = (c: Candidate) => {+ if (!c.episodes) {+ toast('该源无可用播放资源', 'warning');+ return;+ }+ const targetIndex = currentIndex < c.episodes ? currentIndex : 0;+ onClose(); // 先关闭面板,避免路由参数变化后弹窗残留旧数据+ router.push(+ buildWatchUrl({+ sourceKey: c.source.key,+ vodId: c.result.vodId,+ index: targetIndex,+ title: c.result.name || currentTitle,+ sourceUrl: c.source.url,+ detail: c.source.detail,+ })+ );+ };++ return (+ <div+ className="fixed inset-0 z-[65] flex items-start justify-center overflow-y-auto bg-black/80 py-10 px-4 animate-fade-in"+ onClick={(e) => {+ if (e.target === e.currentTarget) onClose();+ }}+ >+ <div className="bg-surface-raised rounded-xl w-full max-w-3xl shadow-2xl p-5 animate-slide-up" role="dialog" aria-modal>+ <div className="flex items-center justify-between mb-4">+ <div className="min-w-0">+ <h2 className="text-lg font-semibold text-content truncate">{currentTitle}</h2>+ <p className="text-xs text-faint">+ {phase === 'searching' ? '正在搜索各资源...' : phase === 'testing' ? '正在测试各资源速率...' : `共 ${sorted.length} 个可用资源`}+ </p>+ </div>+ <button className="p-1.5 rounded-md text-muted hover:text-content hover:bg-hover" onClick={onClose} aria-label="关闭">+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />+ </svg>+ </button>+ </div>++ {phase !== 'done' ? (+ <div className="flex flex-col items-center py-10 gap-3">+ <div className="h-8 w-8 rounded-full border-4 border-line border-t-accent animate-spin" />+ <p className="text-sm text-muted">{phase === 'searching' ? '搜索各资源中...' : '测速中...'}</p>+ </div>+ ) : sorted.length === 0 ? (+ <p className="text-center text-sm text-faint py-8">其他数据源未找到同名资源</p>+ ) : (+ <div className="grid grid-cols-2 sm:grid-cols-4 gap-3">+ {sorted.map((c) => {+ const isCurrent = c.source.key === currentSourceKey && String(c.result.vodId) === String(currentVodId);+ const img = buildImageUrl(c.result.pic, store.imageProxyMode, store.customImageProxy);+ return (+ <button+ key={c.source.key}+ className={cn('text-left group relative rounded-lg overflow-hidden bg-card transition-transform', !isCurrent && 'hover:scale-[1.03] cursor-pointer', isCurrent && 'cursor-default')}+ onClick={() => !isCurrent && switchTo(c)}+ disabled={isCurrent}+ >+ <div className="relative aspect-[2/3] bg-chip">+ {img ? (+ // eslint-disable-next-line @next/next/no-img-element+ <img src={img} alt={c.result.name} className="w-full h-full object-cover" loading="lazy" />+ ) : (+ <div className="w-full h-full flex items-center justify-center text-faint text-xs">无封面</div>+ )}+ <span+ className={cn(+ 'absolute top-1.5 right-1.5 tag',+ !c.ok ? 'bg-red-500/80 text-white' : c.ms! > 2000 ? 'bg-yellow-600/80 text-white' : 'bg-green-600/80 text-white'+ )}+ >+ {!c.ok ? '失败' : `${c.ms}ms`}+ </span>+ {isCurrent && (+ <span className="absolute inset-x-0 bottom-0 bg-accent/90 text-white text-xs text-center py-1">当前播放</span>+ )}+ </div>+ <div className="p-2">+ <div className="text-xs font-medium text-content truncate">{c.source.name}</div>+ <div className="text-[10px] text-faint mt-0.5">{c.episodes ? `${c.episodes} 集` : '无资源'}</div>+ </div>+ </button>+ );+ })}+ </div>+ )}+ </div>+ </div>+ );+}diff --git a/libretv-next/src/components/theme.tsx b/libretv-next/src/components/theme.tsxnew file mode 100644index 0000000..f0670a1--- /dev/null+++ b/libretv-next/src/components/theme.tsx@@ -0,0 +1,97 @@+'use client';++import { createContext, useCallback, useContext, useEffect, useState, type ReactNode } from 'react';++/**+ * 主题上下文:light / dark / system,持久化到 localStorage。+ * html 上的 .dark 类由 layout 中的内联脚本先行设置(避免首屏闪烁),此处负责后续切换。+ */++export type ThemeChoice = 'light' | 'dark' | 'system';+const STORAGE_KEY = 'libretv-theme';++interface ThemeContextValue {+ theme: ThemeChoice;+ resolved: 'light' | 'dark';+ setTheme: (t: ThemeChoice) => void;+}++const ThemeContext = createContext<ThemeContextValue>({+ theme: 'system',+ resolved: 'dark',+ setTheme: () => {},+});++export function useTheme(): ThemeContextValue {+ return useContext(ThemeContext);+}++function systemPrefersDark(): boolean {+ return typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches;+}++function apply(choice: ThemeChoice): 'light' | 'dark' {+ const resolved = choice === 'system' ? (systemPrefersDark() ? 'dark' : 'light') : choice;+ document.documentElement.classList.toggle('dark', resolved === 'dark');+ return resolved;+}++export function ThemeProvider({ children }: { children: ReactNode }) {+ const [theme, setThemeState] = useState<ThemeChoice>('system');+ const [resolved, setResolved] = useState<'light' | 'dark'>('dark');++ useEffect(() => {+ const stored = (localStorage.getItem(STORAGE_KEY) as ThemeChoice | null) || 'system';+ setThemeState(stored);+ setResolved(apply(stored));++ const media = window.matchMedia('(prefers-color-scheme: dark)');+ const onChange = () => {+ const current = (localStorage.getItem(STORAGE_KEY) as ThemeChoice | null) || 'system';+ if (current === 'system') {+ setResolved(apply('system'));+ }+ };+ media.addEventListener('change', onChange);+ return () => media.removeEventListener('change', onChange);+ }, []);++ const setTheme = useCallback((t: ThemeChoice) => {+ localStorage.setItem(STORAGE_KEY, t);+ setThemeState(t);+ setResolved(apply(t));+ }, []);++ return <ThemeContext.Provider value={{ theme, resolved, setTheme }}>{children}</ThemeContext.Provider>;+}++/** 亮暗切换按钮:在 light → dark → system 三态间循环 */+export function ThemeToggle() {+ const { theme, resolved, setTheme } = useTheme();+ const next: ThemeChoice = theme === 'light' ? 'dark' : theme === 'dark' ? 'system' : 'light';+ const label = theme === 'system' ? '跟随系统(当前深色)' : theme === 'dark' ? '深色' : '浅色';+ const nextLabel = next === 'light' ? '浅色' : next === 'dark' ? '深色' : '跟随系统';++ return (+ <button+ className="p-2 rounded-md text-muted hover:text-content hover:bg-hover transition-colors"+ title={`主题:${label},点击切换为${nextLabel}`}+ aria-label={`切换主题,当前 ${label}`}+ onClick={() => setTheme(next)}+ >+ {theme === 'system' ? (+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />+ </svg>+ ) : resolved === 'dark' ? (+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" />+ </svg>+ ) : (+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />+ </svg>+ )}+ </button>+ );+}diff --git a/libretv-next/src/components/toast.tsx b/libretv-next/src/components/toast.tsxnew file mode 100644index 0000000..91fe098--- /dev/null+++ b/libretv-next/src/components/toast.tsx@@ -0,0 +1,75 @@+'use client';++import { createContext, useCallback, useContext, useRef, useState, type ReactNode } from 'react';+import { cn } from '@/lib/utils';++// —— Toast —— 替代旧版 3 秒/条串行队列,支持并行堆叠与自动过期++interface ToastItem {+ id: number;+ message: string;+ type: 'error' | 'success' | 'info' | 'warning';+}++interface ToastContextValue {+ toast: (message: string, type?: ToastItem['type']) => void;+}++const ToastContext = createContext<ToastContextValue>({ toast: () => {} });++export function useToast(): ToastContextValue {+ return useContext(ToastContext);+}++const TYPE_STYLES: Record<ToastItem['type'], string> = {+ error: 'bg-red-500',+ success: 'bg-green-600',+ info: 'bg-blue-500',+ warning: 'bg-yellow-600',+};++export function ToastProvider({ children }: { children: ReactNode }) {+ const [items, setItems] = useState<ToastItem[]>([]);+ const idRef = useRef(0);++ const toast = useCallback((message: string, type: ToastItem['type'] = 'info') => {+ const id = ++idRef.current;+ setItems((prev) => [...prev.slice(-3), { id, message, type }]);+ setTimeout(() => {+ setItems((prev) => prev.filter((t) => t.id !== id));+ }, 3000);+ }, []);++ return (+ <ToastContext.Provider value={{ toast }}>+ {children}+ <div className="fixed top-4 left-1/2 -translate-x-1/2 z-[100] flex flex-col gap-2 items-center pointer-events-none">+ {items.map((t) => (+ <div+ key={t.id}+ className={cn(+ 'px-4 py-2.5 rounded-lg shadow-lg text-white text-sm max-w-md animate-slide-up',+ TYPE_STYLES[t.type]+ )}+ >+ {t.message}+ </div>+ ))}+ </div>+ </ToastContext.Provider>+ );+}++// —— Loading 遮罩 ——(带 30s 自动解除,防无限 loading)++export function LoadingOverlay({ show, message = '加载中...' }: { show: boolean; message?: string }) {+ if (!show) return null;+ return (+ <div className="fixed inset-0 z-[90] flex items-center justify-center bg-black/70 animate-fade-in">+ <div className="flex flex-col items-center gap-3">+ <div className="h-10 w-10 rounded-full border-4 border-line border-t-accent animate-spin" />+ <p className="text-sm text-content">{message}</p>+ </div>+ </div>+ );+}diff --git a/libretv-next/src/components/video-card.tsx b/libretv-next/src/components/video-card.tsxnew file mode 100644index 0000000..59ffee9--- /dev/null+++ b/libretv-next/src/components/video-card.tsx@@ -0,0 +1,118 @@+'use client';++import { useEffect, useState } from 'react';+import type { SearchResultItem } from '@/lib/types';+import { buildImageUrl } from '@/lib/utils';+import { useAppStore } from '@/lib/store';+import { cn } from '@/lib/utils';++/** 影片卡片:封面加载失败时逐级降级到占位图 */+export function VideoCard({ item, onClick }: { item: SearchResultItem; onClick: () => void }) {+ const imageProxyMode = useAppStore((s) => s.imageProxyMode);+ const customImageProxy = useAppStore((s) => s.customImageProxy);+ const [imgFailed, setImgFailed] = useState(false);+ const primary = buildImageUrl(item.pic, imageProxyMode, customImageProxy);+ // 加载方式变化时重置失败状态,允许新地址重试+ useEffect(() => setImgFailed(false), [primary]);+ const showImg = primary && !imgFailed;++ return (+ <div+ className="card cursor-pointer hover:scale-[1.02] hover:shadow-md h-full"+ role="button"+ tabIndex={0}+ onClick={onClick}+ onKeyDown={(e) => {+ if (e.key === 'Enter' || e.key === ' ') onClick();+ }}+ >+ <div className="flex h-full">+ {showImg ? (+ <div className="relative flex-shrink-0 w-[105px] sm:w-[120px] bg-chip">+ {/* eslint-disable-next-line @next/next/no-img-element */}+ <img+ src={primary}+ alt={item.name}+ className="h-full w-full object-cover"+ loading="lazy"+ onError={() => setImgFailed(true)}+ />+ <div className="absolute inset-0 bg-gradient-to-r from-black/30 to-transparent" />+ </div>+ ) : (+ <div className="flex-shrink-0 w-[105px] sm:w-[120px] bg-chip flex items-center justify-center">+ <svg className="w-8 h-8 text-faint" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M7 4v16m10-16v16M3 6a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm4 0a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1h-1a1 1 0 01-1-1V6zm8 0a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1h-1a1 1 0 01-1-1V6zm4 0a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1h-1a1 1 0 01-1-1V6z" />+ </svg>+ </div>+ )}++ <div className="p-2.5 flex flex-col flex-grow min-w-0">+ <div className="flex-grow">+ <h3 className="font-semibold text-sm text-content mb-1.5 line-clamp-2" title={item.name}>+ {item.name}+ </h3>+ <div className="flex flex-wrap gap-1 mb-1.5">+ {item.typeName && <span className="tag bg-accent/15 text-accent">{item.typeName}</span>}+ {item.year && <span className="tag bg-purple-500/15 text-purple-600 dark:text-purple-300">{item.year}</span>}+ </div>+ <p className="text-xs text-muted line-clamp-2 mb-2">{item.remarks || '暂无介绍'}</p>+ </div>+ <div className="flex items-center justify-between mt-auto pt-1.5 border-t border-line">+ <span className="tag bg-chip text-muted truncate max-w-[80%]">{item.sourceName}</span>+ </div>+ </div>+ </div>+ </div>+ );+}++/** 豆瓣推荐卡片(无来源徽章,点击直接搜索) */+export function DoubanCard({ item, onClick }: { item: { title: string; cover: string; rating?: string }; onClick: () => void }) {+ const imageProxyMode = useAppStore((s) => s.imageProxyMode);+ const customImageProxy = useAppStore((s) => s.customImageProxy);+ const [imgFailed, setImgFailed] = useState(false);+ const primary = buildImageUrl(item.cover, imageProxyMode, customImageProxy);+ useEffect(() => setImgFailed(false), [primary]);++ return (+ <div+ className="card cursor-pointer hover:scale-[1.03] hover:shadow-md"+ role="button"+ tabIndex={0}+ onClick={onClick}+ onKeyDown={(e) => {+ if (e.key === 'Enter' || e.key === ' ') onClick();+ }}+ >+ <div className="relative aspect-[2/3] bg-chip">+ {primary && !imgFailed ? (+ // eslint-disable-next-line @next/next/no-img-element+ <img+ src={primary}+ alt={item.title}+ className="w-full h-full object-cover"+ loading="lazy"+ onError={() => setImgFailed(true)}+ />+ ) : (+ <div className="w-full h-full flex items-center justify-center bg-chip">+ <svg className="w-9 h-9 text-faint" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M7 4v16m10-16v16M3 6a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm4 0a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1h-1a1 1 0 01-1-1V6zm8 0a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1h-1a1 1 0 01-1-1V6zm4 0a1 1 0 011-1h1a1 1 0 011 1v12a1 1 0 01-1 1h-1a1 1 0 01-1-1V6z" />+ </svg>+ </div>+ )}+ {item.rating && (+ <span className={cn('absolute top-1.5 right-1.5 tag bg-black/70 text-amber-400 font-medium')}>+ ★ {item.rating}+ </span>+ )}+ </div>+ <div className="p-2">+ <div className="text-xs font-medium text-content truncate" title={item.title}>+ {item.title}+ </div>+ </div>+ </div>+ );+}diff --git a/libretv-next/src/lib/api-guard.ts b/libretv-next/src/lib/api-guard.tsnew file mode 100644index 0000000..e42afaf--- /dev/null+++ b/libretv-next/src/lib/api-guard.ts@@ -0,0 +1,20 @@+import { NextResponse } from 'next/server';+import { isPasswordConfigured, sessionFromCookieHeader } from './auth';++/** API Route 共享守卫:未配置密码返回 503,未登录返回 401 */+export function guardRequest(req: Request): NextResponse | null {+ if (!isPasswordConfigured()) {+ return NextResponse.json(+ { error: '服务器未设置 PASSWORD 环境变量' },+ { status: 503 }+ );+ }+ if (!sessionFromCookieHeader(req.headers.get('cookie'))) {+ return NextResponse.json({ error: '未登录' }, { status: 401 });+ }+ return null;+}++export function jsonError(message: string, status: number): NextResponse {+ return NextResponse.json({ error: message }, { status });+}diff --git a/libretv-next/src/lib/auth.ts b/libretv-next/src/lib/auth.tsnew file mode 100644index 0000000..68efa2b--- /dev/null+++ b/libretv-next/src/lib/auth.ts@@ -0,0 +1,111 @@+import crypto from 'node:crypto';++/**+ * 会话鉴权:httpOnly cookie + HMAC 签名。+ *+ * 相比旧版的改进:+ * - 页面源码不再下发 sha256(password),前端拿不到任何可重放的凭证;+ * - 兼容模式「哈希即凭证」被彻底移除;+ * - 登录接口只接受 POST body,不再把明文密码放 query。+ */++export const SESSION_COOKIE = 'ltv_session';+const SESSION_TTL_MS = 90 * 24 * 60 * 60 * 1000; // 90 天++export function getPassword(): string {+ return process.env.PASSWORD || '';+}++export function isPasswordConfigured(): boolean {+ return getPassword().length > 0;+}++function getSecret(): string {+ if (process.env.PROXY_SECRET) return process.env.PROXY_SECRET;+ return crypto.createHash('sha256').update(getPassword() + ':libretv-next::session-salt').digest('hex');+}++function hmac(payload: string): string {+ return crypto.createHmac('sha256', getSecret()).update(payload).digest('hex');+}++/** 生成签名会话 token:`<expiresAtMs>.<hmac>` */+export function signSession(): { token: string; expiresAt: number } {+ const expiresAt = Date.now() + SESSION_TTL_MS;+ const payload = String(expiresAt);+ return { token: `${payload}.${hmac(payload)}`, expiresAt };+}++/** 校验会话 token 的签名与有效期 */+export function verifySession(token: string | undefined | null): boolean {+ if (!token) return false;+ const dot = token.lastIndexOf('.');+ if (dot <= 0) return false;+ const payload = token.slice(0, dot);+ const sig = token.slice(dot + 1);+ const expected = hmac(payload);+ const a = Buffer.from(sig);+ const b = Buffer.from(expected);+ if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) return false;+ const expiresAt = parseInt(payload, 10);+ if (!Number.isFinite(expiresAt)) return false;+ return Date.now() < expiresAt;+}++/** 恒定时间比较密码(比较 sha256 摘要避免长度泄漏) */+export function checkPassword(input: string): boolean {+ const password = getPassword();+ if (!password) return false;+ const a = crypto.createHash('sha256').update(input).digest();+ const b = crypto.createHash('sha256').update(password).digest();+ return crypto.timingSafeEqual(a, b);+}++/** 从请求 Cookie 中解析会话 */+export function sessionFromCookieHeader(cookieHeader: string | null): boolean {+ if (!cookieHeader) return false;+ const cookies = cookieHeader.split(';');+ for (const c of cookies) {+ const eq = c.indexOf('=');+ if (eq === -1) continue;+ const name = c.slice(0, eq).trim();+ if (name === SESSION_COOKIE) {+ return verifySession(decodeURIComponent(c.slice(eq + 1).trim()));+ }+ }+ return false;+}++// —— 登录速率限制(内存实现,单实例部署足够;多实例可换 Redis) ——++const attemptMap = new Map<string, { count: number; resetAt: number }>();+const MAX_ATTEMPTS = 10;+const WINDOW_MS = 10 * 60 * 1000;++export function checkRateLimit(ip: string): boolean {+ const now = Date.now();+ const entry = attemptMap.get(ip);+ if (!entry || now > entry.resetAt) {+ attemptMap.set(ip, { count: 1, resetAt: now + WINDOW_MS });+ return true;+ }+ if (entry.count >= MAX_ATTEMPTS) return false;+ entry.count += 1;+ return true;+}++export function clearRateLimit(ip: string): void {+ attemptMap.delete(ip);+}++// 定期清理过期限流记录,避免长期运行下 Map 膨胀+if (typeof setInterval === 'function') {+ const timer = setInterval(() => {+ const now = Date.now();+ for (const [ip, entry] of attemptMap) {+ if (now > entry.resetAt) attemptMap.delete(ip);+ }+ }, 60 * 1000);+ // 不阻止 Node 进程退出+ if (typeof timer.unref === 'function') timer.unref();+}diff --git a/libretv-next/src/lib/client-api.ts b/libretv-next/src/lib/client-api.tsnew file mode 100644index 0000000..d167c08--- /dev/null+++ b/libretv-next/src/lib/client-api.ts@@ -0,0 +1,100 @@+'use client';++import type { SearchResponse, VideoDetail, DoubanResponse, AuthStatusResponse, SourceConfig, SearchResultItem } from './types';++/**+ * 客户端 API 封装。401 时触发全局事件打开登录框,+ * 替代旧版在每个函数里手工检查 isPasswordVerified 的散弹式写法。+ */++export class ApiError extends Error {+ status: number;+ constructor(message: string, status: number) {+ super(message);+ this.status = status;+ }+}++const UNAUTHORIZED_EVENT = 'libretv:unauthorized';++export function onUnauthorized(handler: (event: CustomEvent) => void): () => void {+ const wrapped = (e: Event) => handler(e as CustomEvent);+ window.addEventListener(UNAUTHORIZED_EVENT, wrapped);+ return () => window.removeEventListener(UNAUTHORIZED_EVENT, wrapped);+}++async function request<T>(url: string, init?: RequestInit): Promise<T> {+ let res: Response;+ try {+ res = await fetch(url, init);+ } catch (err) {+ if (err instanceof DOMException && err.name === 'AbortError') throw err;+ throw new ApiError('网络请求失败,请检查网络连接', 0);+ }+ if (res.status === 401) {+ window.dispatchEvent(new CustomEvent(UNAUTHORIZED_EVENT));+ throw new ApiError('需要登录', 401);+ }+ if (res.status === 503) {+ window.dispatchEvent(new CustomEvent(UNAUTHORIZED_EVENT, { detail: 'setup' }));+ throw new ApiError('服务器未配置密码', 503);+ }+ if (!res.ok) {+ let msg = `请求失败 (${res.status})`;+ try {+ const data = (await res.json()) as { error?: string };+ if (data?.error) msg = data.error;+ } catch { /* 忽略解析失败 */ }+ throw new ApiError(msg, res.status);+ }+ return (await res.json()) as T;+}++export const api = {+ status: () => request<AuthStatusResponse>('/api/status'),++ login: (password: string) =>+ request<{ success: boolean }>('/api/auth', {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({ password }),+ }),++ logout: () => request<{ success: boolean }>('/api/auth', { method: 'DELETE' }),++ search: (wd: string, sources: SourceConfig[], filterAdult: boolean, signal?: AbortSignal) =>+ request<SearchResponse>('/api/search', {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({ wd, sources, filterAdult }),+ signal,+ }),++ detail: (id: string, source: SourceConfig, signal?: AbortSignal) => {+ const sp = new URLSearchParams({ id, source: JSON.stringify(source) });+ return request<VideoDetail>(`/api/detail?${sp.toString()}`, { signal });+ },++ douban: (type: 'movie' | 'tv', tag: string, pageStart: number, pageSize: number, signal?: AbortSignal) => {+ const sp = new URLSearchParams({ type, tag, pageStart: String(pageStart), pageSize: String(pageSize) });+ return request<DoubanResponse>(`/api/douban?${sp.toString()}`, { signal });+ },++ /** 换源:按标题跨源搜索并取详情,附带接口耗时(测速) */+ detailSpeed: async (id: string, source: SourceConfig) => {+ const start = performance.now();+ try {+ const detail = await api.detail(id, source);+ return { ok: true, ms: Math.round(performance.now() - start), detail };+ } catch (err) {+ return { ok: false, ms: Math.round(performance.now() - start), detail: undefined as VideoDetail | undefined, error: err instanceof Error ? err.message : '失败' };+ }+ },+};++export interface SearchFailure {+ sourceKey: string;+ error: string;+}++export type { SearchResponse, SearchResultItem };diff --git a/libretv-next/src/lib/cms-parser.test.ts b/libretv-next/src/lib/cms-parser.test.tsnew file mode 100644index 0000000..0f1d9fb--- /dev/null+++ b/libretv-next/src/lib/cms-parser.test.ts@@ -0,0 +1,128 @@+import { describe, expect, it } from 'vitest';+import {+ extractEpisodesFromPlayUrl,+ extractM3u8FromText,+ filterAdultResults,+ isAdultContent,+ parseDetail,+ parseDetailPageHtml,+ parseSearchList,+} from './cms-parser';++const source = { key: 'test', name: '测试源', url: 'https://api.example.com/provide/vod' };++describe('parseSearchList', () => {+ it('解析标准搜索响应并补齐源信息', () => {+ const data = {+ list: [+ { vod_id: 123, vod_name: '流浪地球', vod_pic: 'https://img/a.jpg', type_name: '科幻', vod_year: '2019', vod_remarks: 'HD' },+ { vod_id: 'abc-1', vod_name: '探<script>' },+ ],+ };+ const items = parseSearchList(data, source);+ expect(items).toHaveLength(2);+ expect(items[0]).toMatchObject({+ sourceKey: 'test', sourceName: '测试源', vodId: '123', name: '流浪地球',+ typeName: '科幻', year: '2019', remarks: 'HD', sourceUrl: source.url,+ });+ expect(items[1].vodId).toBe('abc-1');+ });++ it('对缺失字段健壮', () => {+ const items = parseSearchList({ list: [{}] }, source);+ expect(items[0].vodId).toBe('');+ expect(items[0].name).toBe('');+ });++ it('拒绝无效响应', () => {+ expect(() => parseSearchList(null, source)).toThrow();+ expect(() => parseSearchList({}, source)).toThrow();+ expect(() => parseSearchList({ list: 'nope' }, source)).toThrow();+ });+});++describe('extractEpisodesFromPlayUrl', () => {+ it('解析 源$$$源 与 集$URL#集$URL 结构', () => {+ const play = '第01集$https://cdn/a1.m3u8#第02集$https://cdn/a2.m3u8$$$备用$https://x/b.m3u8';+ expect(extractEpisodesFromPlayUrl(play)).toEqual([+ 'https://cdn/a1.m3u8',+ 'https://cdn/a2.m3u8',+ ]);+ });++ it('过滤无 URL 或非 http 的集', () => {+ const play = '第01集$#第02集$ftp://x#第03集$https://cdn/a3.m3u8';+ expect(extractEpisodesFromPlayUrl(play)).toEqual(['https://cdn/a3.m3u8']);+ });++ it('空输入返回空数组', () => {+ expect(extractEpisodesFromPlayUrl('')).toEqual([]);+ });+});++describe('extractM3u8FromText', () => {+ it('从简介中提取 m3u8 链接', () => {+ const text = '正片$https://cdn.com/x/index.m3u8 更多';+ expect(extractM3u8FromText(text)).toEqual(['https://cdn.com/x/index.m3u8']);+ });+});++describe('parseDetail', () => {+ it('解析详情并提取分集', () => {+ const data = {+ list: [{+ vod_id: 1, vod_name: '三体', vod_content: '科幻剧',+ vod_play_url: '第1集$https://cdn/1.m3u8#第2集$https://cdn/2.m3u8',+ }],+ };+ const detail = parseDetail(data, source);+ expect(detail.episodes).toHaveLength(2);+ expect(detail.videoInfo.title).toBe('三体');+ expect(detail.videoInfo.sourceName).toBe('测试源');+ });++ it('play_url 为空时从简介兜底', () => {+ const data = { list: [{ vod_name: 'X', vod_content: '$https://cdn/fall.m3u8' }] };+ const detail = parseDetail(data, source);+ expect(detail.episodes).toEqual(['https://cdn/fall.m3u8']);+ });++ it('空列表抛错', () => {+ expect(() => parseDetail({ list: [] }, source)).toThrow();+ });+});++describe('parseDetailPageHtml', () => {+ it('从 HTML 中提取去重后的 m3u8', () => {+ const html = `<h1>庆余年</h1>+ <div class="sketch">简介<b>内容</b></div>+ <script>player_aa={"url":"$https://cdn/ep1.m3u8"}</script>+ <script>player_bb={"url":"$https://cdn/ep2.m3u8"}</script>+ <script>player_cc={"url":"$https://cdn/ep1.m3u8"}</script>`;+ const detail = parseDetailPageHtml(html, source);+ expect(detail.episodes).toEqual(['https://cdn/ep1.m3u8', 'https://cdn/ep2.m3u8']);+ expect(detail.videoInfo.title).toBe('庆余年');+ expect(detail.videoInfo.desc).toBe('简介 内容');+ });++ it('非凡影视特征路径兜底', () => {+ const html = '$https://vip.ffzy.com/20231101/12345_abcdef/index.m3u8';+ const detail = parseDetailPageHtml(html, source);+ expect(detail.episodes).toContain('https://vip.ffzy.com/20231101/12345_abcdef/index.m3u8');+ });+});++describe('成人内容过滤', () => {+ it('识别敏感分类', () => {+ expect(isAdultContent('伦理片')).toBe(true);+ expect(isAdultContent('福利片')).toBe(true);+ expect(isAdultContent('科幻片')).toBe(false);+ expect(isAdultContent(undefined)).toBe(false);+ });++ it('filterAdultResults 按开关过滤', () => {+ const items = [{ typeName: '伦理片' }, { typeName: '剧情片' }];+ expect(filterAdultResults(items, true)).toEqual([{ typeName: '剧情片' }]);+ expect(filterAdultResults(items, false)).toHaveLength(2);+ });+});diff --git a/libretv-next/src/lib/cms-parser.ts b/libretv-next/src/lib/cms-parser.tsnew file mode 100644index 0000000..565faee--- /dev/null+++ b/libretv-next/src/lib/cms-parser.ts@@ -0,0 +1,155 @@+import type { SearchResultItem, VideoDetail } from './types';++/**+ * Apple CMS(苹果CMS)资源站响应解析+ * 与旧版 js/api.js 逻辑对齐,迁移为纯函数以便单元测试。+ */++const M3U8_PATTERN = /\$https?:\/\/[^"'\s]+?\.m3u8/g;++const UA_HEADERS = {+ 'User-Agent':+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',+ Accept: 'application/json',+};++export function cmsRequestHeaders(): Record<string, string> {+ return { ...UA_HEADERS };+}++/** 搜索响应 → 统一结果列表 */+export function parseSearchList(+ data: unknown,+ source: { key: string; name: string; url: string; isAdult?: boolean }+): SearchResultItem[] {+ if (!data || typeof data !== 'object') throw new Error('API返回的数据格式无效');+ const list = (data as { list?: unknown }).list;+ if (!Array.isArray(list)) throw new Error('API返回的数据格式无效');+ return list.map((item) => {+ const vod = item as Record<string, unknown>;+ return {+ sourceKey: source.key,+ sourceName: source.name,+ vodId: String(vod.vod_id ?? ''),+ name: String(vod.vod_name ?? ''),+ pic: typeof vod.vod_pic === 'string' ? vod.vod_pic : undefined,+ typeName: typeof vod.type_name === 'string' ? vod.type_name : undefined,+ year: typeof vod.vod_year === 'string' ? vod.vod_year : undefined,+ area: typeof vod.vod_area === 'string' ? vod.vod_area : undefined,+ remarks: typeof vod.vod_remarks === 'string' ? vod.vod_remarks : undefined,+ sourceUrl: source.url,+ isAdult: source.isAdult,+ };+ });+}++/** 从 vod_play_url 中提取分集地址:格式 源1$$$源2,集1$URL1#集2$URL2 */+export function extractEpisodesFromPlayUrl(playUrl: string): string[] {+ if (!playUrl) return [];+ const firstSource = playUrl.split('$$$')[0] ?? '';+ return firstSource+ .split('#')+ .map((ep) => {+ const parts = ep.split('$');+ return parts.length > 1 ? parts[1] : '';+ })+ .filter((url) => url.startsWith('http://') || url.startsWith('https://'));+}++/** 从简介文本中兜底提取 m3u8 链接 */+export function extractM3u8FromText(text: string): string[] {+ if (!text) return [];+ const matches = text.match(M3U8_PATTERN) || [];+ return matches.map((link) => link.replace(/^\$/, ''));+}++/** 详情 JSON 响应 → 统一详情 */+export function parseDetail(+ data: unknown,+ source: { key: string; name: string; url: string }+): VideoDetail {+ const d = data as { list?: Record<string, unknown>[] };+ if (!d || !Array.isArray(d.list) || d.list.length === 0) {+ throw new Error('获取到的详情内容无效');+ }+ const vod = d.list[0];+ let episodes = extractEpisodesFromPlayUrl(String(vod.vod_play_url ?? ''));+ if (episodes.length === 0) {+ episodes = extractM3u8FromText(String(vod.vod_content ?? ''));+ }+ return {+ episodes,+ videoInfo: {+ title: str(vod.vod_name),+ cover: str(vod.vod_pic),+ desc: str(vod.vod_content),+ typeName: str(vod.type_name),+ year: str(vod.vod_year),+ area: str(vod.vod_area),+ director: str(vod.vod_director),+ actor: str(vod.vod_actor),+ remarks: str(vod.vod_remarks),+ sourceKey: source.key,+ sourceName: source.name,+ sourceUrl: source.url,+ },+ };+}++function str(v: unknown): string | undefined {+ const s = typeof v === 'string' ? v.trim() : '';+ return s || undefined;+}++/**+ * 部分源的列表接口不返回播放地址,需要爬详情页 HTML 提取 m3u8。+ * 与旧版 handleSpecialSourceDetail 对齐。+ */+export function parseDetailPageHtml(+ html: string,+ source: { key: string; name: string; url: string }+): VideoDetail {+ // 先尝试通用模式,再尝试非凡影视的日期哈希特征路径+ let matches = html.match(/\$(https?:\/\/[^"'\s]+?\.m3u8)/g) || [];+ if (matches.length === 0) {+ matches = html.match(/\$(https?:\/\/[^"'\s]+?\/\d{8}\/\d+_[a-f0-9]+\/index\.m3u8)/g) || [];+ }+ // 去重并清理尾缀+ const episodes = [...new Set(matches)].map((link) => {+ let u = link.substring(1);+ const parenIndex = u.indexOf('(');+ if (parenIndex > 0) u = u.substring(0, parenIndex);+ return u;+ });++ const titleMatch = html.match(/<h1[^>]*>([^<]+)<\/h1>/);+ const descMatch = html.match(/<div[^>]*class=["']sketch["'][^>]*>([\s\S]*?)<\/div>/);++ return {+ episodes,+ videoInfo: {+ title: titleMatch ? titleMatch[1].trim() : undefined,+ desc: descMatch ? descMatch[1].replace(/<[^>]+>/g, ' ').trim() : undefined,+ sourceKey: source.key,+ sourceName: source.name,+ sourceUrl: source.url,+ },+ };+}++/** 敏感分类过滤(成人内容过滤,关键词与旧版保持一致) */+const ADULT_KEYWORDS = [+ '伦理片', '福利', '里番动漫', '门事件', '萝莉少女', '制服诱惑', '国产传媒',+ 'cosplay', '黑丝诱惑', '无码', '日本无码', '有码', '日本有码', 'SWAG',+ '网红主播', '色情片', '同性片', '福利视频', '福利片',+];++export function isAdultContent(typeName: string | undefined): boolean {+ if (!typeName) return false;+ return ADULT_KEYWORDS.some((k) => typeName.includes(k));+}++export function filterAdultResults<T extends { typeName?: string }>(items: T[], enabled: boolean): T[] {+ if (!enabled) return items;+ return items.filter((item) => !isAdultContent(item.typeName));+}diff --git a/libretv-next/src/lib/db.ts b/libretv-next/src/lib/db.tsnew file mode 100644index 0000000..373955c--- /dev/null+++ b/libretv-next/src/lib/db.ts@@ -0,0 +1,205 @@+import Dexie, { type EntityTable } from 'dexie';+import type { SourceConfig } from './types';++/**+ * IndexedDB 持久化(替代旧版 localStorage 数据库):+ * - 观看历史不再冗余存储全集 URL 列表(旧版长剧 × 50 条极易撑爆 5MB 配额),+ * 只存定位信息(sourceKey+vodId+index),进入播放页时按需重新拉详情,+ * 顺带免费获得「剧集更新同步」能力。+ */++export interface HistoryEntry {+ /** 主键:`${sourceKey}_${vodId}` */+ id: string;+ sourceKey: string;+ sourceUrl?: string;+ vodId: string;+ title: string;+ pic?: string;+ episodeIndex: number;+ totalEpisodes: number;+ playbackPosition: number;+ duration: number;+ timestamp: number;+}++export interface ProgressEntry {+ key: string; // `${sourceKey}_${vodId}_${episodeIndex}`+ position: number;+ duration: number;+ updatedAt: number;+}++export interface SearchHistoryEntry {+ text: string;+ timestamp: number;+}++export const db = new Dexie('libretv-next') as Dexie & {+ history: EntityTable<HistoryEntry, 'id'>;+ progress: EntityTable<ProgressEntry, 'key'>;+ searchHistory: EntityTable<SearchHistoryEntry, 'text'>;+};++db.version(1).stores({+ history: 'id, timestamp',+ progress: 'key, updatedAt',+ searchHistory: 'text, timestamp',+});++export const MAX_HISTORY = 100;+export const MAX_SEARCH_HISTORY = 10;++export async function upsertHistory(entry: Omit<HistoryEntry, 'id'>): Promise<void> {+ const id = `${entry.sourceKey}_${entry.vodId}`;+ const existing = await db.history.get(id);+ const merged: HistoryEntry = {+ ...existing,+ ...entry,+ id,+ playbackPosition: entry.playbackPosition > 10 ? entry.playbackPosition : existing?.playbackPosition ?? 0,+ duration: entry.duration || existing?.duration || 0,+ timestamp: Date.now(),+ };+ await db.history.put(merged);+ // 淘汰最旧记录+ const count = await db.history.count();+ if (count > MAX_HISTORY) {+ const oldest = await db.history.orderBy('timestamp').limit(count - MAX_HISTORY).toArray();+ await db.history.bulkDelete(oldest.map((o) => o.id));+ }+}++export async function updateHistoryProgress(+ sourceKey: string,+ vodId: string,+ position: number,+ duration: number+): Promise<void> {+ const id = `${sourceKey}_${vodId}`;+ const existing = await db.history.get(id);+ if (!existing) return;+ if (Math.abs(existing.playbackPosition - position) < 2 && Math.abs(existing.duration - duration) < 2) return;+ await db.history.update(id, {+ playbackPosition: position,+ duration,+ timestamp: Date.now(),+ });+}++export async function removeHistory(sourceKey: string, vodId: string): Promise<void> {+ await db.history.delete(`${sourceKey}_${vodId}`);+}++export async function clearAllHistory(): Promise<void> {+ await db.history.clear();+}++export function progressKeyOf(sourceKey: string, vodId: string, episodeIndex: number): string {+ return `${sourceKey}_${vodId}_${episodeIndex}`;+}++export async function saveProgress(sourceKey: string, vodId: string, episodeIndex: number, position: number, duration: number): Promise<void> {+ if (!duration || position < 1) return;+ await db.progress.put({+ key: progressKeyOf(sourceKey, vodId, episodeIndex),+ position,+ duration,+ updatedAt: Date.now(),+ });+}++export async function clearProgress(sourceKey: string, vodId: string, episodeIndex: number): Promise<void> {+ await db.progress.delete(progressKeyOf(sourceKey, vodId, episodeIndex));+}++export async function addSearchHistory(text: string): Promise<void> {+ const t = text.trim().slice(0, 50);+ if (!t) return;+ await db.searchHistory.put({ text: t, timestamp: Date.now() });+ const count = await db.searchHistory.count();+ if (count > MAX_SEARCH_HISTORY) {+ const oldest = await db.searchHistory.orderBy('timestamp').limit(count - MAX_SEARCH_HISTORY).toArray();+ await db.searchHistory.bulkDelete(oldest.map((o) => o.text));+ }+}++export async function removeSearchHistory(text: string): Promise<void> {+ await db.searchHistory.delete(text);+}++export async function clearSearchHistory(): Promise<void> {+ await db.searchHistory.clear();+}++// —— 配置导入导出(兼容旧版 LibreTV-Settings JSON 结构的导出格式) ——++export async function exportConfig(): Promise<string> {+ const [history, customAPIsStr, ...rest] = await Promise.all([+ db.history.toArray(),+ Promise.resolve(localStorage.getItem('libretv-settings')),+ Promise.resolve(null),+ ]);+ const data: Record<string, unknown> = {};+ data['viewingHistory'] = JSON.stringify(history);+ if (customAPIsStr) data['libretv-settings'] = customAPIsStr;+ void rest;++ const payload = {+ name: 'LibreTV-Settings',+ time: Date.now().toString(),+ cfgVer: '2.0.0',+ data,+ };+ return JSON.stringify(payload);+}++export async function importConfig(content: string): Promise<void> {+ const config = JSON.parse(content) as {+ name?: string;+ data?: Record<string, string>;+ };+ if (config.name !== 'LibreTV-Settings') throw new Error('配置文件格式不正确');+ const data = config.data || {};++ if (typeof data['libretv-settings'] === 'string') {+ localStorage.setItem('libretv-settings', data['libretv-settings']);+ }++ if (typeof data['viewingHistory'] === 'string') {+ // 兼容旧版历史结构(含全集 URL 列表),只迁移定位信息+ const legacy = JSON.parse(data['viewingHistory']) as Record<string, unknown>[];+ for (const item of legacy.slice(0, MAX_HISTORY)) {+ const sourceKey = String(item.sourceCode || item.sourceName || '');+ const vodId = String(item.vod_id || '');+ const title = String(item.title || '未知视频');+ if (!sourceKey || !vodId) continue;+ const totalEpisodes = Array.isArray(item.episodes) ? item.episodes.length : 0;+ await upsertHistory({+ sourceKey,+ vodId,+ title,+ episodeIndex: typeof item.episodeIndex === 'number' ? item.episodeIndex : 0,+ totalEpisodes,+ playbackPosition: typeof item.playbackPosition === 'number' ? item.playbackPosition : 0,+ duration: typeof item.duration === 'number' ? item.duration : 0,+ timestamp: typeof item.timestamp === 'number' ? item.timestamp : Date.now(),+ });+ }+ }+}++export function saveSettingsToLocalStorage(settings: unknown): void {+ localStorage.setItem('libretv-settings', JSON.stringify(settings));+}++export function loadSettingsFromLocalStorage<T>(): T | undefined {+ try {+ const raw = localStorage.getItem('libretv-settings');+ return raw ? (JSON.parse(raw) as T) : undefined;+ } catch {+ return undefined;+ }+}++export type { SourceConfig };diff --git a/libretv-next/src/lib/douban.ts b/libretv-next/src/lib/douban.tsnew file mode 100644index 0000000..366cb37--- /dev/null+++ b/libretv-next/src/lib/douban.ts@@ -0,0 +1,88 @@+import type { DoubanItem } from './types';+import { fetchUpstream, getCache, setCache } from './fetch-utils';++/**+ * 豆瓣推荐数据获取(服务端直连,带内存缓存与降级链)。+ * 旧版在浏览器里经公共 CORS 代理请求豆瓣(隐私差且不稳定),+ * 重构后由服务端直连,仅在直连被拒时降级到公共代理。+ */++const DOUBAN_API = 'https://movie.douban.com/j/search_subjects';+const CACHE_TTL = 10 * 60 * 1000;+const UA =+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36';++interface DoubanRawSubject {+ id: string;+ title: string;+ cover: string;+ rate: string;+ url?: string;+}++function fallbackProxies(): string[] {+ const proxies: string[] = [];+ if (process.env.FALLBACK_CORS_PROXY) proxies.push(process.env.FALLBACK_CORS_PROXY);+ return proxies;+}++export async function fetchDoubanRecommend(+ type: 'movie' | 'tv',+ tag: string,+ pageStart: number,+ pageSize: number+): Promise<DoubanItem[]> {+ const cacheKey = `douban:${type}:${tag}:${pageStart}:${pageSize}`;+ const cached = getCache<DoubanItem[]>(cacheKey);+ if (cached) return cached;++ const target = `${DOUBAN_API}?type=${type}&tag=${encodeURIComponent(tag)}&sort=recommend&page_limit=${pageSize}&page_start=${pageStart}`;++ let raw: DoubanRawSubject[] | undefined;++ // 1) 服务端直连+ try {+ const res = await fetchUpstream(target, {+ timeoutMs: 8000,+ headers: { 'User-Agent': UA, Referer: 'https://movie.douban.com/', Accept: 'application/json' },+ });+ if (res.ok) {+ const data = (await res.json()) as { subjects?: DoubanRawSubject[] };+ raw = data.subjects;+ }+ } catch {+ // 忽略,走降级+ }++ // 2) 降级:经 FALLBACK_CORS_PROXY+ if (!raw) {+ for (const proxy of fallbackProxies()) {+ try {+ const res = await fetchUpstream(proxy + encodeURIComponent(target), {+ timeoutMs: 8000,+ headers: { Accept: 'application/json' },+ });+ if (res.ok) {+ const data = (await res.json()) as { subjects?: DoubanRawSubject[] };+ raw = data.subjects;+ if (raw) break;+ }+ } catch {+ // 继续尝试下一个+ }+ }+ }++ if (!raw) throw new Error('豆瓣推荐获取失败');++ const items: DoubanItem[] = raw.map((s) => ({+ id: s.id,+ title: s.title,+ cover: s.cover,+ rating: s.rate && s.rate !== '0' ? s.rate : undefined,+ isTv: type === 'tv',+ }));++ setCache(cacheKey, items, CACHE_TTL);+ return items;+}diff --git a/libretv-next/src/lib/fetch-utils.ts b/libretv-next/src/lib/fetch-utils.tsnew file mode 100644index 0000000..42919be--- /dev/null+++ b/libretv-next/src/lib/fetch-utils.ts@@ -0,0 +1,55 @@+/** 服务端上游请求工具:超时、重试、JSON 解析 */++export interface FetchOptions extends RequestInit {+ timeoutMs?: number;+ retries?: number;+}++export async function fetchUpstream(url: string, options: FetchOptions = {}): Promise<Response> {+ const { timeoutMs = 8000, retries = 0, ...init } = options;+ let lastError: unknown;+ for (let attempt = 0; attempt <= retries; attempt++) {+ try {+ return await fetch(url, {+ ...init,+ signal: AbortSignal.timeout(timeoutMs),+ redirect: init.redirect ?? 'follow',+ });+ } catch (err) {+ lastError = err;+ }+ }+ throw lastError instanceof Error ? lastError : new Error('上游请求失败');+}++export async function fetchUpstreamJson<T = unknown>(url: string, options: FetchOptions = {}): Promise<T> {+ const res = await fetchUpstream(url, options);+ if (!res.ok) throw new Error(`上游请求失败: ${res.status}`);+ const data = (await res.json()) as T;+ return data;+}++/** 内存 TTL 缓存(豆瓣推荐等热点数据) */+const cache = new Map<string, { value: unknown; expiresAt: number }>();++export function getCache<T>(key: string): T | undefined {+ const entry = cache.get(key);+ if (!entry) return undefined;+ if (Date.now() > entry.expiresAt) {+ cache.delete(key);+ return undefined;+ }+ return entry.value as T;+}++export function setCache(key: string, value: unknown, ttlMs: number): void {+ if (cache.size > 500) {+ // 简单防膨胀:超限时清掉最早过期的条目+ const now = Date.now();+ for (const [k, v] of cache) {+ if (now > v.expiresAt) cache.delete(k);+ }+ if (cache.size > 500) cache.clear();+ }+ cache.set(key, { value, expiresAt: Date.now() + ttlMs });+}diff --git a/libretv-next/src/lib/m3u8.test.ts b/libretv-next/src/lib/m3u8.test.tsnew file mode 100644index 0000000..8ca97d9--- /dev/null+++ b/libretv-next/src/lib/m3u8.test.ts@@ -0,0 +1,53 @@+import { describe, expect, it } from 'vitest';+import { filterAdsFromM3u8, rewriteM3u8 } from './m3u8';++const BASE = 'https://cdn.example.com/live/index.m3u8';++describe('rewriteM3u8', () => {+ it('把分片、嵌套播放列表、key、map 全部改写为代理路径', () => {+ const input = [+ '#EXTM3U',+ '#EXT-X-STREAM-INF:BANDWIDTH=1280000',+ 'https://cdn.example.com/live/720p.m3u8',+ '#EXT-X-KEY:METHOD=AES-128,URI="https://cdn.example.com/key.bin",IV=0x1',+ '#EXT-X-MAP:URI="init.mp4"',+ '/relative/seg1.ts',+ 'seg2.ts',+ '#EXT-X-ENDLIST',+ ].join('\n');++ const out = rewriteM3u8(input, BASE);++ expect(out).toContain('/api/proxy/' + encodeURIComponent('https://cdn.example.com/live/720p.m3u8'));+ expect(out).toContain('/api/proxy/' + encodeURIComponent('https://cdn.example.com/key.bin'));+ expect(out).toContain('/api/proxy/' + encodeURIComponent('https://cdn.example.com/live/init.mp4'));+ expect(out).toContain('/api/proxy/' + encodeURIComponent('https://cdn.example.com/relative/seg1.ts'));+ expect(out).toContain('/api/proxy/' + encodeURIComponent('https://cdn.example.com/live/seg2.ts'));+ // 非地址行保持不变+ expect(out).toContain('#EXTM3U');+ expect(out).toContain('#EXT-X-ENDLIST');+ });++ it('已是代理路径的行不重复改写', () => {+ const input = '/api/proxy/' + encodeURIComponent('https://x.com/a.ts');+ expect(rewriteM3u8(input, BASE)).toBe(input);+ });++ it('超过递归深度限制时原样返回', () => {+ const input = 'https://a.ts';+ expect(rewriteM3u8(input, BASE, 6)).toBe(input);+ });+});++describe('filterAdsFromM3u8', () => {+ it('剔除 DISCONTINUITY 标记,保留其余内容', () => {+ const input = ['#EXTM3U', '#EXT-X-DISCONTINUITY', 'ad.ts', '#EXTINF:10,', 'video.ts', '#EXT-X-DISCONTINUITY'].join('\n');+ const out = filterAdsFromM3u8(input);+ expect(out).not.toContain('#EXT-X-DISCONTINUITY');+ expect(out).toContain('video.ts');+ });++ it('空内容返回空串', () => {+ expect(filterAdsFromM3u8('')).toBe('');+ });+});diff --git a/libretv-next/src/lib/m3u8.ts b/libretv-next/src/lib/m3u8.tsnew file mode 100644index 0000000..1bf8cf7--- /dev/null+++ b/libretv-next/src/lib/m3u8.ts@@ -0,0 +1,48 @@+/**+ * m3u8 处理:代理路径重写与广告分片过滤+ *+ * 鉴权说明:重构后代理走同源 httpOnly cookie 鉴权,+ * hls.js 拉取重写后的分片时浏览器自动携带 cookie,无需再往 URL 上拼接 token,+ * 从根本上修复旧版「重写分片丢失鉴权参数导致 401」的问题。+ */++export const PROXY_PREFIX = '/api/proxy/';++export function makeAbsolute(url: string, base: string): string {+ try {+ return new URL(url, base).href;+ } catch {+ return url;+ }+}++/** 将 m3u8 中的地址改写为经过本站代理的地址(分片/key/map 同样改写) */+export function rewriteM3u8(content: string, baseUrl: string, depth = 0): string {+ if (depth > 5) return content;+ const lines = content.split('\n');+ const out = lines.map((line) => {+ if (line.startsWith('#EXT-X-KEY') || line.startsWith('#EXT-X-MAP')) {+ return line.replace(/(URI=")([^"]+)(")/g, (m, p1: string, uri: string, p2: string) => {+ if (uri.startsWith(PROXY_PREFIX)) return m;+ return p1 + PROXY_PREFIX + encodeURIComponent(makeAbsolute(uri, baseUrl)) + p2;+ });+ }+ if (line.startsWith('#') || line.trim() === '') return line;+ if (line.startsWith(PROXY_PREFIX)) return line;+ return PROXY_PREFIX + encodeURIComponent(makeAbsolute(line, baseUrl));+ });+ return out.join('\n');+}++/**+ * 过滤 m3u8 中的广告分片:移除 #EXT-X-DISCONTINUITY 之后紧邻的插入片段。+ * 采集站广告的典型特征是 DISCONTINUITY 包裹的短时片段组,这里保留与旧版一致+ * 的保守策略:直接剔除 DISCONTINUITY 标记本身,避免误伤正常多码流内容。+ */+export function filterAdsFromM3u8(m3u8Content: string): string {+ if (!m3u8Content) return '';+ return m3u8Content+ .split('\n')+ .filter((line) => !line.includes('#EXT-X-DISCONTINUITY'))+ .join('\n');+}diff --git a/libretv-next/src/lib/ssrf.test.ts b/libretv-next/src/lib/ssrf.test.tsnew file mode 100644index 0000000..0d277ef--- /dev/null+++ b/libretv-next/src/lib/ssrf.test.ts@@ -0,0 +1,42 @@+import { describe, expect, it } from 'vitest';+import { isPrivateIP, isValidProxyUrl } from './ssrf';++describe('isPrivateIP', () => {+ it.each([+ ['127.0.0.1', true],+ ['10.1.2.3', true],+ ['192.168.1.1', true],+ ['172.16.0.1', true],+ ['172.31.255.255', true],+ ['172.32.0.1', false],+ ['169.254.169.254', true],+ ['100.64.0.1', true],+ ['::1', true],+ ['fe80::1', true],+ ['fd00::1', true],+ ['8.8.8.8', false],+ ['1.2.3.4', false],+ ])('%s → %s', (ip, expected) => {+ expect(isPrivateIP(ip)).toBe(expected);+ });+});++describe('isValidProxyUrl', () => {+ it('放行公网 http(s)', () => {+ expect(isValidProxyUrl('https://cdn.example.com/a.m3u8')).toBe(true);+ expect(isValidProxyUrl('http://1.2.3.4/x.ts')).toBe(true);+ });++ it('拦截内网与保留地址', () => {+ expect(isValidProxyUrl('http://localhost/x')).toBe(false);+ expect(isValidProxyUrl('http://127.0.0.1/x')).toBe(false);+ expect(isValidProxyUrl('http://192.168.1.1/x')).toBe(false);+ expect(isValidProxyUrl('http://169.254.169.254/latest/meta-data')).toBe(false);+ });++ it('拦截非 http 协议', () => {+ expect(isValidProxyUrl('file:///etc/passwd')).toBe(false);+ expect(isValidProxyUrl('ftp://x.com/a')).toBe(false);+ expect(isValidProxyUrl('not a url')).toBe(false);+ });+});diff --git a/libretv-next/src/lib/ssrf.ts b/libretv-next/src/lib/ssrf.tsnew file mode 100644index 0000000..9561fe1--- /dev/null+++ b/libretv-next/src/lib/ssrf.ts@@ -0,0 +1,45 @@+import dns from 'node:dns/promises';++/** 判断 IP 是否为私有/回环/链路本地/保留地址(SSRF 防护) */+export function isPrivateIP(ip: string): boolean {+ if (/^(127\.|0\.0\.0\.0$|::1$|fe80:|fc|fd)/i.test(ip)) return true;+ if (ip.startsWith('10.')) return true;+ if (ip.startsWith('192.168.')) return true;+ if (/^172\.(1[6-9]|2\d|3[01])\./.test(ip)) return true;+ if (ip.startsWith('169.254.')) return true; // 链路本地(含云元数据 169.254.169.254)+ if (ip.startsWith('100.64.')) return true; // CGNAT+ if (ip.startsWith('192.0.0.')) return true; // 协议分配块+ return false;+}++const BLOCKED_HOSTNAMES = new Set(['localhost', '127.0.0.1', '0.0.0.0', '::1']);++/** URL 字面量校验:协议白名单 + 主机名/字面量 IP 黑名单 */+export function isValidProxyUrl(urlString: string): boolean {+ try {+ const parsed = new URL(urlString);+ if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return false;+ if (BLOCKED_HOSTNAMES.has(parsed.hostname)) return false;+ const host = parsed.hostname;+ if (/^\d{1,3}(\.\d{1,3}){3}$/.test(host) || host.includes(':')) {+ if (isPrivateIP(host)) return false;+ }+ return true;+ } catch {+ return false;+ }+}++/** DNS 解析后校验目标主机名是否解析到内网/保留地址 */+export async function isBlockedByDNS(urlString: string): Promise<boolean> {+ try {+ const { hostname } = new URL(urlString);+ if (/^\d{1,3}(\.\d{1,3}){3}$/.test(hostname) || hostname.includes(':')) {+ return isPrivateIP(hostname);+ }+ const result = await dns.lookup(hostname, { all: true });+ return result.some((r) => isPrivateIP(r.address));+ } catch {+ return false; // 解析失败不阻断,交给后续请求处理+ }+}diff --git a/libretv-next/src/lib/store.ts b/libretv-next/src/lib/store.tsnew file mode 100644index 0000000..8145c1a--- /dev/null+++ b/libretv-next/src/lib/store.ts@@ -0,0 +1,107 @@+'use client';++import { create } from 'zustand';+import { persist } from 'zustand/middleware';+import type { SourceConfig } from './types';++/**+ * 全局设置(zustand + localStorage 持久化)。+ * 旧版把 10+ 个零散 localStorage key 当作跨页面状态总线,这里统一为单一 store。+ */++export interface AppSettings {+ customAPIs: SourceConfig[];+ selectedKeys: string[];+ yellowFilter: boolean;+ adFilter: boolean;+ doubanEnabled: boolean;+ autoplayNext: boolean;+ imageProxyMode: 'direct' | 'proxy' | 'custom';+ customImageProxy: string;+}++interface AppState extends AppSettings {+ addCustomApi: (api: Omit<SourceConfig, 'key'> & { key?: string }) => void;+ updateCustomApi: (key: string, patch: Partial<SourceConfig>) => void;+ removeCustomApi: (key: string) => void;+ toggleSourceSelected: (key: string) => void;+ setSelectedKeys: (keys: string[]) => void;+ updateSettings: (patch: Partial<Omit<AppSettings, 'customAPIs' | 'selectedKeys'>>) => void;+}++function nextCustomKey(apiList: SourceConfig[]): string {+ let i = 0;+ const used = new Set(apiList.map((a) => a.key));+ while (used.has(`custom_${i}`)) i++;+ return `custom_${i}`;+}++export const useAppStore = create<AppState>()(+ persist(+ (set, get) => ({+ customAPIs: [],+ selectedKeys: [],+ yellowFilter: true,+ adFilter: true,+ doubanEnabled: true,+ autoplayNext: true,+ imageProxyMode: 'direct',+ customImageProxy: '',++ addCustomApi: (api) => {+ const list = get().customAPIs;+ const entry: SourceConfig = { ...api, key: api.key || nextCustomKey(list) };+ set({+ customAPIs: [...list, entry],+ selectedKeys: [...get().selectedKeys, entry.key],+ });+ },++ updateCustomApi: (key, patch) => {+ set({+ customAPIs: get().customAPIs.map((a) => (a.key === key ? { ...a, ...patch } : a)),+ });+ },++ removeCustomApi: (key) => {+ set({+ customAPIs: get().customAPIs.filter((a) => a.key !== key),+ selectedKeys: get().selectedKeys.filter((k) => k !== key),+ });+ },++ toggleSourceSelected: (key) => {+ const cur = get().selectedKeys;+ set({+ selectedKeys: cur.includes(key) ? cur.filter((k) => k !== key) : [...cur, key],+ });+ },++ setSelectedKeys: (keys) => set({ selectedKeys: keys }),++ updateSettings: (patch) => set(patch),+ }),+ {+ name: 'libretv-settings',+ }+ )+);++/** 获取指定 key 的源配置;找不到时支持从 URL 参数兜底构造 */+export function resolveSource(+ store: Pick<AppState, 'customAPIs'>,+ key: string,+ fallback?: { url?: string; detail?: string; name?: string }+): SourceConfig | undefined {+ const found = store.customAPIs.find((a) => a.key === key);+ if (found) return found;+ if (fallback?.url) {+ return {+ key,+ name: fallback.name || '自定义源',+ url: fallback.url,+ detail: fallback.detail,+ };+ }+ return undefined;+}diff --git a/libretv-next/src/lib/types.ts b/libretv-next/src/lib/types.tsnew file mode 100644index 0000000..e201c19--- /dev/null+++ b/libretv-next/src/lib/types.ts@@ -0,0 +1,82 @@+// 采集站(Apple CMS 资源站)描述+export interface SourceConfig {+ /** 唯一标识,如 "custom_0";内置源直接用短名 */+ key: string;+ name: string;+ /** API 根地址,如 https://example.com/api.php/provide/vod */+ url: string;+ /** 可选:详情页根地址(部分源需要爬详情页提取 m3u8) */+ detail?: string;+ isAdult?: boolean;+}++export interface SearchResultItem {+ sourceKey: string;+ sourceName: string;+ vodId: string;+ name: string;+ pic?: string;+ typeName?: string;+ year?: string;+ area?: string;+ remarks?: string;+ /** 自定义源的 API 地址,详情请求需要 */+ sourceUrl?: string;+ isAdult?: boolean;+}++export interface VideoInfo {+ title?: string;+ cover?: string;+ desc?: string;+ typeName?: string;+ year?: string;+ area?: string;+ director?: string;+ actor?: string;+ remarks?: string;+ sourceKey: string;+ sourceName: string;+ sourceUrl?: string;+}++export interface VideoDetail {+ episodes: string[];+ videoInfo: VideoInfo;+}++export interface DoubanItem {+ id: string;+ title: string;+ cover: string;+ rating?: string;+ isTv?: boolean;+}++export interface SourceSearchOutcome {+ sourceKey: string;+ ok: boolean;+ list: SearchResultItem[];+ error?: string;+}++// —— API 响应结构 ——++export interface SearchResponse {+ list: SearchResultItem[];+ failures: { sourceKey: string; error: string }[];+}++export interface DetailResponse extends VideoDetail {}++export interface DoubanResponse {+ items: DoubanItem[];+}++export interface AuthStatusResponse {+ /** 服务器是否配置了 PASSWORD */+ passwordRequired: boolean;+ /** 当前会话是否已验证 */+ verified: boolean;+ version: string;+}diff --git a/libretv-next/src/lib/utils.ts b/libretv-next/src/lib/utils.tsnew file mode 100644index 0000000..e1db33f--- /dev/null+++ b/libretv-next/src/lib/utils.ts@@ -0,0 +1,82 @@+import type { SourceConfig } from './types';++export function cn(...classes: (string | false | null | undefined)[]): string {+ return classes.filter(Boolean).join(' ');+}++export function formatTime(seconds: number): string {+ if (!Number.isFinite(seconds) || seconds < 0) return '00:00';+ const h = Math.floor(seconds / 3600);+ const m = Math.floor((seconds % 3600) / 60);+ const s = Math.floor(seconds % 60);+ const mm = String(m).padStart(2, '0');+ const ss = String(s).padStart(2, '0');+ return h > 0 ? `${h}:${mm}:${ss}` : `${mm}:${ss}`;+}++export function formatRelativeTime(timestamp: number): string {+ const diff = Date.now() - timestamp;+ if (diff < 60_000) return '刚刚';+ if (diff < 3_600_000) return `${Math.floor(diff / 60_000)}分钟前`;+ if (diff < 86_400_000) return `${Math.floor(diff / 3_600_000)}小时前`;+ if (diff < 604_800_000) return `${Math.floor(diff / 86_400_000)}天前`;+ const d = new Date(timestamp);+ const pad = (n: number) => String(n).padStart(2, '0');+ return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;+}++export async function sha256Hex(input: string): Promise<string> {+ const buffer = new TextEncoder().encode(input);+ const hash = await crypto.subtle.digest('SHA-256', buffer);+ return Array.from(new Uint8Array(hash))+ .map((b) => b.toString(16).padStart(2, '0'))+ .join('');+}++/**+ * 封面图加载地址:direct 直连 / proxy 内置代理 / custom 自定义模板({url} 占位符或直接拼接)。+ * 默认 direct,修正旧版「默认 builtin + 部署前手工改回」的配置陷阱。+ */+export function buildImageUrl(+ url: string | undefined,+ mode: 'direct' | 'proxy' | 'custom',+ customTemplate: string+): string | undefined {+ if (!url) return undefined;+ if (mode === 'proxy') return `/api/proxy/${encodeURIComponent(url)}`;+ if (mode === 'custom' && customTemplate) {+ return customTemplate.includes('{url}')+ ? customTemplate.replace('{url}', encodeURIComponent(url))+ : customTemplate + encodeURIComponent(url);+ }+ return url;+}++export function normalizeSourceUrl(url: string): string {+ return url.trim().replace(/\/+$/, '');+}++export function validateSourceUrl(url: string): boolean {+ return /^https?:\/\/.+/.test(url);+}++/** 为分享链接等场景构造观看页 URL */+export function buildWatchUrl(params: {+ sourceKey: string;+ vodId?: string;+ index?: number;+ title?: string;+ episodeUrl?: string;+ sourceUrl?: string;+ detail?: string;+}): string {+ const sp = new URLSearchParams();+ sp.set('source', params.sourceKey);+ if (params.vodId) sp.set('id', params.vodId);+ if (typeof params.index === 'number') sp.set('index', String(params.index));+ if (params.title) sp.set('title', params.title);+ if (params.episodeUrl) sp.set('url', params.episodeUrl);+ if (params.sourceUrl) sp.set('sourceUrl', params.sourceUrl);+ if (params.detail) sp.set('detail', params.detail);+ return `/watch?${sp.toString()}`;+}diff --git a/libretv-next/tailwind.config.ts b/libretv-next/tailwind.config.tsnew file mode 100644index 0000000..44425d8--- /dev/null+++ b/libretv-next/tailwind.config.ts@@ -0,0 +1,46 @@+import type { Config } from 'tailwindcss';++/**+ * 语义化颜色 token:全部通过 CSS 变量驱动,支持亮暗主题切换。+ * 深色主题沿用旧版 LibreTV 配色(#111 页面 / #191919 面板 / #222 卡片 / blue-600 主色)。+ */+const config: Config = {+ darkMode: 'class',+ content: ['./src/**/*.{ts,tsx}'],+ theme: {+ extend: {+ colors: {+ page: 'rgb(var(--c-page) / <alpha-value>)',+ surface: {+ DEFAULT: 'rgb(var(--c-surface) / <alpha-value>)',+ raised: 'rgb(var(--c-surface-raised) / <alpha-value>)',+ },+ card: 'rgb(var(--c-card) / <alpha-value>)',+ chip: 'rgb(var(--c-chip) / <alpha-value>)',+ hover: 'rgb(var(--c-hover) / <alpha-value>)',+ line: 'rgb(var(--c-line) / <alpha-value>)',+ content: 'rgb(var(--c-content) / <alpha-value>)',+ muted: 'rgb(var(--c-muted) / <alpha-value>)',+ faint: 'rgb(var(--c-faint) / <alpha-value>)',+ accent: {+ DEFAULT: 'rgb(var(--c-accent) / <alpha-value>)',+ hover: 'rgb(var(--c-accent-hover) / <alpha-value>)',+ },+ },+ keyframes: {+ 'fade-in': { from: { opacity: '0' }, to: { opacity: '1' } },+ 'slide-up': {+ from: { opacity: '0', transform: 'translateY(8px)' },+ to: { opacity: '1', transform: 'translateY(0)' },+ },+ },+ animation: {+ 'fade-in': 'fade-in 0.2s ease-out',+ 'slide-up': 'slide-up 0.25s ease-out',+ },+ },+ },+ plugins: [],+};++export default config;diff --git a/libretv-next/tsconfig.json b/libretv-next/tsconfig.jsonnew file mode 100644index 0000000..334fafd--- /dev/null+++ b/libretv-next/tsconfig.json@@ -0,0 +1,21 @@+{+ "compilerOptions": {+ "target": "ES2022",+ "lib": ["dom", "dom.iterable", "esnext"],+ "allowJs": true,+ "skipLibCheck": true,+ "strict": true,+ "noEmit": true,+ "esModuleInterop": true,+ "module": "esnext",+ "moduleResolution": "bundler",+ "resolveJsonModule": true,+ "isolatedModules": true,+ "jsx": "preserve",+ "incremental": true,+ "plugins": [{ "name": "next" }],+ "paths": { "@/*": ["./src/*"] }+ },+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],+ "exclude": ["node_modules"]+}diff --git a/libretv-next/vitest.config.ts b/libretv-next/vitest.config.tsnew file mode 100644index 0000000..6d132c7--- /dev/null+++ b/libretv-next/vitest.config.ts@@ -0,0 +1,12 @@+import { defineConfig } from 'vitest/config';+import path from 'path';++export default defineConfig({+ test: {+ include: ['src/**/*.test.ts'],+ environment: 'node',+ },+ resolve: {+ alias: { '@': path.resolve(__dirname, './src') },+ },+});