diff --git a/.cursor/agent/产品经理/evolution/2026-03-10.md b/.cursor/agent/产品经理/evolution/2026-03-10.md new file mode 100644 index 00000000..e5f77d22 --- /dev/null +++ b/.cursor/agent/产品经理/evolution/2026-03-10.md @@ -0,0 +1,13 @@ +# 产品经理 经验记录 - 2026-03-10 + +## 管理端迁移 Mycontent-temp:信息架构与验收口径 + +- **主导航收敛**:侧栏只保留运营主链路 5 项(概览/内容/用户/找伙伴/推广),系统设置固定在底部;其余能力不删除但不占主导航入口。 +- **入口承载策略**:非主菜单页面(订单/提现/推广设置/VIP角色/导师等)通过“概览卡片/页面内按钮/系统设置 Tab”进入,确保可达且路径更短。 +- **验收标准**: + - 菜单与布局一致(新规范) + - 隐藏页面路由仍可访问(功能不丢) + - author/admin 设置统一在 `/settings?tab=...` 承载,旧路径可兼容跳转 + +> 详见会议纪要:`.cursor/meeting/2026-03-10_管理端迁移Mycontent-temp菜单布局讨论.md` + diff --git a/.cursor/agent/产品经理/evolution/索引.md b/.cursor/agent/产品经理/evolution/索引.md index fbdc760a..5e876b42 100644 --- a/.cursor/agent/产品经理/evolution/索引.md +++ b/.cursor/agent/产品经理/evolution/索引.md @@ -4,3 +4,4 @@ |------|------|------| | 2026-03-05 | 分支冲突后需求文档与实现一致性核对 | [2026-03-05.md](./2026-03-05.md) | | 2026-03-05 | 文章详情@某人高亮与一键加好友验收标准与待确认 | [2026-03-05.md](./2026-03-05.md) | +| 2026-03-10 | 管理端迁移 Mycontent-temp:主导航收敛与隐藏页面入口承载策略 | [2026-03-10.md](./2026-03-10.md) | diff --git a/.cursor/agent/后端工程师/evolution/2026-03-10.md b/.cursor/agent/后端工程师/evolution/2026-03-10.md new file mode 100644 index 00000000..8755e1dd --- /dev/null +++ b/.cursor/agent/后端工程师/evolution/2026-03-10.md @@ -0,0 +1,67 @@ +# 后端工程师 经验记录 - 2026-03-10 + +## 管理端迁移 Mycontent-temp:后端视角注意点 + +- **接口边界不变**:管理端迁移/重构只允许调用 `/api/admin/*`、`/api/db/*`、`/api/orders`,严禁引入 `/api/miniprogram/*`。 +- **概览聚合接口可选**:`/api/admin/dashboard/overview` 可作为“优化项”提供更轻量的统计聚合,但必须保留**降级策略**(用 `/api/db/users` + `/api/orders` 拼)以免阻塞前端迁移与部署节奏。 +- **鉴权一致性**:页面入口/菜单变化不影响鉴权口径,仍以 `GET /api/admin` 作为 session/token 校验;401 统一跳登录并清 token。 + +> 详见会议纪要:`.cursor/meeting/2026-03-10_管理端迁移Mycontent-temp菜单布局讨论.md` + +--- + +## 新增聚合接口 UserDashboardStats + +**场景**:小程序「我的」页需要一个聚合接口返回阅读统计,避免多次请求。 + +**接口**:`GET /api/miniprogram/user/dashboard-stats?userId=xxx` + +**数据来源**: +- `readSectionIds` / `readCount` → `reading_progress` WHERE `user_id = userId` +- `totalReadMinutes` → `SUM(duration) / 60`(秒转分,最小值 1 分钟) +- `recentChapters` → `reading_progress` ORDER BY `last_open_at DESC` JOIN `chapters`(最近 5 条**去重**) +- `matchHistory` → `match_records` COUNT WHERE `user_id = userId` + +**三处 bug 修复点**(对比 Mycontent-temp 参考版发现): + +| Bug | 错误做法 | 正确做法 | +|-----|---------|---------| +| 最近阅读重复 | 直接取前 5 条(同章节可重复) | `seenRecent` map 去重,保证 5 条不重复 | +| 阅读时长最小值 | 不足 60 秒返回 0 | `if totalReadSeconds > 0 && totalReadMinutes == 0 { totalReadMinutes = 1 }` | +| DB 错误状态码 | 返回 200 + `success:false` | 返回 HTTP 500 `InternalServerError` | + +**规则沉淀**:新增聚合接口时,先参考已有版本实现,对比 diff 后修复潜在 bug,再提交。 + +> 详见会议纪要:`.cursor/meeting/2026-03-10_小程序新旧版对比与dashboard接口新增.md` + +--- + +## chapters 表新增 hot_score 字段 + +### 问题 + +前端 `ContentPage.tsx` 保存章节时传递 `hotScore` 字段,但后端 model 和数据库均缺少该列,导致: +``` +Error 1054 (42S22): Unknown column 'hot_score' in 'field list' +``` + +### 修复步骤 + +1. 执行迁移 SQL(`soul-api/scripts/add-hot-score.sql`): + ```sql + ALTER TABLE chapters ADD COLUMN hot_score INT NOT NULL DEFAULT 0; + ``` +2. 同步 model(`internal/model/chapter.go`): + ```go + HotScore int `gorm:"column:hot_score;default:0" json:"hotScore"` + ``` +3. 重启后端服务生效 + +### 规则沉淀 + +- **model 与 DB 必须同步**:前端传入新字段时,必须先确认 DB 列存在,再确认 model struct 中有对应字段,缺一不可 +- **变更流程**:前端加字段 → ALTER TABLE → 更新 model struct → 重启服务 +- 迁移 SQL 统一放 `soul-api/scripts/` 目录,文件名格式 `add-{描述}.sql` + +> 详见会议纪要:`.cursor/meeting/2026-03-10_Toast通知系统全局落地.md` + diff --git a/.cursor/agent/后端工程师/evolution/索引.md b/.cursor/agent/后端工程师/evolution/索引.md index a3f19dbe..4d319129 100644 --- a/.cursor/agent/后端工程师/evolution/索引.md +++ b/.cursor/agent/后端工程师/evolution/索引.md @@ -4,3 +4,4 @@ |------|------|------| | 2026-03-05 | soul-api 合并状态确认;orders、distribution 接口核对 | [2026-03-05.md](./2026-03-05.md) | | 2026-03-05 | 文章详情@某人:content 内嵌 @ 标记、miniprogram 添加好友接口 | [2026-03-05.md](./2026-03-05.md) | +| 2026-03-10 | 管理端迁移 Mycontent-temp:接口边界不变;overview 聚合接口可选但需降级 | [2026-03-10.md](./2026-03-10.md) | diff --git a/.cursor/agent/团队/evolution/2026-03-08.md b/.cursor/agent/团队/evolution/2026-03-08.md new file mode 100644 index 00000000..ef457126 --- /dev/null +++ b/.cursor/agent/团队/evolution/2026-03-08.md @@ -0,0 +1,20 @@ +# 团队共享 经验记录 - 2026-03-08 + +## 文章阅读付费规则澄清与后端修复 + +### 业务规则(全团队共识) + +1. **非会员专属文章**:免费,无需登录/付费;以管理端「系统设置 → 免费章节」配置为准 +2. **VIP 会员**:开通 VIP 后,所有文章免费阅读;`check-purchased` 按 `is_vip=1` 且 `vip_expire_date>NOW` 返回 `isPurchased: true` + +### 技术实现 + +- **免费章节**:soul-api `book.go` 从 `system_config.free_chapters` 或 `chapter_config.freeChapters` 读取,优先于 chapters 表 +- **VIP 全章免费**:`user.go` 的 `UserCheckPurchased` 已实现,无需改动 + +### 影响角色 + +- 后端:book.go 变更,部署后需重启 +- 管理端:确保免费章节配置正确 +- 产品:作为验收规则 +- 小程序:无变更 diff --git a/.cursor/agent/团队/evolution/2026-03-10.md b/.cursor/agent/团队/evolution/2026-03-10.md new file mode 100644 index 00000000..c4077cbf --- /dev/null +++ b/.cursor/agent/团队/evolution/2026-03-10.md @@ -0,0 +1,144 @@ +# 团队共享 经验记录 - 2026-03-10 + +## 在 Windows 上一键启动 macOS 虚拟机(“龙虾”智能体经验) + +### 场景 / 问题 + +- 成员希望在 **Windows 10/11** 上通过 **Docker** 一键安装 macOS,用于演示 / 测试。 +- 实际上: + - **macOS 不能在 Docker 中运行**(Docker 只跑 Linux 容器,没有合法的 macOS 镜像)。 + - 唯一可行路径是:**WSL2 + Ubuntu + QEMU/KVM + OneClick-macOS-Simple-KVM**。 + +### 关键决策 + +1. **明确技术与法律边界** + - 不支持也不承诺在 Docker 中直接跑 macOS。 + - 统一采用「**WSL2 + QEMU/KVM + OneClick**」这个方案,仅用于演示 / 测试。 + +2. **固定目录与流程约定** + - Windows 侧统一放在:`C:\Users\{USERNAME}\Mycontent\macos-vm` + - WSL 侧路径:`/mnt/c/Users/{USERNAME}/Mycontent/macos-vm` + - 内部结构: + - `OneClick-macOS-Simple-KVM/` + - `BaseSystem.dmg` / `BaseSystem.img` + - `macOS.qcow2` + +3. **获取 OneClick 源码时优先走 zip,而不是 git clone** + - 直接 `git clone` 很容易在国内网络环境下触发 `GnuTLS recv error (-110)` 等 TLS 超时。 + - 统一约定使用: + - `https://codeload.github.com/notAperson535/OneClick-macOS-Simple-KVM/zip/refs/heads/master` + - 然后在 WSL 中: + - `curl + unzip` → 解压 → 重命名为 `OneClick-macOS-Simple-KVM`。 + +4. **依赖安装与 KVM 检查** + - 在 Ubuntu-24.04 内安装: + - `qemu-system qemu-utils python3 python3-pip cpu-checker` + - 使用 `kvm-ok` 检查: + - 期望输出:`/dev/kvm exists` + `KVM acceleration can be used`。 + - 若 `nested` 为 `N` 且需要嵌套虚拟化,使用 `.wslconfig` 打开 nested。 + +5. **下载 macOS Ventura 恢复镜像并生成 BaseSystem.img** + - 通过 `python3 fetch-macOS-v2.py -s ventura` 下载官方 Recovery 镜像。 + - 将 `RecoveryImage.dmg` 重命名为 `BaseSystem.dmg`,再用 `qemu-img convert` 生成 `BaseSystem.img`。 + - 验收标准: + - `BaseSystem.dmg` ≈ 678 MB + - `BaseSystem.img` ≈ 3.0 GB + +6. **以 HEADLESS + VNC 方式启动 VM** + - 使用 `sudo HEADLESS=1 ./basic.sh` 启动 QEMU。 + - 在 Windows 中确认 `127.0.0.1:5900` 端口监听。 + - 统一告知使用 VNC 客户端连接 `localhost:5900`,再在图形界面内完成 macOS 安装向导。**用户环境已采用 TightVNC**,与 RealVNC Viewer 等方式等效。 + +7. **WSL 卡死与多 wsl 进程清理策略** + - 当 `wsl --shutdown` 卡住、或者有大量 `wsl` 进程残留时: + - 使用 PowerShell `Get-Process wsl | Stop-Process -Force` 清理。 + - 再执行 `wsl --shutdown` + `wsl -l -v` 验证状态恢复。 + +### 对应 Skill / 智能体 + +- 新建 Skill:`.cursor/skills/lobster-macos-vm/SKILL.md` + - 技能名:`lobster-macos-vm` + - 智能体名(对外):**“龙虾”** + - 职责:当用户在 Windows 上提出安装 / 维护 macOS 虚拟机的需求时,统一按该 Skill 流程执行: + - 解释 Docker 不可用 → 切换到 WSL2 + QEMU 方案。 + - 固定目录 → 下载 OneClick → 安装依赖 → 下载 Ventura → 生成 `BaseSystem.img` → HEADLESS 启动 → 引导 VNC 安装。 + +- 计划脚本化: + - 在 `开发文档/服务器管理/scripts/lobster_macos_vm.py` 中实现一键部署脚本,封装上述流程,供“龙虾”及人类成员复用。 + +### 用户环境补充 + +- **VNC 客户端**:当前环境使用 **TightVNC** 连接 `localhost:5900`,已写入龙虾 Skill,后续回复可一并推荐 TightVNC / RealVNC / TigerVNC 等。 + +### 适用角色 + +- 后端 / 运维:需要在本地或服务器上快速拉起 macOS VM 做兼容性验证或演示。 +- 团队:对外说明 **“我们不支持 Docker macOS,统一用龙虾方案”**。 + +--- + +## 管理端迁移 Mycontent-temp:菜单/布局新规范基线 + +### 决议(团队共享) + +- **目标态基线**:以 `Mycontent-temp/soul-admin` 的 `AdminLayout` + `SettingsPage` 作为“新规范基线”,后续管理端所有菜单/布局调整按该基线执行,避免两套后台并行发散。 +- **主导航收敛**:侧栏只保留 5 个主入口(概览/内容/用户/找伙伴/推广),系统设置固定底部,取消“更多”折叠入口。 +- **功能不丢但入口收敛**:订单/提现/推广设置/VIP角色/导师等页面保留路由可达,入口通过概览卡片或页面内跳转承载;作者/管理员设置并入 `/settings?tab=author|admin`。 + +### 实施建议 + +- 迁移时优先保证:**鉴权一致(GET /api/admin)**、**路由可达性**、**菜单一致性**,再逐步优化概览聚合接口与快捷入口。 + +--- + +## 新旧版代码对比方法论(Mycontent-temp vs miniprogram) + +### 场景 + +存在两个并行代码库(主线 + 预览版),需要判断哪个版本更可靠,以及如何安全地吸收另一版的优点。 + +### 最佳实践 + +1. **批量 diff 优先于逐文件比较**:用 PowerShell 批量对比 WXSS/JS/WXML 文件,精确列出「相同/有差异」的文件清单,再聚焦差异文件逐一分析。 +2. **以功能完整性为基准**:不以「新/旧」日期判断优劣,而以**功能是否完整**为主要依据;本次判断旧版(miniprogram)才是功能更完整的版本。 +3. **差异归类**: + - **旧版有、新版没有** → 旧版是主线,保留旧版 + - **新版有、旧版没有** → 评估是否需要移植(如 dashboard-stats 调用) + - **样式差异** → 对比具体行数,判断是改进还是遗漏 +4. **接口对比时对照新版参考修复 bug**:新版的接口实现即使存在,也可能有遗漏;参考后自行修复(去重、最小值、错误码等)再提交。 + +### 适用场景 + +- 分支合并前的功能完整性分析 +- 迁移预览版到主线时的取舍决策 +- 跨版本 bug 溯源 + +> 同时影响:小程序开发工程师、后端工程师 +> 详见会议纪要:`.cursor/meeting/2026-03-10_小程序新旧版对比与dashboard接口新增.md` + +--- + +## Toast 通知系统 & DB 变更 SOP(团队共享) + +### Toast 批量替换方法论 + +使用 PowerShell 正则脚本批量替换 alert → toast,**替换后必须人工复查 `toast.info()`**: +- 验证提示类("请输入/请填写/密码至少/ID已存在")被脚本误判为 info,应改为 error +- 核查方式:`grep -r "toast.info(" src/` 逐条确认语义 + +### DB 变更 SOP(前后端联动) + +当前端新增字段时,完整变更流程: + +| 步骤 | 执行方 | 操作 | +|------|--------|------| +| 1 | 后端 | 执行 `ALTER TABLE` 或用 `db-exec` 脚本 | +| 2 | 后端 | 更新 `internal/model/*.go` struct | +| 3 | 后端 | 重启服务验证 | +| 4 | 管理端 | 确认保存请求不再报 1054 | + +若跳过任一步骤,GORM 写入时必报 `Unknown column`。 + +> 同时影响:管理端开发工程师、后端工程师 +> 详见会议纪要:`.cursor/meeting/2026-03-10_Toast通知系统全局落地.md` + diff --git a/.cursor/agent/团队/evolution/索引.md b/.cursor/agent/团队/evolution/索引.md index 72a8adf9..47f4dc7a 100644 --- a/.cursor/agent/团队/evolution/索引.md +++ b/.cursor/agent/团队/evolution/索引.md @@ -5,3 +5,4 @@ | 日期 | 摘要 | 文件 | |------|------|------| | 2026-03-05 | 分支冲突后各端完整性自查流程 | [2026-03-05.md](./2026-03-05.md) | +| 2026-03-10 | 管理端迁移 Mycontent-temp:菜单/布局新规范基线与入口收敛规则 | [2026-03-10.md](./2026-03-10.md) | diff --git a/.cursor/agent/小程序开发工程师/evolution/2026-03-10.md b/.cursor/agent/小程序开发工程师/evolution/2026-03-10.md new file mode 100644 index 00000000..10066f86 --- /dev/null +++ b/.cursor/agent/小程序开发工程师/evolution/2026-03-10.md @@ -0,0 +1,46 @@ +# 小程序开发工程师 经验记录 - 2026-03-10 + +## 管理端迁移 Mycontent-temp:小程序侧关注点 + +- **菜单/布局迁移不应影响小程序接口**:管理端仅重排入口与页面承载,禁止因此改动小程序端接口路径或混用 `/api/miniprogram/*`。 +- **内容编辑产物稳定性**:如果管理端迁移导致内容从 Markdown → HTML(TipTap)或 mention/tag 的序列化结构变化,小程序阅读页解析必须同步升级并回归兼容。 +- **验收建议**:迁移期间抽样验证“新编辑器保存的内容”在小程序阅读页可正常渲染与交互(@ 点击加好友、# 标签等)。 + +> 详见会议纪要:`.cursor/meeting/2026-03-10_管理端迁移Mycontent-temp菜单布局讨论.md` + +--- + +## my.js 阅读统计改为后端接口(loadDashboardStats 移植) + +**场景**:旧版 `my.js` 的 `initUserStatus()` 用本地缓存随机数时间(`Math.floor(Math.random() * 200) + 50`)和标题占位(`章节 ${id}`)展示统计,不准确且不一致。 + +**解决方案**: +1. 移植 Mycontent-temp 中的 `loadDashboardStats()` 方法 +2. 调用 `/api/miniprogram/user/dashboard-stats?userId=xxx` +3. 同步 `readSectionIds` 到 `app.globalData` 和 Storage +4. 返回真实 `recentChapters`(含标题/mid)、`readCount`、`totalReadMinutes`、`matchHistory` + +**initUserStatus 改造要点**: +- `readCount` 初始化为 `0`(不再读本地缓存) +- `recentChapters` 初始化为 `[]` +- `totalReadTime` 初始化为 `0`(不再用随机数) +- 新增 `matchHistory: 0` 字段 +- 登录状态下额外调用 `this.loadDashboardStats()` + +**规则沉淀**:`my.js` 阅读统计必须走后端接口,禁止用本地缓存 + 随机数占位展示统计数据。 + +--- + +## 富文本渲染现状(技术债,待实施) + +**现状**:`contentParser.js` 将 TipTap HTML 剥成纯文本,``/`

`/`

"),e=e.replace(/^## (.+)$/gm,"

$1

"),e=e.replace(/^# (.+)$/gm,"

$1

"),e=e.replace(/\*\*(.+?)\*\*/g,"$1"),e=e.replace(/\*(.+?)\*/g,"$1"),e=e.replace(/~~(.+?)~~/g,"$1"),e=e.replace(/`([^`]+)`/g,"$1"),e=e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'$1'),e=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'
$1'),e=e.replace(/^> (.+)$/gm,"

$1

"),e=e.replace(/^---$/gm,"
"),e=e.replace(/^- (.+)$/gm,"
  • $1
  • ");const n=e.split(` +`),r=[];for(const s of n){const a=s.trim();a&&(/^<(?:h[1-6]|blockquote|hr|li|ul|ol|table|img)/.test(a)?r.push(a):r.push(`

    ${a}

    `))}return r.join("")}const $$=un.create({name:"linkTag",group:"inline",inline:!0,selectable:!0,atom:!0,addAttributes(){return{label:{default:""},url:{default:""},tagType:{default:"url",parseHTML:t=>t.getAttribute("data-tag-type")||"url"},tagId:{default:"",parseHTML:t=>t.getAttribute("data-tag-id")||""},pagePath:{default:"",parseHTML:t=>t.getAttribute("data-page-path")||""}}},parseHTML(){return[{tag:'span[data-type="linkTag"]',getAttrs:t=>{var e;return{label:((e=t.textContent)==null?void 0:e.replace(/^#/,"").trim())||"",url:t.getAttribute("data-url")||"",tagType:t.getAttribute("data-tag-type")||"url",tagId:t.getAttribute("data-tag-id")||"",pagePath:t.getAttribute("data-page-path")||""}}}]},renderHTML({node:t,HTMLAttributes:e}){return["span",yt(e,{"data-type":"linkTag","data-url":t.attrs.url,"data-tag-type":t.attrs.tagType,"data-tag-id":t.attrs.tagId,"data-page-path":t.attrs.pagePath,class:"link-tag-node"}),`#${t.attrs.label}`]}}),F$=t=>({items:({query:e})=>t.filter(n=>n.name.toLowerCase().includes(e.toLowerCase())||n.id.includes(e)).slice(0,8),render:()=>{let e=null,n=0,r=[],s=null;const a=()=>{e&&(e.innerHTML=r.map((o,c)=>`
    + @${o.name} + ${o.label||o.id} +
    `).join(""),e.querySelectorAll(".mention-item").forEach(o=>{o.addEventListener("click",()=>{const c=parseInt(o.getAttribute("data-index")||"0");s&&r[c]&&s({id:r[c].id,label:r[c].name})})}))};return{onStart:o=>{if(e=document.createElement("div"),e.className="mention-popup",document.body.appendChild(e),r=o.items,s=o.command,n=0,a(),o.clientRect){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onUpdate:o=>{if(r=o.items,s=o.command,n=0,a(),o.clientRect&&e){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onKeyDown:o=>o.event.key==="ArrowUp"?(n=Math.max(0,n-1),a(),!0):o.event.key==="ArrowDown"?(n=Math.min(r.length-1,n+1),a(),!0):o.event.key==="Enter"?(s&&r[n]&&s({id:r[n].id,label:r[n].name}),!0):o.event.key==="Escape"?(e==null||e.remove(),e=null,!0):!1,onExit:()=>{e==null||e.remove(),e=null}}}}),fx=b.forwardRef(({content:t,onChange:e,onImageUpload:n,persons:r=[],linkTags:s=[],placeholder:a="开始编辑内容...",className:o},c)=>{const u=b.useRef(null),[h,f]=b.useState(""),[m,g]=b.useState(!1),y=b.useRef(Qw(t)),v=O_({extensions:[w7,k7.configure({inline:!0,allowBase64:!0}),Az.configure({openOnClick:!1,HTMLAttributes:{class:"rich-link"}}),A7.configure({HTMLAttributes:{class:"mention-tag"},suggestion:F$(r)}),$$,R7.configure({placeholder:a}),CC.configure({resizable:!0}),SC,jC,kC],content:y.current,onUpdate:({editor:E})=>{e(E.getHTML())},editorProps:{attributes:{class:"rich-editor-content"}}});b.useImperativeHandle(c,()=>({getHTML:()=>(v==null?void 0:v.getHTML())||"",getMarkdown:()=>z$((v==null?void 0:v.getHTML())||"")})),b.useEffect(()=>{if(v&&t!==v.getHTML()){const E=Qw(t);E!==v.getHTML()&&v.commands.setContent(E)}},[t]);const j=b.useCallback(async E=>{var T;const C=(T=E.target.files)==null?void 0:T[0];if(!(!C||!v)){if(n){const O=await n(C);O&&v.chain().focus().setImage({src:O}).run()}else{const O=new FileReader;O.onload=()=>{typeof O.result=="string"&&v.chain().focus().setImage({src:O.result}).run()},O.readAsDataURL(C)}E.target.value=""}},[v,n]),w=b.useCallback(E=>{v&&v.chain().focus().insertContent({type:"linkTag",attrs:{label:E.label,url:E.url||"",tagType:E.type||"url",tagId:E.id||"",pagePath:E.pagePath||""}}).run()},[v]),k=b.useCallback(()=>{!v||!h||(v.chain().focus().setLink({href:h}).run(),f(""),g(!1))},[v,h]);return v?i.jsxs("div",{className:`rich-editor-wrapper ${o||""}`,children:[i.jsxs("div",{className:"rich-editor-toolbar",children:[i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().toggleBold().run(),className:v.isActive("bold")?"is-active":"",type:"button",children:i.jsx(TT,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleItalic().run(),className:v.isActive("italic")?"is-active":"",type:"button",children:i.jsx(MM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleStrike().run(),className:v.isActive("strike")?"is-active":"",type:"button",children:i.jsx(EA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleCode().run(),className:v.isActive("code")?"is-active":"",type:"button",children:i.jsx(GT,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),className:v.isActive("heading",{level:1})?"is-active":"",type:"button",children:i.jsx(vM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),className:v.isActive("heading",{level:2})?"is-active":"",type:"button",children:i.jsx(wM,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),className:v.isActive("heading",{level:3})?"is-active":"",type:"button",children:i.jsx(jM,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().toggleBulletList().run(),className:v.isActive("bulletList")?"is-active":"",type:"button",children:i.jsx($M,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleOrderedList().run(),className:v.isActive("orderedList")?"is-active":"",type:"button",children:i.jsx(_M,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().toggleBlockquote().run(),className:v.isActive("blockquote")?"is-active":"",type:"button",children:i.jsx(hA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().setHorizontalRule().run(),type:"button",children:i.jsx(YM,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:j,className:"hidden"}),i.jsx("button",{onClick:()=>{var E;return(E=u.current)==null?void 0:E.click()},type:"button",children:i.jsx(FN,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>g(!m),className:v.isActive("link")?"is-active":"",type:"button",children:i.jsx(bg,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",children:i.jsx(MA,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"toolbar-divider"}),i.jsxs("div",{className:"toolbar-group",children:[i.jsx("button",{onClick:()=>v.chain().focus().undo().run(),disabled:!v.can().undo(),type:"button",children:i.jsx(LA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().redo().run(),disabled:!v.can().redo(),type:"button",children:i.jsx(pA,{className:"w-4 h-4"})})]}),s.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"toolbar-divider"}),i.jsx("div",{className:"toolbar-group",children:i.jsxs("select",{className:"link-tag-select",onChange:E=>{const C=s.find(T=>T.id===E.target.value);C&&w(C),E.target.value=""},defaultValue:"",children:[i.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),s.map(E=>i.jsx("option",{value:E.id,children:E.label},E.id))]})})]})]}),m&&i.jsxs("div",{className:"link-input-bar",children:[i.jsx("input",{type:"url",placeholder:"输入链接地址...",value:h,onChange:E=>f(E.target.value),onKeyDown:E=>E.key==="Enter"&&k(),className:"link-input"}),i.jsx("button",{onClick:k,className:"link-confirm",type:"button",children:"确定"}),i.jsx("button",{onClick:()=>{v.chain().focus().unsetLink().run(),g(!1)},className:"link-remove",type:"button",children:"移除"})]}),i.jsx(L2,{editor:v})]}):null});fx.displayName="RichEditor";const B$=["top","right","bottom","left"],ea=Math.min,Nr=Math.max,Wh=Math.round,Lu=Math.floor,Cs=t=>({x:t,y:t}),V$={left:"right",right:"left",bottom:"top",top:"bottom"},H$={start:"end",end:"start"};function px(t,e,n){return Nr(t,ea(e,n))}function ni(t,e){return typeof t=="function"?t(e):t}function ri(t){return t.split("-")[0]}function pl(t){return t.split("-")[1]}function D0(t){return t==="x"?"y":"x"}function L0(t){return t==="y"?"height":"width"}const W$=new Set(["top","bottom"]);function ks(t){return W$.has(ri(t))?"y":"x"}function _0(t){return D0(ks(t))}function U$(t,e,n){n===void 0&&(n=!1);const r=pl(t),s=_0(t),a=L0(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=Uh(o)),[o,Uh(o)]}function K$(t){const e=Uh(t);return[mx(t),e,mx(e)]}function mx(t){return t.replace(/start|end/g,e=>H$[e])}const Xw=["left","right"],Zw=["right","left"],q$=["top","bottom"],G$=["bottom","top"];function J$(t,e,n){switch(t){case"top":case"bottom":return n?e?Zw:Xw:e?Xw:Zw;case"left":case"right":return e?q$:G$;default:return[]}}function Y$(t,e,n,r){const s=pl(t);let a=J$(ri(t),n==="start",r);return s&&(a=a.map(o=>o+"-"+s),e&&(a=a.concat(a.map(mx)))),a}function Uh(t){return t.replace(/left|right|bottom|top/g,e=>V$[e])}function Q$(t){return{top:0,right:0,bottom:0,left:0,...t}}function EC(t){return typeof t!="number"?Q$(t):{top:t,right:t,bottom:t,left:t}}function Kh(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function eN(t,e,n){let{reference:r,floating:s}=t;const a=ks(e),o=_0(e),c=L0(o),u=ri(e),h=a==="y",f=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,g=r[c]/2-s[c]/2;let y;switch(u){case"top":y={x:f,y:r.y-s.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-s.width,y:m};break;default:y={x:r.x,y:r.y}}switch(pl(e)){case"start":y[o]-=g*(n&&h?-1:1);break;case"end":y[o]+=g*(n&&h?-1:1);break}return y}async function X$(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:a,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=ni(e,t),v=EC(y),w=c[g?m==="floating"?"reference":"floating":m],k=Kh(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(w)))==null||n?w:w.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),E=m==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),T=await(a.isElement==null?void 0:a.isElement(C))?await(a.getScale==null?void 0:a.getScale(C))||{x:1,y:1}:{x:1,y:1},O=Kh(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:C,strategy:u}):E);return{top:(k.top-O.top+v.top)/T.y,bottom:(O.bottom-k.bottom+v.bottom)/T.y,left:(k.left-O.left+v.left)/T.x,right:(O.right-k.right+v.right)/T.x}}const Z$=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:o}=n,c=a.filter(Boolean),u=await(o.isRTL==null?void 0:o.isRTL(e));let h=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:f,y:m}=eN(h,r,u),g=r,y={},v=0;for(let w=0;w({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:a,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=ni(t,e)||{};if(h==null)return{};const m=EC(f),g={x:n,y:r},y=_0(s),v=L0(y),j=await o.getDimensions(h),w=y==="y",k=w?"top":"left",E=w?"bottom":"right",C=w?"clientHeight":"clientWidth",T=a.reference[v]+a.reference[y]-g[y]-a.floating[v],O=g[y]-a.reference[y],B=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let R=B?B[C]:0;(!R||!await(o.isElement==null?void 0:o.isElement(B)))&&(R=c.floating[C]||a.floating[v]);const P=T/2-O/2,I=R/2-j[v]/2-1,L=ea(m[k],I),X=ea(m[E],I),Z=L,Y=R-j[v]-X,W=R/2-j[v]/2+P,D=px(Z,W,Y),$=!u.arrow&&pl(s)!=null&&W!==D&&a.reference[v]/2-(WW<=0)){var X,Z;const W=(((X=a.flip)==null?void 0:X.index)||0)+1,D=R[W];if(D&&(!(m==="alignment"?E!==ks(D):!1)||L.every(_=>ks(_.placement)===E?_.overflows[0]>0:!0)))return{data:{index:W,overflows:L},reset:{placement:D}};let $=(Z=L.filter(ae=>ae.overflows[0]<=0).sort((ae,_)=>ae.overflows[1]-_.overflows[1])[0])==null?void 0:Z.placement;if(!$)switch(y){case"bestFit":{var Y;const ae=(Y=L.filter(_=>{if(B){const se=ks(_.placement);return se===E||se==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(se=>se>0).reduce((se,q)=>se+q,0)]).sort((_,se)=>_[1]-se[1])[0])==null?void 0:Y[0];ae&&($=ae);break}case"initialPlacement":$=c;break}if(s!==$)return{reset:{placement:$}}}return{}}}};function tN(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function nN(t){return B$.some(e=>t[e]>=0)}const nF=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...a}=ni(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...a,elementContext:"reference"}),c=tN(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:nN(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...a,altBoundary:!0}),c=tN(o,n.floating);return{data:{escapedOffsets:c,escaped:nN(c)}}}default:return{}}}}},TC=new Set(["left","top"]);async function rF(t,e){const{placement:n,platform:r,elements:s}=t,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=ri(n),c=pl(n),u=ks(n)==="y",h=TC.has(o)?-1:1,f=a&&u?-1:1,m=ni(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof v=="number"&&(y=c==="end"?v*-1:v),u?{x:y*f,y:g*h}:{x:g*h,y:y*f}}const sF=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:a,placement:o,middlewareData:c}=e,u=await rF(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:s+u.x,y:a+u.y,data:{...u,placement:o}}}}},iF=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:a}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:E,y:C}=k;return{x:E,y:C}}},...h}=ni(t,e),f={x:n,y:r},m=await a.detectOverflow(e,h),g=ks(ri(s)),y=D0(g);let v=f[y],j=f[g];if(o){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",C=v+m[k],T=v-m[E];v=px(C,v,T)}if(c){const k=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=j+m[k],T=j-m[E];j=px(C,j,T)}const w=u.fn({...e,[y]:v,[g]:j});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[y]:o,[g]:c}}}}}},aF=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:a,middlewareData:o}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=ni(t,e),f={x:n,y:r},m=ks(s),g=D0(m);let y=f[g],v=f[m];const j=ni(c,e),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(u){const C=g==="y"?"height":"width",T=a.reference[g]-a.floating[C]+w.mainAxis,O=a.reference[g]+a.reference[C]-w.mainAxis;yO&&(y=O)}if(h){var k,E;const C=g==="y"?"width":"height",T=TC.has(ri(s)),O=a.reference[m]-a.floating[C]+(T&&((k=o.offset)==null?void 0:k[m])||0)+(T?0:w.crossAxis),B=a.reference[m]+a.reference[C]+(T?0:((E=o.offset)==null?void 0:E[m])||0)-(T?w.crossAxis:0);vB&&(v=B)}return{[g]:y,[m]:v}}}},oF=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:a,platform:o,elements:c}=e,{apply:u=()=>{},...h}=ni(t,e),f=await o.detectOverflow(e,h),m=ri(s),g=pl(s),y=ks(s)==="y",{width:v,height:j}=a.floating;let w,k;m==="top"||m==="bottom"?(w=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,w=g==="end"?"top":"bottom");const E=j-f.top-f.bottom,C=v-f.left-f.right,T=ea(j-f[w],E),O=ea(v-f[k],C),B=!e.middlewareData.shift;let R=T,P=O;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(R=E),B&&!g){const L=Nr(f.left,0),X=Nr(f.right,0),Z=Nr(f.top,0),Y=Nr(f.bottom,0);y?P=v-2*(L!==0||X!==0?L+X:Nr(f.left,f.right)):R=j-2*(Z!==0||Y!==0?Z+Y:Nr(f.top,f.bottom))}await u({...e,availableWidth:P,availableHeight:R});const I=await o.getDimensions(c.floating);return v!==I.width||j!==I.height?{reset:{rects:!0}}:{}}}};function wf(){return typeof window<"u"}function ml(t){return MC(t)?(t.nodeName||"").toLowerCase():"#document"}function Cr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Rs(t){var e;return(e=(MC(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function MC(t){return wf()?t instanceof Node||t instanceof Cr(t).Node:!1}function cs(t){return wf()?t instanceof Element||t instanceof Cr(t).Element:!1}function Ms(t){return wf()?t instanceof HTMLElement||t instanceof Cr(t).HTMLElement:!1}function rN(t){return!wf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Cr(t).ShadowRoot}const lF=new Set(["inline","contents"]);function ed(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=ds(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!lF.has(s)}const cF=new Set(["table","td","th"]);function dF(t){return cF.has(ml(t))}const uF=[":popover-open",":modal"];function Nf(t){return uF.some(e=>{try{return t.matches(e)}catch{return!1}})}const hF=["transform","translate","scale","rotate","perspective"],fF=["transform","translate","scale","rotate","perspective","filter"],pF=["paint","layout","strict","content"];function z0(t){const e=$0(),n=cs(t)?ds(t):t;return hF.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||fF.some(r=>(n.willChange||"").includes(r))||pF.some(r=>(n.contain||"").includes(r))}function mF(t){let e=ta(t);for(;Ms(e)&&!al(e);){if(z0(e))return e;if(Nf(e))return null;e=ta(e)}return null}function $0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const gF=new Set(["html","body","#document"]);function al(t){return gF.has(ml(t))}function ds(t){return Cr(t).getComputedStyle(t)}function jf(t){return cs(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ta(t){if(ml(t)==="html")return t;const e=t.assignedSlot||t.parentNode||rN(t)&&t.host||Rs(t);return rN(e)?e.host:e}function AC(t){const e=ta(t);return al(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ms(e)&&ed(e)?e:AC(e)}function Vc(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=AC(t),a=s===((r=t.ownerDocument)==null?void 0:r.body),o=Cr(s);if(a){const c=gx(o);return e.concat(o,o.visualViewport||[],ed(s)?s:[],c&&n?Vc(c):[])}return e.concat(s,Vc(s,[],n))}function gx(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function RC(t){const e=ds(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Ms(t),a=s?t.offsetWidth:n,o=s?t.offsetHeight:r,c=Wh(n)!==a||Wh(r)!==o;return c&&(n=a,r=o),{width:n,height:r,$:c}}function F0(t){return cs(t)?t:t.contextElement}function Qo(t){const e=F0(t);if(!Ms(e))return Cs(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:a}=RC(e);let o=(a?Wh(n.width):n.width)/r,c=(a?Wh(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const xF=Cs(0);function PC(t){const e=Cr(t);return!$0()||!e.visualViewport?xF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function yF(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Cr(t)?!1:e}function Za(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=F0(t);let o=Cs(1);e&&(r?cs(r)&&(o=Qo(r)):o=Qo(t));const c=yF(a,n,r)?PC(a):Cs(0);let u=(s.left+c.x)/o.x,h=(s.top+c.y)/o.y,f=s.width/o.x,m=s.height/o.y;if(a){const g=Cr(a),y=r&&cs(r)?Cr(r):r;let v=g,j=gx(v);for(;j&&r&&y!==v;){const w=Qo(j),k=j.getBoundingClientRect(),E=ds(j),C=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*w.x,T=k.top+(j.clientTop+parseFloat(E.paddingTop))*w.y;u*=w.x,h*=w.y,f*=w.x,m*=w.y,u+=C,h+=T,v=Cr(j),j=gx(v)}}return Kh({width:f,height:m,x:u,y:h})}function kf(t,e){const n=jf(t).scrollLeft;return e?e.left+n:Za(Rs(t)).left+n}function IC(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-kf(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function vF(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const a=s==="fixed",o=Rs(r),c=e?Nf(e.floating):!1;if(r===o||c&&a)return n;let u={scrollLeft:0,scrollTop:0},h=Cs(1);const f=Cs(0),m=Ms(r);if((m||!m&&!a)&&((ml(r)!=="body"||ed(o))&&(u=jf(r)),Ms(r))){const y=Za(r);h=Qo(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=o&&!m&&!a?IC(o,u):Cs(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+g.x,y:n.y*h.y-u.scrollTop*h.y+f.y+g.y}}function bF(t){return Array.from(t.getClientRects())}function wF(t){const e=Rs(t),n=jf(t),r=t.ownerDocument.body,s=Nr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=Nr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+kf(t);const c=-n.scrollTop;return ds(r).direction==="rtl"&&(o+=Nr(e.clientWidth,r.clientWidth)-s),{width:s,height:a,x:o,y:c}}const sN=25;function NF(t,e){const n=Cr(t),r=Rs(t),s=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,c=0,u=0;if(s){a=s.width,o=s.height;const f=$0();(!f||f&&e==="fixed")&&(c=s.offsetLeft,u=s.offsetTop)}const h=kf(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),y=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-y);v<=sN&&(a-=v)}else h<=sN&&(a+=h);return{width:a,height:o,x:c,y:u}}const jF=new Set(["absolute","fixed"]);function kF(t,e){const n=Za(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,a=Ms(t)?Qo(t):Cs(1),o=t.clientWidth*a.x,c=t.clientHeight*a.y,u=s*a.x,h=r*a.y;return{width:o,height:c,x:u,y:h}}function iN(t,e,n){let r;if(e==="viewport")r=NF(t,n);else if(e==="document")r=wF(Rs(t));else if(cs(e))r=kF(e,n);else{const s=PC(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Kh(r)}function OC(t,e){const n=ta(t);return n===e||!cs(n)||al(n)?!1:ds(n).position==="fixed"||OC(n,e)}function SF(t,e){const n=e.get(t);if(n)return n;let r=Vc(t,[],!1).filter(c=>cs(c)&&ml(c)!=="body"),s=null;const a=ds(t).position==="fixed";let o=a?ta(t):t;for(;cs(o)&&!al(o);){const c=ds(o),u=z0(o);!u&&c.position==="fixed"&&(s=null),(a?!u&&!s:!u&&c.position==="static"&&!!s&&jF.has(s.position)||ed(o)&&!u&&OC(t,o))?r=r.filter(f=>f!==o):s=c,o=ta(o)}return e.set(t,r),r}function CF(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?Nf(e)?[]:SF(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=iN(e,f,s);return h.top=Nr(m.top,h.top),h.right=ea(m.right,h.right),h.bottom=ea(m.bottom,h.bottom),h.left=Nr(m.left,h.left),h},iN(e,c,s));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function EF(t){const{width:e,height:n}=RC(t);return{width:e,height:n}}function TF(t,e,n){const r=Ms(e),s=Rs(e),a=n==="fixed",o=Za(t,!0,a,e);let c={scrollLeft:0,scrollTop:0};const u=Cs(0);function h(){u.x=kf(s)}if(r||!r&&!a)if((ml(e)!=="body"||ed(s))&&(c=jf(e)),r){const y=Za(e,!0,a,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else s&&h();a&&!r&&s&&h();const f=s&&!r&&!a?IC(s,c):Cs(0),m=o.left+c.scrollLeft-u.x-f.x,g=o.top+c.scrollTop-u.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function og(t){return ds(t).position==="static"}function aN(t,e){if(!Ms(t)||ds(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Rs(t)===n&&(n=n.ownerDocument.body),n}function DC(t,e){const n=Cr(t);if(Nf(t))return n;if(!Ms(t)){let s=ta(t);for(;s&&!al(s);){if(cs(s)&&!og(s))return s;s=ta(s)}return n}let r=aN(t,e);for(;r&&dF(r)&&og(r);)r=aN(r,e);return r&&al(r)&&og(r)&&!z0(r)?n:r||mF(t)||n}const MF=async function(t){const e=this.getOffsetParent||DC,n=this.getDimensions,r=await n(t.floating);return{reference:TF(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function AF(t){return ds(t).direction==="rtl"}const RF={convertOffsetParentRelativeRectToViewportRelativeRect:vF,getDocumentElement:Rs,getClippingRect:CF,getOffsetParent:DC,getElementRects:MF,getClientRects:bF,getDimensions:EF,getScale:Qo,isElement:cs,isRTL:AF};function LC(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function PF(t,e){let n=null,r;const s=Rs(t);function a(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),a();const h=t.getBoundingClientRect(),{left:f,top:m,width:g,height:y}=h;if(c||e(),!g||!y)return;const v=Lu(m),j=Lu(s.clientWidth-(f+g)),w=Lu(s.clientHeight-(m+y)),k=Lu(f),C={rootMargin:-v+"px "+-j+"px "+-w+"px "+-k+"px",threshold:Nr(0,ea(1,u))||1};let T=!0;function O(B){const R=B[0].intersectionRatio;if(R!==u){if(!T)return o();R?o(!1,R):r=setTimeout(()=>{o(!1,1e-7)},1e3)}R===1&&!LC(h,t.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(O,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(O,C)}n.observe(t)}return o(!0),a}function IF(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=F0(t),f=s||a?[...h?Vc(h):[],...Vc(e)]:[];f.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),a&&k.addEventListener("resize",n)});const m=h&&c?PF(h,n):null;let g=-1,y=null;o&&(y=new ResizeObserver(k=>{let[E]=k;E&&E.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=y)==null||C.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let v,j=u?Za(t):null;u&&w();function w(){const k=Za(t);j&&!LC(j,k)&&n(),j=k,v=requestAnimationFrame(w)}return n(),()=>{var k;f.forEach(E=>{s&&E.removeEventListener("scroll",n),a&&E.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(v)}}const OF=sF,DF=iF,LF=tF,_F=oF,zF=nF,oN=eF,$F=aF,FF=(t,e,n)=>{const r=new Map,s={platform:RF,...n},a={...s.platform,_c:r};return Z$(t,e,{...s,platform:a})};var BF=typeof document<"u",VF=function(){},Ku=BF?b.useLayoutEffect:VF;function qh(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!qh(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(!(a==="_owner"&&t.$$typeof)&&!qh(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function _C(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function lN(t,e){const n=_C(t);return Math.round(e*n)/n}function lg(t){const e=b.useRef(t);return Ku(()=>{e.current=t}),e}function HF(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=b.useState(r);qh(g,r)||y(r);const[v,j]=b.useState(null),[w,k]=b.useState(null),E=b.useCallback(_=>{_!==B.current&&(B.current=_,j(_))},[]),C=b.useCallback(_=>{_!==R.current&&(R.current=_,k(_))},[]),T=a||v,O=o||w,B=b.useRef(null),R=b.useRef(null),P=b.useRef(f),I=u!=null,L=lg(u),X=lg(s),Z=lg(h),Y=b.useCallback(()=>{if(!B.current||!R.current)return;const _={placement:e,strategy:n,middleware:g};X.current&&(_.platform=X.current),FF(B.current,R.current,_).then(se=>{const q={...se,isPositioned:Z.current!==!1};W.current&&!qh(P.current,q)&&(P.current=q,Wc.flushSync(()=>{m(q)}))})},[g,e,n,X,Z]);Ku(()=>{h===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m(_=>({..._,isPositioned:!1})))},[h]);const W=b.useRef(!1);Ku(()=>(W.current=!0,()=>{W.current=!1}),[]),Ku(()=>{if(T&&(B.current=T),O&&(R.current=O),T&&O){if(L.current)return L.current(T,O,Y);Y()}},[T,O,Y,L,I]);const D=b.useMemo(()=>({reference:B,floating:R,setReference:E,setFloating:C}),[E,C]),$=b.useMemo(()=>({reference:T,floating:O}),[T,O]),ae=b.useMemo(()=>{const _={position:n,left:0,top:0};if(!$.floating)return _;const se=lN($.floating,f.x),q=lN($.floating,f.y);return c?{..._,transform:"translate("+se+"px, "+q+"px)",..._C($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:se,top:q}},[n,c,$.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:Y,refs:D,elements:$,floatingStyles:ae}),[f,Y,D,$,ae])}const WF=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?oN({element:r.current,padding:s}).fn(n):{}:r?oN({element:r,padding:s}).fn(n):{}}}},UF=(t,e)=>({...OF(t),options:[t,e]}),KF=(t,e)=>({...DF(t),options:[t,e]}),qF=(t,e)=>({...$F(t),options:[t,e]}),GF=(t,e)=>({...LF(t),options:[t,e]}),JF=(t,e)=>({..._F(t),options:[t,e]}),YF=(t,e)=>({...zF(t),options:[t,e]}),QF=(t,e)=>({...WF(t),options:[t,e]});var XF="Arrow",zC=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...a}=t;return i.jsx(at.svg,{...a,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});zC.displayName=XF;var ZF=zC,B0="Popper",[$C,FC]=ia(B0),[eB,BC]=$C(B0),VC=t=>{const{__scopePopper:e,children:n}=t,[r,s]=b.useState(null);return i.jsx(eB,{scope:e,anchor:r,onAnchorChange:s,children:n})};VC.displayName=B0;var HC="PopperAnchor",WC=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,a=BC(HC,n),o=b.useRef(null),c=vt(e,o),u=b.useRef(null);return b.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&a.onAnchorChange(u.current)}),r?null:i.jsx(at.div,{...s,ref:c})});WC.displayName=HC;var V0="PopperContent",[tB,nB]=$C(V0),UC=b.forwardRef((t,e)=>{var oe,ue,ye,V,ge,Me;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:a="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:v,...j}=t,w=BC(V0,n),[k,E]=b.useState(null),C=vt(e,tt=>E(tt)),[T,O]=b.useState(null),B=Vx(T),R=(B==null?void 0:B.width)??0,P=(B==null?void 0:B.height)??0,I=r+(a!=="center"?"-"+a:""),L=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},X=Array.isArray(h)?h:[h],Z=X.length>0,Y={padding:L,boundary:X.filter(sB),altBoundary:Z},{refs:W,floatingStyles:D,placement:$,isPositioned:ae,middlewareData:_}=HF({strategy:"fixed",placement:I,whileElementsMounted:(...tt)=>IF(...tt,{animationFrame:y==="always"}),elements:{reference:w.anchor},middleware:[UF({mainAxis:s+P,alignmentAxis:o}),u&&KF({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?qF():void 0,...Y}),u&&GF({...Y}),JF({...Y,apply:({elements:tt,rects:et,availableWidth:ot,availableHeight:Ge})=>{const{width:dt,height:Et}=et.reference,ht=tt.floating.style;ht.setProperty("--radix-popper-available-width",`${ot}px`),ht.setProperty("--radix-popper-available-height",`${Ge}px`),ht.setProperty("--radix-popper-anchor-width",`${dt}px`),ht.setProperty("--radix-popper-anchor-height",`${Et}px`)}}),T&&QF({element:T,padding:c}),iB({arrowWidth:R,arrowHeight:P}),g&&YF({strategy:"referenceHidden",...Y})]}),[se,q]=GC($),z=Qi(v);Un(()=>{ae&&(z==null||z())},[ae,z]);const H=(oe=_.arrow)==null?void 0:oe.x,de=(ue=_.arrow)==null?void 0:ue.y,K=((ye=_.arrow)==null?void 0:ye.centerOffset)!==0,[fe,Q]=b.useState();return Un(()=>{k&&Q(window.getComputedStyle(k).zIndex)},[k]),i.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:ae?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[(V=_.transformOrigin)==null?void 0:V.x,(ge=_.transformOrigin)==null?void 0:ge.y].join(" "),...((Me=_.hide)==null?void 0:Me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i.jsx(tB,{scope:n,placedSide:se,onArrowChange:O,arrowX:H,arrowY:de,shouldHideArrow:K,children:i.jsx(at.div,{"data-side":se,"data-align":q,...j,ref:C,style:{...j.style,animation:ae?void 0:"none"}})})})});UC.displayName=V0;var KC="PopperArrow",rB={top:"bottom",right:"left",bottom:"top",left:"right"},qC=b.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,a=nB(KC,r),o=rB[a.placedSide];return i.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:i.jsx(ZF,{...s,ref:n,style:{...s.style,display:"block"}})})});qC.displayName=KC;function sB(t){return t!==null}var iB=t=>({name:"transformOrigin",options:t,fn(e){var w,k,E;const{placement:n,rects:r,middlewareData:s}=e,o=((w=s.arrow)==null?void 0:w.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=GC(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=s.arrow)==null?void 0:k.x)??0)+c/2,y=(((E=s.arrow)==null?void 0:E.y)??0)+u/2;let v="",j="";return h==="bottom"?(v=o?m:`${g}px`,j=`${-u}px`):h==="top"?(v=o?m:`${g}px`,j=`${r.floating.height+u}px`):h==="right"?(v=`${-u}px`,j=o?m:`${y}px`):h==="left"&&(v=`${r.floating.width+u}px`,j=o?m:`${y}px`),{data:{x:v,y:j}}}});function GC(t){const[e,n="center"]=t.split("-");return[e,n]}var aB=VC,oB=WC,lB=UC,cB=qC,JC=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),dB="VisuallyHidden",uB=b.forwardRef((t,e)=>i.jsx(at.span,{...t,ref:e,style:{...JC,...t.style}}));uB.displayName=dB;var hB=[" ","Enter","ArrowUp","ArrowDown"],fB=[" ","Enter"],eo="Select",[Sf,Cf,pB]=$x(eo),[gl]=ia(eo,[pB,FC]),Ef=FC(),[mB,ca]=gl(eo),[gB,xB]=gl(eo),YC=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:a,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:y,form:v}=t,j=Ef(e),[w,k]=b.useState(null),[E,C]=b.useState(null),[T,O]=b.useState(!1),B=ef(h),[R,P]=Wa({prop:r,defaultProp:s??!1,onChange:a,caller:eo}),[I,L]=Wa({prop:o,defaultProp:c,onChange:u,caller:eo}),X=b.useRef(null),Z=w?v||!!w.closest("form"):!0,[Y,W]=b.useState(new Set),D=Array.from(Y).map($=>$.props.value).join(";");return i.jsx(aB,{...j,children:i.jsxs(mB,{required:y,scope:e,trigger:w,onTriggerChange:k,valueNode:E,onValueNodeChange:C,valueNodeHasChildren:T,onValueNodeHasChildrenChange:O,contentId:Ki(),value:I,onValueChange:L,open:R,onOpenChange:P,dir:B,triggerPointerDownPosRef:X,disabled:g,children:[i.jsx(Sf.Provider,{scope:e,children:i.jsx(gB,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback($=>{W(ae=>new Set(ae).add($))},[]),onNativeOptionRemove:b.useCallback($=>{W(ae=>{const _=new Set(ae);return _.delete($),_})},[]),children:n})}),Z?i.jsxs(yE,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:I,onChange:$=>L($.target.value),disabled:g,form:v,children:[I===void 0?i.jsx("option",{value:""}):null,Array.from(Y)]},D):null]})})};YC.displayName=eo;var QC="SelectTrigger",XC=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,a=Ef(n),o=ca(QC,n),c=o.disabled||r,u=vt(e,o.onTriggerChange),h=Cf(n),f=b.useRef("touch"),[m,g,y]=bE(j=>{const w=h().filter(C=>!C.disabled),k=w.find(C=>C.value===o.value),E=wE(w,j,k);E!==void 0&&o.onValueChange(E.value)}),v=j=>{c||(o.onOpenChange(!0),y()),j&&(o.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return i.jsx(oB,{asChild:!0,...a,children:i.jsx(at.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":vE(o.value)?"":void 0,...s,ref:u,onClick:rt(s.onClick,j=>{j.currentTarget.focus(),f.current!=="mouse"&&v(j)}),onPointerDown:rt(s.onPointerDown,j=>{f.current=j.pointerType;const w=j.target;w.hasPointerCapture(j.pointerId)&&w.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(v(j),j.preventDefault())}),onKeyDown:rt(s.onKeyDown,j=>{const w=m.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&g(j.key),!(w&&j.key===" ")&&hB.includes(j.key)&&(v(),j.preventDefault())})})})});XC.displayName=QC;var ZC="SelectValue",eE=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:a,placeholder:o="",...c}=t,u=ca(ZC,n),{onValueNodeHasChildrenChange:h}=u,f=a!==void 0,m=vt(e,u.onValueNodeChange);return Un(()=>{h(f)},[h,f]),i.jsx(at.span,{...c,ref:m,style:{pointerEvents:"none"},children:vE(u.value)?i.jsx(i.Fragment,{children:o}):a})});eE.displayName=ZC;var yB="SelectIcon",tE=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return i.jsx(at.span,{"aria-hidden":!0,...s,ref:e,children:r||"▼"})});tE.displayName=yB;var vB="SelectPortal",nE=t=>i.jsx(Ox,{asChild:!0,...t});nE.displayName=vB;var to="SelectContent",rE=b.forwardRef((t,e)=>{const n=ca(to,t.__scopeSelect),[r,s]=b.useState();if(Un(()=>{s(new DocumentFragment)},[]),!n.open){const a=r;return a?Wc.createPortal(i.jsx(sE,{scope:t.__scopeSelect,children:i.jsx(Sf.Slot,{scope:t.__scopeSelect,children:i.jsx("div",{children:t.children})})}),a):null}return i.jsx(iE,{...t,ref:e})});rE.displayName=to;var rs=10,[sE,da]=gl(to),bB="SelectContentImpl",wB=Mc("SelectContent.RemoveScroll"),iE=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:j,avoidCollisions:w,...k}=t,E=ca(to,n),[C,T]=b.useState(null),[O,B]=b.useState(null),R=vt(e,oe=>T(oe)),[P,I]=b.useState(null),[L,X]=b.useState(null),Z=Cf(n),[Y,W]=b.useState(!1),D=b.useRef(!1);b.useEffect(()=>{if(C)return vj(C)},[C]),dj();const $=b.useCallback(oe=>{const[ue,...ye]=Z().map(Me=>Me.ref.current),[V]=ye.slice(-1),ge=document.activeElement;for(const Me of oe)if(Me===ge||(Me==null||Me.scrollIntoView({block:"nearest"}),Me===ue&&O&&(O.scrollTop=0),Me===V&&O&&(O.scrollTop=O.scrollHeight),Me==null||Me.focus(),document.activeElement!==ge))return},[Z,O]),ae=b.useCallback(()=>$([P,C]),[$,P,C]);b.useEffect(()=>{Y&&ae()},[Y,ae]);const{onOpenChange:_,triggerPointerDownPosRef:se}=E;b.useEffect(()=>{if(C){let oe={x:0,y:0};const ue=V=>{var ge,Me;oe={x:Math.abs(Math.round(V.pageX)-(((ge=se.current)==null?void 0:ge.x)??0)),y:Math.abs(Math.round(V.pageY)-(((Me=se.current)==null?void 0:Me.y)??0))}},ye=V=>{oe.x<=10&&oe.y<=10?V.preventDefault():C.contains(V.target)||_(!1),document.removeEventListener("pointermove",ue),se.current=null};return se.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",ye,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",ye,{capture:!0})}}},[C,_,se]),b.useEffect(()=>{const oe=()=>_(!1);return window.addEventListener("blur",oe),window.addEventListener("resize",oe),()=>{window.removeEventListener("blur",oe),window.removeEventListener("resize",oe)}},[_]);const[q,z]=bE(oe=>{const ue=Z().filter(ge=>!ge.disabled),ye=ue.find(ge=>ge.ref.current===document.activeElement),V=wE(ue,oe,ye);V&&setTimeout(()=>V.ref.current.focus())}),H=b.useCallback((oe,ue,ye)=>{const V=!D.current&&!ye;(E.value!==void 0&&E.value===ue||V)&&(I(oe),V&&(D.current=!0))},[E.value]),de=b.useCallback(()=>C==null?void 0:C.focus(),[C]),K=b.useCallback((oe,ue,ye)=>{const V=!D.current&&!ye;(E.value!==void 0&&E.value===ue||V)&&X(oe)},[E.value]),fe=r==="popper"?xx:aE,Q=fe===xx?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:j,avoidCollisions:w}:{};return i.jsx(sE,{scope:n,content:C,viewport:O,onViewportChange:B,itemRefCallback:H,selectedItem:P,onItemLeave:de,itemTextRefCallback:K,focusSelectedItem:ae,selectedItemText:L,position:r,isPositioned:Y,searchRef:q,children:i.jsx(Dx,{as:wB,allowPinchZoom:!0,children:i.jsx(Ix,{asChild:!0,trapped:E.open,onMountAutoFocus:oe=>{oe.preventDefault()},onUnmountAutoFocus:rt(s,oe=>{var ue;(ue=E.trigger)==null||ue.focus({preventScroll:!0}),oe.preventDefault()}),children:i.jsx(Px,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:oe=>oe.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:i.jsx(fe,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:oe=>oe.preventDefault(),...k,...Q,onPlaced:()=>W(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:rt(k.onKeyDown,oe=>{const ue=oe.ctrlKey||oe.altKey||oe.metaKey;if(oe.key==="Tab"&&oe.preventDefault(),!ue&&oe.key.length===1&&z(oe.key),["ArrowUp","ArrowDown","Home","End"].includes(oe.key)){let V=Z().filter(ge=>!ge.disabled).map(ge=>ge.ref.current);if(["ArrowUp","End"].includes(oe.key)&&(V=V.slice().reverse()),["ArrowUp","ArrowDown"].includes(oe.key)){const ge=oe.target,Me=V.indexOf(ge);V=V.slice(Me+1)}setTimeout(()=>$(V)),oe.preventDefault()}})})})})})})});iE.displayName=bB;var NB="SelectItemAlignedPosition",aE=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,a=ca(to,n),o=da(to,n),[c,u]=b.useState(null),[h,f]=b.useState(null),m=vt(e,R=>f(R)),g=Cf(n),y=b.useRef(!1),v=b.useRef(!0),{viewport:j,selectedItem:w,selectedItemText:k,focusSelectedItem:E}=o,C=b.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&h&&j&&w&&k){const R=a.trigger.getBoundingClientRect(),P=h.getBoundingClientRect(),I=a.valueNode.getBoundingClientRect(),L=k.getBoundingClientRect();if(a.dir!=="rtl"){const ge=L.left-P.left,Me=I.left-ge,tt=R.left-Me,et=R.width+tt,ot=Math.max(et,P.width),Ge=window.innerWidth-rs,dt=eh(Me,[rs,Math.max(rs,Ge-ot)]);c.style.minWidth=et+"px",c.style.left=dt+"px"}else{const ge=P.right-L.right,Me=window.innerWidth-I.right-ge,tt=window.innerWidth-R.right-Me,et=R.width+tt,ot=Math.max(et,P.width),Ge=window.innerWidth-rs,dt=eh(Me,[rs,Math.max(rs,Ge-ot)]);c.style.minWidth=et+"px",c.style.right=dt+"px"}const X=g(),Z=window.innerHeight-rs*2,Y=j.scrollHeight,W=window.getComputedStyle(h),D=parseInt(W.borderTopWidth,10),$=parseInt(W.paddingTop,10),ae=parseInt(W.borderBottomWidth,10),_=parseInt(W.paddingBottom,10),se=D+$+Y+_+ae,q=Math.min(w.offsetHeight*5,se),z=window.getComputedStyle(j),H=parseInt(z.paddingTop,10),de=parseInt(z.paddingBottom,10),K=R.top+R.height/2-rs,fe=Z-K,Q=w.offsetHeight/2,oe=w.offsetTop+Q,ue=D+$+oe,ye=se-ue;if(ue<=K){const ge=X.length>0&&w===X[X.length-1].ref.current;c.style.bottom="0px";const Me=h.clientHeight-j.offsetTop-j.offsetHeight,tt=Math.max(fe,Q+(ge?de:0)+Me+ae),et=ue+tt;c.style.height=et+"px"}else{const ge=X.length>0&&w===X[0].ref.current;c.style.top="0px";const tt=Math.max(K,D+j.offsetTop+(ge?H:0)+Q)+ye;c.style.height=tt+"px",j.scrollTop=ue-K+j.offsetTop}c.style.margin=`${rs}px 0`,c.style.minHeight=q+"px",c.style.maxHeight=Z+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,a.trigger,a.valueNode,c,h,j,w,k,a.dir,r]);Un(()=>C(),[C]);const[T,O]=b.useState();Un(()=>{h&&O(window.getComputedStyle(h).zIndex)},[h]);const B=b.useCallback(R=>{R&&v.current===!0&&(C(),E==null||E(),v.current=!1)},[C,E]);return i.jsx(kB,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:B,children:i.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:i.jsx(at.div,{...s,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});aE.displayName=NB;var jB="SelectPopperPosition",xx=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=rs,...a}=t,o=Ef(n);return i.jsx(lB,{...o,...a,ref:e,align:r,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xx.displayName=jB;var[kB,H0]=gl(to,{}),yx="SelectViewport",oE=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,a=da(yx,n),o=H0(yx,n),c=vt(e,a.onViewportChange),u=b.useRef(0);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),i.jsx(Sf.Slot,{scope:n,children:i.jsx(at.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:rt(s.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const y=Math.abs(u.current-f.scrollTop);if(y>0){const v=window.innerHeight-rs*2,j=parseFloat(m.style.minHeight),w=parseFloat(m.style.height),k=Math.max(j,w);if(k0?T:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});oE.displayName=yx;var lE="SelectGroup",[SB,CB]=gl(lE),EB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Ki();return i.jsx(SB,{scope:n,id:s,children:i.jsx(at.div,{role:"group","aria-labelledby":s,...r,ref:e})})});EB.displayName=lE;var cE="SelectLabel",TB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=CB(cE,n);return i.jsx(at.div,{id:s.id,...r,ref:e})});TB.displayName=cE;var Gh="SelectItem",[MB,dE]=gl(Gh),uE=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:a,...o}=t,c=ca(Gh,n),u=da(Gh,n),h=c.value===r,[f,m]=b.useState(a??""),[g,y]=b.useState(!1),v=vt(e,E=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,E,r,s)}),j=Ki(),w=b.useRef("touch"),k=()=>{s||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return i.jsx(MB,{scope:n,value:r,disabled:s,textId:j,isSelected:h,onItemTextChange:b.useCallback(E=>{m(C=>C||((E==null?void 0:E.textContent)??"").trim())},[]),children:i.jsx(Sf.ItemSlot,{scope:n,value:r,disabled:s,textValue:f,children:i.jsx(at.div,{role:"option","aria-labelledby":j,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:v,onFocus:rt(o.onFocus,()=>y(!0)),onBlur:rt(o.onBlur,()=>y(!1)),onClick:rt(o.onClick,()=>{w.current!=="mouse"&&k()}),onPointerUp:rt(o.onPointerUp,()=>{w.current==="mouse"&&k()}),onPointerDown:rt(o.onPointerDown,E=>{w.current=E.pointerType}),onPointerMove:rt(o.onPointerMove,E=>{var C;w.current=E.pointerType,s?(C=u.onItemLeave)==null||C.call(u):w.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:rt(o.onPointerLeave,E=>{var C;E.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:rt(o.onKeyDown,E=>{var T;((T=u.searchRef)==null?void 0:T.current)!==""&&E.key===" "||(fB.includes(E.key)&&k(),E.key===" "&&E.preventDefault())})})})})});uE.displayName=Gh;var uc="SelectItemText",hE=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...a}=t,o=ca(uc,n),c=da(uc,n),u=dE(uc,n),h=xB(uc,n),[f,m]=b.useState(null),g=vt(e,k=>m(k),u.onItemTextChange,k=>{var E;return(E=c.itemTextRefCallback)==null?void 0:E.call(c,k,u.value,u.disabled)}),y=f==null?void 0:f.textContent,v=b.useMemo(()=>i.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:j,onNativeOptionRemove:w}=h;return Un(()=>(j(v),()=>w(v)),[j,w,v]),i.jsxs(i.Fragment,{children:[i.jsx(at.span,{id:u.textId,...a,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Wc.createPortal(a.children,o.valueNode):null]})});hE.displayName=uc;var fE="SelectItemIndicator",pE=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return dE(fE,n).isSelected?i.jsx(at.span,{"aria-hidden":!0,...r,ref:e}):null});pE.displayName=fE;var vx="SelectScrollUpButton",mE=b.forwardRef((t,e)=>{const n=da(vx,t.__scopeSelect),r=H0(vx,t.__scopeSelect),[s,a]=b.useState(!1),o=vt(e,r.onScrollButtonChange);return Un(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollTop>0;a(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?i.jsx(xE,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});mE.displayName=vx;var bx="SelectScrollDownButton",gE=b.forwardRef((t,e)=>{const n=da(bx,t.__scopeSelect),r=H0(bx,t.__scopeSelect),[s,a]=b.useState(!1),o=vt(e,r.onScrollButtonChange);return Un(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),s?i.jsx(xE,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});gE.displayName=bx;var xE=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,a=da("SelectScrollButton",n),o=b.useRef(null),c=Cf(n),u=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>u(),[u]),Un(()=>{var f;const h=c().find(m=>m.ref.current===document.activeElement);(f=h==null?void 0:h.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),i.jsx(at.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:rt(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:rt(s.onPointerMove,()=>{var h;(h=a.onItemLeave)==null||h.call(a),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:rt(s.onPointerLeave,()=>{u()})})}),AB="SelectSeparator",RB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return i.jsx(at.div,{"aria-hidden":!0,...r,ref:e})});RB.displayName=AB;var wx="SelectArrow",PB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Ef(n),a=ca(wx,n),o=da(wx,n);return a.open&&o.position==="popper"?i.jsx(cB,{...s,...r,ref:e}):null});PB.displayName=wx;var IB="SelectBubbleInput",yE=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const s=b.useRef(null),a=vt(r,s),o=Bx(e);return b.useEffect(()=>{const c=s.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),i.jsx(at.select,{...n,style:{...JC,...n.style},ref:a,defaultValue:e})});yE.displayName=IB;function vE(t){return t===""||t===void 0}function bE(t){const e=Qi(t),n=b.useRef(""),r=b.useRef(0),s=b.useCallback(o=>{const c=n.current+o;e(c),(function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[e]),a=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,a]}function wE(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,a=n?t.indexOf(n):-1;let o=OB(t,Math.max(a,0));s.length===1&&(o=o.filter(h=>h!==n));const u=o.find(h=>h.textValue.toLowerCase().startsWith(s.toLowerCase()));return u!==n?u:void 0}function OB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var DB=YC,NE=XC,LB=eE,_B=tE,zB=nE,jE=rE,$B=oE,kE=uE,FB=hE,BB=pE,VB=mE,HB=gE;const sc=DB,ic=LB,Bo=b.forwardRef(({className:t,children:e,...n},r)=>i.jsxs(NE,{ref:r,className:bt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,i.jsx(_B,{asChild:!0,children:i.jsx(Ec,{className:"h-4 w-4 opacity-50"})})]}));Bo.displayName=NE.displayName;const Vo=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>i.jsx(zB,{children:i.jsxs(jE,{ref:s,className:bt("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1",t),position:n,...r,children:[i.jsx(VB,{className:"flex cursor-default items-center justify-center py-1",children:i.jsx(DN,{className:"h-4 w-4"})}),i.jsx($B,{className:"p-1",children:e}),i.jsx(HB,{className:"flex cursor-default items-center justify-center py-1",children:i.jsx(Ec,{className:"h-4 w-4"})})]})}));Vo.displayName=jE.displayName;const bs=b.forwardRef(({className:t,children:e,...n},r)=>i.jsxs(kE,{ref:r,className:bt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(BB,{children:i.jsx(Uc,{className:"h-4 w-4"})})}),i.jsx(FB,{children:e})]}));bs.displayName=kE.displayName;const WB=["一","二","三","四","五","六","七","八","九","十"];function cg(t){return t.startsWith("part:")?{type:"part",id:t.slice(5)}:t.startsWith("chapter:")?{type:"chapter",id:t.slice(8)}:t.startsWith("section:")?{type:"section",id:t.slice(8)}:null}function UB({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:s,onDeleteSection:a,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:y,onShowSectionOrders:v,pinnedSectionIds:j=[]}){const[w,k]=b.useState(null),[E,C]=b.useState(null),T=(L,X)=>(w==null?void 0:w.type)===L&&(w==null?void 0:w.id)===X,O=(L,X)=>(E==null?void 0:E.type)===L&&(E==null?void 0:E.id)===X,B=b.useCallback(()=>{const L=[];for(const X of t)for(const Z of X.chapters)for(const Y of Z.sections)L.push({id:Y.id,partId:X.id,partTitle:X.title,chapterId:Z.id,chapterTitle:Z.title});return L},[t]),R=b.useCallback(async(L,X,Z,Y)=>{var _;L.preventDefault(),L.stopPropagation();const W=L.dataTransfer.getData("text/plain"),D=cg(W);if(!D||D.type===X&&D.id===Z)return;const $=B(),ae=new Map($.map(se=>[se.id,se]));if(D.type==="part"&&X==="part"){const se=t.map(K=>K.id),q=se.indexOf(D.id),z=se.indexOf(Z);if(q===-1||z===-1)return;const H=[...se];H.splice(q,1),H.splice(qQ.id===K);if(fe)for(const Q of fe.chapters)for(const oe of Q.sections){const ue=ae.get(oe.id);ue&&de.push(ue)}}await r(de);return}if(D.type==="chapter"&&(X==="chapter"||X==="section"||X==="part")){const se=t.find(ue=>ue.chapters.some(ye=>ye.id===D.id)),q=se==null?void 0:se.chapters.find(ue=>ue.id===D.id);if(!se||!q)return;let z,H,de=null;if(X==="section"){const ue=ae.get(Z);if(!ue)return;z=ue.partId,H=ue.partTitle,de=Z}else if(X==="chapter"){const ue=t.find(ge=>ge.chapters.some(Me=>Me.id===Z)),ye=ue==null?void 0:ue.chapters.find(ge=>ge.id===Z);if(!ue||!ye)return;z=ue.id,H=ue.title;const V=$.filter(ge=>ge.chapterId===Z).pop();de=(V==null?void 0:V.id)??null}else{const ue=t.find(V=>V.id===Z);if(!ue||!ue.chapters[0])return;z=ue.id,H=ue.title;const ye=$.filter(V=>V.partId===ue.id&&V.chapterId===ue.chapters[0].id);de=((_=ye[ye.length-1])==null?void 0:_.id)??null}const K=q.sections.map(ue=>ue.id),fe=$.filter(ue=>!K.includes(ue.id));let Q=fe.length;if(de){const ue=fe.findIndex(ye=>ye.id===de);ue>=0&&(Q=ue+1)}const oe=K.map(ue=>({...ae.get(ue),partId:z,partTitle:H,chapterId:q.id,chapterTitle:q.title}));await r([...fe.slice(0,Q),...oe,...fe.slice(Q)]);return}if(D.type==="section"&&(X==="section"||X==="chapter"||X==="part")){if(!Y)return;const{partId:se,partTitle:q,chapterId:z,chapterTitle:H}=Y;let de;if(X==="section")de=$.findIndex(ye=>ye.id===Z);else if(X==="chapter"){const ye=$.filter(V=>V.chapterId===Z).pop();de=ye?$.findIndex(V=>V.id===ye.id)+1:$.length}else{const ye=t.find(Me=>Me.id===Z);if(!(ye!=null&&ye.chapters[0]))return;const V=$.filter(Me=>Me.partId===ye.id&&Me.chapterId===ye.chapters[0].id),ge=V[V.length-1];de=ge?$.findIndex(Me=>Me.id===ge.id)+1:0}const K=$.findIndex(ye=>ye.id===D.id);if(K===-1)return;const fe=$.filter(ye=>ye.id!==D.id),Q=K({onDragEnter:Y=>{Y.preventDefault(),Y.stopPropagation(),Y.dataTransfer.dropEffect="move",C({type:L,id:X})},onDragOver:Y=>{Y.preventDefault(),Y.stopPropagation(),Y.dataTransfer.dropEffect="move",C({type:L,id:X})},onDragLeave:()=>C(null),onDrop:Y=>{C(null);const W=cg(Y.dataTransfer.getData("text/plain"));if(W&&!(L==="section"&&W.type==="section"&&W.id===X))if(L==="part")if(W.type==="part")R(Y,"part",X);else{const D=t.find(ae=>ae.id===X);(D==null?void 0:D.chapters[0])&&Z&&R(Y,"part",X,Z)}else L==="chapter"&&Z?(W.type==="section"||W.type==="chapter")&&R(Y,"chapter",X,Z):L==="section"&&Z&&R(Y,"section",X,Z)}}),I=L=>WB[L]??String(L+1);return i.jsx("div",{className:"space-y-3",children:t.map((L,X)=>{var q,z,H,de;const Z=L.title==="序言"||L.title.includes("序言"),Y=L.title==="尾声"||L.title.includes("尾声"),W=L.title==="附录"||L.title.includes("附录"),D=O("part",L.id),$=e.includes(L.id),ae=L.chapters.length,_=L.chapters.reduce((K,fe)=>K+fe.sections.length,0);if(Z&&L.chapters.length===1&&L.chapters[0].sections.length===1){const K=L.chapters[0].sections[0],fe=O("section",K.id),Q={partId:L.id,partTitle:L.title,chapterId:L.chapters[0].id,chapterTitle:L.chapters[0].title};return i.jsxs("div",{draggable:!0,onDragStart:oe=>{oe.stopPropagation(),oe.dataTransfer.setData("text/plain","section:"+K.id),oe.dataTransfer.effectAllowed="move",k({type:"section",id:K.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${fe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",K.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",K.id,Q),children:[i.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[i.jsx(Vs,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:oe=>oe.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(K.id),onChange:()=>y(K.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:i.jsx(Hr,{className:"w-4 h-4 text-gray-400"})}),i.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[L.chapters[0].title," | ",K.title]}),j.includes(K.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Uo,{className:"w-3.5 h-3.5 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:oe=>oe.stopPropagation(),onClick:oe=>oe.stopPropagation(),children:[K.price===0||K.isFree?i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):i.jsxs("span",{className:"text-xs text-gray-500",children:["¥",K.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",K.clickCount??0," · 付款 ",K.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(K.hotScore??0).toFixed(1)," · 第",K.hotRank&&K.hotRank>0?K.hotRank:"-","名"]}),v&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(K),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(K),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]})]},L.id)}if(L.title==="2026每日派对干货"||L.title.includes("2026每日派对干货")){const K=O("part",L.id);return i.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${K?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...P("part",L.id,{partId:L.id,partTitle:L.title,chapterId:((q=L.chapters[0])==null?void 0:q.id)??"",chapterTitle:((z=L.chapters[0])==null?void 0:z.title)??""}),children:[i.jsxs("div",{draggable:!0,onDragStart:fe=>{fe.stopPropagation(),fe.dataTransfer.setData("text/plain","part:"+L.id),fe.dataTransfer.effectAllowed="move",k({type:"part",id:L.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${T("part",L.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>n(L.id),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx(Vs,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),i.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-white text-base",children:L.title}),i.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",_," 节"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:fe=>fe.stopPropagation(),onClick:fe=>fe.stopPropagation(),children:[o&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(L),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:i.jsx(Ft,{className:"w-3.5 h-3.5"})}),h&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(L),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),f&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(L),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:i.jsx(wn,{className:"w-3.5 h-3.5"})}),i.jsxs("span",{className:"text-xs text-gray-500",children:[ae,"章"]}),$?i.jsx(Ec,{className:"w-5 h-5 text-gray-500"}):i.jsx(Ho,{className:"w-5 h-5 text-gray-500"})]})]}),$&&L.chapters.length>0&&i.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:L.chapters.map(fe=>i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 w-full",children:[i.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:fe.title}),i.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:Q=>Q.stopPropagation(),children:[m&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>m(L,fe),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),c&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>c(L),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:i.jsx(Ft,{className:"w-3.5 h-3.5"})}),u&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(L,fe),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx("div",{className:"space-y-1 pl-2",children:fe.sections.map(Q=>{const oe=O("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:ue=>{ue.stopPropagation(),ue.dataTransfer.setData("text/plain","section:"+Q.id),ue.dataTransfer.effectAllowed="move",k({type:"section",id:Q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${oe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",Q.id,{partId:L.id,partTitle:L.title,chapterId:fe.id,chapterTitle:fe.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx(Vs,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ue=>ue.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(Q.id),onChange:()=>y(Q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[Q.id," ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Uo,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",Q.clickCount??0," · 付款 ",Q.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Q.hotScore??0).toFixed(1)," · 第",Q.hotRank&&Q.hotRank>0?Q.hotRank:"-","名"]}),v&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]},Q.id)})})]},fe.id))})]},L.id)}if(W)return i.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),i.jsx("div",{className:"space-y-3",children:L.chapters.map((K,fe)=>K.sections.length>0?K.sections.map(Q=>{const oe=O("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:ue=>{ue.stopPropagation(),ue.dataTransfer.setData("text/plain","section:"+Q.id),ue.dataTransfer.effectAllowed="move",k({type:"section",id:Q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${oe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",Q.id,{partId:L.id,partTitle:L.title,chapterId:K.id,chapterTitle:K.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx(Vs,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ue=>ue.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(Q.id),onChange:()=>y(Q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",fe+1," | ",K.title," | ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Uo,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",Q.clickCount??0," · 付款 ",Q.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Q.hotScore??0).toFixed(1)," · 第",Q.hotRank&&Q.hotRank>0?Q.hotRank:"-","名"]}),v&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx(Ho,{className:"w-4 h-4 text-gray-500 shrink-0"})]},Q.id)}):i.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[i.jsxs("span",{className:"text-sm text-gray-500",children:["附录",fe+1," | ",K.title,"(空)"]}),i.jsx(Ho,{className:"w-4 h-4 text-gray-500 shrink-0"})]},K.id))})]},L.id);if(Y&&L.chapters.length===1&&L.chapters[0].sections.length===1){const K=L.chapters[0].sections[0],fe=O("section",K.id),Q={partId:L.id,partTitle:L.title,chapterId:L.chapters[0].id,chapterTitle:L.chapters[0].title};return i.jsxs("div",{draggable:!0,onDragStart:oe=>{oe.stopPropagation(),oe.dataTransfer.setData("text/plain","section:"+K.id),oe.dataTransfer.effectAllowed="move",k({type:"section",id:K.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${fe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",K.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",K.id,Q),children:[i.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[i.jsx(Vs,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:oe=>oe.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(K.id),onChange:()=>y(K.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:i.jsx(Hr,{className:"w-4 h-4 text-gray-400"})}),i.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[L.chapters[0].title," | ",K.title]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:oe=>oe.stopPropagation(),onClick:oe=>oe.stopPropagation(),children:[K.price===0||K.isFree?i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):i.jsxs("span",{className:"text-xs text-gray-500",children:["¥",K.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",K.clickCount??0," · 付款 ",K.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(K.hotScore??0).toFixed(1)," · 第",K.hotRank&&K.hotRank>0?K.hotRank:"-","名"]}),v&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(K),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(K),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]})]},L.id)}return Y?i.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[i.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),i.jsx("div",{className:"space-y-3",children:L.chapters.map(K=>K.sections.map(fe=>{const Q=O("section",fe.id);return i.jsxs("div",{draggable:!0,onDragStart:oe=>{oe.stopPropagation(),oe.dataTransfer.setData("text/plain","section:"+fe.id),oe.dataTransfer.effectAllowed="move",k({type:"section",id:fe.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${Q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${T("section",fe.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",fe.id,{partId:L.id,partTitle:L.title,chapterId:K.id,chapterTitle:K.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx(Vs,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:oe=>oe.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(fe.id),onChange:()=>y(fe.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsxs("span",{className:"text-sm text-gray-300",children:[K.title," | ",fe.title]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",fe.clickCount??0," · 付款 ",fe.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(fe.hotScore??0).toFixed(1)," · 第",fe.hotRank&&fe.hotRank>0?fe.hotRank:"-","名"]}),v&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(fe),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsxs("div",{className:"flex gap-1",children:[i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(fe),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(fe),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]})]},fe.id)}))})]},L.id):i.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${D?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...P("part",L.id,{partId:L.id,partTitle:L.title,chapterId:((H=L.chapters[0])==null?void 0:H.id)??"",chapterTitle:((de=L.chapters[0])==null?void 0:de.title)??""}),children:[i.jsxs("div",{draggable:!0,onDragStart:K=>{K.stopPropagation(),K.dataTransfer.setData("text/plain","part:"+L.id),K.dataTransfer.effectAllowed="move",k({type:"part",id:L.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${T("part",L.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>n(L.id),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx(Vs,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),i.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:I(X)}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-white text-base",children:L.title}),i.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",_," 节"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:K=>K.stopPropagation(),onClick:K=>K.stopPropagation(),children:[o&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(L),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:i.jsx(Ft,{className:"w-3.5 h-3.5"})}),h&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(L),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),f&&i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(L),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:i.jsx(wn,{className:"w-3.5 h-3.5"})}),i.jsxs("span",{className:"text-xs text-gray-500",children:[ae,"章"]}),$?i.jsx(Ec,{className:"w-5 h-5 text-gray-500"}):i.jsx(Ho,{className:"w-5 h-5 text-gray-500"})]})]}),$&&i.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:L.chapters.map(K=>{const fe=O("chapter",K.id);return i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 w-full",children:[i.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","chapter:"+K.id),Q.dataTransfer.effectAllowed="move",k({type:"chapter",id:K.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:Q=>{Q.preventDefault(),Q.stopPropagation(),Q.dataTransfer.dropEffect="move",C({type:"chapter",id:K.id})},onDragOver:Q=>{Q.preventDefault(),Q.stopPropagation(),Q.dataTransfer.dropEffect="move",C({type:"chapter",id:K.id})},onDragLeave:()=>C(null),onDrop:Q=>{C(null);const oe=cg(Q.dataTransfer.getData("text/plain"));if(!oe)return;const ue={partId:L.id,partTitle:L.title,chapterId:K.id,chapterTitle:K.title};(oe.type==="section"||oe.type==="chapter")&&R(Q,"chapter",K.id,ue)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${fe?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${T("chapter",K.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[i.jsx(Vs,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),i.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:K.title})]}),i.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:Q=>Q.stopPropagation(),children:[m&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>m(L,K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),c&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>c(L),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:i.jsx(Ft,{className:"w-3.5 h-3.5"})}),u&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(L,K),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx("div",{className:"space-y-1 pl-2",children:K.sections.map(Q=>{const oe=O("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:ue=>{ue.stopPropagation(),ue.dataTransfer.setData("text/plain","section:"+Q.id),ue.dataTransfer.effectAllowed="move",k({type:"section",id:Q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${oe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${T("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...P("section",Q.id,{partId:L.id,partTitle:L.title,chapterId:K.id,chapterTitle:K.title}),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ue=>ue.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(Q.id),onChange:()=>y(Q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),i.jsx(Vs,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),i.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${Q.price===0||Q.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),i.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[Q.id," ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Uo,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:ue=>ue.stopPropagation(),onClick:ue=>ue.stopPropagation(),children:[Q.isNew&&i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),Q.price===0||Q.isFree?i.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):i.jsxs("span",{className:"text-xs text-gray-500",children:["¥",Q.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",Q.clickCount??0," · 付款 ",Q.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(Q.hotScore??0).toFixed(1)," · 第",Q.hotRank&&Q.hotRank>0?Q.hotRank:"-","名"]}),v&&i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),i.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(kt,{className:"w-3.5 h-3.5"})}),i.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(wn,{className:"w-3.5 h-3.5"})})]})]})]},Q.id)})})]},K.id)})})]},L.id)})})}function KB(t){const e=new Map;for(const c of t){const u=c.partId||"part-1",h=c.partTitle||"未分类",f=c.chapterId||"chapter-1",m=c.chapterTitle||"未分类";e.has(u)||e.set(u,{id:u,title:h,chapters:new Map});const g=e.get(u);g.chapters.has(f)||g.chapters.set(f,{id:f,title:m,sections:[]}),g.chapters.get(f).sections.push({id:c.id,title:c.title,price:c.price??1,filePath:c.filePath,isFree:c.isFree,isNew:c.isNew,clickCount:c.clickCount??0,payCount:c.payCount??0,hotScore:c.hotScore??0,hotRank:c.hotRank??0})}const n="part-2026-daily",r="2026每日派对干货";Array.from(e.values()).some(c=>c.title===r||c.title.includes(r))||e.set(n,{id:n,title:r,chapters:new Map([["chapter-2026-daily",{id:"chapter-2026-daily",title:r,sections:[]}]])});const a=Array.from(e.values()).map(c=>({...c,chapters:Array.from(c.chapters.values())})),o=c=>c.includes("序言")?0:c.includes(r)?1.5:c.includes("附录")?2:c.includes("尾声")?3:1;return a.sort((c,u)=>{const h=o(c.title),f=o(u.title);return h!==f?h-f:0})}function qB(){var od,ld,fa;const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState([]),[o,c]=b.useState(null),[u,h]=b.useState(!1),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,j]=b.useState(""),[w,k]=b.useState([]),[E,C]=b.useState(!1),[T,O]=b.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[B,R]=b.useState(null),[P,I]=b.useState(!1),[L,X]=b.useState(!1),[Z,Y]=b.useState(null),[W,D]=b.useState(!1),[$,ae]=b.useState([]),[_,se]=b.useState(!1),[q,z]=b.useState(""),[H,de]=b.useState(""),[K,fe]=b.useState(!1),[Q,oe]=b.useState(""),[ue,ye]=b.useState(!1),[V,ge]=b.useState(null),[Me,tt]=b.useState(!1),[et,ot]=b.useState(!1),[Ge,dt]=b.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[Et,ht]=b.useState(!1),[Tt,rr]=b.useState(!1),[sr,Er]=b.useState(1),[on,Kr]=b.useState([]),[gr,Tr]=b.useState(!1),[_n,Jn]=b.useState(20),[Yn,Cn]=b.useState(!1),[pe,ve]=b.useState(!1),[hn,Mr]=b.useState([]),[fs,ua]=b.useState([]),[En,qr]=b.useState({personId:"",name:"",label:"",ckbApiKey:""}),[ha,xr]=b.useState(null),[Gr,ai]=b.useState(""),[ut,Ar]=b.useState({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),io=b.useRef(null),xn=KB(t),Jr=t.length,oi=[...t].sort((A,ee)=>(ee.hotScore??0)-(A.hotScore??0)),Rr=10,ps=Math.max(1,Math.ceil(oi.length/Rr)),Yr=oi.slice((sr-1)*Rr,sr*Rr),Tn=async()=>{r(!0);try{const A=await Fe("/api/db/book?action=list",{cache:"no-store"});e(Array.isArray(A==null?void 0:A.sections)?A.sections:[])}catch(A){console.error(A),e([])}finally{r(!1)}};b.useEffect(()=>{Tn()},[]);const ms=A=>{a(ee=>ee.includes(A)?ee.filter(Se=>Se!==A):[...ee,A])},Ps=b.useCallback(A=>{const ee=t,Se=A.flatMap(je=>{const jt=ee.find(Mt=>Mt.id===je.id);return jt?[{...jt,partId:je.partId,partTitle:je.partTitle,chapterId:je.chapterId,chapterTitle:je.chapterTitle}]:[]});return e(Se),_t("/api/db/book",{action:"reorder",items:A}).then(je=>{je&&je.success===!1&&(e(ee),he.error("排序失败: "+(je&&typeof je=="object"&&"error"in je?je.error:"未知错误")))}).catch(je=>{e(ee),console.error("排序失败:",je),he.error("排序失败: "+(je instanceof Error?je.message:"网络或服务异常"))}),Promise.resolve()},[t]),Is=async A=>{if(confirm(`确定要删除章节「${A.title}」吗?此操作不可恢复。`))try{const ee=await ss(`/api/db/book?id=${encodeURIComponent(A.id)}`);ee&&ee.success!==!1?(he.success("已删除"),Tn()):he.error("删除失败: "+(ee&&typeof ee=="object"&&"error"in ee?ee.error:"未知错误"))}catch(ee){console.error(ee),he.error("删除失败")}},G=b.useCallback(async()=>{ht(!0);try{const A=await Fe("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),ee=A&&A.data;ee&&typeof ee.readWeight=="number"&&typeof ee.recencyWeight=="number"&&typeof ee.payWeight=="number"&&dt({readWeight:Math.max(0,Math.min(1,ee.readWeight)),recencyWeight:Math.max(0,Math.min(1,ee.recencyWeight)),payWeight:Math.max(0,Math.min(1,ee.payWeight))})}catch{}finally{ht(!1)}},[]);b.useEffect(()=>{et&&G()},[et,G]);const nt=async()=>{const{readWeight:A,recencyWeight:ee,payWeight:Se}=Ge,je=A+ee+Se;if(Math.abs(je-1)>.001){he.error("三个权重之和必须等于 1");return}rr(!0);try{const jt=await mt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:A,recencyWeight:ee,payWeight:Se},description:"文章排名算法权重"});jt&&jt.success!==!1?(he.success("排名权重已保存"),Tn()):he.error("保存失败: "+(jt&&typeof jt=="object"&&"error"in jt?jt.error:""))}catch(jt){console.error(jt),he.error("保存失败")}finally{rr(!1)}},wt=b.useCallback(async()=>{Tr(!0);try{const A=await Fe("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),ee=A&&A.data;Array.isArray(ee)&&Kr(ee)}catch{}finally{Tr(!1)}},[]),ft=b.useCallback(async()=>{try{const A=await Fe("/api/db/persons");A!=null&&A.success&&A.persons&&Mr(A.persons.map(ee=>({id:ee.personId,name:ee.name,label:ee.label,ckbApiKey:ee.ckbApiKey})))}catch{}},[]),Qt=b.useCallback(async()=>{try{const A=await Fe("/api/db/link-tags");A!=null&&A.success&&A.linkTags&&ua(A.linkTags.map(ee=>({id:ee.tagId,label:ee.label,url:ee.url,type:ee.type,appId:ee.appId,pagePath:ee.pagePath})))}catch{}},[]),li=async A=>{const ee=on.includes(A)?on.filter(Se=>Se!==A):[...on,A];Kr(ee);try{await mt("/api/db/config",{key:"pinned_section_ids",value:ee,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{Kr(on)}},xl=b.useCallback(async()=>{Cn(!0);try{const A=await Fe("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),ee=A&&A.data;typeof ee=="number"&&ee>0&&ee<=100&&Jn(ee)}catch{}finally{Cn(!1)}},[]),Tf=async()=>{if(_n<1||_n>100){he.error("预览比例需在 1~100 之间");return}ve(!0);try{const A=await mt("/api/db/config",{key:"unpaid_preview_percent",value:_n,description:"小程序未付费内容默认预览比例(%)"});A&&A.success!==!1?he.success("预览比例已保存"):he.error("保存失败: "+(A.error||""))}catch{he.error("保存失败")}finally{ve(!1)}};b.useEffect(()=>{wt(),xl(),ft(),Qt()},[wt,xl,ft,Qt]);const yl=async A=>{ge({section:A,orders:[]}),tt(!0);try{const ee=await Fe(`/api/db/book?action=section-orders&id=${encodeURIComponent(A.id)}`),Se=ee!=null&&ee.success&&Array.isArray(ee.orders)?ee.orders:[];ge(je=>je?{...je,orders:Se}:null)}catch(ee){console.error(ee),ge(Se=>Se?{...Se,orders:[]}:null)}finally{tt(!1)}},ao=async A=>{m(!0);try{const ee=await Fe(`/api/db/book?action=read&id=${encodeURIComponent(A.id)}`);if(ee!=null&&ee.success&&ee.section){const Se=ee.section,je=Se.editionPremium===!0;c({id:A.id,originalId:A.id,title:ee.section.title??A.title,price:ee.section.price??A.price,content:ee.section.content??"",filePath:A.filePath,isFree:A.isFree||A.price===0,isNew:Se.isNew??A.isNew,isPinned:on.includes(A.id),hotScore:A.hotScore??0,editionStandard:je?!1:Se.editionStandard??!0,editionPremium:je})}else c({id:A.id,originalId:A.id,title:A.title,price:A.price,content:"",filePath:A.filePath,isFree:A.isFree,isNew:A.isNew,isPinned:on.includes(A.id),hotScore:A.hotScore??0,editionStandard:!0,editionPremium:!1}),ee&&!ee.success&&he.error("无法读取文件内容: "+(ee.error||"未知错误"))}catch(ee){console.error(ee),c({id:A.id,title:A.title,price:A.price,content:"",filePath:A.filePath,isFree:A.isFree})}finally{m(!1)}},td=async()=>{var A;if(o){y(!0);try{let ee=o.content||"";const Se=[new RegExp(`^#+\\s*${o.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${o.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(A=o.title)==null?void 0:A.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const Mn of Se)ee=ee.replace(Mn,"");ee=ee.replace(/^\s*\n+/,"").trim();const je=o.originalId||o.id,jt=o.id!==je,Mt=await _t("/api/db/book",{id:je,...jt?{newId:o.id}:{},title:o.title,price:o.isFree?0:o.price,content:ee,isFree:o.isFree||o.price===0,isNew:o.isNew,hotScore:o.hotScore,editionStandard:o.editionPremium?!1:o.editionStandard??!0,editionPremium:o.editionPremium??!1,saveToFile:!0}),zn=jt?o.id:je;o.isPinned!==on.includes(zn)&&await li(zn),Mt&&Mt.success!==!1?(he.success(`已保存:${o.title}`),c(null),Tn()):he.error("保存失败: "+(Mt&&typeof Mt=="object"&&"error"in Mt?Mt.error:"未知错误"))}catch(ee){console.error(ee),he.error("保存失败")}finally{y(!1)}}},nd=async()=>{if(!T.id||!T.title){he.error("请填写章节ID和标题");return}y(!0);try{const A=xn.find(je=>je.id===T.partId),ee=A==null?void 0:A.chapters.find(je=>je.id===T.chapterId),Se=await _t("/api/db/book",{id:T.id,title:T.title,price:T.isFree?0:T.price,content:T.content,partId:T.partId,partTitle:(A==null?void 0:A.title)??"",chapterId:T.chapterId,chapterTitle:(ee==null?void 0:ee.title)??"",isFree:T.isFree,isNew:T.isNew,editionStandard:T.editionPremium?!1:T.editionStandard??!0,editionPremium:T.editionPremium??!1,hotScore:T.hotScore??0,saveToFile:!1});if(Se&&Se.success!==!1){if(T.isPinned){const je=[...on,T.id];Kr(je);try{await mt("/api/db/config",{key:"pinned_section_ids",value:je,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}he.success(`章节创建成功:${T.title}`),h(!1),O({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),Tn()}else he.error("创建失败: "+(Se&&typeof Se=="object"&&"error"in Se?Se.error:"未知错误"))}catch(A){console.error(A),he.error("创建失败")}finally{y(!1)}},Mf=A=>{O(ee=>{var Se;return{...ee,partId:A.id,chapterId:((Se=A.chapters[0])==null?void 0:Se.id)??"chapter-1"}}),h(!0)},Af=A=>{R({id:A.id,title:A.title})},Vt=async()=>{var A;if((A=B==null?void 0:B.title)!=null&&A.trim()){I(!0);try{const ee=t.map(je=>({id:je.id,partId:je.partId||"part-1",partTitle:je.partId===B.id?B.title.trim():je.partTitle||"",chapterId:je.chapterId||"chapter-1",chapterTitle:je.chapterTitle||""})),Se=await _t("/api/db/book",{action:"reorder",items:ee});if(Se&&Se.success!==!1){const je=B.title.trim();e(jt=>jt.map(Mt=>Mt.partId===B.id?{...Mt,partTitle:je}:Mt)),R(null),Tn()}else he.error("更新篇名失败: "+(Se&&typeof Se=="object"&&"error"in Se?Se.error:"未知错误"))}catch(ee){console.error(ee),he.error("更新篇名失败")}finally{I(!1)}}},Rf=A=>{const ee=A.chapters.length+1,Se=`chapter-${A.id}-${ee}-${Date.now()}`;O({id:`${ee}.1`,title:"新章节",price:1,partId:A.id,chapterId:Se,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),h(!0)},vl=(A,ee)=>{Y({part:A,chapter:ee,title:ee.title})},rd=async()=>{var A;if((A=Z==null?void 0:Z.title)!=null&&A.trim()){D(!0);try{const ee=t.map(je=>({id:je.id,partId:je.partId||Z.part.id,partTitle:je.partId===Z.part.id?Z.part.title:je.partTitle||"",chapterId:je.chapterId||Z.chapter.id,chapterTitle:je.partId===Z.part.id&&je.chapterId===Z.chapter.id?Z.title.trim():je.chapterTitle||""})),Se=await _t("/api/db/book",{action:"reorder",items:ee});if(Se&&Se.success!==!1){const je=Z.title.trim(),jt=Z.part.id,Mt=Z.chapter.id;e(zn=>zn.map(Mn=>Mn.partId===jt&&Mn.chapterId===Mt?{...Mn,chapterTitle:je}:Mn)),Y(null),Tn()}else he.error("保存失败: "+(Se&&typeof Se=="object"&&"error"in Se?Se.error:"未知错误"))}catch(ee){console.error(ee),he.error("保存失败")}finally{D(!1)}}},oo=async(A,ee)=>{const Se=ee.sections.map(je=>je.id);if(Se.length===0){he.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${A.chapters.indexOf(ee)+1}章 | ${ee.title}」吗?将删除共 ${Se.length} 节,此操作不可恢复。`))try{for(const je of Se)await ss(`/api/db/book?id=${encodeURIComponent(je)}`);Tn()}catch(je){console.error(je),he.error("删除失败")}},Pf=async()=>{if(!Q.trim()){he.error("请输入篇名");return}ye(!0);try{const A=`part-new-${Date.now()}`,ee="chapter-1",Se=`part-placeholder-${Date.now()}`,je=await _t("/api/db/book",{id:Se,title:"占位节(可编辑)",price:0,content:"",partId:A,partTitle:Q.trim(),chapterId:ee,chapterTitle:"第1章 | 待编辑",saveToFile:!1});je&&je.success!==!1?(he.success(`篇「${Q}」创建成功`),X(!1),oe(""),Tn()):he.error("创建失败: "+(je&&typeof je=="object"&&"error"in je?je.error:"未知错误"))}catch(A){console.error(A),he.error("创建失败")}finally{ye(!1)}},sd=async()=>{if($.length===0){he.error("请先勾选要移动的章节");return}const A=xn.find(Se=>Se.id===q),ee=A==null?void 0:A.chapters.find(Se=>Se.id===H);if(!A||!ee||!q||!H){he.error("请选择目标篇和章");return}fe(!0);try{const Se=()=>{const zn=new Set($),Mn=t.map(Qe=>({id:Qe.id,partId:Qe.partId||"",partTitle:Qe.partTitle||"",chapterId:Qe.chapterId||"",chapterTitle:Qe.chapterTitle||""})),pa=Mn.filter(Qe=>zn.has(Qe.id)).map(Qe=>({...Qe,partId:q,partTitle:A.title||q,chapterId:H,chapterTitle:ee.title||H})),ma=Mn.filter(Qe=>!zn.has(Qe.id));let ga=ma.length;for(let Qe=ma.length-1;Qe>=0;Qe-=1){const bl=ma[Qe];if(bl.partId===q&&bl.chapterId===H){ga=Qe+1;break}}return[...ma.slice(0,ga),...pa,...ma.slice(ga)]},je=async()=>{const zn=Se(),Mn=await _t("/api/db/book",{action:"reorder",items:zn});return Mn&&Mn.success!==!1?(he.success(`已移动 ${$.length} 节到「${A.title}」-「${ee.title}」`),se(!1),ae([]),await Tn(),!0):!1},jt={action:"move-sections",sectionIds:$,targetPartId:q,targetChapterId:H,targetPartTitle:A.title||q,targetChapterTitle:ee.title||H},Mt=await _t("/api/db/book",jt);if(Mt&&Mt.success!==!1)he.success(`已移动 ${Mt.count??$.length} 节到「${A.title}」-「${ee.title}」`),se(!1),ae([]),await Tn();else{const zn=Mt&&typeof Mt=="object"&&"error"in Mt?Mt.error||"":"未知错误";if((zn.includes("缺少 id")||zn.includes("无效的 action"))&&await je())return;he.error("移动失败: "+zn)}}catch(Se){console.error(Se),he.error("移动失败: "+(Se instanceof Error?Se.message:"网络或服务异常"))}finally{fe(!1)}},lo=A=>{ae(ee=>ee.includes(A)?ee.filter(Se=>Se!==A):[...ee,A])},Pr=async A=>{const ee=t.filter(Se=>Se.partId===A.id).map(Se=>Se.id);if(ee.length===0){he.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${A.title}」整篇吗?将删除共 ${ee.length} 节内容,此操作不可恢复。`))try{for(const Se of ee)await ss(`/api/db/book?id=${encodeURIComponent(Se)}`);Tn()}catch(Se){console.error(Se),he.error("删除失败")}},id=async()=>{var A;if(v.trim()){C(!0);try{const ee=await Fe(`/api/search?q=${encodeURIComponent(v)}`);ee!=null&&ee.success&&((A=ee.data)!=null&&A.results)?k(ee.data.results):(k([]),ee&&!ee.success&&he.error("搜索失败: "+ee.error))}catch(ee){console.error(ee),k([]),he.error("搜索失败")}finally{C(!1)}}},Qn=xn.find(A=>A.id===T.partId),ad=(Qn==null?void 0:Qn.chapters)??[];return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),i.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",xn.length," 篇 · ",Jr," 节内容"]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(ne,{onClick:()=>ot(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[i.jsx(uu,{className:"w-4 h-4 mr-2"}),"排名算法"]}),i.jsxs(ne,{onClick:()=>{const A=typeof window<"u"?`${window.location.origin}/api-doc`:"";A&&window.open(A,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(Ss,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),i.jsx(Zt,{open:u,onOpenChange:h,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[i.jsx(en,{className:"shrink-0 px-6 pt-6 pb-2",children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),i.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节ID *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:T.id,onChange:A=>O({...T,id:A.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:T.isFree?0:T.price,onChange:A=>O({...T,price:Number(A.target.value),isFree:Number(A.target.value)===0}),disabled:T.isFree})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"免费"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:T.isFree,onChange:A=>O({...T,isFree:A.target.checked,price:A.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最新新增"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:T.isNew,onChange:A=>O({...T,isNew:A.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"小程序直推"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:T.isPinned,onChange:A=>O({...T,isPinned:A.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"文章类型"}),i.jsxs("div",{className:"flex items-center gap-4 h-10",children:[i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"radio",name:"new-edition-type",checked:T.editionPremium!==!0,onChange:()=>O({...T,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"radio",name:"new-edition-type",checked:T.editionPremium===!0,onChange:()=>O({...T,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"热度分"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:T.hotScore??0,onChange:A=>O({...T,hotScore:Math.max(0,parseFloat(A.target.value)||0)})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节标题 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:T.title,onChange:A=>O({...T,title:A.target.value})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"所属篇"}),i.jsxs(sc,{value:T.partId,onValueChange:A=>{var Se;const ee=xn.find(je=>je.id===A);O({...T,partId:A,chapterId:((Se=ee==null?void 0:ee.chapters[0])==null?void 0:Se.id)??"chapter-1"})},children:[i.jsx(Bo,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(ic,{})}),i.jsxs(Vo,{className:"bg-[#0f2137] border-gray-700",children:[xn.map(A=>i.jsx(bs,{value:A.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:A.title},A.id)),xn.length===0&&i.jsx(bs,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"所属章"}),i.jsxs(sc,{value:T.chapterId,onValueChange:A=>O({...T,chapterId:A}),children:[i.jsx(Bo,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(ic,{})}),i.jsxs(Vo,{className:"bg-[#0f2137] border-gray-700",children:[ad.map(A=>i.jsx(bs,{value:A.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:A.title},A.id)),ad.length===0&&i.jsx(bs,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),i.jsx(fx,{content:T.content||"",onChange:A=>O({...T,content:A}),onImageUpload:async A=>{var jt;const ee=new FormData;ee.append("file",A),ee.append("folder","book-images");const je=await(await fetch(Ha("/api/upload"),{method:"POST",body:ee,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((jt=je==null?void 0:je.data)==null?void 0:jt.url)||(je==null?void 0:je.url)||""},persons:hn,linkTags:fs,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),i.jsxs(Nn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[i.jsx(ne,{variant:"outline",onClick:()=>h(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(ne,{onClick:nd,disabled:g||!T.id||!T.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),i.jsx(Zt,{open:!!B,onOpenChange:A=>!A&&R(null),children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(kt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),B&&i.jsx("div",{className:"space-y-4 py-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"篇名"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:B.title,onChange:A=>R({...B,title:A.target.value}),placeholder:"输入篇名"})]})}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",onClick:()=>R(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(ne,{onClick:Vt,disabled:P||!((od=B==null?void 0:B.title)!=null&&od.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:P?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),i.jsx(Zt,{open:!!Z,onOpenChange:A=>!A&&Y(null),children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(kt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),Z&&i.jsx("div",{className:"space-y-4 py-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:Z.title,onChange:A=>Y({...Z,title:A.target.value}),placeholder:"输入章节名称"})]})}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",onClick:()=>Y(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(ne,{onClick:rd,disabled:W||!((ld=Z==null?void 0:Z.title)!=null&&ld.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:W?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),i.jsx(Zt,{open:_,onOpenChange:A=>{var ee;if(se(A),A&&xn.length>0){const Se=xn[0];z(Se.id),de(((ee=Se.chapters[0])==null?void 0:ee.id)??"")}},children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(en,{children:i.jsx(tn,{className:"text-white",children:"批量移动至指定目录"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",i.jsx("span",{className:"text-[#38bdac] font-medium",children:$.length})," 节,请选择目标篇与章。"]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目标篇"}),i.jsxs(sc,{value:q,onValueChange:A=>{var Se;z(A);const ee=xn.find(je=>je.id===A);de(((Se=ee==null?void 0:ee.chapters[0])==null?void 0:Se.id)??"")},children:[i.jsx(Bo,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(ic,{placeholder:"选择篇"})}),i.jsx(Vo,{className:"bg-[#0f2137] border-gray-700",children:xn.map(A=>i.jsx(bs,{value:A.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:A.title},A.id))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目标章"}),i.jsxs(sc,{value:H,onValueChange:de,children:[i.jsx(Bo,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(ic,{placeholder:"选择章"})}),i.jsx(Vo,{className:"bg-[#0f2137] border-gray-700",children:(((fa=xn.find(A=>A.id===q))==null?void 0:fa.chapters)??[]).map(A=>i.jsx(bs,{value:A.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:A.title},A.id))})]})]})]}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",onClick:()=>se(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(ne,{onClick:sd,disabled:K||$.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:K?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),i.jsx(Zt,{open:!!V,onOpenChange:A=>!A&&ge(null),children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white",children:["付款记录 — ",(V==null?void 0:V.section.title)??""]})}),i.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Me?i.jsxs("div",{className:"flex items-center justify-center py-8",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):V&&V.orders.length===0?i.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):V?i.jsxs("table",{className:"w-full text-sm border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[i.jsx("th",{className:"py-2 pr-2",children:"订单号"}),i.jsx("th",{className:"py-2 pr-2",children:"用户ID"}),i.jsx("th",{className:"py-2 pr-2",children:"金额"}),i.jsx("th",{className:"py-2 pr-2",children:"状态"}),i.jsx("th",{className:"py-2 pr-2",children:"支付时间"})]})}),i.jsx("tbody",{children:V.orders.map(A=>i.jsxs("tr",{className:"border-b border-gray-700/50",children:[i.jsx("td",{className:"py-2 pr-2",children:i.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${A.orderSn}`,onClick:()=>window.open(`/orders?search=${A.orderSn??A.id??""}`,"_blank"),children:A.orderSn?A.orderSn.length>16?A.orderSn.slice(0,8)+"..."+A.orderSn.slice(-6):A.orderSn:"-"})}),i.jsx("td",{className:"py-2 pr-2",children:i.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${A.userId??A.openId??""}`,onClick:()=>window.open(`/users?search=${A.userId??A.openId??""}`,"_blank"),children:(()=>{const ee=A.userId??A.openId??"-";return ee.length>12?ee.slice(0,6)+"..."+ee.slice(-4):ee})()})}),i.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",A.amount??0]}),i.jsx("td",{className:"py-2 pr-2 text-gray-300",children:A.status??"-"}),i.jsx("td",{className:"py-2 pr-2 text-gray-500",children:A.payTime??A.createdAt??"-"})]},A.id??A.orderSn??""))})]}):null})]})}),i.jsx(Zt,{open:et,onOpenChange:ot,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(uu,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),i.jsxs("div",{className:"space-y-4 py-2",children:[i.jsx("p",{className:"text-sm text-gray-400",children:"热度积分 = 阅读权重×阅读排名分 + 新度权重×新度排名分 + 付款权重×付款排名分(三权重之和须为 1)"}),Et?i.jsx("p",{className:"text-gray-500",children:"加载中..."}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"阅读权重"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Ge.readWeight,onChange:A=>dt(ee=>({...ee,readWeight:Math.max(0,Math.min(1,parseFloat(A.target.value)||0))}))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"新度权重"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Ge.recencyWeight,onChange:A=>dt(ee=>({...ee,recencyWeight:Math.max(0,Math.min(1,parseFloat(A.target.value)||0))}))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"付款权重"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Ge.payWeight,onChange:A=>dt(ee=>({...ee,payWeight:Math.max(0,Math.min(1,parseFloat(A.target.value)||0))}))})]})]}),i.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(Ge.readWeight+Ge.recencyWeight+Ge.payWeight).toFixed(1)]}),i.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[i.jsx("li",{children:"阅读量前 20 名:第1名=20分、第2名=19分...第20名=1分"}),i.jsx("li",{children:"最近更新前 30 篇:第1名=30分、第2名=29分...第30名=1分"}),i.jsx("li",{children:"付款数前 20 名:第1名=20分、第2名=19分...第20名=1分"}),i.jsx("li",{children:"热度分可在编辑章节中手动覆盖"})]}),i.jsx(ne,{onClick:nt,disabled:Tt||Math.abs(Ge.readWeight+Ge.recencyWeight+Ge.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Tt?"保存中...":"保存权重"})]})]})]})}),i.jsx(Zt,{open:L,onOpenChange:X,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(Ft,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),i.jsx("div",{className:"space-y-4 py-4",children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:Q,onChange:A=>oe(A.target.value),placeholder:"输入篇名"})]})}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",onClick:()=>{X(!1),oe("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(ne,{onClick:Pf,disabled:ue||!Q.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:ue?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),i.jsx(Zt,{open:!!o,onOpenChange:()=>c(null),children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[i.jsx(en,{className:"shrink-0 px-6 pt-6 pb-2",children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[i.jsx(kt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),o&&i.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.id,onChange:A=>c({...o,id:A.target.value}),placeholder:"如: 9.15"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.isFree?0:o.price,onChange:A=>c({...o,price:Number(A.target.value),isFree:Number(A.target.value)===0}),disabled:o.isFree})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"免费"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:o.isFree||o.price===0,onChange:A=>c({...o,isFree:A.target.checked,price:A.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最新新增"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:o.isNew??!1,onChange:A=>c({...o,isNew:A.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"小程序直推"}),i.jsx("div",{className:"flex items-center h-10",children:i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:o.isPinned??!1,onChange:A=>c({...o,isPinned:A.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"文章类型"}),i.jsxs("div",{className:"flex items-center gap-4 h-10",children:[i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium!==!0,onChange:()=>c({...o,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),i.jsxs("label",{className:"flex items-center cursor-pointer",children:[i.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium===!0,onChange:()=>c({...o,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),i.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"热度分"}),i.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:o.hotScore??0,onChange:A=>c({...o,hotScore:Math.max(0,parseFloat(A.target.value)||0)})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"章节标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.title,onChange:A=>c({...o,title:A.target.value})})]}),o.filePath&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"文件路径"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:o.filePath,disabled:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),f?i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsx(fx,{ref:io,content:o.content||"",onChange:A=>c({...o,content:A}),onImageUpload:async A=>{var jt;const ee=new FormData;ee.append("file",A),ee.append("folder","book-images");const je=await(await fetch(Ha("/api/upload"),{method:"POST",body:ee,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((jt=je==null?void 0:je.data)==null?void 0:jt.url)||(je==null?void 0:je.url)||""},persons:hn,linkTags:fs,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),i.jsxs(Nn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[o&&i.jsxs(ne,{variant:"outline",onClick:()=>yl({id:o.id,title:o.title,price:o.price}),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent mr-auto",children:[i.jsx(Hr,{className:"w-4 h-4 mr-2"}),"付款记录"]}),i.jsxs(ne,{variant:"outline",onClick:()=>c(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(Wn,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsx(ne,{onClick:td,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),i.jsxs(Gc,{defaultValue:"chapters",className:"space-y-6",children:[i.jsxs(ul,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[i.jsxs(nn,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[i.jsx(Hr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),i.jsxs(nn,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[i.jsx(Ob,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),i.jsxs(nn,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[i.jsx(Ui,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),i.jsxs(nn,{value:"link-ai",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[i.jsx(Ss,{className:"w-4 h-4 mr-2"}),"链接AI"]})]}),i.jsxs(rn,{value:"chapters",className:"space-y-4",children:[i.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:i.jsx(Hr,{className:"w-6 h-6"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),i.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),i.jsxs("div",{className:"text-center shrink-0",children:[i.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:Jr}),i.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsxs(ne,{onClick:()=>h(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"新建章节"]}),i.jsxs(ne,{onClick:()=>X(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"新建篇"]}),i.jsxs(ne,{variant:"outline",onClick:()=>se(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",$.length," 节)"]})]}),n?i.jsxs("div",{className:"flex items-center justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsx(UB,{parts:xn,expandedParts:s,onTogglePart:ms,onReorder:Ps,onReadSection:ao,onDeleteSection:Is,onAddSectionInPart:Mf,onAddChapterInPart:Rf,onDeleteChapter:oo,onEditPart:Af,onDeletePart:Pr,onEditChapter:vl,selectedSectionIds:$,onToggleSectionSelect:lo,onShowSectionOrders:yl,pinnedSectionIds:on})]}),i.jsx(rn,{value:"search",className:"space-y-4",children:i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"内容搜索"})}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:v,onChange:A=>j(A.target.value),onKeyDown:A=>A.key==="Enter"&&id()}),i.jsx(ne,{onClick:id,disabled:E||!v.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?i.jsx(qe,{className:"w-4 h-4 animate-spin"}):i.jsx(Ui,{className:"w-4 h-4"})})]}),w.length>0&&i.jsxs("div",{className:"space-y-2 mt-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",w.length," 个结果"]}),w.map(A=>i.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>ao({id:A.id,title:A.title,price:A.price??1,filePath:""}),children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:A.id}),i.jsx("span",{className:"text-white",children:A.title}),on.includes(A.id)&&i.jsx(Uo,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),i.jsx(Be,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:A.matchType==="title"?"标题匹配":"内容匹配"})]}),A.snippet&&i.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:A.snippet}),(A.partTitle||A.chapterTitle)&&i.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[A.partTitle," · ",A.chapterTitle]})]},A.id))]})]})]})}),i.jsxs(rn,{value:"ranking",className:"space-y-4",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(Xe,{className:"pb-3",children:i.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(uu,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),i.jsx(Re,{children:i.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(te,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),i.jsx(ce,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:_n,onChange:A=>Jn(Math.max(1,Math.min(100,Number(A.target.value)||20))),disabled:Yn}),i.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),i.jsx(ne,{size:"sm",onClick:Tf,disabled:pe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:pe?"保存中...":"保存"}),i.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",_n,"% 内容"]})]})})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(Xe,{className:"pb-3",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(Ob,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",i.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",oi.length," 节"]})]}),i.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[i.jsx(ne,{variant:"ghost",size:"sm",disabled:sr<=1,onClick:()=>Er(A=>Math.max(1,A-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:i.jsx(LT,{className:"w-4 h-4"})}),i.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[sr," / ",ps]}),i.jsx(ne,{variant:"ghost",size:"sm",disabled:sr>=ps,onClick:()=>Er(A=>Math.min(ps,A+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:i.jsx(Ho,{className:"w-4 h-4"})})]})]})}),i.jsx(Re,{children:i.jsxs("div",{className:"space-y-0",children:[i.jsxs("div",{className:"grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2 text-xs text-gray-500 border-b border-gray-700/50",children:[i.jsx("span",{children:"排名"}),i.jsx("span",{children:"置顶"}),i.jsx("span",{children:"标题"}),i.jsx("span",{className:"text-right",children:"点击量"}),i.jsx("span",{className:"text-right",children:"付款数"}),i.jsx("span",{className:"text-right",children:"热度"}),i.jsx("span",{className:"text-right",children:"编辑"})]}),Yr.map((A,ee)=>{const Se=(sr-1)*Rr+ee+1,je=on.includes(A.id);return i.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${je?"bg-amber-500/5":""}`,children:[i.jsx("span",{className:`text-sm font-bold ${Se<=3?"text-amber-400":"text-gray-500"}`,children:Se<=3?["🥇","🥈","🥉"][Se-1]:`#${Se}`}),i.jsx(ne,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${je?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>li(A.id),disabled:gr,title:je?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:je?i.jsx(Uo,{className:"w-3.5 h-3.5 fill-current"}):i.jsx(lA,{className:"w-3.5 h-3.5"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("span",{className:"text-white text-sm truncate block",children:A.title}),i.jsxs("span",{className:"text-gray-600 text-xs",children:[A.partTitle," · ",A.chapterTitle]})]}),i.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:A.clickCount??0}),i.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:A.payCount??0}),i.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(A.hotScore??0).toFixed(1)}),i.jsx("div",{className:"text-right",children:i.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>ao({id:A.id,title:A.title,price:A.price,filePath:""}),title:"编辑文章",children:i.jsx(kt,{className:"w-3 h-3"})})})]},A.id)}),Yr.length===0&&i.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),i.jsxs(rn,{value:"link-ai",className:"space-y-4",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"pb-3",children:[i.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[i.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — 链接人与事(编辑器内输入 @ 可链接)"]}),i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"在文章中 @人物,小程序端点击可跳转存客宝流量池或详情页"})]}),i.jsxs(Re,{className:"space-y-3",children:[i.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"名称 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 卡若",value:En.name,onChange:A=>qr({...En,name:A.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"自动生成",value:En.personId,onChange:A=>qr({...En,personId:A.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"如 超级个体",value:En.label,onChange:A=>qr({...En,label:A.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"存客宝密钥(留空用默认)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-48",placeholder:"xxxx-xxxx-xxxx-xxxx",value:En.ckbApiKey,onChange:A=>qr({...En,ckbApiKey:A.target.value})})]}),i.jsxs(ne,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8",onClick:async()=>{if(!En.name){he.error("名称必填");return}const A={...En};A.personId||(A.personId=En.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36)),await mt("/api/db/persons",A),qr({personId:"",name:"",label:"",ckbApiKey:""}),ft()},children:[i.jsx(Ft,{className:"w-3 h-3 mr-1"}),"添加"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[hn.map(A=>i.jsxs("div",{className:"bg-[#0a1628] rounded px-3 py-2 space-y-1.5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsxs("span",{className:"text-[#38bdac] font-bold text-base",children:["@",A.name]}),i.jsx("span",{className:"text-gray-600 text-xs font-mono",children:A.id}),A.label&&i.jsx(Be,{variant:"secondary",className:"bg-purple-500/20 text-purple-300 border-purple-500/30 text-[10px]",children:A.label}),A.ckbApiKey?i.jsx(Be,{variant:"secondary",className:"bg-green-500/20 text-green-300 border-green-500/30 text-[10px]",children:"密钥 ✓"}):i.jsx(Be,{variant:"secondary",className:"bg-gray-500/20 text-gray-500 border-gray-500/30 text-[10px]",children:"用默认密钥"})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑密钥",onClick:()=>{xr(A.id),ai(A.ckbApiKey||"")},children:i.jsx(nA,{className:"w-3 h-3"})}),i.jsx(ne,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await ss(`/api/db/persons?personId=${A.id}`),ft()},children:i.jsx(Wn,{className:"w-3 h-3"})})]})]}),ha===A.id&&i.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[i.jsx(ce,{className:"bg-[#0d1f35] border-gray-600 text-white h-7 text-xs flex-1",placeholder:"输入存客宝密钥,留空则用默认",value:Gr,onChange:ee=>ai(ee.target.value),onKeyDown:ee=>{ee.key==="Escape"&&xr(null)},autoFocus:!0}),i.jsx(ne,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-7 px-2",onClick:async()=>{await mt("/api/db/persons",{personId:A.id,name:A.name,label:A.label,ckbApiKey:Gr}),xr(null),ft()},children:i.jsx(Uc,{className:"w-3 h-3"})}),i.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-400 h-7 px-2",onClick:()=>xr(null),children:i.jsx(Wn,{className:"w-3 h-3"})})]})]},A.id)),hn.length===0&&i.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"pb-3",children:[i.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(xM,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),i.jsxs(Re,{className:"space-y-3",children:[i.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"标签ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",placeholder:"如 team01",value:ut.tagId,onChange:A=>Ar({...ut,tagId:A.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"显示文字"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 神仙团队",value:ut.label,onChange:A=>Ar({...ut,label:A.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"类型"}),i.jsxs(sc,{value:ut.type,onValueChange:A=>Ar({...ut,type:A}),children:[i.jsx(Bo,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",children:i.jsx(ic,{})}),i.jsxs(Vo,{children:[i.jsx(bs,{value:"url",children:"网页链接"}),i.jsx(bs,{value:"miniprogram",children:"小程序"}),i.jsx(bs,{value:"ckb",children:"存客宝"})]})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:ut.type==="url"?"URL地址":ut.type==="ckb"?"存客宝计划URL":"小程序AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:ut.type==="url"?"https://...":ut.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"wx...",value:ut.type==="url"||ut.type==="ckb"?ut.url:ut.appId,onChange:A=>{ut.type==="url"||ut.type==="ckb"?Ar({...ut,url:A.target.value}):Ar({...ut,appId:A.target.value})}})]}),ut.type==="miniprogram"&&i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"页面路径"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"pages/index/index",value:ut.pagePath,onChange:A=>Ar({...ut,pagePath:A.target.value})})]}),i.jsxs(ne,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:async()=>{if(!ut.tagId||!ut.label){he.error("标签ID和显示文字必填");return}const A={...ut};A.type==="miniprogram"&&A.appId&&(A.url=`weixin://dl/business/?appid=${A.appId}&path=${A.pagePath}`),await mt("/api/db/link-tags",A),Ar({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),Qt()},children:[i.jsx(Ft,{className:"w-3 h-3 mr-1"}),"添加"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[fs.map(A=>i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsxs("span",{className:"text-amber-400 font-bold text-base",children:["#",A.label]}),i.jsx(Be,{variant:"secondary",className:`text-[10px] ${A.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":"bg-gray-700 text-gray-300"}`,children:A.type==="url"?"网页":A.type==="ckb"?"存客宝":"小程序"}),i.jsxs("a",{href:A.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[250px] hover:underline flex items-center gap-1",children:[A.url," ",i.jsx(ti,{className:"w-3 h-3 shrink-0"})]})]}),i.jsx(ne,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await ss(`/api/db/link-tags?tagId=${A.id}`),Qt()},children:i.jsx(Wn,{className:"w-3 h-3"})})]},A.id)),fs.length===0&&i.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"pb-3",children:[i.jsxs(Ze,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(uu,{className:"w-4 h-4 text-green-400"}),"存客宝绑定"]}),i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),i.jsxs(Re,{className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"存客宝 API 地址"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"https://ckbapi.quwanzhi.com",defaultValue:"https://ckbapi.quwanzhi.com",readOnly:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"绑定计划"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"创业实验-内容引流",defaultValue:"创业实验-内容引流",readOnly:!0})]})]}),i.jsxs("p",{className:"text-xs text-gray-500",children:["具体存客宝场景配置与接口测试请前往 ",i.jsx("button",{className:"text-[#38bdac] hover:underline",onClick:()=>window.open("/match","_blank"),children:"找伙伴 → 存客宝工作台"})]})]})]})]})]})]})}const Ys={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function cN(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&"label"in e&&"value"in e?{label:String(e.label),value:String(e.value)}:{label:"",value:""}).filter(e=>e.label||e.value):Ys.stats}function dN(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):Ys.highlights}function GB(){const[t,e]=b.useState(Ys),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{Fe("/api/admin/author-settings").then(k=>{const E=k==null?void 0:k.data;E&&typeof E=="object"&&e({name:String(E.name??Ys.name),avatar:String(E.avatar??Ys.avatar),avatarImg:String(E.avatarImg??""),title:String(E.title??Ys.title),bio:String(E.bio??Ys.bio),stats:cN(E.stats).length?cN(E.stats):Ys.stats,highlights:dN(E.highlights).length?dN(E.highlights):Ys.highlights})}).catch(console.error).finally(()=>r(!1))},[]);const h=async()=>{a(!0);try{const k={name:t.name,avatar:t.avatar||"K",avatarImg:t.avatarImg,title:t.title,bio:t.bio,stats:t.stats.filter(T=>T.label||T.value),highlights:t.highlights.filter(Boolean)},E=await mt("/api/admin/author-settings",k);if(!E||E.success===!1){he.error("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.error:""));return}a(!1);const C=document.createElement("div");C.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",C.textContent="作者设置已保存",document.body.appendChild(C),setTimeout(()=>C.remove(),2e3)}catch(k){console.error(k),he.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{a(!1)}},f=async k=>{var C;const E=(C=k.target.files)==null?void 0:C[0];if(E){c(!0);try{const T=new FormData;T.append("file",E),T.append("folder","avatars");const O=Mx(),B={};O&&(B.Authorization=`Bearer ${O}`);const P=await(await fetch(Ha("/api/upload"),{method:"POST",body:T,credentials:"include",headers:B})).json();P!=null&&P.success&&(P!=null&&P.url)?e(I=>({...I,avatarImg:P.url})):he.error("上传失败: "+((P==null?void 0:P.error)||"未知错误"))}catch(T){console.error(T),he.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(E=>({...E,stats:E.stats.filter((C,T)=>T!==k)})),y=(k,E,C)=>e(T=>({...T,stats:T.stats.map((O,B)=>B===k?{...O,[E]:C}:O)})),v=()=>e(k=>({...k,highlights:[...k.highlights,""]})),j=k=>e(E=>({...E,highlights:E.highlights.filter((C,T)=>T!==k)})),w=(k,E)=>e(C=>({...C,highlights:C.highlights.map((T,O)=>O===k?E:T)}));return n?i.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(qo,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),i.jsxs(ne,{onClick:h,disabled:s||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),s?"保存中...":"保存"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"flex items-center gap-2 text-white",children:[i.jsx(qo,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),i.jsx(zt,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"姓名"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(E=>({...E,name:k.target.value})),placeholder:"卡若"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(E=>({...E,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(FN,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(E=>({...E,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),i.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),i.jsxs(ne,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:o,onClick:()=>{var k;return(k=u.current)==null?void 0:k.click()},children:[i.jsx(Yu,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&i.jsx("div",{className:"mt-2",children:i.jsx("img",{src:t.avatarImg.startsWith("http")?t.avatarImg:Ha(t.avatarImg),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"头衔"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(E=>({...E,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"个人简介"}),i.jsx(Jc,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(E=>({...E,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsx(Ze,{className:"text-white",children:"统计数据"}),i.jsx(zt,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),i.jsxs(Re,{className:"space-y-3",children:[t.stats.map((k,E)=>i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:C=>y(E,"label",C.target.value),placeholder:"标签"}),i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>y(E,"value",C.target.value),placeholder:"数值"}),i.jsx(ne,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(E),children:i.jsx(Wn,{className:"w-4 h-4"})})]},E)),i.jsxs(ne,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsx(Ze,{className:"text-white",children:"亮点标签"}),i.jsx(zt,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),i.jsxs(Re,{className:"space-y-3",children:[t.highlights.map((k,E)=>i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:C=>w(E,C.target.value),placeholder:"5年私域运营经验"}),i.jsx(ne,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>j(E),children:i.jsx(Wn,{className:"w-4 h-4"})})]},E)),i.jsxs(ne,{variant:"outline",size:"sm",onClick:v,className:"border-gray-600 text-gray-400",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function JB(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o]=b.useState(10),[c,u]=b.useState(0),[h,f]=b.useState(""),m=Wx(h,300),[g,y]=b.useState(!0),[v,j]=b.useState(null),[w,k]=b.useState(!1),[E,C]=b.useState(null),[T,O]=b.useState(""),[B,R]=b.useState(""),[P,I]=b.useState(""),[L,X]=b.useState("admin"),[Z,Y]=b.useState("active"),[W,D]=b.useState(!1);async function $(){var H;y(!0),j(null);try{const de=new URLSearchParams({page:String(s),pageSize:String(o)});m.trim()&&de.set("search",m.trim());const K=await Fe(`/api/admin/users?${de}`);K!=null&&K.success?(e(K.records||[]),r(K.total??0),u(K.totalPages??0)):j(K.error||"加载失败")}catch(de){const K=de;j(K.status===403?"无权限访问":((H=K==null?void 0:K.data)==null?void 0:H.error)||"加载失败"),e([])}finally{y(!1)}}b.useEffect(()=>{$()},[s,o,m]);const ae=()=>{C(null),O(""),R(""),I(""),X("admin"),Y("active"),k(!0)},_=H=>{C(H),O(H.username),R(""),I(H.name||""),X(H.role==="super_admin"?"super_admin":"admin"),Y(H.status==="disabled"?"disabled":"active"),k(!0)},se=async()=>{var H;if(!T.trim()){j("用户名不能为空");return}if(!E&&!B){j("新建时密码必填,至少 6 位");return}if(B&&B.length<6){j("密码至少 6 位");return}j(null),D(!0);try{if(E){const de=await _t("/api/admin/users",{id:E.id,password:B||void 0,name:P.trim(),role:L,status:Z});de!=null&&de.success?(k(!1),$()):j((de==null?void 0:de.error)||"保存失败")}else{const de=await mt("/api/admin/users",{username:T.trim(),password:B,name:P.trim(),role:L});de!=null&&de.success?(k(!1),$()):j((de==null?void 0:de.error)||"保存失败")}}catch(de){const K=de;j(((H=K==null?void 0:K.data)==null?void 0:H.error)||"保存失败")}finally{D(!1)}},q=async H=>{var de;if(confirm("确定删除该管理员?"))try{const K=await ss(`/api/admin/users?id=${H}`);K!=null&&K.success?$():j((K==null?void 0:K.error)||"删除失败")}catch(K){const fe=K;j(((de=fe==null?void 0:fe.data)==null?void 0:de.error)||"删除失败")}},z=H=>{if(!H)return"-";try{const de=new Date(H);return isNaN(de.getTime())?H:de.toLocaleString("zh-CN")}catch{return H}};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Ex,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ce,{placeholder:"搜索用户名/昵称",value:h,onChange:H=>f(H.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),i.jsx(ne,{variant:"outline",size:"sm",onClick:$,disabled:g,className:"border-gray-600 text-gray-300",children:i.jsx(qe,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),i.jsxs(ne,{onClick:ae,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),v&&i.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[i.jsx("span",{children:v}),i.jsx("button",{type:"button",onClick:()=>j(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-0",children:g?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(i.Fragment,{children:[i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"ID"}),i.jsx(Te,{className:"text-gray-400",children:"用户名"}),i.jsx(Te,{className:"text-gray-400",children:"昵称"}),i.jsx(Te,{className:"text-gray-400",children:"角色"}),i.jsx(Te,{className:"text-gray-400",children:"状态"}),i.jsx(Te,{className:"text-gray-400",children:"创建时间"}),i.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(mr,{children:[t.map(H=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(we,{className:"text-gray-300",children:H.id}),i.jsx(we,{className:"text-white font-medium",children:H.username}),i.jsx(we,{className:"text-gray-400",children:H.name||"-"}),i.jsx(we,{children:i.jsx(Be,{variant:"outline",className:H.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:H.role==="super_admin"?"超级管理员":"管理员"})}),i.jsx(we,{children:i.jsx(Be,{variant:"outline",className:H.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:H.status==="active"?"正常":"已禁用"})}),i.jsx(we,{className:"text-gray-500 text-sm",children:z(H.createdAt)}),i.jsxs(we,{className:"text-right",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>_(H),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(kt,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>q(H.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(wn,{className:"w-4 h-4"})})]})]},H.id)),t.length===0&&!g&&i.jsx(ct,{children:i.jsx(we,{colSpan:7,className:"text-center py-12 text-gray-500",children:v==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&i.jsx("div",{className:"p-4 border-t border-gray-700/50",children:i.jsx(ls,{page:s,pageSize:o,total:n,totalPages:c,onPageChange:a})})]})})}),i.jsx(Zt,{open:w,onOpenChange:k,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[i.jsx(en,{children:i.jsx(tn,{className:"text-white",children:E?"编辑管理员":"新增管理员"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"用户名"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:T,onChange:H=>O(H.target.value),disabled:!!E}),E&&i.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:E?"新密码(留空不改)":"密码"}),i.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:E?"留空表示不修改":"至少 6 位",value:B,onChange:H=>R(H.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"昵称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:P,onChange:H=>I(H.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"角色"}),i.jsxs("select",{value:L,onChange:H=>X(H.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[i.jsx("option",{value:"admin",children:"管理员"}),i.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),E&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"状态"}),i.jsxs("select",{value:Z,onChange:H=>Y(H.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[i.jsx("option",{value:"active",children:"正常"}),i.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),i.jsxs(Nn,{children:[i.jsxs(ne,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(Wn,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(ne,{onClick:se,disabled:W,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),W?"保存中...":"保存"]})]})]})})]})}const YB={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},QB={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},XB={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...QB}},ZB={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},eV=["system","author","admin"];function tV(){const[t,e]=IN(),n=t.get("tab")??"system",r=eV.includes(n)?n:"system",[s,a]=b.useState(XB),[o,c]=b.useState(ZB),[u,h]=b.useState(YB),[f,m]=b.useState(!1),[g,y]=b.useState(!0),[v,j]=b.useState(!1),[w,k]=b.useState(""),[E,C]=b.useState(""),[T,O]=b.useState(!1),[B,R]=b.useState(!1),P=(Y,W,D=!1)=>{k(Y),C(W),O(D),j(!0)};b.useEffect(()=>{(async()=>{try{const W=await Fe("/api/admin/settings");if(!W||W.success===!1)return;if(W.featureConfig&&Object.keys(W.featureConfig).length&&c(D=>({...D,...W.featureConfig})),W.mpConfig&&typeof W.mpConfig=="object"&&h(D=>({...D,...W.mpConfig})),W.siteSettings&&typeof W.siteSettings=="object"){const D=W.siteSettings;a($=>({...$,...typeof D.sectionPrice=="number"&&{sectionPrice:D.sectionPrice},...typeof D.baseBookPrice=="number"&&{baseBookPrice:D.baseBookPrice},...typeof D.distributorShare=="number"&&{distributorShare:D.distributorShare},...D.authorInfo&&typeof D.authorInfo=="object"&&{authorInfo:{...$.authorInfo,...D.authorInfo}}}))}}catch(W){console.error("Load settings error:",W)}finally{y(!1)}})()},[]);const I=async(Y,W)=>{R(!0);try{const D=await mt("/api/admin/settings",{featureConfig:Y});if(!D||D.success===!1){W(),P("保存失败",(D==null?void 0:D.error)??"未知错误",!0);return}P("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(D){console.error("Save feature config error:",D),W(),P("保存失败",D instanceof Error?D.message:String(D),!0)}finally{R(!1)}},L=(Y,W)=>{const D=o,$={...D,[Y]:W};c($),I($,()=>c(D))},X=async()=>{m(!0);try{const Y=await mt("/api/admin/settings",{featureConfig:o,siteSettings:{sectionPrice:s.sectionPrice,baseBookPrice:s.baseBookPrice,distributorShare:s.distributorShare,authorInfo:s.authorInfo},mpConfig:{...u,appId:u.appId||"",withdrawSubscribeTmplId:u.withdrawSubscribeTmplId||"",mchId:u.mchId||"",minWithdraw:typeof u.minWithdraw=="number"?u.minWithdraw:10}});if(!Y||Y.success===!1){P("保存失败",(Y==null?void 0:Y.error)??"未知错误",!0);return}P("已保存","设置已保存成功。")}catch(Y){console.error("Save settings error:",Y),P("保存失败",Y instanceof Error?Y.message:String(Y),!0)}finally{m(!1)}},Z=Y=>{e(Y==="system"?{}:{tab:Y})};return g?i.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-6",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),r==="system"&&i.jsxs(ne,{onClick:X,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),f?"保存中...":"保存设置"]})]}),i.jsxs(Gc,{value:r,onValueChange:Z,className:"w-full",children:[i.jsxs(ul,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[i.jsxs(nn,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[i.jsx(_a,{className:"w-4 h-4 mr-2"}),"系统设置"]}),i.jsxs(nn,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[i.jsx(gm,{className:"w-4 h-4 mr-2"}),"作者详情"]}),i.jsxs(nn,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[i.jsx(Ex,{className:"w-4 h-4 mr-2"}),"管理员"]})]}),i.jsx(rn,{value:"system",className:"mt-0",children:i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(gm,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),i.jsx(zt,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(gm,{className:"w-3 h-3"}),"主理人名称"]}),i.jsx(ce,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:s.authorInfo.name??"",onChange:Y=>a(W=>({...W,authorInfo:{...W.authorInfo,name:Y.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(Gu,{className:"w-3 h-3"}),"开播日期"]}),i.jsx(ce,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:s.authorInfo.startDate??"",onChange:Y=>a(W=>({...W,authorInfo:{...W.authorInfo,startDate:Y.target.value}}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(Gu,{className:"w-3 h-3"}),"直播时间"]}),i.jsx(ce,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:s.authorInfo.liveTime??"",onChange:Y=>a(W=>({...W,authorInfo:{...W.authorInfo,liveTime:Y.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(BN,{className:"w-3 h-3"}),"直播平台"]}),i.jsx(ce,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:s.authorInfo.platform??"",onChange:Y=>a(W=>({...W,authorInfo:{...W.authorInfo,platform:Y.target.value}}))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[i.jsx(Hr,{className:"w-3 h-3"}),"简介描述"]}),i.jsx(ce,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:s.authorInfo.description??"",onChange:Y=>a(W=>({...W,authorInfo:{...W.authorInfo,description:Y.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),i.jsx(Jc,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:s.authorInfo.bio??"",onChange:Y=>a(W=>({...W,authorInfo:{...W.authorInfo,bio:Y.target.value}}))})]}),i.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[i.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(s.authorInfo.name??"K").charAt(0)}),i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-semibold",children:s.authorInfo.name}),i.jsx("p",{className:"text-gray-400 text-xs",children:s.authorInfo.description}),i.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",s.authorInfo.liveTime," · ",s.authorInfo.platform]})]})]})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Ju,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),i.jsx(Re,{className:"space-y-4",children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"单节价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:s.sectionPrice,onChange:Y=>a(W=>({...W,sectionPrice:Number.parseFloat(Y.target.value)||1}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"整本价格 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:s.baseBookPrice,onChange:Y=>a(W=>({...W,baseBookPrice:Number.parseFloat(Y.target.value)||9.9}))})]})]})})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Tc,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),i.jsx(zt,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),i.jsx(Re,{className:"space-y-4",children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"小程序 AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:u.appId??"",onChange:Y=>h(W=>({...W,appId:Y.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"提现订阅模板 ID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:u.withdrawSubscribeTmplId??"",onChange:Y=>h(W=>({...W,withdrawSubscribeTmplId:Y.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"微信支付商户号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:u.mchId??"",onChange:Y=>h(W=>({...W,mchId:Y.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"最低提现金额 (元)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:u.minWithdraw??10,onChange:Y=>h(W=>({...W,minWithdraw:Number.parseFloat(Y.target.value)||10}))})]})]})})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(_a,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),i.jsx(zt,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ln,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),i.jsx(Nt,{id:"match-enabled",checked:o.matchEnabled,disabled:B,onCheckedChange:Y=>L("matchEnabled",Y)})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(oM,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),i.jsx(Nt,{id:"referral-enabled",checked:o.referralEnabled,disabled:B,onCheckedChange:Y=>L("referralEnabled",Y)})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Hr,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),i.jsx(Nt,{id:"search-enabled",checked:o.searchEnabled,disabled:B,onCheckedChange:Y=>L("searchEnabled",Y)})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(_a,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx(te,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),i.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),i.jsx(Nt,{id:"about-enabled",checked:o.aboutEnabled,disabled:B,onCheckedChange:Y=>L("aboutEnabled",Y)})]})]}),i.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:i.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]})}),i.jsx(rn,{value:"author",className:"mt-0",children:i.jsx(GB,{})}),i.jsx(rn,{value:"admin",className:"mt-0",children:i.jsx(JB,{})})]}),i.jsx(Zt,{open:v,onOpenChange:j,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[i.jsxs(en,{children:[i.jsx(tn,{className:T?"text-red-400":"text-[#38bdac]",children:w}),i.jsx(RP,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:E})]}),i.jsx(Nn,{className:"mt-4",children:i.jsx(ne,{onClick:()=>j(!1),className:T?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const uN={wechat:{enabled:!0,qrCode:"/images/wechat-pay.png",account:"卡若",websiteAppId:"",merchantId:"",groupQrCode:"/images/party-group-qr.png"},alipay:{enabled:!0,qrCode:"/images/alipay.png",account:"卡若",partnerId:"",securityKey:""},usdt:{enabled:!1,network:"TRC20",address:"",exchangeRate:7.2},paypal:{enabled:!1,email:"",exchangeRate:7.2}};function nV(){const[t,e]=b.useState(!1),[n,r]=b.useState(uN),[s,a]=b.useState(""),o=async()=>{e(!0);try{const k=await Fe("/api/config");k!=null&&k.paymentMethods&&r({...uN,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};b.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await mt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),he.success("配置已保存!")}catch(k){console.error("保存失败:",k),he.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,E)=>{navigator.clipboard.writeText(k),a(E),setTimeout(()=>a(""),2e3)},h=(k,E)=>{r(C=>({...C,wechat:{...C.wechat,[k]:E}}))},f=(k,E)=>{r(C=>({...C,alipay:{...C.alipay,[k]:E}}))},m=(k,E)=>{r(C=>({...C,usdt:{...C.usdt,[k]:E}}))},g=(k,E)=>{r(C=>({...C,paypal:{...C.paypal,[k]:E}}))},y=n.wechat,v=n.alipay,j=n.usdt,w=n.paypal;return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),i.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(ne,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),i.jsxs(ne,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),i.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(LN,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),i.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[i.jsx("li",{children:"打开微信,进入目标微信群"}),i.jsx("li",{children:'点击右上角"..." → "群二维码"'}),i.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),i.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),i.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),i.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),i.jsxs(Gc,{defaultValue:"wechat",className:"space-y-6",children:[i.jsxs(ul,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[i.jsxs(nn,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[i.jsx(Tc,{className:"w-4 h-4 mr-2"}),"微信"]}),i.jsxs(nn,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[i.jsx(Pb,{className:"w-4 h-4 mr-2"}),"支付宝"]}),i.jsxs(nn,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[i.jsx(Ab,{className:"w-4 h-4 mr-2"}),"USDT"]}),i.jsxs(nn,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[i.jsx(vg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),i.jsx(rn,{value:"wechat",className:"space-y-4",children:i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(Ze,{className:"text-[#07C160] flex items-center gap-2",children:[i.jsx(Tc,{className:"w-5 h-5"}),"微信支付配置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),i.jsx(Nt,{checked:!!y.enabled,onCheckedChange:k=>h("enabled",k)})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"网站AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"商户号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),i.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[i.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[i.jsx(ti,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"微信收款码/支付链接"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(y.qrCode??""),onChange:k=>h("qrCode",k.target.value)}),i.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),i.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[i.jsx(te,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),i.jsx(ce,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(y.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),i.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),i.jsx(rn,{value:"alipay",className:"space-y-4",children:i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(Ze,{className:"text-[#1677FF] flex items-center gap-2",children:[i.jsx(Pb,{className:"w-5 h-5"}),"支付宝配置"]}),i.jsx(zt,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),i.jsx(Nt,{checked:!!v.enabled,onCheckedChange:k=>f("enabled",k)})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"合作者身份 (PID)"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),i.jsx(ne,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(v.partnerId??""),"pid"),children:s==="pid"?i.jsx(Uc,{className:"w-4 h-4 text-green-500"}):i.jsx(zN,{className:"w-4 h-4 text-gray-400"})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"安全校验码 (Key)"}),i.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),i.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[i.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[i.jsx(ti,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(v.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),i.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),i.jsx(rn,{value:"usdt",className:"space-y-4",children:i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(Ze,{className:"text-[#26A17B] flex items-center gap-2",children:[i.jsx(Ab,{className:"w-5 h-5"}),"USDT配置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),i.jsx(Nt,{checked:!!j.enabled,onCheckedChange:k=>m("enabled",k)})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"网络类型"}),i.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(j.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[i.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),i.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),i.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"收款地址"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(j.address??""),onChange:k=>m("address",k.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),i.jsx(rn,{value:"paypal",className:"space-y-4",children:i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(Ze,{className:"text-[#169BD7] flex items-center gap-2",children:[i.jsx(vg,{className:"w-5 h-5"}),"PayPal配置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),i.jsx(Nt,{checked:!!w.enabled,onCheckedChange:k=>g("enabled",k)})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"PayPal邮箱"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(w.email??""),onChange:k=>g("email",k.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(w.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const rV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},sV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},iV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function aV(){const[t,e]=b.useState({siteConfig:{...rV},menuConfig:{...sV},pageConfig:{...iV}}),[n,r]=b.useState(!1),[s,a]=b.useState(!1);b.useEffect(()=>{Fe("/api/config").then(f=>{f!=null&&f.siteConfig&&e(m=>({...m,siteConfig:{...m.siteConfig,...f.siteConfig}})),f!=null&&f.menuConfig&&e(m=>({...m,menuConfig:{...m.menuConfig,...f.menuConfig}})),f!=null&&f.pageConfig&&e(m=>({...m,pageConfig:{...m.pageConfig,...f.pageConfig}}))}).catch(console.error)},[]);const o=async()=>{a(!0);try{await mt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await mt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await mt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),he.success("配置已保存")}catch(f){console.error(f),he.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{a(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),i.jsxs(ne,{onClick:o,disabled:s,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),s?"保存中...":n?"已保存":"保存设置"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(vg,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),i.jsx(zt,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),i.jsx(ce,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteName??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteName:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),i.jsx(ce,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteTitle??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteTitle:f.target.value}}))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),i.jsx(ce,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteDescription??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteDescription:f.target.value}}))})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),i.jsx(ce,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:c.logo??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,logo:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),i.jsx(ce,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:c.favicon??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,favicon:f.target.value}}))})]})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(ZM,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),i.jsx(zt,{className:"text-gray-400",children:"配置网站主题色"})]}),i.jsx(Re,{children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("div",{className:"space-y-2 flex-1",children:[i.jsx(te,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(ce,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))})]})]}),i.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:c.primaryColor??"#00CED1"},children:"预览"})]})})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(KM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),i.jsx(zt,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),i.jsx(Re,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>i.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[i.jsx(Nt,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,enabled:g}}}))}),i.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,label:g.target.value}}}))})]}),i.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(sM,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"首页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeTitle:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"首页副标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeSubtitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeSubtitle:f.target.value}}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目录页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.chaptersTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,chaptersTitle:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"匹配页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.matchTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,matchTitle:f.target.value}}))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"我的页标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.myTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,myTitle:f.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"关于作者标题"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function oV(){const[t,e]=b.useState(""),[n,r]=b.useState(""),[s,a]=b.useState(""),[o,c]=b.useState({}),u=async()=>{var y,v,j,w;try{const k=await Fe("/api/config"),E=(v=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:v.urls;Array.isArray(E)&&e(E.join(` +`));const C=(w=(j=k==null?void 0:k.paymentMethods)==null?void 0:j.wechat)==null?void 0:w.groupQrCode;C&&r(C),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};b.useEffect(()=>{u()},[]);const h=(y,v)=>{navigator.clipboard.writeText(y),a(v),setTimeout(()=>a(""),2e3)},f=async()=>{try{const y=t.split(` +`).map(j=>j.trim()).filter(Boolean),v=[...o.liveQRCodes||[]];v[0]?v[0].urls=y:v.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await mt("/api/db/config",{key:"live_qr_codes",value:v,description:"群活码配置"}),he.success("群活码配置已保存!"),await u()}catch(y){console.error(y),he.error("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await mt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),he.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(v){console.error(v),he.error("保存失败: "+(v instanceof Error?v.message:String(v)))}},g=()=>{n?window.open(n,"_blank"):he.error("请先配置微信群链接")};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"mb-8",children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),i.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(LN,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),i.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[i.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),i.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[i.jsx("li",{children:"访问草料二维码创建活码"}),i.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),i.jsx("li",{children:"复制生成的短链接填入下方配置"}),i.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),i.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),i.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[i.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),i.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),i.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),i.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-[#07C160] flex items-center gap-2",children:[i.jsx(Ib,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),i.jsx(zt,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(bg,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:n,onChange:y=>r(y.target.value)}),i.jsx(ne,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:s==="group"?i.jsx(Uc,{className:"w-4 h-4 text-green-500"}):i.jsx(zN,{className:"w-4 h-4 text-gray-400"})})]}),i.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[i.jsx(ti,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(ne,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[i.jsx(Yu,{className:"w-4 h-4 mr-2"}),"保存配置"]}),i.jsxs(ne,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[i.jsx(ti,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Ib,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),i.jsx(zt,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),i.jsxs(Re,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(bg,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),i.jsx(Jc,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:y=>e(y.target.value)}),i.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),i.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[i.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),i.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` +`).filter(Boolean).length," 个"]})]}),i.jsxs(ne,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Yu,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),i.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[i.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),i.jsxs("div",{className:"space-y-3 text-sm",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),i.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),i.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const hN={matchTypes:[{id:"partner",label:"创业合伙",matchLabel:"创业伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10}},lV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function cV(){const[t,e]=b.useState(hN),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(!1),[u,h]=b.useState(null),[f,m]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const C=await Fe("/api/db/config/full?key=match_config"),T=(C==null?void 0:C.data)??(C==null?void 0:C.config);T&&e({...hN,...T})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};b.useEffect(()=>{g()},[]);const y=async()=>{a(!0);try{const C=await mt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?he.success("配置保存成功!"):he.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),he.error("保存失败")}finally{a(!1)}},v=C=>{h(C),m({id:C.id,label:C.label,matchLabel:C.matchLabel,icon:C.icon,matchFromDB:C.matchFromDB,showJoinAfterMatch:C.showJoinAfterMatch,price:C.price,enabled:C.enabled}),c(!0)},j=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},w=()=>{if(!f.id||!f.label){he.error("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const T=C.findIndex(O=>O.id===u.id);T!==-1&&(C[T]={...f})}else{if(C.some(T=>T.id===f.id)){he.error("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(T=>T.id!==C)})},E=C=>{e({...t,matchTypes:t.matchTypes.map(T=>T.id===C?{...T,enabled:!T.enabled}:T)})};return i.jsxs("div",{className:"p-8 w-full space-y-6",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(_a,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(ne,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),i.jsxs(ne,{onClick:y,disabled:s,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),s?"保存中...":"保存配置"]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Fi,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),i.jsxs(Re,{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日免费匹配次数"}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:C=>e({...t,freeMatchLimit:parseInt(C.target.value,10)||0})}),i.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:C=>e({...t,matchPrice:parseFloat(C.target.value)||1})}),i.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),i.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:C=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(C.target.value,10)||10}})}),i.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),i.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:t.settings.enableFreeMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enableFreeMatches:C}})}),i.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),i.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Ln,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),i.jsx(zt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),i.jsxs(ne,{onClick:j,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),i.jsx(Re,{children:i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"图标"}),i.jsx(Te,{className:"text-gray-400",children:"类型ID"}),i.jsx(Te,{className:"text-gray-400",children:"显示名称"}),i.jsx(Te,{className:"text-gray-400",children:"匹配标签"}),i.jsx(Te,{className:"text-gray-400",children:"价格"}),i.jsx(Te,{className:"text-gray-400",children:"数据库匹配"}),i.jsx(Te,{className:"text-gray-400",children:"状态"}),i.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsx(mr,{children:t.matchTypes.map(C=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(we,{children:i.jsx("span",{className:"text-2xl",children:C.icon})}),i.jsx(we,{className:"font-mono text-gray-300",children:C.id}),i.jsx(we,{className:"text-white font-medium",children:C.label}),i.jsx(we,{className:"text-gray-300",children:C.matchLabel}),i.jsx(we,{children:i.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),i.jsx(we,{children:C.matchFromDB?i.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):i.jsx(Be,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),i.jsx(we,{children:i.jsx(Nt,{checked:C.enabled,onCheckedChange:()=>E(C.id)})}),i.jsx(we,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(kt,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>k(C.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(wn,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),i.jsx(Zt,{open:o,onOpenChange:c,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[u?i.jsx(kt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:C=>m({...f,id:C.target.value}),disabled:!!u})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"图标"}),i.jsx("div",{className:"flex gap-1 flex-wrap",children:lV.map(C=>i.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===C?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:C}),children:C},C))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"显示名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:C=>m({...f,label:C.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"匹配标签"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:C=>m({...f,matchLabel:C.target.value})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:C=>m({...f,price:parseFloat(C.target.value)||1})})]}),i.jsxs("div",{className:"flex gap-6 pt-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:f.matchFromDB,onCheckedChange:C=>m({...f,matchFromDB:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:f.showJoinAfterMatch,onCheckedChange:C=>m({...f,showJoinAfterMatch:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsxs(ne,{onClick:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const fN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function dV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null);async function v(){m(!0),y(null);try{const w=new URLSearchParams({page:String(s),pageSize:String(o)});u&&w.set("matchType",u);const k=await Fe(`/api/db/match-records?${w}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(w){console.error("加载匹配记录失败",w),y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{v()},[s,u]);const j=Math.ceil(n/o)||1;return i.jsxs("div",{className:"p-8 w-full",children:[g&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:g}),i.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),i.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",n," 条记录"]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("select",{value:u,onChange:w=>{h(w.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[i.jsx("option",{value:"",children:"全部类型"}),Object.entries(fN).map(([w,k])=>i.jsx("option",{value:w,children:k},w))]}),i.jsxs("button",{type:"button",onClick:v,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[i.jsx(qe,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Re,{className:"p-0",children:f?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"发起人"}),i.jsx(Te,{className:"text-gray-400",children:"匹配到"}),i.jsx(Te,{className:"text-gray-400",children:"类型"}),i.jsx(Te,{className:"text-gray-400",children:"联系方式"}),i.jsx(Te,{className:"text-gray-400",children:"匹配时间"})]})}),i.jsxs(mr,{children:[t.map(w=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(we,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[w.userAvatar?i.jsx("img",{src:w.userAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,i.jsx("span",{className:w.userAvatar?"hidden":"",children:(w.userNickname||w.userId||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white",children:w.userNickname||w.userId}),i.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.userId.slice(0,16),"..."]})]})]})}),i.jsx(we,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[w.matchedUserAvatar?i.jsx("img",{src:w.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,i.jsx("span",{className:w.matchedUserAvatar?"hidden":"",children:(w.matchedNickname||w.matchedUserId||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white",children:w.matchedNickname||w.matchedUserId}),i.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.matchedUserId.slice(0,16),"..."]})]})]})}),i.jsx(we,{children:i.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:fN[w.matchType]||w.matchType})}),i.jsxs(we,{className:"text-gray-400 text-sm",children:[w.phone&&i.jsxs("div",{children:["📱 ",w.phone]}),w.wechatId&&i.jsxs("div",{children:["💬 ",w.wechatId]}),!w.phone&&!w.wechatId&&"-"]}),i.jsx(we,{className:"text-gray-400",children:w.createdAt?new Date(w.createdAt).toLocaleString():"-"})]},w.id)),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),i.jsx(ls,{page:s,totalPages:j,total:n,pageSize:o,onPageChange:a,onPageSizeChange:w=>{c(w),a(1)}})]})})})]})}function uV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(null),[u,h]=b.useState(""),[f,m]=b.useState(0),[g,y]=b.useState(!1);async function v(){r(!0);try{const C=await Fe("/api/db/vip-roles");C!=null&&C.success&&C.data&&e(C.data)}catch(C){console.error("Load roles error:",C)}finally{r(!1)}}b.useEffect(()=>{v()},[]);const j=()=>{c(null),h(""),m(t.length>0?Math.max(...t.map(C=>C.sort))+1:0),a(!0)},w=C=>{c(C),h(C.name),m(C.sort),a(!0)},k=async()=>{if(!u.trim()){he.error("角色名称不能为空");return}y(!0);try{if(o){const C=await _t("/api/db/vip-roles",{id:o.id,name:u.trim(),sort:f});C!=null&&C.success?(a(!1),v()):he.error("更新失败: "+(C==null?void 0:C.error))}else{const C=await mt("/api/db/vip-roles",{name:u.trim(),sort:f});C!=null&&C.success?(a(!1),v()):he.error("新增失败: "+(C==null?void 0:C.error))}}catch(C){console.error("Save error:",C),he.error("保存失败")}finally{y(!1)}},E=async C=>{if(confirm("确定删除该角色?已设置该角色的 VIP 用户将保留角色名称。"))try{const T=await ss(`/api/db/vip-roles?id=${C}`);T!=null&&T.success?v():he.error("删除失败: "+(T==null?void 0:T.error))}catch(T){console.error("Delete error:",T),he.error("删除失败")}};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Pa,{className:"w-5 h-5 text-amber-400"}),"VIP 角色管理"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"超级个体固定角色,在「设置 VIP」时可选择或手动填写"})]}),i.jsxs(ne,{onClick:j,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"新增角色"]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"ID"}),i.jsx(Te,{className:"text-gray-400",children:"角色名称"}),i.jsx(Te,{className:"text-gray-400",children:"排序"}),i.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(mr,{children:[t.map(C=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(we,{className:"text-gray-300",children:C.id}),i.jsx(we,{className:"text-white",children:C.name}),i.jsx(we,{className:"text-gray-400",children:C.sort}),i.jsxs(we,{className:"text-right",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>w(C),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(kt,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>E(C.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(wn,{className:"w-4 h-4"})})]})]},C.id)),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无角色,点击「新增角色」添加"})})]})]})})}),i.jsx(Zt,{open:s,onOpenChange:a,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[i.jsx(en,{children:i.jsx(tn,{className:"text-white",children:o?"编辑角色":"新增角色"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"角色名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创始人、投资人",value:u,onChange:C=>h(C.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"排序(下拉展示顺序,越小越前)"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f,onChange:C=>m(parseInt(C.target.value,10)||0)})]})]}),i.jsxs(Nn,{children:[i.jsxs(ne,{variant:"outline",onClick:()=>a(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(Wn,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(ne,{onClick:k,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存"]})]})]})})]})}function SE(t){const[e,n]=b.useState([]),[r,s]=b.useState(!0),[a,o]=b.useState(!1),[c,u]=b.useState(null),[h,f]=b.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[m,g]=b.useState(!1),[y,v]=b.useState(!1),j=b.useRef(null),w=async P=>{var L;const I=(L=P.target.files)==null?void 0:L[0];if(I){v(!0);try{const X=new FormData;X.append("file",I),X.append("folder","mentors");const Z=Mx(),Y={};Z&&(Y.Authorization=`Bearer ${Z}`);const D=await(await fetch(Ha("/api/upload"),{method:"POST",body:X,credentials:"include",headers:Y})).json();D!=null&&D.success&&(D!=null&&D.url)?f($=>({...$,avatar:D.url})):he.error("上传失败: "+((D==null?void 0:D.error)||"未知错误"))}catch(X){console.error(X),he.error("上传失败")}finally{v(!1),j.current&&(j.current.value="")}}};async function k(){s(!0);try{const P=await Fe("/api/db/mentors");P!=null&&P.success&&P.data&&n(P.data)}catch(P){console.error("Load mentors error:",P)}finally{s(!1)}}b.useEffect(()=>{k()},[]);const E=()=>{f({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:e.length>0?Math.max(...e.map(P=>P.sort))+1:0,enabled:!0})},C=()=>{u(null),E(),o(!0)},T=P=>{u(P),f({name:P.name,avatar:P.avatar||"",intro:P.intro||"",tags:P.tags||"",priceSingle:P.priceSingle!=null?String(P.priceSingle):"",priceHalfYear:P.priceHalfYear!=null?String(P.priceHalfYear):"",priceYear:P.priceYear!=null?String(P.priceYear):"",quote:P.quote||"",whyFind:P.whyFind||"",offering:P.offering||"",judgmentStyle:P.judgmentStyle||"",sort:P.sort,enabled:P.enabled??!0}),o(!0)},O=async()=>{if(!h.name.trim()){he.error("导师姓名不能为空");return}g(!0);try{const P=L=>L===""?void 0:parseFloat(L),I={name:h.name.trim(),avatar:h.avatar.trim()||void 0,intro:h.intro.trim()||void 0,tags:h.tags.trim()||void 0,priceSingle:P(h.priceSingle),priceHalfYear:P(h.priceHalfYear),priceYear:P(h.priceYear),quote:h.quote.trim()||void 0,whyFind:h.whyFind.trim()||void 0,offering:h.offering.trim()||void 0,judgmentStyle:h.judgmentStyle.trim()||void 0,sort:h.sort,enabled:h.enabled};if(c){const L=await _t("/api/db/mentors",{id:c.id,...I});L!=null&&L.success?(o(!1),k()):he.error("更新失败: "+(L==null?void 0:L.error))}else{const L=await mt("/api/db/mentors",I);L!=null&&L.success?(o(!1),k()):he.error("新增失败: "+(L==null?void 0:L.error))}}catch(P){console.error("Save error:",P),he.error("保存失败")}finally{g(!1)}},B=async P=>{if(confirm("确定删除该导师?"))try{const I=await ss(`/api/db/mentors?id=${P}`);I!=null&&I.success?k():he.error("删除失败: "+(I==null?void 0:I.error))}catch(I){console.error("Delete error:",I),he.error("删除失败")}},R=P=>P!=null?`¥${P}`:"-";return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Ln,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),i.jsxs(ne,{onClick:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-0",children:r?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"ID"}),i.jsx(Te,{className:"text-gray-400",children:"姓名"}),i.jsx(Te,{className:"text-gray-400",children:"简介"}),i.jsx(Te,{className:"text-gray-400",children:"单次"}),i.jsx(Te,{className:"text-gray-400",children:"半年"}),i.jsx(Te,{className:"text-gray-400",children:"年度"}),i.jsx(Te,{className:"text-gray-400",children:"排序"}),i.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(mr,{children:[e.map(P=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(we,{className:"text-gray-300",children:P.id}),i.jsx(we,{className:"text-white",children:P.name}),i.jsx(we,{className:"text-gray-400 max-w-[200px] truncate",children:P.intro||"-"}),i.jsx(we,{className:"text-gray-400",children:R(P.priceSingle)}),i.jsx(we,{className:"text-gray-400",children:R(P.priceHalfYear)}),i.jsx(we,{className:"text-gray-400",children:R(P.priceYear)}),i.jsx(we,{className:"text-gray-400",children:P.sort}),i.jsxs(we,{className:"text-right",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>T(P),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(kt,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>B(P.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(wn,{className:"w-4 h-4"})})]})]},P.id)),e.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),i.jsx(Zt,{open:a,onOpenChange:o,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[i.jsx(en,{children:i.jsx(tn,{className:"text-white",children:c?"编辑导师":"新增导师"})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"姓名 *"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:h.name,onChange:P=>f(I=>({...I,name:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"排序"}),i.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:h.sort,onChange:P=>f(I=>({...I,sort:parseInt(P.target.value,10)||0}))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"头像"}),i.jsxs("div",{className:"flex gap-3 items-center",children:[i.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:h.avatar,onChange:P=>f(I=>({...I,avatar:P.target.value})),placeholder:"点击上传或粘贴图片地址"}),i.jsx("input",{ref:j,type:"file",accept:"image/*",className:"hidden",onChange:w}),i.jsxs(ne,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:y,onClick:()=>{var P;return(P=j.current)==null?void 0:P.click()},children:[i.jsx(Yu,{className:"w-4 h-4 mr-2"}),y?"上传中...":"上传"]})]}),h.avatar&&i.jsx("div",{className:"mt-2",children:i.jsx("img",{src:h.avatar.startsWith("http")?h.avatar:Ha(h.avatar),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"简介"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:h.intro,onChange:P=>f(I=>({...I,intro:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:h.tags,onChange:P=>f(I=>({...I,tags:P.target.value}))})]}),i.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[i.jsx(te,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),i.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:h.priceSingle,onChange:P=>f(I=>({...I,priceSingle:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),i.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:h.priceHalfYear,onChange:P=>f(I=>({...I,priceHalfYear:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),i.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:h.priceYear,onChange:P=>f(I=>({...I,priceYear:P.target.value}))})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"引言"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:h.quote,onChange:P=>f(I=>({...I,quote:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"为什么找(文本)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.whyFind,onChange:P=>f(I=>({...I,whyFind:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"提供什么(文本)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.offering,onChange:P=>f(I=>({...I,offering:P.target.value}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:h.judgmentStyle,onChange:P=>f(I=>({...I,judgmentStyle:P.target.value}))})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"checkbox",id:"enabled",checked:h.enabled,onChange:P=>f(I=>({...I,enabled:P.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),i.jsx(te,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),i.jsxs(Nn,{children:[i.jsxs(ne,{variant:"outline",onClick:()=>o(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(Wn,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(ne,{onClick:O,disabled:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"}),m?"保存中...":"保存"]})]})]})})]})}function hV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState("");async function o(){r(!0);try{const h=s?`/api/db/mentor-consultations?status=${s}`:"/api/db/mentor-consultations",f=await Fe(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}b.useEffect(()=>{o()},[s]);const c={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},u={single:"单次",half_year:"半年",year:"年度"};return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex justify-between items-center mb-8",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Gu,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("select",{value:s,onChange:h=>a(h.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[i.jsx("option",{value:"",children:"全部状态"}),Object.entries(c).map(([h,f])=>i.jsx("option",{value:h,children:f},h))]}),i.jsxs(ne,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"ID"}),i.jsx(Te,{className:"text-gray-400",children:"用户ID"}),i.jsx(Te,{className:"text-gray-400",children:"导师ID"}),i.jsx(Te,{className:"text-gray-400",children:"类型"}),i.jsx(Te,{className:"text-gray-400",children:"金额"}),i.jsx(Te,{className:"text-gray-400",children:"状态"}),i.jsx(Te,{className:"text-gray-400",children:"创建时间"})]})}),i.jsxs(mr,{children:[t.map(h=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(we,{className:"text-gray-300",children:h.id}),i.jsx(we,{className:"text-gray-400",children:h.userId}),i.jsx(we,{className:"text-gray-400",children:h.mentorId}),i.jsx(we,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),i.jsxs(we,{className:"text-white",children:["¥",h.amount]}),i.jsx(we,{className:"text-gray-400",children:c[h.status]||h.status}),i.jsx(we,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const hc={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},pN={matchTypes:[{id:"partner",label:"找伙伴",matchLabel:"找伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10},poolSettings:hc},fV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function pV(){const t=sa(),[e,n]=b.useState(pN),[r,s]=b.useState(!0),[a,o]=b.useState(!1),[c,u]=b.useState(!1),[h,f]=b.useState(null),[m,g]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[y,v]=b.useState(null),[j,w]=b.useState(!1),k=async()=>{w(!0);try{const I=await Fe("/api/db/match-pool-counts");I!=null&&I.success&&I.data&&v(I.data)}catch(I){console.error("加载池子人数失败:",I)}finally{w(!1)}},E=async()=>{s(!0);try{const I=await Fe("/api/db/config/full?key=match_config"),L=(I==null?void 0:I.data)??(I==null?void 0:I.config);if(L){let X=L.poolSettings??hc;X.poolSource&&!Array.isArray(X.poolSource)&&(X={...X,poolSource:[X.poolSource]}),n({...pN,...L,poolSettings:X})}}catch(I){console.error("加载匹配配置失败:",I)}finally{s(!1)}};b.useEffect(()=>{E(),k()},[]);const C=async()=>{o(!0);try{const I=await mt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});he.error((I==null?void 0:I.success)!==!1?"配置保存成功!":"保存失败: "+((I==null?void 0:I.error)||"未知错误"))}catch(I){console.error(I),he.error("保存失败")}finally{o(!1)}},T=I=>{f(I),g({...I}),u(!0)},O=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},B=()=>{if(!m.id||!m.label){he.error("请填写类型ID和名称");return}const I=[...e.matchTypes];if(h){const L=I.findIndex(X=>X.id===h.id);L!==-1&&(I[L]={...m})}else{if(I.some(L=>L.id===m.id)){he.error("类型ID已存在");return}I.push({...m})}n({...e,matchTypes:I}),u(!1)},R=I=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(L=>L.id!==I)})},P=I=>{n({...e,matchTypes:e.matchTypes.map(L=>L.id===I?{...L,enabled:!L.enabled}:L)})};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex justify-end gap-3",children:[i.jsxs(ne,{variant:"outline",onClick:E,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),i.jsxs(ne,{onClick:C,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"})," ",a?"保存中...":"保存配置"]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx($N,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),i.jsx(zt,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),i.jsxs(Re,{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx(te,{className:"text-gray-300",children:"匹配来源池"}),i.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(I=>{const L=e.poolSettings??hc,Z=(Array.isArray(L.poolSource)?L.poolSource:[L.poolSource]).includes(I.value),Y=y==null?void 0:y[I.countKey],W=()=>{const D=Array.isArray(L.poolSource)?[...L.poolSource]:[L.poolSource],$=Z?D.filter(ae=>ae!==I.value):[...D,I.value];$.length===0&&$.push(I.value),n({...e,poolSettings:{...L,poolSource:$}})};return i.jsxs("button",{type:"button",onClick:W,className:`p-4 rounded-lg border text-left transition-all ${Z?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${Z?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:Z&&"✓"}),i.jsx("span",{className:"text-xl",children:I.icon}),i.jsx("span",{className:`text-sm font-medium ${Z?"text-[#38bdac]":"text-gray-300"}`,children:I.label})]}),i.jsxs("span",{className:"text-lg font-bold text-white",children:[j?"...":Y??"-",i.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),i.jsx("p",{className:"text-gray-500 text-xs mt-2",children:I.desc}),i.jsx("span",{role:"link",tabIndex:0,onClick:D=>{D.stopPropagation(),t(`/users?pool=${I.value}`)},onKeyDown:D=>{D.key==="Enter"&&(D.stopPropagation(),t(`/users?pool=${I.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},I.value)})})]}),i.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[i.jsx(te,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(I=>{const X=(e.poolSettings??hc)[I.key];return i.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[i.jsx(Nt,{checked:X,onCheckedChange:Z=>n({...e,poolSettings:{...e.poolSettings??hc,[I.key]:Z}})}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{children:I.icon}),i.jsx(te,{className:"text-gray-300 text-sm",children:I.label})]})]},I.key)})})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(Xe,{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Fi,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),i.jsx(zt,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),i.jsxs(Re,{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日免费匹配次数"}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:I=>n({...e,freeMatchLimit:parseInt(I.target.value,10)||0})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:I=>n({...e,matchPrice:parseFloat(I.target.value)||1})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),i.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:I=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(I.target.value,10)||10}})})]})]}),i.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:e.settings.enableFreeMatches,onCheckedChange:I=>n({...e,settings:{...e.settings,enableFreeMatches:I}})}),i.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:e.settings.enablePaidMatches,onCheckedChange:I=>n({...e,settings:{...e.settings,enablePaidMatches:I}})}),i.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(Xe,{className:"flex flex-row items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs(Ze,{className:"text-white flex items-center gap-2",children:[i.jsx(Ln,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),i.jsx(zt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),i.jsxs(ne,{onClick:O,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Ft,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),i.jsx(Re,{children:i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"图标"}),i.jsx(Te,{className:"text-gray-400",children:"类型ID"}),i.jsx(Te,{className:"text-gray-400",children:"显示名称"}),i.jsx(Te,{className:"text-gray-400",children:"匹配标签"}),i.jsx(Te,{className:"text-gray-400",children:"价格"}),i.jsx(Te,{className:"text-gray-400",children:"数据库匹配"}),i.jsx(Te,{className:"text-gray-400",children:"状态"}),i.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsx(mr,{children:e.matchTypes.map(I=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(we,{children:i.jsx("span",{className:"text-2xl",children:I.icon})}),i.jsx(we,{className:"font-mono text-gray-300",children:I.id}),i.jsx(we,{className:"text-white font-medium",children:I.label}),i.jsx(we,{className:"text-gray-300",children:I.matchLabel}),i.jsx(we,{children:i.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",I.price]})}),i.jsx(we,{children:I.matchFromDB?i.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):i.jsx(Be,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),i.jsx(we,{children:i.jsx(Nt,{checked:I.enabled,onCheckedChange:()=>P(I.id)})}),i.jsx(we,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>T(I),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(kt,{className:"w-4 h-4"})}),i.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>R(I.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(wn,{className:"w-4 h-4"})})]})})]},I.id))})]})})]}),i.jsx(Zt,{open:c,onOpenChange:u,children:i.jsxs(qt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[i.jsx(en,{children:i.jsxs(tn,{className:"text-white flex items-center gap-2",children:[h?i.jsx(kt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(Ft,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:I=>g({...m,id:I.target.value}),disabled:!!h})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"图标"}),i.jsx("div",{className:"flex gap-1 flex-wrap",children:fV.map(I=>i.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===I?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:I}),children:I},I))})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"显示名称"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:I=>g({...m,label:I.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"匹配标签"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:I=>g({...m,matchLabel:I.target.value})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),i.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:I=>g({...m,price:parseFloat(I.target.value)||1})})]}),i.jsxs("div",{className:"flex gap-6 pt-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:m.matchFromDB,onCheckedChange:I=>g({...m,matchFromDB:I})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:m.showJoinAfterMatch,onCheckedChange:I=>g({...m,showJoinAfterMatch:I})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Nt,{checked:m.enabled,onCheckedChange:I=>g({...m,enabled:I})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),i.jsxs(Nn,{children:[i.jsx(ne,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsxs(ne,{onClick:B,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const mN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function mV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null),[v,j]=b.useState(null);async function w(){m(!0),y(null);try{const C=new URLSearchParams({page:String(s),pageSize:String(o)});u&&C.set("matchType",u);const T=await Fe(`/api/db/match-records?${C}`);T!=null&&T.success?(e(T.records||[]),r(T.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{w()},[s,u]);const k=Math.ceil(n/o)||1,E=({userId:C,nickname:T,avatar:O})=>i.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>j(C),children:[i.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[O?i.jsx("img",{src:O,alt:"",className:"w-full h-full object-cover",onError:B=>{B.currentTarget.style.display="none"}}):null,i.jsx("span",{className:O?"hidden":"",children:(T||C||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:T||C}),i.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[C==null?void 0:C.slice(0,16),(C==null?void 0:C.length)>16?"...":""]})]})]});return i.jsxs("div",{children:[g&&i.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[i.jsx("span",{children:g}),i.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs("select",{value:u,onChange:C=>{h(C.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[i.jsx("option",{value:"",children:"全部类型"}),Object.entries(mN).map(([C,T])=>i.jsx("option",{value:C,children:T},C))]}),i.jsxs("button",{type:"button",onClick:w,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[i.jsx(qe,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Re,{className:"p-0",children:f?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"发起人"}),i.jsx(Te,{className:"text-gray-400",children:"匹配到"}),i.jsx(Te,{className:"text-gray-400",children:"类型"}),i.jsx(Te,{className:"text-gray-400",children:"联系方式"}),i.jsx(Te,{className:"text-gray-400",children:"匹配时间"})]})}),i.jsxs(mr,{children:[t.map(C=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(we,{children:i.jsx(E,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),i.jsx(we,{children:C.matchedUserId?i.jsx(E,{userId:C.matchedUserId,nickname:C.matchedNickname,avatar:C.matchedUserAvatar}):i.jsx("span",{className:"text-gray-500",children:"—"})}),i.jsx(we,{children:i.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:mN[C.matchType]||C.matchType})}),i.jsxs(we,{className:"text-sm",children:[C.phone&&i.jsxs("div",{className:"text-green-400",children:["📱 ",C.phone]}),C.wechatId&&i.jsxs("div",{className:"text-blue-400",children:["💬 ",C.wechatId]}),!C.phone&&!C.wechatId&&i.jsx("span",{className:"text-gray-600",children:"-"})]}),i.jsx(we,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),i.jsx(ls,{page:s,totalPages:k,total:n,pageSize:o,onPageChange:a,onPageSizeChange:C=>{c(C),a(1)}})]})})}),i.jsx(Hx,{open:!!v,onClose:()=>j(null),userId:v,onUserUpdated:w})]})}function gV(){const[t,e]=b.useState("records");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{type:"button",onClick:()=>e("records"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="records"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配记录"}),i.jsx("button",{type:"button",onClick:()=>e("pool"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="pool"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配池设置"})]}),t==="records"&&i.jsx(mV,{}),t==="pool"&&i.jsx(pV,{})]})}const gN={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function xV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0),[f,m]=b.useState("investor"),[g,y]=b.useState(null);async function v(){h(!0);try{const E=new URLSearchParams({page:String(s),pageSize:String(o),matchType:f}),C=await Fe(`/api/db/match-records?${E}`);C!=null&&C.success&&(e(C.records||[]),r(C.total??0))}catch(E){console.error(E)}finally{h(!1)}}b.useEffect(()=>{v()},[s,f]);const j=async E=>{if(!E.phone&&!E.wechatId){he.info("该记录无联系方式,无法推送到存客宝");return}y(E.id);try{const C=await mt("/api/ckb/join",{type:E.matchType||"investor",phone:E.phone||"",wechat:E.wechatId||"",userId:E.userId,name:E.userNickname||""});he.error((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){he.error("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{y(null)}},w=Math.ceil(n/o)||1,k=E=>!!(E.phone||E.wechatId);return i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),i.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("select",{value:f,onChange:E=>{m(E.target.value),a(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(gN).map(([E,C])=>i.jsx("option",{value:E,children:C},E))}),i.jsxs(ne,{onClick:v,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Re,{className:"p-0",children:u?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"发起人"}),i.jsx(Te,{className:"text-gray-400",children:"匹配到"}),i.jsx(Te,{className:"text-gray-400",children:"类型"}),i.jsx(Te,{className:"text-gray-400",children:"联系方式"}),i.jsx(Te,{className:"text-gray-400",children:"时间"}),i.jsx(Te,{className:"text-gray-400 text-right",children:"操作"})]})}),i.jsxs(mr,{children:[t.map(E=>{var C,T;return i.jsxs(ct,{className:`border-gray-700/50 ${k(E)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[i.jsx(we,{className:"text-white",children:E.userNickname||((C=E.userId)==null?void 0:C.slice(0,12))}),i.jsx(we,{className:"text-white",children:E.matchedNickname||((T=E.matchedUserId)==null?void 0:T.slice(0,12))}),i.jsx(we,{children:i.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:gN[E.matchType]||E.matchType})}),i.jsxs(we,{className:"text-sm",children:[E.phone&&i.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&i.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&i.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),i.jsx(we,{className:"text-gray-400 text-sm",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"}),i.jsx(we,{className:"text-right",children:k(E)?i.jsxs(ne,{size:"sm",onClick:()=>j(E),disabled:g===E.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[i.jsx(vA,{className:"w-3 h-3 mr-1"}),g===E.id?"推送中...":"推送CKB"]}):i.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},E.id)}),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),i.jsx(ls,{page:s,totalPages:w,total:n,pageSize:o,onPageChange:a,onPageSizeChange:E=>{c(E),a(1)}})]})})})]})}const xN={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},yV={single:"单次",half_year:"半年",year:"年度"};function vV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,a]=b.useState("");async function o(){r(!0);try{const c=s?`/api/db/mentor-consultations?status=${s}`:"/api/db/mentor-consultations",u=await Fe(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return b.useEffect(()=>{o()},[s]),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("select",{value:s,onChange:c=>a(c.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[i.jsx("option",{value:"",children:"全部状态"}),Object.entries(xN).map(([c,u])=>i.jsx("option",{value:c,children:u},c))]}),i.jsxs(ne,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Re,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"ID"}),i.jsx(Te,{className:"text-gray-400",children:"用户ID"}),i.jsx(Te,{className:"text-gray-400",children:"导师ID"}),i.jsx(Te,{className:"text-gray-400",children:"类型"}),i.jsx(Te,{className:"text-gray-400",children:"金额"}),i.jsx(Te,{className:"text-gray-400",children:"状态"}),i.jsx(Te,{className:"text-gray-400",children:"创建时间"})]})}),i.jsxs(mr,{children:[t.map(c=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(we,{className:"text-gray-300",children:c.id}),i.jsx(we,{className:"text-gray-400",children:c.userId}),i.jsx(we,{className:"text-gray-400",children:c.mentorId}),i.jsx(we,{className:"text-gray-400",children:yV[c.consultationType]||c.consultationType}),i.jsxs(we,{className:"text-white",children:["¥",c.amount]}),i.jsx(we,{className:"text-gray-400",children:xN[c.status]||c.status}),i.jsx(we,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function bV(){const[t,e]=b.useState("booking");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{type:"button",onClick:()=>e("booking"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="booking"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"预约记录"}),i.jsx("button",{type:"button",onClick:()=>e("manage"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="manage"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"导师管理"})]}),t==="booking"&&i.jsx(vV,{}),t==="manage"&&i.jsx("div",{className:"-mx-8",children:i.jsx(SE,{embedded:!0})})]})}function wV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[s,a]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(s),pageSize:String(o),matchType:"team"}),y=await Fe(`/api/db/match-records?${g}`);y!=null&&y.success&&(e(y.records||[]),r(y.total??0))}catch(g){console.error(g)}finally{h(!1)}}b.useEffect(()=>{f()},[s]);const m=Math.ceil(n/o)||1;return i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsxs("div",{children:[i.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),i.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),i.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[i.jsx(qe,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Re,{className:"p-0",children:u?i.jsxs("div",{className:"flex justify-center py-12",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[i.jsxs(fr,{children:[i.jsx(pr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(Te,{className:"text-gray-400",children:"发起人"}),i.jsx(Te,{className:"text-gray-400",children:"匹配到"}),i.jsx(Te,{className:"text-gray-400",children:"联系方式"}),i.jsx(Te,{className:"text-gray-400",children:"时间"})]})}),i.jsxs(mr,{children:[t.map(g=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(we,{className:"text-white",children:g.userNickname||g.userId}),i.jsx(we,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),i.jsxs(we,{className:"text-gray-400 text-sm",children:[g.phone&&i.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&i.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),i.jsx(we,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&i.jsx(ct,{children:i.jsx(we,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),i.jsx(ls,{page:s,totalPages:m,total:n,pageSize:o,onPageChange:a,onPageSizeChange:g=>{c(g),a(1)}})]})})})]})}const yN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"},vN={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮"};function NV({onSwitchTab:t,onOpenCKB:e}={}){const n=sa(),[r,s]=b.useState(null),[a,o]=b.useState(null),[c,u]=b.useState(!0),h=b.useCallback(async()=>{var m,g;u(!0);try{const[y,v]=await Promise.allSettled([Fe("/api/db/match-records?stats=true"),Fe("/api/db/ckb-plan-stats")]);if(y.status==="fulfilled"&&((m=y.value)!=null&&m.success)&&y.value.data){let j=y.value.data;if(j.totalMatches>0&&(!j.uniqueUsers||j.uniqueUsers===0))try{const w=await Fe("/api/db/match-records?page=1&pageSize=200");if(w!=null&&w.success&&w.records){const k=new Set(w.records.map(E=>E.userId).filter(Boolean));j={...j,uniqueUsers:k.size}}}catch{}s(j)}v.status==="fulfilled"&&((g=v.value)!=null&&g.success)&&v.value.data&&o(v.value.data)}catch(y){console.error("加载统计失败:",y)}finally{u(!1)}},[]);b.useEffect(()=>{h()},[h]);const f=m=>c?"—":String(m??0);return i.jsxs("div",{className:"space-y-8",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[i.jsx(Ln,{className:"w-5 h-5 text-[#38bdac]"})," 找伙伴数据"]}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",children:[i.jsx(Ae,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-[#38bdac]/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"总匹配次数"}),i.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.totalMatches)}),i.jsxs("p",{className:"text-[#38bdac] text-xs mt-3 flex items-center gap-1",children:[i.jsx(ti,{className:"w-3 h-3"})," 查看匹配记录"]})]})}),i.jsx(Ae,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-yellow-500/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"今日匹配"}),i.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.todayMatches)}),i.jsxs("p",{className:"text-yellow-400/60 text-xs mt-3 flex items-center gap-1",children:[i.jsx(Fi,{className:"w-3 h-3"})," 今日实时"]})]})}),i.jsx(Ae,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-blue-500/60 transition-all",onClick:()=>n("/users"),children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"匹配用户数"}),i.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.uniqueUsers)}),i.jsxs("p",{className:"text-blue-400/60 text-xs mt-3 flex items-center gap-1",children:[i.jsx(ti,{className:"w-3 h-3"})," 查看用户管理"]})]})}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40",children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"人均匹配"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":r!=null&&r.uniqueUsers?(r.totalMatches/r.uniqueUsers).toFixed(1):"0"})]})}),i.jsx(Ae,{className:"bg-[#0f2137] border-gray-700/40",children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"付费匹配次数"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:f(r==null?void 0:r.paidMatchCount)})]})})]})]}),(r==null?void 0:r.byType)&&r.byType.length>0&&i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"各类型匹配分布"}),i.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:r.byType.map(m=>{const g=r.totalMatches>0?m.count/r.totalMatches*100:0;return i.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/40 rounded-xl p-5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx("span",{className:"text-2xl",children:vN[m.matchType]||"📊"}),i.jsx("span",{className:"text-gray-300 font-medium",children:yN[m.matchType]||m.matchType})]}),i.jsx("p",{className:"text-3xl font-bold text-white mb-2",children:m.count}),i.jsx("div",{className:"w-full h-2 bg-gray-700/50 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-[#38bdac] rounded-full transition-all",style:{width:`${Math.min(g,100)}%`}})}),i.jsxs("p",{className:"text-gray-500 text-xs mt-1.5",children:[g.toFixed(1),"%"]})]},m.matchType)})})]}),i.jsxs("div",{children:[i.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[i.jsx(Ss,{className:"w-5 h-5 text-orange-400"})," AI 获客数据"]}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5 mb-6",children:[i.jsx(Ae,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("submitted"),children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"已提交线索"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(a==null?void 0:a.ckbTotal)??0}),i.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),i.jsx(Ae,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("contact"),children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"有联系方式"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(a==null?void 0:a.withContact)??0}),i.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),i.jsx(Ae,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("test"),children:i.jsxs(Re,{className:"p-6",children:[i.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"AI 添加进度"}),i.jsx("p",{className:"text-xl font-bold text-orange-400",children:"查看详情 →"}),i.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"添加成功率 · 回复率 · API 文档"})]})})]}),(a==null?void 0:a.byType)&&a.byType.length>0&&i.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:a.byType.map(m=>i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-lg p-4 flex items-center gap-3",children:[i.jsx("span",{className:"text-xl",children:vN[m.matchType]||"📋"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-xs",children:yN[m.matchType]||m.matchType}),i.jsx("p",{className:"text-xl font-bold text-white",children:m.total})]})]},m.matchType))})]})]})}const jV=["partner","investor","mentor","team"],dg=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],bN=`# 场景获客接口摘要 +- 地址:POST /v1/api/scenarios +- 必填:apiKey、sign、timestamp +- 主标识:phone 或 wechatId 至少一项 +- 可选:name、source、remark、tags、siteTags、portrait +- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 +- 成功:code=200,message=新增成功 或 已存在`;function kV({initialTab:t="overview"}){const[e,n]=b.useState(t),[r,s]=b.useState("13800000000"),[a,o]=b.useState(""),[c,u]=b.useState(""),[h,f]=b.useState(bN),[m,g]=b.useState(!1),[y,v]=b.useState(!1),[j,w]=b.useState([]),[k,E]=b.useState([]),[C,T]=b.useState({}),[O,B]=b.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),R=b.useMemo(()=>{const D={};return dg.forEach($=>{D[$.key]=C[$.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),D},[C]),P=D=>{const $=r.trim(),ae=a.trim();return D<=3?{type:jV[D],phone:$||void 0,wechat:ae||void 0,userId:"admin_test",name:"后台测试"}:D===4?{matchType:"partner",phone:$||void 0,wechat:ae||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:D===5?{phone:$||void 0,wechatId:ae||void 0,userId:"admin_test",name:"后台测试"}:{}};async function I(){v(!0);try{const[D,$,ae]=await Promise.all([Fe("/api/db/config/full?key=ckb_config"),Fe("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Fe("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),_=D==null?void 0:D.data;_!=null&&_.routes&&T(_.routes),_!=null&&_.docNotes&&u(_.docNotes),_!=null&&_.docContent&&f(_.docContent),$!=null&&$.success&&w($.records||[]),ae!=null&&ae.success&&E(ae.records||[])}finally{v(!1)}}b.useEffect(()=>{n(t)},[t]),b.useEffect(()=>{I()},[]);async function L(){g(!0);try{const D=await mt("/api/db/config",{key:"ckb_config",value:{routes:R,docNotes:c,docContent:h},description:"存客宝接口配置"});he.error((D==null?void 0:D.success)!==!1?"存客宝配置已保存":`保存失败: ${(D==null?void 0:D.error)||"未知错误"}`)}catch(D){he.error(`保存失败: ${D instanceof Error?D.message:"网络错误"}`)}finally{g(!1)}}const X=(D,$)=>{T(ae=>({...ae,[D]:{...R[D],...$}}))},Z=async D=>{const $=O[D];if($.method==="POST"&&!r.trim()&&!a.trim()){he.error("请填写测试手机号");return}const ae=[...O];ae[D]={...$,status:"testing",message:void 0,responseTime:void 0},B(ae);const _=performance.now();try{const se=$.method==="GET"?await Fe($.endpoint):await mt($.endpoint,P(D)),q=Math.round(performance.now()-_),z=(se==null?void 0:se.message)||"",H=(se==null?void 0:se.success)===!0||z.includes("已存在")||z.includes("已加入")||z.includes("已提交"),de=[...O];de[D]={...$,status:H?"success":"error",message:z||(H?"正常":"异常"),responseTime:q},B(de),await I()}catch(se){const q=Math.round(performance.now()-_),z=[...O];z[D]={...$,status:"error",message:se instanceof Error?se.message:"失败",responseTime:q},B(z)}},Y=async()=>{if(!r.trim()&&!a.trim()){he.error("请填写测试手机号");return}for(let D=0;Di.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:i.jsxs("tr",{children:[i.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),i.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),i.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),i.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),i.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),i.jsx("tbody",{children:D.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:$})}):D.map(ae=>i.jsxs("tr",{className:"border-t border-gray-700/30",children:[i.jsx("td",{className:"px-4 py-3 text-white",children:ae.userNickname||ae.userId}),i.jsx("td",{className:"px-4 py-3 text-gray-300",children:ae.matchType}),i.jsx("td",{className:"px-4 py-3 text-green-400",children:ae.phone||"—"}),i.jsx("td",{className:"px-4 py-3 text-blue-400",children:ae.wechatId||"—"}),i.jsx("td",{className:"px-4 py-3 text-gray-400",children:ae.createdAt?new Date(ae.createdAt).toLocaleString():"—"})]},ae.id))})]})});return i.jsx(Ae,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:i.jsxs(Re,{className:"p-5",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),i.jsx(Be,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),i.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[i.jsx(ti,{className:"w-3 h-3"})," API 文档"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(ne,{onClick:()=>I(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(qe,{className:`w-3.5 h-3.5 mr-1 ${y?"animate-spin":""}`})," 刷新"]}),i.jsxs(ne,{onClick:L,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(an,{className:"w-3.5 h-3.5 mr-1"})," ",m?"保存中...":"保存配置"]})]})]}),i.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","已提交线索"],["contact","有联系方式"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([D,$])=>i.jsx("button",{type:"button",onClick:()=>n(D),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===D?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:$},D))}),e==="overview"&&i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"已提交线索"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:j.length})]}),i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"有联系方式"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:k.length})]}),i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"场景配置数"}),i.jsx("p",{className:"text-3xl font-bold text-white",children:dg.length})]}),i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[i.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),i.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&W(j,"暂无已提交线索"),e==="contact"&&W(k,"暂无有联系方式线索"),e==="config"&&i.jsx("div",{className:"space-y-4",children:dg.map(D=>i.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h4",{className:"text-white font-medium",children:D.label}),i.jsx(Be,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:D.key})]}),i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"API 地址"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[D.key].apiUrl,onChange:$=>X(D.key,{apiUrl:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"API Key"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[D.key].apiKey,onChange:$=>X(D.key,{apiKey:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"Source"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[D.key].source,onChange:$=>X(D.key,{source:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"Tags"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[D.key].tags,onChange:$=>X(D.key,{tags:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"SiteTags"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[D.key].siteTags,onChange:$=>X(D.key,{siteTags:$.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"说明备注"}),i.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:R[D.key].notes,onChange:$=>X(D.key,{notes:$.target.value})})]})]})]},D.key))}),e==="test"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex gap-3 mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[i.jsx(Tc,{className:"w-4 h-4 text-gray-500 shrink-0"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"测试手机号"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:D=>s(D.target.value)})]})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[i.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(te,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:a,onChange:D=>o(D.target.value)})]})]}),i.jsx("div",{className:"flex items-end",children:i.jsxs(ne,{onClick:Y,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[i.jsx(Fi,{className:"w-3.5 h-3.5 mr-1"})," 全部测试"]})})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:O.map((D,$)=>i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[D.status==="idle"&&i.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),D.status==="testing"&&i.jsx(qe,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),D.status==="success"&&i.jsx(gg,{className:"w-3 h-3 text-green-400 shrink-0"}),D.status==="error"&&i.jsx(_N,{className:"w-3 h-3 text-red-400 shrink-0"}),i.jsx("span",{className:"text-white text-xs truncate",children:D.label})]}),i.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[D.responseTime!==void 0&&i.jsxs("span",{className:"text-gray-600 text-[10px]",children:[D.responseTime,"ms"]}),i.jsx("button",{type:"button",onClick:()=>Z($),disabled:D.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${D.endpoint}-${$}`))})]}),e==="doc"&&i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h4",{className:"text-white text-sm font-medium",children:"场景获客 API 摘要"}),i.jsxs("a",{href:"https://ckbapi.quwanzhi.com/v1/api/scenarios",target:"_blank",rel:"noreferrer",className:"text-orange-400/70 hover:text-orange-400 text-xs flex items-center gap-1",children:[i.jsx(ti,{className:"w-3 h-3"})," 打开外链"]})]}),i.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||bN})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[i.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"说明备注(可编辑)"}),i.jsx("textarea",{className:"w-full min-h-[260px] bg-[#0f2137] border border-gray-700 rounded-md text-sm text-gray-300 p-3 outline-none focus:border-orange-500/50 resize-y",value:c,onChange:D=>u(D.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const SV=[{id:"stats",label:"数据统计",icon:PT},{id:"partner",label:"找伙伴",icon:Ln},{id:"resource",label:"资源对接",icon:mM},{id:"mentor",label:"导师预约",icon:hM},{id:"team",label:"团队招募",icon:Ng}];function CV(){const[t,e]=b.useState("stats"),[n,r]=b.useState(!1),[s,a]=b.useState("overview");return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[i.jsx(Ln,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),i.jsxs(ne,{type:"button",variant:"outline",onClick:()=>r(o=>!o),className:"border-orange-500/40 text-orange-300 hover:bg-orange-500/10 bg-transparent",children:[i.jsx(Ss,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),n&&i.jsx(kV,{initialTab:s}),i.jsx("div",{className:"flex flex-wrap gap-1 mb-6 bg-[#0f2137] rounded-lg p-1 border border-gray-700/50",children:SV.map(o=>{const c=t===o.id;return i.jsxs("button",{type:"button",onClick:()=>e(o.id),className:`flex items-center gap-2 px-5 py-2.5 rounded-md text-sm font-medium transition-all ${c?"bg-[#38bdac] text-white shadow-lg":"text-gray-400 hover:text-white hover:bg-gray-700/50"}`,children:[i.jsx(o.icon,{className:"w-4 h-4"}),o.label]},o.id)})}),t==="stats"&&i.jsx(NV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{a(o||"overview"),r(!0)}}),t==="partner"&&i.jsx(gV,{}),t==="resource"&&i.jsx(xV,{}),t==="mentor"&&i.jsx(bV,{}),t==="team"&&i.jsx(wV,{})]})}function EV(){return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[i.jsx(Ss,{className:"w-8 h-8 text-[#38bdac]"}),i.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),i.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"1. 接口总览"})}),i.jsxs(Re,{className:"space-y-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),i.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[i.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),i.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),i.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),i.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),i.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),i.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),i.jsx("li",{children:"/api/config — 配置系统"})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),i.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),i.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"2. 书籍内容"})}),i.jsxs(Re,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),i.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),i.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"3. 支付"})}),i.jsxs(Re,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"POST /api/payment/create-order — 创建订单"}),i.jsx("p",{children:"POST /api/payment/alipay/notify — 支付宝回调"}),i.jsx("p",{children:"POST /api/payment/wechat/notify — 微信回调"})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"4. 分销与用户"})}),i.jsxs(Re,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"/api/referral/* — 邀请码、收益查询、提现"}),i.jsx("p",{children:"/api/user/* — 登录、注册、信息更新"}),i.jsx("p",{children:"/api/match/* — 匹配、匹配历史"})]})]}),i.jsxs(Ae,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(Xe,{children:i.jsx(Ze,{className:"text-white",children:"5. 管理后台"})}),i.jsxs(Re,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[i.jsx("p",{children:"GET/POST /api/admin/referral-settings — 推广/分销设置(含 VIP 配置)"}),i.jsx("p",{children:"GET /api/db/users、/api/db/book — 用户与章节数据"}),i.jsx("p",{children:"GET /api/orders — 订单列表"})]})]}),i.jsx("p",{className:"text-gray-500 text-xs",children:"完整说明见项目内 开发文档/5、接口/API接口完整文档.md"})]})}function TV(){const t=ra();return i.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:i.jsxs("div",{className:"text-center max-w-md",children:[i.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500/20 text-red-400 mb-6",children:i.jsx(FT,{className:"w-10 h-10"})}),i.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),i.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),i.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:t.pathname}),i.jsx(ne,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:i.jsxs(mg,{to:"/",children:[i.jsx(SM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function MV(){return i.jsxs(oT,{children:[i.jsx(Dt,{path:"/login",element:i.jsx(KR,{})}),i.jsxs(Dt,{path:"/",element:i.jsx(JA,{}),children:[i.jsx(Dt,{index:!0,element:i.jsx(mm,{to:"/dashboard",replace:!0})}),i.jsx(Dt,{path:"dashboard",element:i.jsx(rI,{})}),i.jsx(Dt,{path:"orders",element:i.jsx(sI,{})}),i.jsx(Dt,{path:"users",element:i.jsx(iI,{})}),i.jsx(Dt,{path:"distribution",element:i.jsx(EI,{})}),i.jsx(Dt,{path:"withdrawals",element:i.jsx(TI,{})}),i.jsx(Dt,{path:"content",element:i.jsx(qB,{})}),i.jsx(Dt,{path:"referral-settings",element:i.jsx(jk,{})}),i.jsx(Dt,{path:"author-settings",element:i.jsx(mm,{to:"/settings?tab=author",replace:!0})}),i.jsx(Dt,{path:"vip-roles",element:i.jsx(uV,{})}),i.jsx(Dt,{path:"mentors",element:i.jsx(SE,{})}),i.jsx(Dt,{path:"mentor-consultations",element:i.jsx(hV,{})}),i.jsx(Dt,{path:"admin-users",element:i.jsx(mm,{to:"/settings?tab=admin",replace:!0})}),i.jsx(Dt,{path:"settings",element:i.jsx(tV,{})}),i.jsx(Dt,{path:"payment",element:i.jsx(nV,{})}),i.jsx(Dt,{path:"site",element:i.jsx(aV,{})}),i.jsx(Dt,{path:"qrcodes",element:i.jsx(oV,{})}),i.jsx(Dt,{path:"find-partner",element:i.jsx(CV,{})}),i.jsx(Dt,{path:"match",element:i.jsx(cV,{})}),i.jsx(Dt,{path:"match-records",element:i.jsx(dV,{})}),i.jsx(Dt,{path:"api-doc",element:i.jsx(EV,{})})]}),i.jsx(Dt,{path:"*",element:i.jsx(TV,{})})]})}h4.createRoot(document.getElementById("root")).render(i.jsx(b.StrictMode,{children:i.jsx(mT,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:i.jsx(MV,{})})})); diff --git a/soul-admin/dist/assets/index-hM2iAGkr.css b/soul-admin/dist/assets/index-hM2iAGkr.css new file mode 100644 index 00000000..d94e0466 --- /dev/null +++ b/soul-admin/dist/assets/index-hM2iAGkr.css @@ -0,0 +1 @@ +.rich-editor-wrapper{border:1px solid #374151;border-radius:.5rem;background:#0a1628;overflow:hidden}.rich-editor-toolbar{display:flex;align-items:center;gap:2px;padding:6px 8px;border-bottom:1px solid #374151;background:#0f1d32;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:1px}.toolbar-divider{width:1px;height:20px;background:#374151;margin:0 4px}.rich-editor-toolbar button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer;transition:all .15s}.rich-editor-toolbar button:hover{background:#1f2937;color:#d1d5db}.rich-editor-toolbar button.is-active{background:#38bdac33;color:#38bdac}.rich-editor-toolbar button:disabled{opacity:.3;cursor:not-allowed}.link-tag-select{background:#0a1628;border:1px solid #374151;color:#d1d5db;font-size:12px;padding:2px 6px;border-radius:4px;cursor:pointer;max-width:160px}.link-input-bar{display:flex;align-items:center;gap:4px;padding:4px 8px;border-bottom:1px solid #374151;background:#0f1d32}.link-input{flex:1;background:#0a1628;border:1px solid #374151;color:#fff;padding:4px 8px;border-radius:4px;font-size:13px}.link-confirm,.link-remove{padding:4px 10px;border-radius:4px;border:none;font-size:12px;cursor:pointer}.link-confirm{background:#38bdac;color:#fff}.link-remove{background:#374151;color:#9ca3af}.rich-editor-content{min-height:300px;max-height:500px;overflow-y:auto;padding:12px 16px;color:#e5e7eb;font-size:14px;line-height:1.7}.rich-editor-content:focus{outline:none}.rich-editor-content h1{font-size:1.5em;font-weight:700;margin:.8em 0 .4em;color:#fff}.rich-editor-content h2{font-size:1.3em;font-weight:600;margin:.7em 0 .3em;color:#fff}.rich-editor-content h3{font-size:1.15em;font-weight:600;margin:.6em 0 .3em;color:#fff}.rich-editor-content p{margin:.4em 0}.rich-editor-content strong{color:#fff}.rich-editor-content code{background:#1f2937;padding:2px 6px;border-radius:3px;font-size:.9em;color:#38bdac}.rich-editor-content pre{background:#1f2937;padding:12px;border-radius:6px;overflow-x:auto;margin:.6em 0}.rich-editor-content blockquote{border-left:3px solid #38bdac;padding-left:12px;margin:.6em 0;color:#9ca3af}.rich-editor-content ul,.rich-editor-content ol{padding-left:1.5em;margin:.4em 0}.rich-editor-content li{margin:.2em 0}.rich-editor-content hr{border:none;border-top:1px solid #374151;margin:1em 0}.rich-editor-content img{max-width:100%;border-radius:6px;margin:.5em 0}.rich-editor-content a,.rich-link{color:#38bdac;text-decoration:underline;cursor:pointer}.rich-editor-content table{border-collapse:collapse;width:100%;margin:.5em 0}.rich-editor-content th,.rich-editor-content td{border:1px solid #374151;padding:6px 10px;text-align:left}.rich-editor-content th{background:#1f2937;font-weight:600}.rich-editor-content .ProseMirror-placeholder:before{content:attr(data-placeholder);color:#6b7280;float:left;height:0;pointer-events:none}.mention-tag{background:#38bdac26;color:#38bdac;border-radius:4px;padding:1px 4px;font-weight:500}.link-tag-node{background:#ffd7001f;color:gold;border-radius:4px;padding:1px 4px;font-weight:500;cursor:default;-webkit-user-select:all;user-select:all}.mention-popup{position:fixed;z-index:9999;background:#1a2638;border:1px solid #374151;border-radius:8px;padding:4px;min-width:180px;max-height:240px;overflow-y:auto;box-shadow:0 4px 20px #0006}.mention-item{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:4px;cursor:pointer;color:#d1d5db;font-size:13px}.mention-item:hover,.mention-item.is-selected{background:#38bdac26;color:#38bdac}.mention-name{font-weight:500}.mention-id{font-size:11px;color:#6b7280}.bubble-menu{display:flex;gap:2px;background:#1a2638;border:1px solid #374151;border-radius:6px;padding:4px;box-shadow:0 4px 12px #0000004d}.bubble-menu button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer}.bubble-menu button:hover{background:#1f2937;color:#d1d5db}.bubble-menu button.is-active{color:#38bdac}/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2\.5{top:calc(var(--spacing)*-2.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.-left-2\.5{left:calc(var(--spacing)*-2.5)}.left-0{left:calc(var(--spacing)*0)}.left-1\/4{left:25%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-8{margin-inline:calc(var(--spacing)*-8)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-auto{margin-right:auto}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline\!{display:inline!important}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table\!{display:table!important}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-96{height:calc(var(--spacing)*96)}.h-\[75vh\]{height:75vh}.h-auto{height:auto}.h-full{height:100%}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[2rem\]{min-height:2rem}.min-h-\[32px\]{min-height:32px}.min-h-\[40px\]{min-height:40px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[80px\]{min-height:80px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[260px\]{min-height:260px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-36{width:calc(var(--spacing)*36)}.w-44{width:calc(var(--spacing)*44)}.w-48{width:calc(var(--spacing)*48)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[1024px\]{min-width:1024px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}:where(.divide-gray-700\/50>:not(:last-child)){border-color:#36415380}@supports (color:color-mix(in lab,red,red)){:where(.divide-gray-700\/50>:not(:last-child)){border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}:where(.divide-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-\[\#07C160\]{border-color:#07c160}.border-\[\#07C160\]\/20{border-color:#07c16033}.border-\[\#07C160\]\/30{border-color:#07c1604d}.border-\[\#38bdac\]{border-color:#38bdac}.border-\[\#38bdac\]\/20{border-color:#38bdac33}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.border-cyan-500\/40{border-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/40{border-color:color-mix(in oklab,var(--color-cyan-500)40%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-500\/30{border-color:#6a72824d}@supports (color:color-mix(in lab,red,red)){.border-gray-500\/30{border-color:color-mix(in oklab,var(--color-gray-500)30%,transparent)}}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-700\/30{border-color:#3641534d}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/30{border-color:color-mix(in oklab,var(--color-gray-700)30%,transparent)}}.border-gray-700\/40{border-color:#36415366}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/40{border-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.border-gray-700\/50{border-color:#36415380}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/50{border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-orange-500\/20{border-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/20{border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.border-orange-500\/50{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/50{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.border-purple-500\/20{border-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/20{border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.border-purple-500\/40{border-color:#ac4bff66}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/40{border-color:color-mix(in oklab,var(--color-purple-500)40%,transparent)}}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-transparent{border-color:#0000}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.bg-\[\#0a1628\]{background-color:#0a1628}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0d1f35\]{background-color:#0d1f35}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#07C160\]{background-color:#07c160}.bg-\[\#07C160\]\/5{background-color:#07c1600d}.bg-\[\#07C160\]\/10{background-color:#07c1601a}.bg-\[\#38bdac\]{background-color:#38bdac}.bg-\[\#38bdac\]\/5{background-color:#38bdac0d}.bg-\[\#38bdac\]\/10{background-color:#38bdac1a}.bg-\[\#38bdac\]\/15{background-color:#38bdac26}.bg-\[\#38bdac\]\/20{background-color:#38bdac33}.bg-\[\#38bdac\]\/30{background-color:#38bdac4d}.bg-\[\#38bdac\]\/60{background-color:#38bdac99}.bg-\[\#38bdac\]\/80{background-color:#38bdaccc}.bg-\[\#162840\]{background-color:#162840}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-600\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#0f2137\]{--tw-gradient-from:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#162d4a\]{--tw-gradient-to:#162d4a;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-amber-400{fill:var(--color-amber-400)}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-0\.5{padding-top:calc(var(--spacing)*.5)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-6{padding-top:calc(var(--spacing)*6)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-4{padding-right:calc(var(--spacing)*4)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.text-wrap{text-wrap:wrap}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#00CED1\]{color:#00ced1}.text-\[\#07C160\]{color:#07c160}.text-\[\#07C160\]\/60{color:#07c16099}.text-\[\#07C160\]\/70{color:#07c160b3}.text-\[\#07C160\]\/80{color:#07c160cc}.text-\[\#26A17B\]{color:#26a17b}.text-\[\#38bdac\]{color:#38bdac}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#169BD7\]{color:#169bd7}.text-\[\#1677FF\]{color:#1677ff}.text-\[\#FFD700\]{color:gold}.text-amber-200{color:var(--color-amber-200)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/30{color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/30{color:color-mix(in oklab,var(--color-amber-400)30%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-blue-300\/60{color:#90c5ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/60{color:color-mix(in oklab,var(--color-blue-300)60%,transparent)}}.text-blue-400{color:var(--color-blue-400)}.text-blue-400\/60{color:#54a2ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-400\/60{color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/60{color:#ffb96d99}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/60{color:color-mix(in oklab,var(--color-orange-300)60%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-purple-400{color:var(--color-purple-400)}.text-red-400{color:var(--color-red-400)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-400\/60{color:#fac80099}@supports (color:color-mix(in lab,red,red)){.text-yellow-400\/60{color:color-mix(in oklab,var(--color-yellow-400)60%,transparent)}}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.italic\!{font-style:italic!important}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline\!{text-decoration-line:underline!important}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[\#38bdac\]\/20{--tw-shadow-color:#38bdac33}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/20{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.2) var(--tw-shadow-alpha),transparent)}}.shadow-\[\#38bdac\]\/30{--tw-shadow-color:#38bdac4d}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/30{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.3) var(--tw-shadow-alpha),transparent)}}.ring-\[\#38bdac\]{--tw-ring-color:#38bdac}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-\[\#38bdac\]:is(:where(.group):hover *){color:#38bdac}.group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.placeholder\:text-gray-500::placeholder{color:var(--color-gray-500)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-\[\#38bdac\]\/30:hover{border-color:#38bdac4d}.hover\:border-\[\#38bdac\]\/50:hover{border-color:#38bdac80}.hover\:border-\[\#38bdac\]\/60:hover{border-color:#38bdac99}.hover\:border-amber-500\/40:hover{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.hover\:border-amber-500\/40:hover{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.hover\:border-blue-500\/60:hover{border-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-500\/60:hover{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.hover\:border-gray-500:hover{border-color:var(--color-gray-500)}.hover\:border-gray-600:hover{border-color:var(--color-gray-600)}.hover\:border-orange-500\/50:hover{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.hover\:border-orange-500\/50:hover{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.hover\:border-yellow-500\/60:hover{border-color:#edb20099}@supports (color:color-mix(in lab,red,red)){.hover\:border-yellow-500\/60:hover{border-color:color-mix(in oklab,var(--color-yellow-500)60%,transparent)}}.hover\:bg-\[\#0a1628\]:hover{background-color:#0a1628}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-blue-400\/10:hover{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-400\/10:hover{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.hover\:bg-blue-500\/20:hover{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/20:hover{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-gray-500\/20:hover{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-500\/20:hover{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:text-\[\#2da396\]:hover{color:#2da396}.hover\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-300:hover{color:var(--color-amber-300)}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.focus\:border-orange-500\/50:focus{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.focus\:border-orange-500\/50:focus{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.focus\:bg-\[\#38bdac\]\/20:focus{background-color:#38bdac33}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[\#38bdac\]:focus{--tw-ring-color:#38bdac}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[\#38bdac\]:focus-visible{--tw-ring-color:#38bdac}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-\[\#0a1628\]:focus-visible{--tw-ring-offset-color:#0a1628}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-\[\#07C160\]\/20[data-state=active]{background-color:#07c16033}.data-\[state\=active\]\:bg-\[\#26A17B\]\/20[data-state=active]{background-color:#26a17b33}.data-\[state\=active\]\:bg-\[\#38bdac\]\/20[data-state=active]{background-color:#38bdac33}.data-\[state\=active\]\:bg-\[\#1677FF\]\/20[data-state=active]{background-color:#1677ff33}.data-\[state\=active\]\:bg-\[\#003087\]\/20[data-state=active]{background-color:#00308733}.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.data-\[state\=active\]\:font-medium[data-state=active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[state\=active\]\:text-\[\#07C160\][data-state=active]{color:#07c160}.data-\[state\=active\]\:text-\[\#26A17B\][data-state=active]{color:#26a17b}.data-\[state\=active\]\:text-\[\#38bdac\][data-state=active]{color:#38bdac}.data-\[state\=active\]\:text-\[\#169BD7\][data-state=active]{color:#169bd7}.data-\[state\=active\]\:text-\[\#1677FF\][data-state=active]{color:#1677ff}.data-\[state\=active\]\:text-amber-400[data-state=active]{color:var(--color-amber-400)}.data-\[state\=active\]\:text-purple-400[data-state=active]{color:var(--color-purple-400)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:bg-\[\#38bdac\][data-state=checked]{background-color:#38bdac}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-gray-600[data-state=unchecked]{background-color:var(--color-gray-600)}@media(min-width:40rem){.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/soul-admin/dist/assets/index-iq3PeMuM.js b/soul-admin/dist/assets/index-iq3PeMuM.js deleted file mode 100644 index e7d4099a..00000000 --- a/soul-admin/dist/assets/index-iq3PeMuM.js +++ /dev/null @@ -1,470 +0,0 @@ -function ty(n,a){for(var l=0;lo[c]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function l(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(c){if(c.ep)return;c.ep=!0;const u=l(c);fetch(c.href,u)}})();function cp(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Bc={exports:{}},Da={},Uc={exports:{}},$e={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Zh;function ry(){if(Zh)return $e;Zh=1;var n=Symbol.for("react.element"),a=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.iterator;function k(I){return I===null||typeof I!="object"?null:(I=y&&I[y]||I["@@iterator"],typeof I=="function"?I:null)}var R={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,N={};function w(I,L,X){this.props=I,this.context=L,this.refs=N,this.updater=X||R}w.prototype.isReactComponent={},w.prototype.setState=function(I,L){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,L,"setState")},w.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function S(){}S.prototype=w.prototype;function P(I,L,X){this.props=I,this.context=L,this.refs=N,this.updater=X||R}var j=P.prototype=new S;j.constructor=P,C(j,w.prototype),j.isPureReactComponent=!0;var _=Array.isArray,B=Object.prototype.hasOwnProperty,V={current:null},E={key:!0,ref:!0,__self:!0,__source:!0};function T(I,L,X){var ae,ve={},pe=null,le=null;if(L!=null)for(ae in L.ref!==void 0&&(le=L.ref),L.key!==void 0&&(pe=""+L.key),L)B.call(L,ae)&&!E.hasOwnProperty(ae)&&(ve[ae]=L[ae]);var ye=arguments.length-2;if(ye===1)ve.children=X;else if(1>>1,L=M[I];if(0>>1;Ic(ve,H))pec(le,ve)?(M[I]=le,M[pe]=H,I=pe):(M[I]=ve,M[ae]=H,I=ae);else if(pec(le,H))M[I]=le,M[pe]=H,I=pe;else break e}}return Q}function c(M,Q){var H=M.sortIndex-Q.sortIndex;return H!==0?H:M.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var x=[],g=[],v=1,y=null,k=3,R=!1,C=!1,N=!1,w=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(M){for(var Q=l(g);Q!==null;){if(Q.callback===null)o(g);else if(Q.startTime<=M)o(g),Q.sortIndex=Q.expirationTime,a(x,Q);else break;Q=l(g)}}function _(M){if(N=!1,j(M),!C)if(l(x)!==null)C=!0,te(B);else{var Q=l(g);Q!==null&&U(_,Q.startTime-M)}}function B(M,Q){C=!1,N&&(N=!1,S(T),T=-1),R=!0;var H=k;try{for(j(Q),y=l(x);y!==null&&(!(y.expirationTime>Q)||M&&!ue());){var I=y.callback;if(typeof I=="function"){y.callback=null,k=y.priorityLevel;var L=I(y.expirationTime<=Q);Q=n.unstable_now(),typeof L=="function"?y.callback=L:y===l(x)&&o(x),j(Q)}else o(x);y=l(x)}if(y!==null)var X=!0;else{var ae=l(g);ae!==null&&U(_,ae.startTime-Q),X=!1}return X}finally{y=null,k=H,R=!1}}var V=!1,E=null,T=-1,z=5,q=-1;function ue(){return!(n.unstable_now()-qM||125I?(M.sortIndex=H,a(g,M),l(x)===null&&M===l(g)&&(N?(S(T),T=-1):N=!0,U(_,H-I))):(M.sortIndex=L,a(x,M),C||R||(C=!0,te(B))),M},n.unstable_shouldYield=ue,n.unstable_wrapCallback=function(M){var Q=k;return function(){var H=k;k=Q;try{return M.apply(this,arguments)}finally{k=H}}}})(Hc)),Hc}var sm;function ly(){return sm||(sm=1,Wc.exports=ay()),Wc.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var am;function iy(){if(am)return Wt;am=1;var n=Ad(),a=ly();function l(e){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),x=Object.prototype.hasOwnProperty,g=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,v={},y={};function k(e){return x.call(y,e)?!0:x.call(v,e)?!1:g.test(e)?y[e]=!0:(v[e]=!0,!1)}function R(e,r,s,i){if(s!==null&&s.type===0)return!1;switch(typeof r){case"function":case"symbol":return!0;case"boolean":return i?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function C(e,r,s,i){if(r===null||typeof r>"u"||R(e,r,s,i))return!0;if(i)return!1;if(s!==null)switch(s.type){case 3:return!r;case 4:return r===!1;case 5:return isNaN(r);case 6:return isNaN(r)||1>r}return!1}function N(e,r,s,i,d,m,b){this.acceptsBooleans=r===2||r===3||r===4,this.attributeName=i,this.attributeNamespace=d,this.mustUseProperty=s,this.propertyName=e,this.type=r,this.sanitizeURL=m,this.removeEmptyString=b}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){w[e]=new N(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var r=e[0];w[r]=new N(r,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){w[e]=new N(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){w[e]=new N(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){w[e]=new N(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){w[e]=new N(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){w[e]=new N(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){w[e]=new N(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){w[e]=new N(e,5,!1,e.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function P(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var r=e.replace(S,P);w[r]=new N(r,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var r=e.replace(S,P);w[r]=new N(r,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var r=e.replace(S,P);w[r]=new N(r,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){w[e]=new N(e,1,!1,e.toLowerCase(),null,!1,!1)}),w.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){w[e]=new N(e,1,!1,e.toLowerCase(),null,!0,!0)});function j(e,r,s,i){var d=w.hasOwnProperty(r)?w[r]:null;(d!==null?d.type!==0:i||!(2A||d[b]!==m[A]){var O=` -`+d[b].replace(" at new "," at ");return e.displayName&&O.includes("")&&(O=O.replace("",e.displayName)),O}while(1<=b&&0<=A);break}}}finally{X=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?L(e):""}function ve(e){switch(e.tag){case 5:return L(e.type);case 16:return L("Lazy");case 13:return L("Suspense");case 19:return L("SuspenseList");case 0:case 2:case 15:return e=ae(e.type,!1),e;case 11:return e=ae(e.type.render,!1),e;case 1:return e=ae(e.type,!0),e;default:return""}}function pe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case V:return"Portal";case z:return"Profiler";case T:return"StrictMode";case ce:return"Suspense";case G:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ue:return(e.displayName||"Context")+".Consumer";case q:return(e._context.displayName||"Context")+".Provider";case ee:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return r=e.displayName||null,r!==null?r:pe(e.type)||"Memo";case te:r=e._payload,e=e._init;try{return pe(e(r))}catch{}}return null}function le(e){var r=e.type;switch(e.tag){case 24:return"Cache";case 9:return(r.displayName||"Context")+".Consumer";case 10:return(r._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=r.render,e=e.displayName||e.name||"",r.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return r;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return pe(r);case 8:return r===T?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r}return null}function ye(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function D(e){var r=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function fe(e){var r=D(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,r),i=""+e[r];if(!e.hasOwnProperty(r)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var d=s.get,m=s.set;return Object.defineProperty(e,r,{configurable:!0,get:function(){return d.call(this)},set:function(b){i=""+b,m.call(this,b)}}),Object.defineProperty(e,r,{enumerable:s.enumerable}),{getValue:function(){return i},setValue:function(b){i=""+b},stopTracking:function(){e._valueTracker=null,delete e[r]}}}}function F(e){e._valueTracker||(e._valueTracker=fe(e))}function re(e){if(!e)return!1;var r=e._valueTracker;if(!r)return!0;var s=r.getValue(),i="";return e&&(i=D(e)?e.checked?"true":"false":e.value),e=i,e!==s?(r.setValue(e),!0):!1}function je(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function xe(e,r){var s=r.checked;return H({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Oe(e,r){var s=r.defaultValue==null?"":r.defaultValue,i=r.checked!=null?r.checked:r.defaultChecked;s=ye(r.value!=null?r.value:s),e._wrapperState={initialChecked:i,initialValue:s,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function Xe(e,r){r=r.checked,r!=null&&j(e,"checked",r,!1)}function Be(e,r){Xe(e,r);var s=ye(r.value),i=r.type;if(s!=null)i==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(i==="submit"||i==="reset"){e.removeAttribute("value");return}r.hasOwnProperty("value")?Ft(e,r.type,s):r.hasOwnProperty("defaultValue")&&Ft(e,r.type,ye(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(e.defaultChecked=!!r.defaultChecked)}function Ct(e,r,s){if(r.hasOwnProperty("value")||r.hasOwnProperty("defaultValue")){var i=r.type;if(!(i!=="submit"&&i!=="reset"||r.value!==void 0&&r.value!==null))return;r=""+e._wrapperState.initialValue,s||r===e.value||(e.value=r),e.defaultValue=r}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function Ft(e,r,s){(r!=="number"||je(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var In=Array.isArray;function qr(e,r,s,i){if(e=e.options,r){r={};for(var d=0;d"+r.valueOf().toString()+"",r=We.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;r.firstChild;)e.appendChild(r.firstChild)}});function or(e,r){if(r){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=r;return}}e.textContent=r}var An={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},a0=["Webkit","ms","Moz","O"];Object.keys(An).forEach(function(e){a0.forEach(function(r){r=r+e.charAt(0).toUpperCase()+e.substring(1),An[r]=An[e]})});function hu(e,r,s){return r==null||typeof r=="boolean"||r===""?"":s||typeof r!="number"||r===0||An.hasOwnProperty(e)&&An[e]?(""+r).trim():r+"px"}function mu(e,r){e=e.style;for(var s in r)if(r.hasOwnProperty(s)){var i=s.indexOf("--")===0,d=hu(s,r[s],i);s==="float"&&(s="cssFloat"),i?e.setProperty(s,d):e[s]=d}}var l0=H({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ji(e,r){if(r){if(l0[e]&&(r.children!=null||r.dangerouslySetInnerHTML!=null))throw Error(l(137,e));if(r.dangerouslySetInnerHTML!=null){if(r.children!=null)throw Error(l(60));if(typeof r.dangerouslySetInnerHTML!="object"||!("__html"in r.dangerouslySetInnerHTML))throw Error(l(61))}if(r.style!=null&&typeof r.style!="object")throw Error(l(62))}}function Zi(e,r){if(e.indexOf("-")===-1)return typeof r.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var eo=null;function to(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ro=null,as=null,ls=null;function pu(e){if(e=ja(e)){if(typeof ro!="function")throw Error(l(280));var r=e.stateNode;r&&(r=xl(r),ro(e.stateNode,e.type,r))}}function xu(e){as?ls?ls.push(e):ls=[e]:as=e}function gu(){if(as){var e=as,r=ls;if(ls=as=null,pu(e),r)for(e=0;e>>=0,e===0?32:31-(g0(e)/v0|0)|0}var Ja=64,Za=4194304;function ra(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function el(e,r){var s=e.pendingLanes;if(s===0)return 0;var i=0,d=e.suspendedLanes,m=e.pingedLanes,b=s&268435455;if(b!==0){var A=b&~d;A!==0?i=ra(A):(m&=b,m!==0&&(i=ra(m)))}else b=s&~d,b!==0?i=ra(b):m!==0&&(i=ra(m));if(i===0)return 0;if(r!==0&&r!==i&&(r&d)===0&&(d=i&-i,m=r&-r,d>=m||d===16&&(m&4194240)!==0))return r;if((i&4)!==0&&(i|=s&16),r=e.entangledLanes,r!==0)for(e=e.entanglements,r&=i;0s;s++)r.push(e);return r}function na(e,r,s){e.pendingLanes|=r,r!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,r=31-cr(r),e[r]=s}function b0(e,r){var s=e.pendingLanes&~r;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=r,e.mutableReadLanes&=r,e.entangledLanes&=r,r=e.entanglements;var i=e.eventTimes;for(e=e.expirationTimes;0=ua),Hu=" ",Ku=!1;function Gu(e,r){switch(e){case"keyup":return q0.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var cs=!1;function J0(e,r){switch(e){case"compositionend":return Yu(r);case"keypress":return r.which!==32?null:(Ku=!0,Hu);case"textInput":return e=r.data,e===Hu&&Ku?null:e;default:return null}}function Z0(e,r){if(cs)return e==="compositionend"||!No&&Gu(e,r)?(e=zu(),al=po=tn=null,cs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1=r)return{node:s,offset:r-e};e=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=tf(s)}}function nf(e,r){return e&&r?e===r?!0:e&&e.nodeType===3?!1:r&&r.nodeType===3?nf(e,r.parentNode):"contains"in e?e.contains(r):e.compareDocumentPosition?!!(e.compareDocumentPosition(r)&16):!1:!1}function sf(){for(var e=window,r=je();r instanceof e.HTMLIFrameElement;){try{var s=typeof r.contentWindow.location.href=="string"}catch{s=!1}if(s)e=r.contentWindow;else break;r=je(e.document)}return r}function So(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r&&(r==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||r==="textarea"||e.contentEditable==="true")}function ov(e){var r=sf(),s=e.focusedElem,i=e.selectionRange;if(r!==s&&s&&s.ownerDocument&&nf(s.ownerDocument.documentElement,s)){if(i!==null&&So(s)){if(r=i.start,e=i.end,e===void 0&&(e=r),"selectionStart"in s)s.selectionStart=r,s.selectionEnd=Math.min(e,s.value.length);else if(e=(r=s.ownerDocument||document)&&r.defaultView||window,e.getSelection){e=e.getSelection();var d=s.textContent.length,m=Math.min(i.start,d);i=i.end===void 0?m:Math.min(i.end,d),!e.extend&&m>i&&(d=i,i=m,m=d),d=rf(s,m);var b=rf(s,i);d&&b&&(e.rangeCount!==1||e.anchorNode!==d.node||e.anchorOffset!==d.offset||e.focusNode!==b.node||e.focusOffset!==b.offset)&&(r=r.createRange(),r.setStart(d.node,d.offset),e.removeAllRanges(),m>i?(e.addRange(r),e.extend(b.node,b.offset)):(r.setEnd(b.node,b.offset),e.addRange(r)))}}for(r=[],e=s;e=e.parentNode;)e.nodeType===1&&r.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,ds=null,Co=null,pa=null,ko=!1;function af(e,r,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;ko||ds==null||ds!==je(i)||(i=ds,"selectionStart"in i&&So(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),pa&&ma(pa,i)||(pa=i,i=hl(Co,"onSelect"),0ps||(e.current=Fo[ps],Fo[ps]=null,ps--)}function Je(e,r){ps++,Fo[ps]=e.current,e.current=r}var an={},kt=sn(an),zt=sn(!1),Ln=an;function xs(e,r){var s=e.type.contextTypes;if(!s)return an;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===r)return i.__reactInternalMemoizedMaskedChildContext;var d={},m;for(m in s)d[m]=r[m];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=d),d}function $t(e){return e=e.childContextTypes,e!=null}function gl(){tt(zt),tt(kt)}function Nf(e,r,s){if(kt.current!==an)throw Error(l(168));Je(kt,r),Je(zt,s)}function bf(e,r,s){var i=e.stateNode;if(r=r.childContextTypes,typeof i.getChildContext!="function")return s;i=i.getChildContext();for(var d in i)if(!(d in r))throw Error(l(108,le(e)||"Unknown",d));return H({},s,i)}function vl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||an,Ln=kt.current,Je(kt,e),Je(zt,zt.current),!0}function wf(e,r,s){var i=e.stateNode;if(!i)throw Error(l(169));s?(e=bf(e,r,Ln),i.__reactInternalMemoizedMergedChildContext=e,tt(zt),tt(kt),Je(kt,e)):tt(zt),Je(zt,s)}var Mr=null,yl=!1,zo=!1;function Sf(e){Mr===null?Mr=[e]:Mr.push(e)}function jv(e){yl=!0,Sf(e)}function ln(){if(!zo&&Mr!==null){zo=!0;var e=0,r=qe;try{var s=Mr;for(qe=1;e>=b,d-=b,Dr=1<<32-cr(r)+d|s<Me?(yt=Ae,Ae=null):yt=Ae.sibling;var Ge=oe(W,Ae,K[Me],me);if(Ge===null){Ae===null&&(Ae=yt);break}e&&Ae&&Ge.alternate===null&&r(W,Ae),$=m(Ge,$,Me),Ie===null?Pe=Ge:Ie.sibling=Ge,Ie=Ge,Ae=yt}if(Me===K.length)return s(W,Ae),rt&&Fn(W,Me),Pe;if(Ae===null){for(;MeMe?(yt=Ae,Ae=null):yt=Ae.sibling;var xn=oe(W,Ae,Ge.value,me);if(xn===null){Ae===null&&(Ae=yt);break}e&&Ae&&xn.alternate===null&&r(W,Ae),$=m(xn,$,Me),Ie===null?Pe=xn:Ie.sibling=xn,Ie=xn,Ae=yt}if(Ge.done)return s(W,Ae),rt&&Fn(W,Me),Pe;if(Ae===null){for(;!Ge.done;Me++,Ge=K.next())Ge=he(W,Ge.value,me),Ge!==null&&($=m(Ge,$,Me),Ie===null?Pe=Ge:Ie.sibling=Ge,Ie=Ge);return rt&&Fn(W,Me),Pe}for(Ae=i(W,Ae);!Ge.done;Me++,Ge=K.next())Ge=ge(Ae,W,Me,Ge.value,me),Ge!==null&&(e&&Ge.alternate!==null&&Ae.delete(Ge.key===null?Me:Ge.key),$=m(Ge,$,Me),Ie===null?Pe=Ge:Ie.sibling=Ge,Ie=Ge);return e&&Ae.forEach(function(ey){return r(W,ey)}),rt&&Fn(W,Me),Pe}function dt(W,$,K,me){if(typeof K=="object"&&K!==null&&K.type===E&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case B:e:{for(var Pe=K.key,Ie=$;Ie!==null;){if(Ie.key===Pe){if(Pe=K.type,Pe===E){if(Ie.tag===7){s(W,Ie.sibling),$=d(Ie,K.props.children),$.return=W,W=$;break e}}else if(Ie.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===te&&Tf(Pe)===Ie.type){s(W,Ie.sibling),$=d(Ie,K.props),$.ref=Na(W,Ie,K),$.return=W,W=$;break e}s(W,Ie);break}else r(W,Ie);Ie=Ie.sibling}K.type===E?($=Kn(K.props.children,W.mode,me,K.key),$.return=W,W=$):(me=Gl(K.type,K.key,K.props,null,W.mode,me),me.ref=Na(W,$,K),me.return=W,W=me)}return b(W);case V:e:{for(Ie=K.key;$!==null;){if($.key===Ie)if($.tag===4&&$.stateNode.containerInfo===K.containerInfo&&$.stateNode.implementation===K.implementation){s(W,$.sibling),$=d($,K.children||[]),$.return=W,W=$;break e}else{s(W,$);break}else r(W,$);$=$.sibling}$=Lc(K,W.mode,me),$.return=W,W=$}return b(W);case te:return Ie=K._init,dt(W,$,Ie(K._payload),me)}if(In(K))return we(W,$,K,me);if(Q(K))return Ee(W,$,K,me);wl(W,K)}return typeof K=="string"&&K!==""||typeof K=="number"?(K=""+K,$!==null&&$.tag===6?(s(W,$.sibling),$=d($,K),$.return=W,W=$):(s(W,$),$=Dc(K,W.mode,me),$.return=W,W=$),b(W)):s(W,$)}return dt}var js=_f(!0),If=_f(!1),Sl=sn(null),Cl=null,Ns=null,Ho=null;function Ko(){Ho=Ns=Cl=null}function Go(e){var r=Sl.current;tt(Sl),e._currentValue=r}function Yo(e,r,s){for(;e!==null;){var i=e.alternate;if((e.childLanes&r)!==r?(e.childLanes|=r,i!==null&&(i.childLanes|=r)):i!==null&&(i.childLanes&r)!==r&&(i.childLanes|=r),e===s)break;e=e.return}}function bs(e,r){Cl=e,Ho=Ns=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&r)!==0&&(Bt=!0),e.firstContext=null)}function tr(e){var r=e._currentValue;if(Ho!==e)if(e={context:e,memoizedValue:r,next:null},Ns===null){if(Cl===null)throw Error(l(308));Ns=e,Cl.dependencies={lanes:0,firstContext:e}}else Ns=Ns.next=e;return r}var zn=null;function Qo(e){zn===null?zn=[e]:zn.push(e)}function Af(e,r,s,i){var d=r.interleaved;return d===null?(s.next=s,Qo(r)):(s.next=d.next,d.next=s),r.interleaved=s,Or(e,i)}function Or(e,r){e.lanes|=r;var s=e.alternate;for(s!==null&&(s.lanes|=r),s=e,e=e.return;e!==null;)e.childLanes|=r,s=e.alternate,s!==null&&(s.childLanes|=r),s=e,e=e.return;return s.tag===3?s.stateNode:null}var on=!1;function qo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mf(e,r){e=e.updateQueue,r.updateQueue===e&&(r.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Fr(e,r){return{eventTime:e,lane:r,tag:0,payload:null,callback:null,next:null}}function cn(e,r,s){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(He&2)!==0){var d=i.pending;return d===null?r.next=r:(r.next=d.next,d.next=r),i.pending=r,Or(e,s)}return d=i.interleaved,d===null?(r.next=r,Qo(i)):(r.next=d.next,d.next=r),i.interleaved=r,Or(e,s)}function kl(e,r,s){if(r=r.updateQueue,r!==null&&(r=r.shared,(s&4194240)!==0)){var i=r.lanes;i&=e.pendingLanes,s|=i,r.lanes=s,co(e,s)}}function Df(e,r){var s=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,s===i)){var d=null,m=null;if(s=s.firstBaseUpdate,s!==null){do{var b={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};m===null?d=m=b:m=m.next=b,s=s.next}while(s!==null);m===null?d=m=r:m=m.next=r}else d=m=r;s={baseState:i.baseState,firstBaseUpdate:d,lastBaseUpdate:m,shared:i.shared,effects:i.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=r:e.next=r,s.lastBaseUpdate=r}function El(e,r,s,i){var d=e.updateQueue;on=!1;var m=d.firstBaseUpdate,b=d.lastBaseUpdate,A=d.shared.pending;if(A!==null){d.shared.pending=null;var O=A,Y=O.next;O.next=null,b===null?m=Y:b.next=Y,b=O;var de=e.alternate;de!==null&&(de=de.updateQueue,A=de.lastBaseUpdate,A!==b&&(A===null?de.firstBaseUpdate=Y:A.next=Y,de.lastBaseUpdate=O))}if(m!==null){var he=d.baseState;b=0,de=Y=O=null,A=m;do{var oe=A.lane,ge=A.eventTime;if((i&oe)===oe){de!==null&&(de=de.next={eventTime:ge,lane:0,tag:A.tag,payload:A.payload,callback:A.callback,next:null});e:{var we=e,Ee=A;switch(oe=r,ge=s,Ee.tag){case 1:if(we=Ee.payload,typeof we=="function"){he=we.call(ge,he,oe);break e}he=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Ee.payload,oe=typeof we=="function"?we.call(ge,he,oe):we,oe==null)break e;he=H({},he,oe);break e;case 2:on=!0}}A.callback!==null&&A.lane!==0&&(e.flags|=64,oe=d.effects,oe===null?d.effects=[A]:oe.push(A))}else ge={eventTime:ge,lane:oe,tag:A.tag,payload:A.payload,callback:A.callback,next:null},de===null?(Y=de=ge,O=he):de=de.next=ge,b|=oe;if(A=A.next,A===null){if(A=d.shared.pending,A===null)break;oe=A,A=oe.next,oe.next=null,d.lastBaseUpdate=oe,d.shared.pending=null}}while(!0);if(de===null&&(O=he),d.baseState=O,d.firstBaseUpdate=Y,d.lastBaseUpdate=de,r=d.shared.interleaved,r!==null){d=r;do b|=d.lane,d=d.next;while(d!==r)}else m===null&&(d.shared.lanes=0);Un|=b,e.lanes=b,e.memoizedState=he}}function Lf(e,r,s){if(e=r.effects,r.effects=null,e!==null)for(r=0;rs?s:4,e(!0);var i=tc.transition;tc.transition={};try{e(!1),r()}finally{qe=s,tc.transition=i}}function th(){return rr().memoizedState}function Sv(e,r,s){var i=hn(e);if(s={lane:i,action:s,hasEagerState:!1,eagerState:null,next:null},rh(e))nh(r,s);else if(s=Af(e,r,s,i),s!==null){var d=At();pr(s,e,i,d),sh(s,r,i)}}function Cv(e,r,s){var i=hn(e),d={lane:i,action:s,hasEagerState:!1,eagerState:null,next:null};if(rh(e))nh(r,d);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=r.lastRenderedReducer,m!==null))try{var b=r.lastRenderedState,A=m(b,s);if(d.hasEagerState=!0,d.eagerState=A,dr(A,b)){var O=r.interleaved;O===null?(d.next=d,Qo(r)):(d.next=O.next,O.next=d),r.interleaved=d;return}}catch{}finally{}s=Af(e,r,d,i),s!==null&&(d=At(),pr(s,e,i,d),sh(s,r,i))}}function rh(e){var r=e.alternate;return e===lt||r!==null&&r===lt}function nh(e,r){Ca=Tl=!0;var s=e.pending;s===null?r.next=r:(r.next=s.next,s.next=r),e.pending=r}function sh(e,r,s){if((s&4194240)!==0){var i=r.lanes;i&=e.pendingLanes,s|=i,r.lanes=s,co(e,s)}}var Al={readContext:tr,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useInsertionEffect:Et,useLayoutEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useMutableSource:Et,useSyncExternalStore:Et,useId:Et,unstable_isNewReconciler:!1},kv={readContext:tr,useCallback:function(e,r){return Cr().memoizedState=[e,r===void 0?null:r],e},useContext:tr,useEffect:Gf,useImperativeHandle:function(e,r,s){return s=s!=null?s.concat([e]):null,_l(4194308,4,qf.bind(null,r,e),s)},useLayoutEffect:function(e,r){return _l(4194308,4,e,r)},useInsertionEffect:function(e,r){return _l(4,2,e,r)},useMemo:function(e,r){var s=Cr();return r=r===void 0?null:r,e=e(),s.memoizedState=[e,r],e},useReducer:function(e,r,s){var i=Cr();return r=s!==void 0?s(r):r,i.memoizedState=i.baseState=r,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},i.queue=e,e=e.dispatch=Sv.bind(null,lt,e),[i.memoizedState,e]},useRef:function(e){var r=Cr();return e={current:e},r.memoizedState=e},useState:Hf,useDebugValue:oc,useDeferredValue:function(e){return Cr().memoizedState=e},useTransition:function(){var e=Hf(!1),r=e[0];return e=wv.bind(null,e[1]),Cr().memoizedState=e,[r,e]},useMutableSource:function(){},useSyncExternalStore:function(e,r,s){var i=lt,d=Cr();if(rt){if(s===void 0)throw Error(l(407));s=s()}else{if(s=r(),vt===null)throw Error(l(349));(Bn&30)!==0||$f(i,r,s)}d.memoizedState=s;var m={value:s,getSnapshot:r};return d.queue=m,Gf(Uf.bind(null,i,m,e),[e]),i.flags|=2048,Pa(9,Bf.bind(null,i,m,s,r),void 0,null),s},useId:function(){var e=Cr(),r=vt.identifierPrefix;if(rt){var s=Lr,i=Dr;s=(i&~(1<<32-cr(i)-1)).toString(32)+s,r=":"+r+"R"+s,s=ka++,0<\/script>",e=e.removeChild(e.firstChild)):typeof i.is=="string"?e=b.createElement(s,{is:i.is}):(e=b.createElement(s),s==="select"&&(b=e,i.multiple?b.multiple=!0:i.size&&(b.size=i.size))):e=b.createElementNS(e,s),e[wr]=r,e[ya]=i,Sh(e,r,!1,!1),r.stateNode=e;e:{switch(b=Zi(s,i),s){case"dialog":et("cancel",e),et("close",e),d=i;break;case"iframe":case"object":case"embed":et("load",e),d=i;break;case"video":case"audio":for(d=0;dEs&&(r.flags|=128,i=!0,Ra(m,!1),r.lanes=4194304)}else{if(!i)if(e=Pl(b),e!==null){if(r.flags|=128,i=!0,s=e.updateQueue,s!==null&&(r.updateQueue=s,r.flags|=4),Ra(m,!0),m.tail===null&&m.tailMode==="hidden"&&!b.alternate&&!rt)return Pt(r),null}else 2*ct()-m.renderingStartTime>Es&&s!==1073741824&&(r.flags|=128,i=!0,Ra(m,!1),r.lanes=4194304);m.isBackwards?(b.sibling=r.child,r.child=b):(s=m.last,s!==null?s.sibling=b:r.child=b,m.last=b)}return m.tail!==null?(r=m.tail,m.rendering=r,m.tail=r.sibling,m.renderingStartTime=ct(),r.sibling=null,s=at.current,Je(at,i?s&1|2:s&1),r):(Pt(r),null);case 22:case 23:return Ic(),i=r.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(r.flags|=8192),i&&(r.mode&1)!==0?(qt&1073741824)!==0&&(Pt(r),r.subtreeFlags&6&&(r.flags|=8192)):Pt(r),null;case 24:return null;case 25:return null}throw Error(l(156,r.tag))}function Mv(e,r){switch(Bo(r),r.tag){case 1:return $t(r.type)&&gl(),e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 3:return ws(),tt(zt),tt(kt),ec(),e=r.flags,(e&65536)!==0&&(e&128)===0?(r.flags=e&-65537|128,r):null;case 5:return Jo(r),null;case 13:if(tt(at),e=r.memoizedState,e!==null&&e.dehydrated!==null){if(r.alternate===null)throw Error(l(340));ys()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 19:return tt(at),null;case 4:return ws(),null;case 10:return Go(r.type._context),null;case 22:case 23:return Ic(),null;case 24:return null;default:return null}}var Ol=!1,Rt=!1,Dv=typeof WeakSet=="function"?WeakSet:Set,Ne=null;function Cs(e,r){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(i){it(e,r,i)}else s.current=null}function jc(e,r,s){try{s()}catch(i){it(e,r,i)}}var Eh=!1;function Lv(e,r){if(Io=nl,e=sf(),So(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var i=s.getSelection&&s.getSelection();if(i&&i.rangeCount!==0){s=i.anchorNode;var d=i.anchorOffset,m=i.focusNode;i=i.focusOffset;try{s.nodeType,m.nodeType}catch{s=null;break e}var b=0,A=-1,O=-1,Y=0,de=0,he=e,oe=null;t:for(;;){for(var ge;he!==s||d!==0&&he.nodeType!==3||(A=b+d),he!==m||i!==0&&he.nodeType!==3||(O=b+i),he.nodeType===3&&(b+=he.nodeValue.length),(ge=he.firstChild)!==null;)oe=he,he=ge;for(;;){if(he===e)break t;if(oe===s&&++Y===d&&(A=b),oe===m&&++de===i&&(O=b),(ge=he.nextSibling)!==null)break;he=oe,oe=he.parentNode}he=ge}s=A===-1||O===-1?null:{start:A,end:O}}else s=null}s=s||{start:0,end:0}}else s=null;for(Ao={focusedElem:e,selectionRange:s},nl=!1,Ne=r;Ne!==null;)if(r=Ne,e=r.child,(r.subtreeFlags&1028)!==0&&e!==null)e.return=r,Ne=e;else for(;Ne!==null;){r=Ne;try{var we=r.alternate;if((r.flags&1024)!==0)switch(r.tag){case 0:case 11:case 15:break;case 1:if(we!==null){var Ee=we.memoizedProps,dt=we.memoizedState,W=r.stateNode,$=W.getSnapshotBeforeUpdate(r.elementType===r.type?Ee:fr(r.type,Ee),dt);W.__reactInternalSnapshotBeforeUpdate=$}break;case 3:var K=r.stateNode.containerInfo;K.nodeType===1?K.textContent="":K.nodeType===9&&K.documentElement&&K.removeChild(K.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(l(163))}}catch(me){it(r,r.return,me)}if(e=r.sibling,e!==null){e.return=r.return,Ne=e;break}Ne=r.return}return we=Eh,Eh=!1,we}function Ta(e,r,s){var i=r.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var d=i=i.next;do{if((d.tag&e)===e){var m=d.destroy;d.destroy=void 0,m!==void 0&&jc(r,s,m)}d=d.next}while(d!==i)}}function Fl(e,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.create;s.destroy=i()}s=s.next}while(s!==r)}}function Nc(e){var r=e.ref;if(r!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof r=="function"?r(e):r.current=e}}function Ph(e){var r=e.alternate;r!==null&&(e.alternate=null,Ph(r)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(r=e.stateNode,r!==null&&(delete r[wr],delete r[ya],delete r[Oo],delete r[vv],delete r[yv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Rh(e){return e.tag===5||e.tag===3||e.tag===4}function Th(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function bc(e,r,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,r?s.nodeType===8?s.parentNode.insertBefore(e,r):s.insertBefore(e,r):(s.nodeType===8?(r=s.parentNode,r.insertBefore(e,s)):(r=s,r.appendChild(e)),s=s._reactRootContainer,s!=null||r.onclick!==null||(r.onclick=pl));else if(i!==4&&(e=e.child,e!==null))for(bc(e,r,s),e=e.sibling;e!==null;)bc(e,r,s),e=e.sibling}function wc(e,r,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,r?s.insertBefore(e,r):s.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(wc(e,r,s),e=e.sibling;e!==null;)wc(e,r,s),e=e.sibling}var bt=null,hr=!1;function dn(e,r,s){for(s=s.child;s!==null;)_h(e,r,s),s=s.sibling}function _h(e,r,s){if(br&&typeof br.onCommitFiberUnmount=="function")try{br.onCommitFiberUnmount(Xa,s)}catch{}switch(s.tag){case 5:Rt||Cs(s,r);case 6:var i=bt,d=hr;bt=null,dn(e,r,s),bt=i,hr=d,bt!==null&&(hr?(e=bt,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):bt.removeChild(s.stateNode));break;case 18:bt!==null&&(hr?(e=bt,s=s.stateNode,e.nodeType===8?Lo(e.parentNode,s):e.nodeType===1&&Lo(e,s),oa(e)):Lo(bt,s.stateNode));break;case 4:i=bt,d=hr,bt=s.stateNode.containerInfo,hr=!0,dn(e,r,s),bt=i,hr=d;break;case 0:case 11:case 14:case 15:if(!Rt&&(i=s.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){d=i=i.next;do{var m=d,b=m.destroy;m=m.tag,b!==void 0&&((m&2)!==0||(m&4)!==0)&&jc(s,r,b),d=d.next}while(d!==i)}dn(e,r,s);break;case 1:if(!Rt&&(Cs(s,r),i=s.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=s.memoizedProps,i.state=s.memoizedState,i.componentWillUnmount()}catch(A){it(s,r,A)}dn(e,r,s);break;case 21:dn(e,r,s);break;case 22:s.mode&1?(Rt=(i=Rt)||s.memoizedState!==null,dn(e,r,s),Rt=i):dn(e,r,s);break;default:dn(e,r,s)}}function Ih(e){var r=e.updateQueue;if(r!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Dv),r.forEach(function(i){var d=Hv.bind(null,e,i);s.has(i)||(s.add(i),i.then(d,d))})}}function mr(e,r){var s=r.deletions;if(s!==null)for(var i=0;id&&(d=b),i&=~m}if(i=d,i=ct()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Fv(i/1960))-i,10e?16:e,fn===null)var i=!1;else{if(e=fn,fn=null,Vl=0,(He&6)!==0)throw Error(l(331));var d=He;for(He|=4,Ne=e.current;Ne!==null;){var m=Ne,b=m.child;if((Ne.flags&16)!==0){var A=m.deletions;if(A!==null){for(var O=0;Oct()-kc?Wn(e,0):Cc|=s),Vt(e,r)}function Hh(e,r){r===0&&((e.mode&1)===0?r=1:(r=Za,Za<<=1,(Za&130023424)===0&&(Za=4194304)));var s=At();e=Or(e,r),e!==null&&(na(e,r,s),Vt(e,s))}function Wv(e){var r=e.memoizedState,s=0;r!==null&&(s=r.retryLane),Hh(e,s)}function Hv(e,r){var s=0;switch(e.tag){case 13:var i=e.stateNode,d=e.memoizedState;d!==null&&(s=d.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(l(314))}i!==null&&i.delete(r),Hh(e,s)}var Kh;Kh=function(e,r,s){if(e!==null)if(e.memoizedProps!==r.pendingProps||zt.current)Bt=!0;else{if((e.lanes&s)===0&&(r.flags&128)===0)return Bt=!1,Iv(e,r,s);Bt=(e.flags&131072)!==0}else Bt=!1,rt&&(r.flags&1048576)!==0&&Cf(r,Nl,r.index);switch(r.lanes=0,r.tag){case 2:var i=r.type;Ll(e,r),e=r.pendingProps;var d=xs(r,kt.current);bs(r,s),d=nc(null,r,i,e,d,s);var m=sc();return r.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(r.tag=1,r.memoizedState=null,r.updateQueue=null,$t(i)?(m=!0,vl(r)):m=!1,r.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,qo(r),d.updater=Ml,r.stateNode=d,d._reactInternals=r,dc(r,i,e,s),r=mc(null,r,i,!0,m,s)):(r.tag=0,rt&&m&&$o(r),It(null,r,d,s),r=r.child),r;case 16:i=r.elementType;e:{switch(Ll(e,r),e=r.pendingProps,d=i._init,i=d(i._payload),r.type=i,d=r.tag=Gv(i),e=fr(i,e),d){case 0:r=hc(null,r,i,e,s);break e;case 1:r=vh(null,r,i,e,s);break e;case 11:r=hh(null,r,i,e,s);break e;case 14:r=mh(null,r,i,fr(i.type,e),s);break e}throw Error(l(306,i,""))}return r;case 0:return i=r.type,d=r.pendingProps,d=r.elementType===i?d:fr(i,d),hc(e,r,i,d,s);case 1:return i=r.type,d=r.pendingProps,d=r.elementType===i?d:fr(i,d),vh(e,r,i,d,s);case 3:e:{if(yh(r),e===null)throw Error(l(387));i=r.pendingProps,m=r.memoizedState,d=m.element,Mf(e,r),El(r,i,null,s);var b=r.memoizedState;if(i=b.element,m.isDehydrated)if(m={element:i,isDehydrated:!1,cache:b.cache,pendingSuspenseBoundaries:b.pendingSuspenseBoundaries,transitions:b.transitions},r.updateQueue.baseState=m,r.memoizedState=m,r.flags&256){d=Ss(Error(l(423)),r),r=jh(e,r,i,s,d);break e}else if(i!==d){d=Ss(Error(l(424)),r),r=jh(e,r,i,s,d);break e}else for(Qt=nn(r.stateNode.containerInfo.firstChild),Yt=r,rt=!0,ur=null,s=If(r,null,i,s),r.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(ys(),i===d){r=zr(e,r,s);break e}It(e,r,i,s)}r=r.child}return r;case 5:return Of(r),e===null&&Vo(r),i=r.type,d=r.pendingProps,m=e!==null?e.memoizedProps:null,b=d.children,Mo(i,d)?b=null:m!==null&&Mo(i,m)&&(r.flags|=32),gh(e,r),It(e,r,b,s),r.child;case 6:return e===null&&Vo(r),null;case 13:return Nh(e,r,s);case 4:return Xo(r,r.stateNode.containerInfo),i=r.pendingProps,e===null?r.child=js(r,null,i,s):It(e,r,i,s),r.child;case 11:return i=r.type,d=r.pendingProps,d=r.elementType===i?d:fr(i,d),hh(e,r,i,d,s);case 7:return It(e,r,r.pendingProps,s),r.child;case 8:return It(e,r,r.pendingProps.children,s),r.child;case 12:return It(e,r,r.pendingProps.children,s),r.child;case 10:e:{if(i=r.type._context,d=r.pendingProps,m=r.memoizedProps,b=d.value,Je(Sl,i._currentValue),i._currentValue=b,m!==null)if(dr(m.value,b)){if(m.children===d.children&&!zt.current){r=zr(e,r,s);break e}}else for(m=r.child,m!==null&&(m.return=r);m!==null;){var A=m.dependencies;if(A!==null){b=m.child;for(var O=A.firstContext;O!==null;){if(O.context===i){if(m.tag===1){O=Fr(-1,s&-s),O.tag=2;var Y=m.updateQueue;if(Y!==null){Y=Y.shared;var de=Y.pending;de===null?O.next=O:(O.next=de.next,de.next=O),Y.pending=O}}m.lanes|=s,O=m.alternate,O!==null&&(O.lanes|=s),Yo(m.return,s,r),A.lanes|=s;break}O=O.next}}else if(m.tag===10)b=m.type===r.type?null:m.child;else if(m.tag===18){if(b=m.return,b===null)throw Error(l(341));b.lanes|=s,A=b.alternate,A!==null&&(A.lanes|=s),Yo(b,s,r),b=m.sibling}else b=m.child;if(b!==null)b.return=m;else for(b=m;b!==null;){if(b===r){b=null;break}if(m=b.sibling,m!==null){m.return=b.return,b=m;break}b=b.return}m=b}It(e,r,d.children,s),r=r.child}return r;case 9:return d=r.type,i=r.pendingProps.children,bs(r,s),d=tr(d),i=i(d),r.flags|=1,It(e,r,i,s),r.child;case 14:return i=r.type,d=fr(i,r.pendingProps),d=fr(i.type,d),mh(e,r,i,d,s);case 15:return ph(e,r,r.type,r.pendingProps,s);case 17:return i=r.type,d=r.pendingProps,d=r.elementType===i?d:fr(i,d),Ll(e,r),r.tag=1,$t(i)?(e=!0,vl(r)):e=!1,bs(r,s),lh(r,i,d),dc(r,i,d,s),mc(null,r,i,!0,e,s);case 19:return wh(e,r,s);case 22:return xh(e,r,s)}throw Error(l(156,r.tag))};function Gh(e,r){return Cu(e,r)}function Kv(e,r,s,i){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function sr(e,r,s,i){return new Kv(e,r,s,i)}function Mc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Gv(e){if(typeof e=="function")return Mc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ee)return 11;if(e===Z)return 14}return 2}function pn(e,r){var s=e.alternate;return s===null?(s=sr(e.tag,r,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=r,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,r=e.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Gl(e,r,s,i,d,m){var b=2;if(i=e,typeof e=="function")Mc(e)&&(b=1);else if(typeof e=="string")b=5;else e:switch(e){case E:return Kn(s.children,d,m,r);case T:b=8,d|=8;break;case z:return e=sr(12,s,r,d|2),e.elementType=z,e.lanes=m,e;case ce:return e=sr(13,s,r,d),e.elementType=ce,e.lanes=m,e;case G:return e=sr(19,s,r,d),e.elementType=G,e.lanes=m,e;case U:return Yl(s,d,m,r);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case q:b=10;break e;case ue:b=9;break e;case ee:b=11;break e;case Z:b=14;break e;case te:b=16,i=null;break e}throw Error(l(130,e==null?e:typeof e,""))}return r=sr(b,s,r,d),r.elementType=e,r.type=i,r.lanes=m,r}function Kn(e,r,s,i){return e=sr(7,e,i,r),e.lanes=s,e}function Yl(e,r,s,i){return e=sr(22,e,i,r),e.elementType=U,e.lanes=s,e.stateNode={isHidden:!1},e}function Dc(e,r,s){return e=sr(6,e,null,r),e.lanes=s,e}function Lc(e,r,s){return r=sr(4,e.children!==null?e.children:[],e.key,r),r.lanes=s,r.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},r}function Yv(e,r,s,i,d){this.tag=r,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=oo(0),this.expirationTimes=oo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=oo(0),this.identifierPrefix=i,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function Oc(e,r,s,i,d,m,b,A,O){return e=new Yv(e,r,s,A,O),r===1?(r=1,m===!0&&(r|=8)):r=0,m=sr(3,null,null,r),e.current=m,m.stateNode=e,m.memoizedState={element:i,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},qo(m),e}function Qv(e,r,s){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),Vc.exports=iy(),Vc.exports}var im;function oy(){if(im)return ti;im=1;var n=dp();return ti.createRoot=n.createRoot,ti.hydrateRoot=n.hydrateRoot,ti}var cy=oy(),Va=dp();const dy=cp(Va);/** - * @remix-run/router v1.23.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Fa(){return Fa=Object.assign?Object.assign.bind():function(n){for(var a=1;a"u")throw new Error(a)}function Md(n,a){if(!n){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function fy(){return Math.random().toString(36).substr(2,8)}function cm(n,a){return{usr:n.state,key:n.key,idx:a}}function dd(n,a,l,o){return l===void 0&&(l=null),Fa({pathname:typeof n=="string"?n:n.pathname,search:"",hash:""},typeof a=="string"?Bs(a):a,{state:l,key:a&&a.key||o||fy()})}function vi(n){let{pathname:a="/",search:l="",hash:o=""}=n;return l&&l!=="?"&&(a+=l.charAt(0)==="?"?l:"?"+l),o&&o!=="#"&&(a+=o.charAt(0)==="#"?o:"#"+o),a}function Bs(n){let a={};if(n){let l=n.indexOf("#");l>=0&&(a.hash=n.substr(l),n=n.substr(0,l));let o=n.indexOf("?");o>=0&&(a.search=n.substr(o),n=n.substr(0,o)),n&&(a.pathname=n)}return a}function hy(n,a,l,o){o===void 0&&(o={});let{window:c=document.defaultView,v5Compat:u=!1}=o,f=c.history,p=Nn.Pop,x=null,g=v();g==null&&(g=0,f.replaceState(Fa({},f.state,{idx:g}),""));function v(){return(f.state||{idx:null}).idx}function y(){p=Nn.Pop;let w=v(),S=w==null?null:w-g;g=w,x&&x({action:p,location:N.location,delta:S})}function k(w,S){p=Nn.Push;let P=dd(N.location,w,S);g=v()+1;let j=cm(P,g),_=N.createHref(P);try{f.pushState(j,"",_)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;c.location.assign(_)}u&&x&&x({action:p,location:N.location,delta:1})}function R(w,S){p=Nn.Replace;let P=dd(N.location,w,S);g=v();let j=cm(P,g),_=N.createHref(P);f.replaceState(j,"",_),u&&x&&x({action:p,location:N.location,delta:0})}function C(w){let S=c.location.origin!=="null"?c.location.origin:c.location.href,P=typeof w=="string"?w:vi(w);return P=P.replace(/ $/,"%20"),ut(S,"No window.location.(origin|href) available to create URL for href: "+P),new URL(P,S)}let N={get action(){return p},get location(){return n(c,f)},listen(w){if(x)throw new Error("A history only accepts one active listener");return c.addEventListener(om,y),x=w,()=>{c.removeEventListener(om,y),x=null}},createHref(w){return a(c,w)},createURL:C,encodeLocation(w){let S=C(w);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:k,replace:R,go(w){return f.go(w)}};return N}var dm;(function(n){n.data="data",n.deferred="deferred",n.redirect="redirect",n.error="error"})(dm||(dm={}));function my(n,a,l){return l===void 0&&(l="/"),py(n,a,l)}function py(n,a,l,o){let c=typeof a=="string"?Bs(a):a,u=Dd(c.pathname||"/",l);if(u==null)return null;let f=up(n);xy(f);let p=null;for(let x=0;p==null&&x{let x={relativePath:p===void 0?u.path||"":p,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};x.relativePath.startsWith("/")&&(ut(x.relativePath.startsWith(o),'Absolute route path "'+x.relativePath+'" nested under path '+('"'+o+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),x.relativePath=x.relativePath.slice(o.length));let g=bn([o,x.relativePath]),v=l.concat(x);u.children&&u.children.length>0&&(ut(u.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+g+'".')),up(u.children,a,v,g)),!(u.path==null&&!u.index)&&a.push({path:g,score:wy(g,u.index),routesMeta:v})};return n.forEach((u,f)=>{var p;if(u.path===""||!((p=u.path)!=null&&p.includes("?")))c(u,f);else for(let x of fp(u.path))c(u,f,x)}),a}function fp(n){let a=n.split("/");if(a.length===0)return[];let[l,...o]=a,c=l.endsWith("?"),u=l.replace(/\?$/,"");if(o.length===0)return c?[u,""]:[u];let f=fp(o.join("/")),p=[];return p.push(...f.map(x=>x===""?u:[u,x].join("/"))),c&&p.push(...f),p.map(x=>n.startsWith("/")&&x===""?"/":x)}function xy(n){n.sort((a,l)=>a.score!==l.score?l.score-a.score:Sy(a.routesMeta.map(o=>o.childrenIndex),l.routesMeta.map(o=>o.childrenIndex)))}const gy=/^:[\w-]+$/,vy=3,yy=2,jy=1,Ny=10,by=-2,um=n=>n==="*";function wy(n,a){let l=n.split("/"),o=l.length;return l.some(um)&&(o+=by),a&&(o+=yy),l.filter(c=>!um(c)).reduce((c,u)=>c+(gy.test(u)?vy:u===""?jy:Ny),o)}function Sy(n,a){return n.length===a.length&&n.slice(0,-1).every((o,c)=>o===a[c])?n[n.length-1]-a[a.length-1]:0}function Cy(n,a,l){let{routesMeta:o}=n,c={},u="/",f=[];for(let p=0;p{let{paramName:k,isOptional:R}=v;if(k==="*"){let N=p[y]||"";f=u.slice(0,u.length-N.length).replace(/(.)\/+$/,"$1")}const C=p[y];return R&&!C?g[k]=void 0:g[k]=(C||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:f,pattern:n}}function Ey(n,a,l){a===void 0&&(a=!1),l===void 0&&(l=!0),Md(n==="*"||!n.endsWith("*")||n.endsWith("/*"),'Route path "'+n+'" will be treated as if it were '+('"'+n.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+n.replace(/\*$/,"/*")+'".'));let o=[],c="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,p,x)=>(o.push({paramName:p,isOptional:x!=null}),x?"/?([^\\/]+)?":"/([^\\/]+)"));return n.endsWith("*")?(o.push({paramName:"*"}),c+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):l?c+="\\/*$":n!==""&&n!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,a?void 0:"i"),o]}function Py(n){try{return n.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return Md(!1,'The URL path "'+n+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),n}}function Dd(n,a){if(a==="/")return n;if(!n.toLowerCase().startsWith(a.toLowerCase()))return null;let l=a.endsWith("/")?a.length-1:a.length,o=n.charAt(l);return o&&o!=="/"?null:n.slice(l)||"/"}const Ry=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ty=n=>Ry.test(n);function _y(n,a){a===void 0&&(a="/");let{pathname:l,search:o="",hash:c=""}=typeof n=="string"?Bs(n):n,u;if(l)if(Ty(l))u=l;else{if(l.includes("//")){let f=l;l=l.replace(/\/\/+/g,"/"),Md(!1,"Pathnames cannot have embedded double slashes - normalizing "+(f+" -> "+l))}l.startsWith("/")?u=fm(l.substring(1),"/"):u=fm(l,a)}else u=a;return{pathname:u,search:My(o),hash:Dy(c)}}function fm(n,a){let l=a.replace(/\/+$/,"").split("/");return n.split("/").forEach(c=>{c===".."?l.length>1&&l.pop():c!=="."&&l.push(c)}),l.length>1?l.join("/"):"/"}function Kc(n,a,l,o){return"Cannot include a '"+n+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(o)+"]. Please separate it out to the ")+("`to."+l+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Iy(n){return n.filter((a,l)=>l===0||a.route.path&&a.route.path.length>0)}function Ld(n,a){let l=Iy(n);return a?l.map((o,c)=>c===l.length-1?o.pathname:o.pathnameBase):l.map(o=>o.pathnameBase)}function Od(n,a,l,o){o===void 0&&(o=!1);let c;typeof n=="string"?c=Bs(n):(c=Fa({},n),ut(!c.pathname||!c.pathname.includes("?"),Kc("?","pathname","search",c)),ut(!c.pathname||!c.pathname.includes("#"),Kc("#","pathname","hash",c)),ut(!c.search||!c.search.includes("#"),Kc("#","search","hash",c)));let u=n===""||c.pathname==="",f=u?"/":c.pathname,p;if(f==null)p=l;else{let y=a.length-1;if(!o&&f.startsWith("..")){let k=f.split("/");for(;k[0]==="..";)k.shift(),y-=1;c.pathname=k.join("/")}p=y>=0?a[y]:"/"}let x=_y(c,p),g=f&&f!=="/"&&f.endsWith("/"),v=(u||f===".")&&l.endsWith("/");return!x.pathname.endsWith("/")&&(g||v)&&(x.pathname+="/"),x}const bn=n=>n.join("/").replace(/\/\/+/g,"/"),Ay=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),My=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,Dy=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n;function Ly(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}const hp=["post","put","patch","delete"];new Set(hp);const Oy=["get",...hp];new Set(Oy);/** - * React Router v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function za(){return za=Object.assign?Object.assign.bind():function(n){for(var a=1;a{p.current=!0}),h.useCallback(function(g,v){if(v===void 0&&(v={}),!p.current)return;if(typeof g=="number"){o.go(g);return}let y=Od(g,JSON.parse(f),u,v.relative==="path");n==null&&a!=="/"&&(y.pathname=y.pathname==="/"?a:bn([a,y.pathname])),(v.replace?o.replace:o.push)(y,v.state,v)},[a,o,f,u,n])}const By=h.createContext(null);function Uy(n){let a=h.useContext(Kr).outlet;return a&&h.createElement(By.Provider,{value:n},a)}function xp(n,a){let{relative:l}=a===void 0?{}:a,{future:o}=h.useContext(Pn),{matches:c}=h.useContext(Kr),{pathname:u}=ns(),f=JSON.stringify(Ld(c,o.v7_relativeSplatPath));return h.useMemo(()=>Od(n,JSON.parse(f),u,l==="path"),[n,f,u,l])}function Vy(n,a){return Wy(n,a)}function Wy(n,a,l,o){Us()||ut(!1);let{navigator:c}=h.useContext(Pn),{matches:u}=h.useContext(Kr),f=u[u.length-1],p=f?f.params:{};f&&f.pathname;let x=f?f.pathnameBase:"/";f&&f.route;let g=ns(),v;if(a){var y;let w=typeof a=="string"?Bs(a):a;x==="/"||(y=w.pathname)!=null&&y.startsWith(x)||ut(!1),v=w}else v=g;let k=v.pathname||"/",R=k;if(x!=="/"){let w=x.replace(/^\//,"").split("/");R="/"+k.replace(/^\//,"").split("/").slice(w.length).join("/")}let C=my(n,{pathname:R}),N=Qy(C&&C.map(w=>Object.assign({},w,{params:Object.assign({},p,w.params),pathname:bn([x,c.encodeLocation?c.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?x:bn([x,c.encodeLocation?c.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),u,l,o);return a&&N?h.createElement(Ai.Provider,{value:{location:za({pathname:"/",search:"",hash:"",state:null,key:"default"},v),navigationType:Nn.Pop}},N):N}function Hy(){let n=Zy(),a=Ly(n)?n.status+" "+n.statusText:n instanceof Error?n.message:JSON.stringify(n),l=n instanceof Error?n.stack:null,c={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},a),l?h.createElement("pre",{style:c},l):null,null)}const Ky=h.createElement(Hy,null);class Gy extends h.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,l){return l.location!==a.location||l.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:l.error,location:l.location,revalidation:a.revalidation||l.revalidation}}componentDidCatch(a,l){console.error("React Router caught the following error during render",a,l)}render(){return this.state.error!==void 0?h.createElement(Kr.Provider,{value:this.props.routeContext},h.createElement(mp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Yy(n){let{routeContext:a,match:l,children:o}=n,c=h.useContext(Fd);return c&&c.static&&c.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=l.route.id),h.createElement(Kr.Provider,{value:a},o)}function Qy(n,a,l,o){var c;if(a===void 0&&(a=[]),l===void 0&&(l=null),o===void 0&&(o=null),n==null){var u;if(!l)return null;if(l.errors)n=l.matches;else if((u=o)!=null&&u.v7_partialHydration&&a.length===0&&!l.initialized&&l.matches.length>0)n=l.matches;else return null}let f=n,p=(c=l)==null?void 0:c.errors;if(p!=null){let v=f.findIndex(y=>y.route.id&&(p==null?void 0:p[y.route.id])!==void 0);v>=0||ut(!1),f=f.slice(0,Math.min(f.length,v+1))}let x=!1,g=-1;if(l&&o&&o.v7_partialHydration)for(let v=0;v=0?f=f.slice(0,g+1):f=[f[0]];break}}}return f.reduceRight((v,y,k)=>{let R,C=!1,N=null,w=null;l&&(R=p&&y.route.id?p[y.route.id]:void 0,N=y.route.errorElement||Ky,x&&(g<0&&k===0?(tj("route-fallback"),C=!0,w=null):g===k&&(C=!0,w=y.route.hydrateFallbackElement||null)));let S=a.concat(f.slice(0,k+1)),P=()=>{let j;return R?j=N:C?j=w:y.route.Component?j=h.createElement(y.route.Component,null):y.route.element?j=y.route.element:j=v,h.createElement(Yy,{match:y,routeContext:{outlet:v,matches:S,isDataRoute:l!=null},children:j})};return l&&(y.route.ErrorBoundary||y.route.errorElement||k===0)?h.createElement(Gy,{location:l.location,revalidation:l.revalidation,component:N,error:R,children:P(),routeContext:{outlet:null,matches:S,isDataRoute:!0}}):P()},null)}var gp=(function(n){return n.UseBlocker="useBlocker",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n})(gp||{}),vp=(function(n){return n.UseBlocker="useBlocker",n.UseLoaderData="useLoaderData",n.UseActionData="useActionData",n.UseRouteError="useRouteError",n.UseNavigation="useNavigation",n.UseRouteLoaderData="useRouteLoaderData",n.UseMatches="useMatches",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n.UseRouteId="useRouteId",n})(vp||{});function qy(n){let a=h.useContext(Fd);return a||ut(!1),a}function Xy(n){let a=h.useContext(Fy);return a||ut(!1),a}function Jy(n){let a=h.useContext(Kr);return a||ut(!1),a}function yp(n){let a=Jy(),l=a.matches[a.matches.length-1];return l.route.id||ut(!1),l.route.id}function Zy(){var n;let a=h.useContext(mp),l=Xy(),o=yp();return a!==void 0?a:(n=l.errors)==null?void 0:n[o]}function ej(){let{router:n}=qy(gp.UseNavigateStable),a=yp(vp.UseNavigateStable),l=h.useRef(!1);return pp(()=>{l.current=!0}),h.useCallback(function(c,u){u===void 0&&(u={}),l.current&&(typeof c=="number"?n.navigate(c):n.navigate(c,za({fromRouteId:a},u)))},[n,a])}const hm={};function tj(n,a,l){hm[n]||(hm[n]=!0)}function rj(n,a){n==null||n.v7_startTransition,n==null||n.v7_relativeSplatPath}function nj(n){let{to:a,replace:l,state:o,relative:c}=n;Us()||ut(!1);let{future:u,static:f}=h.useContext(Pn),{matches:p}=h.useContext(Kr),{pathname:x}=ns(),g=Wa(),v=Od(a,Ld(p,u.v7_relativeSplatPath),x,c==="path"),y=JSON.stringify(v);return h.useEffect(()=>g(JSON.parse(y),{replace:l,state:o,relative:c}),[g,y,c,l,o]),null}function sj(n){return Uy(n.context)}function nt(n){ut(!1)}function aj(n){let{basename:a="/",children:l=null,location:o,navigationType:c=Nn.Pop,navigator:u,static:f=!1,future:p}=n;Us()&&ut(!1);let x=a.replace(/^\/*/,"/"),g=h.useMemo(()=>({basename:x,navigator:u,static:f,future:za({v7_relativeSplatPath:!1},p)}),[x,p,u,f]);typeof o=="string"&&(o=Bs(o));let{pathname:v="/",search:y="",hash:k="",state:R=null,key:C="default"}=o,N=h.useMemo(()=>{let w=Dd(v,x);return w==null?null:{location:{pathname:w,search:y,hash:k,state:R,key:C},navigationType:c}},[x,v,y,k,R,C,c]);return N==null?null:h.createElement(Pn.Provider,{value:g},h.createElement(Ai.Provider,{children:l,value:N}))}function lj(n){let{children:a,location:l}=n;return Vy(ud(a),l)}new Promise(()=>{});function ud(n,a){a===void 0&&(a=[]);let l=[];return h.Children.forEach(n,(o,c)=>{if(!h.isValidElement(o))return;let u=[...a,c];if(o.type===h.Fragment){l.push.apply(l,ud(o.props.children,u));return}o.type!==nt&&ut(!1),!o.props.index||!o.props.children||ut(!1);let f={id:o.props.id||u.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,loader:o.props.loader,action:o.props.action,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(f.children=ud(o.props.children,u)),l.push(f)}),l}/** - * React Router DOM v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function fd(){return fd=Object.assign?Object.assign.bind():function(n){for(var a=1;a=0)&&(l[c]=n[c]);return l}function oj(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function cj(n,a){return n.button===0&&(!a||a==="_self")&&!oj(n)}const dj=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],uj="6";try{window.__reactRouterVersion=uj}catch{}const fj="startTransition",mm=Ii[fj];function hj(n){let{basename:a,children:l,future:o,window:c}=n,u=h.useRef();u.current==null&&(u.current=uy({window:c,v5Compat:!0}));let f=u.current,[p,x]=h.useState({action:f.action,location:f.location}),{v7_startTransition:g}=o||{},v=h.useCallback(y=>{g&&mm?mm(()=>x(y)):x(y)},[x,g]);return h.useLayoutEffect(()=>f.listen(v),[f,v]),h.useEffect(()=>rj(o),[o]),h.createElement(aj,{basename:a,children:l,location:p.location,navigationType:p.action,navigator:f,future:o})}const mj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",pj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fi=h.forwardRef(function(a,l){let{onClick:o,relative:c,reloadDocument:u,replace:f,state:p,target:x,to:g,preventScrollReset:v,viewTransition:y}=a,k=ij(a,dj),{basename:R}=h.useContext(Pn),C,N=!1;if(typeof g=="string"&&pj.test(g)&&(C=g,mj))try{let j=new URL(window.location.href),_=g.startsWith("//")?new URL(j.protocol+g):new URL(g),B=Dd(_.pathname,R);_.origin===j.origin&&B!=null?g=B+_.search+_.hash:N=!0}catch{}let w=zy(g,{relative:c}),S=xj(g,{replace:f,state:p,target:x,preventScrollReset:v,relative:c,viewTransition:y});function P(j){o&&o(j),j.defaultPrevented||S(j)}return h.createElement("a",fd({},k,{href:C||w,onClick:N||u?o:P,ref:l,target:x}))});var pm;(function(n){n.UseScrollRestoration="useScrollRestoration",n.UseSubmit="useSubmit",n.UseSubmitFetcher="useSubmitFetcher",n.UseFetcher="useFetcher",n.useViewTransitionState="useViewTransitionState"})(pm||(pm={}));var xm;(function(n){n.UseFetcher="useFetcher",n.UseFetchers="useFetchers",n.UseScrollRestoration="useScrollRestoration"})(xm||(xm={}));function xj(n,a){let{target:l,replace:o,state:c,preventScrollReset:u,relative:f,viewTransition:p}=a===void 0?{}:a,x=Wa(),g=ns(),v=xp(n,{relative:f});return h.useCallback(y=>{if(cj(y,l)){y.preventDefault();let k=o!==void 0?o:vi(g)===vi(v);x(n,{replace:k,state:c,preventScrollReset:u,relative:f,viewTransition:p})}},[g,x,v,o,c,l,n,u,f,p])}/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gj=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),vj=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,l,o)=>o?o.toUpperCase():l.toLowerCase()),gm=n=>{const a=vj(n);return a.charAt(0).toUpperCase()+a.slice(1)},jp=(...n)=>n.filter((a,l,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===l).join(" ").trim(),yj=n=>{for(const a in n)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var jj={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Nj=h.forwardRef(({color:n="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:f,...p},x)=>h.createElement("svg",{ref:x,...jj,width:a,height:a,stroke:n,strokeWidth:o?Number(l)*24/Number(a):l,className:jp("lucide",c),...!u&&!yj(p)&&{"aria-hidden":"true"},...p},[...f.map(([g,v])=>h.createElement(g,v)),...Array.isArray(u)?u:[u]]));/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const be=(n,a)=>{const l=h.forwardRef(({className:o,...c},u)=>h.createElement(Nj,{ref:u,iconNode:a,className:jp(`lucide-${gj(gm(n))}`,`lucide-${n}`,o),...c}));return l.displayName=gm(n),l};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bj=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],vm=be("bitcoin",bj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wj=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Vr=be("book-open",wj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Sj=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],$a=be("calendar",Sj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Cj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Mi=be("check",Cj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Di=be("chevron-down",kj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ej=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],As=be("chevron-right",Ej);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pj=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Np=be("chevron-up",Pj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Rj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Tj=be("circle-alert",Rj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _j=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ym=be("circle-check-big",_j);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ij=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],bp=be("circle-question-mark",Ij);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Aj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],jm=be("circle-user",Aj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Dj=be("circle-x",Mj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Lj=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],wp=be("clock",Lj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Oj=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Sp=be("copy",Oj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Fj=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],hd=be("credit-card",Fj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zj=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],Li=be("crown",zj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $j=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],yi=be("dollar-sign",$j);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Bj=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Uj=be("download",Bj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vj=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ji=be("external-link",Vj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Wj=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ms=be("eye",Wj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hj=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Kj=be("file-text",Hj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gj=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Yj=be("funnel",Gj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Qj=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],qj=be("gift",Qj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xj=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],Jj=be("git-merge",Xj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Zj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],md=be("globe",Zj);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eN=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],tN=be("graduation-cap",eN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rN=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Gc=be("grip-vertical",rN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nN=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Nm=be("history",nN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sN=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aN=be("house",sN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Cp=be("image",lN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ri=be("info",iN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oN=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],bm=be("key",oN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cN=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],dN=be("layout-dashboard",cN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uN=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Yn=be("link-2",uN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fN=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],wm=be("link",fN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hN=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],mN=be("lock",hN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pN=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],xN=be("log-out",pN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gN=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],vN=be("map-pin",gN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yN=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],jN=be("menu",yN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NN=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],bN=be("message-circle",NN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wN=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],SN=be("palette",wN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CN=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Ht=be("pen-line",CN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kN=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],EN=be("percent",kN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PN=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],RN=be("phone",PN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TN=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],gr=be("plus",TN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _N=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],Sm=be("qr-code",_N);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IN=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ze=be("refresh-cw",IN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AN=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Ot=be("save",AN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MN=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Qn=be("search",MN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DN=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ni=be("settings",DN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LN=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ON=be("settings-2",LN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const FN=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],zd=be("shield-check",FN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zN=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],pd=be("shopping-bag",zN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $N=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],xd=be("smartphone",$N);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BN=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],UN=be("tag",BN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VN=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Er=be("trash-2",VN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const WN=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],gd=be("trending-up",WN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const HN=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],kp=be("undo-2",HN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KN=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],bi=be("upload",KN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const GN=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Cm=be("user-plus",GN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YN=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],qn=be("user",YN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const QN=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],vr=be("users",QN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qN=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],Os=be("wallet",qN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ir=be("x",XN);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const JN=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ZN=be("zap",JN),$d="admin_token";function Bd(){try{return localStorage.getItem($d)}catch{return null}}function eb(n){try{localStorage.setItem($d,n)}catch{}}function tb(){try{localStorage.removeItem($d)}catch{}}const rb="https://soulapi.quwanzhi.com",nb=()=>{const n="https://soulapi.quwanzhi.com";return n.length>0?n.replace(/\/$/,""):rb};function Fs(n){const a=nb(),l=n.startsWith("/")?n:`/${n}`;return a?`${a}${l}`:l}async function Oi(n,a={}){const{data:l,...o}=a,c=Fs(n),u=new Headers(o.headers),f=Bd();f&&u.set("Authorization",`Bearer ${f}`),l!=null&&!u.has("Content-Type")&&u.set("Content-Type","application/json");const p=l!=null?JSON.stringify(l):o.body,x=await fetch(c,{...o,headers:u,body:p,credentials:"include"}),v=(x.headers.get("Content-Type")||"").includes("application/json")?await x.json():x;if(!x.ok){const y=new Error((v==null?void 0:v.error)||`HTTP ${x.status}`);throw y.status=x.status,y.data=v,y}return v}function Ke(n,a){return Oi(n,{...a,method:"GET"})}function jt(n,a,l){return Oi(n,{...l,method:"POST",data:a})}function St(n,a,l){return Oi(n,{...l,method:"PUT",data:a})}function zs(n,a){return Oi(n,{...a,method:"DELETE"})}const sb=[{icon:dN,label:"数据概览",href:"/dashboard"},{icon:Vr,label:"内容管理",href:"/content"},{icon:vr,label:"用户管理",href:"/users"}],km=[{icon:Li,label:"VIP 角色",href:"/vip-roles"},{icon:qn,label:"作者详情",href:"/author-settings"},{icon:zd,label:"管理员",href:"/admin-users"},{icon:tN,label:"导师管理",href:"/mentors"},{icon:$a,label:"导师预约",href:"/mentor-consultations"},{icon:Os,label:"推广中心",href:"/distribution"},{icon:Jj,label:"匹配记录",href:"/match-records"},{icon:hd,label:"推广设置",href:"/referral-settings"}];function ab(){const n=ns(),a=Wa(),[l,o]=h.useState(!1),[c,u]=h.useState(!1),[f,p]=h.useState(!1);h.useEffect(()=>{o(!0)},[]),h.useEffect(()=>{km.some(v=>n.pathname===v.href)&&p(!0)},[n.pathname]),h.useEffect(()=>{if(!l)return;u(!1);let g=!1;return Ke("/api/admin").then(v=>{g||(v&&v.success!==!1?u(!0):a("/login",{replace:!0}))}).catch(()=>{g||a("/login",{replace:!0})}),()=>{g=!0}},[l,a]);const x=async()=>{tb();try{await jt("/api/admin/logout",{})}catch{}a("/login",{replace:!0})};return!l||!c?t.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[t.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):t.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[t.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[t.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[t.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),t.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),t.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[sb.map(g=>{const v=n.pathname===g.href;return t.jsxs(fi,{to:g.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${v?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[t.jsx(g.icon,{className:"w-5 h-5 shrink-0"}),t.jsx("span",{className:"text-sm",children:g.label})]},g.href)}),t.jsx("button",{type:"button",onClick:()=>p(!f),className:"w-full flex items-center justify-between gap-3 px-4 py-3 text-gray-400 hover:bg-gray-700/50 hover:text-white rounded-lg transition-colors",children:t.jsxs("span",{className:"flex items-center gap-3",children:[f?t.jsx(Np,{className:"w-5 h-5"}):t.jsx(Di,{className:"w-5 h-5"}),t.jsx("span",{className:"text-sm",children:"更多"})]})}),f&&t.jsx("div",{className:"space-y-1 pl-4",children:km.map(g=>{const v=n.pathname===g.href;return t.jsxs(fi,{to:g.href,className:`flex items-center gap-3 px-4 py-2 rounded-lg transition-colors ${v?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[t.jsx(g.icon,{className:"w-5 h-5 shrink-0"}),t.jsx("span",{className:"text-sm",children:g.label})]},g.href)})}),t.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:t.jsxs(fi,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${n.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[t.jsx(Ni,{className:"w-5 h-5 shrink-0"}),t.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),t.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:t.jsxs("button",{type:"button",onClick:x,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white rounded-lg hover:bg-gray-700/50 transition-colors",children:[t.jsx(xN,{className:"w-5 h-5"}),t.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),t.jsx("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0",children:t.jsx("div",{className:"w-full min-w-[1024px] min-h-full",children:t.jsx(sj,{})})})]})}function Em(n,a){if(typeof n=="function")return n(a);n!=null&&(n.current=a)}function Ud(...n){return a=>{let l=!1;const o=n.map(c=>{const u=Em(c,a);return!l&&typeof u=="function"&&(l=!0),u});if(l)return()=>{for(let c=0;c{let{children:u,...f}=o;Ep(u)&&typeof wi=="function"&&(u=wi(u._payload));const p=h.Children.toArray(u),x=p.find(db);if(x){const g=x.props.children,v=p.map(y=>y===x?h.Children.count(g)>1?h.Children.only(null):h.isValidElement(g)?g.props.children:null:y);return t.jsx(a,{...f,ref:c,children:h.isValidElement(g)?h.cloneElement(g,void 0,v):null})}return t.jsx(a,{...f,ref:c,children:u})});return l.displayName=`${n}.Slot`,l}var Rp=Pp("Slot");function ob(n){const a=h.forwardRef((l,o)=>{let{children:c,...u}=l;if(Ep(c)&&typeof wi=="function"&&(c=wi(c._payload)),h.isValidElement(c)){const f=fb(c),p=ub(u,c.props);return c.type!==h.Fragment&&(p.ref=o?Ud(o,f):f),h.cloneElement(c,p)}return h.Children.count(c)>1?h.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var cb=Symbol("radix.slottable");function db(n){return h.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===cb}function ub(n,a){const l={...a};for(const o in a){const c=n[o],u=a[o];/^on[A-Z]/.test(o)?c&&u?l[o]=(...p)=>{const x=u(...p);return c(...p),x}:c&&(l[o]=c):o==="style"?l[o]={...c,...u}:o==="className"&&(l[o]=[c,u].filter(Boolean).join(" "))}return{...n,...l}}function fb(n){var o,c;let a=(o=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:o.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?n.ref:(a=(c=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?n.props.ref:n.props.ref||n.ref)}function Tp(n){var a,l,o="";if(typeof n=="string"||typeof n=="number")o+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(a=0;atypeof n=="boolean"?`${n}`:n===0?"0":n,Rm=_p,Ip=(n,a)=>l=>{var o;if((a==null?void 0:a.variants)==null)return Rm(n,l==null?void 0:l.class,l==null?void 0:l.className);const{variants:c,defaultVariants:u}=a,f=Object.keys(c).map(g=>{const v=l==null?void 0:l[g],y=u==null?void 0:u[g];if(v===null)return null;const k=Pm(v)||Pm(y);return c[g][k]}),p=l&&Object.entries(l).reduce((g,v)=>{let[y,k]=v;return k===void 0||(g[y]=k),g},{}),x=a==null||(o=a.compoundVariants)===null||o===void 0?void 0:o.reduce((g,v)=>{let{class:y,className:k,...R}=v;return Object.entries(R).every(C=>{let[N,w]=C;return Array.isArray(w)?w.includes({...u,...p}[N]):{...u,...p}[N]===w})?[...g,y,k]:g},[]);return Rm(n,f,x,l==null?void 0:l.class,l==null?void 0:l.className)},hb=(n,a)=>{const l=new Array(n.length+a.length);for(let o=0;o({classGroupId:n,validator:a}),Ap=(n=new Map,a=null,l)=>({nextPart:n,validators:a,classGroupId:l}),Si="-",Tm=[],pb="arbitrary..",xb=n=>{const a=vb(n),{conflictingClassGroups:l,conflictingClassGroupModifiers:o}=n;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return gb(f);const p=f.split(Si),x=p[0]===""&&p.length>1?1:0;return Mp(p,x,a)},getConflictingClassGroupIds:(f,p)=>{if(p){const x=o[f],g=l[f];return x?g?hb(g,x):x:g||Tm}return l[f]||Tm}}},Mp=(n,a,l)=>{if(n.length-a===0)return l.classGroupId;const c=n[a],u=l.nextPart.get(c);if(u){const g=Mp(n,a+1,u);if(g)return g}const f=l.validators;if(f===null)return;const p=a===0?n.join(Si):n.slice(a).join(Si),x=f.length;for(let g=0;gn.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=n.slice(1,-1),l=a.indexOf(":"),o=a.slice(0,l);return o?pb+o:void 0})(),vb=n=>{const{theme:a,classGroups:l}=n;return yb(l,a)},yb=(n,a)=>{const l=Ap();for(const o in n){const c=n[o];Vd(c,l,o,a)}return l},Vd=(n,a,l,o)=>{const c=n.length;for(let u=0;u{if(typeof n=="string"){Nb(n,a,l);return}if(typeof n=="function"){bb(n,a,l,o);return}wb(n,a,l,o)},Nb=(n,a,l)=>{const o=n===""?a:Dp(a,n);o.classGroupId=l},bb=(n,a,l,o)=>{if(Sb(n)){Vd(n(o),a,l,o);return}a.validators===null&&(a.validators=[]),a.validators.push(mb(l,n))},wb=(n,a,l,o)=>{const c=Object.entries(n),u=c.length;for(let f=0;f{let l=n;const o=a.split(Si),c=o.length;for(let u=0;u"isThemeGetter"in n&&n.isThemeGetter===!0,Cb=n=>{if(n<1)return{get:()=>{},set:()=>{}};let a=0,l=Object.create(null),o=Object.create(null);const c=(u,f)=>{l[u]=f,a++,a>n&&(a=0,o=l,l=Object.create(null))};return{get(u){let f=l[u];if(f!==void 0)return f;if((f=o[u])!==void 0)return c(u,f),f},set(u,f){u in l?l[u]=f:c(u,f)}}},vd="!",_m=":",kb=[],Im=(n,a,l,o,c)=>({modifiers:n,hasImportantModifier:a,baseClassName:l,maybePostfixModifierPosition:o,isExternal:c}),Eb=n=>{const{prefix:a,experimentalParseClassName:l}=n;let o=c=>{const u=[];let f=0,p=0,x=0,g;const v=c.length;for(let N=0;Nx?g-x:void 0;return Im(u,R,k,C)};if(a){const c=a+_m,u=o;o=f=>f.startsWith(c)?u(f.slice(c.length)):Im(kb,!1,f,void 0,!0)}if(l){const c=o;o=u=>l({className:u,parseClassName:c})}return o},Pb=n=>{const a=new Map;return n.orderSensitiveModifiers.forEach((l,o)=>{a.set(l,1e6+o)}),l=>{const o=[];let c=[];for(let u=0;u0&&(c.sort(),o.push(...c),c=[]),o.push(f)):c.push(f)}return c.length>0&&(c.sort(),o.push(...c)),o}},Rb=n=>({cache:Cb(n.cacheSize),parseClassName:Eb(n),sortModifiers:Pb(n),...xb(n)}),Tb=/\s+/,_b=(n,a)=>{const{parseClassName:l,getClassGroupId:o,getConflictingClassGroupIds:c,sortModifiers:u}=a,f=[],p=n.trim().split(Tb);let x="";for(let g=p.length-1;g>=0;g-=1){const v=p[g],{isExternal:y,modifiers:k,hasImportantModifier:R,baseClassName:C,maybePostfixModifierPosition:N}=l(v);if(y){x=v+(x.length>0?" "+x:x);continue}let w=!!N,S=o(w?C.substring(0,N):C);if(!S){if(!w){x=v+(x.length>0?" "+x:x);continue}if(S=o(C),!S){x=v+(x.length>0?" "+x:x);continue}w=!1}const P=k.length===0?"":k.length===1?k[0]:u(k).join(":"),j=R?P+vd:P,_=j+S;if(f.indexOf(_)>-1)continue;f.push(_);const B=c(S,w);for(let V=0;V0?" "+x:x)}return x},Ib=(...n)=>{let a=0,l,o,c="";for(;a{if(typeof n=="string")return n;let a,l="";for(let o=0;o{let l,o,c,u;const f=x=>{const g=a.reduce((v,y)=>y(v),n());return l=Rb(g),o=l.cache.get,c=l.cache.set,u=p,p(x)},p=x=>{const g=o(x);if(g)return g;const v=_b(x,l);return c(x,v),v};return u=f,(...x)=>u(Ib(...x))},Mb=[],xt=n=>{const a=l=>l[n]||Mb;return a.isThemeGetter=!0,a},Op=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Fp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Db=/^\d+\/\d+$/,Lb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ob=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Fb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$b=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rs=n=>Db.test(n),Fe=n=>!!n&&!Number.isNaN(Number(n)),gn=n=>!!n&&Number.isInteger(Number(n)),Yc=n=>n.endsWith("%")&&Fe(n.slice(0,-1)),Br=n=>Lb.test(n),Bb=()=>!0,Ub=n=>Ob.test(n)&&!Fb.test(n),zp=()=>!1,Vb=n=>zb.test(n),Wb=n=>$b.test(n),Hb=n=>!Se(n)&&!Ce(n),Kb=n=>Vs(n,Up,zp),Se=n=>Op.test(n),Gn=n=>Vs(n,Vp,Ub),Qc=n=>Vs(n,Xb,Fe),Am=n=>Vs(n,$p,zp),Gb=n=>Vs(n,Bp,Wb),ni=n=>Vs(n,Wp,Vb),Ce=n=>Fp.test(n),La=n=>Ws(n,Vp),Yb=n=>Ws(n,Jb),Mm=n=>Ws(n,$p),Qb=n=>Ws(n,Up),qb=n=>Ws(n,Bp),si=n=>Ws(n,Wp,!0),Vs=(n,a,l)=>{const o=Op.exec(n);return o?o[1]?a(o[1]):l(o[2]):!1},Ws=(n,a,l=!1)=>{const o=Fp.exec(n);return o?o[1]?a(o[1]):l:!1},$p=n=>n==="position"||n==="percentage",Bp=n=>n==="image"||n==="url",Up=n=>n==="length"||n==="size"||n==="bg-size",Vp=n=>n==="length",Xb=n=>n==="number",Jb=n=>n==="family-name",Wp=n=>n==="shadow",Zb=()=>{const n=xt("color"),a=xt("font"),l=xt("text"),o=xt("font-weight"),c=xt("tracking"),u=xt("leading"),f=xt("breakpoint"),p=xt("container"),x=xt("spacing"),g=xt("radius"),v=xt("shadow"),y=xt("inset-shadow"),k=xt("text-shadow"),R=xt("drop-shadow"),C=xt("blur"),N=xt("perspective"),w=xt("aspect"),S=xt("ease"),P=xt("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],B=()=>[..._(),Ce,Se],V=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],T=()=>[Ce,Se,x],z=()=>[Rs,"full","auto",...T()],q=()=>[gn,"none","subgrid",Ce,Se],ue=()=>["auto",{span:["full",gn,Ce,Se]},gn,Ce,Se],ee=()=>[gn,"auto",Ce,Se],ce=()=>["auto","min","max","fr",Ce,Se],G=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],te=()=>["auto",...T()],U=()=>[Rs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],M=()=>[n,Ce,Se],Q=()=>[..._(),Mm,Am,{position:[Ce,Se]}],H=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",Qb,Kb,{size:[Ce,Se]}],L=()=>[Yc,La,Gn],X=()=>["","none","full",g,Ce,Se],ae=()=>["",Fe,La,Gn],ve=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[Fe,Yc,Mm,Am],ye=()=>["","none",C,Ce,Se],D=()=>["none",Fe,Ce,Se],fe=()=>["none",Fe,Ce,Se],F=()=>[Fe,Ce,Se],re=()=>[Rs,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Br],breakpoint:[Br],color:[Bb],container:[Br],"drop-shadow":[Br],ease:["in","out","in-out"],font:[Hb],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Br],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Br],shadow:[Br],spacing:["px",Fe],text:[Br],"text-shadow":[Br],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Rs,Se,Ce,w]}],container:["container"],columns:[{columns:[Fe,Se,Ce,p]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:B()}],overflow:[{overflow:V()}],"overflow-x":[{"overflow-x":V()}],"overflow-y":[{"overflow-y":V()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[gn,"auto",Ce,Se]}],basis:[{basis:[Rs,"full","auto",p,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Fe,Rs,"auto","initial","none",Se]}],grow:[{grow:["",Fe,Ce,Se]}],shrink:[{shrink:["",Fe,Ce,Se]}],order:[{order:[gn,"first","last","none",Ce,Se]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:ue()}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:ue()}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...G(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...G()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":G()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:te()}],mx:[{mx:te()}],my:[{my:te()}],ms:[{ms:te()}],me:[{me:te()}],mt:[{mt:te()}],mr:[{mr:te()}],mb:[{mb:te()}],ml:[{ml:te()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[p,"screen",...U()]}],"min-w":[{"min-w":[p,"screen","none",...U()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[f]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",l,La,Gn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,Ce,Qc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Yc,Se]}],"font-family":[{font:[Yb,Se,a]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,Ce,Se]}],"line-clamp":[{"line-clamp":[Fe,"none",Ce,Qc]}],leading:[{leading:[u,...T()]}],"list-image":[{"list-image":["none",Ce,Se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ce,Se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:[Fe,"from-font","auto",Ce,Gn]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Fe,"auto",Ce,Se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce,Se]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ce,Se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:H()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gn,Ce,Se],radial:["",Ce,Se],conic:[gn,Ce,Se]},qb,Gb]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ve(),"hidden","none"]}],"divide-style":[{divide:[...ve(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...ve(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Fe,Ce,Se]}],"outline-w":[{outline:["",Fe,La,Gn]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",v,si,ni]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",y,si,ni]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Fe,Gn]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",k,si,ni]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Fe,Ce,Se]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Fe]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Ce,Se]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Fe]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:H()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ce,Se]}],filter:[{filter:["","none",Ce,Se]}],blur:[{blur:ye()}],brightness:[{brightness:[Fe,Ce,Se]}],contrast:[{contrast:[Fe,Ce,Se]}],"drop-shadow":[{"drop-shadow":["","none",R,si,ni]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Fe,Ce,Se]}],"hue-rotate":[{"hue-rotate":[Fe,Ce,Se]}],invert:[{invert:["",Fe,Ce,Se]}],saturate:[{saturate:[Fe,Ce,Se]}],sepia:[{sepia:["",Fe,Ce,Se]}],"backdrop-filter":[{"backdrop-filter":["","none",Ce,Se]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[Fe,Ce,Se]}],"backdrop-contrast":[{"backdrop-contrast":[Fe,Ce,Se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Fe,Ce,Se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Fe,Ce,Se]}],"backdrop-invert":[{"backdrop-invert":["",Fe,Ce,Se]}],"backdrop-opacity":[{"backdrop-opacity":[Fe,Ce,Se]}],"backdrop-saturate":[{"backdrop-saturate":[Fe,Ce,Se]}],"backdrop-sepia":[{"backdrop-sepia":["",Fe,Ce,Se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ce,Se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Fe,"initial",Ce,Se]}],ease:[{ease:["linear","initial",S,Ce,Se]}],delay:[{delay:[Fe,Ce,Se]}],animate:[{animate:["none",P,Ce,Se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,Ce,Se]}],"perspective-origin":[{"perspective-origin":B()}],rotate:[{rotate:D()}],"rotate-x":[{"rotate-x":D()}],"rotate-y":[{"rotate-y":D()}],"rotate-z":[{"rotate-z":D()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Ce,Se,"","none","gpu","cpu"]}],"transform-origin":[{origin:B()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:re()}],"translate-x":[{"translate-x":re()}],"translate-y":[{"translate-y":re()}],"translate-z":[{"translate-z":re()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ce,Se]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ce,Se]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Fe,La,Gn,Qc]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},ew=Ab(Zb);function Qe(...n){return ew(_p(n))}const tw=Ip("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function ie({className:n,variant:a,size:l,asChild:o=!1,...c}){const u=o?Rp:"button";return t.jsx(u,{"data-slot":"button",className:Qe(tw({variant:a,size:l,className:n})),...c})}function se({className:n,type:a,...l}){return t.jsx("input",{type:a,"data-slot":"input",className:Qe("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 md:text-sm focus-visible:ring-2 focus-visible:ring-ring",n),...l})}function rw(){const n=Wa(),[a,l]=h.useState(""),[o,c]=h.useState(""),[u,f]=h.useState(""),[p,x]=h.useState(!1),g=async()=>{f(""),x(!0);try{const v=await jt("/api/admin",{username:a.trim(),password:o});if((v==null?void 0:v.success)!==!1&&(v!=null&&v.token)){eb(v.token),n("/dashboard",{replace:!0});return}f(v.error||"用户名或密码错误")}catch(v){const y=v;f(y.status===401?"用户名或密码错误":(y==null?void 0:y.message)||"网络错误,请重试")}finally{x(!1)}};return t.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[t.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[t.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),t.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),t.jsxs("div",{className:"w-full max-w-md relative z-10",children:[t.jsxs("div",{className:"text-center mb-8",children:[t.jsx("div",{className:"w-16 h-16 bg-[#38bdac]/20 rounded-2xl flex items-center justify-center mx-auto mb-4 border border-[#38bdac]/30",children:t.jsx(zd,{className:"w-8 h-8 text-[#38bdac]"})}),t.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),t.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),t.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[t.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),t.jsxs("div",{className:"relative",children:[t.jsx(qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx(se,{type:"text",value:a,onChange:v=>l(v.target.value),placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),t.jsxs("div",{className:"relative",children:[t.jsx(mN,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx(se,{type:"password",value:o,onChange:v=>c(v.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:v=>v.key==="Enter"&&g()})]})]}),u&&t.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:u}),t.jsx(ie,{onClick:g,disabled:p,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:p?"登录中...":"登录"})]})]}),t.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Re=h.forwardRef(({className:n,...a},l)=>t.jsx("div",{ref:l,className:Qe("rounded-xl border bg-card text-card-foreground shadow",n),...a}));Re.displayName="Card";const Ue=h.forwardRef(({className:n,...a},l)=>t.jsx("div",{ref:l,className:Qe("flex flex-col space-y-1.5 p-6",n),...a}));Ue.displayName="CardHeader";const Ve=h.forwardRef(({className:n,...a},l)=>t.jsx("h3",{ref:l,className:Qe("font-semibold leading-none tracking-tight",n),...a}));Ve.displayName="CardTitle";const ot=h.forwardRef(({className:n,...a},l)=>t.jsx("p",{ref:l,className:Qe("text-sm text-muted-foreground",n),...a}));ot.displayName="CardDescription";const Te=h.forwardRef(({className:n,...a},l)=>t.jsx("div",{ref:l,className:Qe("p-6 pt-0",n),...a}));Te.displayName="CardContent";const nw=h.forwardRef(({className:n,...a},l)=>t.jsx("div",{ref:l,className:Qe("flex items-center p-6 pt-0",n),...a}));nw.displayName="CardFooter";function sw(){const n=Wa(),[a,l]=h.useState(!0),[o,c]=h.useState([]),[u,f]=h.useState([]);async function p(){l(!0);try{const[C,N]=await Promise.all([Ke("/api/db/users"),Ke("/api/orders")]);C!=null&&C.success&&C.users&&c(C.users),N!=null&&N.success&&N.orders&&f(N.orders)}catch(C){console.error("加载数据失败",C)}finally{l(!1)}}if(h.useEffect(()=>{p()},[]),a)return t.jsxs("div",{className:"p-8 w-full",children:[t.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),t.jsxs("div",{className:"flex flex-col items-center justify-center py-24",children:[t.jsx(Ze,{className:"w-12 h-12 text-[#38bdac] animate-spin mb-4"}),t.jsx("span",{className:"text-gray-400",children:"加载中..."})]})]});const g=u.filter(C=>C.status==="paid"||C.status==="completed"||C.status==="success").reduce((C,N)=>C+Number(N.amount||0),0),v=o.length,y=u.length,k=C=>{const N=C.productType||"",w=C.description||"";if(w){if(N==="section"&&w.includes("章节")){if(w.includes("-")){const S=w.split("-");if(S.length>=3)return{title:`第${S[1]}章 第${S[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:w,subtitle:"章节购买"}}return N==="fullbook"||w.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:N==="match"||w.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:w,subtitle:N==="section"?"单章":N==="fullbook"?"全书":"其他"}}return N==="section"?{title:`章节 ${C.productId||""}`,subtitle:"单章购买"}:N==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:N==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:N||"其他"}},R=[{title:"总用户数",value:v,icon:vr,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:`¥${Number(g).toFixed(2)}`,icon:gd,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:y,icon:pd,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:`${v>0?(y/v*100).toFixed(1):0}%`,icon:Vr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"}];return t.jsxs("div",{className:"p-8 w-full",children:[t.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:R.map((C,N)=>t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>C.link&&n(C.link),children:[t.jsxs(Ue,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsx(Ve,{className:"text-sm font-medium text-gray-400",children:C.title}),t.jsx("div",{className:`p-2 rounded-lg ${C.bg}`,children:t.jsx(C.icon,{className:`w-4 h-4 ${C.color}`})})]}),t.jsx(Te,{children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"text-2xl font-bold text-white",children:C.value}),t.jsx(As,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},N))}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"最近订单"})}),t.jsx(Te,{children:t.jsxs("div",{className:"space-y-3",children:[u.slice(-5).reverse().map(C=>{var j;const N=C.referrerId?o.find(_=>_.id===C.referrerId):void 0,w=C.referralCode||(N==null?void 0:N.referralCode)||(N==null?void 0:N.nickname)||(C.referrerId?String(C.referrerId).slice(0,8):""),S=k(C),P=C.userNickname||((j=o.find(_=>_.id===C.userId))==null?void 0:j.nickname)||"匿名用户";return t.jsxs("div",{className:"flex items-start justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30 hover:border-[#38bdac]/30 transition-colors",children:[t.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[C.userAvatar?t.jsx("img",{src:C.userAvatar,alt:P,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:_=>{_.currentTarget.style.display="none";const B=_.currentTarget.nextElementSibling;B&&B.classList.remove("hidden")}}):null,t.jsx("div",{className:`w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 mt-0.5 ${C.userAvatar?"hidden":""}`,children:P.charAt(0)}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"text-sm text-gray-300",children:P}),t.jsx("span",{className:"text-gray-600",children:"·"}),t.jsx("span",{className:"text-sm font-medium text-white truncate",children:S.title})]}),t.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[t.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:S.subtitle}),t.jsx("span",{children:new Date(C.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),w&&t.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",w]})]})]}),t.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[t.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(C.amount).toFixed(2)]}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:C.paymentMethod||"微信"})]})]},C.id)}),u.length===0&&t.jsxs("div",{className:"text-center py-12",children:[t.jsx(pd,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),t.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"新注册用户"})}),t.jsx(Te,{children:t.jsxs("div",{className:"space-y-3",children:[o.slice(-5).reverse().map(C=>{var N;return t.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((N=C.nickname)==null?void 0:N.charAt(0))||"?"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-white",children:C.nickname||"匿名用户"}),t.jsx("p",{className:"text-xs text-gray-500",children:C.phone||"-"})]})]}),t.jsx("p",{className:"text-xs text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleDateString():"-"})]},C.id)}),o.length===0&&t.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})]})]})]})}const Gr=h.forwardRef(({className:n,...a},l)=>t.jsx("div",{className:"relative w-full overflow-auto",children:t.jsx("table",{ref:l,className:Qe("w-full caption-bottom text-sm",n),...a})}));Gr.displayName="Table";const Yr=h.forwardRef(({className:n,...a},l)=>t.jsx("thead",{ref:l,className:Qe("[&_tr]:border-b",n),...a}));Yr.displayName="TableHeader";const Qr=h.forwardRef(({className:n,...a},l)=>t.jsx("tbody",{ref:l,className:Qe("[&_tr:last-child]:border-0",n),...a}));Qr.displayName="TableBody";const st=h.forwardRef(({className:n,...a},l)=>t.jsx("tr",{ref:l,className:Qe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",n),...a}));st.displayName="TableRow";const _e=h.forwardRef(({className:n,...a},l)=>t.jsx("th",{ref:l,className:Qe("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",n),...a}));_e.displayName="TableHead";const ke=h.forwardRef(({className:n,...a},l)=>t.jsx("td",{ref:l,className:Qe("p-4 align-middle [&:has([role=checkbox])]:pr-0",n),...a}));ke.displayName="TableCell";const aw=Ip("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 transition-colors",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Le({className:n,variant:a,asChild:l=!1,...o}){const c=l?Rp:"span";return t.jsx(c,{className:Qe(aw({variant:a}),n),...o})}function De(n,a,{checkForDefaultPrevented:l=!0}={}){return function(c){if(n==null||n(c),l===!1||!c.defaultPrevented)return a==null?void 0:a(c)}}function lw(n,a){const l=h.createContext(a),o=u=>{const{children:f,...p}=u,x=h.useMemo(()=>p,Object.values(p));return t.jsx(l.Provider,{value:x,children:f})};o.displayName=n+"Provider";function c(u){const f=h.useContext(l);if(f)return f;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${n}\``)}return[o,c]}function Rn(n,a=[]){let l=[];function o(u,f){const p=h.createContext(f),x=l.length;l=[...l,f];const g=y=>{var S;const{scope:k,children:R,...C}=y,N=((S=k==null?void 0:k[n])==null?void 0:S[x])||p,w=h.useMemo(()=>C,Object.values(C));return t.jsx(N.Provider,{value:w,children:R})};g.displayName=u+"Provider";function v(y,k){var N;const R=((N=k==null?void 0:k[n])==null?void 0:N[x])||p,C=h.useContext(R);if(C)return C;if(f!==void 0)return f;throw new Error(`\`${y}\` must be used within \`${u}\``)}return[g,v]}const c=()=>{const u=l.map(f=>h.createContext(f));return function(p){const x=(p==null?void 0:p[n])||u;return h.useMemo(()=>({[`__scope${n}`]:{...p,[n]:x}}),[p,x])}};return c.scopeName=n,[o,iw(c,...a)]}function iw(...n){const a=n[0];if(n.length===1)return a;const l=()=>{const o=n.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(u){const f=o.reduce((p,{useScope:x,scopeName:g})=>{const y=x(u)[`__scope${g}`];return{...p,...y}},{});return h.useMemo(()=>({[`__scope${a.scopeName}`]:f}),[f])}};return l.scopeName=a.scopeName,l}var _t=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},ow=Ii[" useId ".trim().toString()]||(()=>{}),cw=0;function wn(n){const[a,l]=h.useState(ow());return _t(()=>{l(o=>o??String(cw++))},[n]),a?`radix-${a}`:""}var dw=Ii[" useInsertionEffect ".trim().toString()]||_t;function Jn({prop:n,defaultProp:a,onChange:l=()=>{},caller:o}){const[c,u,f]=uw({defaultProp:a,onChange:l}),p=n!==void 0,x=p?n:c;{const v=h.useRef(n!==void 0);h.useEffect(()=>{const y=v.current;y!==p&&console.warn(`${o} is changing from ${y?"controlled":"uncontrolled"} to ${p?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=p},[p,o])}const g=h.useCallback(v=>{var y;if(p){const k=fw(v)?v(n):v;k!==n&&((y=f.current)==null||y.call(f,k))}else u(v)},[p,n,u,f]);return[x,g]}function uw({defaultProp:n,onChange:a}){const[l,o]=h.useState(n),c=h.useRef(l),u=h.useRef(a);return dw(()=>{u.current=a},[a]),h.useEffect(()=>{var f;c.current!==l&&((f=u.current)==null||f.call(u,l),c.current=l)},[l,c]),[l,o,u]}function fw(n){return typeof n=="function"}function Ba(n){const a=hw(n),l=h.forwardRef((o,c)=>{const{children:u,...f}=o,p=h.Children.toArray(u),x=p.find(pw);if(x){const g=x.props.children,v=p.map(y=>y===x?h.Children.count(g)>1?h.Children.only(null):h.isValidElement(g)?g.props.children:null:y);return t.jsx(a,{...f,ref:c,children:h.isValidElement(g)?h.cloneElement(g,void 0,v):null})}return t.jsx(a,{...f,ref:c,children:u})});return l.displayName=`${n}.Slot`,l}function hw(n){const a=h.forwardRef((l,o)=>{const{children:c,...u}=l;if(h.isValidElement(c)){const f=gw(c),p=xw(u,c.props);return c.type!==h.Fragment&&(p.ref=o?Ud(o,f):f),h.cloneElement(c,p)}return h.Children.count(c)>1?h.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var mw=Symbol("radix.slottable");function pw(n){return h.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===mw}function xw(n,a){const l={...a};for(const o in a){const c=n[o],u=a[o];/^on[A-Z]/.test(o)?c&&u?l[o]=(...p)=>{const x=u(...p);return c(...p),x}:c&&(l[o]=c):o==="style"?l[o]={...c,...u}:o==="className"&&(l[o]=[c,u].filter(Boolean).join(" "))}return{...n,...l}}function gw(n){var o,c;let a=(o=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:o.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?n.ref:(a=(c=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?n.props.ref:n.props.ref||n.ref)}var vw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=vw.reduce((n,a)=>{const l=Ba(`Primitive.${a}`),o=h.forwardRef((c,u)=>{const{asChild:f,...p}=c,x=f?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(x,{...p,ref:u})});return o.displayName=`Primitive.${a}`,{...n,[a]:o}},{});function yw(n,a){n&&Va.flushSync(()=>n.dispatchEvent(a))}function Cn(n){const a=h.useRef(n);return h.useEffect(()=>{a.current=n}),h.useMemo(()=>(...l)=>{var o;return(o=a.current)==null?void 0:o.call(a,...l)},[])}function jw(n,a=globalThis==null?void 0:globalThis.document){const l=Cn(n);h.useEffect(()=>{const o=c=>{c.key==="Escape"&&l(c)};return a.addEventListener("keydown",o,{capture:!0}),()=>a.removeEventListener("keydown",o,{capture:!0})},[l,a])}var Nw="DismissableLayer",yd="dismissableLayer.update",bw="dismissableLayer.pointerDownOutside",ww="dismissableLayer.focusOutside",Dm,Hp=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wd=h.forwardRef((n,a)=>{const{disableOutsidePointerEvents:l=!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:f,onDismiss:p,...x}=n,g=h.useContext(Hp),[v,y]=h.useState(null),k=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,R]=h.useState({}),C=Ye(a,E=>y(E)),N=Array.from(g.layers),[w]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),S=N.indexOf(w),P=v?N.indexOf(v):-1,j=g.layersWithOutsidePointerEventsDisabled.size>0,_=P>=S,B=kw(E=>{const T=E.target,z=[...g.branches].some(q=>q.contains(T));!_||z||(c==null||c(E),f==null||f(E),E.defaultPrevented||p==null||p())},k),V=Ew(E=>{const T=E.target;[...g.branches].some(q=>q.contains(T))||(u==null||u(E),f==null||f(E),E.defaultPrevented||p==null||p())},k);return jw(E=>{P===g.layers.size-1&&(o==null||o(E),!E.defaultPrevented&&p&&(E.preventDefault(),p()))},k),h.useEffect(()=>{if(v)return l&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(Dm=k.body.style.pointerEvents,k.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(v)),g.layers.add(v),Lm(),()=>{l&&g.layersWithOutsidePointerEventsDisabled.size===1&&(k.body.style.pointerEvents=Dm)}},[v,k,l,g]),h.useEffect(()=>()=>{v&&(g.layers.delete(v),g.layersWithOutsidePointerEventsDisabled.delete(v),Lm())},[v,g]),h.useEffect(()=>{const E=()=>R({});return document.addEventListener(yd,E),()=>document.removeEventListener(yd,E)},[]),t.jsx(ze.div,{...x,ref:C,style:{pointerEvents:j?_?"auto":"none":void 0,...n.style},onFocusCapture:De(n.onFocusCapture,V.onFocusCapture),onBlurCapture:De(n.onBlurCapture,V.onBlurCapture),onPointerDownCapture:De(n.onPointerDownCapture,B.onPointerDownCapture)})});Wd.displayName=Nw;var Sw="DismissableLayerBranch",Cw=h.forwardRef((n,a)=>{const l=h.useContext(Hp),o=h.useRef(null),c=Ye(a,o);return h.useEffect(()=>{const u=o.current;if(u)return l.branches.add(u),()=>{l.branches.delete(u)}},[l.branches]),t.jsx(ze.div,{...n,ref:c})});Cw.displayName=Sw;function kw(n,a=globalThis==null?void 0:globalThis.document){const l=Cn(n),o=h.useRef(!1),c=h.useRef(()=>{});return h.useEffect(()=>{const u=p=>{if(p.target&&!o.current){let x=function(){Kp(bw,l,g,{discrete:!0})};const g={originalEvent:p};p.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=x,a.addEventListener("click",c.current,{once:!0})):x()}else a.removeEventListener("click",c.current);o.current=!1},f=window.setTimeout(()=>{a.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(f),a.removeEventListener("pointerdown",u),a.removeEventListener("click",c.current)}},[a,l]),{onPointerDownCapture:()=>o.current=!0}}function Ew(n,a=globalThis==null?void 0:globalThis.document){const l=Cn(n),o=h.useRef(!1);return h.useEffect(()=>{const c=u=>{u.target&&!o.current&&Kp(ww,l,{originalEvent:u},{discrete:!1})};return a.addEventListener("focusin",c),()=>a.removeEventListener("focusin",c)},[a,l]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Lm(){const n=new CustomEvent(yd);document.dispatchEvent(n)}function Kp(n,a,l,{discrete:o}){const c=l.originalEvent.target,u=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:l});a&&c.addEventListener(n,a,{once:!0}),o?yw(c,u):c.dispatchEvent(u)}var qc="focusScope.autoFocusOnMount",Xc="focusScope.autoFocusOnUnmount",Om={bubbles:!1,cancelable:!0},Pw="FocusScope",Hd=h.forwardRef((n,a)=>{const{loop:l=!1,trapped:o=!1,onMountAutoFocus:c,onUnmountAutoFocus:u,...f}=n,[p,x]=h.useState(null),g=Cn(c),v=Cn(u),y=h.useRef(null),k=Ye(a,N=>x(N)),R=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(o){let N=function(j){if(R.paused||!p)return;const _=j.target;p.contains(_)?y.current=_:yn(y.current,{select:!0})},w=function(j){if(R.paused||!p)return;const _=j.relatedTarget;_!==null&&(p.contains(_)||yn(y.current,{select:!0}))},S=function(j){if(document.activeElement===document.body)for(const B of j)B.removedNodes.length>0&&yn(p)};document.addEventListener("focusin",N),document.addEventListener("focusout",w);const P=new MutationObserver(S);return p&&P.observe(p,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",w),P.disconnect()}}},[o,p,R.paused]),h.useEffect(()=>{if(p){zm.add(R);const N=document.activeElement;if(!p.contains(N)){const S=new CustomEvent(qc,Om);p.addEventListener(qc,g),p.dispatchEvent(S),S.defaultPrevented||(Rw(Mw(Gp(p)),{select:!0}),document.activeElement===N&&yn(p))}return()=>{p.removeEventListener(qc,g),setTimeout(()=>{const S=new CustomEvent(Xc,Om);p.addEventListener(Xc,v),p.dispatchEvent(S),S.defaultPrevented||yn(N??document.body,{select:!0}),p.removeEventListener(Xc,v),zm.remove(R)},0)}}},[p,g,v,R]);const C=h.useCallback(N=>{if(!l&&!o||R.paused)return;const w=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,S=document.activeElement;if(w&&S){const P=N.currentTarget,[j,_]=Tw(P);j&&_?!N.shiftKey&&S===_?(N.preventDefault(),l&&yn(j,{select:!0})):N.shiftKey&&S===j&&(N.preventDefault(),l&&yn(_,{select:!0})):S===P&&N.preventDefault()}},[l,o,R.paused]);return t.jsx(ze.div,{tabIndex:-1,...f,ref:k,onKeyDown:C})});Hd.displayName=Pw;function Rw(n,{select:a=!1}={}){const l=document.activeElement;for(const o of n)if(yn(o,{select:a}),document.activeElement!==l)return}function Tw(n){const a=Gp(n),l=Fm(a,n),o=Fm(a.reverse(),n);return[l,o]}function Gp(n){const a=[],l=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const c=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||c?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;l.nextNode();)a.push(l.currentNode);return a}function Fm(n,a){for(const l of n)if(!_w(l,{upTo:a}))return l}function _w(n,{upTo:a}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(a!==void 0&&n===a)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function Iw(n){return n instanceof HTMLInputElement&&"select"in n}function yn(n,{select:a=!1}={}){if(n&&n.focus){const l=document.activeElement;n.focus({preventScroll:!0}),n!==l&&Iw(n)&&a&&n.select()}}var zm=Aw();function Aw(){let n=[];return{add(a){const l=n[0];a!==l&&(l==null||l.pause()),n=$m(n,a),n.unshift(a)},remove(a){var l;n=$m(n,a),(l=n[0])==null||l.resume()}}}function $m(n,a){const l=[...n],o=l.indexOf(a);return o!==-1&&l.splice(o,1),l}function Mw(n){return n.filter(a=>a.tagName!=="A")}var Dw="Portal",Kd=h.forwardRef((n,a)=>{var p;const{container:l,...o}=n,[c,u]=h.useState(!1);_t(()=>u(!0),[]);const f=l||c&&((p=globalThis==null?void 0:globalThis.document)==null?void 0:p.body);return f?dy.createPortal(t.jsx(ze.div,{...o,ref:a}),f):null});Kd.displayName=Dw;function Lw(n,a){return h.useReducer((l,o)=>a[l][o]??l,n)}var Ha=n=>{const{present:a,children:l}=n,o=Ow(a),c=typeof l=="function"?l({present:o.isPresent}):h.Children.only(l),u=Ye(o.ref,Fw(c));return typeof l=="function"||o.isPresent?h.cloneElement(c,{ref:u}):null};Ha.displayName="Presence";function Ow(n){const[a,l]=h.useState(),o=h.useRef(null),c=h.useRef(n),u=h.useRef("none"),f=n?"mounted":"unmounted",[p,x]=Lw(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const g=ai(o.current);u.current=p==="mounted"?g:"none"},[p]),_t(()=>{const g=o.current,v=c.current;if(v!==n){const k=u.current,R=ai(g);n?x("MOUNT"):R==="none"||(g==null?void 0:g.display)==="none"?x("UNMOUNT"):x(v&&k!==R?"ANIMATION_OUT":"UNMOUNT"),c.current=n}},[n,x]),_t(()=>{if(a){let g;const v=a.ownerDocument.defaultView??window,y=R=>{const N=ai(o.current).includes(CSS.escape(R.animationName));if(R.target===a&&N&&(x("ANIMATION_END"),!c.current)){const w=a.style.animationFillMode;a.style.animationFillMode="forwards",g=v.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=w)})}},k=R=>{R.target===a&&(u.current=ai(o.current))};return a.addEventListener("animationstart",k),a.addEventListener("animationcancel",y),a.addEventListener("animationend",y),()=>{v.clearTimeout(g),a.removeEventListener("animationstart",k),a.removeEventListener("animationcancel",y),a.removeEventListener("animationend",y)}}else x("ANIMATION_END")},[a,x]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:h.useCallback(g=>{o.current=g?getComputedStyle(g):null,l(g)},[])}}function ai(n){return(n==null?void 0:n.animationName)||"none"}function Fw(n){var o,c;let a=(o=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:o.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?n.ref:(a=(c=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?n.props.ref:n.props.ref||n.ref)}var Jc=0;function Yp(){h.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??Bm()),document.body.insertAdjacentElement("beforeend",n[1]??Bm()),Jc++,()=>{Jc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Jc--}},[])}function Bm(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var Pr=function(){return Pr=Object.assign||function(a){for(var l,o=1,c=arguments.length;o"u")return t1;var a=r1(n),l=document.documentElement.clientWidth,o=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,o-l+a[2]-a[0])}},s1=Jp(),Ds="data-scroll-locked",a1=function(n,a,l,o){var c=n.left,u=n.top,f=n.right,p=n.gap;return l===void 0&&(l="margin"),` - .`.concat($w,` { - overflow: hidden `).concat(o,`; - padding-right: `).concat(p,"px ").concat(o,`; - } - body[`).concat(Ds,`] { - overflow: hidden `).concat(o,`; - overscroll-behavior: contain; - `).concat([a&&"position: relative ".concat(o,";"),l==="margin"&&` - padding-left: `.concat(c,`px; - padding-top: `).concat(u,`px; - padding-right: `).concat(f,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(p,"px ").concat(o,`; - `),l==="padding"&&"padding-right: ".concat(p,"px ").concat(o,";")].filter(Boolean).join(""),` - } - - .`).concat(hi,` { - right: `).concat(p,"px ").concat(o,`; - } - - .`).concat(mi,` { - margin-right: `).concat(p,"px ").concat(o,`; - } - - .`).concat(hi," .").concat(hi,` { - right: 0 `).concat(o,`; - } - - .`).concat(mi," .").concat(mi,` { - margin-right: 0 `).concat(o,`; - } - - body[`).concat(Ds,`] { - `).concat(Bw,": ").concat(p,`px; - } -`)},Vm=function(){var n=parseInt(document.body.getAttribute(Ds)||"0",10);return isFinite(n)?n:0},l1=function(){h.useEffect(function(){return document.body.setAttribute(Ds,(Vm()+1).toString()),function(){var n=Vm()-1;n<=0?document.body.removeAttribute(Ds):document.body.setAttribute(Ds,n.toString())}},[])},i1=function(n){var a=n.noRelative,l=n.noImportant,o=n.gapMode,c=o===void 0?"margin":o;l1();var u=h.useMemo(function(){return n1(c)},[c]);return h.createElement(s1,{styles:a1(u,!a,c,l?"":"!important")})},jd=!1;if(typeof window<"u")try{var li=Object.defineProperty({},"passive",{get:function(){return jd=!0,!0}});window.addEventListener("test",li,li),window.removeEventListener("test",li,li)}catch{jd=!1}var Ts=jd?{passive:!1}:!1,o1=function(n){return n.tagName==="TEXTAREA"},Zp=function(n,a){if(!(n instanceof Element))return!1;var l=window.getComputedStyle(n);return l[a]!=="hidden"&&!(l.overflowY===l.overflowX&&!o1(n)&&l[a]==="visible")},c1=function(n){return Zp(n,"overflowY")},d1=function(n){return Zp(n,"overflowX")},Wm=function(n,a){var l=a.ownerDocument,o=a;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var c=ex(n,o);if(c){var u=tx(n,o),f=u[1],p=u[2];if(f>p)return!0}o=o.parentNode}while(o&&o!==l.body);return!1},u1=function(n){var a=n.scrollTop,l=n.scrollHeight,o=n.clientHeight;return[a,l,o]},f1=function(n){var a=n.scrollLeft,l=n.scrollWidth,o=n.clientWidth;return[a,l,o]},ex=function(n,a){return n==="v"?c1(a):d1(a)},tx=function(n,a){return n==="v"?u1(a):f1(a)},h1=function(n,a){return n==="h"&&a==="rtl"?-1:1},m1=function(n,a,l,o,c){var u=h1(n,window.getComputedStyle(a).direction),f=u*o,p=l.target,x=a.contains(p),g=!1,v=f>0,y=0,k=0;do{if(!p)break;var R=tx(n,p),C=R[0],N=R[1],w=R[2],S=N-w-u*C;(C||S)&&ex(n,p)&&(y+=S,k+=C);var P=p.parentNode;p=P&&P.nodeType===Node.DOCUMENT_FRAGMENT_NODE?P.host:P}while(!x&&p!==document.body||x&&(a.contains(p)||a===p));return(v&&Math.abs(y)<1||!v&&Math.abs(k)<1)&&(g=!0),g},ii=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},Hm=function(n){return[n.deltaX,n.deltaY]},Km=function(n){return n&&"current"in n?n.current:n},p1=function(n,a){return n[0]===a[0]&&n[1]===a[1]},x1=function(n){return` - .block-interactivity-`.concat(n,` {pointer-events: none;} - .allow-interactivity-`).concat(n,` {pointer-events: all;} -`)},g1=0,_s=[];function v1(n){var a=h.useRef([]),l=h.useRef([0,0]),o=h.useRef(),c=h.useState(g1++)[0],u=h.useState(Jp)[0],f=h.useRef(n);h.useEffect(function(){f.current=n},[n]),h.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(c));var N=zw([n.lockRef.current],(n.shards||[]).map(Km),!0).filter(Boolean);return N.forEach(function(w){return w.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),N.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(c))})}}},[n.inert,n.lockRef.current,n.shards]);var p=h.useCallback(function(N,w){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!f.current.allowPinchZoom;var S=ii(N),P=l.current,j="deltaX"in N?N.deltaX:P[0]-S[0],_="deltaY"in N?N.deltaY:P[1]-S[1],B,V=N.target,E=Math.abs(j)>Math.abs(_)?"h":"v";if("touches"in N&&E==="h"&&V.type==="range")return!1;var T=window.getSelection(),z=T&&T.anchorNode,q=z?z===V||z.contains(V):!1;if(q)return!1;var ue=Wm(E,V);if(!ue)return!0;if(ue?B=E:(B=E==="v"?"h":"v",ue=Wm(E,V)),!ue)return!1;if(!o.current&&"changedTouches"in N&&(j||_)&&(o.current=B),!B)return!0;var ee=o.current||B;return m1(ee,w,N,ee==="h"?j:_)},[]),x=h.useCallback(function(N){var w=N;if(!(!_s.length||_s[_s.length-1]!==u)){var S="deltaY"in w?Hm(w):ii(w),P=a.current.filter(function(B){return B.name===w.type&&(B.target===w.target||w.target===B.shadowParent)&&p1(B.delta,S)})[0];if(P&&P.should){w.cancelable&&w.preventDefault();return}if(!P){var j=(f.current.shards||[]).map(Km).filter(Boolean).filter(function(B){return B.contains(w.target)}),_=j.length>0?p(w,j[0]):!f.current.noIsolation;_&&w.cancelable&&w.preventDefault()}}},[]),g=h.useCallback(function(N,w,S,P){var j={name:N,delta:w,target:S,should:P,shadowParent:y1(S)};a.current.push(j),setTimeout(function(){a.current=a.current.filter(function(_){return _!==j})},1)},[]),v=h.useCallback(function(N){l.current=ii(N),o.current=void 0},[]),y=h.useCallback(function(N){g(N.type,Hm(N),N.target,p(N,n.lockRef.current))},[]),k=h.useCallback(function(N){g(N.type,ii(N),N.target,p(N,n.lockRef.current))},[]);h.useEffect(function(){return _s.push(u),n.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:k}),document.addEventListener("wheel",x,Ts),document.addEventListener("touchmove",x,Ts),document.addEventListener("touchstart",v,Ts),function(){_s=_s.filter(function(N){return N!==u}),document.removeEventListener("wheel",x,Ts),document.removeEventListener("touchmove",x,Ts),document.removeEventListener("touchstart",v,Ts)}},[]);var R=n.removeScrollBar,C=n.inert;return h.createElement(h.Fragment,null,C?h.createElement(u,{styles:x1(c)}):null,R?h.createElement(i1,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function y1(n){for(var a=null;n!==null;)n instanceof ShadowRoot&&(a=n.host,n=n.host),n=n.parentNode;return a}const j1=Yw(Xp,v1);var Gd=h.forwardRef(function(n,a){return h.createElement(Fi,Pr({},n,{ref:a,sideCar:j1}))});Gd.classNames=Fi.classNames;var N1=function(n){if(typeof document>"u")return null;var a=Array.isArray(n)?n[0]:n;return a.ownerDocument.body},Is=new WeakMap,oi=new WeakMap,ci={},rd=0,rx=function(n){return n&&(n.host||rx(n.parentNode))},b1=function(n,a){return a.map(function(l){if(n.contains(l))return l;var o=rx(l);return o&&n.contains(o)?o:(console.error("aria-hidden",l,"in not contained inside",n,". Doing nothing"),null)}).filter(function(l){return!!l})},w1=function(n,a,l,o){var c=b1(a,Array.isArray(n)?n:[n]);ci[l]||(ci[l]=new WeakMap);var u=ci[l],f=[],p=new Set,x=new Set(c),g=function(y){!y||p.has(y)||(p.add(y),g(y.parentNode))};c.forEach(g);var v=function(y){!y||x.has(y)||Array.prototype.forEach.call(y.children,function(k){if(p.has(k))v(k);else try{var R=k.getAttribute(o),C=R!==null&&R!=="false",N=(Is.get(k)||0)+1,w=(u.get(k)||0)+1;Is.set(k,N),u.set(k,w),f.push(k),N===1&&C&&oi.set(k,!0),w===1&&k.setAttribute(l,"true"),C||k.setAttribute(o,"true")}catch(S){console.error("aria-hidden: cannot operate on ",k,S)}})};return v(a),p.clear(),rd++,function(){f.forEach(function(y){var k=Is.get(y)-1,R=u.get(y)-1;Is.set(y,k),u.set(y,R),k||(oi.has(y)||y.removeAttribute(o),oi.delete(y)),R||y.removeAttribute(l)}),rd--,rd||(Is=new WeakMap,Is=new WeakMap,oi=new WeakMap,ci={})}},nx=function(n,a,l){l===void 0&&(l="data-aria-hidden");var o=Array.from(Array.isArray(n)?n:[n]),c=N1(n);return c?(o.push.apply(o,Array.from(c.querySelectorAll("[aria-live], script"))),w1(o,c,l,"aria-hidden")):function(){return null}},zi="Dialog",[sx]=Rn(zi),[S1,Nr]=sx(zi),ax=n=>{const{__scopeDialog:a,children:l,open:o,defaultOpen:c,onOpenChange:u,modal:f=!0}=n,p=h.useRef(null),x=h.useRef(null),[g,v]=Jn({prop:o,defaultProp:c??!1,onChange:u,caller:zi});return t.jsx(S1,{scope:a,triggerRef:p,contentRef:x,contentId:wn(),titleId:wn(),descriptionId:wn(),open:g,onOpenChange:v,onOpenToggle:h.useCallback(()=>v(y=>!y),[v]),modal:f,children:l})};ax.displayName=zi;var lx="DialogTrigger",C1=h.forwardRef((n,a)=>{const{__scopeDialog:l,...o}=n,c=Nr(lx,l),u=Ye(a,c.triggerRef);return t.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":qd(c.open),...o,ref:u,onClick:De(n.onClick,c.onOpenToggle)})});C1.displayName=lx;var Yd="DialogPortal",[k1,ix]=sx(Yd,{forceMount:void 0}),ox=n=>{const{__scopeDialog:a,forceMount:l,children:o,container:c}=n,u=Nr(Yd,a);return t.jsx(k1,{scope:a,forceMount:l,children:h.Children.map(o,f=>t.jsx(Ha,{present:l||u.open,children:t.jsx(Kd,{asChild:!0,container:c,children:f})}))})};ox.displayName=Yd;var Ci="DialogOverlay",cx=h.forwardRef((n,a)=>{const l=ix(Ci,n.__scopeDialog),{forceMount:o=l.forceMount,...c}=n,u=Nr(Ci,n.__scopeDialog);return u.modal?t.jsx(Ha,{present:o||u.open,children:t.jsx(P1,{...c,ref:a})}):null});cx.displayName=Ci;var E1=Ba("DialogOverlay.RemoveScroll"),P1=h.forwardRef((n,a)=>{const{__scopeDialog:l,...o}=n,c=Nr(Ci,l);return t.jsx(Gd,{as:E1,allowPinchZoom:!0,shards:[c.contentRef],children:t.jsx(ze.div,{"data-state":qd(c.open),...o,ref:a,style:{pointerEvents:"auto",...o.style}})})}),Zn="DialogContent",dx=h.forwardRef((n,a)=>{const l=ix(Zn,n.__scopeDialog),{forceMount:o=l.forceMount,...c}=n,u=Nr(Zn,n.__scopeDialog);return t.jsx(Ha,{present:o||u.open,children:u.modal?t.jsx(R1,{...c,ref:a}):t.jsx(T1,{...c,ref:a})})});dx.displayName=Zn;var R1=h.forwardRef((n,a)=>{const l=Nr(Zn,n.__scopeDialog),o=h.useRef(null),c=Ye(a,l.contentRef,o);return h.useEffect(()=>{const u=o.current;if(u)return nx(u)},[]),t.jsx(ux,{...n,ref:c,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:De(n.onCloseAutoFocus,u=>{var f;u.preventDefault(),(f=l.triggerRef.current)==null||f.focus()}),onPointerDownOutside:De(n.onPointerDownOutside,u=>{const f=u.detail.originalEvent,p=f.button===0&&f.ctrlKey===!0;(f.button===2||p)&&u.preventDefault()}),onFocusOutside:De(n.onFocusOutside,u=>u.preventDefault())})}),T1=h.forwardRef((n,a)=>{const l=Nr(Zn,n.__scopeDialog),o=h.useRef(!1),c=h.useRef(!1);return t.jsx(ux,{...n,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{var f,p;(f=n.onCloseAutoFocus)==null||f.call(n,u),u.defaultPrevented||(o.current||(p=l.triggerRef.current)==null||p.focus(),u.preventDefault()),o.current=!1,c.current=!1},onInteractOutside:u=>{var x,g;(x=n.onInteractOutside)==null||x.call(n,u),u.defaultPrevented||(o.current=!0,u.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const f=u.target;((g=l.triggerRef.current)==null?void 0:g.contains(f))&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&c.current&&u.preventDefault()}})}),ux=h.forwardRef((n,a)=>{const{__scopeDialog:l,trapFocus:o,onOpenAutoFocus:c,onCloseAutoFocus:u,...f}=n,p=Nr(Zn,l),x=h.useRef(null),g=Ye(a,x);return Yp(),t.jsxs(t.Fragment,{children:[t.jsx(Hd,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:c,onUnmountAutoFocus:u,children:t.jsx(Wd,{role:"dialog",id:p.contentId,"aria-describedby":p.descriptionId,"aria-labelledby":p.titleId,"data-state":qd(p.open),...f,ref:g,onDismiss:()=>p.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(_1,{titleId:p.titleId}),t.jsx(A1,{contentRef:x,descriptionId:p.descriptionId})]})]})}),Qd="DialogTitle",fx=h.forwardRef((n,a)=>{const{__scopeDialog:l,...o}=n,c=Nr(Qd,l);return t.jsx(ze.h2,{id:c.titleId,...o,ref:a})});fx.displayName=Qd;var hx="DialogDescription",mx=h.forwardRef((n,a)=>{const{__scopeDialog:l,...o}=n,c=Nr(hx,l);return t.jsx(ze.p,{id:c.descriptionId,...o,ref:a})});mx.displayName=hx;var px="DialogClose",xx=h.forwardRef((n,a)=>{const{__scopeDialog:l,...o}=n,c=Nr(px,l);return t.jsx(ze.button,{type:"button",...o,ref:a,onClick:De(n.onClick,()=>c.onOpenChange(!1))})});xx.displayName=px;function qd(n){return n?"open":"closed"}var gx="DialogTitleWarning",[g4,vx]=lw(gx,{contentName:Zn,titleName:Qd,docsSlug:"dialog"}),_1=({titleId:n})=>{const a=vx(gx),l=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return h.useEffect(()=>{n&&(document.getElementById(n)||console.error(l))},[l,n]),null},I1="DialogDescriptionWarning",A1=({contentRef:n,descriptionId:a})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${vx(I1).contentName}}.`;return h.useEffect(()=>{var u;const c=(u=n.current)==null?void 0:u.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(o))},[o,n,a]),null},M1=ax,D1=ox,L1=cx,O1=dx,F1=fx,z1=mx,$1=xx;function Mt(n){return t.jsx(M1,{"data-slot":"dialog",...n})}function B1(n){return t.jsx(D1,{...n})}const yx=h.forwardRef(({className:n,...a},l)=>t.jsx(L1,{ref:l,className:Qe("fixed inset-0 z-50 bg-black/50",n),...a}));yx.displayName="DialogOverlay";const Tt=h.forwardRef(({className:n,children:a,showCloseButton:l=!0,...o},c)=>t.jsxs(B1,{children:[t.jsx(yx,{}),t.jsxs(O1,{ref:c,"aria-describedby":void 0,className:Qe("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg sm:max-w-lg",n),...o,children:[a,l&&t.jsxs($1,{className:"absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[t.jsx(ir,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Tt.displayName="DialogContent";function Dt({className:n,...a}){return t.jsx("div",{className:Qe("flex flex-col gap-2 text-center sm:text-left",n),...a})}function Kt({className:n,...a}){return t.jsx("div",{className:Qe("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",n),...a})}function Lt(n){return t.jsx(F1,{className:"text-lg font-semibold leading-none",...n})}function U1(n){return t.jsx(z1,{className:"text-sm text-muted-foreground",...n})}function Xd(n,a){const[l,o]=h.useState(n);return h.useEffect(()=>{const c=setTimeout(()=>o(n),a);return()=>clearTimeout(c)},[n,a]),l}function Sn({page:n,totalPages:a,total:l,pageSize:o,onPageChange:c,onPageSizeChange:u,pageSizeOptions:f=[10,20,50,100]}){return a<=1&&!u?null:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[t.jsxs("span",{children:["共 ",l," 条"]}),u&&t.jsx("select",{value:o,onChange:p=>u(Number(p.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:f.map(p=>t.jsxs("option",{value:p,children:[p," 条/页"]},p))})]}),a>1&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>c(1),disabled:n<=1,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"首页"}),t.jsx("button",{type:"button",onClick:()=>c(n-1),disabled:n<=1,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"上一页"}),t.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[n," / ",a]}),t.jsx("button",{type:"button",onClick:()=>c(n+1),disabled:n>=a,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),t.jsx("button",{type:"button",onClick:()=>c(a),disabled:n>=a,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"末页"})]})]})}function V1(){const[n,a]=h.useState([]),[l,o]=h.useState([]),[c,u]=h.useState(0),[f,p]=h.useState(0),[x,g]=h.useState(0),[v,y]=h.useState(1),[k,R]=h.useState(10),[C,N]=h.useState(""),w=Xd(C,300),[S,P]=h.useState("all"),[j,_]=h.useState(!0),[B,V]=h.useState(null),[E,T]=h.useState(null),[z,q]=h.useState(""),[ue,ee]=h.useState(!1);async function ce(){_(!0),V(null);try{const H=S==="all"?"":S==="completed"?"completed":S,I=new URLSearchParams({page:String(v),pageSize:String(k),...H&&{status:H},...w&&{search:w}}),[L,X]=await Promise.all([Ke(`/api/orders?${I}`),Ke("/api/db/users?page=1&pageSize=500")]);L!=null&&L.success&&(a(L.orders||[]),u(L.total??0),p(L.totalRevenue??0),g(L.todayRevenue??0)),X!=null&&X.success&&X.users&&o(X.users)}catch(H){console.error("加载订单失败",H),V("加载订单失败,请检查网络后重试")}finally{_(!1)}}h.useEffect(()=>{y(1)},[w,S]),h.useEffect(()=>{ce()},[v,k,w,S]);const G=H=>{var I;return H.userNickname||((I=l.find(L=>L.id===H.userId))==null?void 0:I.nickname)||"匿名用户"},Z=H=>{var I;return((I=l.find(L=>L.id===H))==null?void 0:I.phone)||"-"},te=H=>{const I=H.productType||H.type||"",L=H.description||"";if(L){if(I==="section"&&L.includes("章节")){if(L.includes("-")){const X=L.split("-");if(X.length>=3)return{name:`第${X[1]}章 第${X[2]}节`,type:"《一场Soul的创业实验》"}}return{name:L,type:"章节购买"}}return I==="fullbook"||L.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:I==="vip"||L.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:I==="match"||L.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:L,type:"其他"}}return I==="section"?{name:`章节 ${H.productId||H.sectionId||""}`,type:"单章"}:I==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:I==="vip"?{name:"VIP年度会员",type:"VIP"}:I==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:I||"其他"}},U=Math.ceil(c/k)||1;async function M(){var H;if(!(!(E!=null&&E.orderSn)&&!(E!=null&&E.id))){ee(!0),V(null);try{const I=await St("/api/admin/orders/refund",{orderSn:E.orderSn||E.id,reason:z||void 0});I!=null&&I.success?(T(null),q(""),ce()):V((I==null?void 0:I.error)||"退款失败")}catch(I){const L=I;V(((H=L==null?void 0:L.data)==null?void 0:H.error)||"退款失败,请检查网络后重试")}finally{ee(!1)}}}function Q(){if(n.length===0){alert("暂无数据可导出");return}const H=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],I=n.map(pe=>{const le=te(pe);return[pe.orderSn||pe.id||"",G(pe),Z(pe.userId),le.name,Number(pe.amount||0).toFixed(2),pe.paymentMethod==="wechat"?"微信支付":pe.paymentMethod==="alipay"?"支付宝":pe.paymentMethod||"微信支付",pe.status==="refunded"?"已退款":pe.status==="paid"||pe.status==="completed"?"已完成":pe.status==="pending"||pe.status==="created"?"待支付":"已失败",pe.status==="refunded"&&pe.refundReason?pe.refundReason:"-",pe.referrerEarnings?Number(pe.referrerEarnings).toFixed(2):"-",pe.createdAt?new Date(pe.createdAt).toLocaleString("zh-CN"):""].join(",")}),L="\uFEFF"+[H.join(","),...I].join(` -`),X=new Blob([L],{type:"text/csv;charset=utf-8"}),ae=URL.createObjectURL(X),ve=document.createElement("a");ve.href=ae,ve.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,ve.click(),URL.revokeObjectURL(ae)}return t.jsxs("div",{className:"p-8 w-full",children:[B&&t.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[t.jsx("span",{children:B}),t.jsx("button",{type:"button",onClick:()=>V(null),className:"hover:text-red-300",children:"×"})]}),t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),t.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",n.length," 笔订单"]})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(ie,{variant:"outline",onClick:ce,disabled:j,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${j?"animate-spin":""}`}),"刷新"]}),t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"text-gray-400",children:"总收入:"}),t.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",f.toFixed(2)]}),t.jsx("span",{className:"text-gray-600",children:"|"}),t.jsx("span",{className:"text-gray-400",children:"今日:"}),t.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",x.toFixed(2)]})]})]})]}),t.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[t.jsxs("div",{className:"relative flex-1 max-w-md",children:[t.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),t.jsx(se,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:C,onChange:H=>N(H.target.value)})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Yj,{className:"w-4 h-4 text-gray-400"}),t.jsxs("select",{value:S,onChange:H=>P(H.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[t.jsx("option",{value:"all",children:"全部状态"}),t.jsx("option",{value:"completed",children:"已完成"}),t.jsx("option",{value:"pending",children:"待支付"}),t.jsx("option",{value:"created",children:"已创建"}),t.jsx("option",{value:"failed",children:"已失败"}),t.jsx("option",{value:"refunded",children:"已退款"})]})]}),t.jsxs(ie,{variant:"outline",onClick:Q,disabled:n.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Uj,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(Te,{className:"p-0",children:j?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(Ze,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsxs("div",{children:[t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx(_e,{className:"text-gray-400",children:"订单号"}),t.jsx(_e,{className:"text-gray-400",children:"用户"}),t.jsx(_e,{className:"text-gray-400",children:"商品"}),t.jsx(_e,{className:"text-gray-400",children:"金额"}),t.jsx(_e,{className:"text-gray-400",children:"支付方式"}),t.jsx(_e,{className:"text-gray-400",children:"状态"}),t.jsx(_e,{className:"text-gray-400",children:"退款原因"}),t.jsx(_e,{className:"text-gray-400",children:"分销佣金"}),t.jsx(_e,{className:"text-gray-400",children:"下单时间"}),t.jsx(_e,{className:"text-gray-400",children:"操作"})]})}),t.jsxs(Qr,{children:[n.map(H=>{const I=te(H);return t.jsxs(st,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsxs(ke,{className:"font-mono text-xs text-gray-400",children:[(H.orderSn||H.id||"").slice(0,12),"..."]}),t.jsx(ke,{children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:G(H)}),t.jsx("p",{className:"text-gray-500 text-xs",children:Z(H.userId)})]})}),t.jsx(ke,{children:t.jsxs("div",{children:[t.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[I.name,(H.productType||H.type)==="vip"&&t.jsx(Le,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),t.jsx("p",{className:"text-gray-500 text-xs",children:I.type})]})}),t.jsxs(ke,{className:"text-[#38bdac] font-bold",children:["¥",Number(H.amount||0).toFixed(2)]}),t.jsx(ke,{className:"text-gray-300",children:H.paymentMethod==="wechat"?"微信支付":H.paymentMethod==="alipay"?"支付宝":H.paymentMethod||"微信支付"}),t.jsx(ke,{children:H.status==="refunded"?t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):H.status==="paid"||H.status==="completed"?t.jsx(Le,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):H.status==="pending"||H.status==="created"?t.jsx(Le,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):t.jsx(Le,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),t.jsx(ke,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:H.refundReason,children:H.status==="refunded"&&H.refundReason?H.refundReason:"-"}),t.jsx(ke,{className:"text-[#FFD700]",children:H.referrerEarnings?`¥${Number(H.referrerEarnings).toFixed(2)}`:"-"}),t.jsx(ke,{className:"text-gray-400 text-sm",children:new Date(H.createdAt).toLocaleString("zh-CN")}),t.jsx(ke,{children:(H.status==="paid"||H.status==="completed")&&t.jsxs(ie,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{T(H),q("")},children:[t.jsx(kp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},H.id)}),n.length===0&&t.jsx(st,{children:t.jsx(ke,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),t.jsx(Sn,{page:v,totalPages:U,total:c,pageSize:k,onPageChange:y,onPageSizeChange:H=>{R(H),y(1)}})]})})}),t.jsx(Mt,{open:!!E,onOpenChange:H=>!H&&T(null),children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Dt,{children:t.jsx(Lt,{className:"text-white",children:"订单退款"})}),E&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",E.orderSn||E.id]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(E.amount||0).toFixed(2)]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),t.jsx("div",{className:"form-input",children:t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:z,onChange:H=>q(H.target.value)})})]}),t.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),t.jsxs(Kt,{children:[t.jsx(ie,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>T(null),disabled:ue,children:"取消"}),t.jsx(ie,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:M,disabled:ue,children:ue?"退款中...":"确认退款"})]})]})})]})}var W1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],H1=W1.reduce((n,a)=>{const l=Pp(`Primitive.${a}`),o=h.forwardRef((c,u)=>{const{asChild:f,...p}=c,x=f?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(x,{...p,ref:u})});return o.displayName=`Primitive.${a}`,{...n,[a]:o}},{}),K1="Label",jx=h.forwardRef((n,a)=>t.jsx(H1.label,{...n,ref:a,onMouseDown:l=>{var c;l.target.closest("button, input, select, textarea")||((c=n.onMouseDown)==null||c.call(n,l),!l.defaultPrevented&&l.detail>1&&l.preventDefault())}}));jx.displayName=K1;var Nx=jx;const J=h.forwardRef(({className:n,...a},l)=>t.jsx(Nx,{ref:l,className:Qe("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",n),...a}));J.displayName=Nx.displayName;function Jd(n){const a=h.useRef({value:n,previous:n});return h.useMemo(()=>(a.current.value!==n&&(a.current.previous=a.current.value,a.current.value=n),a.current.previous),[n])}function Zd(n){const[a,l]=h.useState(void 0);return _t(()=>{if(n){l({width:n.offsetWidth,height:n.offsetHeight});const o=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const u=c[0];let f,p;if("borderBoxSize"in u){const x=u.borderBoxSize,g=Array.isArray(x)?x[0]:x;f=g.inlineSize,p=g.blockSize}else f=n.offsetWidth,p=n.offsetHeight;l({width:f,height:p})});return o.observe(n,{box:"border-box"}),()=>o.unobserve(n)}else l(void 0)},[n]),a}var $i="Switch",[G1]=Rn($i),[Y1,Q1]=G1($i),bx=h.forwardRef((n,a)=>{const{__scopeSwitch:l,name:o,checked:c,defaultChecked:u,required:f,disabled:p,value:x="on",onCheckedChange:g,form:v,...y}=n,[k,R]=h.useState(null),C=Ye(a,j=>R(j)),N=h.useRef(!1),w=k?v||!!k.closest("form"):!0,[S,P]=Jn({prop:c,defaultProp:u??!1,onChange:g,caller:$i});return t.jsxs(Y1,{scope:l,checked:S,disabled:p,children:[t.jsx(ze.button,{type:"button",role:"switch","aria-checked":S,"aria-required":f,"data-state":kx(S),"data-disabled":p?"":void 0,disabled:p,value:x,...y,ref:C,onClick:De(n.onClick,j=>{P(_=>!_),w&&(N.current=j.isPropagationStopped(),N.current||j.stopPropagation())})}),w&&t.jsx(Cx,{control:k,bubbles:!N.current,name:o,value:x,checked:S,required:f,disabled:p,form:v,style:{transform:"translateX(-100%)"}})]})});bx.displayName=$i;var wx="SwitchThumb",Sx=h.forwardRef((n,a)=>{const{__scopeSwitch:l,...o}=n,c=Q1(wx,l);return t.jsx(ze.span,{"data-state":kx(c.checked),"data-disabled":c.disabled?"":void 0,...o,ref:a})});Sx.displayName=wx;var q1="SwitchBubbleInput",Cx=h.forwardRef(({__scopeSwitch:n,control:a,checked:l,bubbles:o=!0,...c},u)=>{const f=h.useRef(null),p=Ye(f,u),x=Jd(l),g=Zd(a);return h.useEffect(()=>{const v=f.current;if(!v)return;const y=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(y,"checked").set;if(x!==l&&R){const C=new Event("click",{bubbles:o});R.call(v,l),v.dispatchEvent(C)}},[x,l,o]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:l,...c,tabIndex:-1,ref:p,style:{...c.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Cx.displayName=q1;function kx(n){return n?"checked":"unchecked"}var Ex=bx,X1=Sx;const ht=h.forwardRef(({className:n,...a},l)=>t.jsx(Ex,{className:Qe("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 focus-visible:ring-offset-[#0a1628] disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-gray-600 data-[state=checked]:bg-[#38bdac]",n),...a,ref:l,children:t.jsx(X1,{className:Qe("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));ht.displayName=Ex.displayName;function eu(n){const a=n+"CollectionProvider",[l,o]=Rn(a),[c,u]=l(a,{collectionRef:{current:null},itemMap:new Map}),f=N=>{const{scope:w,children:S}=N,P=vn.useRef(null),j=vn.useRef(new Map).current;return t.jsx(c,{scope:w,itemMap:j,collectionRef:P,children:S})};f.displayName=a;const p=n+"CollectionSlot",x=Ba(p),g=vn.forwardRef((N,w)=>{const{scope:S,children:P}=N,j=u(p,S),_=Ye(w,j.collectionRef);return t.jsx(x,{ref:_,children:P})});g.displayName=p;const v=n+"CollectionItemSlot",y="data-radix-collection-item",k=Ba(v),R=vn.forwardRef((N,w)=>{const{scope:S,children:P,...j}=N,_=vn.useRef(null),B=Ye(w,_),V=u(v,S);return vn.useEffect(()=>(V.itemMap.set(_,{ref:_,...j}),()=>void V.itemMap.delete(_))),t.jsx(k,{[y]:"",ref:B,children:P})});R.displayName=v;function C(N){const w=u(n+"CollectionConsumer",N);return vn.useCallback(()=>{const P=w.collectionRef.current;if(!P)return[];const j=Array.from(P.querySelectorAll(`[${y}]`));return Array.from(w.itemMap.values()).sort((V,E)=>j.indexOf(V.ref.current)-j.indexOf(E.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:f,Slot:g,ItemSlot:R},C,o]}var J1=h.createContext(void 0);function Bi(n){const a=h.useContext(J1);return n||a||"ltr"}var nd="rovingFocusGroup.onEntryFocus",Z1={bubbles:!1,cancelable:!0},Ka="RovingFocusGroup",[Nd,Px,e2]=eu(Ka),[t2,Rx]=Rn(Ka,[e2]),[r2,n2]=t2(Ka),Tx=h.forwardRef((n,a)=>t.jsx(Nd.Provider,{scope:n.__scopeRovingFocusGroup,children:t.jsx(Nd.Slot,{scope:n.__scopeRovingFocusGroup,children:t.jsx(s2,{...n,ref:a})})}));Tx.displayName=Ka;var s2=h.forwardRef((n,a)=>{const{__scopeRovingFocusGroup:l,orientation:o,loop:c=!1,dir:u,currentTabStopId:f,defaultCurrentTabStopId:p,onCurrentTabStopIdChange:x,onEntryFocus:g,preventScrollOnEntryFocus:v=!1,...y}=n,k=h.useRef(null),R=Ye(a,k),C=Bi(u),[N,w]=Jn({prop:f,defaultProp:p??null,onChange:x,caller:Ka}),[S,P]=h.useState(!1),j=Cn(g),_=Px(l),B=h.useRef(!1),[V,E]=h.useState(0);return h.useEffect(()=>{const T=k.current;if(T)return T.addEventListener(nd,j),()=>T.removeEventListener(nd,j)},[j]),t.jsx(r2,{scope:l,orientation:o,dir:C,loop:c,currentTabStopId:N,onItemFocus:h.useCallback(T=>w(T),[w]),onItemShiftTab:h.useCallback(()=>P(!0),[]),onFocusableItemAdd:h.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:h.useCallback(()=>E(T=>T-1),[]),children:t.jsx(ze.div,{tabIndex:S||V===0?-1:0,"data-orientation":o,...y,ref:R,style:{outline:"none",...n.style},onMouseDown:De(n.onMouseDown,()=>{B.current=!0}),onFocus:De(n.onFocus,T=>{const z=!B.current;if(T.target===T.currentTarget&&z&&!S){const q=new CustomEvent(nd,Z1);if(T.currentTarget.dispatchEvent(q),!q.defaultPrevented){const ue=_().filter(te=>te.focusable),ee=ue.find(te=>te.active),ce=ue.find(te=>te.id===N),Z=[ee,ce,...ue].filter(Boolean).map(te=>te.ref.current);Ax(Z,v)}}B.current=!1}),onBlur:De(n.onBlur,()=>P(!1))})})}),_x="RovingFocusGroupItem",Ix=h.forwardRef((n,a)=>{const{__scopeRovingFocusGroup:l,focusable:o=!0,active:c=!1,tabStopId:u,children:f,...p}=n,x=wn(),g=u||x,v=n2(_x,l),y=v.currentTabStopId===g,k=Px(l),{onFocusableItemAdd:R,onFocusableItemRemove:C,currentTabStopId:N}=v;return h.useEffect(()=>{if(o)return R(),()=>C()},[o,R,C]),t.jsx(Nd.ItemSlot,{scope:l,id:g,focusable:o,active:c,children:t.jsx(ze.span,{tabIndex:y?0:-1,"data-orientation":v.orientation,...p,ref:a,onMouseDown:De(n.onMouseDown,w=>{o?v.onItemFocus(g):w.preventDefault()}),onFocus:De(n.onFocus,()=>v.onItemFocus(g)),onKeyDown:De(n.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){v.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const S=i2(w,v.orientation,v.dir);if(S!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let j=k().filter(_=>_.focusable).map(_=>_.ref.current);if(S==="last")j.reverse();else if(S==="prev"||S==="next"){S==="prev"&&j.reverse();const _=j.indexOf(w.currentTarget);j=v.loop?o2(j,_+1):j.slice(_+1)}setTimeout(()=>Ax(j))}}),children:typeof f=="function"?f({isCurrentTabStop:y,hasTabStop:N!=null}):f})})});Ix.displayName=_x;var a2={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function l2(n,a){return a!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function i2(n,a,l){const o=l2(n.key,l);if(!(a==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(a==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return a2[o]}function Ax(n,a=!1){const l=document.activeElement;for(const o of n)if(o===l||(o.focus({preventScroll:a}),document.activeElement!==l))return}function o2(n,a){return n.map((l,o)=>n[(a+o)%n.length])}var c2=Tx,d2=Ix,Ui="Tabs",[u2]=Rn(Ui,[Rx]),Mx=Rx(),[f2,tu]=u2(Ui),Dx=h.forwardRef((n,a)=>{const{__scopeTabs:l,value:o,onValueChange:c,defaultValue:u,orientation:f="horizontal",dir:p,activationMode:x="automatic",...g}=n,v=Bi(p),[y,k]=Jn({prop:o,onChange:c,defaultProp:u??"",caller:Ui});return t.jsx(f2,{scope:l,baseId:wn(),value:y,onValueChange:k,orientation:f,dir:v,activationMode:x,children:t.jsx(ze.div,{dir:v,"data-orientation":f,...g,ref:a})})});Dx.displayName=Ui;var Lx="TabsList",Ox=h.forwardRef((n,a)=>{const{__scopeTabs:l,loop:o=!0,...c}=n,u=tu(Lx,l),f=Mx(l);return t.jsx(c2,{asChild:!0,...f,orientation:u.orientation,dir:u.dir,loop:o,children:t.jsx(ze.div,{role:"tablist","aria-orientation":u.orientation,...c,ref:a})})});Ox.displayName=Lx;var Fx="TabsTrigger",zx=h.forwardRef((n,a)=>{const{__scopeTabs:l,value:o,disabled:c=!1,...u}=n,f=tu(Fx,l),p=Mx(l),x=Ux(f.baseId,o),g=Vx(f.baseId,o),v=o===f.value;return t.jsx(d2,{asChild:!0,...p,focusable:!c,active:v,children:t.jsx(ze.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":g,"data-state":v?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:x,...u,ref:a,onMouseDown:De(n.onMouseDown,y=>{!c&&y.button===0&&y.ctrlKey===!1?f.onValueChange(o):y.preventDefault()}),onKeyDown:De(n.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&f.onValueChange(o)}),onFocus:De(n.onFocus,()=>{const y=f.activationMode!=="manual";!v&&!c&&y&&f.onValueChange(o)})})})});zx.displayName=Fx;var $x="TabsContent",Bx=h.forwardRef((n,a)=>{const{__scopeTabs:l,value:o,forceMount:c,children:u,...f}=n,p=tu($x,l),x=Ux(p.baseId,o),g=Vx(p.baseId,o),v=o===p.value,y=h.useRef(v);return h.useEffect(()=>{const k=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(k)},[]),t.jsx(Ha,{present:c||v,children:({present:k})=>t.jsx(ze.div,{"data-state":v?"active":"inactive","data-orientation":p.orientation,role:"tabpanel","aria-labelledby":x,hidden:!k,id:g,tabIndex:0,...f,ref:a,style:{...n.style,animationDuration:y.current?"0s":void 0},children:k&&u})})});Bx.displayName=$x;function Ux(n,a){return`${n}-trigger-${a}`}function Vx(n,a){return`${n}-content-${a}`}var h2=Dx,Wx=Ox,Hx=zx,Kx=Bx;const ru=h2,Vi=h.forwardRef(({className:n,...a},l)=>t.jsx(Wx,{ref:l,className:Qe("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",n),...a}));Vi.displayName=Wx.displayName;const ar=h.forwardRef(({className:n,...a},l)=>t.jsx(Hx,{ref:l,className:Qe("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",n),...a}));ar.displayName=Hx.displayName;const lr=h.forwardRef(({className:n,...a},l)=>t.jsx(Kx,{ref:l,className:Qe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...a}));lr.displayName=Kx.displayName;function m2({open:n,onClose:a,userId:l,onUserUpdated:o}){var te;const[c,u]=h.useState(null),[f,p]=h.useState([]),[x,g]=h.useState([]),[v,y]=h.useState(!1),[k,R]=h.useState(!1),[C,N]=h.useState(!1),[w,S]=h.useState("info"),[P,j]=h.useState(""),[_,B]=h.useState(""),[V,E]=h.useState([]),[T,z]=h.useState("");h.useEffect(()=>{n&&l&&q()},[n,l]);async function q(){if(l){y(!0);try{const U=await Ke(`/api/db/users?id=${encodeURIComponent(l)}`);if(U!=null&&U.success&&U.user){const M=U.user;u(M),j(M.phone||""),B(M.nickname||""),E(typeof M.tags=="string"?JSON.parse(M.tags||"[]"):[])}try{const M=await Ke(`/api/user/track?userId=${encodeURIComponent(l)}&limit=50`);M!=null&&M.success&&M.tracks&&p(M.tracks)}catch{p([])}try{const M=await Ke(`/api/db/users/referrals?userId=${encodeURIComponent(l)}`);M!=null&&M.success&&M.referrals&&g(M.referrals)}catch{g([])}}catch(U){console.error("Load user detail error:",U)}finally{y(!1)}}}async function ue(){if(!(c!=null&&c.phone)){alert("用户未绑定手机号,无法同步");return}R(!0);try{const U=await jt("/api/ckb/sync",{action:"full_sync",phone:c.phone,userId:c.id});U!=null&&U.success?(alert("同步成功"),q()):alert("同步失败: "+(U==null?void 0:U.error))}catch(U){console.error("Sync CKB error:",U),alert("同步失败")}finally{R(!1)}}async function ee(){if(c){N(!0);try{const U={id:c.id,phone:P||void 0,nickname:_||void 0,tags:JSON.stringify(V)},M=await St("/api/db/users",U);M!=null&&M.success?(alert("保存成功"),q(),o==null||o()):alert("保存失败: "+(M==null?void 0:M.error))}catch(U){console.error("Save user error:",U),alert("保存失败")}finally{N(!1)}}}const ce=()=>{T&&!V.includes(T)&&(E([...V,T]),z(""))},G=U=>{E(V.filter(M=>M!==U))},Z=U=>{const Q={view_chapter:Vr,purchase:pd,match:vr,login:qn,register:qn,share:Yn,bind_phone:RN,bind_wechat:bN}[U]||Nm;return t.jsx(Q,{className:"w-4 h-4"})};return n?t.jsx(Mt,{open:n,onOpenChange:()=>a(),children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(qn,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(c==null?void 0:c.phone)&&t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"})]})}),v?t.jsxs("div",{className:"flex items-center justify-center py-20",children:[t.jsx(Ze,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):c?t.jsxs("div",{className:"flex flex-col h-[70vh]",children:[t.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-4",children:[t.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac]",children:c.avatar?t.jsx("img",{src:c.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((te=c.nickname)==null?void 0:te.charAt(0))||"?"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h3",{className:"text-lg font-bold text-white",children:c.nickname}),c.isAdmin&&t.jsx(Le,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),c.hasFullBook&&t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"})]}),t.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[c.phone?`📱 ${c.phone}`:"未绑定手机",c.wechatId&&` · 💬 ${c.wechatId}`]}),t.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["ID: ",c.id," · 推广码: ",c.referralCode??"-"]})]}),t.jsxs("div",{className:"text-right",children:[t.jsxs("p",{className:"text-[#38bdac] font-bold",children:["¥",(c.earnings||0).toFixed(2)]}),t.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),t.jsxs(ru,{value:w,onValueChange:S,className:"flex-1 flex flex-col overflow-hidden",children:[t.jsxs(Vi,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-4",children:[t.jsx(ar,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"基础信息"}),t.jsx(ar,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"标签体系"}),t.jsx(ar,{value:"tracks",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"行为轨迹"}),t.jsx(ar,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"关系链路"})]}),t.jsxs(lr,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"手机号"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:P,onChange:U=>j(U.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"昵称"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:_,onChange:U=>B(U.target.value)})]})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[t.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),t.jsx("p",{className:"text-2xl font-bold text-white",children:c.referralCount??0})]}),t.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),t.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(c.pendingEarnings??0).toFixed(2)]})]}),t.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),t.jsx("p",{className:"text-sm text-white",children:c.createdAt?new Date(c.createdAt).toLocaleDateString():"-"})]})]}),t.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Yn,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),t.jsx(ie,{size:"sm",onClick:ue,disabled:k||!c.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:k?t.jsxs(t.Fragment,{children:[t.jsx(Ze,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(Ze,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-gray-500",children:"同步状态:"}),c.ckbSyncedAt?t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-gray-500",children:"最后同步:"}),t.jsx("span",{className:"text-gray-300 ml-1",children:c.ckbSyncedAt?new Date(c.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),t.jsx(lr,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:t.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx(UN,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-white font-medium",children:"系统标签"})]}),t.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[V.map((U,M)=>t.jsxs(Le,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[U,t.jsx("button",{type:"button",onClick:()=>G(U),className:"ml-1 hover:text-red-400",children:t.jsx(ir,{className:"w-3 h-3"})})]},M)),V.length===0&&t.jsx("span",{className:"text-gray-500 text-sm",children:"暂无标签"})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(se,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"添加新标签",value:T,onChange:U=>z(U.target.value),onKeyDown:U=>U.key==="Enter"&&ce()}),t.jsx(ie,{onClick:ce,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})}),t.jsx(lr,{value:"tracks",className:"flex-1 overflow-auto",children:t.jsx("div",{className:"space-y-2",children:f.length>0?f.map(U=>t.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:Z(U.action)}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-white font-medium",children:U.actionLabel}),U.chapterTitle&&t.jsxs("span",{className:"text-gray-400 text-sm",children:["- ",U.chapterTitle]})]}),t.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:[t.jsx(wp,{className:"w-3 h-3 inline mr-1"}),U.timeAgo," · ",new Date(U.createdAt).toLocaleString()]})]})]},U.id)):t.jsxs("div",{className:"text-center py-12",children:[t.jsx(Nm,{className:"w-10 h-10 text-[#38bdac]/40 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-400",children:"暂无行为轨迹"})]})})}),t.jsx(lr,{value:"relations",className:"flex-1 overflow-auto space-y-4",children:t.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Yn,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-white font-medium",children:"推荐的用户"})]}),t.jsxs(Le,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:["共 ",x.length," 人"]})]}),t.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto",children:x.length>0?x.map((U,M)=>{var H;const Q=U;return t.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((H=Q.nickname)==null?void 0:H.charAt(0))||"?"}),t.jsx("span",{className:"text-white text-sm",children:Q.nickname})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[Q.status==="vip"&&t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),t.jsx("span",{className:"text-gray-500 text-xs",children:Q.createdAt?new Date(Q.createdAt).toLocaleDateString():""})]})]},Q.id||M)}):t.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t border-gray-700 mt-4",children:[t.jsxs(ie,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"关闭"]}),t.jsxs(ie,{onClick:ee,disabled:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),C?"保存中...":"保存修改"]})]})]}):t.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}const sd={isVip:!1,vipExpireDate:"",vipSort:"",vipRole:"",vipRoleCustom:"",vipName:"",vipProject:"",vipContact:"",vipBio:""};function p2({open:n,onClose:a,userId:l,userNickname:o="",onSaved:c}){const[u,f]=h.useState(sd),[p,x]=h.useState([]),[g,v]=h.useState(!1),[y,k]=h.useState(!1);h.useEffect(()=>{if(!n){f(sd);return}let C=!1;return v(!0),Promise.all([Ke("/api/db/vip-roles"),l?Ke(`/api/db/users?id=${encodeURIComponent(l)}`):Promise.resolve(null)]).then(([N,w])=>{if(C)return;const S=N!=null&&N.success&&N.data?N.data:[];x(S);const P=w&&w.user?w.user:null;if(P){const j=String(P.vipRole??""),_=S.some(B=>B.name===j);f({isVip:!!(P.isVip??!1),vipExpireDate:P.vipExpireDate?String(P.vipExpireDate).slice(0,10):"",vipSort:typeof P.vipSort=="number"?P.vipSort:"",vipRole:_?j:j?"__custom__":"",vipRoleCustom:_?"":j,vipName:String(P.vipName??""),vipProject:String(P.vipProject??""),vipContact:String(P.vipContact??""),vipBio:String(P.vipBio??"")})}else f(sd)}).catch(N=>{C||console.error("Load error:",N)}).finally(()=>{C||v(!1)}),()=>{C=!0}},[n,l]);async function R(){if(l){if(u.isVip&&!u.vipExpireDate.trim()){alert("开启 VIP 时请填写有效到期日");return}if(u.isVip&&u.vipExpireDate.trim()){const C=new Date(u.vipExpireDate);if(isNaN(C.getTime())){alert("到期日格式无效,请使用 YYYY-MM-DD");return}}k(!0);try{const C=u.vipRole==="__custom__"?u.vipRoleCustom.trim():u.vipRole,N={id:l,isVip:u.isVip,vipExpireDate:u.isVip?u.vipExpireDate:void 0,vipSort:u.vipSort===""?void 0:u.vipSort,vipRole:C||void 0,vipName:u.vipName||void 0,vipProject:u.vipProject||void 0,vipContact:u.vipContact||void 0,vipBio:u.vipBio||void 0},w=await St("/api/db/users",N);w!=null&&w.success?(alert("VIP 设置已保存"),c==null||c(),a()):alert("保存失败: "+(w==null?void 0:w.error))}catch(C){console.error("Save VIP error:",C),alert("保存失败")}finally{k(!1)}}}return n?t.jsx(Mt,{open:n,onOpenChange:()=>a(),children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(Li,{className:"w-5 h-5 text-amber-400"}),"设置 VIP - ",o||l]})}),g?t.jsx("div",{className:"py-8 text-center text-gray-400",children:"加载中..."}):t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(J,{className:"text-gray-300",children:"VIP 会员"}),t.jsx(ht,{checked:u.isVip,onCheckedChange:C=>f(N=>({...N,isVip:C}))})]}),u.isVip&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300",children:["到期日 (YYYY-MM-DD) ",t.jsx("span",{className:"text-amber-400",children:"*"})]}),t.jsx(se,{type:"date",className:"bg-[#0a1628] border-gray-700 text-white",value:u.vipExpireDate,onChange:C=>f(N=>({...N,vipExpireDate:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"排序"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"数字越小越靠前,留空按时间",value:u.vipSort===""?"":u.vipSort,onChange:C=>{const N=C.target.value;f(w=>({...w,vipSort:N===""?"":parseInt(N,10)||0}))}})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"角色"}),t.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md px-3 py-2",value:u.vipRole,onChange:C=>f(N=>({...N,vipRole:C.target.value})),children:[t.jsx("option",{value:"",children:"请选择或下方手动填写"}),p.map(C=>t.jsx("option",{value:C.name,children:C.name},C.id)),t.jsx("option",{value:"__custom__",children:"其他(手动填写)"})]}),u.vipRole==="__custom__"&&t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"输入自定义角色",value:u.vipRoleCustom,onChange:C=>f(N=>({...N,vipRoleCustom:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"VIP 展示名"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"创业老板排行展示名",value:u.vipName,onChange:C=>f(N=>({...N,vipName:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"项目/公司"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"项目名称",value:u.vipProject,onChange:C=>f(N=>({...N,vipProject:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"联系方式"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"微信号或手机",value:u.vipContact,onChange:C=>f(N=>({...N,vipContact:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"一句话简介"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"简要描述业务",value:u.vipBio,onChange:C=>f(N=>({...N,vipBio:C.target.value}))})]})]}),t.jsxs(Kt,{children:[t.jsxs(ie,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(ie,{onClick:R,disabled:y||g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),y?"保存中...":"保存"]})]})]})}):null}function x2(){var ss,Qs,qs,Xs,Js;const[n,a]=h.useState([]),[l,o]=h.useState(0),[c,u]=h.useState(1),[f,p]=h.useState(10),[x,g]=h.useState(""),v=Xd(x,300),[y,k]=h.useState("all"),[R,C]=h.useState(!0),[N,w]=h.useState(null),[S,P]=h.useState(!1),[j,_]=h.useState(!1),[B,V]=h.useState(null),[E,T]=h.useState(""),[z,q]=h.useState(""),[ue,ee]=h.useState(!1),[ce,G]=h.useState(!1),[Z,te]=h.useState({referrals:[],stats:{}}),[U,M]=h.useState(!1),[Q,H]=h.useState(null),[I,L]=h.useState(!1),[X,ae]=h.useState(null),[ve,pe]=h.useState(!1),[le,ye]=h.useState(null),[D,fe]=h.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1});async function F(){C(!0),w(null);try{const ne=new URLSearchParams({page:String(c),pageSize:String(f),search:v,...y==="vip"&&{vip:"true"}}),We=await Ke(`/api/db/users?${ne}`);We!=null&&We.success?(a(We.users||[]),o(We.total??0)):w((We==null?void 0:We.error)||"加载失败")}catch(ne){console.error("Load users error:",ne),w("网络错误,请检查连接")}finally{C(!1)}}h.useEffect(()=>{u(1)},[v,y]),h.useEffect(()=>{F()},[c,f,v,y]);const re=Math.ceil(l/f)||1;async function je(ne){if(confirm("确定要删除这个用户吗?"))try{const We=await zs(`/api/db/users?id=${encodeURIComponent(ne)}`);We!=null&&We.success?F():alert("删除失败: "+((We==null?void 0:We.error)||"未知错误"))}catch(We){console.error("Delete user error:",We),alert("删除失败")}}const xe=ne=>{V(ne),fe({phone:ne.phone||"",nickname:ne.nickname||"",password:"",isAdmin:!!(ne.isAdmin??!1),hasFullBook:!!(ne.hasFullBook??!1)}),P(!0)},Oe=()=>{V(null),fe({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),P(!0)};async function Xe(){if(!D.phone||!D.nickname){alert("请填写手机号和昵称");return}ee(!0);try{if(B){const ne=await St("/api/db/users",{id:B.id,nickname:D.nickname,isAdmin:D.isAdmin,hasFullBook:D.hasFullBook,...D.password&&{password:D.password}});if(!(ne!=null&&ne.success)){alert("更新失败: "+((ne==null?void 0:ne.error)||"未知错误"));return}}else{const ne=await jt("/api/db/users",{phone:D.phone,nickname:D.nickname,password:D.password,isAdmin:D.isAdmin});if(!(ne!=null&&ne.success)){alert("创建失败: "+((ne==null?void 0:ne.error)||"未知错误"));return}}P(!1),F()}catch(ne){console.error("Save user error:",ne),alert("保存失败")}finally{ee(!1)}}const Be=ne=>{V(ne),T(""),q(""),_(!0)};async function Ct(ne){H(ne),G(!0),M(!0);try{const We=await Ke(`/api/db/users/referrals?userId=${encodeURIComponent(ne.id)}`);We!=null&&We.success?te({referrals:We.referrals||[],stats:We.stats||{}}):te({referrals:[],stats:{}})}catch(We){console.error("Load referrals error:",We),te({referrals:[],stats:{}})}finally{M(!1)}}const Ft=ne=>{ae(ne.id),L(!0)},In=ne=>{ye(ne),pe(!0)};async function qr(){if(!E){alert("请输入新密码");return}if(E!==z){alert("两次输入的密码不一致");return}if(E.length<6){alert("密码长度不能少于6位");return}ee(!0);try{const ne=await St("/api/db/users",{id:B==null?void 0:B.id,password:E});ne!=null&&ne.success?(alert("密码修改成功"),_(!1)):alert("密码修改失败: "+((ne==null?void 0:ne.error)||"未知错误"))}catch(ne){console.error("Change password error:",ne),alert("密码修改失败")}finally{ee(!1)}}return t.jsxs("div",{className:"p-8 w-full",children:[N&&t.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[t.jsx("span",{children:N}),t.jsx("button",{type:"button",onClick:()=>w(null),className:"hover:text-red-300",children:"×"})]}),t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),t.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",l," 位注册用户",y==="vip"&&",当前筛选 VIP"]})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(ie,{variant:"outline",onClick:F,disabled:R,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${R?"animate-spin":""}`}),"刷新"]}),t.jsxs("select",{value:y,onChange:ne=>{k(ne.target.value),u(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[t.jsx("option",{value:"all",children:"全部用户"}),t.jsx("option",{value:"vip",children:"VIP会员"})]}),t.jsxs("div",{className:"relative",children:[t.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),t.jsx(se,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-64",value:x,onChange:ne=>g(ne.target.value)})]}),t.jsxs(ie,{onClick:Oe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Cm,{className:"w-4 h-4 mr-2"}),"添加用户"]})]})]}),t.jsx(Mt,{open:S,onOpenChange:P,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[B?t.jsx(Ht,{className:"w-5 h-5 text-[#38bdac]"}):t.jsx(Cm,{className:"w-5 h-5 text-[#38bdac]"}),B?"编辑用户":"添加用户"]})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"手机号"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:D.phone,onChange:ne=>fe({...D,phone:ne.target.value}),disabled:!!B})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"昵称"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:D.nickname,onChange:ne=>fe({...D,nickname:ne.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:B?"新密码 (留空则不修改)":"密码"}),t.jsx(se,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:B?"留空则不修改":"请输入密码",value:D.password,onChange:ne=>fe({...D,password:ne.target.value})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(J,{className:"text-gray-300",children:"管理员权限"}),t.jsx(ht,{checked:D.isAdmin,onCheckedChange:ne=>fe({...D,isAdmin:ne})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(J,{className:"text-gray-300",children:"已购全书"}),t.jsx(ht,{checked:D.hasFullBook,onCheckedChange:ne=>fe({...D,hasFullBook:ne})})]})]}),t.jsxs(Kt,{children:[t.jsxs(ie,{variant:"outline",onClick:()=>P(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(ie,{onClick:Xe,disabled:ue,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),ue?"保存中...":"保存"]})]})]})}),t.jsx(Mt,{open:j,onOpenChange:_,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(bm,{className:"w-5 h-5 text-[#38bdac]"}),"修改密码"]})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["用户:",B==null?void 0:B.nickname]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["手机号:",B==null?void 0:B.phone]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"新密码"}),t.jsx(se,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入新密码 (至少6位)",value:E,onChange:ne=>T(ne.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"确认密码"}),t.jsx(se,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请再次输入新密码",value:z,onChange:ne=>q(ne.target.value)})]})]}),t.jsxs(Kt,{children:[t.jsx(ie,{variant:"outline",onClick:()=>_(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(ie,{onClick:qr,disabled:ue,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ue?"保存中...":"确认修改"})]})]})}),t.jsx(m2,{open:I,onClose:()=>L(!1),userId:X,onUserUpdated:F}),t.jsx(p2,{open:ve,onClose:()=>{pe(!1),ye(null)},userId:(le==null?void 0:le.id)??null,userNickname:le==null?void 0:le.nickname,onSaved:F}),t.jsx(Mt,{open:ce,onOpenChange:G,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(vr,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系详情 - ",Q==null?void 0:Q.nickname]})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[t.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[t.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((ss=Z.stats)==null?void 0:ss.total)||0}),t.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),t.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[t.jsx("div",{className:"text-2xl font-bold text-green-400",children:((Qs=Z.stats)==null?void 0:Qs.purchased)||0}),t.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),t.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[t.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((qs=Z.stats)==null?void 0:qs.earnings)||0).toFixed(2)]}),t.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),t.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[t.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((Xs=Z.stats)==null?void 0:Xs.pendingEarnings)||0).toFixed(2)]}),t.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),U?t.jsxs("div",{className:"flex items-center justify-center py-8",children:[t.jsx(Ze,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Js=Z.referrals)==null?void 0:Js.length)??0)>0?t.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(Z.referrals??[]).map((ne,We)=>{var or;const Nt=ne;return t.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((or=Nt.nickname)==null?void 0:or.charAt(0))||"?"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white text-sm",children:Nt.nickname}),t.jsx("div",{className:"text-xs text-gray-500",children:Nt.phone||(Nt.hasOpenId?"微信用户":"未绑定")})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[Nt.status==="vip"&&t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Nt.status==="paid"&&t.jsxs(Le,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Nt.purchasedSections,"章"]}),Nt.status==="free"&&t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),t.jsx("span",{className:"text-xs text-gray-500",children:Nt.createdAt?new Date(Nt.createdAt).toLocaleDateString():""})]})]},Nt.id||We)})}):t.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),t.jsx(Kt,{children:t.jsx(ie,{variant:"outline",onClick:()=>G(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(Te,{className:"p-0",children:R?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(Ze,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsxs("div",{children:[t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx(_e,{className:"text-gray-400",children:"用户信息"}),t.jsx(_e,{className:"text-gray-400",children:"绑定信息"}),t.jsx(_e,{className:"text-gray-400",children:"购买状态"}),t.jsx(_e,{className:"text-gray-400",children:"分销收益"}),t.jsx(_e,{className:"text-gray-400",children:"推广码"}),t.jsx(_e,{className:"text-gray-400",children:"注册时间"}),t.jsx(_e,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(Qr,{children:[n.map(ne=>{var We,Nt,or;return t.jsxs(st,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(ke,{children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:ne.avatar?t.jsx("img",{src:ne.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((We=ne.nickname)==null?void 0:We.charAt(0))||"?"}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("p",{className:"font-medium text-white",children:ne.nickname}),ne.isAdmin&&t.jsx(Le,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),ne.openId&&!((Nt=ne.id)!=null&&Nt.startsWith("user_"))&&t.jsx(Le,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),t.jsx("p",{className:"text-xs text-gray-500 font-mono",children:ne.openId?ne.openId.slice(0,12)+"...":(or=ne.id)==null?void 0:or.slice(0,12)})]})]})}),t.jsx(ke,{children:t.jsxs("div",{className:"space-y-1",children:[ne.phone&&t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[t.jsx("span",{className:"text-gray-500",children:"📱"}),t.jsx("span",{className:"text-gray-300",children:ne.phone})]}),ne.wechatId&&t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[t.jsx("span",{className:"text-gray-500",children:"💬"}),t.jsx("span",{className:"text-gray-300",children:ne.wechatId})]}),ne.openId&&t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[t.jsx("span",{className:"text-gray-500",children:"🔗"}),t.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:ne.openId,children:[ne.openId.slice(0,12),"..."]})]}),!ne.phone&&!ne.wechatId&&!ne.openId&&t.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),t.jsx(ke,{children:ne.hasFullBook?t.jsx(Le,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):t.jsx(Le,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),t.jsx(ke,{children:t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(ne.earnings||0)).toFixed(2)]}),parseFloat(String(ne.pendingEarnings||0))>0&&t.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(ne.pendingEarnings||0)).toFixed(2)]}),t.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>Ct(ne),onKeyDown:An=>An.key==="Enter"&&Ct(ne),role:"button",tabIndex:0,children:[t.jsx(vr,{className:"w-3 h-3"}),"绑定",ne.referralCount||0,"人"]})]})}),t.jsx(ke,{children:t.jsx("code",{className:"text-[#38bdac] text-xs bg-[#38bdac]/10 px-2 py-0.5 rounded",children:ne.referralCode||"-"})}),t.jsx(ke,{className:"text-gray-400",children:ne.createdAt?new Date(ne.createdAt).toLocaleDateString():"-"}),t.jsx(ke,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>In(ne),className:"text-gray-400 hover:text-amber-400 hover:bg-amber-400/10",title:"设置 VIP",children:t.jsx(Li,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>Ft(ne),className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"查看详情",children:t.jsx(Ms,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>xe(ne),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑",children:t.jsx(Ht,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>Be(ne),className:"text-gray-400 hover:text-yellow-400 hover:bg-yellow-400/10",title:"修改密码",children:t.jsx(bm,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>je(ne.id),title:"删除",children:t.jsx(Er,{className:"w-4 h-4"})})]})})]},ne.id)}),n.length===0&&t.jsx(st,{children:t.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),t.jsx(Sn,{page:c,totalPages:re,total:l,pageSize:f,onPageChange:u,onPageSizeChange:ne=>{p(ne),u(1)}})]})})})]})}function g2(){const[n,a]=h.useState("overview"),[l,o]=h.useState([]),[c,u]=h.useState(null),[f,p]=h.useState([]),[x,g]=h.useState([]),[v,y]=h.useState([]),[k,R]=h.useState(!0),[C,N]=h.useState(null),[w,S]=h.useState(""),[P,j]=h.useState("all"),[_,B]=h.useState(1),[V,E]=h.useState(10),[T,z]=h.useState(0),[q,ue]=h.useState(new Set),[ee,ce]=h.useState(null),[G,Z]=h.useState(""),[te,U]=h.useState(!1);h.useEffect(()=>{M()},[]),h.useEffect(()=>{B(1)},[n,P]),h.useEffect(()=>{Q(n)},[n]),h.useEffect(()=>{["orders","bindings","withdrawals"].includes(n)&&Q(n,!0)},[_,V,P,w]);async function M(){N(null);try{const D=await Ke("/api/admin/distribution/overview");D!=null&&D.success&&D.overview&&u(D.overview)}catch(D){console.error("[Admin] 概览接口异常:",D),N("加载概览失败")}try{const D=await Ke("/api/db/users");y((D==null?void 0:D.users)||[])}catch(D){console.error("[Admin] 用户数据加载失败:",D)}}async function Q(D,fe=!1){var F;if(!(!fe&&q.has(D))){R(!0);try{const re=v;switch(D){case"overview":break;case"orders":{try{const je=new URLSearchParams({page:String(_),pageSize:String(V),...P!=="all"&&{status:P},...w&&{search:w}}),xe=await Ke(`/api/orders?${je}`);if(xe!=null&&xe.success&&xe.orders){const Oe=xe.orders.map(Xe=>{const Be=re.find(Ft=>Ft.id===Xe.userId),Ct=Xe.referrerId?re.find(Ft=>Ft.id===Xe.referrerId):null;return{...Xe,amount:parseFloat(String(Xe.amount))||0,userNickname:(Be==null?void 0:Be.nickname)||Xe.userNickname||"未知用户",userPhone:(Be==null?void 0:Be.phone)||Xe.userPhone||"-",referrerNickname:(Ct==null?void 0:Ct.nickname)||null,referrerCode:(Ct==null?void 0:Ct.referralCode)??null,type:Xe.productType||Xe.type}});o(Oe),z(xe.total??Oe.length)}else o([]),z(0)}catch(je){console.error(je),N("加载订单失败"),o([])}break}case"bindings":{try{const je=new URLSearchParams({page:String(_),pageSize:String(V),...P!=="all"&&{status:P}}),xe=await Ke(`/api/db/distribution?${je}`);p((xe==null?void 0:xe.bindings)||[]),z((xe==null?void 0:xe.total)??((F=xe==null?void 0:xe.bindings)==null?void 0:F.length)??0)}catch(je){console.error(je),N("加载绑定数据失败"),p([])}break}case"withdrawals":{try{const je=P==="completed"?"success":P==="rejected"?"failed":P,xe=new URLSearchParams({...je&&je!=="all"&&{status:je},page:String(_),pageSize:String(V)}),Oe=await Ke(`/api/admin/withdrawals?${xe}`);if(Oe!=null&&Oe.success&&Oe.withdrawals){const Xe=Oe.withdrawals.map(Be=>({...Be,account:Be.account??"未绑定微信号",status:Be.status==="success"?"completed":Be.status==="failed"?"rejected":Be.status}));g(Xe),z((Oe==null?void 0:Oe.total)??Xe.length)}else Oe!=null&&Oe.success||N(`获取提现记录失败: ${(Oe==null?void 0:Oe.error)||"未知错误"}`),g([])}catch(je){console.error(je),N("加载提现数据失败"),g([])}break}}ue(je=>new Set(je).add(D))}catch(re){console.error(re)}finally{R(!1)}}}async function H(){N(null),ue(D=>{const fe=new Set(D);return fe.delete(n),fe}),n==="overview"&&M(),await Q(n,!0)}async function I(D){if(confirm("确认审核通过并打款?"))try{const fe=await St("/api/admin/withdrawals",{id:D,action:"approve"});if(!(fe!=null&&fe.success)){const F=(fe==null?void 0:fe.message)||(fe==null?void 0:fe.error)||"操作失败";alert(F);return}await H()}catch(fe){console.error(fe),alert("操作失败")}}async function L(D){const fe=prompt("请输入拒绝原因:");if(fe)try{const F=await St("/api/admin/withdrawals",{id:D,action:"reject",errorMessage:fe});if(!(F!=null&&F.success)){alert((F==null?void 0:F.error)||"操作失败");return}await H()}catch(F){console.error(F),alert("操作失败")}}async function X(){var D;if(!(!(ee!=null&&ee.orderSn)&&!(ee!=null&&ee.id))){U(!0),N(null);try{const fe=await St("/api/admin/orders/refund",{orderSn:ee.orderSn||ee.id,reason:G||void 0});fe!=null&&fe.success?(ce(null),Z(""),await Q("orders",!0)):N((fe==null?void 0:fe.error)||"退款失败")}catch(fe){const F=fe;N(((D=F==null?void 0:F.data)==null?void 0:D.error)||"退款失败,请检查网络后重试")}finally{U(!1)}}}function ae(D){const fe={active:"bg-green-500/20 text-green-400",converted:"bg-blue-500/20 text-blue-400",expired:"bg-gray-500/20 text-gray-400",cancelled:"bg-red-500/20 text-red-400",pending:"bg-orange-500/20 text-orange-400",pending_confirm:"bg-orange-500/20 text-orange-400",processing:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",rejected:"bg-red-500/20 text-red-400"},F={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return t.jsx(Le,{className:`${fe[D]||"bg-gray-500/20 text-gray-400"} border-0`,children:F[D]||D})}const ve=Math.ceil(T/V)||1,pe=l,le=f.filter(D=>{var F,re,je,xe;if(!w)return!0;const fe=w.toLowerCase();return((F=D.refereeNickname)==null?void 0:F.toLowerCase().includes(fe))||((re=D.refereePhone)==null?void 0:re.includes(fe))||((je=D.referrerName)==null?void 0:je.toLowerCase().includes(fe))||((xe=D.referrerCode)==null?void 0:xe.toLowerCase().includes(fe))}),ye=x.filter(D=>{var F;if(!w)return!0;const fe=w.toLowerCase();return((F=D.userName)==null?void 0:F.toLowerCase().includes(fe))||D.account&&D.account.toLowerCase().includes(fe)});return t.jsxs("div",{className:"p-8 w-full",children:[C&&t.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[t.jsx("span",{children:C}),t.jsx("button",{type:"button",onClick:()=>N(null),className:"hover:text-red-300",children:"×"})]}),t.jsxs("div",{className:"flex items-center justify-between mb-8",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold text-white",children:"交易中心"}),t.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),t.jsxs(ie,{onClick:H,disabled:k,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${k?"animate-spin":""}`}),"刷新数据"]})]}),t.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4",children:[{key:"overview",label:"数据概览",icon:gd},{key:"orders",label:"订单管理",icon:yi},{key:"bindings",label:"绑定管理",icon:Yn},{key:"withdrawals",label:"提现审核",icon:Os}].map(D=>t.jsxs("button",{type:"button",onClick:()=>{a(D.key),j("all"),S("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${n===D.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[t.jsx(D.icon,{className:"w-4 h-4"}),D.label]},D.key))}),k?t.jsxs("div",{className:"flex items-center justify-center py-20",children:[t.jsx(Ze,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsxs(t.Fragment,{children:[n==="overview"&&c&&t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{className:"p-6",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),t.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c.todayClicks})]}),t.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:t.jsx(Ms,{className:"w-6 h-6 text-blue-400"})})]})})}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{className:"p-6",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),t.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c.todayBindings})]}),t.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:t.jsx(Yn,{className:"w-6 h-6 text-green-400"})})]})})}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{className:"p-6",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),t.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c.todayConversions})]}),t.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:t.jsx(ym,{className:"w-6 h-6 text-purple-400"})})]})})}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{className:"p-6",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),t.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",c.todayEarnings.toFixed(2)]})]}),t.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:t.jsx(yi,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(Re,{className:"bg-orange-500/10 border-orange-500/30",children:t.jsx(Te,{className:"p-6",children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:t.jsx(wp,{className:"w-6 h-6 text-orange-400"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),t.jsxs("p",{className:"text-2xl font-bold text-white",children:[c.expiringBindings," 个"]}),t.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),t.jsx(Re,{className:"bg-blue-500/10 border-blue-500/30",children:t.jsx(Te,{className:"p-6",children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:t.jsx(Os,{className:"w-6 h-6 text-blue-400"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),t.jsxs("p",{className:"text-2xl font-bold text-white",children:[c.pendingWithdrawals," 笔"]}),t.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",c.pendingWithdrawAmount.toFixed(2)]})]}),t.jsx(ie,{onClick:()=>a("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Ue,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx($a,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),t.jsx(Te,{children:t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),t.jsx("p",{className:"text-xl font-bold text-white",children:c.monthClicks})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),t.jsx("p",{className:"text-xl font-bold text-white",children:c.monthBindings})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),t.jsx("p",{className:"text-xl font-bold text-white",children:c.monthConversions})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),t.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",c.monthEarnings.toFixed(2)]})]})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Ue,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(gd,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),t.jsxs(Te,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),t.jsx("p",{className:"text-xl font-bold text-white",children:c.totalClicks.toLocaleString()})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),t.jsx("p",{className:"text-xl font-bold text-white",children:c.totalBindings.toLocaleString()})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),t.jsx("p",{className:"text-xl font-bold text-white",children:c.totalConversions})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[t.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),t.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",c.totalEarnings.toFixed(2)]})]})]}),t.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[t.jsx("span",{className:"text-gray-300",children:"点击转化率"}),t.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[c.conversionRate,"%"]})]})]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Ue,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(vr,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),t.jsx(Te,{children:t.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[t.jsx("p",{className:"text-3xl font-bold text-white",children:c.totalDistributors}),t.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[t.jsx("p",{className:"text-3xl font-bold text-green-400",children:c.activeDistributors}),t.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[t.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),t.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),t.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[t.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),t.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),n==="orders"&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(se,{value:w,onChange:D=>S(D.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:P,onChange:D=>j(D.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[t.jsx("option",{value:"all",children:"全部状态"}),t.jsx("option",{value:"completed",children:"已完成"}),t.jsx("option",{value:"pending",children:"待支付"}),t.jsx("option",{value:"failed",children:"已失败"}),t.jsx("option",{value:"refunded",children:"已退款"})]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{className:"p-0",children:[l.length===0?t.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[t.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-700/50",children:pe.map(D=>{var fe,F;return t.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[t.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(fe=D.id)==null?void 0:fe.slice(0,12),"..."]}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:D.userNickname}),t.jsx("p",{className:"text-gray-500 text-xs",children:D.userPhone})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:(()=>{const re=D.productType||D.type;return re==="fullbook"?`${D.bookName||"《底层逻辑》"} - 全本`:re==="match"?"匹配次数购买":`${D.bookName||"《底层逻辑》"} - ${D.sectionTitle||D.chapterTitle||`章节${D.productId||D.sectionId||""}`}`})()}),t.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const re=D.productType||D.type;return re==="fullbook"?"全书解锁":re==="match"?"功能权益":D.chapterTitle||"单章购买"})()})]})}),t.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof D.amount=="number"?D.amount.toFixed(2):parseFloat(String(D.amount||"0")).toFixed(2)]}),t.jsx("td",{className:"p-4 text-gray-300",children:D.paymentMethod==="wechat"?"微信支付":D.paymentMethod==="alipay"?"支付宝":D.paymentMethod||"微信支付"}),t.jsx("td",{className:"p-4",children:D.status==="refunded"?t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):D.status==="completed"||D.status==="paid"?t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):D.status==="pending"||D.status==="created"?t.jsx(Le,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):t.jsx(Le,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),t.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:D.refundReason,children:D.status==="refunded"&&D.refundReason?D.refundReason:"-"}),t.jsx("td",{className:"p-4 text-gray-300 text-sm",children:D.referrerId||D.referralCode?t.jsxs("span",{title:D.referralCode||D.referrerCode||D.referrerId||"",children:[D.referrerNickname||D.referralCode||D.referrerCode||((F=D.referrerId)==null?void 0:F.slice(0,8)),(D.referralCode||D.referrerCode)&&` (${D.referralCode||D.referrerCode})`]}):"-"}),t.jsx("td",{className:"p-4 text-[#FFD700]",children:D.referrerEarnings?`¥${(typeof D.referrerEarnings=="number"?D.referrerEarnings:parseFloat(String(D.referrerEarnings))).toFixed(2)}`:"-"}),t.jsx("td",{className:"p-4 text-gray-400 text-sm",children:D.createdAt?new Date(D.createdAt).toLocaleString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:(D.status==="paid"||D.status==="completed")&&t.jsxs(ie,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{ce(D),Z("")},children:[t.jsx(kp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},D.id)})})]})}),n==="orders"&&t.jsx(Sn,{page:_,totalPages:ve,total:T,pageSize:V,onPageChange:B,onPageSizeChange:D=>{E(D),B(1)}})]})})]}),n==="bindings"&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(se,{value:w,onChange:D=>S(D.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:P,onChange:D=>j(D.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[t.jsx("option",{value:"all",children:"全部状态"}),t.jsx("option",{value:"active",children:"有效"}),t.jsx("option",{value:"converted",children:"已转化"}),t.jsx("option",{value:"expired",children:"已过期"})]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{className:"p-0",children:[le.length===0?t.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[t.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-700/50",children:le.map(D=>t.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-medium",children:D.refereeNickname||"匿名用户"}),t.jsx("p",{className:"text-gray-500 text-xs",children:D.refereePhone})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white",children:D.referrerName||"-"}),t.jsx("p",{className:"text-gray-500 text-xs font-mono",children:D.referrerCode})]})}),t.jsx("td",{className:"p-4 text-gray-400",children:D.boundAt?new Date(D.boundAt).toLocaleDateString("zh-CN"):"-"}),t.jsx("td",{className:"p-4 text-gray-400",children:D.expiresAt?new Date(D.expiresAt).toLocaleDateString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:ae(D.status)}),t.jsx("td",{className:"p-4",children:D.commission?t.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",D.commission.toFixed(2)]}):t.jsx("span",{className:"text-gray-500",children:"-"})})]},D.id))})]})}),n==="bindings"&&t.jsx(Sn,{page:_,totalPages:ve,total:T,pageSize:V,onPageChange:B,onPageSizeChange:D=>{E(D),B(1)}})]})})]}),n==="withdrawals"&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(se,{value:w,onChange:D=>S(D.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:P,onChange:D=>j(D.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[t.jsx("option",{value:"all",children:"全部状态"}),t.jsx("option",{value:"pending",children:"待审核"}),t.jsx("option",{value:"completed",children:"已完成"}),t.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{className:"p-0",children:[ye.length===0?t.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[t.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),t.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-700/50",children:ye.map(D=>t.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[t.jsx("td",{className:"p-4",children:t.jsxs("div",{className:"flex items-center gap-2",children:[D.userAvatar?t.jsx("img",{src:D.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):t.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(D.userName||D.name||"?").slice(0,1)}),t.jsx("p",{className:"text-white font-medium",children:D.userName||D.name})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",D.amount.toFixed(2)]})}),t.jsx("td",{className:"p-4",children:t.jsx(Le,{className:D.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:D.method==="wechat"?"微信":"支付宝"})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-mono text-xs",children:D.account}),t.jsx("p",{className:"text-gray-500 text-xs",children:D.name})]})}),t.jsx("td",{className:"p-4 text-gray-400",children:D.createdAt?new Date(D.createdAt).toLocaleString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:ae(D.status)}),t.jsx("td",{className:"p-4 text-right",children:D.status==="pending"&&t.jsxs("div",{className:"flex gap-2 justify-end",children:[t.jsxs(ie,{size:"sm",onClick:()=>I(D.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(ym,{className:"w-4 h-4 mr-1"}),"通过"]}),t.jsxs(ie,{size:"sm",variant:"outline",onClick:()=>L(D.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[t.jsx(Dj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},D.id))})]})}),n==="withdrawals"&&t.jsx(Sn,{page:_,totalPages:ve,total:T,pageSize:V,onPageChange:B,onPageSizeChange:D=>{E(D),B(1)}})]})})]})]}),t.jsx(Mt,{open:!!ee,onOpenChange:D=>!D&&ce(null),children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Dt,{children:t.jsx(Lt,{className:"text-white",children:"订单退款"})}),ee&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",ee.orderSn||ee.id]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof ee.amount=="number"?ee.amount.toFixed(2):parseFloat(String(ee.amount||"0")).toFixed(2)]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),t.jsx("div",{className:"form-input",children:t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:G,onChange:D=>Z(D.target.value)})})]}),t.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),t.jsxs(Kt,{children:[t.jsx(ie,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>ce(null),disabled:te,children:"取消"}),t.jsx(ie,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:X,disabled:te,children:te?"退款中...":"确认退款"})]})]})})]})}function v2(){const[n,a]=h.useState([]),[l,o]=h.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[c,u]=h.useState(!0),[f,p]=h.useState(null),[x,g]=h.useState("all"),[v,y]=h.useState(1),[k,R]=h.useState(10),[C,N]=h.useState(0),[w,S]=h.useState(null);async function P(){var E,T,z,q,ue,ee,ce;u(!0),p(null);try{const G=new URLSearchParams({status:x,page:String(v),pageSize:String(k)}),Z=await Ke(`/api/admin/withdrawals?${G}`);if(Z!=null&&Z.success){const te=Z.withdrawals||[];a(te),N(Z.total??((E=Z.stats)==null?void 0:E.total)??te.length),o({total:((T=Z.stats)==null?void 0:T.total)??Z.total??te.length,pendingCount:((z=Z.stats)==null?void 0:z.pendingCount)??0,pendingAmount:((q=Z.stats)==null?void 0:q.pendingAmount)??0,successCount:((ue=Z.stats)==null?void 0:ue.successCount)??0,successAmount:((ee=Z.stats)==null?void 0:ee.successAmount)??0,failedCount:((ce=Z.stats)==null?void 0:ce.failedCount)??0})}else p("加载提现记录失败")}catch(G){console.error("Load withdrawals error:",G),p("加载失败,请检查网络后重试")}finally{u(!1)}}h.useEffect(()=>{y(1)},[x]),h.useEffect(()=>{P()},[x,v,k]);const j=Math.ceil(C/k)||1;async function _(E){const T=n.find(z=>z.id===E);if(T!=null&&T.userCommissionInfo&&T.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${T.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 - -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;S(E);try{const z=await St("/api/admin/withdrawals",{id:E,action:"approve"});z!=null&&z.success?P():alert("操作失败: "+((z==null?void 0:z.error)??""))}catch{alert("操作失败")}finally{S(null)}}async function B(E){const T=prompt("请输入拒绝原因(将返还用户余额):");if(T){S(E);try{const z=await St("/api/admin/withdrawals",{id:E,action:"reject",errorMessage:T});z!=null&&z.success?P():alert("操作失败: "+((z==null?void 0:z.error)??""))}catch{alert("操作失败")}finally{S(null)}}}function V(E){switch(E){case"pending":return t.jsx(Le,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return t.jsx(Le,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return t.jsx(Le,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return t.jsx(Le,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return t.jsx(Le,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 border-0",children:E})}}return t.jsxs("div",{className:"p-8 w-full",children:[f&&t.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[t.jsx("span",{children:f}),t.jsx("button",{type:"button",onClick:()=>p(null),className:"hover:text-red-300",children:"×"})]}),t.jsxs("div",{className:"flex justify-between items-start mb-8",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),t.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),t.jsxs(ie,{variant:"outline",onClick:P,disabled:c,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${c?"animate-spin":""}`}),"刷新"]})]}),t.jsx(Re,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:t.jsx(Te,{className:"p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(yi,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),t.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[t.jsxs("p",{children:["• ",t.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",t.jsx("span",{className:"text-white font-medium",children:"90%"})]}),t.jsxs("p",{children:["• ",t.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),t.jsxs("p",{children:["• ",t.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),t.jsxs("p",{children:["• ",t.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),t.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{className:"p-4 text-center",children:[t.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:l.total}),t.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{className:"p-4 text-center",children:[t.jsx("div",{className:"text-3xl font-bold text-orange-400",children:l.pendingCount}),t.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),t.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",l.pendingAmount.toFixed(2)]})]})}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{className:"p-4 text-center",children:[t.jsx("div",{className:"text-3xl font-bold text-green-400",children:l.successCount}),t.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),t.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",l.successAmount.toFixed(2)]})]})}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(Te,{className:"p-4 text-center",children:[t.jsx("div",{className:"text-3xl font-bold text-red-400",children:l.failedCount}),t.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),t.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(E=>t.jsx(ie,{variant:x===E?"default":"outline",size:"sm",onClick:()=>g(E),className:x===E?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:E==="all"?"全部":E==="pending"?"待处理":E==="success"?"已完成":"已拒绝"},E))}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(Te,{className:"p-0",children:c?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(Ze,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):n.length===0?t.jsxs("div",{className:"text-center py-12",children:[t.jsx(Os,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),t.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[t.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),t.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),t.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-700/50",children:n.map(E=>t.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[t.jsx("td",{className:"p-4 text-gray-400",children:new Date(E.createdAt??"").toLocaleString()}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{className:"flex items-center gap-2",children:[E.userAvatar?t.jsx("img",{src:E.userAvatar,alt:E.userName??"",className:"w-8 h-8 rounded-full object-cover"}):t.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(E.userName??"?").charAt(0)}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-white",children:E.userName??"未知"}),t.jsx("p",{className:"text-xs text-gray-500",children:E.userPhone??E.referralCode??(E.userId??"").slice(0,10)})]})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(E.amount).toFixed(2)]})}),t.jsx("td",{className:"p-4",children:E.userCommissionInfo?t.jsxs("div",{className:"text-xs space-y-1",children:[t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),t.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",E.userCommissionInfo.totalCommission.toFixed(2)]})]}),t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{className:"text-gray-500",children:"已提现:"}),t.jsxs("span",{className:"text-gray-400",children:["¥",E.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{className:"text-gray-500",children:"待审核:"}),t.jsxs("span",{className:"text-orange-400",children:["¥",E.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),t.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[t.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),t.jsxs("span",{className:E.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",E.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):t.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),t.jsxs("td",{className:"p-4",children:[V(E.status),E.errorMessage&&t.jsx("p",{className:"text-xs text-red-400 mt-1",children:E.errorMessage})]}),t.jsx("td",{className:"p-4 text-gray-400",children:E.processedAt?new Date(E.processedAt).toLocaleString():"-"}),t.jsx("td",{className:"p-4 text-gray-400",children:E.userConfirmedAt?t.jsxs("span",{className:"text-green-400",title:E.userConfirmedAt,children:["已确认 ",new Date(E.userConfirmedAt).toLocaleString()]}):"-"}),t.jsxs("td",{className:"p-4 text-right",children:[(E.status==="pending"||E.status==="pending_confirm")&&t.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t.jsxs(ie,{size:"sm",onClick:()=>_(E.id),disabled:w===E.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[t.jsx(Mi,{className:"w-4 h-4 mr-1"}),"批准"]}),t.jsxs(ie,{size:"sm",variant:"outline",onClick:()=>B(E.id),disabled:w===E.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[t.jsx(ir,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(E.status==="success"||E.status==="completed")&&E.transactionId&&t.jsx("span",{className:"text-xs text-gray-500 font-mono",children:E.transactionId})]})]},E.id))})]})}),t.jsx(Sn,{page:v,totalPages:j,total:C,pageSize:k,onPageChange:y,onPageSizeChange:E=>{R(E),y(1)}})]})})})]})}const Xn=h.forwardRef(({className:n,...a},l)=>t.jsx("textarea",{className:Qe("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:l,...a}));Xn.displayName="Textarea";function ki(n,[a,l]){return Math.min(l,Math.max(a,n))}const y2=["top","right","bottom","left"],kn=Math.min,Xt=Math.max,Ei=Math.round,di=Math.floor,Tr=n=>({x:n,y:n}),j2={left:"right",right:"left",bottom:"top",top:"bottom"},N2={start:"end",end:"start"};function bd(n,a,l){return Xt(n,kn(a,l))}function Wr(n,a){return typeof n=="function"?n(a):n}function Hr(n){return n.split("-")[0]}function Hs(n){return n.split("-")[1]}function nu(n){return n==="x"?"y":"x"}function su(n){return n==="y"?"height":"width"}const b2=new Set(["top","bottom"]);function Rr(n){return b2.has(Hr(n))?"y":"x"}function au(n){return nu(Rr(n))}function w2(n,a,l){l===void 0&&(l=!1);const o=Hs(n),c=au(n),u=su(c);let f=c==="x"?o===(l?"end":"start")?"right":"left":o==="start"?"bottom":"top";return a.reference[u]>a.floating[u]&&(f=Pi(f)),[f,Pi(f)]}function S2(n){const a=Pi(n);return[wd(n),a,wd(a)]}function wd(n){return n.replace(/start|end/g,a=>N2[a])}const Gm=["left","right"],Ym=["right","left"],C2=["top","bottom"],k2=["bottom","top"];function E2(n,a,l){switch(n){case"top":case"bottom":return l?a?Ym:Gm:a?Gm:Ym;case"left":case"right":return a?C2:k2;default:return[]}}function P2(n,a,l,o){const c=Hs(n);let u=E2(Hr(n),l==="start",o);return c&&(u=u.map(f=>f+"-"+c),a&&(u=u.concat(u.map(wd)))),u}function Pi(n){return n.replace(/left|right|bottom|top/g,a=>j2[a])}function R2(n){return{top:0,right:0,bottom:0,left:0,...n}}function Gx(n){return typeof n!="number"?R2(n):{top:n,right:n,bottom:n,left:n}}function Ri(n){const{x:a,y:l,width:o,height:c}=n;return{width:o,height:c,top:l,left:a,right:a+o,bottom:l+c,x:a,y:l}}function Qm(n,a,l){let{reference:o,floating:c}=n;const u=Rr(a),f=au(a),p=su(f),x=Hr(a),g=u==="y",v=o.x+o.width/2-c.width/2,y=o.y+o.height/2-c.height/2,k=o[p]/2-c[p]/2;let R;switch(x){case"top":R={x:v,y:o.y-c.height};break;case"bottom":R={x:v,y:o.y+o.height};break;case"right":R={x:o.x+o.width,y};break;case"left":R={x:o.x-c.width,y};break;default:R={x:o.x,y:o.y}}switch(Hs(a)){case"start":R[f]-=k*(l&&g?-1:1);break;case"end":R[f]+=k*(l&&g?-1:1);break}return R}async function T2(n,a){var l;a===void 0&&(a={});const{x:o,y:c,platform:u,rects:f,elements:p,strategy:x}=n,{boundary:g="clippingAncestors",rootBoundary:v="viewport",elementContext:y="floating",altBoundary:k=!1,padding:R=0}=Wr(a,n),C=Gx(R),w=p[k?y==="floating"?"reference":"floating":y],S=Ri(await u.getClippingRect({element:(l=await(u.isElement==null?void 0:u.isElement(w)))==null||l?w:w.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(p.floating)),boundary:g,rootBoundary:v,strategy:x})),P=y==="floating"?{x:o,y:c,width:f.floating.width,height:f.floating.height}:f.reference,j=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p.floating)),_=await(u.isElement==null?void 0:u.isElement(j))?await(u.getScale==null?void 0:u.getScale(j))||{x:1,y:1}:{x:1,y:1},B=Ri(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:P,offsetParent:j,strategy:x}):P);return{top:(S.top-B.top+C.top)/_.y,bottom:(B.bottom-S.bottom+C.bottom)/_.y,left:(S.left-B.left+C.left)/_.x,right:(B.right-S.right+C.right)/_.x}}const _2=async(n,a,l)=>{const{placement:o="bottom",strategy:c="absolute",middleware:u=[],platform:f}=l,p=u.filter(Boolean),x=await(f.isRTL==null?void 0:f.isRTL(a));let g=await f.getElementRects({reference:n,floating:a,strategy:c}),{x:v,y}=Qm(g,o,x),k=o,R={},C=0;for(let w=0;w({name:"arrow",options:n,async fn(a){const{x:l,y:o,placement:c,rects:u,platform:f,elements:p,middlewareData:x}=a,{element:g,padding:v=0}=Wr(n,a)||{};if(g==null)return{};const y=Gx(v),k={x:l,y:o},R=au(c),C=su(R),N=await f.getDimensions(g),w=R==="y",S=w?"top":"left",P=w?"bottom":"right",j=w?"clientHeight":"clientWidth",_=u.reference[C]+u.reference[R]-k[R]-u.floating[C],B=k[R]-u.reference[R],V=await(f.getOffsetParent==null?void 0:f.getOffsetParent(g));let E=V?V[j]:0;(!E||!await(f.isElement==null?void 0:f.isElement(V)))&&(E=p.floating[j]||u.floating[C]);const T=_/2-B/2,z=E/2-N[C]/2-1,q=kn(y[S],z),ue=kn(y[P],z),ee=q,ce=E-N[C]-ue,G=E/2-N[C]/2+T,Z=bd(ee,G,ce),te=!x.arrow&&Hs(c)!=null&&G!==Z&&u.reference[C]/2-(GG<=0)){var ue,ee;const G=(((ue=u.flip)==null?void 0:ue.index)||0)+1,Z=E[G];if(Z&&(!(y==="alignment"?P!==Rr(Z):!1)||q.every(M=>Rr(M.placement)===P?M.overflows[0]>0:!0)))return{data:{index:G,overflows:q},reset:{placement:Z}};let te=(ee=q.filter(U=>U.overflows[0]<=0).sort((U,M)=>U.overflows[1]-M.overflows[1])[0])==null?void 0:ee.placement;if(!te)switch(R){case"bestFit":{var ce;const U=(ce=q.filter(M=>{if(V){const Q=Rr(M.placement);return Q===P||Q==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(Q=>Q>0).reduce((Q,H)=>Q+H,0)]).sort((M,Q)=>M[1]-Q[1])[0])==null?void 0:ce[0];U&&(te=U);break}case"initialPlacement":te=p;break}if(c!==te)return{reset:{placement:te}}}return{}}}};function qm(n,a){return{top:n.top-a.height,right:n.right-a.width,bottom:n.bottom-a.height,left:n.left-a.width}}function Xm(n){return y2.some(a=>n[a]>=0)}const M2=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(a){const{rects:l,platform:o}=a,{strategy:c="referenceHidden",...u}=Wr(n,a);switch(c){case"referenceHidden":{const f=await o.detectOverflow(a,{...u,elementContext:"reference"}),p=qm(f,l.reference);return{data:{referenceHiddenOffsets:p,referenceHidden:Xm(p)}}}case"escaped":{const f=await o.detectOverflow(a,{...u,altBoundary:!0}),p=qm(f,l.floating);return{data:{escapedOffsets:p,escaped:Xm(p)}}}default:return{}}}}},Yx=new Set(["left","top"]);async function D2(n,a){const{placement:l,platform:o,elements:c}=n,u=await(o.isRTL==null?void 0:o.isRTL(c.floating)),f=Hr(l),p=Hs(l),x=Rr(l)==="y",g=Yx.has(f)?-1:1,v=u&&x?-1:1,y=Wr(a,n);let{mainAxis:k,crossAxis:R,alignmentAxis:C}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return p&&typeof C=="number"&&(R=p==="end"?C*-1:C),x?{x:R*v,y:k*g}:{x:k*g,y:R*v}}const L2=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(a){var l,o;const{x:c,y:u,placement:f,middlewareData:p}=a,x=await D2(a,n);return f===((l=p.offset)==null?void 0:l.placement)&&(o=p.arrow)!=null&&o.alignmentOffset?{}:{x:c+x.x,y:u+x.y,data:{...x,placement:f}}}}},O2=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(a){const{x:l,y:o,placement:c,platform:u}=a,{mainAxis:f=!0,crossAxis:p=!1,limiter:x={fn:S=>{let{x:P,y:j}=S;return{x:P,y:j}}},...g}=Wr(n,a),v={x:l,y:o},y=await u.detectOverflow(a,g),k=Rr(Hr(c)),R=nu(k);let C=v[R],N=v[k];if(f){const S=R==="y"?"top":"left",P=R==="y"?"bottom":"right",j=C+y[S],_=C-y[P];C=bd(j,C,_)}if(p){const S=k==="y"?"top":"left",P=k==="y"?"bottom":"right",j=N+y[S],_=N-y[P];N=bd(j,N,_)}const w=x.fn({...a,[R]:C,[k]:N});return{...w,data:{x:w.x-l,y:w.y-o,enabled:{[R]:f,[k]:p}}}}}},F2=function(n){return n===void 0&&(n={}),{options:n,fn(a){const{x:l,y:o,placement:c,rects:u,middlewareData:f}=a,{offset:p=0,mainAxis:x=!0,crossAxis:g=!0}=Wr(n,a),v={x:l,y:o},y=Rr(c),k=nu(y);let R=v[k],C=v[y];const N=Wr(p,a),w=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(x){const j=k==="y"?"height":"width",_=u.reference[k]-u.floating[j]+w.mainAxis,B=u.reference[k]+u.reference[j]-w.mainAxis;R<_?R=_:R>B&&(R=B)}if(g){var S,P;const j=k==="y"?"width":"height",_=Yx.has(Hr(c)),B=u.reference[y]-u.floating[j]+(_&&((S=f.offset)==null?void 0:S[y])||0)+(_?0:w.crossAxis),V=u.reference[y]+u.reference[j]+(_?0:((P=f.offset)==null?void 0:P[y])||0)-(_?w.crossAxis:0);CV&&(C=V)}return{[k]:R,[y]:C}}}},z2=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(a){var l,o;const{placement:c,rects:u,platform:f,elements:p}=a,{apply:x=()=>{},...g}=Wr(n,a),v=await f.detectOverflow(a,g),y=Hr(c),k=Hs(c),R=Rr(c)==="y",{width:C,height:N}=u.floating;let w,S;y==="top"||y==="bottom"?(w=y,S=k===(await(f.isRTL==null?void 0:f.isRTL(p.floating))?"start":"end")?"left":"right"):(S=y,w=k==="end"?"top":"bottom");const P=N-v.top-v.bottom,j=C-v.left-v.right,_=kn(N-v[w],P),B=kn(C-v[S],j),V=!a.middlewareData.shift;let E=_,T=B;if((l=a.middlewareData.shift)!=null&&l.enabled.x&&(T=j),(o=a.middlewareData.shift)!=null&&o.enabled.y&&(E=P),V&&!k){const q=Xt(v.left,0),ue=Xt(v.right,0),ee=Xt(v.top,0),ce=Xt(v.bottom,0);R?T=C-2*(q!==0||ue!==0?q+ue:Xt(v.left,v.right)):E=N-2*(ee!==0||ce!==0?ee+ce:Xt(v.top,v.bottom))}await x({...a,availableWidth:T,availableHeight:E});const z=await f.getDimensions(p.floating);return C!==z.width||N!==z.height?{reset:{rects:!0}}:{}}}};function Wi(){return typeof window<"u"}function Ks(n){return Qx(n)?(n.nodeName||"").toLowerCase():"#document"}function Jt(n){var a;return(n==null||(a=n.ownerDocument)==null?void 0:a.defaultView)||window}function Ir(n){var a;return(a=(Qx(n)?n.ownerDocument:n.document)||window.document)==null?void 0:a.documentElement}function Qx(n){return Wi()?n instanceof Node||n instanceof Jt(n).Node:!1}function yr(n){return Wi()?n instanceof Element||n instanceof Jt(n).Element:!1}function _r(n){return Wi()?n instanceof HTMLElement||n instanceof Jt(n).HTMLElement:!1}function Jm(n){return!Wi()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Jt(n).ShadowRoot}const $2=new Set(["inline","contents"]);function Ga(n){const{overflow:a,overflowX:l,overflowY:o,display:c}=jr(n);return/auto|scroll|overlay|hidden|clip/.test(a+o+l)&&!$2.has(c)}const B2=new Set(["table","td","th"]);function U2(n){return B2.has(Ks(n))}const V2=[":popover-open",":modal"];function Hi(n){return V2.some(a=>{try{return n.matches(a)}catch{return!1}})}const W2=["transform","translate","scale","rotate","perspective"],H2=["transform","translate","scale","rotate","perspective","filter"],K2=["paint","layout","strict","content"];function lu(n){const a=iu(),l=yr(n)?jr(n):n;return W2.some(o=>l[o]?l[o]!=="none":!1)||(l.containerType?l.containerType!=="normal":!1)||!a&&(l.backdropFilter?l.backdropFilter!=="none":!1)||!a&&(l.filter?l.filter!=="none":!1)||H2.some(o=>(l.willChange||"").includes(o))||K2.some(o=>(l.contain||"").includes(o))}function G2(n){let a=En(n);for(;_r(a)&&!$s(a);){if(lu(a))return a;if(Hi(a))return null;a=En(a)}return null}function iu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Y2=new Set(["html","body","#document"]);function $s(n){return Y2.has(Ks(n))}function jr(n){return Jt(n).getComputedStyle(n)}function Ki(n){return yr(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function En(n){if(Ks(n)==="html")return n;const a=n.assignedSlot||n.parentNode||Jm(n)&&n.host||Ir(n);return Jm(a)?a.host:a}function qx(n){const a=En(n);return $s(a)?n.ownerDocument?n.ownerDocument.body:n.body:_r(a)&&Ga(a)?a:qx(a)}function Ua(n,a,l){var o;a===void 0&&(a=[]),l===void 0&&(l=!0);const c=qx(n),u=c===((o=n.ownerDocument)==null?void 0:o.body),f=Jt(c);if(u){const p=Sd(f);return a.concat(f,f.visualViewport||[],Ga(c)?c:[],p&&l?Ua(p):[])}return a.concat(c,Ua(c,[],l))}function Sd(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Xx(n){const a=jr(n);let l=parseFloat(a.width)||0,o=parseFloat(a.height)||0;const c=_r(n),u=c?n.offsetWidth:l,f=c?n.offsetHeight:o,p=Ei(l)!==u||Ei(o)!==f;return p&&(l=u,o=f),{width:l,height:o,$:p}}function ou(n){return yr(n)?n:n.contextElement}function Ls(n){const a=ou(n);if(!_r(a))return Tr(1);const l=a.getBoundingClientRect(),{width:o,height:c,$:u}=Xx(a);let f=(u?Ei(l.width):l.width)/o,p=(u?Ei(l.height):l.height)/c;return(!f||!Number.isFinite(f))&&(f=1),(!p||!Number.isFinite(p))&&(p=1),{x:f,y:p}}const Q2=Tr(0);function Jx(n){const a=Jt(n);return!iu()||!a.visualViewport?Q2:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function q2(n,a,l){return a===void 0&&(a=!1),!l||a&&l!==Jt(n)?!1:a}function es(n,a,l,o){a===void 0&&(a=!1),l===void 0&&(l=!1);const c=n.getBoundingClientRect(),u=ou(n);let f=Tr(1);a&&(o?yr(o)&&(f=Ls(o)):f=Ls(n));const p=q2(u,l,o)?Jx(u):Tr(0);let x=(c.left+p.x)/f.x,g=(c.top+p.y)/f.y,v=c.width/f.x,y=c.height/f.y;if(u){const k=Jt(u),R=o&&yr(o)?Jt(o):o;let C=k,N=Sd(C);for(;N&&o&&R!==C;){const w=Ls(N),S=N.getBoundingClientRect(),P=jr(N),j=S.left+(N.clientLeft+parseFloat(P.paddingLeft))*w.x,_=S.top+(N.clientTop+parseFloat(P.paddingTop))*w.y;x*=w.x,g*=w.y,v*=w.x,y*=w.y,x+=j,g+=_,C=Jt(N),N=Sd(C)}}return Ri({width:v,height:y,x,y:g})}function Gi(n,a){const l=Ki(n).scrollLeft;return a?a.left+l:es(Ir(n)).left+l}function Zx(n,a){const l=n.getBoundingClientRect(),o=l.left+a.scrollLeft-Gi(n,l),c=l.top+a.scrollTop;return{x:o,y:c}}function X2(n){let{elements:a,rect:l,offsetParent:o,strategy:c}=n;const u=c==="fixed",f=Ir(o),p=a?Hi(a.floating):!1;if(o===f||p&&u)return l;let x={scrollLeft:0,scrollTop:0},g=Tr(1);const v=Tr(0),y=_r(o);if((y||!y&&!u)&&((Ks(o)!=="body"||Ga(f))&&(x=Ki(o)),_r(o))){const R=es(o);g=Ls(o),v.x=R.x+o.clientLeft,v.y=R.y+o.clientTop}const k=f&&!y&&!u?Zx(f,x):Tr(0);return{width:l.width*g.x,height:l.height*g.y,x:l.x*g.x-x.scrollLeft*g.x+v.x+k.x,y:l.y*g.y-x.scrollTop*g.y+v.y+k.y}}function J2(n){return Array.from(n.getClientRects())}function Z2(n){const a=Ir(n),l=Ki(n),o=n.ownerDocument.body,c=Xt(a.scrollWidth,a.clientWidth,o.scrollWidth,o.clientWidth),u=Xt(a.scrollHeight,a.clientHeight,o.scrollHeight,o.clientHeight);let f=-l.scrollLeft+Gi(n);const p=-l.scrollTop;return jr(o).direction==="rtl"&&(f+=Xt(a.clientWidth,o.clientWidth)-c),{width:c,height:u,x:f,y:p}}const Zm=25;function eS(n,a){const l=Jt(n),o=Ir(n),c=l.visualViewport;let u=o.clientWidth,f=o.clientHeight,p=0,x=0;if(c){u=c.width,f=c.height;const v=iu();(!v||v&&a==="fixed")&&(p=c.offsetLeft,x=c.offsetTop)}const g=Gi(o);if(g<=0){const v=o.ownerDocument,y=v.body,k=getComputedStyle(y),R=v.compatMode==="CSS1Compat"&&parseFloat(k.marginLeft)+parseFloat(k.marginRight)||0,C=Math.abs(o.clientWidth-y.clientWidth-R);C<=Zm&&(u-=C)}else g<=Zm&&(u+=g);return{width:u,height:f,x:p,y:x}}const tS=new Set(["absolute","fixed"]);function rS(n,a){const l=es(n,!0,a==="fixed"),o=l.top+n.clientTop,c=l.left+n.clientLeft,u=_r(n)?Ls(n):Tr(1),f=n.clientWidth*u.x,p=n.clientHeight*u.y,x=c*u.x,g=o*u.y;return{width:f,height:p,x,y:g}}function ep(n,a,l){let o;if(a==="viewport")o=eS(n,l);else if(a==="document")o=Z2(Ir(n));else if(yr(a))o=rS(a,l);else{const c=Jx(n);o={x:a.x-c.x,y:a.y-c.y,width:a.width,height:a.height}}return Ri(o)}function eg(n,a){const l=En(n);return l===a||!yr(l)||$s(l)?!1:jr(l).position==="fixed"||eg(l,a)}function nS(n,a){const l=a.get(n);if(l)return l;let o=Ua(n,[],!1).filter(p=>yr(p)&&Ks(p)!=="body"),c=null;const u=jr(n).position==="fixed";let f=u?En(n):n;for(;yr(f)&&!$s(f);){const p=jr(f),x=lu(f);!x&&p.position==="fixed"&&(c=null),(u?!x&&!c:!x&&p.position==="static"&&!!c&&tS.has(c.position)||Ga(f)&&!x&&eg(n,f))?o=o.filter(v=>v!==f):c=p,f=En(f)}return a.set(n,o),o}function sS(n){let{element:a,boundary:l,rootBoundary:o,strategy:c}=n;const f=[...l==="clippingAncestors"?Hi(a)?[]:nS(a,this._c):[].concat(l),o],p=f[0],x=f.reduce((g,v)=>{const y=ep(a,v,c);return g.top=Xt(y.top,g.top),g.right=kn(y.right,g.right),g.bottom=kn(y.bottom,g.bottom),g.left=Xt(y.left,g.left),g},ep(a,p,c));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}}function aS(n){const{width:a,height:l}=Xx(n);return{width:a,height:l}}function lS(n,a,l){const o=_r(a),c=Ir(a),u=l==="fixed",f=es(n,!0,u,a);let p={scrollLeft:0,scrollTop:0};const x=Tr(0);function g(){x.x=Gi(c)}if(o||!o&&!u)if((Ks(a)!=="body"||Ga(c))&&(p=Ki(a)),o){const R=es(a,!0,u,a);x.x=R.x+a.clientLeft,x.y=R.y+a.clientTop}else c&&g();u&&!o&&c&&g();const v=c&&!o&&!u?Zx(c,p):Tr(0),y=f.left+p.scrollLeft-x.x-v.x,k=f.top+p.scrollTop-x.y-v.y;return{x:y,y:k,width:f.width,height:f.height}}function ad(n){return jr(n).position==="static"}function tp(n,a){if(!_r(n)||jr(n).position==="fixed")return null;if(a)return a(n);let l=n.offsetParent;return Ir(n)===l&&(l=l.ownerDocument.body),l}function tg(n,a){const l=Jt(n);if(Hi(n))return l;if(!_r(n)){let c=En(n);for(;c&&!$s(c);){if(yr(c)&&!ad(c))return c;c=En(c)}return l}let o=tp(n,a);for(;o&&U2(o)&&ad(o);)o=tp(o,a);return o&&$s(o)&&ad(o)&&!lu(o)?l:o||G2(n)||l}const iS=async function(n){const a=this.getOffsetParent||tg,l=this.getDimensions,o=await l(n.floating);return{reference:lS(n.reference,await a(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function oS(n){return jr(n).direction==="rtl"}const cS={convertOffsetParentRelativeRectToViewportRelativeRect:X2,getDocumentElement:Ir,getClippingRect:sS,getOffsetParent:tg,getElementRects:iS,getClientRects:J2,getDimensions:aS,getScale:Ls,isElement:yr,isRTL:oS};function rg(n,a){return n.x===a.x&&n.y===a.y&&n.width===a.width&&n.height===a.height}function dS(n,a){let l=null,o;const c=Ir(n);function u(){var p;clearTimeout(o),(p=l)==null||p.disconnect(),l=null}function f(p,x){p===void 0&&(p=!1),x===void 0&&(x=1),u();const g=n.getBoundingClientRect(),{left:v,top:y,width:k,height:R}=g;if(p||a(),!k||!R)return;const C=di(y),N=di(c.clientWidth-(v+k)),w=di(c.clientHeight-(y+R)),S=di(v),j={rootMargin:-C+"px "+-N+"px "+-w+"px "+-S+"px",threshold:Xt(0,kn(1,x))||1};let _=!0;function B(V){const E=V[0].intersectionRatio;if(E!==x){if(!_)return f();E?f(!1,E):o=setTimeout(()=>{f(!1,1e-7)},1e3)}E===1&&!rg(g,n.getBoundingClientRect())&&f(),_=!1}try{l=new IntersectionObserver(B,{...j,root:c.ownerDocument})}catch{l=new IntersectionObserver(B,j)}l.observe(n)}return f(!0),u}function uS(n,a,l,o){o===void 0&&(o={});const{ancestorScroll:c=!0,ancestorResize:u=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:p=typeof IntersectionObserver=="function",animationFrame:x=!1}=o,g=ou(n),v=c||u?[...g?Ua(g):[],...Ua(a)]:[];v.forEach(S=>{c&&S.addEventListener("scroll",l,{passive:!0}),u&&S.addEventListener("resize",l)});const y=g&&p?dS(g,l):null;let k=-1,R=null;f&&(R=new ResizeObserver(S=>{let[P]=S;P&&P.target===g&&R&&(R.unobserve(a),cancelAnimationFrame(k),k=requestAnimationFrame(()=>{var j;(j=R)==null||j.observe(a)})),l()}),g&&!x&&R.observe(g),R.observe(a));let C,N=x?es(n):null;x&&w();function w(){const S=es(n);N&&!rg(N,S)&&l(),N=S,C=requestAnimationFrame(w)}return l(),()=>{var S;v.forEach(P=>{c&&P.removeEventListener("scroll",l),u&&P.removeEventListener("resize",l)}),y==null||y(),(S=R)==null||S.disconnect(),R=null,x&&cancelAnimationFrame(C)}}const fS=L2,hS=O2,mS=A2,pS=z2,xS=M2,rp=I2,gS=F2,vS=(n,a,l)=>{const o=new Map,c={platform:cS,...l},u={...c.platform,_c:o};return _2(n,a,{...c,platform:u})};var yS=typeof document<"u",jS=function(){},pi=yS?h.useLayoutEffect:jS;function Ti(n,a){if(n===a)return!0;if(typeof n!=typeof a)return!1;if(typeof n=="function"&&n.toString()===a.toString())return!0;let l,o,c;if(n&&a&&typeof n=="object"){if(Array.isArray(n)){if(l=n.length,l!==a.length)return!1;for(o=l;o--!==0;)if(!Ti(n[o],a[o]))return!1;return!0}if(c=Object.keys(n),l=c.length,l!==Object.keys(a).length)return!1;for(o=l;o--!==0;)if(!{}.hasOwnProperty.call(a,c[o]))return!1;for(o=l;o--!==0;){const u=c[o];if(!(u==="_owner"&&n.$$typeof)&&!Ti(n[u],a[u]))return!1}return!0}return n!==n&&a!==a}function ng(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function np(n,a){const l=ng(n);return Math.round(a*l)/l}function ld(n){const a=h.useRef(n);return pi(()=>{a.current=n}),a}function NS(n){n===void 0&&(n={});const{placement:a="bottom",strategy:l="absolute",middleware:o=[],platform:c,elements:{reference:u,floating:f}={},transform:p=!0,whileElementsMounted:x,open:g}=n,[v,y]=h.useState({x:0,y:0,strategy:l,placement:a,middlewareData:{},isPositioned:!1}),[k,R]=h.useState(o);Ti(k,o)||R(o);const[C,N]=h.useState(null),[w,S]=h.useState(null),P=h.useCallback(M=>{M!==V.current&&(V.current=M,N(M))},[]),j=h.useCallback(M=>{M!==E.current&&(E.current=M,S(M))},[]),_=u||C,B=f||w,V=h.useRef(null),E=h.useRef(null),T=h.useRef(v),z=x!=null,q=ld(x),ue=ld(c),ee=ld(g),ce=h.useCallback(()=>{if(!V.current||!E.current)return;const M={placement:a,strategy:l,middleware:k};ue.current&&(M.platform=ue.current),vS(V.current,E.current,M).then(Q=>{const H={...Q,isPositioned:ee.current!==!1};G.current&&!Ti(T.current,H)&&(T.current=H,Va.flushSync(()=>{y(H)}))})},[k,a,l,ue,ee]);pi(()=>{g===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,y(M=>({...M,isPositioned:!1})))},[g]);const G=h.useRef(!1);pi(()=>(G.current=!0,()=>{G.current=!1}),[]),pi(()=>{if(_&&(V.current=_),B&&(E.current=B),_&&B){if(q.current)return q.current(_,B,ce);ce()}},[_,B,ce,q,z]);const Z=h.useMemo(()=>({reference:V,floating:E,setReference:P,setFloating:j}),[P,j]),te=h.useMemo(()=>({reference:_,floating:B}),[_,B]),U=h.useMemo(()=>{const M={position:l,left:0,top:0};if(!te.floating)return M;const Q=np(te.floating,v.x),H=np(te.floating,v.y);return p?{...M,transform:"translate("+Q+"px, "+H+"px)",...ng(te.floating)>=1.5&&{willChange:"transform"}}:{position:l,left:Q,top:H}},[l,p,te.floating,v.x,v.y]);return h.useMemo(()=>({...v,update:ce,refs:Z,elements:te,floatingStyles:U}),[v,ce,Z,te,U])}const bS=n=>{function a(l){return{}.hasOwnProperty.call(l,"current")}return{name:"arrow",options:n,fn(l){const{element:o,padding:c}=typeof n=="function"?n(l):n;return o&&a(o)?o.current!=null?rp({element:o.current,padding:c}).fn(l):{}:o?rp({element:o,padding:c}).fn(l):{}}}},wS=(n,a)=>({...fS(n),options:[n,a]}),SS=(n,a)=>({...hS(n),options:[n,a]}),CS=(n,a)=>({...gS(n),options:[n,a]}),kS=(n,a)=>({...mS(n),options:[n,a]}),ES=(n,a)=>({...pS(n),options:[n,a]}),PS=(n,a)=>({...xS(n),options:[n,a]}),RS=(n,a)=>({...bS(n),options:[n,a]});var TS="Arrow",sg=h.forwardRef((n,a)=>{const{children:l,width:o=10,height:c=5,...u}=n;return t.jsx(ze.svg,{...u,ref:a,width:o,height:c,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?l:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});sg.displayName=TS;var _S=sg,cu="Popper",[ag,lg]=Rn(cu),[IS,ig]=ag(cu),og=n=>{const{__scopePopper:a,children:l}=n,[o,c]=h.useState(null);return t.jsx(IS,{scope:a,anchor:o,onAnchorChange:c,children:l})};og.displayName=cu;var cg="PopperAnchor",dg=h.forwardRef((n,a)=>{const{__scopePopper:l,virtualRef:o,...c}=n,u=ig(cg,l),f=h.useRef(null),p=Ye(a,f),x=h.useRef(null);return h.useEffect(()=>{const g=x.current;x.current=(o==null?void 0:o.current)||f.current,g!==x.current&&u.onAnchorChange(x.current)}),o?null:t.jsx(ze.div,{...c,ref:p})});dg.displayName=cg;var du="PopperContent",[AS,MS]=ag(du),ug=h.forwardRef((n,a)=>{var le,ye,D,fe,F,re;const{__scopePopper:l,side:o="bottom",sideOffset:c=0,align:u="center",alignOffset:f=0,arrowPadding:p=0,avoidCollisions:x=!0,collisionBoundary:g=[],collisionPadding:v=0,sticky:y="partial",hideWhenDetached:k=!1,updatePositionStrategy:R="optimized",onPlaced:C,...N}=n,w=ig(du,l),[S,P]=h.useState(null),j=Ye(a,je=>P(je)),[_,B]=h.useState(null),V=Zd(_),E=(V==null?void 0:V.width)??0,T=(V==null?void 0:V.height)??0,z=o+(u!=="center"?"-"+u:""),q=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},ue=Array.isArray(g)?g:[g],ee=ue.length>0,ce={padding:q,boundary:ue.filter(LS),altBoundary:ee},{refs:G,floatingStyles:Z,placement:te,isPositioned:U,middlewareData:M}=NS({strategy:"fixed",placement:z,whileElementsMounted:(...je)=>uS(...je,{animationFrame:R==="always"}),elements:{reference:w.anchor},middleware:[wS({mainAxis:c+T,alignmentAxis:f}),x&&SS({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?CS():void 0,...ce}),x&&kS({...ce}),ES({...ce,apply:({elements:je,rects:xe,availableWidth:Oe,availableHeight:Xe})=>{const{width:Be,height:Ct}=xe.reference,Ft=je.floating.style;Ft.setProperty("--radix-popper-available-width",`${Oe}px`),Ft.setProperty("--radix-popper-available-height",`${Xe}px`),Ft.setProperty("--radix-popper-anchor-width",`${Be}px`),Ft.setProperty("--radix-popper-anchor-height",`${Ct}px`)}}),_&&RS({element:_,padding:p}),OS({arrowWidth:E,arrowHeight:T}),k&&PS({strategy:"referenceHidden",...ce})]}),[Q,H]=mg(te),I=Cn(C);_t(()=>{U&&(I==null||I())},[U,I]);const L=(le=M.arrow)==null?void 0:le.x,X=(ye=M.arrow)==null?void 0:ye.y,ae=((D=M.arrow)==null?void 0:D.centerOffset)!==0,[ve,pe]=h.useState();return _t(()=>{S&&pe(window.getComputedStyle(S).zIndex)},[S]),t.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:U?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ve,"--radix-popper-transform-origin":[(fe=M.transformOrigin)==null?void 0:fe.x,(F=M.transformOrigin)==null?void 0:F.y].join(" "),...((re=M.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:t.jsx(AS,{scope:l,placedSide:Q,onArrowChange:B,arrowX:L,arrowY:X,shouldHideArrow:ae,children:t.jsx(ze.div,{"data-side":Q,"data-align":H,...N,ref:j,style:{...N.style,animation:U?void 0:"none"}})})})});ug.displayName=du;var fg="PopperArrow",DS={top:"bottom",right:"left",bottom:"top",left:"right"},hg=h.forwardRef(function(a,l){const{__scopePopper:o,...c}=a,u=MS(fg,o),f=DS[u.placedSide];return t.jsx("span",{ref:u.onArrowChange,style:{position:"absolute",left:u.arrowX,top:u.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[u.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[u.placedSide],visibility:u.shouldHideArrow?"hidden":void 0},children:t.jsx(_S,{...c,ref:l,style:{...c.style,display:"block"}})})});hg.displayName=fg;function LS(n){return n!==null}var OS=n=>({name:"transformOrigin",options:n,fn(a){var w,S,P;const{placement:l,rects:o,middlewareData:c}=a,f=((w=c.arrow)==null?void 0:w.centerOffset)!==0,p=f?0:n.arrowWidth,x=f?0:n.arrowHeight,[g,v]=mg(l),y={start:"0%",center:"50%",end:"100%"}[v],k=(((S=c.arrow)==null?void 0:S.x)??0)+p/2,R=(((P=c.arrow)==null?void 0:P.y)??0)+x/2;let C="",N="";return g==="bottom"?(C=f?y:`${k}px`,N=`${-x}px`):g==="top"?(C=f?y:`${k}px`,N=`${o.floating.height+x}px`):g==="right"?(C=`${-x}px`,N=f?y:`${R}px`):g==="left"&&(C=`${o.floating.width+x}px`,N=f?y:`${R}px`),{data:{x:C,y:N}}}});function mg(n){const[a,l="center"]=n.split("-");return[a,l]}var FS=og,zS=dg,$S=ug,BS=hg,pg=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),US="VisuallyHidden",VS=h.forwardRef((n,a)=>t.jsx(ze.span,{...n,ref:a,style:{...pg,...n.style}}));VS.displayName=US;var WS=[" ","Enter","ArrowUp","ArrowDown"],HS=[" ","Enter"],ts="Select",[Yi,Qi,KS]=eu(ts),[Gs]=Rn(ts,[KS,lg]),qi=lg(),[GS,Tn]=Gs(ts),[YS,QS]=Gs(ts),xg=n=>{const{__scopeSelect:a,children:l,open:o,defaultOpen:c,onOpenChange:u,value:f,defaultValue:p,onValueChange:x,dir:g,name:v,autoComplete:y,disabled:k,required:R,form:C}=n,N=qi(a),[w,S]=h.useState(null),[P,j]=h.useState(null),[_,B]=h.useState(!1),V=Bi(g),[E,T]=Jn({prop:o,defaultProp:c??!1,onChange:u,caller:ts}),[z,q]=Jn({prop:f,defaultProp:p,onChange:x,caller:ts}),ue=h.useRef(null),ee=w?C||!!w.closest("form"):!0,[ce,G]=h.useState(new Set),Z=Array.from(ce).map(te=>te.props.value).join(";");return t.jsx(FS,{...N,children:t.jsxs(GS,{required:R,scope:a,trigger:w,onTriggerChange:S,valueNode:P,onValueNodeChange:j,valueNodeHasChildren:_,onValueNodeHasChildrenChange:B,contentId:wn(),value:z,onValueChange:q,open:E,onOpenChange:T,dir:V,triggerPointerDownPosRef:ue,disabled:k,children:[t.jsx(Yi.Provider,{scope:a,children:t.jsx(YS,{scope:n.__scopeSelect,onNativeOptionAdd:h.useCallback(te=>{G(U=>new Set(U).add(te))},[]),onNativeOptionRemove:h.useCallback(te=>{G(U=>{const M=new Set(U);return M.delete(te),M})},[]),children:l})}),ee?t.jsxs(Fg,{"aria-hidden":!0,required:R,tabIndex:-1,name:v,autoComplete:y,value:z,onChange:te=>q(te.target.value),disabled:k,form:C,children:[z===void 0?t.jsx("option",{value:""}):null,Array.from(ce)]},Z):null]})})};xg.displayName=ts;var gg="SelectTrigger",vg=h.forwardRef((n,a)=>{const{__scopeSelect:l,disabled:o=!1,...c}=n,u=qi(l),f=Tn(gg,l),p=f.disabled||o,x=Ye(a,f.onTriggerChange),g=Qi(l),v=h.useRef("touch"),[y,k,R]=$g(N=>{const w=g().filter(j=>!j.disabled),S=w.find(j=>j.value===f.value),P=Bg(w,N,S);P!==void 0&&f.onValueChange(P.value)}),C=N=>{p||(f.onOpenChange(!0),R()),N&&(f.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return t.jsx(zS,{asChild:!0,...u,children:t.jsx(ze.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:p,"data-disabled":p?"":void 0,"data-placeholder":zg(f.value)?"":void 0,...c,ref:x,onClick:De(c.onClick,N=>{N.currentTarget.focus(),v.current!=="mouse"&&C(N)}),onPointerDown:De(c.onPointerDown,N=>{v.current=N.pointerType;const w=N.target;w.hasPointerCapture(N.pointerId)&&w.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(C(N),N.preventDefault())}),onKeyDown:De(c.onKeyDown,N=>{const w=y.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&k(N.key),!(w&&N.key===" ")&&WS.includes(N.key)&&(C(),N.preventDefault())})})})});vg.displayName=gg;var yg="SelectValue",jg=h.forwardRef((n,a)=>{const{__scopeSelect:l,className:o,style:c,children:u,placeholder:f="",...p}=n,x=Tn(yg,l),{onValueNodeHasChildrenChange:g}=x,v=u!==void 0,y=Ye(a,x.onValueNodeChange);return _t(()=>{g(v)},[g,v]),t.jsx(ze.span,{...p,ref:y,style:{pointerEvents:"none"},children:zg(x.value)?t.jsx(t.Fragment,{children:f}):u})});jg.displayName=yg;var qS="SelectIcon",Ng=h.forwardRef((n,a)=>{const{__scopeSelect:l,children:o,...c}=n;return t.jsx(ze.span,{"aria-hidden":!0,...c,ref:a,children:o||"▼"})});Ng.displayName=qS;var XS="SelectPortal",bg=n=>t.jsx(Kd,{asChild:!0,...n});bg.displayName=XS;var rs="SelectContent",wg=h.forwardRef((n,a)=>{const l=Tn(rs,n.__scopeSelect),[o,c]=h.useState();if(_t(()=>{c(new DocumentFragment)},[]),!l.open){const u=o;return u?Va.createPortal(t.jsx(Sg,{scope:n.__scopeSelect,children:t.jsx(Yi.Slot,{scope:n.__scopeSelect,children:t.jsx("div",{children:n.children})})}),u):null}return t.jsx(Cg,{...n,ref:a})});wg.displayName=rs;var xr=10,[Sg,_n]=Gs(rs),JS="SelectContentImpl",ZS=Ba("SelectContent.RemoveScroll"),Cg=h.forwardRef((n,a)=>{const{__scopeSelect:l,position:o="item-aligned",onCloseAutoFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,side:p,sideOffset:x,align:g,alignOffset:v,arrowPadding:y,collisionBoundary:k,collisionPadding:R,sticky:C,hideWhenDetached:N,avoidCollisions:w,...S}=n,P=Tn(rs,l),[j,_]=h.useState(null),[B,V]=h.useState(null),E=Ye(a,le=>_(le)),[T,z]=h.useState(null),[q,ue]=h.useState(null),ee=Qi(l),[ce,G]=h.useState(!1),Z=h.useRef(!1);h.useEffect(()=>{if(j)return nx(j)},[j]),Yp();const te=h.useCallback(le=>{const[ye,...D]=ee().map(re=>re.ref.current),[fe]=D.slice(-1),F=document.activeElement;for(const re of le)if(re===F||(re==null||re.scrollIntoView({block:"nearest"}),re===ye&&B&&(B.scrollTop=0),re===fe&&B&&(B.scrollTop=B.scrollHeight),re==null||re.focus(),document.activeElement!==F))return},[ee,B]),U=h.useCallback(()=>te([T,j]),[te,T,j]);h.useEffect(()=>{ce&&U()},[ce,U]);const{onOpenChange:M,triggerPointerDownPosRef:Q}=P;h.useEffect(()=>{if(j){let le={x:0,y:0};const ye=fe=>{var F,re;le={x:Math.abs(Math.round(fe.pageX)-(((F=Q.current)==null?void 0:F.x)??0)),y:Math.abs(Math.round(fe.pageY)-(((re=Q.current)==null?void 0:re.y)??0))}},D=fe=>{le.x<=10&&le.y<=10?fe.preventDefault():j.contains(fe.target)||M(!1),document.removeEventListener("pointermove",ye),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",D,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",D,{capture:!0})}}},[j,M,Q]),h.useEffect(()=>{const le=()=>M(!1);return window.addEventListener("blur",le),window.addEventListener("resize",le),()=>{window.removeEventListener("blur",le),window.removeEventListener("resize",le)}},[M]);const[H,I]=$g(le=>{const ye=ee().filter(F=>!F.disabled),D=ye.find(F=>F.ref.current===document.activeElement),fe=Bg(ye,le,D);fe&&setTimeout(()=>fe.ref.current.focus())}),L=h.useCallback((le,ye,D)=>{const fe=!Z.current&&!D;(P.value!==void 0&&P.value===ye||fe)&&(z(le),fe&&(Z.current=!0))},[P.value]),X=h.useCallback(()=>j==null?void 0:j.focus(),[j]),ae=h.useCallback((le,ye,D)=>{const fe=!Z.current&&!D;(P.value!==void 0&&P.value===ye||fe)&&ue(le)},[P.value]),ve=o==="popper"?Cd:kg,pe=ve===Cd?{side:p,sideOffset:x,align:g,alignOffset:v,arrowPadding:y,collisionBoundary:k,collisionPadding:R,sticky:C,hideWhenDetached:N,avoidCollisions:w}:{};return t.jsx(Sg,{scope:l,content:j,viewport:B,onViewportChange:V,itemRefCallback:L,selectedItem:T,onItemLeave:X,itemTextRefCallback:ae,focusSelectedItem:U,selectedItemText:q,position:o,isPositioned:ce,searchRef:H,children:t.jsx(Gd,{as:ZS,allowPinchZoom:!0,children:t.jsx(Hd,{asChild:!0,trapped:P.open,onMountAutoFocus:le=>{le.preventDefault()},onUnmountAutoFocus:De(c,le=>{var ye;(ye=P.trigger)==null||ye.focus({preventScroll:!0}),le.preventDefault()}),children:t.jsx(Wd,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:le=>le.preventDefault(),onDismiss:()=>P.onOpenChange(!1),children:t.jsx(ve,{role:"listbox",id:P.contentId,"data-state":P.open?"open":"closed",dir:P.dir,onContextMenu:le=>le.preventDefault(),...S,...pe,onPlaced:()=>G(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:De(S.onKeyDown,le=>{const ye=le.ctrlKey||le.altKey||le.metaKey;if(le.key==="Tab"&&le.preventDefault(),!ye&&le.key.length===1&&I(le.key),["ArrowUp","ArrowDown","Home","End"].includes(le.key)){let fe=ee().filter(F=>!F.disabled).map(F=>F.ref.current);if(["ArrowUp","End"].includes(le.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(le.key)){const F=le.target,re=fe.indexOf(F);fe=fe.slice(re+1)}setTimeout(()=>te(fe)),le.preventDefault()}})})})})})})});Cg.displayName=JS;var eC="SelectItemAlignedPosition",kg=h.forwardRef((n,a)=>{const{__scopeSelect:l,onPlaced:o,...c}=n,u=Tn(rs,l),f=_n(rs,l),[p,x]=h.useState(null),[g,v]=h.useState(null),y=Ye(a,E=>v(E)),k=Qi(l),R=h.useRef(!1),C=h.useRef(!0),{viewport:N,selectedItem:w,selectedItemText:S,focusSelectedItem:P}=f,j=h.useCallback(()=>{if(u.trigger&&u.valueNode&&p&&g&&N&&w&&S){const E=u.trigger.getBoundingClientRect(),T=g.getBoundingClientRect(),z=u.valueNode.getBoundingClientRect(),q=S.getBoundingClientRect();if(u.dir!=="rtl"){const F=q.left-T.left,re=z.left-F,je=E.left-re,xe=E.width+je,Oe=Math.max(xe,T.width),Xe=window.innerWidth-xr,Be=ki(re,[xr,Math.max(xr,Xe-Oe)]);p.style.minWidth=xe+"px",p.style.left=Be+"px"}else{const F=T.right-q.right,re=window.innerWidth-z.right-F,je=window.innerWidth-E.right-re,xe=E.width+je,Oe=Math.max(xe,T.width),Xe=window.innerWidth-xr,Be=ki(re,[xr,Math.max(xr,Xe-Oe)]);p.style.minWidth=xe+"px",p.style.right=Be+"px"}const ue=k(),ee=window.innerHeight-xr*2,ce=N.scrollHeight,G=window.getComputedStyle(g),Z=parseInt(G.borderTopWidth,10),te=parseInt(G.paddingTop,10),U=parseInt(G.borderBottomWidth,10),M=parseInt(G.paddingBottom,10),Q=Z+te+ce+M+U,H=Math.min(w.offsetHeight*5,Q),I=window.getComputedStyle(N),L=parseInt(I.paddingTop,10),X=parseInt(I.paddingBottom,10),ae=E.top+E.height/2-xr,ve=ee-ae,pe=w.offsetHeight/2,le=w.offsetTop+pe,ye=Z+te+le,D=Q-ye;if(ye<=ae){const F=ue.length>0&&w===ue[ue.length-1].ref.current;p.style.bottom="0px";const re=g.clientHeight-N.offsetTop-N.offsetHeight,je=Math.max(ve,pe+(F?X:0)+re+U),xe=ye+je;p.style.height=xe+"px"}else{const F=ue.length>0&&w===ue[0].ref.current;p.style.top="0px";const je=Math.max(ae,Z+N.offsetTop+(F?L:0)+pe)+D;p.style.height=je+"px",N.scrollTop=ye-ae+N.offsetTop}p.style.margin=`${xr}px 0`,p.style.minHeight=H+"px",p.style.maxHeight=ee+"px",o==null||o(),requestAnimationFrame(()=>R.current=!0)}},[k,u.trigger,u.valueNode,p,g,N,w,S,u.dir,o]);_t(()=>j(),[j]);const[_,B]=h.useState();_t(()=>{g&&B(window.getComputedStyle(g).zIndex)},[g]);const V=h.useCallback(E=>{E&&C.current===!0&&(j(),P==null||P(),C.current=!1)},[j,P]);return t.jsx(rC,{scope:l,contentWrapper:p,shouldExpandOnScrollRef:R,onScrollButtonChange:V,children:t.jsx("div",{ref:x,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:t.jsx(ze.div,{...c,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});kg.displayName=eC;var tC="SelectPopperPosition",Cd=h.forwardRef((n,a)=>{const{__scopeSelect:l,align:o="start",collisionPadding:c=xr,...u}=n,f=qi(l);return t.jsx($S,{...f,...u,ref:a,align:o,collisionPadding:c,style:{boxSizing:"border-box",...u.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Cd.displayName=tC;var[rC,uu]=Gs(rs,{}),kd="SelectViewport",Eg=h.forwardRef((n,a)=>{const{__scopeSelect:l,nonce:o,...c}=n,u=_n(kd,l),f=uu(kd,l),p=Ye(a,u.onViewportChange),x=h.useRef(0);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),t.jsx(Yi.Slot,{scope:l,children:t.jsx(ze.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:p,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:De(c.onScroll,g=>{const v=g.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:k}=f;if(k!=null&&k.current&&y){const R=Math.abs(x.current-v.scrollTop);if(R>0){const C=window.innerHeight-xr*2,N=parseFloat(y.style.minHeight),w=parseFloat(y.style.height),S=Math.max(N,w);if(S0?_:0,y.style.justifyContent="flex-end")}}}x.current=v.scrollTop})})})]})});Eg.displayName=kd;var Pg="SelectGroup",[nC,sC]=Gs(Pg),aC=h.forwardRef((n,a)=>{const{__scopeSelect:l,...o}=n,c=wn();return t.jsx(nC,{scope:l,id:c,children:t.jsx(ze.div,{role:"group","aria-labelledby":c,...o,ref:a})})});aC.displayName=Pg;var Rg="SelectLabel",lC=h.forwardRef((n,a)=>{const{__scopeSelect:l,...o}=n,c=sC(Rg,l);return t.jsx(ze.div,{id:c.id,...o,ref:a})});lC.displayName=Rg;var _i="SelectItem",[iC,Tg]=Gs(_i),_g=h.forwardRef((n,a)=>{const{__scopeSelect:l,value:o,disabled:c=!1,textValue:u,...f}=n,p=Tn(_i,l),x=_n(_i,l),g=p.value===o,[v,y]=h.useState(u??""),[k,R]=h.useState(!1),C=Ye(a,P=>{var j;return(j=x.itemRefCallback)==null?void 0:j.call(x,P,o,c)}),N=wn(),w=h.useRef("touch"),S=()=>{c||(p.onValueChange(o),p.onOpenChange(!1))};if(o==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t.jsx(iC,{scope:l,value:o,disabled:c,textId:N,isSelected:g,onItemTextChange:h.useCallback(P=>{y(j=>j||((P==null?void 0:P.textContent)??"").trim())},[]),children:t.jsx(Yi.ItemSlot,{scope:l,value:o,disabled:c,textValue:v,children:t.jsx(ze.div,{role:"option","aria-labelledby":N,"data-highlighted":k?"":void 0,"aria-selected":g&&k,"data-state":g?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...f,ref:C,onFocus:De(f.onFocus,()=>R(!0)),onBlur:De(f.onBlur,()=>R(!1)),onClick:De(f.onClick,()=>{w.current!=="mouse"&&S()}),onPointerUp:De(f.onPointerUp,()=>{w.current==="mouse"&&S()}),onPointerDown:De(f.onPointerDown,P=>{w.current=P.pointerType}),onPointerMove:De(f.onPointerMove,P=>{var j;w.current=P.pointerType,c?(j=x.onItemLeave)==null||j.call(x):w.current==="mouse"&&P.currentTarget.focus({preventScroll:!0})}),onPointerLeave:De(f.onPointerLeave,P=>{var j;P.currentTarget===document.activeElement&&((j=x.onItemLeave)==null||j.call(x))}),onKeyDown:De(f.onKeyDown,P=>{var _;((_=x.searchRef)==null?void 0:_.current)!==""&&P.key===" "||(HS.includes(P.key)&&S(),P.key===" "&&P.preventDefault())})})})})});_g.displayName=_i;var Oa="SelectItemText",Ig=h.forwardRef((n,a)=>{const{__scopeSelect:l,className:o,style:c,...u}=n,f=Tn(Oa,l),p=_n(Oa,l),x=Tg(Oa,l),g=QS(Oa,l),[v,y]=h.useState(null),k=Ye(a,S=>y(S),x.onItemTextChange,S=>{var P;return(P=p.itemTextRefCallback)==null?void 0:P.call(p,S,x.value,x.disabled)}),R=v==null?void 0:v.textContent,C=h.useMemo(()=>t.jsx("option",{value:x.value,disabled:x.disabled,children:R},x.value),[x.disabled,x.value,R]),{onNativeOptionAdd:N,onNativeOptionRemove:w}=g;return _t(()=>(N(C),()=>w(C)),[N,w,C]),t.jsxs(t.Fragment,{children:[t.jsx(ze.span,{id:x.textId,...u,ref:k}),x.isSelected&&f.valueNode&&!f.valueNodeHasChildren?Va.createPortal(u.children,f.valueNode):null]})});Ig.displayName=Oa;var Ag="SelectItemIndicator",Mg=h.forwardRef((n,a)=>{const{__scopeSelect:l,...o}=n;return Tg(Ag,l).isSelected?t.jsx(ze.span,{"aria-hidden":!0,...o,ref:a}):null});Mg.displayName=Ag;var Ed="SelectScrollUpButton",Dg=h.forwardRef((n,a)=>{const l=_n(Ed,n.__scopeSelect),o=uu(Ed,n.__scopeSelect),[c,u]=h.useState(!1),f=Ye(a,o.onScrollButtonChange);return _t(()=>{if(l.viewport&&l.isPositioned){let p=function(){const g=x.scrollTop>0;u(g)};const x=l.viewport;return p(),x.addEventListener("scroll",p),()=>x.removeEventListener("scroll",p)}},[l.viewport,l.isPositioned]),c?t.jsx(Og,{...n,ref:f,onAutoScroll:()=>{const{viewport:p,selectedItem:x}=l;p&&x&&(p.scrollTop=p.scrollTop-x.offsetHeight)}}):null});Dg.displayName=Ed;var Pd="SelectScrollDownButton",Lg=h.forwardRef((n,a)=>{const l=_n(Pd,n.__scopeSelect),o=uu(Pd,n.__scopeSelect),[c,u]=h.useState(!1),f=Ye(a,o.onScrollButtonChange);return _t(()=>{if(l.viewport&&l.isPositioned){let p=function(){const g=x.scrollHeight-x.clientHeight,v=Math.ceil(x.scrollTop)x.removeEventListener("scroll",p)}},[l.viewport,l.isPositioned]),c?t.jsx(Og,{...n,ref:f,onAutoScroll:()=>{const{viewport:p,selectedItem:x}=l;p&&x&&(p.scrollTop=p.scrollTop+x.offsetHeight)}}):null});Lg.displayName=Pd;var Og=h.forwardRef((n,a)=>{const{__scopeSelect:l,onAutoScroll:o,...c}=n,u=_n("SelectScrollButton",l),f=h.useRef(null),p=Qi(l),x=h.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return h.useEffect(()=>()=>x(),[x]),_t(()=>{var v;const g=p().find(y=>y.ref.current===document.activeElement);(v=g==null?void 0:g.ref.current)==null||v.scrollIntoView({block:"nearest"})},[p]),t.jsx(ze.div,{"aria-hidden":!0,...c,ref:a,style:{flexShrink:0,...c.style},onPointerDown:De(c.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(o,50))}),onPointerMove:De(c.onPointerMove,()=>{var g;(g=u.onItemLeave)==null||g.call(u),f.current===null&&(f.current=window.setInterval(o,50))}),onPointerLeave:De(c.onPointerLeave,()=>{x()})})}),oC="SelectSeparator",cC=h.forwardRef((n,a)=>{const{__scopeSelect:l,...o}=n;return t.jsx(ze.div,{"aria-hidden":!0,...o,ref:a})});cC.displayName=oC;var Rd="SelectArrow",dC=h.forwardRef((n,a)=>{const{__scopeSelect:l,...o}=n,c=qi(l),u=Tn(Rd,l),f=_n(Rd,l);return u.open&&f.position==="popper"?t.jsx(BS,{...c,...o,ref:a}):null});dC.displayName=Rd;var uC="SelectBubbleInput",Fg=h.forwardRef(({__scopeSelect:n,value:a,...l},o)=>{const c=h.useRef(null),u=Ye(o,c),f=Jd(a);return h.useEffect(()=>{const p=c.current;if(!p)return;const x=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(x,"value").set;if(f!==a&&v){const y=new Event("change",{bubbles:!0});v.call(p,a),p.dispatchEvent(y)}},[f,a]),t.jsx(ze.select,{...l,style:{...pg,...l.style},ref:u,defaultValue:a})});Fg.displayName=uC;function zg(n){return n===""||n===void 0}function $g(n){const a=Cn(n),l=h.useRef(""),o=h.useRef(0),c=h.useCallback(f=>{const p=l.current+f;a(p),(function x(g){l.current=g,window.clearTimeout(o.current),g!==""&&(o.current=window.setTimeout(()=>x(""),1e3))})(p)},[a]),u=h.useCallback(()=>{l.current="",window.clearTimeout(o.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(o.current),[]),[l,c,u]}function Bg(n,a,l){const c=a.length>1&&Array.from(a).every(g=>g===a[0])?a[0]:a,u=l?n.indexOf(l):-1;let f=fC(n,Math.max(u,0));c.length===1&&(f=f.filter(g=>g!==l));const x=f.find(g=>g.textValue.toLowerCase().startsWith(c.toLowerCase()));return x!==l?x:void 0}function fC(n,a){return n.map((l,o)=>n[(a+o)%n.length])}var hC=xg,Ug=vg,mC=jg,pC=Ng,xC=bg,Vg=wg,gC=Eg,Wg=_g,vC=Ig,yC=Mg,jC=Dg,NC=Lg;const id=hC,od=mC,xi=h.forwardRef(({className:n,children:a,...l},o)=>t.jsxs(Ug,{ref:o,className:Qe("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...l,children:[a,t.jsx(pC,{asChild:!0,children:t.jsx(Di,{className:"h-4 w-4 opacity-50"})})]}));xi.displayName=Ug.displayName;const gi=h.forwardRef(({className:n,children:a,position:l="popper",...o},c)=>t.jsx(xC,{children:t.jsxs(Vg,{ref:c,className:Qe("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",l==="popper"&&"data-[side=bottom]:translate-y-1",n),position:l,...o,children:[t.jsx(jC,{className:"flex cursor-default items-center justify-center py-1",children:t.jsx(Np,{className:"h-4 w-4"})}),t.jsx(gC,{className:"p-1",children:a}),t.jsx(NC,{className:"flex cursor-default items-center justify-center py-1",children:t.jsx(Di,{className:"h-4 w-4"})})]})}));gi.displayName=Vg.displayName;const jn=h.forwardRef(({className:n,children:a,...l},o)=>t.jsxs(Wg,{ref:o,className:Qe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...l,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(yC,{children:t.jsx(Mi,{className:"h-4 w-4"})})}),t.jsx(vC,{children:a})]}));jn.displayName=Wg.displayName;const bC=["一","二","三","四","五","六","七","八","九","十"],wC=["序言","尾声","附录"];function ui(n){return n?wC.some(a=>n.includes(a)):!1}function cd(n){return n.startsWith("part:")?{type:"part",id:n.slice(5)}:n.startsWith("chapter:")?{type:"chapter",id:n.slice(8)}:n.startsWith("section:")?{type:"section",id:n.slice(8)}:null}function SC({parts:n,expandedParts:a,onTogglePart:l,onReorder:o,onReadSection:c,onDeleteSection:u,onAddSectionInPart:f,onEditPart:p,onDeletePart:x}){const[g,v]=h.useState(null),[y,k]=h.useState(null),R=(j,_)=>(g==null?void 0:g.type)===j&&(g==null?void 0:g.id)===_,C=(j,_)=>(y==null?void 0:y.type)===j&&(y==null?void 0:y.id)===_,N=h.useCallback(()=>{const j=[];for(const _ of n)for(const B of _.chapters)for(const V of B.sections)j.push({id:V.id,partId:_.id,partTitle:_.title,chapterId:B.id,chapterTitle:B.title});return j},[n]),w=h.useCallback(async(j,_,B,V)=>{var ue;j.preventDefault(),j.stopPropagation();const E=j.dataTransfer.getData("text/plain"),T=cd(E);if(!T||T.type===_&&T.id===B)return;const z=N(),q=new Map(z.map(ee=>[ee.id,ee]));if(T.type==="section"){const ee=q.get(T.id);if(ee&&ui(ee.partTitle))return}else{const ee=T.type==="part"?n.find(ce=>ce.id===T.id):n.find(ce=>ce.chapters.some(G=>G.id===T.id));if(ee&&ui(ee.title))return}if(!(V&&ui(V.partTitle))){if(_==="part"){const ee=n.find(ce=>ce.id===B);if(ee&&ui(ee.title))return}if(T.type==="part"&&_==="part"){const ee=n.map(U=>U.id),ce=ee.indexOf(T.id),G=ee.indexOf(B);if(ce===-1||G===-1)return;const Z=[...ee];Z.splice(ce,1),Z.splice(ceQ.id===U);if(M)for(const Q of M.chapters)for(const H of Q.sections){const I=q.get(H.id);I&&te.push(I)}}await o(te);return}if(T.type==="chapter"&&(_==="chapter"||_==="section"||_==="part")){const ee=n.find(I=>I.chapters.some(L=>L.id===T.id)),ce=ee==null?void 0:ee.chapters.find(I=>I.id===T.id);if(!ee||!ce)return;let G,Z,te=null;if(_==="section"){const I=q.get(B);if(!I)return;G=I.partId,Z=I.partTitle,te=B}else if(_==="chapter"){const I=n.find(ae=>ae.chapters.some(ve=>ve.id===B)),L=I==null?void 0:I.chapters.find(ae=>ae.id===B);if(!I||!L)return;G=I.id,Z=I.title;const X=z.filter(ae=>ae.chapterId===B).pop();te=(X==null?void 0:X.id)??null}else{const I=n.find(X=>X.id===B);if(!I||!I.chapters[0])return;G=I.id,Z=I.title;const L=z.filter(X=>X.partId===I.id&&X.chapterId===I.chapters[0].id);te=((ue=L[L.length-1])==null?void 0:ue.id)??null}const U=ce.sections.map(I=>I.id),M=z.filter(I=>!U.includes(I.id));let Q=M.length;if(te){const I=M.findIndex(L=>L.id===te);I>=0&&(Q=I+1)}const H=U.map(I=>({...q.get(I),partId:G,partTitle:Z,chapterId:ce.id,chapterTitle:ce.title}));await o([...M.slice(0,Q),...H,...M.slice(Q)]);return}if(T.type==="section"&&(_==="section"||_==="chapter"||_==="part")){if(!V)return;const{partId:ee,partTitle:ce,chapterId:G,chapterTitle:Z}=V;let te;if(_==="section")te=z.findIndex(L=>L.id===B);else if(_==="chapter"){const L=z.filter(X=>X.chapterId===B).pop();te=L?z.findIndex(X=>X.id===L.id)+1:z.length}else{const L=n.find(ve=>ve.id===B);if(!(L!=null&&L.chapters[0]))return;const X=z.filter(ve=>ve.partId===L.id&&ve.chapterId===L.chapters[0].id),ae=X[X.length-1];te=ae?z.findIndex(ve=>ve.id===ae.id)+1:0}const U=z.findIndex(L=>L.id===T.id);if(U===-1)return;const M=z.filter(L=>L.id!==T.id),Q=U({onDragEnter:V=>{V.preventDefault(),V.stopPropagation(),V.dataTransfer.dropEffect="move",k({type:j,id:_})},onDragOver:V=>{V.preventDefault(),V.stopPropagation(),V.dataTransfer.dropEffect="move",k({type:j,id:_})},onDragLeave:()=>k(null),onDrop:V=>{k(null);const E=cd(V.dataTransfer.getData("text/plain"));if(E&&!(j==="section"&&E.type==="section"&&E.id===_))if(j==="part")if(E.type==="part")w(V,"part",_);else{const T=n.find(q=>q.id===_);(T==null?void 0:T.chapters[0])&&B&&w(V,"part",_,B)}else j==="chapter"&&B?(E.type==="section"||E.type==="chapter")&&w(V,"chapter",_,B):j==="section"&&B&&w(V,"section",_,B)}}),P=j=>bC[j]??String(j+1);return t.jsx("div",{className:"space-y-3",children:n.map((j,_)=>{var ee,ce;const B=j.title==="序言"||j.title.includes("序言"),V=j.title==="尾声"||j.title.includes("尾声"),E=j.title==="附录"||j.title.includes("附录"),T=a.includes(j.id),z=j.chapters.length,q=j.chapters.reduce((G,Z)=>G+Z.sections.length,0);if(B&&j.chapters.length===1&&j.chapters[0].sections.length===1){const G=j.chapters[0].sections[0];return t.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[t.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:t.jsx(Vr,{className:"w-4 h-4 text-gray-400"})}),t.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[j.chapters[0].title," | ",G.title]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[G.price===0||G.isFree?t.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):t.jsxs("span",{className:"text-xs text-gray-500",children:["¥",G.price]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ms,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ht,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>u(G),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:t.jsx(Er,{className:"w-3.5 h-3.5"})})]}),t.jsx(As,{className:"w-4 h-4 text-gray-500"})]})]},j.id)}if(E)return t.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),t.jsx("div",{className:"space-y-3",children:j.chapters.map((G,Z)=>t.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[t.jsxs("span",{className:"text-sm text-gray-300",children:["附录",Z+1," | ",G.title]}),t.jsx(As,{className:"w-4 h-4 text-gray-500 shrink-0"})]},G.id))})]},j.id);if(V&&j.chapters.length===1&&j.chapters[0].sections.length===1){const G=j.chapters[0].sections[0];return t.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[t.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:t.jsx(Vr,{className:"w-4 h-4 text-gray-400"})}),t.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[j.chapters[0].title," | ",G.title]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[G.price===0||G.isFree?t.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):t.jsxs("span",{className:"text-xs text-gray-500",children:["¥",G.price]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ms,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ht,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>u(G),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:t.jsx(Er,{className:"w-3.5 h-3.5"})})]}),t.jsx(As,{className:"w-4 h-4 text-gray-500"})]})]},j.id)}if(V)return t.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[t.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),t.jsx("div",{className:"space-y-3",children:j.chapters.map(G=>G.sections.map(Z=>t.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[t.jsxs("span",{className:"text-sm text-gray-300",children:[G.title," | ",Z.title]}),t.jsxs("div",{className:"flex gap-1 shrink-0",children:[t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(Z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ms,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(Z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",children:t.jsx(Ht,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>u(Z),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:t.jsx(Er,{className:"w-3.5 h-3.5"})})]})]},Z.id)))})]},j.id);const ue=C("part",j.id);return t.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${ue?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...S("part",j.id,{partId:j.id,partTitle:j.title,chapterId:((ee=j.chapters[0])==null?void 0:ee.id)??"",chapterTitle:((ce=j.chapters[0])==null?void 0:ce.title)??""}),children:[t.jsxs("div",{draggable:!0,onDragStart:G=>{G.stopPropagation(),G.dataTransfer.setData("text/plain","part:"+j.id),G.dataTransfer.effectAllowed="move",v({type:"part",id:j.id})},onDragEnd:()=>{v(null),k(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${R("part",j.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>l(j.id),children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx(Gc,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),t.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:P(_)}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-bold text-white text-base",children:j.title}),t.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",q," 节"]})]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:G=>G.stopPropagation(),onClick:G=>G.stopPropagation(),children:[f&&t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(j),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:t.jsx(gr,{className:"w-3.5 h-3.5"})}),p&&t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>p(j),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:t.jsx(Ht,{className:"w-3.5 h-3.5"})}),x&&t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>x(j),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:t.jsx(Er,{className:"w-3.5 h-3.5"})}),t.jsxs("span",{className:"text-xs text-gray-500",children:[z,"章"]}),T?t.jsx(Di,{className:"w-5 h-5 text-gray-500"}):t.jsx(As,{className:"w-5 h-5 text-gray-500"})]})]}),T&&t.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:j.chapters.map((G,Z)=>{const te=C("chapter",G.id);return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{draggable:!0,onDragStart:U=>{U.stopPropagation(),U.dataTransfer.setData("text/plain","chapter:"+G.id),U.dataTransfer.effectAllowed="move",v({type:"chapter",id:G.id})},onDragEnd:()=>{v(null),k(null)},onDragEnter:U=>{U.preventDefault(),U.stopPropagation(),U.dataTransfer.dropEffect="move",k({type:"chapter",id:G.id})},onDragOver:U=>{U.preventDefault(),U.stopPropagation(),U.dataTransfer.dropEffect="move",k({type:"chapter",id:G.id})},onDragLeave:()=>k(null),onDrop:U=>{k(null);const M=cd(U.dataTransfer.getData("text/plain"));if(!M)return;const Q={partId:j.id,partTitle:j.title,chapterId:G.id,chapterTitle:G.title};(M.type==="section"||M.type==="chapter")&&w(U,"chapter",G.id,Q)},className:`py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${te?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${R("chapter",G.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[t.jsx(Gc,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),t.jsxs("p",{className:"text-xs text-gray-500 pb-1",children:["第",Z+1,"章 | ",G.title]})]}),t.jsx("div",{className:"space-y-1 pl-2",children:G.sections.map(U=>{const M=C("section",U.id);return t.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","section:"+U.id),Q.dataTransfer.effectAllowed="move",v({type:"section",id:U.id})},onDragEnd:()=>{v(null),k(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${M?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",U.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...S("section",U.id,{partId:j.id,partTitle:j.title,chapterId:G.id,chapterTitle:G.title}),children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[t.jsx(Gc,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),t.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${U.price===0||U.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),t.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[U.id," ",U.title]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Q=>Q.stopPropagation(),onClick:Q=>Q.stopPropagation(),children:[U.isNew&&t.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),U.price===0||U.isFree?t.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):t.jsxs("span",{className:"text-xs text-gray-500",children:["¥",U.price]}),t.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:t.jsx(Ms,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>c(U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:t.jsx(Ht,{className:"w-3.5 h-3.5"})}),t.jsx(ie,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>u(U),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:t.jsx(Er,{className:"w-3.5 h-3.5"})})]}),t.jsx(As,{className:"w-4 h-4 text-gray-500"})]})]},U.id)})})]},G.id)})})]},j.id)})})}function CC(n){const a=new Map;for(const c of n){const u=c.partId||"part-1",f=c.partTitle||"未分类",p=c.chapterId||"chapter-1",x=c.chapterTitle||"未分类";a.has(u)||a.set(u,{id:u,title:f,chapters:new Map});const g=a.get(u);g.chapters.has(p)||g.chapters.set(p,{id:p,title:x,sections:[]}),g.chapters.get(p).sections.push({id:c.id,title:c.title,price:c.price??1,filePath:c.filePath,isFree:c.isFree,isNew:c.isNew})}const l=Array.from(a.values()).map(c=>({...c,chapters:Array.from(c.chapters.values())})),o=c=>c.includes("序言")?0:c.includes("附录")?2:c.includes("尾声")?3:1;return l.sort((c,u)=>{const f=o(c.title),p=o(u.title);return f!==p?f-p:0})}function kC(){var fe;const[n,a]=h.useState([]),[l,o]=h.useState(!0),[c,u]=h.useState([]),[f,p]=h.useState(null),[x,g]=h.useState(!1),[v,y]=h.useState(!1),[k,R]=h.useState(!1),[C,N]=h.useState(""),[w,S]=h.useState([]),[P,j]=h.useState(!1),[_,B]=h.useState(!1),V=h.useRef(null),[E,T]=h.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),[z,q]=h.useState(null),[ue,ee]=h.useState(!1),ce=CC(n),G=n.length,Z=async()=>{o(!0);try{const F=await Ke("/api/db/book?action=list");a(Array.isArray(F==null?void 0:F.sections)?F.sections:[])}catch(F){console.error(F),a([])}finally{o(!1)}};h.useEffect(()=>{Z()},[]);const te=F=>{u(re=>re.includes(F)?re.filter(je=>je!==F):[...re,F])},U=h.useCallback(F=>{const re=n,je=F.flatMap(xe=>{const Oe=re.find(Xe=>Xe.id===xe.id);return Oe?[{...Oe,partId:xe.partId,partTitle:xe.partTitle,chapterId:xe.chapterId,chapterTitle:xe.chapterTitle}]:[]});return a(je),St("/api/db/book",{action:"reorder",items:F}).then(xe=>{xe&&xe.success===!1&&(a(re),alert("排序失败: "+(xe&&typeof xe=="object"&&"error"in xe?xe.error:"未知错误")))}).catch(xe=>{a(re),console.error("排序失败:",xe),alert("排序失败: "+(xe instanceof Error?xe.message:"网络或服务异常"))}),Promise.resolve()},[n]),M=async F=>{if(confirm(`确定要删除章节「${F.title}」吗?此操作不可恢复。`))try{const re=await zs(`/api/db/book?id=${encodeURIComponent(F.id)}`);re&&re.success!==!1?(alert("已删除"),Z()):alert("删除失败: "+(re&&typeof re=="object"&&"error"in re?re.error:"未知错误"))}catch(re){console.error(re),alert("删除失败")}},Q=async F=>{y(!0);try{const re=await Ke(`/api/db/book?action=read&id=${encodeURIComponent(F.id)}`);if(re!=null&&re.success&&re.section){const je=re.section;p({id:F.id,title:re.section.title??F.title,price:re.section.price??F.price,content:re.section.content??"",filePath:F.filePath,isFree:F.isFree||F.price===0,isNew:je.isNew??F.isNew})}else p({id:F.id,title:F.title,price:F.price,content:"",filePath:F.filePath,isFree:F.isFree,isNew:F.isNew}),re&&!re.success&&alert("无法读取文件内容: "+(re.error||"未知错误"))}catch(re){console.error(re),p({id:F.id,title:F.title,price:F.price,content:"",filePath:F.filePath,isFree:F.isFree})}finally{y(!1)}},H=async()=>{var F;if(f){R(!0);try{let re=f.content||"";const je=[new RegExp(`^#+\\s*${f.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${f.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(F=f.title)==null?void 0:F.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const Oe of je)re=re.replace(Oe,"");re=re.replace(/^\s*\n+/,"").trim();const xe=await St("/api/db/book",{id:f.id,title:f.title,price:f.isFree?0:f.price,content:re,isFree:f.isFree||f.price===0,isNew:f.isNew,saveToFile:!0});xe&&xe.success!==!1?(alert(`已保存章节: ${f.title}`),p(null),Z()):alert("保存失败: "+(xe&&typeof xe=="object"&&"error"in xe?xe.error:"未知错误"))}catch(re){console.error(re),alert("保存失败")}finally{R(!1)}}},I=async()=>{if(!E.id||!E.title){alert("请填写章节ID和标题");return}R(!0);try{const F=await St("/api/db/book",{id:E.id,title:E.title,price:E.price,content:E.content,partId:E.partId,chapterId:E.chapterId,saveToFile:!1});F&&F.success!==!1?(alert(`章节创建成功: ${E.title}`),g(!1),T({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),Z()):alert("创建失败: "+(F&&typeof F=="object"&&"error"in F?F.error:"未知错误"))}catch(F){console.error(F),alert("创建失败")}finally{R(!1)}},L=F=>{T(re=>{var je;return{...re,partId:F.id,chapterId:((je=F.chapters[0])==null?void 0:je.id)??"chapter-1"}}),g(!0)},X=F=>{q({id:F.id,title:F.title})},ae=async()=>{var F;if((F=z==null?void 0:z.title)!=null&&F.trim()){ee(!0);try{const re=n.map(xe=>({id:xe.id,partId:xe.partId||"part-1",partTitle:xe.partId===z.id?z.title.trim():xe.partTitle||"",chapterId:xe.chapterId||"chapter-1",chapterTitle:xe.chapterTitle||""})),je=await St("/api/db/book",{action:"reorder",items:re});je&&je.success!==!1?(q(null),Z()):alert("更新篇名失败: "+(je&&typeof je=="object"&&"error"in je?je.error:"未知错误"))}catch(re){console.error(re),alert("更新篇名失败")}finally{ee(!1)}}},ve=async F=>{const re=n.filter(je=>je.partId===F.id).map(je=>je.id);if(re.length!==0&&confirm(`确定要删除「${F.title}」整篇吗?将删除共 ${re.length} 节内容,此操作不可恢复。`))try{for(const je of re)await zs(`/api/db/book?id=${encodeURIComponent(je)}`);Z()}catch(je){console.error(je),alert("删除失败")}},pe=async F=>{var je,xe;const re=(je=F.target.files)==null?void 0:je[0];if(re){B(!0);try{const Oe=new FormData;Oe.append("file",re),Oe.append("folder","book-images");const Be=await(await fetch(Fs("/api/upload"),{method:"POST",body:Oe,credentials:"include"})).json();if(Be!=null&&Be.success&&((xe=Be==null?void 0:Be.data)!=null&&xe.url)){const Ct=`![${re.name}](${Be.data.url})`;f&&p({...f,content:(f.content||"")+` - -`+Ct}),alert(`图片上传成功: ${Be.data.url}`)}else alert("上传失败: "+((Be==null?void 0:Be.error)||"未知错误"))}catch(Oe){console.error(Oe),alert("上传失败")}finally{B(!1),V.current&&(V.current.value="")}}},le=async()=>{var F;if(C.trim()){j(!0);try{const re=await Ke(`/api/search?q=${encodeURIComponent(C)}`);re!=null&&re.success&&((F=re.data)!=null&&F.results)?S(re.data.results):(S([]),re&&!re.success&&alert("搜索失败: "+re.error))}catch(re){console.error(re),S([]),alert("搜索失败")}finally{j(!1)}}},ye=ce.find(F=>F.id===E.partId),D=(ye==null?void 0:ye.chapters)??[];return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),t.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",ce.length," 篇 · ",G," 节内容"]})]}),t.jsx("div",{className:"flex gap-2",children:t.jsxs(ie,{onClick:()=>{const F=typeof window<"u"?`${window.location.origin}/api-doc`:"";F&&window.open(F,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Yn,{className:"w-4 h-4 mr-2"}),"API 接口"]})})]}),t.jsx(Mt,{open:x,onOpenChange:g,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(gr,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"章节ID *"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:E.id,onChange:F=>T({...E,id:F.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"价格 (元)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:E.price,onChange:F=>T({...E,price:Number(F.target.value)})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"章节标题 *"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:E.title,onChange:F=>T({...E,title:F.target.value})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"所属篇"}),t.jsxs(id,{value:E.partId,onValueChange:F=>T({...E,partId:F,chapterId:"chapter-1"}),children:[t.jsx(xi,{className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(od,{})}),t.jsxs(gi,{className:"bg-[#0f2137] border-gray-700",children:[ce.map(F=>t.jsx(jn,{value:F.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:F.title},F.id)),ce.length===0&&t.jsx(jn,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"所属章"}),t.jsxs(id,{value:E.chapterId,onValueChange:F=>T({...E,chapterId:F}),children:[t.jsx(xi,{className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(od,{})}),t.jsxs(gi,{className:"bg-[#0f2137] border-gray-700",children:[D.map(F=>t.jsx(jn,{value:F.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:F.title},F.id)),D.length===0&&t.jsx(jn,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"内容 (Markdown格式)"}),t.jsx(Xn,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[300px] font-mono text-sm placeholder:text-gray-500",placeholder:"输入章节内容...",value:E.content,onChange:F=>T({...E,content:F.target.value})})]})]}),t.jsxs(Kt,{children:[t.jsx(ie,{variant:"outline",onClick:()=>g(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(ie,{onClick:I,disabled:k||!E.id||!E.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:k?t.jsxs(t.Fragment,{children:[t.jsx(Ze,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),t.jsx(Mt,{open:!!z,onOpenChange:F=>!F&&q(null),children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(Ht,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),z&&t.jsx("div",{className:"space-y-4 py-4",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"篇名"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:z.title,onChange:F=>q({...z,title:F.target.value}),placeholder:"输入篇名"})]})}),t.jsxs(Kt,{children:[t.jsx(ie,{variant:"outline",onClick:()=>q(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(ie,{onClick:ae,disabled:ue||!((fe=z==null?void 0:z.title)!=null&&fe.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ue?t.jsxs(t.Fragment,{children:[t.jsx(Ze,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),t.jsx(Mt,{open:!!f,onOpenChange:()=>p(null),children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[t.jsx(Ht,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),f&&t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"章节ID"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:f.id,disabled:!0})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"价格 (元)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.isFree?0:f.price,onChange:F=>p({...f,price:Number(F.target.value),isFree:Number(F.target.value)===0}),disabled:f.isFree})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"免费章节(唯一入口,小程序以 is_free 或 price=0 为准)"}),t.jsx("div",{className:"flex items-center h-10",children:t.jsxs("label",{className:"flex items-center cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:f.isFree||f.price===0,onChange:F=>p({...f,isFree:F.target.checked,price:F.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),t.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"最新新增"}),t.jsx("div",{className:"flex items-center h-10",children:t.jsxs("label",{className:"flex items-center cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:f.isNew??!1,onChange:F=>p({...f,isNew:F.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),t.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"章节标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:f.title,onChange:F=>p({...f,title:F.target.value})})]}),f.filePath&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"文件路径"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:f.filePath,disabled:!0})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(J,{className:"text-gray-300",children:"内容 (Markdown格式)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:V,type:"file",accept:"image/*",onChange:pe,className:"hidden"}),t.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>{var F;return(F=V.current)==null?void 0:F.click()},disabled:_,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[_?t.jsx(Ze,{className:"w-4 h-4 mr-1 animate-spin"}):t.jsx(Cp,{className:"w-4 h-4 mr-1"}),"上传图片"]})]})]}),v?t.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[t.jsx(Ze,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsx(Xn,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[400px] font-mono text-sm placeholder:text-gray-500",placeholder:"此处输入章节内容,支持Markdown格式...",value:f.content,onChange:F=>p({...f,content:F.target.value})})]})]}),t.jsxs(Kt,{children:[t.jsxs(ie,{variant:"outline",onClick:()=>p(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsx(ie,{onClick:H,disabled:k,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:k?t.jsxs(t.Fragment,{children:[t.jsx(Ze,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),t.jsxs(ru,{defaultValue:"chapters",className:"space-y-6",children:[t.jsxs(Vi,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[t.jsxs(ar,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Vr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),t.jsxs(ar,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Qn,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),t.jsxs(ar,{value:"hooks",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(ON,{className:"w-4 h-4 mr-2"}),"钩子配置"]})]}),t.jsxs(lr,{value:"chapters",className:"space-y-4",children:[t.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:t.jsx(Vr,{className:"w-6 h-6"})}),t.jsxs("div",{children:[t.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),t.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),t.jsxs("div",{className:"text-center shrink-0",children:[t.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:G}),t.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),t.jsxs(ie,{onClick:()=>g(!0),className:"w-full bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"新建章节"]}),l?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(Ze,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsx(SC,{parts:ce,expandedParts:c,onTogglePart:te,onReorder:U,onReadSection:Q,onDeleteSection:M,onAddSectionInPart:L,onEditPart:X,onDeletePart:ve})]}),t.jsx(lr,{value:"search",className:"space-y-4",children:t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"内容搜索"})}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:C,onChange:F=>N(F.target.value),onKeyDown:F=>F.key==="Enter"&&le()}),t.jsx(ie,{onClick:le,disabled:P||!C.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:P?t.jsx(Ze,{className:"w-4 h-4 animate-spin"}):t.jsx(Qn,{className:"w-4 h-4"})})]}),w.length>0&&t.jsxs("div",{className:"space-y-2 mt-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",w.length," 个结果"]}),w.map(F=>t.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>Q({id:F.id,title:F.title,price:F.price??1,filePath:""}),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-[#38bdac] font-mono text-xs mr-2",children:F.id}),t.jsx("span",{className:"text-white",children:F.title})]}),t.jsx(Le,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:F.matchType==="title"?"标题匹配":"内容匹配"})]}),F.snippet&&t.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:F.snippet}),(F.partTitle||F.chapterTitle)&&t.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[F.partTitle," · ",F.chapterTitle]})]},F.id))]})]})]})}),t.jsx(lr,{value:"hooks",className:"space-y-4",children:t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"引流钩子配置"})}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"grid w-full max-w-sm items-center gap-1.5",children:[t.jsx(J,{htmlFor:"hook-chapter",className:"text-gray-300",children:"触发章节"}),t.jsxs(id,{defaultValue:"3",children:[t.jsx(xi,{id:"hook-chapter",className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(od,{placeholder:"选择章节"})}),t.jsxs(gi,{className:"bg-[#0f2137] border-gray-700",children:[t.jsx(jn,{value:"1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第一章"}),t.jsx(jn,{value:"2",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第二章"}),t.jsx(jn,{value:"3",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第三章 (默认)"})]})]})]}),t.jsxs("div",{className:"grid w-full gap-1.5",children:[t.jsx(J,{htmlFor:"message",className:"text-gray-300",children:"引流文案"}),t.jsx(Xn,{placeholder:"输入引导用户加群的文案...",id:"message",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",defaultValue:"阅读更多精彩内容,请加入Soul创业实验派对群..."})]}),t.jsx(ie,{className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:"保存配置"})]})]})})]})]})}var Hg=["PageUp","PageDown"],Kg=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Gg={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ys="Slider",[Td,EC,PC]=eu(Ys),[Yg]=Rn(Ys,[PC]),[RC,Xi]=Yg(Ys),Qg=h.forwardRef((n,a)=>{const{name:l,min:o=0,max:c=100,step:u=1,orientation:f="horizontal",disabled:p=!1,minStepsBetweenThumbs:x=0,defaultValue:g=[o],value:v,onValueChange:y=()=>{},onValueCommit:k=()=>{},inverted:R=!1,form:C,...N}=n,w=h.useRef(new Set),S=h.useRef(0),j=f==="horizontal"?TC:_C,[_=[],B]=Jn({prop:v,defaultProp:g,onChange:ue=>{var ce;(ce=[...w.current][S.current])==null||ce.focus(),y(ue)}}),V=h.useRef(_);function E(ue){const ee=LC(_,ue);q(ue,ee)}function T(ue){q(ue,S.current)}function z(){const ue=V.current[S.current];_[S.current]!==ue&&k(_)}function q(ue,ee,{commit:ce}={commit:!1}){const G=$C(u),Z=BC(Math.round((ue-o)/u)*u+o,G),te=ki(Z,[o,c]);B((U=[])=>{const M=MC(U,te,ee);if(zC(M,x*u)){S.current=M.indexOf(te);const Q=String(M)!==String(U);return Q&&ce&&k(M),Q?M:U}else return U})}return t.jsx(RC,{scope:n.__scopeSlider,name:l,disabled:p,min:o,max:c,valueIndexToChangeRef:S,thumbs:w.current,values:_,orientation:f,form:C,children:t.jsx(Td.Provider,{scope:n.__scopeSlider,children:t.jsx(Td.Slot,{scope:n.__scopeSlider,children:t.jsx(j,{"aria-disabled":p,"data-disabled":p?"":void 0,...N,ref:a,onPointerDown:De(N.onPointerDown,()=>{p||(V.current=_)}),min:o,max:c,inverted:R,onSlideStart:p?void 0:E,onSlideMove:p?void 0:T,onSlideEnd:p?void 0:z,onHomeKeyDown:()=>!p&&q(o,0,{commit:!0}),onEndKeyDown:()=>!p&&q(c,_.length-1,{commit:!0}),onStepKeyDown:({event:ue,direction:ee})=>{if(!p){const Z=Hg.includes(ue.key)||ue.shiftKey&&Kg.includes(ue.key)?10:1,te=S.current,U=_[te],M=u*Z*ee;q(U+M,te,{commit:!0})}}})})})})});Qg.displayName=Ys;var[qg,Xg]=Yg(Ys,{startEdge:"left",endEdge:"right",size:"width",direction:1}),TC=h.forwardRef((n,a)=>{const{min:l,max:o,dir:c,inverted:u,onSlideStart:f,onSlideMove:p,onSlideEnd:x,onStepKeyDown:g,...v}=n,[y,k]=h.useState(null),R=Ye(a,j=>k(j)),C=h.useRef(void 0),N=Bi(c),w=N==="ltr",S=w&&!u||!w&&u;function P(j){const _=C.current||y.getBoundingClientRect(),B=[0,_.width],E=fu(B,S?[l,o]:[o,l]);return C.current=_,E(j-_.left)}return t.jsx(qg,{scope:n.__scopeSlider,startEdge:S?"left":"right",endEdge:S?"right":"left",direction:S?1:-1,size:"width",children:t.jsx(Jg,{dir:N,"data-orientation":"horizontal",...v,ref:R,style:{...v.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:j=>{const _=P(j.clientX);f==null||f(_)},onSlideMove:j=>{const _=P(j.clientX);p==null||p(_)},onSlideEnd:()=>{C.current=void 0,x==null||x()},onStepKeyDown:j=>{const B=Gg[S?"from-left":"from-right"].includes(j.key);g==null||g({event:j,direction:B?-1:1})}})})}),_C=h.forwardRef((n,a)=>{const{min:l,max:o,inverted:c,onSlideStart:u,onSlideMove:f,onSlideEnd:p,onStepKeyDown:x,...g}=n,v=h.useRef(null),y=Ye(a,v),k=h.useRef(void 0),R=!c;function C(N){const w=k.current||v.current.getBoundingClientRect(),S=[0,w.height],j=fu(S,R?[o,l]:[l,o]);return k.current=w,j(N-w.top)}return t.jsx(qg,{scope:n.__scopeSlider,startEdge:R?"bottom":"top",endEdge:R?"top":"bottom",size:"height",direction:R?1:-1,children:t.jsx(Jg,{"data-orientation":"vertical",...g,ref:y,style:{...g.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const w=C(N.clientY);u==null||u(w)},onSlideMove:N=>{const w=C(N.clientY);f==null||f(w)},onSlideEnd:()=>{k.current=void 0,p==null||p()},onStepKeyDown:N=>{const S=Gg[R?"from-bottom":"from-top"].includes(N.key);x==null||x({event:N,direction:S?-1:1})}})})}),Jg=h.forwardRef((n,a)=>{const{__scopeSlider:l,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onHomeKeyDown:f,onEndKeyDown:p,onStepKeyDown:x,...g}=n,v=Xi(Ys,l);return t.jsx(ze.span,{...g,ref:a,onKeyDown:De(n.onKeyDown,y=>{y.key==="Home"?(f(y),y.preventDefault()):y.key==="End"?(p(y),y.preventDefault()):Hg.concat(Kg).includes(y.key)&&(x(y),y.preventDefault())}),onPointerDown:De(n.onPointerDown,y=>{const k=y.target;k.setPointerCapture(y.pointerId),y.preventDefault(),v.thumbs.has(k)?k.focus():o(y)}),onPointerMove:De(n.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&c(y)}),onPointerUp:De(n.onPointerUp,y=>{const k=y.target;k.hasPointerCapture(y.pointerId)&&(k.releasePointerCapture(y.pointerId),u(y))})})}),Zg="SliderTrack",e0=h.forwardRef((n,a)=>{const{__scopeSlider:l,...o}=n,c=Xi(Zg,l);return t.jsx(ze.span,{"data-disabled":c.disabled?"":void 0,"data-orientation":c.orientation,...o,ref:a})});e0.displayName=Zg;var _d="SliderRange",t0=h.forwardRef((n,a)=>{const{__scopeSlider:l,...o}=n,c=Xi(_d,l),u=Xg(_d,l),f=h.useRef(null),p=Ye(a,f),x=c.values.length,g=c.values.map(k=>s0(k,c.min,c.max)),v=x>1?Math.min(...g):0,y=100-Math.max(...g);return t.jsx(ze.span,{"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,...o,ref:p,style:{...n.style,[u.startEdge]:v+"%",[u.endEdge]:y+"%"}})});t0.displayName=_d;var Id="SliderThumb",r0=h.forwardRef((n,a)=>{const l=EC(n.__scopeSlider),[o,c]=h.useState(null),u=Ye(a,p=>c(p)),f=h.useMemo(()=>o?l().findIndex(p=>p.ref.current===o):-1,[l,o]);return t.jsx(IC,{...n,ref:u,index:f})}),IC=h.forwardRef((n,a)=>{const{__scopeSlider:l,index:o,name:c,...u}=n,f=Xi(Id,l),p=Xg(Id,l),[x,g]=h.useState(null),v=Ye(a,P=>g(P)),y=x?f.form||!!x.closest("form"):!0,k=Zd(x),R=f.values[o],C=R===void 0?0:s0(R,f.min,f.max),N=DC(o,f.values.length),w=k==null?void 0:k[p.size],S=w?OC(w,C,p.direction):0;return h.useEffect(()=>{if(x)return f.thumbs.add(x),()=>{f.thumbs.delete(x)}},[x,f.thumbs]),t.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[p.startEdge]:`calc(${C}% + ${S}px)`},children:[t.jsx(Td.ItemSlot,{scope:n.__scopeSlider,children:t.jsx(ze.span,{role:"slider","aria-label":n["aria-label"]||N,"aria-valuemin":f.min,"aria-valuenow":R,"aria-valuemax":f.max,"aria-orientation":f.orientation,"data-orientation":f.orientation,"data-disabled":f.disabled?"":void 0,tabIndex:f.disabled?void 0:0,...u,ref:v,style:R===void 0?{display:"none"}:n.style,onFocus:De(n.onFocus,()=>{f.valueIndexToChangeRef.current=o})})}),y&&t.jsx(n0,{name:c??(f.name?f.name+(f.values.length>1?"[]":""):void 0),form:f.form,value:R},o)]})});r0.displayName=Id;var AC="RadioBubbleInput",n0=h.forwardRef(({__scopeSlider:n,value:a,...l},o)=>{const c=h.useRef(null),u=Ye(c,o),f=Jd(a);return h.useEffect(()=>{const p=c.current;if(!p)return;const x=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(x,"value").set;if(f!==a&&v){const y=new Event("input",{bubbles:!0});v.call(p,a),p.dispatchEvent(y)}},[f,a]),t.jsx(ze.input,{style:{display:"none"},...l,ref:u,defaultValue:a})});n0.displayName=AC;function MC(n=[],a,l){const o=[...n];return o[l]=a,o.sort((c,u)=>c-u)}function s0(n,a,l){const u=100/(l-a)*(n-a);return ki(u,[0,100])}function DC(n,a){return a>2?`Value ${n+1} of ${a}`:a===2?["Minimum","Maximum"][n]:void 0}function LC(n,a){if(n.length===1)return 0;const l=n.map(c=>Math.abs(c-a)),o=Math.min(...l);return l.indexOf(o)}function OC(n,a,l){const o=n/2,u=fu([0,50],[0,o]);return(o-u(a)*l)*l}function FC(n){return n.slice(0,-1).map((a,l)=>n[l+1]-a)}function zC(n,a){if(a>0){const l=FC(n);return Math.min(...l)>=a}return!0}function fu(n,a){return l=>{if(n[0]===n[1]||a[0]===a[1])return a[0];const o=(a[1]-a[0])/(n[1]-n[0]);return a[0]+o*(l-n[0])}}function $C(n){return(String(n).split(".")[1]||"").length}function BC(n,a){const l=Math.pow(10,a);return Math.round(n*l)/l}var UC=Qg,VC=e0,WC=t0,HC=r0;function KC({className:n,defaultValue:a,value:l,min:o=0,max:c=100,...u}){const f=h.useMemo(()=>Array.isArray(l)?l:Array.isArray(a)?a:[o,c],[l,a,o,c]);return t.jsxs(UC,{defaultValue:a,value:l,min:o,max:c,className:Qe("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",n),...u,children:[t.jsx(VC,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:t.jsx(WC,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:f.length},(p,x)=>t.jsx(HC,{className:"block size-4 shrink-0 rounded-full border-2 border-[#38bdac] bg-white shadow-sm focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},x))]})}const GC={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function YC(){const[n,a]=h.useState(GC),[l,o]=h.useState(!0),[c,u]=h.useState(!1);h.useEffect(()=>{Ke("/api/admin/referral-settings").then(x=>{const g=x==null?void 0:x.data;g&&typeof g=="object"&&a({distributorShare:g.distributorShare??90,minWithdrawAmount:g.minWithdrawAmount??10,bindingDays:g.bindingDays??30,userDiscount:g.userDiscount??5,enableAutoWithdraw:g.enableAutoWithdraw??!1,vipOrderShareVip:g.vipOrderShareVip??20,vipOrderShareNonVip:g.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>o(!1))},[]);const f=async()=>{u(!0);try{const x={distributorShare:Number(n.distributorShare)||0,minWithdrawAmount:Number(n.minWithdrawAmount)||0,bindingDays:Number(n.bindingDays)||0,userDiscount:Number(n.userDiscount)||0,enableAutoWithdraw:!!n.enableAutoWithdraw,vipOrderShareVip:Number(n.vipOrderShareVip)||20,vipOrderShareNonVip:Number(n.vipOrderShareNonVip)||10},g=await jt("/api/admin/referral-settings",x);if(!g||g.success===!1){alert("保存失败: "+(g&&typeof g=="object"&&"error"in g?g.error:""));return}alert(`✅ 分销配置已保存成功! - -• 小程序与网站的推广规则会一起生效 -• 绑定关系会使用新的天数配置 -• 佣金比例会立即应用到新订单 - -如有缓存,请刷新前台/小程序页面。`)}catch(x){console.error(x),alert("保存失败: "+(x instanceof Error?x.message:String(x)))}finally{u(!1)}},p=x=>g=>{const v=parseFloat(g.target.value||"0");a(y=>({...y,[x]:isNaN(v)?0:v}))};return l?t.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[t.jsx(Os,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),t.jsxs(ie,{onClick:f,disabled:c||l,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"flex items-center gap-2 text-white",children:[t.jsx(EN,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),t.jsx(ot,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),t.jsx(Te,{className:"space-y-6",children:t.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(ri,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),t.jsx(se,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.userDiscount,onChange:p("userDiscount")}),t.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(vr,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(KC,{className:"flex-1",min:10,max:100,step:1,value:[n.distributorShare],onValueChange:([x])=>a(g=>({...g,distributorShare:x}))}),t.jsx(se,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:n.distributorShare,onChange:p("distributorShare")})]}),t.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",t.jsxs("span",{className:"text-[#38bdac] font-mono",children:[n.distributorShare,"%"]}),";会员订单见下方。"]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(ri,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),t.jsx(se,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.vipOrderShareVip,onChange:p("vipOrderShareVip")}),t.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(ri,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),t.jsx(se,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.vipOrderShareNonVip,onChange:p("vipOrderShareNonVip")}),t.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(vr,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),t.jsx(se,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:n.bindingDays,onChange:p("bindingDays")}),t.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"flex items-center gap-2 text-white",children:[t.jsx(Os,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),t.jsx(ot,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),t.jsx(Te,{className:"space-y-6",children:t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"最低提现金额(元)"}),t.jsx(se,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:n.minWithdrawAmount,onChange:p("minWithdrawAmount")}),t.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",t.jsx(Le,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),t.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[t.jsx(ht,{checked:n.enableAutoWithdraw,onCheckedChange:x=>a(g=>({...g,enableAutoWithdraw:x}))}),t.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Ue,{children:t.jsxs(Ve,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[t.jsx(ri,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),t.jsxs(Te,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[t.jsxs("p",{children:["1. 以上配置会写入"," ",t.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),t.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),t.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}const Ur={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function sp(n){return Array.isArray(n)?n.map(a=>a&&typeof a=="object"&&"label"in a&&"value"in a?{label:String(a.label),value:String(a.value)}:{label:"",value:""}).filter(a=>a.label||a.value):Ur.stats}function ap(n){return Array.isArray(n)?n.map(a=>typeof a=="string"?a:String(a??"")).filter(Boolean):Ur.highlights}function QC(){const[n,a]=h.useState(Ur),[l,o]=h.useState(!0),[c,u]=h.useState(!1),[f,p]=h.useState(!1),x=h.useRef(null);h.useEffect(()=>{Ke("/api/admin/author-settings").then(S=>{const P=S==null?void 0:S.data;P&&typeof P=="object"&&a({name:String(P.name??Ur.name),avatar:String(P.avatar??Ur.avatar),avatarImg:String(P.avatarImg??""),title:String(P.title??Ur.title),bio:String(P.bio??Ur.bio),stats:sp(P.stats).length?sp(P.stats):Ur.stats,highlights:ap(P.highlights).length?ap(P.highlights):Ur.highlights})}).catch(console.error).finally(()=>o(!1))},[]);const g=async()=>{u(!0);try{const S={name:n.name,avatar:n.avatar||"K",avatarImg:n.avatarImg,title:n.title,bio:n.bio,stats:n.stats.filter(_=>_.label||_.value),highlights:n.highlights.filter(Boolean)},P=await jt("/api/admin/author-settings",S);if(!P||P.success===!1){alert("保存失败: "+(P&&typeof P=="object"&&"error"in P?P.error:""));return}u(!1);const j=document.createElement("div");j.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",j.textContent="作者设置已保存",document.body.appendChild(j),setTimeout(()=>j.remove(),2e3)}catch(S){console.error(S),alert("保存失败: "+(S instanceof Error?S.message:String(S)))}finally{u(!1)}},v=async S=>{var j;const P=(j=S.target.files)==null?void 0:j[0];if(P){p(!0);try{const _=new FormData;_.append("file",P),_.append("folder","avatars");const B=Bd(),V={};B&&(V.Authorization=`Bearer ${B}`);const T=await(await fetch(Fs("/api/upload"),{method:"POST",body:_,credentials:"include",headers:V})).json();T!=null&&T.success&&(T!=null&&T.url)?a(z=>({...z,avatarImg:T.url})):alert("上传失败: "+((T==null?void 0:T.error)||"未知错误"))}catch(_){console.error(_),alert("上传失败")}finally{p(!1),x.current&&(x.current.value="")}}},y=()=>a(S=>({...S,stats:[...S.stats,{label:"",value:""}]})),k=S=>a(P=>({...P,stats:P.stats.filter((j,_)=>_!==S)})),R=(S,P,j)=>a(_=>({..._,stats:_.stats.map((B,V)=>V===S?{...B,[P]:j}:B)})),C=()=>a(S=>({...S,highlights:[...S.highlights,""]})),N=S=>a(P=>({...P,highlights:P.highlights.filter((j,_)=>_!==S)})),w=(S,P)=>a(j=>({...j,highlights:j.highlights.map((_,B)=>B===S?P:_)}));return l?t.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[t.jsx(qn,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),t.jsxs(ie,{onClick:g,disabled:c||l,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"flex items-center gap-2 text-white",children:[t.jsx(qn,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),t.jsx(ot,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"姓名"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:n.name,onChange:S=>a(P=>({...P,name:S.target.value})),placeholder:"卡若"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:n.avatar,onChange:S=>a(P=>({...P,avatar:S.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(Cp,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),t.jsxs("div",{className:"flex gap-3 items-center",children:[t.jsx(se,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:n.avatarImg,onChange:S=>a(P=>({...P,avatarImg:S.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),t.jsx("input",{ref:x,type:"file",accept:"image/*",className:"hidden",onChange:v}),t.jsxs(ie,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:f,onClick:()=>{var S;return(S=x.current)==null?void 0:S.click()},children:[t.jsx(bi,{className:"w-4 h-4 mr-2"}),f?"上传中...":"上传"]})]}),n.avatarImg&&t.jsx("div",{className:"mt-2",children:t.jsx("img",{src:n.avatarImg.startsWith("http")?n.avatarImg:Fs(n.avatarImg),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"头衔"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:n.title,onChange:S=>a(P=>({...P,title:S.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"个人简介"}),t.jsx(Xn,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:n.bio,onChange:S=>a(P=>({...P,bio:S.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsx(Ve,{className:"text-white",children:"统计数据"}),t.jsx(ot,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),t.jsxs(Te,{className:"space-y-3",children:[n.stats.map((S,P)=>t.jsxs("div",{className:"flex gap-3 items-center",children:[t.jsx(se,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:S.label,onChange:j=>R(P,"label",j.target.value),placeholder:"标签"}),t.jsx(se,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:S.value,onChange:j=>R(P,"value",j.target.value),placeholder:"数值"}),t.jsx(ie,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>k(P),children:t.jsx(ir,{className:"w-4 h-4"})})]},P)),t.jsxs(ie,{variant:"outline",size:"sm",onClick:y,className:"border-gray-600 text-gray-400",children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsx(Ve,{className:"text-white",children:"亮点标签"}),t.jsx(ot,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),t.jsxs(Te,{className:"space-y-3",children:[n.highlights.map((S,P)=>t.jsxs("div",{className:"flex gap-3 items-center",children:[t.jsx(se,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:S,onChange:j=>w(P,j.target.value),placeholder:"5年私域运营经验"}),t.jsx(ie,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>N(P),children:t.jsx(ir,{className:"w-4 h-4"})})]},P)),t.jsxs(ie,{variant:"outline",size:"sm",onClick:C,className:"border-gray-600 text-gray-400",children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}const qC={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},XC={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},JC={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...XC}},ZC={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0};function e4(){const[n,a]=h.useState(JC),[l,o]=h.useState(ZC),[c,u]=h.useState(qC),[f,p]=h.useState(!1),[x,g]=h.useState(!0),[v,y]=h.useState(!1),[k,R]=h.useState(""),[C,N]=h.useState(""),[w,S]=h.useState(!1),[P,j]=h.useState(!1),_=(T,z,q=!1)=>{R(T),N(z),S(q),y(!0)};h.useEffect(()=>{(async()=>{try{const z=await Ke("/api/admin/settings");if(!z||z.success===!1)return;if(z.featureConfig&&Object.keys(z.featureConfig).length&&o(q=>({...q,...z.featureConfig})),z.mpConfig&&typeof z.mpConfig=="object"&&u(q=>({...q,...z.mpConfig})),z.siteSettings&&typeof z.siteSettings=="object"){const q=z.siteSettings;a(ue=>({...ue,...typeof q.sectionPrice=="number"&&{sectionPrice:q.sectionPrice},...typeof q.baseBookPrice=="number"&&{baseBookPrice:q.baseBookPrice},...typeof q.distributorShare=="number"&&{distributorShare:q.distributorShare},...q.authorInfo&&typeof q.authorInfo=="object"&&{authorInfo:{...ue.authorInfo,...q.authorInfo}}}))}}catch(z){console.error("Load settings error:",z)}finally{g(!1)}})()},[]);const B=async(T,z)=>{j(!0);try{const q=await jt("/api/admin/settings",{featureConfig:T});if(!q||q.success===!1){z(),_("保存失败",(q==null?void 0:q.error)??"未知错误",!0);return}_("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(q){console.error("Save feature config error:",q),z(),_("保存失败",q instanceof Error?q.message:String(q),!0)}finally{j(!1)}},V=(T,z)=>{const q=l,ue={...q,[T]:z};o(ue),B(ue,()=>o(q))},E=async()=>{p(!0);try{const T=await jt("/api/admin/settings",{featureConfig:l,siteSettings:{sectionPrice:n.sectionPrice,baseBookPrice:n.baseBookPrice,distributorShare:n.distributorShare,authorInfo:n.authorInfo},mpConfig:{...c,appId:c.appId||"",withdrawSubscribeTmplId:c.withdrawSubscribeTmplId||"",mchId:c.mchId||"",minWithdraw:typeof c.minWithdraw=="number"?c.minWithdraw:10}});if(!T||T.success===!1){_("保存失败",(T==null?void 0:T.error)??"未知错误",!0);return}_("已保存","设置已保存成功。")}catch(T){console.error("Save settings error:",T),_("保存失败",T instanceof Error?T.message:String(T),!0)}finally{p(!1)}};return x?t.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),t.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),t.jsxs(ie,{onClick:E,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),f?"保存中...":"保存设置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(jm,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),t.jsx(ot,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(jm,{className:"w-3 h-3"}),"主理人名称"]}),t.jsx(se,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:n.authorInfo.name??"",onChange:T=>a(z=>({...z,authorInfo:{...z.authorInfo,name:T.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[t.jsx($a,{className:"w-3 h-3"}),"开播日期"]}),t.jsx(se,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:n.authorInfo.startDate??"",onChange:T=>a(z=>({...z,authorInfo:{...z.authorInfo,startDate:T.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[t.jsx($a,{className:"w-3 h-3"}),"直播时间"]}),t.jsx(se,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:n.authorInfo.liveTime??"",onChange:T=>a(z=>({...z,authorInfo:{...z.authorInfo,liveTime:T.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(vN,{className:"w-3 h-3"}),"直播平台"]}),t.jsx(se,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:n.authorInfo.platform??"",onChange:T=>a(z=>({...z,authorInfo:{...z.authorInfo,platform:T.target.value}}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(Vr,{className:"w-3 h-3"}),"简介描述"]}),t.jsx(se,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:n.authorInfo.description??"",onChange:T=>a(z=>({...z,authorInfo:{...z.authorInfo,description:T.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),t.jsx(Xn,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:n.authorInfo.bio??"",onChange:T=>a(z=>({...z,authorInfo:{...z.authorInfo,bio:T.target.value}}))})]}),t.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[t.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(n.authorInfo.name??"K").charAt(0)}),t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-semibold",children:n.authorInfo.name}),t.jsx("p",{className:"text-gray-400 text-xs",children:n.authorInfo.description}),t.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",n.authorInfo.liveTime," · ",n.authorInfo.platform]})]})]})]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(yi,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),t.jsx(Te,{className:"space-y-4",children:t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"单节价格 (元)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:n.sectionPrice,onChange:T=>a(z=>({...z,sectionPrice:Number.parseFloat(T.target.value)||1}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"整本价格 (元)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:n.baseBookPrice,onChange:T=>a(z=>({...z,baseBookPrice:Number.parseFloat(T.target.value)||9.9}))})]})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(xd,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),t.jsx(ot,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),t.jsx(Te,{className:"space-y-4",children:t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"小程序 AppID"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:c.appId??"",onChange:T=>u(z=>({...z,appId:T.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"提现订阅模板 ID"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:c.withdrawSubscribeTmplId??"",onChange:T=>u(z=>({...z,withdrawSubscribeTmplId:T.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"微信支付商户号"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:c.mchId??"",onChange:T=>u(z=>({...z,mchId:T.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"最低提现金额 (元)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:c.minWithdraw??10,onChange:T=>u(z=>({...z,minWithdraw:Number.parseFloat(T.target.value)||10}))})]})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Ni,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),t.jsx(ot,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(vr,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(J,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),t.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),t.jsx(ht,{id:"match-enabled",checked:l.matchEnabled,disabled:P,onCheckedChange:T=>V("matchEnabled",T)})]}),t.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(qj,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(J,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),t.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),t.jsx(ht,{id:"referral-enabled",checked:l.referralEnabled,disabled:P,onCheckedChange:T=>V("referralEnabled",T)})]}),t.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Vr,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(J,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),t.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),t.jsx(ht,{id:"search-enabled",checked:l.searchEnabled,disabled:P,onCheckedChange:T=>V("searchEnabled",T)})]}),t.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ni,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(J,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),t.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),t.jsx(ht,{id:"about-enabled",checked:l.aboutEnabled,disabled:P,onCheckedChange:T=>V("aboutEnabled",T)})]})]}),t.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:t.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]}),t.jsx(Mt,{open:v,onOpenChange:y,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[t.jsxs(Dt,{children:[t.jsx(Lt,{className:w?"text-red-400":"text-[#38bdac]",children:k}),t.jsx(U1,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:C})]}),t.jsx(Kt,{className:"mt-4",children:t.jsx(ie,{onClick:()=>y(!1),className:w?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const lp={wechat:{enabled:!0,qrCode:"/images/wechat-pay.png",account:"卡若",websiteAppId:"",merchantId:"",groupQrCode:"/images/party-group-qr.png"},alipay:{enabled:!0,qrCode:"/images/alipay.png",account:"卡若",partnerId:"",securityKey:""},usdt:{enabled:!1,network:"TRC20",address:"",exchangeRate:7.2},paypal:{enabled:!1,email:"",exchangeRate:7.2}};function t4(){const[n,a]=h.useState(!1),[l,o]=h.useState(lp),[c,u]=h.useState(""),f=async()=>{a(!0);try{const S=await Ke("/api/config");S!=null&&S.paymentMethods&&o({...lp,...S.paymentMethods})}catch(S){console.error(S)}finally{a(!1)}};h.useEffect(()=>{f()},[]);const p=async()=>{a(!0);try{await jt("/api/db/config",{key:"payment_methods",value:l,description:"支付方式配置"}),alert("配置已保存!")}catch(S){console.error("保存失败:",S),alert("保存失败: "+(S instanceof Error?S.message:String(S)))}finally{a(!1)}},x=(S,P)=>{navigator.clipboard.writeText(S),u(P),setTimeout(()=>u(""),2e3)},g=(S,P)=>{o(j=>({...j,wechat:{...j.wechat,[S]:P}}))},v=(S,P)=>{o(j=>({...j,alipay:{...j.alipay,[S]:P}}))},y=(S,P)=>{o(j=>({...j,usdt:{...j.usdt,[S]:P}}))},k=(S,P)=>{o(j=>({...j,paypal:{...j.paypal,[S]:P}}))},R=l.wechat,C=l.alipay,N=l.usdt,w=l.paypal;return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),t.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(ie,{variant:"outline",onClick:f,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"同步配置"]}),t.jsxs(ie,{onClick:p,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),t.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(bp,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm",children:[t.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),t.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[t.jsx("li",{children:"打开微信,进入目标微信群"}),t.jsx("li",{children:'点击右上角"..." → "群二维码"'}),t.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),t.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),t.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),t.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),t.jsxs(ru,{defaultValue:"wechat",className:"space-y-6",children:[t.jsxs(Vi,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[t.jsxs(ar,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[t.jsx(xd,{className:"w-4 h-4 mr-2"}),"微信"]}),t.jsxs(ar,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[t.jsx(hd,{className:"w-4 h-4 mr-2"}),"支付宝"]}),t.jsxs(ar,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[t.jsx(vm,{className:"w-4 h-4 mr-2"}),"USDT"]}),t.jsxs(ar,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[t.jsx(md,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),t.jsx(lr,{value:"wechat",className:"space-y-4",children:t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs(Ve,{className:"text-[#07C160] flex items-center gap-2",children:[t.jsx(xd,{className:"w-5 h-5"}),"微信支付配置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),t.jsx(ht,{checked:!!R.enabled,onCheckedChange:S=>g("enabled",S)})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"网站AppID"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(R.websiteAppId??""),onChange:S=>g("websiteAppId",S.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"商户号"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(R.merchantId??""),onChange:S=>g("merchantId",S.target.value)})]})]}),t.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[t.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[t.jsx(ji,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"微信收款码/支付链接"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(R.qrCode??""),onChange:S=>g("qrCode",S.target.value)}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),t.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[t.jsx(J,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),t.jsx(se,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(R.groupQrCode??""),onChange:S=>g("groupQrCode",S.target.value)}),t.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),t.jsx(lr,{value:"alipay",className:"space-y-4",children:t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs(Ve,{className:"text-[#1677FF] flex items-center gap-2",children:[t.jsx(hd,{className:"w-5 h-5"}),"支付宝配置"]}),t.jsx(ot,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),t.jsx(ht,{checked:!!C.enabled,onCheckedChange:S=>v("enabled",S)})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"合作者身份 (PID)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(C.partnerId??""),onChange:S=>v("partnerId",S.target.value)}),t.jsx(ie,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>x(String(C.partnerId??""),"pid"),children:c==="pid"?t.jsx(Mi,{className:"w-4 h-4 text-green-500"}):t.jsx(Sp,{className:"w-4 h-4 text-gray-400"})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"安全校验码 (Key)"}),t.jsx(se,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(C.securityKey??""),onChange:S=>v("securityKey",S.target.value)})]})]}),t.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[t.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[t.jsx(ji,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(C.qrCode??""),onChange:S=>v("qrCode",S.target.value)}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),t.jsx(lr,{value:"usdt",className:"space-y-4",children:t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs(Ve,{className:"text-[#26A17B] flex items-center gap-2",children:[t.jsx(vm,{className:"w-5 h-5"}),"USDT配置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),t.jsx(ht,{checked:!!N.enabled,onCheckedChange:S=>y("enabled",S)})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"网络类型"}),t.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(N.network??"TRC20"),onChange:S=>y("network",S.target.value),children:[t.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),t.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),t.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"收款地址"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(N.address??""),onChange:S=>y("address",S.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(N.exchangeRate)??7.2,onChange:S=>y("exchangeRate",Number.parseFloat(S.target.value)||7.2)})]})]})]})}),t.jsx(lr,{value:"paypal",className:"space-y-4",children:t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{className:"flex flex-row items-center justify-between pb-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsxs(Ve,{className:"text-[#169BD7] flex items-center gap-2",children:[t.jsx(md,{className:"w-5 h-5"}),"PayPal配置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),t.jsx(ht,{checked:!!w.enabled,onCheckedChange:S=>k("enabled",S)})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"PayPal邮箱"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(w.email??""),onChange:S=>k("email",S.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(w.exchangeRate)??7.2,onChange:S=>k("exchangeRate",Number(S.target.value)||7.2)})]})]})]})})]})]})}const r4={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},n4={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},s4={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function a4(){const[n,a]=h.useState({siteConfig:{...r4},menuConfig:{...n4},pageConfig:{...s4}}),[l,o]=h.useState(!1),[c,u]=h.useState(!1);h.useEffect(()=>{Ke("/api/config").then(v=>{v!=null&&v.siteConfig&&a(y=>({...y,siteConfig:{...y.siteConfig,...v.siteConfig}})),v!=null&&v.menuConfig&&a(y=>({...y,menuConfig:{...y.menuConfig,...v.menuConfig}})),v!=null&&v.pageConfig&&a(y=>({...y,pageConfig:{...y.pageConfig,...v.pageConfig}}))}).catch(console.error)},[]);const f=async()=>{u(!0);try{await jt("/api/db/config",{key:"site_config",value:n.siteConfig,description:"网站基础配置"}),await jt("/api/db/config",{key:"menu_config",value:n.menuConfig,description:"底部菜单配置"}),await jt("/api/db/config",{key:"page_config",value:n.pageConfig,description:"页面标题配置"}),o(!0),setTimeout(()=>o(!1),2e3),alert("配置已保存")}catch(v){console.error(v),alert("保存失败: "+(v instanceof Error?v.message:String(v)))}finally{u(!1)}},p=n.siteConfig,x=n.menuConfig,g=n.pageConfig;return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),t.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),t.jsxs(ie,{onClick:f,disabled:c,className:`${l?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),c?"保存中...":l?"已保存":"保存设置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(md,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),t.jsx(ot,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),t.jsx(se,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:p.siteName??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,siteName:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),t.jsx(se,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:p.siteTitle??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,siteTitle:v.target.value}}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),t.jsx(se,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:p.siteDescription??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,siteDescription:v.target.value}}))})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),t.jsx(se,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:p.logo??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,logo:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),t.jsx(se,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:p.favicon??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,favicon:v.target.value}}))})]})]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(SN,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),t.jsx(ot,{className:"text-gray-400",children:"配置网站主题色"})]}),t.jsx(Te,{children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"space-y-2 flex-1",children:[t.jsx(J,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(se,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:p.primaryColor??"#00CED1",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,primaryColor:v.target.value}}))}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:p.primaryColor??"#00CED1",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,primaryColor:v.target.value}}))})]})]}),t.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:p.primaryColor??"#00CED1"},children:"预览"})]})})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(jN,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),t.jsx(ot,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),t.jsx(Te,{className:"space-y-4",children:Object.entries(x).map(([v,y])=>t.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[t.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[t.jsx(ht,{checked:(y==null?void 0:y.enabled)??!0,onCheckedChange:k=>a(R=>({...R,menuConfig:{...R.menuConfig,[v]:{...y,enabled:k}}}))}),t.jsx("span",{className:"text-gray-300 w-16 capitalize",children:v}),t.jsx(se,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(y==null?void 0:y.label)??"",onChange:k=>a(R=>({...R,menuConfig:{...R.menuConfig,[v]:{...y,label:k.target.value}}}))})]}),t.jsx("span",{className:`text-sm ${y!=null&&y.enabled?"text-green-400":"text-gray-500"}`,children:y!=null&&y.enabled?"显示":"隐藏"})]},v))})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Kj,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"首页标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.homeTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,homeTitle:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"首页副标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.homeSubtitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,homeSubtitle:v.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"目录页标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.chaptersTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,chaptersTitle:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"匹配页标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.matchTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,matchTitle:v.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"我的页标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.myTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,myTitle:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"关于作者标题"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.aboutTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,aboutTitle:v.target.value}}))})]})]})]})]})]})]})}function l4(){const[n,a]=h.useState(""),[l,o]=h.useState(""),[c,u]=h.useState(""),[f,p]=h.useState({}),x=async()=>{var R,C,N,w;try{const S=await Ke("/api/config"),P=(C=(R=S==null?void 0:S.liveQRCodes)==null?void 0:R[0])==null?void 0:C.urls;Array.isArray(P)&&a(P.join(` -`));const j=(w=(N=S==null?void 0:S.paymentMethods)==null?void 0:N.wechat)==null?void 0:w.groupQrCode;j&&o(j),p({paymentMethods:S==null?void 0:S.paymentMethods,liveQRCodes:S==null?void 0:S.liveQRCodes})}catch(S){console.error(S)}};h.useEffect(()=>{x()},[]);const g=(R,C)=>{navigator.clipboard.writeText(R),u(C),setTimeout(()=>u(""),2e3)},v=async()=>{try{const R=n.split(` -`).map(N=>N.trim()).filter(Boolean),C=[...f.liveQRCodes||[]];C[0]?C[0].urls=R:C.push({id:"live-1",name:"微信群活码",urls:R,clickCount:0}),await jt("/api/db/config",{key:"live_qr_codes",value:C,description:"群活码配置"}),alert("群活码配置已保存!"),await x()}catch(R){console.error(R),alert("保存失败: "+(R instanceof Error?R.message:String(R)))}},y=async()=>{var R;try{await jt("/api/db/config",{key:"payment_methods",value:{...f.paymentMethods||{},wechat:{...((R=f.paymentMethods)==null?void 0:R.wechat)||{},groupQrCode:l}},description:"支付方式配置"}),alert("微信群链接已保存!用户支付成功后将自动跳转"),await x()}catch(C){console.error(C),alert("保存失败: "+(C instanceof Error?C.message:String(C)))}},k=()=>{l?window.open(l,"_blank"):alert("请先配置微信群链接")};return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),t.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),t.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(bp,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm",children:[t.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),t.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[t.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),t.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[t.jsx("li",{children:"访问草料二维码创建活码"}),t.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),t.jsx("li",{children:"复制生成的短链接填入下方配置"}),t.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),t.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),t.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[t.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),t.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),t.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),t.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-[#07C160] flex items-center gap-2",children:[t.jsx(Sm,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),t.jsx(ot,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(wm,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(se,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:l,onChange:R=>o(R.target.value)}),t.jsx(ie,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>g(l,"group"),children:c==="group"?t.jsx(Mi,{className:"w-4 h-4 text-green-500"}):t.jsx(Sp,{className:"w-4 h-4 text-gray-400"})})]}),t.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[t.jsx(ji,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(ie,{onClick:y,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[t.jsx(bi,{className:"w-4 h-4 mr-2"}),"保存配置"]}),t.jsxs(ie,{onClick:k,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[t.jsx(ji,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Sm,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),t.jsx(ot,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),t.jsxs(Te,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(J,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(wm,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),t.jsx(Xn,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:n,onChange:R=>a(R.target.value)}),t.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),t.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[t.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),t.jsxs("span",{className:"font-bold text-[#38bdac]",children:[n.split(` -`).filter(Boolean).length," 个"]})]}),t.jsxs(ie,{onClick:v,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(bi,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),t.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[t.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),t.jsxs("div",{className:"space-y-3 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),t.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),t.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const ip={matchTypes:[{id:"partner",label:"创业合伙",matchLabel:"创业伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10}},i4=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function o4(){const[n,a]=h.useState(ip),[l,o]=h.useState(!0),[c,u]=h.useState(!1),[f,p]=h.useState(!1),[x,g]=h.useState(null),[v,y]=h.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),k=async()=>{o(!0);try{const j=await Ke("/api/db/config/full?key=match_config"),_=(j==null?void 0:j.data)??(j==null?void 0:j.config);_&&a({...ip,..._})}catch(j){console.error("加载匹配配置失败:",j)}finally{o(!1)}};h.useEffect(()=>{k()},[]);const R=async()=>{u(!0);try{const j=await jt("/api/db/config",{key:"match_config",value:n,description:"匹配功能配置"});j&&j.success!==!1?alert("配置保存成功!"):alert("保存失败: "+(j&&typeof j=="object"&&"error"in j?j.error:"未知错误"))}catch(j){console.error("保存配置失败:",j),alert("保存失败")}finally{u(!1)}},C=j=>{g(j),y({id:j.id,label:j.label,matchLabel:j.matchLabel,icon:j.icon,matchFromDB:j.matchFromDB,showJoinAfterMatch:j.showJoinAfterMatch,price:j.price,enabled:j.enabled}),p(!0)},N=()=>{g(null),y({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),p(!0)},w=()=>{if(!v.id||!v.label){alert("请填写类型ID和名称");return}const j=[...n.matchTypes];if(x){const _=j.findIndex(B=>B.id===x.id);_!==-1&&(j[_]={...v})}else{if(j.some(_=>_.id===v.id)){alert("类型ID已存在");return}j.push({...v})}a({...n,matchTypes:j}),p(!1)},S=j=>{confirm("确定要删除这个匹配类型吗?")&&a({...n,matchTypes:n.matchTypes.filter(_=>_.id!==j)})},P=j=>{a({...n,matchTypes:n.matchTypes.map(_=>_.id===j?{..._,enabled:!_.enabled}:_)})};return t.jsxs("div",{className:"p-8 w-full space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[t.jsx(Ni,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(ie,{variant:"outline",onClick:k,disabled:l,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]}),t.jsxs(ie,{onClick:R,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsxs(Ue,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(ZN,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),t.jsx(ot,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),t.jsxs(Te,{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"每日免费匹配次数"}),t.jsx(se,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.freeMatchLimit,onChange:j=>a({...n,freeMatchLimit:parseInt(j.target.value,10)||0})}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"付费匹配价格(元)"}),t.jsx(se,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:n.matchPrice,onChange:j=>a({...n,matchPrice:parseFloat(j.target.value)||1})}),t.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"每日最大匹配次数"}),t.jsx(se,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.settings.maxMatchesPerDay,onChange:j=>a({...n,settings:{...n.settings,maxMatchesPerDay:parseInt(j.target.value,10)||10}})}),t.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),t.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ht,{checked:n.settings.enableFreeMatches,onCheckedChange:j=>a({...n,settings:{...n.settings,enableFreeMatches:j}})}),t.jsx(J,{className:"text-gray-300",children:"启用免费匹配"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ht,{checked:n.settings.enablePaidMatches,onCheckedChange:j=>a({...n,settings:{...n.settings,enablePaidMatches:j}})}),t.jsx(J,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsxs(Ue,{className:"flex flex-row items-center justify-between",children:[t.jsxs("div",{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(vr,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),t.jsx(ot,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),t.jsxs(ie,{onClick:N,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(gr,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),t.jsx(Te,{children:t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx(_e,{className:"text-gray-400",children:"图标"}),t.jsx(_e,{className:"text-gray-400",children:"类型ID"}),t.jsx(_e,{className:"text-gray-400",children:"显示名称"}),t.jsx(_e,{className:"text-gray-400",children:"匹配标签"}),t.jsx(_e,{className:"text-gray-400",children:"价格"}),t.jsx(_e,{className:"text-gray-400",children:"数据库匹配"}),t.jsx(_e,{className:"text-gray-400",children:"状态"}),t.jsx(_e,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsx(Qr,{children:n.matchTypes.map(j=>t.jsxs(st,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(ke,{children:t.jsx("span",{className:"text-2xl",children:j.icon})}),t.jsx(ke,{className:"font-mono text-gray-300",children:j.id}),t.jsx(ke,{className:"text-white font-medium",children:j.label}),t.jsx(ke,{className:"text-gray-300",children:j.matchLabel}),t.jsx(ke,{children:t.jsxs(Le,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",j.price]})}),t.jsx(ke,{children:j.matchFromDB?t.jsx(Le,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):t.jsx(Le,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),t.jsx(ke,{children:t.jsx(ht,{checked:j.enabled,onCheckedChange:()=>P(j.id)})}),t.jsx(ke,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>C(j),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:t.jsx(Ht,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>S(j.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:t.jsx(Er,{className:"w-4 h-4"})})]})})]},j.id))})]})})]}),t.jsx(Mt,{open:f,onOpenChange:p,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[t.jsx(Dt,{children:t.jsxs(Lt,{className:"text-white flex items-center gap-2",children:[x?t.jsx(Ht,{className:"w-5 h-5 text-[#38bdac]"}):t.jsx(gr,{className:"w-5 h-5 text-[#38bdac]"}),x?"编辑匹配类型":"添加匹配类型"]})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"类型ID(英文)"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:v.id,onChange:j=>y({...v,id:j.target.value}),disabled:!!x})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"图标"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:i4.map(j=>t.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${v.icon===j?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>y({...v,icon:j}),children:j},j))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"显示名称"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:v.label,onChange:j=>y({...v,label:j.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"匹配标签"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:v.matchLabel,onChange:j=>y({...v,matchLabel:j.target.value})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"单次匹配价格(元)"}),t.jsx(se,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:v.price,onChange:j=>y({...v,price:parseFloat(j.target.value)||1})})]}),t.jsxs("div",{className:"flex gap-6 pt-2",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ht,{checked:v.matchFromDB,onCheckedChange:j=>y({...v,matchFromDB:j})}),t.jsx(J,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ht,{checked:v.showJoinAfterMatch,onCheckedChange:j=>y({...v,showJoinAfterMatch:j})}),t.jsx(J,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ht,{checked:v.enabled,onCheckedChange:j=>y({...v,enabled:j})}),t.jsx(J,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),t.jsxs(Kt,{children:[t.jsx(ie,{variant:"outline",onClick:()=>p(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsxs(ie,{onClick:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const op={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function c4(){const[n,a]=h.useState([]),[l,o]=h.useState(0),[c,u]=h.useState(1),[f,p]=h.useState(10),[x,g]=h.useState(""),[v,y]=h.useState(!0),[k,R]=h.useState(null);async function C(){y(!0),R(null);try{const w=new URLSearchParams({page:String(c),pageSize:String(f)});x&&w.set("matchType",x);const S=await Ke(`/api/db/match-records?${w}`);S!=null&&S.success?(a(S.records||[]),o(S.total??0)):R("加载匹配记录失败")}catch(w){console.error("加载匹配记录失败",w),R("加载失败,请检查网络后重试")}finally{y(!1)}}h.useEffect(()=>{C()},[c,x]);const N=Math.ceil(l/f)||1;return t.jsxs("div",{className:"p-8 w-full",children:[k&&t.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[t.jsx("span",{children:k}),t.jsx("button",{type:"button",onClick:()=>R(null),className:"hover:text-red-300",children:"×"})]}),t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),t.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",l," 条记录"]})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("select",{value:x,onChange:w=>{g(w.target.value),u(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[t.jsx("option",{value:"",children:"全部类型"}),Object.entries(op).map(([w,S])=>t.jsx("option",{value:w,children:S},w))]}),t.jsxs("button",{type:"button",onClick:C,disabled:v,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[t.jsx(Ze,{className:`w-4 h-4 ${v?"animate-spin":""}`}),"刷新"]})]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(Te,{className:"p-0",children:v?t.jsxs("div",{className:"flex justify-center py-12",children:[t.jsx(Ze,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsxs(t.Fragment,{children:[t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx(_e,{className:"text-gray-400",children:"发起人"}),t.jsx(_e,{className:"text-gray-400",children:"匹配到"}),t.jsx(_e,{className:"text-gray-400",children:"类型"}),t.jsx(_e,{className:"text-gray-400",children:"联系方式"}),t.jsx(_e,{className:"text-gray-400",children:"匹配时间"})]})}),t.jsxs(Qr,{children:[n.map(w=>t.jsxs(st,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(ke,{children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[w.userAvatar?t.jsx("img",{src:w.userAvatar,alt:"",className:"w-full h-full object-cover",onError:S=>{S.currentTarget.style.display="none";const P=S.currentTarget.nextElementSibling;P&&P.classList.remove("hidden")}}):null,t.jsx("span",{className:w.userAvatar?"hidden":"",children:(w.userNickname||w.userId||"?").charAt(0)})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white",children:w.userNickname||w.userId}),t.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.userId.slice(0,16),"..."]})]})]})}),t.jsx(ke,{children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[w.matchedUserAvatar?t.jsx("img",{src:w.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:S=>{S.currentTarget.style.display="none";const P=S.currentTarget.nextElementSibling;P&&P.classList.remove("hidden")}}):null,t.jsx("span",{className:w.matchedUserAvatar?"hidden":"",children:(w.matchedNickname||w.matchedUserId||"?").charAt(0)})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white",children:w.matchedNickname||w.matchedUserId}),t.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.matchedUserId.slice(0,16),"..."]})]})]})}),t.jsx(ke,{children:t.jsx(Le,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:op[w.matchType]||w.matchType})}),t.jsxs(ke,{className:"text-gray-400 text-sm",children:[w.phone&&t.jsxs("div",{children:["📱 ",w.phone]}),w.wechatId&&t.jsxs("div",{children:["💬 ",w.wechatId]}),!w.phone&&!w.wechatId&&"-"]}),t.jsx(ke,{className:"text-gray-400",children:w.createdAt?new Date(w.createdAt).toLocaleString():"-"})]},w.id)),n.length===0&&t.jsx(st,{children:t.jsx(ke,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),t.jsx(Sn,{page:c,totalPages:N,total:l,pageSize:f,onPageChange:u,onPageSizeChange:w=>{p(w),u(1)}})]})})})]})}function d4(){const[n,a]=h.useState([]),[l,o]=h.useState(!0),[c,u]=h.useState(!1),[f,p]=h.useState(null),[x,g]=h.useState(""),[v,y]=h.useState(0),[k,R]=h.useState(!1);async function C(){o(!0);try{const j=await Ke("/api/db/vip-roles");j!=null&&j.success&&j.data&&a(j.data)}catch(j){console.error("Load roles error:",j)}finally{o(!1)}}h.useEffect(()=>{C()},[]);const N=()=>{p(null),g(""),y(n.length>0?Math.max(...n.map(j=>j.sort))+1:0),u(!0)},w=j=>{p(j),g(j.name),y(j.sort),u(!0)},S=async()=>{if(!x.trim()){alert("角色名称不能为空");return}R(!0);try{if(f){const j=await St("/api/db/vip-roles",{id:f.id,name:x.trim(),sort:v});j!=null&&j.success?(u(!1),C()):alert("更新失败: "+(j==null?void 0:j.error))}else{const j=await jt("/api/db/vip-roles",{name:x.trim(),sort:v});j!=null&&j.success?(u(!1),C()):alert("新增失败: "+(j==null?void 0:j.error))}}catch(j){console.error("Save error:",j),alert("保存失败")}finally{R(!1)}},P=async j=>{if(confirm("确定删除该角色?已设置该角色的 VIP 用户将保留角色名称。"))try{const _=await zs(`/api/db/vip-roles?id=${j}`);_!=null&&_.success?C():alert("删除失败: "+(_==null?void 0:_.error))}catch(_){console.error("Delete error:",_),alert("删除失败")}};return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[t.jsx(Li,{className:"w-5 h-5 text-amber-400"}),"VIP 角色管理"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"超级个体固定角色,在「设置 VIP」时可选择或手动填写"})]}),t.jsxs(ie,{onClick:N,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"新增角色"]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx(_e,{className:"text-gray-400",children:"ID"}),t.jsx(_e,{className:"text-gray-400",children:"角色名称"}),t.jsx(_e,{className:"text-gray-400",children:"排序"}),t.jsx(_e,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(Qr,{children:[n.map(j=>t.jsxs(st,{className:"border-gray-700/50",children:[t.jsx(ke,{className:"text-gray-300",children:j.id}),t.jsx(ke,{className:"text-white",children:j.name}),t.jsx(ke,{className:"text-gray-400",children:j.sort}),t.jsxs(ke,{className:"text-right",children:[t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>w(j),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(Ht,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>P(j.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Er,{className:"w-4 h-4"})})]})]},j.id)),n.length===0&&t.jsx(st,{children:t.jsx(ke,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无角色,点击「新增角色」添加"})})]})]})})}),t.jsx(Mt,{open:c,onOpenChange:u,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[t.jsx(Dt,{children:t.jsx(Lt,{className:"text-white",children:f?"编辑角色":"新增角色"})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"角色名称"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创始人、投资人",value:x,onChange:j=>g(j.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"排序(下拉展示顺序,越小越前)"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:v,onChange:j=>y(parseInt(j.target.value,10)||0)})]})]}),t.jsxs(Kt,{children:[t.jsxs(ie,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(ie,{onClick:S,disabled:k,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),k?"保存中...":"保存"]})]})]})})]})}function u4(){const[n,a]=h.useState([]),[l,o]=h.useState(!0),[c,u]=h.useState(!1),[f,p]=h.useState(null),[x,g]=h.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[v,y]=h.useState(!1),[k,R]=h.useState(!1),C=h.useRef(null),N=async E=>{var z;const T=(z=E.target.files)==null?void 0:z[0];if(T){R(!0);try{const q=new FormData;q.append("file",T),q.append("folder","mentors");const ue=Bd(),ee={};ue&&(ee.Authorization=`Bearer ${ue}`);const G=await(await fetch(Fs("/api/upload"),{method:"POST",body:q,credentials:"include",headers:ee})).json();G!=null&&G.success&&(G!=null&&G.url)?g(Z=>({...Z,avatar:G.url})):alert("上传失败: "+((G==null?void 0:G.error)||"未知错误"))}catch(q){console.error(q),alert("上传失败")}finally{R(!1),C.current&&(C.current.value="")}}};async function w(){o(!0);try{const E=await Ke("/api/db/mentors");E!=null&&E.success&&E.data&&a(E.data)}catch(E){console.error("Load mentors error:",E)}finally{o(!1)}}h.useEffect(()=>{w()},[]);const S=()=>{g({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:n.length>0?Math.max(...n.map(E=>E.sort))+1:0,enabled:!0})},P=()=>{p(null),S(),u(!0)},j=E=>{p(E),g({name:E.name,avatar:E.avatar||"",intro:E.intro||"",tags:E.tags||"",priceSingle:E.priceSingle!=null?String(E.priceSingle):"",priceHalfYear:E.priceHalfYear!=null?String(E.priceHalfYear):"",priceYear:E.priceYear!=null?String(E.priceYear):"",quote:E.quote||"",whyFind:E.whyFind||"",offering:E.offering||"",judgmentStyle:E.judgmentStyle||"",sort:E.sort,enabled:E.enabled??!0}),u(!0)},_=async()=>{if(!x.name.trim()){alert("导师姓名不能为空");return}y(!0);try{const E=z=>z===""?void 0:parseFloat(z),T={name:x.name.trim(),avatar:x.avatar.trim()||void 0,intro:x.intro.trim()||void 0,tags:x.tags.trim()||void 0,priceSingle:E(x.priceSingle),priceHalfYear:E(x.priceHalfYear),priceYear:E(x.priceYear),quote:x.quote.trim()||void 0,whyFind:x.whyFind.trim()||void 0,offering:x.offering.trim()||void 0,judgmentStyle:x.judgmentStyle.trim()||void 0,sort:x.sort,enabled:x.enabled};if(f){const z=await St("/api/db/mentors",{id:f.id,...T});z!=null&&z.success?(u(!1),w()):alert("更新失败: "+(z==null?void 0:z.error))}else{const z=await jt("/api/db/mentors",T);z!=null&&z.success?(u(!1),w()):alert("新增失败: "+(z==null?void 0:z.error))}}catch(E){console.error("Save error:",E),alert("保存失败")}finally{y(!1)}},B=async E=>{if(confirm("确定删除该导师?"))try{const T=await zs(`/api/db/mentors?id=${E}`);T!=null&&T.success?w():alert("删除失败: "+(T==null?void 0:T.error))}catch(T){console.error("Delete error:",T),alert("删除失败")}},V=E=>E!=null?`¥${E}`:"-";return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[t.jsx(vr,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),t.jsxs(ie,{onClick:P,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx(_e,{className:"text-gray-400",children:"ID"}),t.jsx(_e,{className:"text-gray-400",children:"姓名"}),t.jsx(_e,{className:"text-gray-400",children:"简介"}),t.jsx(_e,{className:"text-gray-400",children:"单次"}),t.jsx(_e,{className:"text-gray-400",children:"半年"}),t.jsx(_e,{className:"text-gray-400",children:"年度"}),t.jsx(_e,{className:"text-gray-400",children:"排序"}),t.jsx(_e,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(Qr,{children:[n.map(E=>t.jsxs(st,{className:"border-gray-700/50",children:[t.jsx(ke,{className:"text-gray-300",children:E.id}),t.jsx(ke,{className:"text-white",children:E.name}),t.jsx(ke,{className:"text-gray-400 max-w-[200px] truncate",children:E.intro||"-"}),t.jsx(ke,{className:"text-gray-400",children:V(E.priceSingle)}),t.jsx(ke,{className:"text-gray-400",children:V(E.priceHalfYear)}),t.jsx(ke,{className:"text-gray-400",children:V(E.priceYear)}),t.jsx(ke,{className:"text-gray-400",children:E.sort}),t.jsxs(ke,{className:"text-right",children:[t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>j(E),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(Ht,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>B(E.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Er,{className:"w-4 h-4"})})]})]},E.id)),n.length===0&&t.jsx(st,{children:t.jsx(ke,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),t.jsx(Mt,{open:c,onOpenChange:u,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[t.jsx(Dt,{children:t.jsx(Lt,{className:"text-white",children:f?"编辑导师":"新增导师"})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"姓名 *"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:x.name,onChange:E=>g(T=>({...T,name:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"排序"}),t.jsx(se,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:x.sort,onChange:E=>g(T=>({...T,sort:parseInt(E.target.value,10)||0}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"头像"}),t.jsxs("div",{className:"flex gap-3 items-center",children:[t.jsx(se,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:x.avatar,onChange:E=>g(T=>({...T,avatar:E.target.value})),placeholder:"点击上传或粘贴图片地址"}),t.jsx("input",{ref:C,type:"file",accept:"image/*",className:"hidden",onChange:N}),t.jsxs(ie,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:k,onClick:()=>{var E;return(E=C.current)==null?void 0:E.click()},children:[t.jsx(bi,{className:"w-4 h-4 mr-2"}),k?"上传中...":"上传"]})]}),x.avatar&&t.jsx("div",{className:"mt-2",children:t.jsx("img",{src:x.avatar.startsWith("http")?x.avatar:Fs(x.avatar),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"简介"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:x.intro,onChange:E=>g(T=>({...T,intro:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:x.tags,onChange:E=>g(T=>({...T,tags:E.target.value}))})]}),t.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[t.jsx(J,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),t.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),t.jsx(se,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:x.priceSingle,onChange:E=>g(T=>({...T,priceSingle:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),t.jsx(se,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:x.priceHalfYear,onChange:E=>g(T=>({...T,priceHalfYear:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),t.jsx(se,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:x.priceYear,onChange:E=>g(T=>({...T,priceYear:E.target.value}))})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"引言"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:x.quote,onChange:E=>g(T=>({...T,quote:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"为什么找(文本)"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:x.whyFind,onChange:E=>g(T=>({...T,whyFind:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"提供什么(文本)"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:x.offering,onChange:E=>g(T=>({...T,offering:E.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:x.judgmentStyle,onChange:E=>g(T=>({...T,judgmentStyle:E.target.value}))})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:"enabled",checked:x.enabled,onChange:E=>g(T=>({...T,enabled:E.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),t.jsx(J,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),t.jsxs(Kt,{children:[t.jsxs(ie,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(ie,{onClick:_,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存"]})]})]})})]})}function f4(){const[n,a]=h.useState([]),[l,o]=h.useState(!0),[c,u]=h.useState("");async function f(){o(!0);try{const g=c?`/api/db/mentor-consultations?status=${c}`:"/api/db/mentor-consultations",v=await Ke(g);v!=null&&v.success&&v.data&&a(v.data)}catch(g){console.error("Load consultations error:",g)}finally{o(!1)}}h.useEffect(()=>{f()},[c]);const p={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},x={single:"单次",half_year:"半年",year:"年度"};return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-8",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[t.jsx($a,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("select",{value:c,onChange:g=>u(g.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[t.jsx("option",{value:"",children:"全部状态"}),Object.entries(p).map(([g,v])=>t.jsx("option",{value:g,children:v},g))]}),t.jsxs(ie,{onClick:f,disabled:l,variant:"outline",className:"border-gray-600 text-gray-300",children:[t.jsx(Ze,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]})]})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx(_e,{className:"text-gray-400",children:"ID"}),t.jsx(_e,{className:"text-gray-400",children:"用户ID"}),t.jsx(_e,{className:"text-gray-400",children:"导师ID"}),t.jsx(_e,{className:"text-gray-400",children:"类型"}),t.jsx(_e,{className:"text-gray-400",children:"金额"}),t.jsx(_e,{className:"text-gray-400",children:"状态"}),t.jsx(_e,{className:"text-gray-400",children:"创建时间"})]})}),t.jsxs(Qr,{children:[n.map(g=>t.jsxs(st,{className:"border-gray-700/50",children:[t.jsx(ke,{className:"text-gray-300",children:g.id}),t.jsx(ke,{className:"text-gray-400",children:g.userId}),t.jsx(ke,{className:"text-gray-400",children:g.mentorId}),t.jsx(ke,{className:"text-gray-400",children:x[g.consultationType]||g.consultationType}),t.jsxs(ke,{className:"text-white",children:["¥",g.amount]}),t.jsx(ke,{className:"text-gray-400",children:p[g.status]||g.status}),t.jsx(ke,{className:"text-gray-500 text-sm",children:g.createdAt})]},g.id)),n.length===0&&t.jsx(st,{children:t.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function h4(){const[n,a]=h.useState([]),[l,o]=h.useState(0),[c,u]=h.useState(1),[f]=h.useState(10),[p,x]=h.useState(0),[g,v]=h.useState(""),y=Xd(g,300),[k,R]=h.useState(!0),[C,N]=h.useState(null),[w,S]=h.useState(!1),[P,j]=h.useState(null),[_,B]=h.useState(""),[V,E]=h.useState(""),[T,z]=h.useState(""),[q,ue]=h.useState("admin"),[ee,ce]=h.useState("active"),[G,Z]=h.useState(!1);async function te(){var L;R(!0),N(null);try{const X=new URLSearchParams({page:String(c),pageSize:String(f)});y.trim()&&X.set("search",y.trim());const ae=await Ke(`/api/admin/users?${X}`);ae!=null&&ae.success?(a(ae.records||[]),o(ae.total??0),x(ae.totalPages??0)):N(ae.error||"加载失败")}catch(X){const ae=X;N(ae.status===403?"无权限访问":((L=ae==null?void 0:ae.data)==null?void 0:L.error)||"加载失败"),a([])}finally{R(!1)}}h.useEffect(()=>{te()},[c,f,y]);const U=()=>{j(null),B(""),E(""),z(""),ue("admin"),ce("active"),S(!0)},M=L=>{j(L),B(L.username),E(""),z(L.name||""),ue(L.role==="super_admin"?"super_admin":"admin"),ce(L.status==="disabled"?"disabled":"active"),S(!0)},Q=async()=>{var L;if(!_.trim()){N("用户名不能为空");return}if(!P&&!V){N("新建时密码必填,至少 6 位");return}if(V&&V.length<6){N("密码至少 6 位");return}N(null),Z(!0);try{if(P){const X=await St("/api/admin/users",{id:P.id,password:V||void 0,name:T.trim(),role:q,status:ee});X!=null&&X.success?(S(!1),te()):N((X==null?void 0:X.error)||"保存失败")}else{const X=await jt("/api/admin/users",{username:_.trim(),password:V,name:T.trim(),role:q});X!=null&&X.success?(S(!1),te()):N((X==null?void 0:X.error)||"保存失败")}}catch(X){const ae=X;N(((L=ae==null?void 0:ae.data)==null?void 0:L.error)||"保存失败")}finally{Z(!1)}},H=async L=>{var X;if(confirm("确定删除该管理员?"))try{const ae=await zs(`/api/admin/users?id=${L}`);ae!=null&&ae.success?te():N((ae==null?void 0:ae.error)||"删除失败")}catch(ae){const ve=ae;N(((X=ve==null?void 0:ve.data)==null?void 0:X.error)||"删除失败")}},I=L=>{if(!L)return"-";try{const X=new Date(L);return isNaN(X.getTime())?L:X.toLocaleString("zh-CN")}catch{return L}};return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex justify-between items-center mb-6",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[t.jsx(zd,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(se,{placeholder:"搜索用户名/昵称",value:g,onChange:L=>v(L.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),t.jsx(ie,{variant:"outline",size:"sm",onClick:te,disabled:k,className:"border-gray-600 text-gray-300",children:t.jsx(Ze,{className:`w-4 h-4 ${k?"animate-spin":""}`})}),t.jsxs(ie,{onClick:U,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(gr,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),C&&t.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[t.jsx("span",{children:C}),t.jsx("button",{type:"button",onClick:()=>N(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),t.jsx(Re,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(Te,{className:"p-0",children:k?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(t.Fragment,{children:[t.jsxs(Gr,{children:[t.jsx(Yr,{children:t.jsxs(st,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx(_e,{className:"text-gray-400",children:"ID"}),t.jsx(_e,{className:"text-gray-400",children:"用户名"}),t.jsx(_e,{className:"text-gray-400",children:"昵称"}),t.jsx(_e,{className:"text-gray-400",children:"角色"}),t.jsx(_e,{className:"text-gray-400",children:"状态"}),t.jsx(_e,{className:"text-gray-400",children:"创建时间"}),t.jsx(_e,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(Qr,{children:[n.map(L=>t.jsxs(st,{className:"border-gray-700/50",children:[t.jsx(ke,{className:"text-gray-300",children:L.id}),t.jsx(ke,{className:"text-white font-medium",children:L.username}),t.jsx(ke,{className:"text-gray-400",children:L.name||"-"}),t.jsx(ke,{children:t.jsx(Le,{variant:"outline",className:L.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:L.role==="super_admin"?"超级管理员":"管理员"})}),t.jsx(ke,{children:t.jsx(Le,{variant:"outline",className:L.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:L.status==="active"?"正常":"已禁用"})}),t.jsx(ke,{className:"text-gray-500 text-sm",children:I(L.createdAt)}),t.jsxs(ke,{className:"text-right",children:[t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>M(L),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(Ht,{className:"w-4 h-4"})}),t.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>H(L.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Er,{className:"w-4 h-4"})})]})]},L.id)),n.length===0&&!k&&t.jsx(st,{children:t.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:C==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),p>1&&t.jsx("div",{className:"p-4 border-t border-gray-700/50",children:t.jsx(Sn,{page:c,pageSize:f,total:l,totalPages:p,onPageChange:u})})]})})}),t.jsx(Mt,{open:w,onOpenChange:S,children:t.jsxs(Tt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[t.jsx(Dt,{children:t.jsx(Lt,{className:"text-white",children:P?"编辑管理员":"新增管理员"})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"用户名"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:_,onChange:L=>B(L.target.value),disabled:!!P}),P&&t.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:P?"新密码(留空不改)":"密码"}),t.jsx(se,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:P?"留空表示不修改":"至少 6 位",value:V,onChange:L=>E(L.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"昵称"}),t.jsx(se,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:T,onChange:L=>z(L.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"角色"}),t.jsxs("select",{value:q,onChange:L=>ue(L.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[t.jsx("option",{value:"admin",children:"管理员"}),t.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),P&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(J,{className:"text-gray-300",children:"状态"}),t.jsxs("select",{value:ee,onChange:L=>ce(L.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[t.jsx("option",{value:"active",children:"正常"}),t.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),t.jsxs(Kt,{children:[t.jsxs(ie,{variant:"outline",onClick:()=>S(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(ir,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(ie,{onClick:Q,disabled:G,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(Ot,{className:"w-4 h-4 mr-2"}),G?"保存中...":"保存"]})]})]})})]})}function m4(){return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[t.jsx(Yn,{className:"w-8 h-8 text-[#38bdac]"}),t.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),t.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"1. 接口总览"})}),t.jsxs(Te,{className:"space-y-4 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),t.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[t.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),t.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),t.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),t.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),t.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),t.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),t.jsx("li",{children:"/api/config — 配置系统"})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),t.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),t.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"2. 书籍内容"})}),t.jsxs(Te,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[t.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),t.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),t.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"3. 支付"})}),t.jsxs(Te,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[t.jsx("p",{children:"POST /api/payment/create-order — 创建订单"}),t.jsx("p",{children:"POST /api/payment/alipay/notify — 支付宝回调"}),t.jsx("p",{children:"POST /api/payment/wechat/notify — 微信回调"})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"4. 分销与用户"})}),t.jsxs(Te,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[t.jsx("p",{children:"/api/referral/* — 邀请码、收益查询、提现"}),t.jsx("p",{children:"/api/user/* — 登录、注册、信息更新"}),t.jsx("p",{children:"/api/match/* — 匹配、匹配历史"})]})]}),t.jsxs(Re,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Ue,{children:t.jsx(Ve,{className:"text-white",children:"5. 管理后台"})}),t.jsxs(Te,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[t.jsx("p",{children:"GET/POST /api/admin/referral-settings — 推广/分销设置(含 VIP 配置)"}),t.jsx("p",{children:"GET /api/db/users、/api/db/book — 用户与章节数据"}),t.jsx("p",{children:"GET /api/orders — 订单列表"})]})]}),t.jsx("p",{className:"text-gray-500 text-xs",children:"完整说明见项目内 开发文档/5、接口/API接口完整文档.md"})]})}function p4(){const n=ns();return t.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:t.jsxs("div",{className:"text-center max-w-md",children:[t.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500/20 text-red-400 mb-6",children:t.jsx(Tj,{className:"w-10 h-10"})}),t.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),t.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),t.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:n.pathname}),t.jsx(ie,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:t.jsxs(fi,{to:"/",children:[t.jsx(aN,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function x4(){return t.jsxs(lj,{children:[t.jsx(nt,{path:"/login",element:t.jsx(rw,{})}),t.jsxs(nt,{path:"/",element:t.jsx(ab,{}),children:[t.jsx(nt,{index:!0,element:t.jsx(nj,{to:"/dashboard",replace:!0})}),t.jsx(nt,{path:"dashboard",element:t.jsx(sw,{})}),t.jsx(nt,{path:"orders",element:t.jsx(V1,{})}),t.jsx(nt,{path:"users",element:t.jsx(x2,{})}),t.jsx(nt,{path:"distribution",element:t.jsx(g2,{})}),t.jsx(nt,{path:"withdrawals",element:t.jsx(v2,{})}),t.jsx(nt,{path:"content",element:t.jsx(kC,{})}),t.jsx(nt,{path:"referral-settings",element:t.jsx(YC,{})}),t.jsx(nt,{path:"author-settings",element:t.jsx(QC,{})}),t.jsx(nt,{path:"vip-roles",element:t.jsx(d4,{})}),t.jsx(nt,{path:"mentors",element:t.jsx(u4,{})}),t.jsx(nt,{path:"mentor-consultations",element:t.jsx(f4,{})}),t.jsx(nt,{path:"admin-users",element:t.jsx(h4,{})}),t.jsx(nt,{path:"settings",element:t.jsx(e4,{})}),t.jsx(nt,{path:"payment",element:t.jsx(t4,{})}),t.jsx(nt,{path:"site",element:t.jsx(a4,{})}),t.jsx(nt,{path:"qrcodes",element:t.jsx(l4,{})}),t.jsx(nt,{path:"match",element:t.jsx(o4,{})}),t.jsx(nt,{path:"match-records",element:t.jsx(c4,{})}),t.jsx(nt,{path:"api-doc",element:t.jsx(m4,{})})]}),t.jsx(nt,{path:"*",element:t.jsx(p4,{})})]})}cy.createRoot(document.getElementById("root")).render(t.jsx(h.StrictMode,{children:t.jsx(hj,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:t.jsx(x4,{})})})); diff --git a/soul-admin/dist/index.html b/soul-admin/dist/index.html index 40bf0dd2..63e92070 100644 --- a/soul-admin/dist/index.html +++ b/soul-admin/dist/index.html @@ -1,13 +1,13 @@ - - - - - - 管理后台 - Soul创业派对 - - - - -
    - - + + + + + + 管理后台 - Soul创业派对 + + + + +
    + + diff --git a/soul-admin/src/App.tsx b/soul-admin/src/App.tsx index 3c04e125..0c2bf4dd 100644 --- a/soul-admin/src/App.tsx +++ b/soul-admin/src/App.tsx @@ -35,10 +35,10 @@ function App() { } /> } /> } /> - } /> } /> } /> } /> + } /> } /> } /> } /> diff --git a/soul-admin/src/components/RichEditor.css b/soul-admin/src/components/RichEditor.css index 54747fd5..4e41ea4d 100644 --- a/soul-admin/src/components/RichEditor.css +++ b/soul-admin/src/components/RichEditor.css @@ -142,6 +142,17 @@ font-weight: 500; } +/* #linkTag 高亮:与小程序 read.wxss .link-tag 金黄色保持一致 */ +.link-tag-node { + background: rgba(255, 215, 0, 0.12); + color: #FFD700; + border-radius: 4px; + padding: 1px 4px; + font-weight: 500; + cursor: default; + user-select: all; +} + .mention-popup { position: fixed; z-index: 9999; diff --git a/soul-admin/src/components/RichEditor.tsx b/soul-admin/src/components/RichEditor.tsx index 58948690..f821650e 100644 --- a/soul-admin/src/components/RichEditor.tsx +++ b/soul-admin/src/components/RichEditor.tsx @@ -1,4 +1,4 @@ -import { useEditor, EditorContent } from '@tiptap/react' +import { useEditor, EditorContent, type Editor, Node, mergeAttributes } from '@tiptap/react' import StarterKit from '@tiptap/starter-kit' import Image from '@tiptap/extension-image' import Link from '@tiptap/extension-link' @@ -16,6 +16,7 @@ export interface PersonItem { id: string name: string label?: string + ckbApiKey?: string // 存客宝密钥,留空则 fallback 全局 Key } export interface LinkTagItem { @@ -102,6 +103,50 @@ function markdownToHtml(md: string): string { return result.join('') } +/** + * LinkTagExtension — 自定义 TipTap 内联节点,保留所有 data-* 属性 + * 解决:insertContent(html) 会经过 TipTap schema 导致自定义属性被丢弃的问题 + */ +const LinkTagExtension = Node.create({ + name: 'linkTag', + group: 'inline', + inline: true, + selectable: true, + atom: true, + + addAttributes() { + return { + label: { default: '' }, + url: { default: '' }, + tagType: { default: 'url', parseHTML: (el: HTMLElement) => el.getAttribute('data-tag-type') || 'url' }, + tagId: { default: '', parseHTML: (el: HTMLElement) => el.getAttribute('data-tag-id') || '' }, + pagePath: { default: '', parseHTML: (el: HTMLElement) => el.getAttribute('data-page-path') || '' }, + } + }, + + parseHTML() { + return [{ tag: 'span[data-type="linkTag"]', getAttrs: (el: HTMLElement) => ({ + label: el.textContent?.replace(/^#/, '').trim() || '', + url: el.getAttribute('data-url') || '', + tagType: el.getAttribute('data-tag-type') || 'url', + tagId: el.getAttribute('data-tag-id') || '', + pagePath: el.getAttribute('data-page-path')|| '', + }) }] + }, + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + renderHTML({ node, HTMLAttributes }: { node: any; HTMLAttributes: Record }) { + return ['span', mergeAttributes(HTMLAttributes, { + 'data-type': 'linkTag', + 'data-url': node.attrs.url, + 'data-tag-type': node.attrs.tagType, + 'data-tag-id': node.attrs.tagId, + 'data-page-path': node.attrs.pagePath, + class: 'link-tag-node', + }), `#${node.attrs.label}`] + }, +}) + // eslint-disable-next-line @typescript-eslint/no-explicit-any const MentionSuggestion = (persons: PersonItem[]): any => ({ items: ({ query }: { query: string }) => @@ -196,12 +241,13 @@ const RichEditor = forwardRef(({ HTMLAttributes: { class: 'mention-tag' }, suggestion: MentionSuggestion(persons), }), + LinkTagExtension, Placeholder.configure({ placeholder }), Table.configure({ resizable: true }), TableRow, TableCell, TableHeader, ], content: initialContent.current, - onUpdate: ({ editor: ed }) => { + onUpdate: ({ editor: ed }: { editor: Editor }) => { onChange(ed.getHTML()) }, editorProps: { @@ -242,10 +288,16 @@ const RichEditor = forwardRef(({ const insertLinkTag = useCallback((tag: LinkTagItem) => { if (!editor) return + // 通过自定义扩展节点插入,确保 data-* 属性不被 TipTap schema 丢弃 editor.chain().focus().insertContent({ - type: 'text', - marks: [{ type: 'link', attrs: { href: tag.url, target: '_blank' } }], - text: `#${tag.label}`, + type: 'linkTag', + attrs: { + label: tag.label, + url: tag.url || '', + tagType: tag.type || 'url', + tagId: tag.id || '', + pagePath: tag.pagePath || '', + }, }).run() }, [editor]) diff --git a/soul-admin/src/components/modules/user/SetVipModal.tsx b/soul-admin/src/components/modules/user/SetVipModal.tsx index b90e6174..673fa9f2 100644 --- a/soul-admin/src/components/modules/user/SetVipModal.tsx +++ b/soul-admin/src/components/modules/user/SetVipModal.tsx @@ -1,3 +1,4 @@ +import toast from '@/utils/toast' import { useState, useEffect } from 'react' import { Dialog, @@ -106,13 +107,13 @@ export function SetVipModal({ async function handleSave() { if (!userId) return if (form.isVip && !form.vipExpireDate.trim()) { - alert('开启 VIP 时请填写有效到期日') + toast.error('开启 VIP 时请填写有效到期日') return } if (form.isVip && form.vipExpireDate.trim()) { const d = new Date(form.vipExpireDate) if (isNaN(d.getTime())) { - alert('到期日格式无效,请使用 YYYY-MM-DD') + toast.error('到期日格式无效,请使用 YYYY-MM-DD') return } } @@ -132,15 +133,15 @@ export function SetVipModal({ } const data = await put<{ success?: boolean; error?: string }>('/api/db/users', payload) if (data?.success) { - alert('VIP 设置已保存') + toast.success('VIP 设置已保存') onSaved?.() onClose() } else { - alert('保存失败: ' + (data as { error?: string })?.error) + toast.error('保存失败: ' + (data as { error?: string })?.error) } } catch (e) { console.error('Save VIP error:', e) - alert('保存失败') + toast.error('保存失败') } finally { setSaving(false) } diff --git a/soul-admin/src/components/modules/user/UserDetailModal.tsx b/soul-admin/src/components/modules/user/UserDetailModal.tsx index a1670ebe..cc655d14 100644 --- a/soul-admin/src/components/modules/user/UserDetailModal.tsx +++ b/soul-admin/src/components/modules/user/UserDetailModal.tsx @@ -1,3 +1,4 @@ +import toast from '@/utils/toast' import { useState, useEffect } from 'react' import { Dialog, @@ -201,7 +202,7 @@ export function UserDetailModal({ } async function handleSyncCKB() { - if (!user?.phone) { alert('用户未绑定手机号,无法同步'); return } + if (!user?.phone) { toast.info('用户未绑定手机号,无法同步'); return } setSyncing(true) try { const data = await post<{ success?: boolean; error?: string }>('/api/ckb/sync', { @@ -209,11 +210,11 @@ export function UserDetailModal({ phone: user.phone, userId: user.id, }) - if (data?.success) { alert('同步成功'); loadUserDetail() } - else alert('同步失败: ' + (data as { error?: string })?.error) + if (data?.success) { toast.success('同步成功'); loadUserDetail() } + else toast.error('同步失败: ' + (data as { error?: string })?.error) } catch (e) { console.error('Sync CKB error:', e) - alert('同步失败') + toast.error('同步失败') } finally { setSyncing(false) } @@ -231,15 +232,15 @@ export function UserDetailModal({ } const data = await put<{ success?: boolean; error?: string }>('/api/db/users', payload) if (data?.success) { - alert('保存成功') + toast.success('保存成功') loadUserDetail() onUserUpdated?.() } else { - alert('保存失败: ' + (data as { error?: string })?.error) + toast.error('保存失败: ' + (data as { error?: string })?.error) } } catch (e) { console.error('Save user error:', e) - alert('保存失败') + toast.error('保存失败') } finally { setSaving(false) } @@ -256,20 +257,20 @@ export function UserDetailModal({ async function handleSavePassword() { if (!user) return - if (!newPassword) { alert('请输入新密码'); return } - if (newPassword !== confirmPassword) { alert('两次密码不一致'); return } - if (newPassword.length < 6) { alert('密码至少 6 位'); return } + if (!newPassword) { toast.error('请输入新密码'); return } + if (newPassword !== confirmPassword) { toast.error('两次密码不一致'); return } + if (newPassword.length < 6) { toast.error('密码至少 6 位'); return } setPasswordSaving(true) try { const data = await put<{ success?: boolean; error?: string }>('/api/db/users', { id: user.id, password: newPassword }) - if (data?.success) { alert('修改成功'); setNewPassword(''); setConfirmPassword('') } - else alert('修改失败: ' + (data?.error || '')) - } catch { alert('修改失败') } finally { setPasswordSaving(false) } + if (data?.success) { toast.success('修改成功'); setNewPassword(''); setConfirmPassword('') } + else toast.error('修改失败: ' + (data?.error || '')) + } catch { toast.error('修改失败') } finally { setPasswordSaving(false) } } async function handleSaveVip() { if (!user) return - if (vipForm.isVip && !vipForm.vipExpireDate.trim()) { alert('开启 VIP 请填写有效到期日'); return } + if (vipForm.isVip && !vipForm.vipExpireDate.trim()) { toast.error('开启 VIP 请填写有效到期日'); return } setVipSaving(true) try { const payload = { @@ -283,9 +284,9 @@ export function UserDetailModal({ vipBio: vipForm.vipBio || undefined, } const data = await put<{ success?: boolean; error?: string }>('/api/db/users', payload) - if (data?.success) { alert('VIP 设置已保存'); loadUserDetail(); onUserUpdated?.() } - else alert('保存失败: ' + (data?.error || '')) - } catch { alert('保存失败') } finally { setVipSaving(false) } + if (data?.success) { toast.success('VIP 设置已保存'); loadUserDetail(); onUserUpdated?.() } + else toast.error('保存失败: ' + (data?.error || '')) + } catch { toast.error('保存失败') } finally { setVipSaving(false) } } // 用户资料完善查询(支持多维度) @@ -657,9 +658,9 @@ export function UserDetailModal({ if (!ckbWechatOwner || !user) return try { await put('/api/db/users', { id: user.id, wechatId: ckbWechatOwner }) - alert('已保存微信归属') + toast.success('已保存微信归属') loadUserDetail() - } catch { alert('保存失败') } + } catch { toast.error('保存失败') } }} className="bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0" > diff --git a/soul-admin/src/components/ui/dialog.tsx b/soul-admin/src/components/ui/dialog.tsx index 91ad8fa8..eecb3874 100644 --- a/soul-admin/src/components/ui/dialog.tsx +++ b/soul-admin/src/components/ui/dialog.tsx @@ -33,7 +33,7 @@ const DialogContent = React.forwardRef< ref={ref} aria-describedby={undefined} className={cn( - 'fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg sm:max-w-lg', + 'fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg', className, )} {...props} diff --git a/soul-admin/src/layouts/AdminLayout.tsx b/soul-admin/src/layouts/AdminLayout.tsx index 86cc76fd..d9f76970 100644 --- a/soul-admin/src/layouts/AdminLayout.tsx +++ b/soul-admin/src/layouts/AdminLayout.tsx @@ -12,7 +12,7 @@ import { import { get, post } from '@/api/client' import { clearAdminToken } from '@/api/auth' -// 主菜单(含原「更多」下的项,直接平铺) +// 主菜单(5 项平铺,按 Mycontent-temp 新规范) const primaryMenuItems = [ { icon: LayoutDashboard, label: '数据概览', href: '/dashboard' }, { icon: BookOpen, label: '内容管理', href: '/content' }, diff --git a/soul-admin/src/pages/author-settings/AuthorSettingsPage.tsx b/soul-admin/src/pages/author-settings/AuthorSettingsPage.tsx index 60ebb4ef..51127db1 100644 --- a/soul-admin/src/pages/author-settings/AuthorSettingsPage.tsx +++ b/soul-admin/src/pages/author-settings/AuthorSettingsPage.tsx @@ -1,3 +1,4 @@ +import toast from '@/utils/toast' import { useState, useEffect, useRef } from 'react' import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' import { Label } from '@/components/ui/label' @@ -97,7 +98,7 @@ export function AuthorSettingsPage() { } const res = await post<{ success?: boolean; error?: string }>('/api/admin/author-settings', body) if (!res || (res as { success?: boolean }).success === false) { - alert('保存失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '')) + toast.error('保存失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '')) return } setSaving(false) @@ -109,7 +110,7 @@ export function AuthorSettingsPage() { setTimeout(() => msg.remove(), 2000) } catch (e) { console.error(e) - alert('保存失败: ' + (e instanceof Error ? e.message : String(e))) + toast.error('保存失败: ' + (e instanceof Error ? e.message : String(e))) } finally { setSaving(false) } @@ -136,11 +137,11 @@ export function AuthorSettingsPage() { if (data?.success && data?.url) { setConfig((prev) => ({ ...prev, avatarImg: data.url })) } else { - alert('上传失败: ' + (data?.error || '未知错误')) + toast.error('上传失败: ' + (data?.error || '未知错误')) } } catch (err) { console.error(err) - alert('上传失败') + toast.error('上传失败') } finally { setUploadingAvatar(false) if (avatarInputRef.current) avatarInputRef.current.value = '' diff --git a/soul-admin/src/pages/chapters/ChaptersPage.tsx b/soul-admin/src/pages/chapters/ChaptersPage.tsx index ed2cd532..93743ede 100644 --- a/soul-admin/src/pages/chapters/ChaptersPage.tsx +++ b/soul-admin/src/pages/chapters/ChaptersPage.tsx @@ -1,3 +1,4 @@ +import toast from '@/utils/toast' import { useState, useEffect } from 'react' import { get, post } from '@/api/client' @@ -80,7 +81,7 @@ export function ChaptersPage() { data: { price: editPrice }, }) if (result?.success) { - alert('价格更新成功') + toast.success('价格更新成功') setEditingSection(null) loadChapters() } @@ -97,7 +98,7 @@ export function ChaptersPage() { data: { isFree: !currentFree }, }) if (result?.success) { - alert('状态更新成功') + toast.success('状态更新成功') loadChapters() } } catch (e) { diff --git a/soul-admin/src/pages/content/ChapterTree.tsx b/soul-admin/src/pages/content/ChapterTree.tsx index b629d619..5b6709d2 100644 --- a/soul-admin/src/pages/content/ChapterTree.tsx +++ b/soul-admin/src/pages/content/ChapterTree.tsx @@ -1,4 +1,4 @@ -/** +/** * 章节树 - 仿照 catalog 设计,支持篇、章、节拖拽排序 * 整行可拖拽;节和章可跨篇 */ diff --git a/soul-admin/src/pages/content/ContentPage.tsx b/soul-admin/src/pages/content/ContentPage.tsx index f6253b48..a1881967 100644 --- a/soul-admin/src/pages/content/ContentPage.tsx +++ b/soul-admin/src/pages/content/ContentPage.tsx @@ -1,4 +1,5 @@ import { useState, useRef, useEffect, useCallback } from 'react' +import toast from '@/utils/toast' import { Card, CardContent, @@ -9,7 +10,6 @@ import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' -import { Textarea } from '@/components/ui/textarea' import RichEditor, { type PersonItem, type LinkTagItem, type RichEditorRef } from '@/components/RichEditor' import '@/components/RichEditor.css' import { @@ -44,6 +44,8 @@ import { Star, Hash, ExternalLink, + Pencil, + Check, } from 'lucide-react' import { get, put, post, del } from '@/api/client' import { ChapterTree } from './ChapterTree' @@ -113,6 +115,8 @@ interface EditingSection { isNew?: boolean isPinned?: boolean hotScore?: number + editionStandard?: boolean + editionPremium?: boolean } function buildTree(sections: SectionListItem[]): Part[] { @@ -195,6 +199,12 @@ export function ContentPage() { partId: 'part-1', chapterId: 'chapter-1', content: '', + editionStandard: true, + editionPremium: false, + isFree: false, + isNew: false, + isPinned: false, + hotScore: 0, }) const [editingPart, setEditingPart] = useState<{ id: string; title: string } | null>(null) @@ -223,7 +233,9 @@ export function ContentPage() { const [previewPercentSaving, setPreviewPercentSaving] = useState(false) const [persons, setPersons] = useState([]) const [linkTags, setLinkTags] = useState([]) - const [newPerson, setNewPerson] = useState({ personId: '', name: '', label: '' }) + const [newPerson, setNewPerson] = useState({ personId: '', name: '', label: '', ckbApiKey: '' }) + const [editingPersonKey, setEditingPersonKey] = useState(null) // 正在编辑密钥的 personId + const [editingPersonKeyValue, setEditingPersonKeyValue] = useState('') const [newLinkTag, setNewLinkTag] = useState({ tagId: '', label: '', url: '', type: 'url' as 'url' | 'miniprogram' | 'ckb', appId: '', pagePath: '' }) const richEditorRef = useRef(null) @@ -276,13 +288,13 @@ export function ContentPage() { .then((res) => { if (res && (res as { success?: boolean }).success === false) { setSectionsList(prev) - alert('排序失败: ' + ((res && typeof res === 'object' && 'error' in res) ? (res as { error?: string }).error : '未知错误')) + toast.error('排序失败: ' + ((res && typeof res === 'object' && 'error' in res) ? (res as { error?: string }).error : '未知错误')) } }) .catch((e) => { setSectionsList(prev) console.error('排序失败:', e) - alert('排序失败: ' + (e instanceof Error ? e.message : '网络或服务异常')) + toast.error('排序失败: ' + (e instanceof Error ? e.message : '网络或服务异常')) }) return Promise.resolve() }, @@ -296,14 +308,14 @@ export function ContentPage() { `/api/db/book?id=${encodeURIComponent(section.id)}`, ) if (res && (res as { success?: boolean }).success !== false) { - alert('已删除') + toast.success('已删除') loadList() } else { - alert('删除失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) + toast.error('删除失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) } } catch (e) { console.error(e) - alert('删除失败') + toast.error('删除失败') } } @@ -337,7 +349,7 @@ export function ContentPage() { const { readWeight, recencyWeight, payWeight } = rankingWeights const sum = readWeight + recencyWeight + payWeight if (Math.abs(sum - 1) > 0.001) { - alert('三个权重之和必须等于 1') + toast.error('三个权重之和必须等于 1') return } setRankingWeightsSaving(true) @@ -348,14 +360,14 @@ export function ContentPage() { description: '文章排名算法权重', }) if (res && (res as { success?: boolean }).success !== false) { - alert('已保存') + toast.success('排名权重已保存') loadList() } else { - alert('保存失败: ' + ((res && typeof res === 'object' && 'error' in res) ? (res as { error?: string }).error : '')) + toast.error('保存失败: ' + ((res && typeof res === 'object' && 'error' in res) ? (res as { error?: string }).error : '')) } } catch (e) { console.error(e) - alert('保存失败') + toast.error('保存失败') } finally { setRankingWeightsSaving(false) } @@ -375,8 +387,8 @@ export function ContentPage() { const loadPersons = useCallback(async () => { try { - const data = await get<{ success?: boolean; persons?: { personId: string; name: string; label?: string }[] }>('/api/db/persons') - if (data?.success && data.persons) setPersons(data.persons.map(p => ({ id: p.personId, name: p.name, label: p.label }))) + const data = await get<{ success?: boolean; persons?: { personId: string; name: string; label?: string; ckbApiKey?: string }[] }>('/api/db/persons') + if (data?.success && data.persons) setPersons(data.persons.map(p => ({ id: p.personId, name: p.name, label: p.label, ckbApiKey: p.ckbApiKey }))) } catch { /* ignore */ } }, []) @@ -414,7 +426,7 @@ export function ContentPage() { }, []) const handleSavePreviewPercent = async () => { - if (previewPercent < 1 || previewPercent > 100) { alert('预览比例需在 1~100 之间'); return } + if (previewPercent < 1 || previewPercent > 100) { toast.error('预览比例需在 1~100 之间'); return } setPreviewPercentSaving(true) try { const res = await post<{ success?: boolean; error?: string }>('/api/db/config', { @@ -422,9 +434,9 @@ export function ContentPage() { value: previewPercent, description: '小程序未付费内容默认预览比例(%)', }) - if (res && (res as { success?: boolean }).success !== false) alert('已保存') - else alert('保存失败: ' + ((res as { error?: string }).error || '')) - } catch { alert('保存失败') } finally { setPreviewPercentSaving(false) } + if (res && (res as { success?: boolean }).success !== false) toast.success('预览比例已保存') + else toast.error('保存失败: ' + ((res as { error?: string }).error || '')) + } catch { toast.error('保存失败') } finally { setPreviewPercentSaving(false) } } useEffect(() => { loadPinnedSections(); loadPreviewPercent(); loadPersons(); loadLinkTags() }, [loadPinnedSections, loadPreviewPercent, loadPersons, loadLinkTags]) @@ -449,11 +461,12 @@ export function ContentPage() { const handleReadSection = async (section: Section & { filePath?: string }) => { setIsLoadingContent(true) try { - const data = await get<{ success?: boolean; section?: { title?: string; price?: number; content?: string }; error?: string }>( + const data = await get<{ success?: boolean; section?: { title?: string; price?: number; content?: string; editionStandard?: boolean; editionPremium?: boolean }; error?: string }>( `/api/db/book?action=read&id=${encodeURIComponent(section.id)}`, ) if (data?.success && data.section) { - const sec = data.section as { isNew?: boolean } + const sec = data.section as { isNew?: boolean; editionStandard?: boolean; editionPremium?: boolean } + const isPremium = sec.editionPremium === true setEditingSection({ id: section.id, originalId: section.id, @@ -465,6 +478,8 @@ export function ContentPage() { isNew: sec.isNew ?? section.isNew, isPinned: pinnedSectionIds.includes(section.id), hotScore: section.hotScore ?? 0, + editionStandard: isPremium ? false : (sec.editionStandard ?? true), + editionPremium: isPremium, }) } else { setEditingSection({ @@ -478,9 +493,11 @@ export function ContentPage() { isNew: section.isNew, isPinned: pinnedSectionIds.includes(section.id), hotScore: section.hotScore ?? 0, + editionStandard: true, + editionPremium: false, }) if (data && !(data as { success?: boolean }).success) { - alert('无法读取文件内容: ' + ((data as { error?: string }).error || '未知错误')) + toast.error('无法读取文件内容: ' + ((data as { error?: string }).error || '未知错误')) } } } catch (e) { @@ -522,6 +539,8 @@ export function ContentPage() { isFree: editingSection.isFree || editingSection.price === 0, isNew: editingSection.isNew, hotScore: editingSection.hotScore, + editionStandard: editingSection.editionPremium ? false : (editingSection.editionStandard ?? true), + editionPremium: editingSection.editionPremium ?? false, saveToFile: true, }) const effectiveId = idChanged ? editingSection.id : originalId @@ -529,15 +548,15 @@ export function ContentPage() { await handleTogglePin(effectiveId) } if (res && (res as { success?: boolean }).success !== false) { - alert(`已保存章节: ${editingSection.title}`) + toast.success(`已保存:${editingSection.title}`) setEditingSection(null) loadList() } else { - alert('保存失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) + toast.error('保存失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) } } catch (e) { console.error(e) - alert('保存失败') + toast.error('保存失败') } finally { setIsSaving(false) } @@ -545,31 +564,51 @@ export function ContentPage() { const handleCreateSection = async () => { if (!newSection.id || !newSection.title) { - alert('请填写章节ID和标题') + toast.error('请填写章节ID和标题') return } setIsSaving(true) try { + const currentPart = tree.find((p) => p.id === newSection.partId) + const currentChapter = currentPart?.chapters.find((c) => c.id === newSection.chapterId) const res = await put<{ success?: boolean; error?: string }>('/api/db/book', { id: newSection.id, title: newSection.title, - price: newSection.price, + price: newSection.isFree ? 0 : newSection.price, content: newSection.content, partId: newSection.partId, + partTitle: currentPart?.title ?? '', chapterId: newSection.chapterId, + chapterTitle: currentChapter?.title ?? '', + isFree: newSection.isFree, + isNew: newSection.isNew, + editionStandard: newSection.editionPremium ? false : (newSection.editionStandard ?? true), + editionPremium: newSection.editionPremium ?? false, + hotScore: newSection.hotScore ?? 0, saveToFile: false, }) if (res && (res as { success?: boolean }).success !== false) { - alert(`章节创建成功: ${newSection.title}`) + if (newSection.isPinned) { + const next = [...pinnedSectionIds, newSection.id] + setPinnedSectionIds(next) + try { + await post<{ success?: boolean }>('/api/db/config', { + key: 'pinned_section_ids', + value: next, + description: '强制置顶章节ID列表(精选推荐/首页最新更新)', + }) + } catch { /* ignore */ } + } + toast.success(`章节创建成功:${newSection.title}`) setShowNewSectionModal(false) - setNewSection({ id: '', title: '', price: 1, partId: 'part-1', chapterId: 'chapter-1', content: '' }) + setNewSection({ id: '', title: '', price: 1, partId: 'part-1', chapterId: 'chapter-1', content: '', editionStandard: true, editionPremium: false, isFree: false, isNew: false, isPinned: false, hotScore: 0 }) loadList() } else { - alert('创建失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) + toast.error('创建失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) } } catch (e) { console.error(e) - alert('创建失败') + toast.error('创建失败') } finally { setIsSaving(false) } @@ -604,14 +643,20 @@ export function ContentPage() { items, }) if (res && (res as { success?: boolean }).success !== false) { + const newTitle = editingPart.title.trim() + setSectionsList((prev) => + prev.map((s) => + s.partId === editingPart.id ? { ...s, partTitle: newTitle } : s + ) + ) setEditingPart(null) loadList() } else { - alert('更新篇名失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) + toast.error('更新篇名失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) } } catch (e) { console.error(e) - alert('更新篇名失败') + toast.error('更新篇名失败') } finally { setIsSavingPartTitle(false) } @@ -627,6 +672,12 @@ export function ContentPage() { partId: part.id, chapterId: newChapterId, content: '', + editionStandard: true, + editionPremium: false, + isFree: false, + isNew: false, + isPinned: false, + hotScore: 0, }) setShowNewSectionModal(true) } @@ -651,14 +702,24 @@ export function ContentPage() { })) const res = await put<{ success?: boolean; error?: string }>('/api/db/book', { action: 'reorder', items }) if (res && (res as { success?: boolean }).success !== false) { + const newTitle = editingChapter.title.trim() + const partId = editingChapter.part.id + const chapterId = editingChapter.chapter.id + setSectionsList((prev) => + prev.map((s) => + s.partId === partId && s.chapterId === chapterId + ? { ...s, chapterTitle: newTitle } + : s + ) + ) setEditingChapter(null) loadList() } else { - alert('保存失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) + toast.error('保存失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) } } catch (e) { console.error(e) - alert('保存失败') + toast.error('保存失败') } finally { setIsSavingChapterTitle(false) } @@ -667,7 +728,7 @@ export function ContentPage() { const handleDeleteChapter = async (part: Part, chapter: Chapter) => { const sectionIds = chapter.sections.map((s) => s.id) if (sectionIds.length === 0) { - alert('该章下无小节,无需删除') + toast.info('该章下无小节,无需删除') return } if (!confirm(`确定要删除「第${part.chapters.indexOf(chapter) + 1}章 | ${chapter.title}」吗?将删除共 ${sectionIds.length} 节,此操作不可恢复。`)) return @@ -678,13 +739,13 @@ export function ContentPage() { loadList() } catch (e) { console.error(e) - alert('删除失败') + toast.error('删除失败') } } const handleCreatePart = async () => { if (!newPartTitle.trim()) { - alert('请输入篇名') + toast.error('请输入篇名') return } setIsSavingPart(true) @@ -704,16 +765,16 @@ export function ContentPage() { saveToFile: false, }) if (res && (res as { success?: boolean }).success !== false) { - alert(`篇「${newPartTitle}」创建成功,请编辑占位节`) + toast.success(`篇「${newPartTitle}」创建成功`) setShowNewPartModal(false) setNewPartTitle('') loadList() } else { - alert('创建失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) + toast.error('创建失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) } } catch (e) { console.error(e) - alert('创建失败') + toast.error('创建失败') } finally { setIsSavingPart(false) } @@ -721,13 +782,13 @@ export function ContentPage() { const handleBatchMoveToTarget = async () => { if (selectedSectionIds.length === 0) { - alert('请先勾选要移动的章节') + toast.error('请先勾选要移动的章节') return } const targetPart = tree.find((p) => p.id === batchMoveTargetPartId) const targetChapter = targetPart?.chapters.find((c) => c.id === batchMoveTargetChapterId) if (!targetPart || !targetChapter || !batchMoveTargetPartId || !batchMoveTargetChapterId) { - alert('请选择目标篇和章') + toast.error('请选择目标篇和章') return } setIsMoving(true) @@ -773,7 +834,7 @@ export function ContentPage() { { action: 'reorder', items: reorderItems }, ) if (reorderRes && (reorderRes as { success?: boolean }).success !== false) { - alert(`已移动 ${selectedSectionIds.length} 节到「${targetPart.title}」-「${targetChapter.title}」`) + toast.success(`已移动 ${selectedSectionIds.length} 节到「${targetPart.title}」-「${targetChapter.title}」`) setShowBatchMoveModal(false) setSelectedSectionIds([]) await loadList() @@ -792,7 +853,7 @@ export function ContentPage() { } const res = await put<{ success?: boolean; error?: string; count?: number }>('/api/db/book', payload) if (res && (res as { success?: boolean }).success !== false) { - alert(`已移动 ${(res as { count?: number }).count ?? selectedSectionIds.length} 节到「${targetPart.title}」-「${targetChapter.title}」`) + toast.success(`已移动 ${(res as { count?: number }).count ?? selectedSectionIds.length} 节到「${targetPart.title}」-「${targetChapter.title}」`) setShowBatchMoveModal(false) setSelectedSectionIds([]) await loadList() @@ -802,11 +863,11 @@ export function ContentPage() { const fallbackOk = await tryFallbackReorder() if (fallbackOk) return } - alert('移动失败: ' + errorMessage) + toast.error('移动失败: ' + errorMessage) } } catch (e) { console.error(e) - alert('移动失败: ' + (e instanceof Error ? e.message : '网络或服务异常')) + toast.error('移动失败: ' + (e instanceof Error ? e.message : '网络或服务异常')) } finally { setIsMoving(false) } @@ -821,7 +882,7 @@ export function ContentPage() { const handleDeletePart = async (part: Part) => { const sectionIds = sectionsList.filter((s) => s.partId === part.id).map((s) => s.id) if (sectionIds.length === 0) { - alert('该篇下暂无小节可删除') + toast.info('该篇下暂无小节可删除') return } if (!confirm(`确定要删除「${part.title}」整篇吗?将删除共 ${sectionIds.length} 节内容,此操作不可恢复。`)) return @@ -832,7 +893,7 @@ export function ContentPage() { loadList() } catch (e) { console.error(e) - alert('删除失败') + toast.error('删除失败') } } @@ -848,13 +909,13 @@ export function ContentPage() { } else { setSearchResults([]) if (data && !(data as { success?: boolean }).success) { - alert('搜索失败: ' + (data as { error?: string }).error) + toast.error('搜索失败: ' + (data as { error?: string }).error) } } } catch (e) { console.error(e) setSearchResults([]) - alert('搜索失败') + toast.error('搜索失败') } finally { setIsSearching(false) } @@ -893,17 +954,17 @@ export function ContentPage() { - {/* 新建章节弹窗 */} + {/* 新建章节弹窗:与编辑章节样式功能一致 */} - - + + 新建章节 -
    -
    +
    +
    setNewSection({ ...newSection, price: Number(e.target.value) })} + value={newSection.isFree ? 0 : newSection.price} + onChange={(e) => + setNewSection({ + ...newSection, + price: Number(e.target.value), + isFree: Number(e.target.value) === 0, + }) + } + disabled={newSection.isFree} + /> +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + + +
    +
    +
    + + + setNewSection({ + ...newSection, + hotScore: Math.max(0, parseFloat(e.target.value) || 0), + }) + } />
    @@ -935,7 +1092,17 @@ export function ContentPage() {
    - { + const part = tree.find((p) => p.id === v) + setNewSection({ + ...newSection, + partId: v, + chapterId: part?.chapters[0]?.id ?? 'chapter-1', + }) + }} + > @@ -975,16 +1142,25 @@ export function ContentPage() {
    - -