From 05ac60dc7e981085ab0c0e9f7a207b2137c208c2 Mon Sep 17 00:00:00 2001 From: Alex-larget <33240357+Alex-larget@users.noreply.github.com> Date: Tue, 10 Mar 2026 11:04:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9EVIP=E4=BC=9A=E5=91=98=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=AB=A0=E8=8A=82=E8=A7=A3=E9=94=81=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81VIP=E7=94=A8=E6=88=B7=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E5=A2=9E=E5=80=BC=E5=86=85=E5=AE=B9=E3=80=82=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E7=94=A8=E6=88=B7=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0VIP=E7=9B=B8=E5=85=B3=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=92=8C=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=8F=90=E5=8D=87?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C=E3=80=82=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BC=9A=E8=AE=AE=E8=AE=B0=E5=BD=95=EF=BC=8C=E5=8F=8D=E6=98=A0?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E8=AE=A8=E8=AE=BA=E5=86=85=E5=AE=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...26-03-09_devlop与yongxu分支差异分析会议.md | 157 ++ ...6-03-09_dev分支需求分析与yongxu迁移方案.md | 165 ++ .cursor/meeting/README.md | 2 + Mycontent-temp | 1 + miniprogram/app.js | 9 +- miniprogram/pages/chapters/chapters.js | 40 +- miniprogram/pages/chapters/chapters.wxml | 7 +- miniprogram/pages/chapters/chapters.wxss | 8 + .../pages/member-detail/member-detail.js | 2 +- miniprogram/pages/my/my.js | 15 +- soul-admin/dist/assets/index-CXOwdtCt.css | 1 + soul-admin/dist/assets/index-DP984f3K.css | 1 - soul-admin/dist/assets/index-DsLRWYbk.js | 774 +++++++++ soul-admin/dist/assets/index-iq3PeMuM.js | 470 ------ soul-admin/dist/index.html | 4 +- soul-admin/package.json | 11 + soul-admin/pnpm-lock.yaml | 715 +++++++- soul-admin/src/App.tsx | 2 + soul-admin/src/components/RichEditor.css | 196 +++ soul-admin/src/components/RichEditor.tsx | 335 ++++ .../modules/user/UserDetailModal.tsx | 735 +++++++- soul-admin/src/layouts/AdminLayout.tsx | 2 + .../src/pages/chapters/ChaptersPage.tsx | 337 ++++ soul-admin/src/pages/content/ChapterTree.tsx | 478 +++++- soul-admin/src/pages/content/ContentPage.tsx | 1480 ++++++++++++++--- .../src/pages/dashboard/DashboardPage.tsx | 146 +- .../pages/distribution/DistributionPage.tsx | 99 +- .../pages/find-partner/FindPartnerPage.tsx | 87 + .../find-partner/tabs/CKBConfigPanel.tsx | 380 +++++ .../pages/find-partner/tabs/CKBStatsTab.tsx | 197 +++ .../find-partner/tabs/FindPartnerTab.tsx | 24 + .../pages/find-partner/tabs/MatchPoolTab.tsx | 358 ++++ .../find-partner/tabs/MatchRecordsTab.tsx | 140 ++ .../find-partner/tabs/MentorBookingTab.tsx | 86 + .../src/pages/find-partner/tabs/MentorTab.tsx | 28 + .../find-partner/tabs/ResourceDockingTab.tsx | 139 ++ .../find-partner/tabs/TeamRecruitTab.tsx | 86 + soul-admin/src/pages/mentors/MentorsPage.tsx | 6 +- .../ReferralSettingsPage.tsx | 6 +- .../src/pages/settings/SettingsPage.tsx | 78 +- soul-admin/src/pages/users/UsersPage.tsx | 1325 ++++++++------- soul-admin/tsconfig.tsbuildinfo | 2 +- soul-api/internal/database/database.go | 6 + soul-api/internal/handler/db_book.go | 62 +- soul-api/internal/handler/db_ckb_leads.go | 138 ++ soul-api/internal/handler/db_link_tag.go | 75 + soul-api/internal/handler/db_person.go | 71 + soul-api/internal/handler/match_records.go | 55 + soul-api/internal/handler/user.go | 40 +- soul-api/internal/handler/vip.go | 8 +- soul-api/internal/model/link_tag.go | 18 + soul-api/internal/model/person.go | 15 + soul-api/internal/router/router.go | 9 + soul-api/scripts/add-persons-link-tags.sql | 23 + .../服务器管理/Windows-macOS虚拟机安装指南.md | 157 ++ .../服务器管理/scripts/macOS-VM-setup-auto.sh | 24 + .../服务器管理/scripts/macOS-VM-一键安装.ps1 | 51 + .../scripts/macOS-VM-安装-步骤1-WSL.ps1 | 13 + .../scripts/macOS-VM-安装-步骤2-克隆与检查.ps1 | 44 + .../服务器管理/scripts/macOS-VM-安装-简化版.bat | 27 + 60 files changed, 8387 insertions(+), 1583 deletions(-) create mode 100644 .cursor/meeting/2026-03-09_devlop与yongxu分支差异分析会议.md create mode 100644 .cursor/meeting/2026-03-09_dev分支需求分析与yongxu迁移方案.md create mode 160000 Mycontent-temp create mode 100644 soul-admin/dist/assets/index-CXOwdtCt.css delete mode 100644 soul-admin/dist/assets/index-DP984f3K.css create mode 100644 soul-admin/dist/assets/index-DsLRWYbk.js delete mode 100644 soul-admin/dist/assets/index-iq3PeMuM.js create mode 100644 soul-admin/src/components/RichEditor.css create mode 100644 soul-admin/src/components/RichEditor.tsx create mode 100644 soul-admin/src/pages/chapters/ChaptersPage.tsx create mode 100644 soul-admin/src/pages/find-partner/FindPartnerPage.tsx create mode 100644 soul-admin/src/pages/find-partner/tabs/CKBConfigPanel.tsx create mode 100644 soul-admin/src/pages/find-partner/tabs/CKBStatsTab.tsx create mode 100644 soul-admin/src/pages/find-partner/tabs/FindPartnerTab.tsx create mode 100644 soul-admin/src/pages/find-partner/tabs/MatchPoolTab.tsx create mode 100644 soul-admin/src/pages/find-partner/tabs/MatchRecordsTab.tsx create mode 100644 soul-admin/src/pages/find-partner/tabs/MentorBookingTab.tsx create mode 100644 soul-admin/src/pages/find-partner/tabs/MentorTab.tsx create mode 100644 soul-admin/src/pages/find-partner/tabs/ResourceDockingTab.tsx create mode 100644 soul-admin/src/pages/find-partner/tabs/TeamRecruitTab.tsx create mode 100644 soul-api/internal/handler/db_ckb_leads.go create mode 100644 soul-api/internal/handler/db_link_tag.go create mode 100644 soul-api/internal/handler/db_person.go create mode 100644 soul-api/internal/model/link_tag.go create mode 100644 soul-api/internal/model/person.go create mode 100644 soul-api/scripts/add-persons-link-tags.sql create mode 100644 开发文档/服务器管理/Windows-macOS虚拟机安装指南.md create mode 100644 开发文档/服务器管理/scripts/macOS-VM-setup-auto.sh create mode 100644 开发文档/服务器管理/scripts/macOS-VM-一键安装.ps1 create mode 100644 开发文档/服务器管理/scripts/macOS-VM-安装-步骤1-WSL.ps1 create mode 100644 开发文档/服务器管理/scripts/macOS-VM-安装-步骤2-克隆与检查.ps1 create mode 100644 开发文档/服务器管理/scripts/macOS-VM-安装-简化版.bat diff --git a/.cursor/meeting/2026-03-09_devlop与yongxu分支差异分析会议.md b/.cursor/meeting/2026-03-09_devlop与yongxu分支差异分析会议.md new file mode 100644 index 00000000..d7bad790 --- /dev/null +++ b/.cursor/meeting/2026-03-09_devlop与yongxu分支差异分析会议.md @@ -0,0 +1,157 @@ +# 会议纪要 - 2026-03-09 | devlop 与 yongxu 分支差异分析 + +> 本文件由**助理橙子**在会议结束后自动生成。 + +--- + +## 基本信息 + +- **时间**:2026-03-09 +- **议题**:分析 devlop(dev 分支 / Mycontent-temp)与 yongxu(当前分支)两个项目的区别 +- **触发方式**:开个会议 +- **参与角色**:产品经理、后端开发、管理端开发工程师、小程序开发工程师、测试人员 + +--- + +## 各角色发言 + +### 【产品经理】 + +**分支定位**: +- **devlop**:老板的老板主改,侧重内容管理、用户管理、找伙伴等管理端能力,开发文档已删除(迁移至他处) +- **yongxu**:你主改,侧重 C 端体验:@提及、一键收款、个人资料页、找伙伴、推荐码绑定、分享带 ref、退款等 + +**差异要点**: +- devlop 删除了整个 `开发文档/` 目录(约 100+ 文件),yongxu 保留 +- 需求文档(20260308 内容管理、用户管理、找伙伴)在 devlop 侧有更新,yongxu 侧沿用旧版 +- 合并后需确保:C 端功能(@提及、推荐码、一键收款)不丢,管理端能力(ContentPage、FindPartnerPage、UsersPage)不丢 + +### 【后端开发】 + +**devlop 独有**(yongxu 没有): +- `admin_dashboard.go`、`admin_rfm.go`、`admin_shensheshou.go`、`admin_user_rules.go` +- `db_book.go`、`db_person.go`(db 路由组扩展) +- `ckb.go` 大改(存客宝扩展) +- `match.go`、`match_records.go` 扩展 +- `book.go`、`user.go`、`cron.go` 等逻辑更新 +- `person.go`、`user_rule.go` 等 model 新增 +- 路由、数据库、配置等变更 + +**yongxu 独有**(devlop 没有): +- @提及相关接口、免费章节判断、存客宝限频、退款逻辑等(在共同祖先 90d32a51 之后) + +**共同修改文件(易冲突)**: +- `soul-api/internal/handler/miniprogram.go` +- `soul-api/internal/config/config.go` +- `soul-api/internal/database/database.go` +- `soul-api/internal/router/router.go` + +### 【管理端开发工程师】 + +**devlop 独有**(yongxu 没有): +- `ContentPage.tsx` 大改(约 1395 行变更) +- `ChapterTree.tsx`、`ChaptersPage.tsx` 新增/重构 +- `FindPartnerPage.tsx` 及多 Tab:CKBConfigPanel、CKBStatsTab、FindPartnerTab、MatchPoolTab、MatchRecordsTab、MentorBookingTab、MentorTab、ResourceDockingTab、TeamRecruitTab +- `RichEditor.tsx`、`UserDetailModal.tsx` 扩展 +- `UsersPage.tsx` 大改(约 1267 行) +- `DashboardPage.tsx`、`DistributionPage.tsx`、`SettingsPage.tsx` 等更新 +- `client.ts`、`AdminLayout.tsx`、`App.tsx` 配置调整 + +**yongxu**:管理端改动较少,主要在小程序侧 + +**合并策略**:以 devlop 管理端为主,yongxu 若有管理端改动需手工合入 + +### 【小程序开发工程师】 + +**yongxu 独有**(相对共同祖先 90d32a51): +- `app.js`:baseUrl 真实后端、goBackOrToHome、推荐码/访问记录、checkUpdate +- `read/*`:@提及解析与高亮、mid 优先跳转 +- `chapters/*`:章节列表、分享 +- `index/*`:首页、已读/待读 +- `my/*`:个人中心、导航栏 + +**devlop 也改了同一批文件**: +- `miniprogram/app.js`、`app.json` +- `miniprogram/pages/chapters/chapters.js`、`chapters.json` +- `miniprogram/pages/index/index.js`、`index.wxml` +- `miniprogram/pages/my/my.js` +- `miniprogram/pages/read/read.js`、`read.wxml`、`read.wxss` +- `miniprogram/project.private.config.json` +- `miniprogram/utils/readingTracker.js` + +**合并重点**:上述文件两分支均有修改,合并时需保留 yongxu 的 @提及、推荐码、baseUrl、goBackOrToHome 等业务逻辑,同时接纳 devlop 的其它改动(若有) + +### 【测试人员】 + +合并后需做: +- 三端联调:小程序↔API、管理端↔API +- 回归测试:@提及、推荐码、找伙伴、内容管理、用户管理、存客宝、一键收款、退款 +- 建议合并完成后拉一份回归清单,逐项验证 + +--- + +## 讨论过程 + +- 用户明确:Mycontent-temp 对应 dev 分支(devlop),当前打开的是 yongxu 分支 +- 基于 `git diff`、`git log` 分析两分支自共同祖先 90d32a51 以来的差异 +- 共识:devlop 改动量大(248 文件、约 6 万行变更),yongxu 改动小(7 文件、约 366 行),合并时需分模块处理 + +--- + +## 会议决议 + +1. **差异总结**:devlop 侧重管理端与脚本(内容管理、找伙伴、飞书导出、开发文档删除);yongxu 侧重 C 端(@提及、一键收款、推荐码、baseUrl 真实后端) +2. **合并策略**: + - 管理端、soul-api 新增能力:以 devlop 为主 + - 小程序:保留 yongxu 的 @提及、推荐码、goBackOrToHome、baseUrl 等,与 devlop 改动手工合并 + - 开发文档:若需保留,从 yongxu 恢复;若已迁移他处,可沿用 devlop 的删除 +3. **待确认项**:开发文档最终保留在仓库内还是迁移到外部?合并冲突时以哪边为准(按模块已约定) + +--- + +## 待办事项 + +| 责任角色 | 任务 | 优先级 | 截止建议 | +|---------|------|--------|---------| +| 用户 | 确认开发文档保留策略 | 中 | 合并前 | +| 用户 | 执行分支合并(如 git merge devlop 或 git merge yongxu) | 高 | 待用户操作 | +| 助理橙子 | 合并时协助逐文件解决冲突 | 高 | 用户合并时 | +| 测试人员 | 合并后回归测试 | 中 | 合并完成 | + +--- + +## 问题与作答区 + +| # | 问题 | 责任角色 | 作答 | +|---|------|---------|------| +| 1 | 开发文档最终保留在仓库内还是迁移到外部? | 用户 | (待补充) | +| 2 | 合并时以 devlop 为基准合并 yongxu,还是以 yongxu 为基准合并 devlop? | 用户 | (待补充) | + +--- + +## 两分支差异速查表 + +| 维度 | devlop(dev 分支) | yongxu(当前分支) | +|------|-------------------|---------------------| +| 共同祖先 | 90d32a51 | 90d32a51 | +| 独有提交数 | 约 200+ | 2 | +| 变更文件数 | 248 | 7 | +| 开发文档 | 已删除 | 保留 | +| 小程序 | 有改动(与 yongxu 重叠) | @提及、推荐码、baseUrl、goBackOrToHome 等 | +| 管理端 | ContentPage、FindPartnerPage、UsersPage 等大改 | 改动少 | +| soul-api | admin_*、db_*、ckb、match 等扩展 | 免费章节、存客宝限频、退款等 | +| 脚本 | 飞书导出、content_upload、Gitea 推送等 | 无 | +| 会议纪要 | 合并策略、管理端与 API 分析等 | 代码完整性分析、各成员功能检测 | + +--- + +## 各角色经验与业务理解更新 + +### 团队共享 + +- 分支差异分析会议:先确定共同祖先,再用 `git diff --stat`、`git log` 分模块梳理,便于制定合并策略 +- 多分支合并时按模块约定「以谁为主」:管理端/soul-api 以 devlop 为主,小程序保留 yongxu 业务逻辑 + +--- + +*会议纪要由助理橙子生成 | 各角色经验已同步至 `agent/{角色}/evolution/2026-03-09.md`* diff --git a/.cursor/meeting/2026-03-09_dev分支需求分析与yongxu迁移方案.md b/.cursor/meeting/2026-03-09_dev分支需求分析与yongxu迁移方案.md new file mode 100644 index 00000000..2e0eb21b --- /dev/null +++ b/.cursor/meeting/2026-03-09_dev分支需求分析与yongxu迁移方案.md @@ -0,0 +1,165 @@ +# dev 分支需求分析与 yongxu 迁移方案 + +> 基于用户反馈:dev 分支只改了样式,未考虑后端/API/小程序三端协调,导致 bug 或功能不全;yongxu 分支功能完善。本文档分析 dev 需求、识别三端缺口,并给出「新功能迁入 yongxu + 补全功能」的执行方案。 + +--- + +## 一、dev 分支变更概览 + +### 1.1 变更性质(用户结论) + +- **dev 侧重**:管理端 UI/样式、新页面布局 +- **问题**:未同步考虑 soul-api、miniprogram 的接口与逻辑,导致: + - 管理端新页面调用的接口在 yongxu 的 soul-api 中不存在或不全 + - 小程序端与 dev 管理端配置/数据模型不一致 + - 三端联调时出现 bug 或功能不全 + +### 1.2 dev 相对 yongxu 的增量(按模块) + +| 模块 | dev 新增/改动 | 依赖的 API/能力 | +|------|---------------|-----------------| +| **soul-admin** | ContentPage 大改、ChapterTree、RichEditor、@提及、persons、link-tags 配置 | `/api/db/book`(含 section-orders)、`/api/db/persons`、`/api/db/link-tags`、`/api/db/config/full?key=xxx` | +| **soul-admin** | FindPartnerPage + 多 Tab(CKBConfigPanel、CKBStatsTab、MatchPoolTab 等) | `/api/db/config/full?key=ckb_config`、`/api/db/ckb-leads` | +| **soul-admin** | UsersPage 大改、UserDetailModal 扩展 | `/api/db/users` 已有,可能需扩展字段 | +| **soul-admin** | ChaptersPage 新增、DashboardPage 调整 | 依赖 db/book、db/users 等 | +| **soul-admin** | DistributionPage、SettingsPage 等样式调整 | 现有 admin 接口 | +| **soul-api** | admin_dashboard、admin_rfm、admin_shensheshou、admin_user_rules | 新增 handler | +| **soul-api** | db_person、db_book 扩展(section-orders、move-sections) | 扩展 db_book action | +| **soul-api** | ckb 扩展、match/match_records 扩展 | 扩展 ckb、match handler | +| **miniprogram** | 部分页面简化/样式调整 | 与 yongxu 的 @提及、推荐码等可能冲突 | + +--- + +## 二、三端缺口分析(yongxu 当前缺失) + +### 2.1 soul-api 缺口(管理端新页面依赖) + +| 接口/能力 | dev 管理端调用 | yongxu 是否已有 | 缺口说明 | +|-----------|---------------|-----------------|----------| +| `GET/POST/DELETE /api/db/persons` | ContentPage @提及人物配置 | ❌ 无 | 需新增 persons 表、model、handler | +| `GET/POST/DELETE /api/db/link-tags` | ContentPage 链接标签配置 | ❌ 无 | 需新增 link_tags 表、model、handler | +| `GET /api/db/book?action=section-orders&id=xxx` | ContentPage 章节内排序 | ❌ 无 | 需在 db_book 中扩展 action | +| `PUT /api/db/book` action=move-sections | ContentPage 跨章移动 | ❌ 无 | 需在 db_book 中扩展 | +| `GET /api/db/config/full?key=article_ranking_weights` | ContentPage | ✅ 有 | DBConfigGet 已支持 | +| `GET /api/db/config/full?key=pinned_section_ids` | ContentPage | ✅ 有 | 同上 | +| `GET /api/db/config/full?key=unpaid_preview_percent` | ContentPage | ✅ 有 | 同上 | +| `GET /api/db/config/full?key=ckb_config` | FindPartnerPage CKBConfigPanel | ✅ 有 | 同上 | +| `GET /api/db/ckb-leads?mode=submitted&page=1&pageSize=50` | FindPartnerPage 存客宝线索 | ❌ 无 | 需新增 ckb_leads 相关接口 | +| admin_dashboard、admin_rfm、admin_shensheshou、admin_user_rules | Dashboard、神奢手等 | ❌ 无 | 可选,按业务需要 | + +### 2.2 小程序端 + +- **yongxu 已完善**:@提及、推荐码、baseUrl、goBackOrToHome、一键收款、免费章节、存客宝限频、退款等 +- **策略**:**保留 yongxu 小程序全部逻辑**,不引入 dev 对 miniprogram 的简化(dev 可能删减了功能) + +### 2.3 管理端(soul-admin) + +- **yongxu 已有**:ContentPage、ChapterTree、UsersPage、DashboardPage 等基础版本 +- **dev 增量**:更丰富的 ContentPage(persons、link-tags、RichEditor @提及)、FindPartnerPage 整页、UsersPage 扩展 +- **策略**:在 soul-api 补全接口后,再选择性迁入 dev 的页面组件 + +--- + +## 三、迁移原则 + +1. **基准分支**:yongxu(功能完善、三端协调良好) +2. **不引入**:dev 对 miniprogram 的改动(避免覆盖 yongxu 的 @提及、推荐码等) +3. **分阶段**:先补 soul-api 缺口 → 再迁入 soul-admin 新页面/组件 +4. **三端协调**:每迁入一个管理端功能,必须确保 soul-api 已有对应接口,且小程序若依赖该配置则已对齐 + +--- + +## 四、执行方案(按优先级) + +### 阶段 1:soul-api 补全(必须) + +| 序号 | 任务 | 说明 | +|------|------|------| +| 1.1 | 新增 `db/persons` | model.Person、表 persons,GET/POST/DELETE,供 ContentPage @提及人物配置 | +| 1.2 | 新增 `db/link-tags` | model.LinkTag、表 link_tags,GET/POST/DELETE,供 ContentPage 链接标签 | +| 1.3 | 扩展 `db/book` | 增加 action=section-orders、action=move-sections(若 ContentPage 需要) | +| 1.4 | 新增 `db/ckb-leads` | 若存在 ckb_leads 表,GET 支持 mode=submitted/contact 分页;否则先建表再实现 | + +### 阶段 2:soul-admin 迁入(在阶段 1 完成后) + +| 序号 | 任务 | 说明 | +|------|------|------| +| 2.1 | ContentPage 增强 | 从 dev 迁入 persons、link-tags 配置区,RichEditor @提及(需 persons 接口) | +| 2.2 | FindPartnerPage | 从 dev 迁入整页 + Tab(CKBConfigPanel、CKBStatsTab 等),需 ckb_config、ckb-leads 接口 | +| 2.3 | UsersPage 扩展 | 从 dev 迁入 UserDetailModal 等扩展(若字段与 yongxu 的 db/users 一致) | +| 2.4 | 菜单与路由 | 在 AdminLayout、App.tsx 中增加 FindPartner 入口(若尚未有) | + +### 阶段 3:可选(按业务需要) + +| 序号 | 任务 | 说明 | +|------|------|------| +| 3.1 | admin_dashboard、admin_rfm 等 | 若 Dashboard 需要新统计维度,再补充 | +| 3.2 | dev 的 scripts、飞书导出等 | 与三端功能无直接关系,可单独评估 | + +--- + +## 五、补全功能清单(可直接用于开发) + +### 5.1 soul-api 必须补全 + +``` +[ ] 1. persons 表 + model + GET/POST/DELETE /api/db/persons +[ ] 2. link_tags 表 + model + GET/POST/DELETE /api/db/link-tags +[ ] 3. db_book 扩展:GET ?action=section-orders&id=xxx +[ ] 4. db_book 扩展:PUT action=move-sections(若 ContentPage 需要) +[ ] 5. ckb_leads 表(若无)+ GET /api/db/ckb-leads?mode=xxx&page=1&pageSize=50 +``` + +### 5.2 soul-admin 迁入(依赖 5.1) + +``` +[ ] 6. ContentPage:persons 配置区、link-tags 配置区 +[ ] 7. ContentPage:RichEditor @提及(调用 persons) +[ ] 8. FindPartnerPage + Tabs(CKBConfigPanel、CKBStatsTab、FindPartnerTab 等) +[ ] 9. AdminLayout:增加「找伙伴」菜单项(若尚无) +[ ] 10. UsersPage:UserDetailModal 扩展(按需) +``` + +### 5.3 小程序 + +``` +[ ] 无需变更,保留 yongxu 全部逻辑 +``` + +--- + +## 六、迁移操作建议 + +### 6.1 不推荐直接 merge devlop + +- dev 与 yongxu 在 miniprogram、部分 soul-api 上存在冲突 +- 直接 merge 会覆盖 yongxu 的完善功能 + +### 6.2 推荐方式 + +1. **保持当前在 yongxu 分支** +2. **按阶段 1**:在 yongxu 上直接开发 soul-api 补全(persons、link-tags、db_book 扩展、ckb-leads) +3. **按阶段 2**:用 `git show devlop:path/to/file` 取出 dev 的 soul-admin 文件,手工合并到 yongxu,并确认调用的接口已在 soul-api 中存在 +4. **每完成一个功能**:过 soul-change-checklist,做三端联调验证 + +### 6.3 冲突文件处理(若必须 diff 参考) + +- `miniprogram/*`:**以 yongxu 为准**,不采纳 dev 的改动 +- `soul-admin/*`:选择性采纳 dev 的 UI/组件,确保调用的 API 已在 yongxu 的 soul-api 中实现 +- `soul-api/*`:以 yongxu 为基础,缺什么补什么(persons、link-tags、ckb-leads 等) + +--- + +## 七、总结 + +| 项目 | 结论 | +|------|------| +| 基准 | yongxu | +| dev 价值 | 管理端 UI 增强(ContentPage、FindPartnerPage、UsersPage) | +| dev 问题 | 未配套 soul-api 的 persons、link-tags、ckb-leads 等,导致功能不全 | +| 迁移路径 | 先补 soul-api → 再迁入 soul-admin 新页面 | +| 小程序 | 不改动,保留 yongxu | + +--- + +*文档生成:2026-03-09 | 供开发执行参考* diff --git a/.cursor/meeting/README.md b/.cursor/meeting/README.md index 1fa81421..ea9746a1 100644 --- a/.cursor/meeting/README.md +++ b/.cursor/meeting/README.md @@ -66,3 +66,5 @@ YYYY-MM-DD_会议主题.md | 2026-03-05 | 超级个体解锁眼睛需求分析 | 产品、小程序 | [2026-03-05_超级个体解锁眼睛需求分析.md](2026-03-05_超级个体解锁眼睛需求分析.md) | | 2026-03-05 | 文章详情 @某人 高亮与一键加好友方案讨论 | 产品、后端、管理端、小程序、测试 | [2026-03-05_文章详情@某人加好友方案讨论.md](2026-03-05_文章详情@某人加好友方案讨论.md) | | 2026-03-09 | 代码完整性分析与分支合并准备 | 产品、后端、管理端、小程序、测试 | [2026-03-09_代码完整性分析与分支合并准备.md](2026-03-09_代码完整性分析与分支合并准备.md) | +| 2026-03-09 | devlop 与 yongxu 分支差异分析 | 产品、后端、管理端、小程序、测试 | [2026-03-09_devlop与yongxu分支差异分析会议.md](2026-03-09_devlop与yongxu分支差异分析会议.md) | +| 2026-03-09 | dev 分支需求分析与 yongxu 迁移方案 | 产品、后端、管理端、小程序 | [2026-03-09_dev分支需求分析与yongxu迁移方案.md](2026-03-09_dev分支需求分析与yongxu迁移方案.md) | diff --git a/Mycontent-temp b/Mycontent-temp new file mode 160000 index 00000000..f00315d7 --- /dev/null +++ b/Mycontent-temp @@ -0,0 +1 @@ +Subproject commit f00315d7854bdf6ecc0484776f5e99372f739573 diff --git a/miniprogram/app.js b/miniprogram/app.js index 1abc1ba6..d564eb03 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -8,9 +8,9 @@ const { parseScene } = require('./utils/scene.js') App({ globalData: { // API基础地址 - 连接真实后端 - baseUrl: 'https://soulapi.quwanzhi.com', + // baseUrl: 'https://soulapi.quwanzhi.com', // baseUrl: 'https://souldev.quwanzhi.com', - // baseUrl: 'http://localhost:8080', + baseUrl: 'http://localhost:8080', // 小程序配置 - 真实AppID @@ -34,6 +34,9 @@ App({ // 购买记录 purchasedSections: [], hasFullBook: false, + // VIP 会员(365天,包含增值版免费;与 hasFullBook=9.9 买断不同) + isVip: false, + vipExpireDate: '', // 已读章节(仅统计有权限打开过的章节,用于首页「已读/待读」) readSectionIds: [], @@ -227,6 +230,8 @@ App({ this.globalData.isLoggedIn = true this.globalData.purchasedSections = userInfo.purchasedSections || [] this.globalData.hasFullBook = userInfo.hasFullBook || false + this.globalData.isVip = userInfo.isVip || false + this.globalData.vipExpireDate = userInfo.vipExpireDate || '' } } catch (e) { console.error('检查登录状态失败:', e) diff --git a/miniprogram/pages/chapters/chapters.js b/miniprogram/pages/chapters/chapters.js index 154ffa44..71e77704 100644 --- a/miniprogram/pages/chapters/chapters.js +++ b/miniprogram/pages/chapters/chapters.js @@ -16,6 +16,7 @@ Page({ // 用户状态 isLoggedIn: false, hasFullBook: false, + isVip: false, purchasedSections: [], // 书籍数据 - 完整真实标题 @@ -212,6 +213,7 @@ Page({ navBarHeight: app.globalData.navBarHeight }) this.updateUserStatus() + this.loadVipStatus() this.loadChaptersOnce() }, @@ -258,13 +260,19 @@ Page({ }) } const ch = part.chapters.get(cid) + const isPremium = + r.editionPremium === true || + r.edition_premium === true || + r.edition_premium === 1 || + r.edition_premium === '1' ch.sections.push({ id: r.id, mid: r.mid ?? r.MID ?? 0, title: r.sectionTitle || r.section_title || r.title || '', isFree: r.isFree === true || (r.price !== undefined && r.price === 0), price: r.price ?? 1, - isNew: r.isNew === true || r.is_new === true + isNew: r.isNew === true || r.is_new === true, + isPremium }) }) const bookData = Array.from(partMap.values()).map(p => ({ @@ -310,12 +318,33 @@ Page({ } } this.updateUserStatus() + this.loadVipStatus() + }, + + // 拉取 VIP 状态(isVip=会员,hasFullBook=9.9 买断) + async loadVipStatus() { + const userId = app.globalData.userInfo?.id + if (!userId) return + try { + const res = await app.request({ url: `/api/miniprogram/vip/status?userId=${userId}`, silent: true, timeout: 3000 }) + if (res?.success) { + app.globalData.isVip = !!res.data?.isVip + app.globalData.vipExpireDate = res.data?.expireDate || '' + this.setData({ isVip: app.globalData.isVip }) + const userInfo = app.globalData.userInfo || {} + userInfo.isVip = app.globalData.isVip + userInfo.vipExpireDate = app.globalData.vipExpireDate + wx.setStorageSync('userInfo', userInfo) + } + } catch (e) { + // 静默失败不影响目录展示 + } }, // 更新用户状态 updateUserStatus() { - const { isLoggedIn, hasFullBook, purchasedSections } = app.globalData - this.setData({ isLoggedIn, hasFullBook, purchasedSections }) + const { isLoggedIn, hasFullBook, purchasedSections, isVip } = app.globalData + this.setData({ isLoggedIn, hasFullBook, purchasedSections, isVip }) }, // 切换展开状态 @@ -335,8 +364,9 @@ Page({ }, // 检查是否已购买 - hasPurchased(sectionId) { - if (this.data.hasFullBook) return true + hasPurchased(sectionId, isPremium) { + if (this.data.isVip) return true + if (!isPremium && this.data.hasFullBook) return true return this.data.purchasedSections.includes(sectionId) }, diff --git a/miniprogram/pages/chapters/chapters.wxml b/miniprogram/pages/chapters/chapters.wxml index b72f0d33..9c25e577 100644 --- a/miniprogram/pages/chapters/chapters.wxml +++ b/miniprogram/pages/chapters/chapters.wxml @@ -73,13 +73,14 @@ - {{section.isFree || hasFullBook || purchasedSections.indexOf(section.id) > -1 ? '○' : '●'}} - {{section.id}} {{section.title}} + {{section.isFree || isVip || (!section.isPremium && hasFullBook) || purchasedSections.indexOf(section.id) > -1 ? '○' : '●'}} + {{section.id}} {{section.title}} NEW + 增值 免费 - 已购 + 已解锁 ¥{{section.price}} diff --git a/miniprogram/pages/chapters/chapters.wxss b/miniprogram/pages/chapters/chapters.wxss index 0b8d475c..890390e8 100644 --- a/miniprogram/pages/chapters/chapters.wxss +++ b/miniprogram/pages/chapters/chapters.wxss @@ -232,6 +232,14 @@ margin-left: 8rpx; } +.tag-vip { + background: rgba(255, 215, 0, 0.12); + color: #FFD700; + font-size: 20rpx; + padding: 2rpx 8rpx; + margin-left: 8rpx; +} + .text-brand { color: #00CED1; } diff --git a/miniprogram/pages/member-detail/member-detail.js b/miniprogram/pages/member-detail/member-detail.js index 1778c371..7c0255d1 100644 --- a/miniprogram/pages/member-detail/member-detail.js +++ b/miniprogram/pages/member-detail/member-detail.js @@ -148,7 +148,7 @@ Page({ } const d = this._getUnlockData(member.id) if (d[field]) return - const isVip = app.globalData.hasFullBook + const isVip = app.globalData.isVip const usedFree = this._hasUsedFreeForMember(member.id) if (isVip || !usedFree) { this._addUnlock(member.id, field) diff --git a/miniprogram/pages/my/my.js b/miniprogram/pages/my/my.js index 8b934c9b..d1db7bea 100644 --- a/miniprogram/pages/my/my.js +++ b/miniprogram/pages/my/my.js @@ -742,20 +742,25 @@ Page({ }) }, - // VIP状态查询(hasFullBook 优先,兼容模拟支付等本地已置 VIP 的情况) + // VIP状态查询(注意:hasFullBook=9.9 买断,不等同 VIP) async loadVipStatus() { - if (app.globalData.hasFullBook) { - this.setData({ isVip: true, vipExpireDate: this.data.vipExpireDate || '' }) - } const userId = app.globalData.userInfo?.id if (!userId) return try { const res = await app.request({ url: `/api/miniprogram/vip/status?userId=${userId}`, silent: true }) if (res?.success) { + const isVip = !!res.data?.isVip + app.globalData.isVip = isVip + app.globalData.vipExpireDate = res.data?.expireDate || '' this.setData({ - isVip: res.data?.isVip || app.globalData.hasFullBook, + isVip, vipExpireDate: res.data?.expireDate || this.data.vipExpireDate || '' }) + // 同步到 storage,便于其他页面复用(注意:hasFullBook=买断,isVip=会员) + const userInfo = app.globalData.userInfo || {} + userInfo.isVip = isVip + userInfo.vipExpireDate = res.data?.expireDate || '' + wx.setStorageSync('userInfo', userInfo) } } catch (e) { console.log('[My] VIP查询失败', e) } }, diff --git a/soul-admin/dist/assets/index-CXOwdtCt.css b/soul-admin/dist/assets/index-CXOwdtCt.css new file mode 100644 index 00000000..1ff5eb7c --- /dev/null +++ b/soul-admin/dist/assets/index-CXOwdtCt.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}.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\/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-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-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-\[70vh\]{height:70vh}.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-\[200px\]{max-height:200px}.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-\[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-\[300px\]{min-height:300px}.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-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-\[\#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)}.py-24{padding-block:calc(var(--spacing)*24)}.pt-0{padding-top:calc(var(--spacing)*0)}.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}.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-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-400\/10:hover{background-color:#fcbb001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-400\/10:hover{background-color:color-mix(in oklab,var(--color-amber-400)10%,transparent)}}.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-400\/10:hover{background-color:#fac8001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-400\/10:hover{background-color:color-mix(in oklab,var(--color-yellow-400)10%,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\:text-yellow-400:hover{color:var(--color-yellow-400)}.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\:max-w-lg{max-width:var(--container-lg)}.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-DP984f3K.css b/soul-admin/dist/assets/index-DP984f3K.css deleted file mode 100644 index 79eee7ca..00000000 --- a/soul-admin/dist/assets/index-DP984f3K.css +++ /dev/null @@ -1 +0,0 @@ -/*! 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-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--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-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-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-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-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-1\/2{top:50%}.top-1\/4{top:25%}.top-4{top:calc(var(--spacing)*4)}.top-\[50\%\]{top:50%}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.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}.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-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.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)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.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-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)}.line-clamp-2{-webkit-line-clamp:2;-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-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-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-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-\[70vh\]{height:70vh}.h-full{height:100%}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[200px\]{max-height:200px}.max-h-\[300px\]{max-height:300px}.min-h-\[40px\]{min-height:40px}.min-h-\[80px\]{min-height:80px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.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-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-48{width:calc(var(--spacing)*48)}.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-4xl{max-width:var(--container-4xl)}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[200px\]{max-width:200px}.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-\[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-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}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.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))}.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-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.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-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}: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-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)}}.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\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.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\/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-gray-500{border-color:var(--color-gray-500)}.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\/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-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\/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-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\/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}.bg-\[\#0a1628\]{background-color:#0a1628}.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-\[\#162840\]{background-color:#162840}.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\/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-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-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\/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-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-\[\#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))}.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))}.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}.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-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\.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-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-8{padding-block:calc(var(--spacing)*8)}.py-12{padding-block:calc(var(--spacing)*12)}.py-20{padding-block:calc(var(--spacing)*20)}.py-24{padding-block:calc(var(--spacing)*24)}.pt-0{padding-top:calc(var(--spacing)*0)}.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)}.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-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-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-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\]\/40{color:#38bdac66}.text-\[\#169BD7\]{color:#169bd7}.text-\[\#1677FF\]{color:#1677ff}.text-\[\#FFD700\]{color:gold}.text-amber-400{color:var(--color-amber-400)}.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-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-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\/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-400{color:var(--color-purple-400)}.text-red-400{color:var(--color-red-400)}.text-white{color:var(--color-white)}.text-yellow-400{color:var(--color-yellow-400)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.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-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-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\: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)}@media(hover:hover){.hover\:border-\[\#38bdac\]\/30:hover{border-color:#38bdac4d}.hover\:border-\[\#38bdac\]\/50:hover{border-color:#38bdac80}.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\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-400\/10:hover{background-color:#fcbb001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-400\/10:hover{background-color:color-mix(in oklab,var(--color-amber-400)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-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\/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\/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-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-yellow-400\/10:hover{background-color:#fac8001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-400\/10:hover{background-color:color-mix(in oklab,var(--color-yellow-400)10%,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\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-blue-400:hover{color:var(--color-blue-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\:text-yellow-400:hover{color:var(--color-yellow-400)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.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-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\]\: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\]\: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\:max-w-lg{max-width:var(--container-lg)}.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\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,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-DsLRWYbk.js b/soul-admin/dist/assets/index-DsLRWYbk.js new file mode 100644 index 00000000..5e31d155 --- /dev/null +++ b/soul-admin/dist/assets/index-DsLRWYbk.js @@ -0,0 +1,774 @@ +function a3(t,e){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();function yN(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lm={exports:{}},Jl={},cm={exports:{}},lt={};/** + * @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 lb;function o3(){if(lb)return lt;lb=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function g(L){return L===null||typeof L!="object"?null:(L=m&&L[m]||L["@@iterator"],typeof L=="function"?L:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,j={};function w(L,H,ue){this.props=L,this.context=H,this.refs=j,this.updater=ue||y}w.prototype.isReactComponent={},w.prototype.setState=function(L,H){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,H,"setState")},w.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function k(){}k.prototype=w.prototype;function E(L,H,ue){this.props=L,this.context=H,this.refs=j,this.updater=ue||y}var C=E.prototype=new k;C.constructor=E,v(C,w.prototype),C.isPureReactComponent=!0;var M=Array.isArray,D=Object.prototype.hasOwnProperty,F={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function I(L,H,ue){var U,he={},Q=null,ee=null;if(H!=null)for(U in H.ref!==void 0&&(ee=H.ref),H.key!==void 0&&(Q=""+H.key),H)D.call(H,U)&&!R.hasOwnProperty(U)&&(he[U]=H[U]);var de=arguments.length-2;if(de===1)he.children=ue;else if(1>>1,H=V[L];if(0>>1;Ls(he,Y))Qs(ee,he)?(V[L]=ee,V[Q]=Y,L=Q):(V[L]=he,V[U]=Y,L=U);else if(Qs(ee,Y))V[L]=ee,V[Q]=Y,L=Q;else break e}}return ae}function s(V,ae){var Y=V.sortIndex-ae.sortIndex;return Y!==0?Y:V.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,m=null,g=3,y=!1,v=!1,j=!1,w=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(V){for(var ae=n(h);ae!==null;){if(ae.callback===null)r(h);else if(ae.startTime<=V)r(h),ae.sortIndex=ae.expirationTime,e(u,ae);else break;ae=n(h)}}function M(V){if(j=!1,C(V),!v)if(n(u)!==null)v=!0,$(D);else{var ae=n(h);ae!==null&&oe(M,ae.startTime-V)}}function D(V,ae){v=!1,j&&(j=!1,k(I),I=-1),y=!0;var Y=g;try{for(C(ae),m=n(u);m!==null&&(!(m.expirationTime>ae)||V&&!W());){var L=m.callback;if(typeof L=="function"){m.callback=null,g=m.priorityLevel;var H=L(m.expirationTime<=ae);ae=t.unstable_now(),typeof H=="function"?m.callback=H:m===n(u)&&r(u),C(ae)}else r(u);m=n(u)}if(m!==null)var ue=!0;else{var U=n(h);U!==null&&oe(M,U.startTime-ae),ue=!1}return ue}finally{m=null,g=Y,y=!1}}var F=!1,R=null,I=-1,A=5,O=-1;function W(){return!(t.unstable_now()-OV||125L?(V.sortIndex=Y,e(h,V),n(u)===null&&V===n(h)&&(j?(k(I),I=-1):j=!0,oe(M,Y-L))):(V.sortIndex=H,e(u,V),v||y||(v=!0,$(D))),V},t.unstable_shouldYield=W,t.unstable_wrapCallback=function(V){var ae=g;return function(){var Y=g;g=ae;try{return V.apply(this,arguments)}finally{g=Y}}}})(hm)),hm}var fb;function u3(){return fb||(fb=1,um.exports=d3()),um.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 pb;function h3(){if(pb)return cr;pb=1;var t=Fc(),e=u3();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[: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]*$/,f={},m={};function g(l){return u.call(m,l)?!0:u.call(f,l)?!1:h.test(l)?m[l]=!0:(f[l]=!0,!1)}function y(l,d,p,x){if(p!==null&&p.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return x?!1:p!==null?!p.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function v(l,d,p,x){if(d===null||typeof d>"u"||y(l,d,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function j(l,d,p,x,N,S,T){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=N,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=T}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){w[l]=new j(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];w[d]=new j(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){w[l]=new j(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){w[l]=new j(l,2,!1,l,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(l){w[l]=new j(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){w[l]=new j(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){w[l]=new j(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){w[l]=new j(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){w[l]=new j(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(l){return l[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(l){var d=l.replace(k,E);w[d]=new j(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,E);w[d]=new j(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,E);w[d]=new j(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){w[l]=new j(l,1,!1,l.toLowerCase(),null,!1,!1)}),w.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){w[l]=new j(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,p,x){var N=w.hasOwnProperty(d)?w[d]:null;(N!==null?N.type!==0:x||!(2z||N[T]!==S[z]){var K=` +`+N[T].replace(" at new "," at ");return l.displayName&&K.includes("")&&(K=K.replace("",l.displayName)),K}while(1<=T&&0<=z);break}}}finally{ue=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?H(l):""}function he(l){switch(l.tag){case 5:return H(l.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return l=U(l.type,!1),l;case 11:return l=U(l.type.render,!1),l;case 1:return l=U(l.type,!0),l;default:return""}}function Q(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case R:return"Fragment";case F:return"Portal";case A:return"Profiler";case I:return"StrictMode";case q:return"Suspense";case Z:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case W:return(l.displayName||"Context")+".Consumer";case O:return(l._context.displayName||"Context")+".Provider";case X:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case _:return d=l.displayName||null,d!==null?d:Q(l.type)||"Memo";case $:d=l._payload,l=l._init;try{return Q(l(d))}catch{}}return null}function ee(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Q(d);case 8:return d===I?"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 d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function de(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function Ce(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function B(l){var d=Ce(l)?"checked":"value",p=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),x=""+l[d];if(!l.hasOwnProperty(d)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var N=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return N.call(this)},set:function(T){x=""+T,S.call(this,T)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(T){x=""+T},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function me(l){l._valueTracker||(l._valueTracker=B(l))}function Se(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=Ce(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function rt(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function Ye(l,d){var p=d.checked;return Y({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function st(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=de(d.value!=null?d.value:p),l._wrapperState={initialChecked:x,initialValue:p,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function Qe(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function Xe(l,d){Qe(l,d);var p=de(d.value),x=d.type;if(p!=null)x==="number"?(p===0&&l.value===""||l.value!=p)&&(l.value=""+p):l.value!==""+p&&(l.value=""+p);else if(x==="submit"||x==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Pt(l,d.type,p):d.hasOwnProperty("defaultValue")&&Pt(l,d.type,de(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function ft(l,d,p){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var x=d.type;if(!(x!=="submit"&&x!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,p||d===l.value||(l.value=d),l.defaultValue=d}p=l.name,p!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,p!==""&&(l.name=p)}function Pt(l,d,p){(d!=="number"||rt(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Jt=Array.isArray;function Kn(l,d,p,x){if(l=l.options,d){d={};for(var N=0;N"+d.valueOf().toString()+"",d=pn.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function Br(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var Gn={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},fe=["Webkit","ms","Moz","O"];Object.keys(Gn).forEach(function(l){fe.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),Gn[d]=Gn[l]})});function ge(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||Gn.hasOwnProperty(l)&&Gn[l]?(""+d).trim():d+"px"}function kn(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,N=ge(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,N):l[p]=N}}var ri=Y({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 Ms(l,d){if(d){if(ri[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function ha(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){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 Jn=null;function as(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var pt=null,Sn=null,Yn=null;function Dn(l){if(l=Ol(l)){if(typeof pt!="function")throw Error(n(280));var d=l.stateNode;d&&(d=vd(d),pt(l.stateNode,l.type,d))}}function fa(l){Sn?Yn?Yn.push(l):Yn=[l]:Sn=l}function si(){if(Sn){var l=Sn,d=Yn;if(Yn=Sn=null,Dn(l),d)for(l=0;l>>=0,l===0?32:31-(P(l)/ie|0)|0}var Re=64,Ot=4194304;function Vt(l){switch(l&-l){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 l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Ln(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,N=l.suspendedLanes,S=l.pingedLanes,T=p&268435455;if(T!==0){var z=T&~N;z!==0?x=Vt(z):(S&=T,S!==0&&(x=Vt(S)))}else T=p&~N,T!==0?x=Vt(T):S!==0&&(x=Vt(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&N)===0&&(N=x&-x,S=d&-d,N>=S||N===16&&(S&4194240)!==0))return d;if((x&4)!==0&&(x|=p&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=x;0p;p++)d.push(l);return d}function li(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-rr(d),l[d]=p}function EE(l,d){var p=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0=Sl),ty=" ",ny=!1;function ry(l,d){switch(l){case"keyup":return t4.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var co=!1;function r4(l,d){switch(l){case"compositionend":return sy(d);case"keypress":return d.which!==32?null:(ny=!0,ty);case"textInput":return l=d.data,l===ty&&ny?null:l;default:return null}}function s4(l,d){if(co)return l==="compositionend"||!Vf&&ry(l,d)?(l=J0(),ld=Lf=fi=null,co=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-l};l=x}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=uy(p)}}function fy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?fy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function py(){for(var l=window,d=rt();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=rt(l.document)}return d}function Uf(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function f4(l){var d=py(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&fy(p.ownerDocument.documentElement,p)){if(x!==null&&Uf(p)){if(d=x.start,l=x.end,l===void 0&&(l=d),"selectionStart"in p)p.selectionStart=d,p.selectionEnd=Math.min(l,p.value.length);else if(l=(d=p.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var N=p.textContent.length,S=Math.min(x.start,N);x=x.end===void 0?S:Math.min(x.end,N),!l.extend&&S>x&&(N=x,x=S,S=N),N=hy(p,S);var T=hy(p,x);N&&T&&(l.rangeCount!==1||l.anchorNode!==N.node||l.anchorOffset!==N.offset||l.focusNode!==T.node||l.focusOffset!==T.offset)&&(d=d.createRange(),d.setStart(N.node,N.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(T.node,T.offset)):(d.setEnd(T.node,T.offset),l.addRange(d)))}}for(d=[],l=p;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p=document.documentMode,uo=null,Kf=null,Ml=null,qf=!1;function my(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;qf||uo==null||uo!==rt(x)||(x=uo,"selectionStart"in x&&Uf(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),Ml&&Tl(Ml,x)||(Ml=x,x=gd(Kf,"onSelect"),0go||(l.current=ip[go],ip[go]=null,go--)}function kt(l,d){go++,ip[go]=l.current,l.current=d}var xi={},_n=gi(xi),sr=gi(!1),xa=xi;function xo(l,d){var p=l.type.contextTypes;if(!p)return xi;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var N={},S;for(S in p)N[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=N),N}function ir(l){return l=l.childContextTypes,l!=null}function bd(){Tt(sr),Tt(_n)}function Ay(l,d,p){if(_n.current!==xi)throw Error(n(168));kt(_n,d),kt(sr,p)}function Ry(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var N in x)if(!(N in d))throw Error(n(108,ee(l)||"Unknown",N));return Y({},p,x)}function wd(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||xi,xa=_n.current,kt(_n,l),kt(sr,sr.current),!0}function Iy(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Ry(l,d,xa),x.__reactInternalMemoizedMergedChildContext=l,Tt(sr),Tt(_n),kt(_n,l)):Tt(sr),kt(sr,p)}var Is=null,Nd=!1,ap=!1;function Py(l){Is===null?Is=[l]:Is.push(l)}function S4(l){Nd=!0,Py(l)}function yi(){if(!ap&&Is!==null){ap=!0;var l=0,d=yt;try{var p=Is;for(yt=1;l>=T,N-=T,Ps=1<<32-rr(d)+N|p<Je?(yn=Ue,Ue=null):yn=Ue.sibling;var ut=xe(ne,Ue,se[Je],Ne);if(ut===null){Ue===null&&(Ue=yn);break}l&&Ue&&ut.alternate===null&&d(ne,Ue),J=S(ut,J,Je),We===null?ze=ut:We.sibling=ut,We=ut,Ue=yn}if(Je===se.length)return p(ne,Ue),Dt&&va(ne,Je),ze;if(Ue===null){for(;JeJe?(yn=Ue,Ue=null):yn=Ue.sibling;var Ei=xe(ne,Ue,ut.value,Ne);if(Ei===null){Ue===null&&(Ue=yn);break}l&&Ue&&Ei.alternate===null&&d(ne,Ue),J=S(Ei,J,Je),We===null?ze=Ei:We.sibling=Ei,We=Ei,Ue=yn}if(ut.done)return p(ne,Ue),Dt&&va(ne,Je),ze;if(Ue===null){for(;!ut.done;Je++,ut=se.next())ut=be(ne,ut.value,Ne),ut!==null&&(J=S(ut,J,Je),We===null?ze=ut:We.sibling=ut,We=ut);return Dt&&va(ne,Je),ze}for(Ue=x(ne,Ue);!ut.done;Je++,ut=se.next())ut=Ie(Ue,ne,Je,ut.value,Ne),ut!==null&&(l&&ut.alternate!==null&&Ue.delete(ut.key===null?Je:ut.key),J=S(ut,J,Je),We===null?ze=ut:We.sibling=ut,We=ut);return l&&Ue.forEach(function(i3){return d(ne,i3)}),Dt&&va(ne,Je),ze}function Yt(ne,J,se,Ne){if(typeof se=="object"&&se!==null&&se.type===R&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case D:e:{for(var ze=se.key,We=J;We!==null;){if(We.key===ze){if(ze=se.type,ze===R){if(We.tag===7){p(ne,We.sibling),J=N(We,se.props.children),J.return=ne,ne=J;break e}}else if(We.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===$&&$y(ze)===We.type){p(ne,We.sibling),J=N(We,se.props),J.ref=Dl(ne,We,se),J.return=ne,ne=J;break e}p(ne,We);break}else d(ne,We);We=We.sibling}se.type===R?(J=Ea(se.props.children,ne.mode,Ne,se.key),J.return=ne,ne=J):(Ne=Yd(se.type,se.key,se.props,null,ne.mode,Ne),Ne.ref=Dl(ne,J,se),Ne.return=ne,ne=Ne)}return T(ne);case F:e:{for(We=se.key;J!==null;){if(J.key===We)if(J.tag===4&&J.stateNode.containerInfo===se.containerInfo&&J.stateNode.implementation===se.implementation){p(ne,J.sibling),J=N(J,se.children||[]),J.return=ne,ne=J;break e}else{p(ne,J);break}else d(ne,J);J=J.sibling}J=rm(se,ne.mode,Ne),J.return=ne,ne=J}return T(ne);case $:return We=se._init,Yt(ne,J,We(se._payload),Ne)}if(Jt(se))return Oe(ne,J,se,Ne);if(ae(se))return _e(ne,J,se,Ne);Cd(ne,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,J!==null&&J.tag===6?(p(ne,J.sibling),J=N(J,se),J.return=ne,ne=J):(p(ne,J),J=nm(se,ne.mode,Ne),J.return=ne,ne=J),T(ne)):p(ne,J)}return Yt}var wo=Fy(!0),By=Fy(!1),Ed=gi(null),Td=null,No=null,hp=null;function fp(){hp=No=Td=null}function pp(l){var d=Ed.current;Tt(Ed),l._currentValue=d}function mp(l,d,p){for(;l!==null;){var x=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),l===p)break;l=l.return}}function jo(l,d){Td=l,hp=No=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(ar=!0),l.firstContext=null)}function Ar(l){var d=l._currentValue;if(hp!==l)if(l={context:l,memoizedValue:d,next:null},No===null){if(Td===null)throw Error(n(308));No=l,Td.dependencies={lanes:0,firstContext:l}}else No=No.next=l;return d}var ba=null;function gp(l){ba===null?ba=[l]:ba.push(l)}function Vy(l,d,p,x){var N=d.interleaved;return N===null?(p.next=p,gp(d)):(p.next=N.next,N.next=p),d.interleaved=p,Ds(l,x)}function Ds(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var vi=!1;function xp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hy(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function Ls(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function bi(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(dt&2)!==0){var N=x.pending;return N===null?d.next=d:(d.next=N.next,N.next=d),x.pending=d,Ds(l,p)}return N=x.interleaved,N===null?(d.next=d,gp(x)):(d.next=N.next,N.next=d),x.interleaved=d,Ds(l,p)}function Md(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Rf(l,p)}}function Wy(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var N=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var T={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?N=S=T:S=S.next=T,p=p.next}while(p!==null);S===null?N=S=d:S=S.next=d}else N=S=d;p={baseState:x.baseState,firstBaseUpdate:N,lastBaseUpdate:S,shared:x.shared,effects:x.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function Ad(l,d,p,x){var N=l.updateQueue;vi=!1;var S=N.firstBaseUpdate,T=N.lastBaseUpdate,z=N.shared.pending;if(z!==null){N.shared.pending=null;var K=z,le=K.next;K.next=null,T===null?S=le:T.next=le,T=K;var ye=l.alternate;ye!==null&&(ye=ye.updateQueue,z=ye.lastBaseUpdate,z!==T&&(z===null?ye.firstBaseUpdate=le:z.next=le,ye.lastBaseUpdate=K))}if(S!==null){var be=N.baseState;T=0,ye=le=K=null,z=S;do{var xe=z.lane,Ie=z.eventTime;if((x&xe)===xe){ye!==null&&(ye=ye.next={eventTime:Ie,lane:0,tag:z.tag,payload:z.payload,callback:z.callback,next:null});e:{var Oe=l,_e=z;switch(xe=d,Ie=p,_e.tag){case 1:if(Oe=_e.payload,typeof Oe=="function"){be=Oe.call(Ie,be,xe);break e}be=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=_e.payload,xe=typeof Oe=="function"?Oe.call(Ie,be,xe):Oe,xe==null)break e;be=Y({},be,xe);break e;case 2:vi=!0}}z.callback!==null&&z.lane!==0&&(l.flags|=64,xe=N.effects,xe===null?N.effects=[z]:xe.push(z))}else Ie={eventTime:Ie,lane:xe,tag:z.tag,payload:z.payload,callback:z.callback,next:null},ye===null?(le=ye=Ie,K=be):ye=ye.next=Ie,T|=xe;if(z=z.next,z===null){if(z=N.shared.pending,z===null)break;xe=z,z=xe.next,xe.next=null,N.lastBaseUpdate=xe,N.shared.pending=null}}while(!0);if(ye===null&&(K=be),N.baseState=K,N.firstBaseUpdate=le,N.lastBaseUpdate=ye,d=N.shared.interleaved,d!==null){N=d;do T|=N.lane,N=N.next;while(N!==d)}else S===null&&(N.shared.lanes=0);ja|=T,l.lanes=T,l.memoizedState=be}}function Uy(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=Np.transition;Np.transition={};try{l(!1),d()}finally{yt=p,Np.transition=x}}function dv(){return Rr().memoizedState}function M4(l,d,p){var x=ki(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},uv(l))hv(d,p);else if(p=Vy(l,d,p,x),p!==null){var N=Xn();Gr(p,l,x,N),fv(p,d,x)}}function A4(l,d,p){var x=ki(l),N={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(uv(l))hv(d,N);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var T=d.lastRenderedState,z=S(T,p);if(N.hasEagerState=!0,N.eagerState=z,Hr(z,T)){var K=d.interleaved;K===null?(N.next=N,gp(d)):(N.next=K.next,K.next=N),d.interleaved=N;return}}catch{}finally{}p=Vy(l,d,N,x),p!==null&&(N=Xn(),Gr(p,l,x,N),fv(p,d,x))}}function uv(l){var d=l.alternate;return l===Bt||d!==null&&d===Bt}function hv(l,d){$l=Pd=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function fv(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Rf(l,p)}}var Ld={readContext:Ar,useCallback:zn,useContext:zn,useEffect:zn,useImperativeHandle:zn,useInsertionEffect:zn,useLayoutEffect:zn,useMemo:zn,useReducer:zn,useRef:zn,useState:zn,useDebugValue:zn,useDeferredValue:zn,useTransition:zn,useMutableSource:zn,useSyncExternalStore:zn,useId:zn,unstable_isNewReconciler:!1},R4={readContext:Ar,useCallback:function(l,d){return ms().memoizedState=[l,d===void 0?null:d],l},useContext:Ar,useEffect:nv,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Od(4194308,4,iv.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Od(4194308,4,l,d)},useInsertionEffect:function(l,d){return Od(4,2,l,d)},useMemo:function(l,d){var p=ms();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=ms();return d=p!==void 0?p(d):d,x.memoizedState=x.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},x.queue=l,l=l.dispatch=M4.bind(null,Bt,l),[x.memoizedState,l]},useRef:function(l){var d=ms();return l={current:l},d.memoizedState=l},useState:ev,useDebugValue:Mp,useDeferredValue:function(l){return ms().memoizedState=l},useTransition:function(){var l=ev(!1),d=l[0];return l=T4.bind(null,l[1]),ms().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=Bt,N=ms();if(Dt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),xn===null)throw Error(n(349));(Na&30)!==0||Jy(x,d,p)}N.memoizedState=p;var S={value:p,getSnapshot:d};return N.queue=S,nv(Qy.bind(null,x,S,l),[l]),x.flags|=2048,Vl(9,Yy.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=ms(),d=xn.identifierPrefix;if(Dt){var p=Os,x=Ps;p=(x&~(1<<32-rr(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=Fl++,0<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=T.createElement(p,{is:x.is}):(l=T.createElement(p),p==="select"&&(T=l,x.multiple?T.multiple=!0:x.size&&(T.size=x.size))):l=T.createElementNS(l,p),l[fs]=d,l[Pl]=x,Pv(l,d,!1,!1),d.stateNode=l;e:{switch(T=ha(p,x),p){case"dialog":Et("cancel",l),Et("close",l),N=x;break;case"iframe":case"object":case"embed":Et("load",l),N=x;break;case"video":case"audio":for(N=0;NTo&&(d.flags|=128,x=!0,Hl(S,!1),d.lanes=4194304)}else{if(!x)if(l=Rd(T),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Hl(S,!0),S.tail===null&&S.tailMode==="hidden"&&!T.alternate&&!Dt)return $n(d),null}else 2*$t()-S.renderingStartTime>To&&p!==1073741824&&(d.flags|=128,x=!0,Hl(S,!1),d.lanes=4194304);S.isBackwards?(T.sibling=d.child,d.child=T):(p=S.last,p!==null?p.sibling=T:d.child=T,S.last=T)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=$t(),d.sibling=null,p=Ft.current,kt(Ft,x?p&1|2:p&1),d):($n(d),null);case 22:case 23:return Zp(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(br&1073741824)!==0&&($n(d),d.subtreeFlags&6&&(d.flags|=8192)):$n(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function $4(l,d){switch(lp(d),d.tag){case 1:return ir(d.type)&&bd(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return ko(),Tt(sr),Tt(_n),wp(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return vp(d),null;case 13:if(Tt(Ft),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));bo()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return Tt(Ft),null;case 4:return ko(),null;case 10:return pp(d.type._context),null;case 22:case 23:return Zp(),null;case 24:return null;default:return null}}var Fd=!1,Fn=!1,F4=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function Co(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){Ht(l,d,x)}else p.current=null}function Bp(l,d,p){try{p()}catch(x){Ht(l,d,x)}}var Lv=!1;function B4(l,d){if(Zf=ad,l=py(),Uf(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var N=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var T=0,z=-1,K=-1,le=0,ye=0,be=l,xe=null;t:for(;;){for(var Ie;be!==p||N!==0&&be.nodeType!==3||(z=T+N),be!==S||x!==0&&be.nodeType!==3||(K=T+x),be.nodeType===3&&(T+=be.nodeValue.length),(Ie=be.firstChild)!==null;)xe=be,be=Ie;for(;;){if(be===l)break t;if(xe===p&&++le===N&&(z=T),xe===S&&++ye===x&&(K=T),(Ie=be.nextSibling)!==null)break;be=xe,xe=be.parentNode}be=Ie}p=z===-1||K===-1?null:{start:z,end:K}}else p=null}p=p||{start:0,end:0}}else p=null;for(ep={focusedElem:l,selectionRange:p},ad=!1,Pe=d;Pe!==null;)if(d=Pe,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Pe=l;else for(;Pe!==null;){d=Pe;try{var Oe=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Oe!==null){var _e=Oe.memoizedProps,Yt=Oe.memoizedState,ne=d.stateNode,J=ne.getSnapshotBeforeUpdate(d.elementType===d.type?_e:Ur(d.type,_e),Yt);ne.__reactInternalSnapshotBeforeUpdate=J}break;case 3:var se=d.stateNode.containerInfo;se.nodeType===1?se.textContent="":se.nodeType===9&&se.documentElement&&se.removeChild(se.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ne){Ht(d,d.return,Ne)}if(l=d.sibling,l!==null){l.return=d.return,Pe=l;break}Pe=d.return}return Oe=Lv,Lv=!1,Oe}function Wl(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var N=x=x.next;do{if((N.tag&l)===l){var S=N.destroy;N.destroy=void 0,S!==void 0&&Bp(d,p,S)}N=N.next}while(N!==x)}}function Bd(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var p=d=d.next;do{if((p.tag&l)===l){var x=p.create;p.destroy=x()}p=p.next}while(p!==d)}}function Vp(l){var d=l.ref;if(d!==null){var p=l.stateNode;switch(l.tag){case 5:l=p;break;default:l=p}typeof d=="function"?d(l):d.current=l}}function _v(l){var d=l.alternate;d!==null&&(l.alternate=null,_v(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[fs],delete d[Pl],delete d[sp],delete d[j4],delete d[k4])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function zv(l){return l.tag===5||l.tag===3||l.tag===4}function $v(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||zv(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Hp(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=yd));else if(x!==4&&(l=l.child,l!==null))for(Hp(l,d,p),l=l.sibling;l!==null;)Hp(l,d,p),l=l.sibling}function Wp(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(x!==4&&(l=l.child,l!==null))for(Wp(l,d,p),l=l.sibling;l!==null;)Wp(l,d,p),l=l.sibling}var En=null,Kr=!1;function wi(l,d,p){for(p=p.child;p!==null;)Fv(l,d,p),p=p.sibling}function Fv(l,d,p){if(gr&&typeof gr.onCommitFiberUnmount=="function")try{gr.onCommitFiberUnmount(ma,p)}catch{}switch(p.tag){case 5:Fn||Co(p,d);case 6:var x=En,N=Kr;En=null,wi(l,d,p),En=x,Kr=N,En!==null&&(Kr?(l=En,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):En.removeChild(p.stateNode));break;case 18:En!==null&&(Kr?(l=En,p=p.stateNode,l.nodeType===8?rp(l.parentNode,p):l.nodeType===1&&rp(l,p),Nl(l)):rp(En,p.stateNode));break;case 4:x=En,N=Kr,En=p.stateNode.containerInfo,Kr=!0,wi(l,d,p),En=x,Kr=N;break;case 0:case 11:case 14:case 15:if(!Fn&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){N=x=x.next;do{var S=N,T=S.destroy;S=S.tag,T!==void 0&&((S&2)!==0||(S&4)!==0)&&Bp(p,d,T),N=N.next}while(N!==x)}wi(l,d,p);break;case 1:if(!Fn&&(Co(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(z){Ht(p,d,z)}wi(l,d,p);break;case 21:wi(l,d,p);break;case 22:p.mode&1?(Fn=(x=Fn)||p.memoizedState!==null,wi(l,d,p),Fn=x):wi(l,d,p);break;default:wi(l,d,p)}}function Bv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new F4),d.forEach(function(x){var N=Y4.bind(null,l,x);p.has(x)||(p.add(x),x.then(N,N))})}}function qr(l,d){var p=d.deletions;if(p!==null)for(var x=0;xN&&(N=T),x&=~S}if(x=N,x=$t()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*H4(x/1960))-x,10l?16:l,ji===null)var x=!1;else{if(l=ji,ji=null,Kd=0,(dt&6)!==0)throw Error(n(331));var N=dt;for(dt|=4,Pe=l.current;Pe!==null;){var S=Pe,T=S.child;if((Pe.flags&16)!==0){var z=S.deletions;if(z!==null){for(var K=0;K$t()-qp?Sa(l,0):Kp|=p),lr(l,d)}function eb(l,d){d===0&&((l.mode&1)===0?d=1:(d=Ot,Ot<<=1,(Ot&130023424)===0&&(Ot=4194304)));var p=Xn();l=Ds(l,d),l!==null&&(li(l,d,p),lr(l,p))}function J4(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),eb(l,p)}function Y4(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,N=l.memoizedState;N!==null&&(p=N.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),eb(l,p)}var tb;tb=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||sr.current)ar=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return ar=!1,_4(l,d,p);ar=(l.flags&131072)!==0}else ar=!1,Dt&&(d.flags&1048576)!==0&&Oy(d,kd,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;$d(l,d),l=d.pendingProps;var N=xo(d,_n.current);jo(d,p),N=kp(null,d,x,l,N,p);var S=Sp();return d.flags|=1,typeof N=="object"&&N!==null&&typeof N.render=="function"&&N.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,ir(x)?(S=!0,wd(d)):S=!1,d.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,xp(d),N.updater=_d,d.stateNode=N,N._reactInternals=d,Rp(d,x,l,p),d=Dp(null,d,x,!0,S,p)):(d.tag=0,Dt&&S&&op(d),Qn(null,d,N,p),d=d.child),d;case 16:x=d.elementType;e:{switch($d(l,d),l=d.pendingProps,N=x._init,x=N(x._payload),d.type=x,N=d.tag=X4(x),l=Ur(x,l),N){case 0:d=Op(null,d,x,l,p);break e;case 1:d=Ev(null,d,x,l,p);break e;case 11:d=Nv(null,d,x,l,p);break e;case 14:d=jv(null,d,x,Ur(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ur(x,N),Op(l,d,x,N,p);case 1:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ur(x,N),Ev(l,d,x,N,p);case 3:e:{if(Tv(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,N=S.element,Hy(l,d),Ad(d,x,null,p);var T=d.memoizedState;if(x=T.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){N=So(Error(n(423)),d),d=Mv(l,d,x,p,N);break e}else if(x!==N){N=So(Error(n(424)),d),d=Mv(l,d,x,p,N);break e}else for(vr=mi(d.stateNode.containerInfo.firstChild),yr=d,Dt=!0,Wr=null,p=By(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(bo(),x===N){d=_s(l,d,p);break e}Qn(l,d,x,p)}d=d.child}return d;case 5:return Ky(d),l===null&&dp(d),x=d.type,N=d.pendingProps,S=l!==null?l.memoizedProps:null,T=N.children,tp(x,N)?T=null:S!==null&&tp(x,S)&&(d.flags|=32),Cv(l,d),Qn(l,d,T,p),d.child;case 6:return l===null&&dp(d),null;case 13:return Av(l,d,p);case 4:return yp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=wo(d,null,x,p):Qn(l,d,x,p),d.child;case 11:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ur(x,N),Nv(l,d,x,N,p);case 7:return Qn(l,d,d.pendingProps,p),d.child;case 8:return Qn(l,d,d.pendingProps.children,p),d.child;case 12:return Qn(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,N=d.pendingProps,S=d.memoizedProps,T=N.value,kt(Ed,x._currentValue),x._currentValue=T,S!==null)if(Hr(S.value,T)){if(S.children===N.children&&!sr.current){d=_s(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var z=S.dependencies;if(z!==null){T=S.child;for(var K=z.firstContext;K!==null;){if(K.context===x){if(S.tag===1){K=Ls(-1,p&-p),K.tag=2;var le=S.updateQueue;if(le!==null){le=le.shared;var ye=le.pending;ye===null?K.next=K:(K.next=ye.next,ye.next=K),le.pending=K}}S.lanes|=p,K=S.alternate,K!==null&&(K.lanes|=p),mp(S.return,p,d),z.lanes|=p;break}K=K.next}}else if(S.tag===10)T=S.type===d.type?null:S.child;else if(S.tag===18){if(T=S.return,T===null)throw Error(n(341));T.lanes|=p,z=T.alternate,z!==null&&(z.lanes|=p),mp(T,p,d),T=S.sibling}else T=S.child;if(T!==null)T.return=S;else for(T=S;T!==null;){if(T===d){T=null;break}if(S=T.sibling,S!==null){S.return=T.return,T=S;break}T=T.return}S=T}Qn(l,d,N.children,p),d=d.child}return d;case 9:return N=d.type,x=d.pendingProps.children,jo(d,p),N=Ar(N),x=x(N),d.flags|=1,Qn(l,d,x,p),d.child;case 14:return x=d.type,N=Ur(x,d.pendingProps),N=Ur(x.type,N),jv(l,d,x,N,p);case 15:return kv(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,N=d.pendingProps,N=d.elementType===x?N:Ur(x,N),$d(l,d),d.tag=1,ir(x)?(l=!0,wd(d)):l=!1,jo(d,p),mv(d,x,N),Rp(d,x,N,p),Dp(null,d,x,!0,l,p);case 19:return Iv(l,d,p);case 22:return Sv(l,d,p)}throw Error(n(156,d.tag))};function nb(l,d){return Zc(l,d)}function Q4(l,d,p,x){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pr(l,d,p,x){return new Q4(l,d,p,x)}function tm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function X4(l){if(typeof l=="function")return tm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===X)return 11;if(l===_)return 14}return 2}function Ci(l,d){var p=l.alternate;return p===null?(p=Pr(l.tag,d,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=d,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&14680064,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,d=l.dependencies,p.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p}function Yd(l,d,p,x,N,S){var T=2;if(x=l,typeof l=="function")tm(l)&&(T=1);else if(typeof l=="string")T=5;else e:switch(l){case R:return Ea(p.children,N,S,d);case I:T=8,N|=8;break;case A:return l=Pr(12,p,d,N|2),l.elementType=A,l.lanes=S,l;case q:return l=Pr(13,p,d,N),l.elementType=q,l.lanes=S,l;case Z:return l=Pr(19,p,d,N),l.elementType=Z,l.lanes=S,l;case oe:return Qd(p,N,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case O:T=10;break e;case W:T=9;break e;case X:T=11;break e;case _:T=14;break e;case $:T=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Pr(T,p,d,N),d.elementType=l,d.type=x,d.lanes=S,d}function Ea(l,d,p,x){return l=Pr(7,l,x,d),l.lanes=p,l}function Qd(l,d,p,x){return l=Pr(22,l,x,d),l.elementType=oe,l.lanes=p,l.stateNode={isHidden:!1},l}function nm(l,d,p){return l=Pr(6,l,null,d),l.lanes=p,l}function rm(l,d,p){return d=Pr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function Z4(l,d,p,x,N){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sn(0),this.expirationTimes=sn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sn(0),this.identifierPrefix=x,this.onRecoverableError=N,this.mutableSourceEagerHydrationData=null}function sm(l,d,p,x,N,S,T,z,K){return l=new Z4(l,d,p,z,K),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Pr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},xp(S),l}function e3(l,d,p){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),dm.exports=h3(),dm.exports}var gb;function f3(){if(gb)return su;gb=1;var t=vN();return su.createRoot=t.createRoot,su.hydrateRoot=t.hydrateRoot,su}var p3=f3(),Bc=vN();const bN=yN(Bc);/** + * @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 Nc(){return Nc=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function yx(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function g3(){return Math.random().toString(36).substr(2,8)}function yb(t,e){return{usr:t.state,key:t.key,idx:e}}function lg(t,e,n,r){return n===void 0&&(n=null),Nc({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?al(e):e,{state:n,key:e&&e.key||r||g3()})}function Hu(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function al(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function x3(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:a=!1}=r,o=s.history,c=$i.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(Nc({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=$i.Pop;let w=f(),k=w==null?null:w-h;h=w,u&&u({action:c,location:j.location,delta:k})}function g(w,k){c=$i.Push;let E=lg(j.location,w,k);h=f()+1;let C=yb(E,h),M=j.createHref(E);try{o.pushState(C,"",M)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;s.location.assign(M)}a&&u&&u({action:c,location:j.location,delta:1})}function y(w,k){c=$i.Replace;let E=lg(j.location,w,k);h=f();let C=yb(E,h),M=j.createHref(E);o.replaceState(C,"",M),a&&u&&u({action:c,location:j.location,delta:0})}function v(w){let k=s.location.origin!=="null"?s.location.origin:s.location.href,E=typeof w=="string"?w:Hu(w);return E=E.replace(/ $/,"%20"),nn(k,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,k)}let j={get action(){return c},get location(){return t(s,o)},listen(w){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(xb,m),u=w,()=>{s.removeEventListener(xb,m),u=null}},createHref(w){return e(s,w)},createURL:v,encodeLocation(w){let k=v(w);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:y,go(w){return o.go(w)}};return j}var vb;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(vb||(vb={}));function y3(t,e,n){return n===void 0&&(n="/"),v3(t,e,n)}function v3(t,e,n,r){let s=typeof e=="string"?al(e):e,a=vx(s.pathname||"/",n);if(a==null)return null;let o=wN(t);b3(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};u.relativePath.startsWith("/")&&(nn(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let h=Ui([r,u.relativePath]),f=n.concat(u);a.children&&a.children.length>0&&(nn(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),wN(a.children,e,f,h)),!(a.path==null&&!a.index)&&e.push({path:h,score:E3(h,a.index),routesMeta:f})};return t.forEach((a,o)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))s(a,o);else for(let u of NN(a.path))s(a,o,u)}),e}function NN(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return s?[a,""]:[a];let o=NN(r.join("/")),c=[];return c.push(...o.map(u=>u===""?a:[a,u].join("/"))),s&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function b3(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:T3(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const w3=/^:[\w-]+$/,N3=3,j3=2,k3=1,S3=10,C3=-2,bb=t=>t==="*";function E3(t,e){let n=t.split("/"),r=n.length;return n.some(bb)&&(r+=C3),e&&(r+=j3),n.filter(s=>!bb(s)).reduce((s,a)=>s+(w3.test(a)?N3:a===""?k3:S3),r)}function T3(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function M3(t,e,n){let{routesMeta:r}=t,s={},a="/",o=[];for(let c=0;c{let{paramName:g,isOptional:y}=f;if(g==="*"){let j=c[m]||"";o=a.slice(0,a.length-j.length).replace(/(.)\/+$/,"$1")}const v=c[m];return y&&!v?h[g]=void 0:h[g]=(v||"").replace(/%2F/g,"/"),h},{}),pathname:a,pathnameBase:o,pattern:t}}function R3(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),yx(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function I3(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return yx(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function vx(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const P3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,O3=t=>P3.test(t);function D3(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?al(t):t,a;if(n)if(O3(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),yx(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=wb(n.substring(1),"/"):a=wb(n,e)}else a=e;return{pathname:a,search:z3(r),hash:$3(s)}}function wb(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function fm(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function L3(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function bx(t,e){let n=L3(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function wx(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=al(t):(s=Nc({},t),nn(!s.pathname||!s.pathname.includes("?"),fm("?","pathname","search",s)),nn(!s.pathname||!s.pathname.includes("#"),fm("#","pathname","hash",s)),nn(!s.search||!s.search.includes("#"),fm("#","search","hash",s)));let a=t===""||s.pathname==="",o=a?"/":s.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;s.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=D3(s,c),h=o&&o!=="/"&&o.endsWith("/"),f=(a||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const Ui=t=>t.join("/").replace(/\/\/+/g,"/"),_3=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),z3=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,$3=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function F3(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const jN=["post","put","patch","delete"];new Set(jN);const B3=["get",...jN];new Set(B3);/** + * 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 jc(){return jc=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),b.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=wx(h,JSON.parse(o),a,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:Ui([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,a,t])}const U3=b.createContext(null);function K3(t){let e=b.useContext(ti).outlet;return e&&b.createElement(U3.Provider,{value:t},e)}function CN(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(ra),{matches:s}=b.useContext(ti),{pathname:a}=sa(),o=JSON.stringify(bx(s,r.v7_relativeSplatPath));return b.useMemo(()=>wx(t,JSON.parse(o),a,n==="path"),[t,o,a,n])}function q3(t,e){return G3(t,e)}function G3(t,e,n,r){ol()||nn(!1);let{navigator:s}=b.useContext(ra),{matches:a}=b.useContext(ti),o=a[a.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=sa(),f;if(e){var m;let w=typeof e=="string"?al(e):e;u==="/"||(m=w.pathname)!=null&&m.startsWith(u)||nn(!1),f=w}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let w=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(w.length).join("/")}let v=y3(t,{pathname:y}),j=Z3(v&&v.map(w=>Object.assign({},w,{params:Object.assign({},c,w.params),pathname:Ui([u,s.encodeLocation?s.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?u:Ui([u,s.encodeLocation?s.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),a,n,r);return e&&j?b.createElement(Uh.Provider,{value:{location:jc({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:$i.Pop}},j):j}function J3(){let t=rT(),e=F3(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),n?b.createElement("pre",{style:s},n):null,null)}const Y3=b.createElement(J3,null);class Q3 extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?b.createElement(ti.Provider,{value:this.props.routeContext},b.createElement(kN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function X3(t){let{routeContext:e,match:n,children:r}=t,s=b.useContext(Nx);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(ti.Provider,{value:e},r)}function Z3(t,e,n,r){var s;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var a;if(!n)return null;if(n.errors)t=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(s=n)==null?void 0:s.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||nn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,g)=>{let y,v=!1,j=null,w=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,j=m.route.errorElement||Y3,u&&(h<0&&g===0?(iT("route-fallback"),v=!0,w=null):h===g&&(v=!0,w=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),E=()=>{let C;return y?C=j:v?C=w:m.route.Component?C=b.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,b.createElement(X3,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?b.createElement(Q3,{location:n.location,revalidation:n.revalidation,component:j,error:y,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):E()},null)}var EN=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(EN||{}),TN=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(TN||{});function eT(t){let e=b.useContext(Nx);return e||nn(!1),e}function tT(t){let e=b.useContext(V3);return e||nn(!1),e}function nT(t){let e=b.useContext(ti);return e||nn(!1),e}function MN(t){let e=nT(),n=e.matches[e.matches.length-1];return n.route.id||nn(!1),n.route.id}function rT(){var t;let e=b.useContext(kN),n=tT(),r=MN();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function sT(){let{router:t}=eT(EN.UseNavigateStable),e=MN(TN.UseNavigateStable),n=b.useRef(!1);return SN(()=>{n.current=!0}),b.useCallback(function(s,a){a===void 0&&(a={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,jc({fromRouteId:e},a)))},[t,e])}const Nb={};function iT(t,e,n){Nb[t]||(Nb[t]=!0)}function aT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function oT(t){let{to:e,replace:n,state:r,relative:s}=t;ol()||nn(!1);let{future:a,static:o}=b.useContext(ra),{matches:c}=b.useContext(ti),{pathname:u}=sa(),h=ia(),f=wx(e,bx(c,a.v7_relativeSplatPath),u,s==="path"),m=JSON.stringify(f);return b.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:s}),[h,m,s,n,r]),null}function lT(t){return K3(t.context)}function Mt(t){nn(!1)}function cT(t){let{basename:e="/",children:n=null,location:r,navigationType:s=$i.Pop,navigator:a,static:o=!1,future:c}=t;ol()&&nn(!1);let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:a,static:o,future:jc({v7_relativeSplatPath:!1},c)}),[u,c,a,o]);typeof r=="string"&&(r=al(r));let{pathname:f="/",search:m="",hash:g="",state:y=null,key:v="default"}=r,j=b.useMemo(()=>{let w=vx(f,u);return w==null?null:{location:{pathname:w,search:m,hash:g,state:y,key:v},navigationType:s}},[u,f,m,g,y,v,s]);return j==null?null:b.createElement(ra.Provider,{value:h},b.createElement(Uh.Provider,{children:n,value:j}))}function dT(t){let{children:e,location:n}=t;return q3(cg(e),n)}new Promise(()=>{});function cg(t,e){e===void 0&&(e=[]);let n=[];return b.Children.forEach(t,(r,s)=>{if(!b.isValidElement(r))return;let a=[...e,s];if(r.type===b.Fragment){n.push.apply(n,cg(r.props.children,a));return}r.type!==Mt&&nn(!1),!r.props.index||!r.props.children||nn(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=cg(r.props.children,a)),n.push(o)}),n}/** + * 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 dg(){return dg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[s]=t[s]);return n}function hT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function fT(t,e){return t.button===0&&(!e||e==="_self")&&!hT(t)}function ug(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function pT(t,e){let n=ug(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(a=>{n.append(s,a)})}),n}const mT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],gT="6";try{window.__reactRouterVersion=gT}catch{}const xT="startTransition",jb=Wh[xT];function yT(t){let{basename:e,children:n,future:r,window:s}=t,a=b.useRef();a.current==null&&(a.current=m3({window:s,v5Compat:!0}));let o=a.current,[c,u]=b.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=b.useCallback(m=>{h&&jb?jb(()=>u(m)):u(m)},[u,h]);return b.useLayoutEffect(()=>o.listen(f),[o,f]),b.useEffect(()=>aT(r),[r]),b.createElement(cT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const vT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",bT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Iu=b.forwardRef(function(e,n){let{onClick:r,relative:s,reloadDocument:a,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=uT(e,mT),{basename:y}=b.useContext(ra),v,j=!1;if(typeof h=="string"&&bT.test(h)&&(v=h,vT))try{let C=new URL(window.location.href),M=h.startsWith("//")?new URL(C.protocol+h):new URL(h),D=vx(M.pathname,y);M.origin===C.origin&&D!=null?h=D+M.search+M.hash:j=!0}catch{}let w=H3(h,{relative:s}),k=wT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:s,viewTransition:m});function E(C){r&&r(C),C.defaultPrevented||k(C)}return b.createElement("a",dg({},g,{href:v||w,onClick:j||a?r:E,ref:n,target:u}))});var kb;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(kb||(kb={}));var Sb;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(Sb||(Sb={}));function wT(t,e){let{target:n,replace:r,state:s,preventScrollReset:a,relative:o,viewTransition:c}=e===void 0?{}:e,u=ia(),h=sa(),f=CN(t,{relative:o});return b.useCallback(m=>{if(fT(m,n)){m.preventDefault();let g=r!==void 0?r:Hu(h)===Hu(f);u(t,{replace:g,state:s,preventScrollReset:a,relative:o,viewTransition:c})}},[h,u,f,r,s,n,t,a,o,c])}function AN(t){let e=b.useRef(ug(t)),n=b.useRef(!1),r=sa(),s=b.useMemo(()=>pT(r.search,n.current?null:e.current),[r.search]),a=ia(),o=b.useCallback((c,u)=>{const h=ug(typeof c=="function"?c(s):c);n.current=!0,a("?"+h,u)},[a,s]);return[s,o]}/** + * @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 NT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),jT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Cb=t=>{const e=jT(t);return e.charAt(0).toUpperCase()+e.slice(1)},RN=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),kT=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="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 ST={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 CT=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:o,...c},u)=>b.createElement("svg",{ref:u,...ST,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:RN("lucide",s),...!a&&!kT(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>b.createElement(h,f)),...Array.isArray(a)?a:[a]]));/** + * @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 je=(t,e)=>{const n=b.forwardRef(({className:r,...s},a)=>b.createElement(CT,{ref:a,iconNode:e,className:RN(`lucide-${NT(Cb(t))}`,`lucide-${t}`,r),...s}));return n.displayName=Cb(t),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 ET=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],TT=je("arrow-up-down",ET);/** + * @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 MT=[["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"}]],Eb=je("bitcoin",MT);/** + * @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 AT=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],RT=je("bold",AT);/** + * @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 IT=[["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"}]],zr=je("book-open",IT);/** + * @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 PT=[["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"}]],kc=je("calendar",PT);/** + * @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 OT=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],DT=je("chart-column",OT);/** + * @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 LT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Kh=je("check",LT);/** + * @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 _T=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Jo=je("chevron-down",_T);/** + * @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 zT=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],$T=je("chevron-left",zT);/** + * @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 FT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Bo=je("chevron-right",FT);/** + * @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 BT=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],jx=je("chevron-up",BT);/** + * @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 VT=[["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"}]],HT=je("circle-alert",VT);/** + * @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 WT=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Tb=je("circle-check-big",WT);/** + * @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 UT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],hg=je("circle-check",UT);/** + * @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 KT=[["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"}]],IN=je("circle-question-mark",KT);/** + * @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 qT=[["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"}]],pm=je("circle-user",qT);/** + * @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 GT=[["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"}]],PN=je("circle-x",GT);/** + * @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 JT=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],fg=je("clock",JT);/** + * @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 YT=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],QT=je("code",YT);/** + * @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 XT=[["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"}]],ON=je("copy",XT);/** + * @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 ZT=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],pg=je("credit-card",ZT);/** + * @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 eM=[["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"}]],Fi=je("crown",eM);/** + * @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 tM=[["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"}]],Wu=je("dollar-sign",tM);/** + * @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 nM=[["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"}]],rM=je("download",nM);/** + * @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 sM=[["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"}]],Xs=je("external-link",sM);/** + * @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 iM=[["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"}]],mg=je("eye",iM);/** + * @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 aM=[["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"}]],oM=je("file-text",aM);/** + * @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 lM=[["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"}]],DN=je("funnel",lM);/** + * @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 cM=[["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"}]],dM=je("gift",cM);/** + * @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 uM=[["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"}]],hM=je("git-merge",uM);/** + * @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 fM=[["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"}]],gg=je("globe",fM);/** + * @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 pM=[["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"}]],LN=je("graduation-cap",pM);/** + * @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 mM=[["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"}]],$s=je("grip-vertical",mM);/** + * @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 gM=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],_N=je("handshake",gM);/** + * @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 xM=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],yM=je("hash",xM);/** + * @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 vM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],bM=je("heading-1",vM);/** + * @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 wM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],NM=je("heading-2",wM);/** + * @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 jM=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],kM=je("heading-3",jM);/** + * @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 SM=[["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"}]],CM=je("house",SM);/** + * @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 EM=[["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"}]],zN=je("image",EM);/** + * @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 TM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],iu=je("info",TM);/** + * @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 MM=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],AM=je("italic",MM);/** + * @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 RM=[["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"}]],IM=je("key",RM);/** + * @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 PM=[["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"}]],OM=je("layout-dashboard",PM);/** + * @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 DM=[["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"}]],Ns=je("link-2",DM);/** + * @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 LM=[["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"}]],xg=je("link",LM);/** + * @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 _M=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],zM=je("list-ordered",_M);/** + * @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 $M=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],FM=je("list",$M);/** + * @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 BM=[["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"}]],VM=je("lock",BM);/** + * @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 HM=[["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"}]],WM=je("log-out",HM);/** + * @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 UM=[["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"}]],$N=je("map-pin",UM);/** + * @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 KM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],qM=je("menu",KM);/** + * @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 GM=[["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"}]],JM=je("message-circle",GM);/** + * @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 YM=[["path",{d:"M5 12h14",key:"1ays0h"}]],QM=je("minus",YM);/** + * @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 XM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],Vo=je("navigation",XM);/** + * @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 ZM=[["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"}]],eA=je("palette",ZM);/** + * @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 tA=[["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"}]],wt=je("pen-line",tA);/** + * @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 nA=[["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"}]],rA=je("percent",nA);/** + * @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 sA=[["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"}]],iA=je("phone",sA);/** + * @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 aA=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],oA=je("pin",aA);/** + * @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 lA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Lt=je("plus",lA);/** + * @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 cA=[["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"}]],Mb=je("qr-code",cA);/** + * @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 dA=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],uA=je("quote",dA);/** + * @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 hA=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],fA=je("redo",hA);/** + * @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 pA=[["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"}]],qe=je("refresh-cw",pA);/** + * @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 mA=[["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"}]],rn=je("save",mA);/** + * @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 gA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ki=je("search",gA);/** + * @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 xA=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],yA=je("send",xA);/** + * @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 vA=[["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"}]],Da=je("settings",vA);/** + * @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 bA=[["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"}]],au=je("settings-2",bA);/** + * @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 wA=[["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"}]],qh=je("shield-check",wA);/** + * @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 NA=[["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"}]],yg=je("shopping-bag",NA);/** + * @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 jA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Sc=je("smartphone",jA);/** + * @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 kA=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Ho=je("star",kA);/** + * @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 SA=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],CA=je("strikethrough",SA);/** + * @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 EA=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],TA=je("table",EA);/** + * @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 MA=[["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"}]],mm=je("tag",MA);/** + * @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 AA=[["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"}]],vn=je("trash-2",AA);/** + * @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 RA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],dc=je("trending-up",RA);/** + * @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 IA=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],Ab=je("trophy",IA);/** + * @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 PA=[["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"}]],FN=je("undo-2",PA);/** + * @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 OA=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],DA=je("undo",OA);/** + * @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 LA=[["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"}]],Uu=je("upload",LA);/** + * @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 _A=[["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"}]],vg=je("user-plus",_A);/** + * @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 zA=[["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"}]],La=je("user",zA);/** + * @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 $A=[["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"}]],Pn=je("users",$A);/** + * @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 FA=[["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"}]],Yo=je("wallet",FA);/** + * @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 BA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],er=je("x",BA);/** + * @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 VA=[["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"}]],Bi=je("zap",VA),kx="admin_token";function Sx(){try{return localStorage.getItem(kx)}catch{return null}}function HA(t){try{localStorage.setItem(kx,t)}catch{}}function WA(){try{localStorage.removeItem(kx)}catch{}}const UA="https://soulapi.quwanzhi.com",KA=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):UA};function Qo(t){const e=KA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function Gh(t,e={}){const{data:n,...r}=e,s=Qo(t),a=new Headers(r.headers),o=Sx();o&&a.set("Authorization",`Bearer ${o}`),n!=null&&!a.has("Content-Type")&&a.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=await fetch(s,{...r,headers:a,body:c,credentials:"include"}),f=(u.headers.get("Content-Type")||"").includes("application/json")?await u.json():u;if(!u.ok){const m=new Error((f==null?void 0:f.error)||`HTTP ${u.status}`);throw m.status=u.status,m.data=f,m}return f}function Be(t,e){return Gh(t,{...e,method:"GET"})}function ht(t,e,n){return Gh(t,{...n,method:"POST",data:e})}function Rt(t,e,n){return Gh(t,{...n,method:"PUT",data:e})}function Yr(t,e){return Gh(t,{...e,method:"DELETE"})}const qA=[{icon:OM,label:"数据概览",href:"/dashboard"},{icon:zr,label:"内容管理",href:"/content"},{icon:Pn,label:"用户管理",href:"/users"}],Rb=[{icon:Fi,label:"VIP 角色",href:"/vip-roles"},{icon:La,label:"作者详情",href:"/author-settings"},{icon:qh,label:"管理员",href:"/admin-users"},{icon:LN,label:"导师管理",href:"/mentors"},{icon:kc,label:"导师预约",href:"/mentor-consultations"},{icon:Yo,label:"推广中心",href:"/distribution"},{icon:_N,label:"找伙伴",href:"/find-partner"},{icon:hM,label:"匹配记录",href:"/match-records"},{icon:pg,label:"推广设置",href:"/referral-settings"}];function GA(){const t=sa(),e=ia(),[n,r]=b.useState(!1),[s,a]=b.useState(!1),[o,c]=b.useState(!1);b.useEffect(()=>{r(!0)},[]),b.useEffect(()=>{Rb.some(f=>t.pathname===f.href)&&c(!0)},[t.pathname]),b.useEffect(()=>{if(!n)return;a(!1);let h=!1;return Be("/api/admin").then(f=>{h||(f&&f.success!==!1?a(!0):e("/login",{replace:!0}))}).catch(()=>{h||e("/login",{replace:!0})}),()=>{h=!0}},[n,e]);const u=async()=>{WA();try{await ht("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!s?i.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[i.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):i.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[i.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[i.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[i.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),i.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),i.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[qA.map(h=>{const f=t.pathname===h.href;return i.jsxs(Iu,{to:h.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${f?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[i.jsx(h.icon,{className:"w-5 h-5 shrink-0"}),i.jsx("span",{className:"text-sm",children:h.label})]},h.href)}),i.jsx("button",{type:"button",onClick:()=>c(!o),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:i.jsxs("span",{className:"flex items-center gap-3",children:[o?i.jsx(jx,{className:"w-5 h-5"}):i.jsx(Jo,{className:"w-5 h-5"}),i.jsx("span",{className:"text-sm",children:"更多"})]})}),o&&i.jsx("div",{className:"space-y-1 pl-4",children:Rb.map(h=>{const f=t.pathname===h.href;return i.jsxs(Iu,{to:h.href,className:`flex items-center gap-3 px-4 py-2 rounded-lg transition-colors ${f?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[i.jsx(h.icon,{className:"w-5 h-5 shrink-0"}),i.jsx("span",{className:"text-sm",children:h.label})]},h.href)})}),i.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:i.jsxs(Iu,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${t.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[i.jsx(Da,{className:"w-5 h-5 shrink-0"}),i.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),i.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:i.jsxs("button",{type:"button",onClick:u,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:[i.jsx(WM,{className:"w-5 h-5"}),i.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),i.jsx("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0",children:i.jsx("div",{className:"w-full min-w-[1024px] min-h-full",children:i.jsx(lT,{})})})]})}function Ib(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Cx(...t){return e=>{let n=!1;const r=t.map(s=>{const a=Ib(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s{let{children:a,...o}=r;BN(a)&&typeof Ku=="function"&&(a=Ku(a._payload));const c=b.Children.toArray(a),u=c.find(ZA);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return i.jsx(e,{...o,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return i.jsx(e,{...o,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}var HN=VN("Slot");function QA(t){const e=b.forwardRef((n,r)=>{let{children:s,...a}=n;if(BN(s)&&typeof Ku=="function"&&(s=Ku(s._payload)),b.isValidElement(s)){const o=tR(s),c=eR(a,s.props);return s.type!==b.Fragment&&(c.ref=r?Cx(r,o):o),b.cloneElement(s,c)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var XA=Symbol("radix.slottable");function ZA(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===XA}function eR(t,e){const n={...e};for(const r in e){const s=t[r],a=e[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...c)=>{const u=a(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function tR(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function WN(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Ob=UN,KN=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Ob(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:a}=e,o=Object.keys(s).map(h=>{const f=n==null?void 0:n[h],m=a==null?void 0:a[h];if(f===null)return null;const g=Pb(f)||Pb(m);return s[h][g]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...y}=f;return Object.entries(y).every(v=>{let[j,w]=v;return Array.isArray(w)?w.includes({...a,...c}[j]):{...a,...c}[j]===w})?[...h,m,g]:h},[]);return Ob(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},nR=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),qN=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),qu="-",Db=[],sR="arbitrary..",iR=t=>{const e=oR(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return aR(o);const c=o.split(qu),u=c[0]===""&&c.length>1?1:0;return GN(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?nR(h,u):u:h||Db}return n[o]||Db}}},GN=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],a=n.nextPart.get(s);if(a){const h=GN(t,e+1,a);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(qu):t.slice(e).join(qu),u=o.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?sR+r:void 0})(),oR=t=>{const{theme:e,classGroups:n}=t;return lR(n,e)},lR=(t,e)=>{const n=qN();for(const r in t){const s=t[r];Ex(s,n,r,e)}return n},Ex=(t,e,n,r)=>{const s=t.length;for(let a=0;a{if(typeof t=="string"){dR(t,e,n);return}if(typeof t=="function"){uR(t,e,n,r);return}hR(t,e,n,r)},dR=(t,e,n)=>{const r=t===""?e:JN(e,t);r.classGroupId=n},uR=(t,e,n,r)=>{if(fR(t)){Ex(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(rR(n,t))},hR=(t,e,n,r)=>{const s=Object.entries(t),a=s.length;for(let o=0;o{let n=t;const r=e.split(qu),s=r.length;for(let a=0;a"isThemeGetter"in t&&t.isThemeGetter===!0,pR=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(a,o)=>{n[a]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(a){let o=n[a];if(o!==void 0)return o;if((o=r[a])!==void 0)return s(a,o),o},set(a,o){a in n?n[a]=o:s(a,o)}}},bg="!",Lb=":",mR=[],_b=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),gR=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const a=[];let o=0,c=0,u=0,h;const f=s.length;for(let j=0;ju?h-u:void 0;return _b(a,y,g,v)};if(e){const s=e+Lb,a=r;r=o=>o.startsWith(s)?a(o.slice(s.length)):_b(mR,!1,o,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},xR=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},yR=t=>({cache:pR(t.cacheSize),parseClassName:gR(t),sortModifiers:xR(t),...iR(t)}),vR=/\s+/,bR=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=e,o=[],c=t.trim().split(vR);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:j}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let w=!!j,k=r(w?v.substring(0,j):v);if(!k){if(!w){u=f+(u.length>0?" "+u:u);continue}if(k=r(v),!k){u=f+(u.length>0?" "+u:u);continue}w=!1}const E=g.length===0?"":g.length===1?g[0]:a(g).join(":"),C=y?E+bg:E,M=C+k;if(o.indexOf(M)>-1)continue;o.push(M);const D=s(k,w);for(let F=0;F0?" "+u:u)}return u},wR=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,a;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=yR(h),r=n.cache.get,s=n.cache.set,a=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=bR(u,n);return s(u,f),f};return a=o,(...u)=>a(wR(...u))},jR=[],un=t=>{const e=n=>n[t]||jR;return e.isThemeGetter=!0,e},QN=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,XN=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kR=/^\d+\/\d+$/,SR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,CR=/\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$/,ER=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,TR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,MR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ao=t=>kR.test(t),at=t=>!!t&&!Number.isNaN(Number(t)),Ti=t=>!!t&&Number.isInteger(Number(t)),gm=t=>t.endsWith("%")&&at(t.slice(0,-1)),Fs=t=>SR.test(t),AR=()=>!0,RR=t=>CR.test(t)&&!ER.test(t),ZN=()=>!1,IR=t=>TR.test(t),PR=t=>MR.test(t),OR=t=>!De(t)&&!Le(t),DR=t=>ll(t,nj,ZN),De=t=>QN.test(t),Ta=t=>ll(t,rj,RR),xm=t=>ll(t,FR,at),zb=t=>ll(t,ej,ZN),LR=t=>ll(t,tj,PR),ou=t=>ll(t,sj,IR),Le=t=>XN.test(t),Yl=t=>cl(t,rj),_R=t=>cl(t,BR),$b=t=>cl(t,ej),zR=t=>cl(t,nj),$R=t=>cl(t,tj),lu=t=>cl(t,sj,!0),ll=(t,e,n)=>{const r=QN.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},cl=(t,e,n=!1)=>{const r=XN.exec(t);return r?r[1]?e(r[1]):n:!1},ej=t=>t==="position"||t==="percentage",tj=t=>t==="image"||t==="url",nj=t=>t==="length"||t==="size"||t==="bg-size",rj=t=>t==="length",FR=t=>t==="number",BR=t=>t==="family-name",sj=t=>t==="shadow",VR=()=>{const t=un("color"),e=un("font"),n=un("text"),r=un("font-weight"),s=un("tracking"),a=un("leading"),o=un("breakpoint"),c=un("container"),u=un("spacing"),h=un("radius"),f=un("shadow"),m=un("inset-shadow"),g=un("text-shadow"),y=un("drop-shadow"),v=un("blur"),j=un("perspective"),w=un("aspect"),k=un("ease"),E=un("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...M(),Le,De],F=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],I=()=>[Le,De,u],A=()=>[Ao,"full","auto",...I()],O=()=>[Ti,"none","subgrid",Le,De],W=()=>["auto",{span:["full",Ti,Le,De]},Ti,Le,De],X=()=>[Ti,"auto",Le,De],q=()=>["auto","min","max","fr",Le,De],Z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],_=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...I()],oe=()=>[Ao,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],V=()=>[t,Le,De],ae=()=>[...M(),$b,zb,{position:[Le,De]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",zR,DR,{size:[Le,De]}],H=()=>[gm,Yl,Ta],ue=()=>["","none","full",h,Le,De],U=()=>["",at,Yl,Ta],he=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=()=>[at,gm,$b,zb],de=()=>["","none",v,Le,De],Ce=()=>["none",at,Le,De],B=()=>["none",at,Le,De],me=()=>[at,Le,De],Se=()=>[Ao,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fs],breakpoint:[Fs],color:[AR],container:[Fs],"drop-shadow":[Fs],ease:["in","out","in-out"],font:[OR],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fs],shadow:[Fs],spacing:["px",at],text:[Fs],"text-shadow":[Fs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ao,De,Le,w]}],container:["container"],columns:[{columns:[at,De,Le,c]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"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:D()}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Ti,"auto",Le,De]}],basis:[{basis:[Ao,"full","auto",c,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[at,Ao,"auto","initial","none",De]}],grow:[{grow:["",at,Le,De]}],shrink:[{shrink:["",at,Le,De]}],order:[{order:[Ti,"first","last","none",Le,De]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:W()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:W()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":q()}],"auto-rows":[{"auto-rows":q()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...Z(),"normal"]}],"justify-items":[{"justify-items":[..._(),"normal"]}],"justify-self":[{"justify-self":["auto",..._()]}],"align-content":[{content:["normal",...Z()]}],"align-items":[{items:[..._(),{baseline:["","last"]}]}],"align-self":[{self:["auto",..._(),{baseline:["","last"]}]}],"place-content":[{"place-content":Z()}],"place-items":[{"place-items":[..._(),"baseline"]}],"place-self":[{"place-self":["auto",..._()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:oe()}],w:[{w:[c,"screen",...oe()]}],"min-w":[{"min-w":[c,"screen","none",...oe()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...oe()]}],h:[{h:["screen","lh",...oe()]}],"min-h":[{"min-h":["screen","lh","none",...oe()]}],"max-h":[{"max-h":["screen","lh",...oe()]}],"font-size":[{text:["base",n,Yl,Ta]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Le,xm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gm,De]}],"font-family":[{font:[_R,De,e]}],"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:[s,Le,De]}],"line-clamp":[{"line-clamp":[at,"none",Le,xm]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",Le,De]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Le,De]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[at,"from-font","auto",Le,Ta]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[at,"auto",Le,De]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Le,De]}],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",Le,De]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ae()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ti,Le,De],radial:["",Le,De],conic:[Ti,Le,De]},$R,LR]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[at,Le,De]}],"outline-w":[{outline:["",at,Yl,Ta]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",f,lu,ou]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",m,lu,ou]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[at,Ta]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",g,lu,ou]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[at,Le,De]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"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":[at]}],"mask-image-linear-from-pos":[{"mask-linear-from":ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":ee()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":ee()}],"mask-image-t-to-pos":[{"mask-t-to":ee()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":ee()}],"mask-image-r-to-pos":[{"mask-r-to":ee()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":ee()}],"mask-image-b-to-pos":[{"mask-b-to":ee()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":ee()}],"mask-image-l-to-pos":[{"mask-l-to":ee()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":ee()}],"mask-image-x-to-pos":[{"mask-x-to":ee()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":ee()}],"mask-image-y-to-pos":[{"mask-y-to":ee()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[Le,De]}],"mask-image-radial-from-pos":[{"mask-radial-from":ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":ee()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"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":M()}],"mask-image-conic-pos":[{"mask-conic":[at]}],"mask-image-conic-from-pos":[{"mask-conic-from":ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":ee()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ae()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Le,De]}],filter:[{filter:["","none",Le,De]}],blur:[{blur:de()}],brightness:[{brightness:[at,Le,De]}],contrast:[{contrast:[at,Le,De]}],"drop-shadow":[{"drop-shadow":["","none",y,lu,ou]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",at,Le,De]}],"hue-rotate":[{"hue-rotate":[at,Le,De]}],invert:[{invert:["",at,Le,De]}],saturate:[{saturate:[at,Le,De]}],sepia:[{sepia:["",at,Le,De]}],"backdrop-filter":[{"backdrop-filter":["","none",Le,De]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[at,Le,De]}],"backdrop-contrast":[{"backdrop-contrast":[at,Le,De]}],"backdrop-grayscale":[{"backdrop-grayscale":["",at,Le,De]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[at,Le,De]}],"backdrop-invert":[{"backdrop-invert":["",at,Le,De]}],"backdrop-opacity":[{"backdrop-opacity":[at,Le,De]}],"backdrop-saturate":[{"backdrop-saturate":[at,Le,De]}],"backdrop-sepia":[{"backdrop-sepia":["",at,Le,De]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Le,De]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[at,"initial",Le,De]}],ease:[{ease:["linear","initial",k,Le,De]}],delay:[{delay:[at,Le,De]}],animate:[{animate:["none",E,Le,De]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Le,De]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:Ce()}],"rotate-x":[{"rotate-x":Ce()}],"rotate-y":[{"rotate-y":Ce()}],"rotate-z":[{"rotate-z":Ce()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[Le,De,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"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",Le,De]}],"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":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",Le,De]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[at,Yl,Ta,xm]}],stroke:[{stroke:["none",...V()]}],"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"]}},HR=NR(VR);function xt(...t){return HR(UN(t))}const WR=KN("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 re({className:t,variant:e,size:n,asChild:r=!1,...s}){const a=r?HN:"button";return i.jsx(a,{"data-slot":"button",className:xt(WR({variant:e,size:n,className:t})),...s})}function ce({className:t,type:e,...n}){return i.jsx("input",{type:e,"data-slot":"input",className:xt("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",t),...n})}function UR(){const t=ia(),[e,n]=b.useState(""),[r,s]=b.useState(""),[a,o]=b.useState(""),[c,u]=b.useState(!1),h=async()=>{o(""),u(!0);try{const f=await ht("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){HA(f.token),t("/dashboard",{replace:!0});return}o(f.error||"用户名或密码错误")}catch(f){const m=f;o(m.status===401?"用户名或密码错误":(m==null?void 0:m.message)||"网络错误,请重试")}finally{u(!1)}};return i.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[i.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[i.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),i.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),i.jsxs("div",{className:"w-full max-w-md relative z-10",children:[i.jsxs("div",{className:"text-center mb-8",children:[i.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:i.jsx(qh,{className:"w-8 h-8 text-[#38bdac]"})}),i.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),i.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),i.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[i.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),i.jsxs("div",{className:"relative",children:[i.jsx(La,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),i.jsx(ce,{type:"text",value:e,onChange:f=>n(f.target.value),placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),i.jsxs("div",{className:"relative",children:[i.jsx(VM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),i.jsx(ce,{type:"password",value:r,onChange:f=>s(f.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),a&&i.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:a}),i.jsx(re,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),i.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Ee=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:xt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Ee.displayName="Card";const et=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:xt("flex flex-col space-y-1.5 p-6",t),...e}));et.displayName="CardHeader";const tt=b.forwardRef(({className:t,...e},n)=>i.jsx("h3",{ref:n,className:xt("font-semibold leading-none tracking-tight",t),...e}));tt.displayName="CardTitle";const It=b.forwardRef(({className:t,...e},n)=>i.jsx("p",{ref:n,className:xt("text-sm text-muted-foreground",t),...e}));It.displayName="CardDescription";const Te=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:xt("p-6 pt-0",t),...e}));Te.displayName="CardContent";const KR=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{ref:n,className:xt("flex items-center p-6 pt-0",t),...e}));KR.displayName="CardFooter";function nt(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t==null||t(s),n===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function qR(t,e){const n=b.createContext(e),r=a=>{const{children:o,...c}=a,u=b.useMemo(()=>c,Object.values(c));return i.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function s(a){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${t}\``)}return[r,s]}function aa(t,e=[]){let n=[];function r(a,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...v}=m,j=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,w=b.useMemo(()=>v,Object.values(v));return i.jsx(j.Provider,{value:w,children:y})};h.displayName=a+"Provider";function f(m,g){var j;const y=((j=g==null?void 0:g[t])==null?void 0:j[u])||c,v=b.useContext(y);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[h,f]}const s=()=>{const a=n.map(o=>b.createContext(o));return function(c){const u=(c==null?void 0:c[t])||a;return b.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return s.scopeName=t,[r,GR(s,...e)]}function GR(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(a)[`__scope${h}`];return{...c,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Vn=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},JR=Wh[" useId ".trim().toString()]||(()=>{}),YR=0;function qi(t){const[e,n]=b.useState(JR());return Vn(()=>{n(r=>r??String(YR++))},[t]),e?`radix-${e}`:""}var QR=Wh[" useInsertionEffect ".trim().toString()]||Vn;function Va({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[s,a,o]=XR({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:s;{const f=b.useRef(t!==void 0);b.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"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.`),f.current=c},[c,r])}const h=b.useCallback(f=>{var m;if(c){const g=ZR(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else a(f)},[c,t,a,o]);return[u,h]}function XR({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),s=b.useRef(n),a=b.useRef(e);return QR(()=>{a.current=e},[e]),b.useEffect(()=>{var o;s.current!==n&&((o=a.current)==null||o.call(a,n),s.current=n)},[n,s]),[n,r,a]}function ZR(t){return typeof t=="function"}function Cc(t){const e=e5(t),n=b.forwardRef((r,s)=>{const{children:a,...o}=r,c=b.Children.toArray(a),u=c.find(n5);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return i.jsx(e,{...o,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return i.jsx(e,{...o,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}function e5(t){const e=b.forwardRef((n,r)=>{const{children:s,...a}=n;if(b.isValidElement(s)){const o=s5(s),c=r5(a,s.props);return s.type!==b.Fragment&&(c.ref=r?Cx(r,o):o),b.cloneElement(s,c)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var t5=Symbol("radix.slottable");function n5(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===t5}function r5(t,e){const n={...e};for(const r in e){const s=t[r],a=e[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...c)=>{const u=a(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function s5(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var i5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ot=i5.reduce((t,e)=>{const n=Cc(`Primitive.${e}`),r=b.forwardRef((s,a)=>{const{asChild:o,...c}=s,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function a5(t,e){t&&Bc.flushSync(()=>t.dispatchEvent(e))}function Xi(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function o5(t,e=globalThis==null?void 0:globalThis.document){const n=Xi(t);b.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var l5="DismissableLayer",wg="dismissableLayer.update",c5="dismissableLayer.pointerDownOutside",d5="dismissableLayer.focusOutside",Fb,ij=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Tx=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(ij),[f,m]=b.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),v=gt(e,R=>m(R)),j=Array.from(h.layers),[w]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(w),E=f?j.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,M=E>=k,D=f5(R=>{const I=R.target,A=[...h.branches].some(O=>O.contains(I));!M||A||(s==null||s(R),o==null||o(R),R.defaultPrevented||c==null||c())},g),F=p5(R=>{const I=R.target;[...h.branches].some(O=>O.contains(I))||(a==null||a(R),o==null||o(R),R.defaultPrevented||c==null||c())},g);return o5(R=>{E===h.layers.size-1&&(r==null||r(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))},g),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Fb=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),Bb(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Fb)}},[f,g,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),Bb())},[f,h]),b.useEffect(()=>{const R=()=>y({});return document.addEventListener(wg,R),()=>document.removeEventListener(wg,R)},[]),i.jsx(ot.div,{...u,ref:v,style:{pointerEvents:C?M?"auto":"none":void 0,...t.style},onFocusCapture:nt(t.onFocusCapture,F.onFocusCapture),onBlurCapture:nt(t.onBlurCapture,F.onBlurCapture),onPointerDownCapture:nt(t.onPointerDownCapture,D.onPointerDownCapture)})});Tx.displayName=l5;var u5="DismissableLayerBranch",h5=b.forwardRef((t,e)=>{const n=b.useContext(ij),r=b.useRef(null),s=gt(e,r);return b.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),i.jsx(ot.div,{...t,ref:s})});h5.displayName=u5;function f5(t,e=globalThis==null?void 0:globalThis.document){const n=Xi(t),r=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const a=c=>{if(c.target&&!r.current){let u=function(){aj(c5,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=u,e.addEventListener("click",s.current,{once:!0})):u()}else e.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",a),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function p5(t,e=globalThis==null?void 0:globalThis.document){const n=Xi(t),r=b.useRef(!1);return b.useEffect(()=>{const s=a=>{a.target&&!r.current&&aj(d5,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Bb(){const t=new CustomEvent(wg);document.dispatchEvent(t)}function aj(t,e,n,{discrete:r}){const s=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?a5(s,a):s.dispatchEvent(a)}var ym="focusScope.autoFocusOnMount",vm="focusScope.autoFocusOnUnmount",Vb={bubbles:!1,cancelable:!0},m5="FocusScope",Mx=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=t,[c,u]=b.useState(null),h=Xi(s),f=Xi(a),m=b.useRef(null),g=gt(e,j=>u(j)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let j=function(C){if(y.paused||!c)return;const M=C.target;c.contains(M)?m.current=M:Ri(m.current,{select:!0})},w=function(C){if(y.paused||!c)return;const M=C.relatedTarget;M!==null&&(c.contains(M)||Ri(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const D of C)D.removedNodes.length>0&&Ri(c)};document.addEventListener("focusin",j),document.addEventListener("focusout",w);const E=new MutationObserver(k);return c&&E.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",w),E.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){Wb.add(y);const j=document.activeElement;if(!c.contains(j)){const k=new CustomEvent(ym,Vb);c.addEventListener(ym,h),c.dispatchEvent(k),k.defaultPrevented||(g5(w5(oj(c)),{select:!0}),document.activeElement===j&&Ri(c))}return()=>{c.removeEventListener(ym,h),setTimeout(()=>{const k=new CustomEvent(vm,Vb);c.addEventListener(vm,f),c.dispatchEvent(k),k.defaultPrevented||Ri(j??document.body,{select:!0}),c.removeEventListener(vm,f),Wb.remove(y)},0)}}},[c,h,f,y]);const v=b.useCallback(j=>{if(!n&&!r||y.paused)return;const w=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(w&&k){const E=j.currentTarget,[C,M]=x5(E);C&&M?!j.shiftKey&&k===M?(j.preventDefault(),n&&Ri(C,{select:!0})):j.shiftKey&&k===C&&(j.preventDefault(),n&&Ri(M,{select:!0})):k===E&&j.preventDefault()}},[n,r,y.paused]);return i.jsx(ot.div,{tabIndex:-1,...o,ref:g,onKeyDown:v})});Mx.displayName=m5;function g5(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Ri(r,{select:e}),document.activeElement!==n)return}function x5(t){const e=oj(t),n=Hb(e,t),r=Hb(e.reverse(),t);return[n,r]}function oj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Hb(t,e){for(const n of t)if(!y5(n,{upTo:e}))return n}function y5(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function v5(t){return t instanceof HTMLInputElement&&"select"in t}function Ri(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&v5(t)&&e&&t.select()}}var Wb=b5();function b5(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Ub(t,e),t.unshift(e)},remove(e){var n;t=Ub(t,e),(n=t[0])==null||n.resume()}}}function Ub(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function w5(t){return t.filter(e=>e.tagName!=="A")}var N5="Portal",Ax=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[s,a]=b.useState(!1);Vn(()=>a(!0),[]);const o=n||s&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?bN.createPortal(i.jsx(ot.div,{...r,ref:e}),o):null});Ax.displayName=N5;function j5(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var Vc=t=>{const{present:e,children:n}=t,r=k5(e),s=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),a=gt(r.ref,S5(s));return typeof n=="function"||r.isPresent?b.cloneElement(s,{ref:a}):null};Vc.displayName="Presence";function k5(t){const[e,n]=b.useState(),r=b.useRef(null),s=b.useRef(t),a=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=j5(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=cu(r.current);a.current=c==="mounted"?h:"none"},[c]),Vn(()=>{const h=r.current,f=s.current;if(f!==t){const g=a.current,y=cu(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,u]),Vn(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const j=cu(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&j&&(u("ANIMATION_END"),!s.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},g=y=>{y.target===e&&(a.current=cu(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:b.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function cu(t){return(t==null?void 0:t.animationName)||"none"}function S5(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var bm=0;function lj(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Kb()),document.body.insertAdjacentElement("beforeend",t[1]??Kb()),bm++,()=>{bm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),bm--}},[])}function Kb(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var bs=function(){return bs=Object.assign||function(e){for(var n,r=1,s=arguments.length;r"u")return V5;var e=H5(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},U5=hj(),Uo="data-scroll-locked",K5=function(t,e,n,r){var s=t.left,a=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` + .`.concat(E5,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(c,"px ").concat(r,`; + } + body[`).concat(Uo,`] { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(s,`px; + padding-top: `).concat(a,`px; + padding-right: `).concat(o,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(c,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(Pu,` { + right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(Ou,` { + margin-right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(Pu," .").concat(Pu,` { + right: 0 `).concat(r,`; + } + + .`).concat(Ou," .").concat(Ou,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(Uo,`] { + `).concat(T5,": ").concat(c,`px; + } +`)},Gb=function(){var t=parseInt(document.body.getAttribute(Uo)||"0",10);return isFinite(t)?t:0},q5=function(){b.useEffect(function(){return document.body.setAttribute(Uo,(Gb()+1).toString()),function(){var t=Gb()-1;t<=0?document.body.removeAttribute(Uo):document.body.setAttribute(Uo,t.toString())}},[])},G5=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;q5();var a=b.useMemo(function(){return W5(s)},[s]);return b.createElement(U5,{styles:K5(a,!e,s,n?"":"!important")})},Ng=!1;if(typeof window<"u")try{var du=Object.defineProperty({},"passive",{get:function(){return Ng=!0,!0}});window.addEventListener("test",du,du),window.removeEventListener("test",du,du)}catch{Ng=!1}var Ro=Ng?{passive:!1}:!1,J5=function(t){return t.tagName==="TEXTAREA"},fj=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!J5(t)&&n[e]==="visible")},Y5=function(t){return fj(t,"overflowY")},Q5=function(t){return fj(t,"overflowX")},Jb=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=pj(t,r);if(s){var a=mj(t,r),o=a[1],c=a[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},X5=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Z5=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},pj=function(t,e){return t==="v"?Y5(e):Q5(e)},mj=function(t,e){return t==="v"?X5(e):Z5(e)},eI=function(t,e){return t==="h"&&e==="rtl"?-1:1},tI=function(t,e,n,r,s){var a=eI(t,window.getComputedStyle(e).direction),o=a*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var y=mj(t,c),v=y[0],j=y[1],w=y[2],k=j-w-a*v;(v||k)&&pj(t,c)&&(m+=k,g+=v);var E=c.parentNode;c=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(h=!0),h},uu=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Yb=function(t){return[t.deltaX,t.deltaY]},Qb=function(t){return t&&"current"in t?t.current:t},nI=function(t,e){return t[0]===e[0]&&t[1]===e[1]},rI=function(t){return` + .block-interactivity-`.concat(t,` {pointer-events: none;} + .allow-interactivity-`).concat(t,` {pointer-events: all;} +`)},sI=0,Io=[];function iI(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),s=b.useState(sI++)[0],a=b.useState(hj)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var j=C5([t.lockRef.current],(t.shards||[]).map(Qb),!0).filter(Boolean);return j.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),j.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(j,w){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!o.current.allowPinchZoom;var k=uu(j),E=n.current,C="deltaX"in j?j.deltaX:E[0]-k[0],M="deltaY"in j?j.deltaY:E[1]-k[1],D,F=j.target,R=Math.abs(C)>Math.abs(M)?"h":"v";if("touches"in j&&R==="h"&&F.type==="range")return!1;var I=window.getSelection(),A=I&&I.anchorNode,O=A?A===F||A.contains(F):!1;if(O)return!1;var W=Jb(R,F);if(!W)return!0;if(W?D=R:(D=R==="v"?"h":"v",W=Jb(R,F)),!W)return!1;if(!r.current&&"changedTouches"in j&&(C||M)&&(r.current=D),!D)return!0;var X=r.current||D;return tI(X,w,j,X==="h"?C:M)},[]),u=b.useCallback(function(j){var w=j;if(!(!Io.length||Io[Io.length-1]!==a)){var k="deltaY"in w?Yb(w):uu(w),E=e.current.filter(function(D){return D.name===w.type&&(D.target===w.target||w.target===D.shadowParent)&&nI(D.delta,k)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var C=(o.current.shards||[]).map(Qb).filter(Boolean).filter(function(D){return D.contains(w.target)}),M=C.length>0?c(w,C[0]):!o.current.noIsolation;M&&w.cancelable&&w.preventDefault()}}},[]),h=b.useCallback(function(j,w,k,E){var C={name:j,delta:w,target:k,should:E,shadowParent:aI(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(M){return M!==C})},1)},[]),f=b.useCallback(function(j){n.current=uu(j),r.current=void 0},[]),m=b.useCallback(function(j){h(j.type,Yb(j),j.target,c(j,t.lockRef.current))},[]),g=b.useCallback(function(j){h(j.type,uu(j),j.target,c(j,t.lockRef.current))},[]);b.useEffect(function(){return Io.push(a),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Ro),document.addEventListener("touchmove",u,Ro),document.addEventListener("touchstart",f,Ro),function(){Io=Io.filter(function(j){return j!==a}),document.removeEventListener("wheel",u,Ro),document.removeEventListener("touchmove",u,Ro),document.removeEventListener("touchstart",f,Ro)}},[]);var y=t.removeScrollBar,v=t.inert;return b.createElement(b.Fragment,null,v?b.createElement(a,{styles:rI(s)}):null,y?b.createElement(G5,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function aI(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const oI=D5(uj,iI);var Rx=b.forwardRef(function(t,e){return b.createElement(Jh,bs({},t,{ref:e,sideCar:oI}))});Rx.classNames=Jh.classNames;var lI=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Po=new WeakMap,hu=new WeakMap,fu={},km=0,gj=function(t){return t&&(t.host||gj(t.parentNode))},cI=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=gj(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},dI=function(t,e,n,r){var s=cI(e,Array.isArray(t)?t:[t]);fu[n]||(fu[n]=new WeakMap);var a=fu[n],o=[],c=new Set,u=new Set(s),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};s.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))f(g);else try{var y=g.getAttribute(r),v=y!==null&&y!=="false",j=(Po.get(g)||0)+1,w=(a.get(g)||0)+1;Po.set(g,j),a.set(g,w),o.push(g),j===1&&v&&hu.set(g,!0),w===1&&g.setAttribute(n,"true"),v||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),km++,function(){o.forEach(function(m){var g=Po.get(m)-1,y=a.get(m)-1;Po.set(m,g),a.set(m,y),g||(hu.has(m)||m.removeAttribute(r),hu.delete(m)),y||m.removeAttribute(n)}),km--,km||(Po=new WeakMap,Po=new WeakMap,hu=new WeakMap,fu={})}},xj=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=lI(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),dI(r,s,n,"aria-hidden")):function(){return null}},Yh="Dialog",[yj]=aa(Yh),[uI,ns]=yj(Yh),vj=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:o=!0}=t,c=b.useRef(null),u=b.useRef(null),[h,f]=Va({prop:r,defaultProp:s??!1,onChange:a,caller:Yh});return i.jsx(uI,{scope:e,triggerRef:c,contentRef:u,contentId:qi(),titleId:qi(),descriptionId:qi(),open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};vj.displayName=Yh;var bj="DialogTrigger",hI=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(bj,n),a=gt(e,s.triggerRef);return i.jsx(ot.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Ox(s.open),...r,ref:a,onClick:nt(t.onClick,s.onOpenToggle)})});hI.displayName=bj;var Ix="DialogPortal",[fI,wj]=yj(Ix,{forceMount:void 0}),Nj=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,a=ns(Ix,e);return i.jsx(fI,{scope:e,forceMount:n,children:b.Children.map(r,o=>i.jsx(Vc,{present:n||a.open,children:i.jsx(Ax,{asChild:!0,container:s,children:o})}))})};Nj.displayName=Ix;var Gu="DialogOverlay",jj=b.forwardRef((t,e)=>{const n=wj(Gu,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,a=ns(Gu,t.__scopeDialog);return a.modal?i.jsx(Vc,{present:r||a.open,children:i.jsx(mI,{...s,ref:e})}):null});jj.displayName=Gu;var pI=Cc("DialogOverlay.RemoveScroll"),mI=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(Gu,n);return i.jsx(Rx,{as:pI,allowPinchZoom:!0,shards:[s.contentRef],children:i.jsx(ot.div,{"data-state":Ox(s.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Ha="DialogContent",kj=b.forwardRef((t,e)=>{const n=wj(Ha,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,a=ns(Ha,t.__scopeDialog);return i.jsx(Vc,{present:r||a.open,children:a.modal?i.jsx(gI,{...s,ref:e}):i.jsx(xI,{...s,ref:e})})});kj.displayName=Ha;var gI=b.forwardRef((t,e)=>{const n=ns(Ha,t.__scopeDialog),r=b.useRef(null),s=gt(e,n.contentRef,r);return b.useEffect(()=>{const a=r.current;if(a)return xj(a)},[]),i.jsx(Sj,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nt(t.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:nt(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&a.preventDefault()}),onFocusOutside:nt(t.onFocusOutside,a=>a.preventDefault())})}),xI=b.forwardRef((t,e)=>{const n=ns(Ha,t.__scopeDialog),r=b.useRef(!1),s=b.useRef(!1);return i.jsx(Sj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,a),a.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=a.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),Sj=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,...o}=t,c=ns(Ha,n),u=b.useRef(null),h=gt(e,u);return lj(),i.jsxs(i.Fragment,{children:[i.jsx(Mx,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:i.jsx(Tx,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Ox(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(yI,{titleId:c.titleId}),i.jsx(bI,{contentRef:u,descriptionId:c.descriptionId})]})]})}),Px="DialogTitle",Cj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(Px,n);return i.jsx(ot.h2,{id:s.titleId,...r,ref:e})});Cj.displayName=Px;var Ej="DialogDescription",Tj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(Ej,n);return i.jsx(ot.p,{id:s.descriptionId,...r,ref:e})});Tj.displayName=Ej;var Mj="DialogClose",Aj=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=ns(Mj,n);return i.jsx(ot.button,{type:"button",...r,ref:e,onClick:nt(t.onClick,()=>s.onOpenChange(!1))})});Aj.displayName=Mj;function Ox(t){return t?"open":"closed"}var Rj="DialogTitleWarning",[SV,Ij]=qR(Rj,{contentName:Ha,titleName:Px,docsSlug:"dialog"}),yI=({titleId:t})=>{const e=Ij(Rj),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},vI="DialogDescriptionWarning",bI=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ij(vI).contentName}}.`;return b.useEffect(()=>{var a;const s=(a=t.current)==null?void 0:a.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},wI=vj,NI=Nj,jI=jj,kI=kj,SI=Cj,CI=Tj,EI=Aj;function Qt(t){return i.jsx(wI,{"data-slot":"dialog",...t})}function TI(t){return i.jsx(NI,{...t})}const Pj=b.forwardRef(({className:t,...e},n)=>i.jsx(jI,{ref:n,className:xt("fixed inset-0 z-50 bg-black/50",t),...e}));Pj.displayName="DialogOverlay";const Ut=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},s)=>i.jsxs(TI,{children:[i.jsx(Pj,{}),i.jsxs(kI,{ref:s,"aria-describedby":void 0,className:xt("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",t),...r,children:[e,n&&i.jsxs(EI,{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:[i.jsx(er,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ut.displayName="DialogContent";function Xt({className:t,...e}){return i.jsx("div",{className:xt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function bn({className:t,...e}){return i.jsx("div",{className:xt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Zt(t){return i.jsx(SI,{className:"text-lg font-semibold leading-none",...t})}function MI(t){return i.jsx(CI,{className:"text-sm text-muted-foreground",...t})}const AI=KN("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 Fe({className:t,variant:e,asChild:n=!1,...r}){const s=n?HN:"span";return i.jsx(s,{className:xt(AI({variant:e}),t),...r})}var RI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],II=RI.reduce((t,e)=>{const n=VN(`Primitive.${e}`),r=b.forwardRef((s,a)=>{const{asChild:o,...c}=s,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),PI="Label",Oj=b.forwardRef((t,e)=>i.jsx(II.label,{...t,ref:e,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Oj.displayName=PI;var Dj=Oj;const te=b.forwardRef(({className:t,...e},n)=>i.jsx(Dj,{ref:n,className:xt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));te.displayName=Dj.displayName;function Dx(t){const e=t+"CollectionProvider",[n,r]=aa(e),[s,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=j=>{const{scope:w,children:k}=j,E=Zn.useRef(null),C=Zn.useRef(new Map).current;return i.jsx(s,{scope:w,itemMap:C,collectionRef:E,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=Cc(c),h=Zn.forwardRef((j,w)=>{const{scope:k,children:E}=j,C=a(c,k),M=gt(w,C.collectionRef);return i.jsx(u,{ref:M,children:E})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=Cc(f),y=Zn.forwardRef((j,w)=>{const{scope:k,children:E,...C}=j,M=Zn.useRef(null),D=gt(w,M),F=a(f,k);return Zn.useEffect(()=>(F.itemMap.set(M,{ref:M,...C}),()=>void F.itemMap.delete(M))),i.jsx(g,{[m]:"",ref:D,children:E})});y.displayName=f;function v(j){const w=a(t+"CollectionConsumer",j);return Zn.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const C=Array.from(E.querySelectorAll(`[${m}]`));return Array.from(w.itemMap.values()).sort((F,R)=>C.indexOf(F.ref.current)-C.indexOf(R.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},v,r]}var OI=b.createContext(void 0);function Qh(t){const e=b.useContext(OI);return t||e||"ltr"}var Sm="rovingFocusGroup.onEntryFocus",DI={bubbles:!1,cancelable:!0},Hc="RovingFocusGroup",[jg,Lj,LI]=Dx(Hc),[_I,_j]=aa(Hc,[LI]),[zI,$I]=_I(Hc),zj=b.forwardRef((t,e)=>i.jsx(jg.Provider,{scope:t.__scopeRovingFocusGroup,children:i.jsx(jg.Slot,{scope:t.__scopeRovingFocusGroup,children:i.jsx(FI,{...t,ref:e})})}));zj.displayName=Hc;var FI=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),y=gt(e,g),v=Qh(a),[j,w]=Va({prop:o,defaultProp:c??null,onChange:u,caller:Hc}),[k,E]=b.useState(!1),C=Xi(h),M=Lj(n),D=b.useRef(!1),[F,R]=b.useState(0);return b.useEffect(()=>{const I=g.current;if(I)return I.addEventListener(Sm,C),()=>I.removeEventListener(Sm,C)},[C]),i.jsx(zI,{scope:n,orientation:r,dir:v,loop:s,currentTabStopId:j,onItemFocus:b.useCallback(I=>w(I),[w]),onItemShiftTab:b.useCallback(()=>E(!0),[]),onFocusableItemAdd:b.useCallback(()=>R(I=>I+1),[]),onFocusableItemRemove:b.useCallback(()=>R(I=>I-1),[]),children:i.jsx(ot.div,{tabIndex:k||F===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:nt(t.onMouseDown,()=>{D.current=!0}),onFocus:nt(t.onFocus,I=>{const A=!D.current;if(I.target===I.currentTarget&&A&&!k){const O=new CustomEvent(Sm,DI);if(I.currentTarget.dispatchEvent(O),!O.defaultPrevented){const W=M().filter($=>$.focusable),X=W.find($=>$.active),q=W.find($=>$.id===j),_=[X,q,...W].filter(Boolean).map($=>$.ref.current);Bj(_,f)}}D.current=!1}),onBlur:nt(t.onBlur,()=>E(!1))})})}),$j="RovingFocusGroupItem",Fj=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:a,children:o,...c}=t,u=qi(),h=a||u,f=$I($j,n),m=f.currentTabStopId===h,g=Lj(n),{onFocusableItemAdd:y,onFocusableItemRemove:v,currentTabStopId:j}=f;return b.useEffect(()=>{if(r)return y(),()=>v()},[r,y,v]),i.jsx(jg.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:i.jsx(ot.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:nt(t.onMouseDown,w=>{r?f.onItemFocus(h):w.preventDefault()}),onFocus:nt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:nt(t.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const k=HI(w,f.orientation,f.dir);if(k!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let C=g().filter(M=>M.focusable).map(M=>M.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const M=C.indexOf(w.currentTarget);C=f.loop?WI(C,M+1):C.slice(M+1)}setTimeout(()=>Bj(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:j!=null}):o})})});Fj.displayName=$j;var BI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function VI(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function HI(t,e,n){const r=VI(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return BI[r]}function Bj(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function WI(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var UI=zj,KI=Fj,Xh="Tabs",[qI]=aa(Xh,[_j]),Vj=_j(),[GI,Lx]=qI(Xh),Hj=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:a,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=Qh(c),[m,g]=Va({prop:r,onChange:s,defaultProp:a??"",caller:Xh});return i.jsx(GI,{scope:n,baseId:qi(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:i.jsx(ot.div,{dir:f,"data-orientation":o,...h,ref:e})})});Hj.displayName=Xh;var Wj="TabsList",Uj=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,a=Lx(Wj,n),o=Vj(n);return i.jsx(UI,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:i.jsx(ot.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:e})})});Uj.displayName=Wj;var Kj="TabsTrigger",qj=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...a}=t,o=Lx(Kj,n),c=Vj(n),u=Yj(o.baseId,r),h=Qj(o.baseId,r),f=r===o.value;return i.jsx(KI,{asChild:!0,...c,focusable:!s,active:f,children:i.jsx(ot.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:u,...a,ref:e,onMouseDown:nt(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:nt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:nt(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!s&&m&&o.onValueChange(r)})})})});qj.displayName=Kj;var Gj="TabsContent",Jj=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:a,...o}=t,c=Lx(Gj,n),u=Yj(c.baseId,r),h=Qj(c.baseId,r),f=r===c.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),i.jsx(Vc,{present:s||f,children:({present:g})=>i.jsx(ot.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&a})})});Jj.displayName=Gj;function Yj(t,e){return`${t}-trigger-${e}`}function Qj(t,e){return`${t}-content-${e}`}var JI=Hj,Xj=Uj,Zj=qj,ek=Jj;const Wc=JI,dl=b.forwardRef(({className:t,...e},n)=>i.jsx(Xj,{ref:n,className:xt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));dl.displayName=Xj.displayName;const en=b.forwardRef(({className:t,...e},n)=>i.jsx(Zj,{ref:n,className:xt("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",t),...e}));en.displayName=Zj.displayName;const tn=b.forwardRef(({className:t,...e},n)=>i.jsx(ek,{ref:n,className:xt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));tn.displayName=ek.displayName;function _x(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function zx(t){const[e,n]=b.useState(void 0);return Vn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let o,c;if("borderBoxSize"in a){const u=a.borderBoxSize,h=Array.isArray(u)?u[0]:u;o=h.inlineSize,c=h.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var Zh="Switch",[YI]=aa(Zh),[QI,XI]=YI(Zh),tk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:a,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=b.useState(null),v=gt(e,C=>y(C)),j=b.useRef(!1),w=g?f||!!g.closest("form"):!0,[k,E]=Va({prop:s,defaultProp:a??!1,onChange:h,caller:Zh});return i.jsxs(QI,{scope:n,checked:k,disabled:c,children:[i.jsx(ot.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":ik(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:v,onClick:nt(t.onClick,C=>{E(M=>!M),w&&(j.current=C.isPropagationStopped(),j.current||C.stopPropagation())})}),w&&i.jsx(sk,{control:g,bubbles:!j.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});tk.displayName=Zh;var nk="SwitchThumb",rk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=XI(nk,n);return i.jsx(ot.span,{"data-state":ik(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});rk.displayName=nk;var ZI="SwitchBubbleInput",sk=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},a)=>{const o=b.useRef(null),c=gt(o,a),u=_x(n),h=zx(e);return b.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const v=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(v)}},[u,n,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:c,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});sk.displayName=ZI;function ik(t){return t?"checked":"unchecked"}var ak=tk,eP=rk;const vt=b.forwardRef(({className:t,...e},n)=>i.jsx(ak,{className:xt("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]",t),...e,ref:n,children:i.jsx(eP,{className:xt("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")})}));vt.displayName=ak.displayName;function $x({open:t,onClose:e,userId:n,onUserUpdated:r}){var Gn;const[s,a]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,j]=b.useState(!1),[w,k]=b.useState("info"),[E,C]=b.useState(""),[M,D]=b.useState(""),[F,R]=b.useState([]),[I,A]=b.useState(""),[O,W]=b.useState(""),[X,q]=b.useState(""),[Z,_]=b.useState(!1),[$,oe]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[V,ae]=b.useState([]),[Y,L]=b.useState(!1),[H,ue]=b.useState(!1),[U,he]=b.useState(null),[Q,ee]=b.useState(null),[de,Ce]=b.useState(""),[B,me]=b.useState(""),[Se,rt]=b.useState(""),[Ye,st]=b.useState(!1),[Qe,Xe]=b.useState(null),[ft,Pt]=b.useState("");b.useEffect(()=>{t&&n&&(k("info"),he(null),ee(null),Xe(null),Pt(""),W(""),q(""),Jt(),Be("/api/db/vip-roles").then(fe=>{fe!=null&&fe.success&&fe.data&&ae(fe.data)}).catch(()=>{}))},[t,n]);async function Jt(){if(n){m(!0);try{const fe=await Be(`/api/db/users?id=${encodeURIComponent(n)}`);if(fe!=null&&fe.success&&fe.user){const ge=fe.user;a(ge),C(ge.phone||""),D(ge.nickname||""),Ce(ge.phone||""),me(ge.wechatId||""),rt(ge.openId||"");try{R(typeof ge.tags=="string"?JSON.parse(ge.tags||"[]"):[])}catch{R([])}oe({isVip:!!(ge.isVip??!1),vipExpireDate:ge.vipExpireDate?String(ge.vipExpireDate).slice(0,10):"",vipRole:String(ge.vipRole??""),vipName:String(ge.vipName??""),vipProject:String(ge.vipProject??""),vipContact:String(ge.vipContact??""),vipBio:String(ge.vipBio??"")})}try{const ge=await Be(`/api/user/track?userId=${encodeURIComponent(n)}&limit=50`);ge!=null&&ge.success&&ge.tracks&&c(ge.tracks)}catch{c([])}try{const ge=await Be(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ge!=null&&ge.success&&ge.referrals&&h(ge.referrals)}catch{h([])}}catch(fe){console.error("Load user detail error:",fe)}finally{m(!1)}}}async function Kn(){if(!(s!=null&&s.phone)){alert("用户未绑定手机号,无法同步");return}y(!0);try{const fe=await ht("/api/ckb/sync",{action:"full_sync",phone:s.phone,userId:s.id});fe!=null&&fe.success?(alert("同步成功"),Jt()):alert("同步失败: "+(fe==null?void 0:fe.error))}catch(fe){console.error("Sync CKB error:",fe),alert("同步失败")}finally{y(!1)}}async function qn(){if(s){j(!0);try{const fe={id:s.id,phone:E||void 0,nickname:M||void 0,tags:JSON.stringify(F)},ge=await Rt("/api/db/users",fe);ge!=null&&ge.success?(alert("保存成功"),Jt(),r==null||r()):alert("保存失败: "+(ge==null?void 0:ge.error))}catch(fe){console.error("Save user error:",fe),alert("保存失败")}finally{j(!1)}}}const ss=()=>{I&&!F.includes(I)&&(R([...F,I]),A(""))},zt=fe=>R(F.filter(ge=>ge!==fe));async function Cr(){if(s){if(!O){alert("请输入新密码");return}if(O!==X){alert("两次密码不一致");return}if(O.length<6){alert("密码至少 6 位");return}_(!0);try{const fe=await Rt("/api/db/users",{id:s.id,password:O});fe!=null&&fe.success?(alert("修改成功"),W(""),q("")):alert("修改失败: "+((fe==null?void 0:fe.error)||""))}catch{alert("修改失败")}finally{_(!1)}}}async function is(){if(s){if($.isVip&&!$.vipExpireDate.trim()){alert("开启 VIP 请填写有效到期日");return}L(!0);try{const fe={id:s.id,isVip:$.isVip,vipExpireDate:$.isVip?$.vipExpireDate:void 0,vipRole:$.vipRole||void 0,vipName:$.vipName||void 0,vipProject:$.vipProject||void 0,vipContact:$.vipContact||void 0,vipBio:$.vipBio||void 0},ge=await Rt("/api/db/users",fe);ge!=null&&ge.success?(alert("VIP 设置已保存"),Jt(),r==null||r()):alert("保存失败: "+((ge==null?void 0:ge.error)||""))}catch{alert("保存失败")}finally{L(!1)}}}async function On(){if(!de&&!Se&&!B){ee("请至少输入手机号、微信号或 OpenID 中的一项");return}ue(!0),ee(null),he(null);try{const fe=new URLSearchParams;de&&fe.set("phone",de),Se&&fe.set("openId",Se),B&&fe.set("wechatId",B);const ge=await Be(`/api/admin/shensheshou/query?${fe}`);ge!=null&&ge.success&&ge.data?(he(ge.data),s&&await pn(ge.data)):ee((ge==null?void 0:ge.error)||"未查询到数据,该用户可能未在神射手收录")}catch(fe){console.error("SSS query error:",fe),ee("请求失败,请检查神射手接口配置")}finally{ue(!1)}}async function pn(fe){if(s)try{await ht("/api/admin/shensheshou/enrich",{userId:s.id,phone:de||s.phone||"",openId:Se||s.openId||"",wechatId:B||s.wechatId||""}),Jt()}catch(ge){console.error("SSS enrich error:",ge)}}async function mr(){if(s){st(!0),Xe(null);try{const fe={users:[{phone:s.phone||"",name:s.nickname||"",openId:s.openId||"",tags:F}]},ge=await ht("/api/admin/shensheshou/ingest",fe);ge!=null&&ge.success&&ge.data?Xe(ge.data):Xe({error:(ge==null?void 0:ge.error)||"推送失败"})}catch(fe){console.error("SSS ingest error:",fe),Xe({error:"请求失败"})}finally{st(!1)}}}const Br=fe=>{const kn={view_chapter:zr,purchase:yg,match:Pn,login:La,register:La,share:Ns,bind_phone:iA,bind_wechat:JM,fill_profile:mm,visit_page:Vo}[fe]||fg;return i.jsx(kn,{className:"w-4 h-4"})};return t?i.jsx(Qt,{open:t,onOpenChange:()=>e(),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(La,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(s==null?void 0:s.phone)&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(s==null?void 0:s.isVip)&&i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),f?i.jsxs("div",{className:"flex items-center justify-center py-20",children:[i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s?i.jsxs("div",{className:"flex flex-col h-[75vh]",children:[i.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-3",children:[i.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac] shrink-0",children:s.avatar?i.jsx("img",{src:s.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Gn=s.nickname)==null?void 0:Gn.charAt(0))||"?"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsx("h3",{className:"text-lg font-bold text-white",children:s.nickname}),s.isAdmin&&i.jsx(Fe,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),s.hasFullBook&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),s.vipRole&&i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 border-0",children:s.vipRole})]}),i.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[s.phone?`📱 ${s.phone}`:"未绑定手机",s.wechatId&&` · 💬 ${s.wechatId}`,s.mbti&&` · ${s.mbti}`]}),i.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[i.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",s.id.slice(0,16),"…"]}),s.referralCode&&i.jsxs("p",{className:"text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"推广码:"}),i.jsx("code",{className:"text-[#38bdac] bg-[#38bdac]/10 px-1.5 py-0.5 rounded",children:s.referralCode})]})]})]}),i.jsxs("div",{className:"text-right shrink-0",children:[i.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(s.earnings||0).toFixed(2)]}),i.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),i.jsxs(Wc,{value:w,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[i.jsxs(dl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[i.jsx(en,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),i.jsx(en,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),i.jsxs(en,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[i.jsx(Vo,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),i.jsx(en,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),i.jsxs(en,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[i.jsx(Bi,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),i.jsxs(tn,{value:"info",className:"flex-1 overflow-auto 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",placeholder:"输入手机号",value:E,onChange:fe=>C(fe.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,onChange:fe=>D(fe.target.value)})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.openId&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"微信 OpenID"}),i.jsx("p",{className:"text-gray-300 font-mono text-xs break-all",children:s.openId})]}),s.region&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[i.jsx($N,{className:"w-4 h-4 text-gray-500"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-500 text-xs",children:"地区"}),i.jsx("p",{className:"text-white",children:s.region})]})]}),s.industry&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"行业"}),i.jsx("p",{className:"text-white",children:s.industry})]}),s.position&&i.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"职位"}),i.jsx("p",{className:"text-white",children:s.position})]})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),i.jsx("p",{className:"text-2xl font-bold text-white",children:s.referralCount??0})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),i.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(s.pendingEarnings??0).toFixed(2)]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),i.jsx("p",{className:"text-sm text-white",children:s.createdAt?new Date(s.createdAt).toLocaleDateString():"-"})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(IM,{className:"w-4 h-4 text-yellow-400"}),i.jsx("span",{className:"text-white font-medium",children:"修改密码"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:O,onChange:fe=>W(fe.target.value)}),i.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:X,onChange:fe=>q(fe.target.value)}),i.jsx(re,{size:"sm",onClick:Cr,disabled:Z||!O||!X,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:Z?"保存中...":"确认修改"})]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Fi,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-white font-medium",children:"设成超级个体"})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(te,{className:"text-gray-400 text-sm",children:"VIP 会员"}),i.jsx(vt,{checked:$.isVip,onCheckedChange:fe=>oe(ge=>({...ge,isVip:fe}))})]}),$.isVip&&i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"到期日"}),i.jsx(ce,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:$.vipExpireDate,onChange:fe=>oe(ge=>({...ge,vipExpireDate:fe.target.value}))})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"角色"}),i.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-2 py-1.5 text-sm",value:$.vipRole,onChange:fe=>oe(ge=>({...ge,vipRole:fe.target.value})),children:[i.jsx("option",{value:"",children:"请选择"}),V.map(fe=>i.jsx("option",{value:fe.name,children:fe.name},fe.id))]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"展示名"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:$.vipName,onChange:fe=>oe(ge=>({...ge,vipName:fe.target.value}))})]}),i.jsx(re,{size:"sm",onClick:is,disabled:Y,className:"bg-amber-500/20 hover:bg-amber-500/30 text-amber-400 border border-amber-500/40",children:Y?"保存中...":"保存 VIP"})]})]})]}),s.isVip&&i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Fi,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:s.vipRole||"VIP"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.vipName&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"展示名:"}),i.jsx("span",{className:"text-white",children:s.vipName})]}),s.vipProject&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"项目:"}),i.jsx("span",{className:"text-white",children:s.vipProject})]}),s.vipContact&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"联系方式:"}),i.jsx("span",{className:"text-white",children:s.vipContact})]}),s.vipExpireDate&&i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"到期时间:"}),i.jsx("span",{className:"text-white",children:new Date(s.vipExpireDate).toLocaleDateString()})]})]}),s.vipBio&&i.jsx("p",{className:"text-gray-400 text-sm mt-2",children:s.vipBio})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-purple-500/20",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Sc,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"微信归属"}),i.jsx("span",{className:"text-gray-500 text-xs",children:"该用户归属在哪个微信号下"})]}),i.jsxs("div",{className:"flex gap-2 items-center",children:[i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:ft,onChange:fe=>Pt(fe.target.value)}),i.jsxs(re,{size:"sm",onClick:async()=>{if(!(!ft||!s))try{await Rt("/api/db/users",{id:s.id,wechatId:ft}),alert("已保存微信归属"),Jt()}catch{alert("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[i.jsx(rn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),s.wechatId&&i.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",i.jsx("span",{className:"text-purple-400",children:s.wechatId})]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ns,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),i.jsx(re,{size:"sm",onClick:Kn,disabled:g||!s.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"同步状态:"}),s.ckbSyncedAt?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-gray-500",children:"最后同步:"}),i.jsx("span",{className:"text-gray-300 ml-1",children:s.ckbSyncedAt?new Date(s.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),i.jsxs(tn,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(mm,{className:"w-4 h-4 text-[#38bdac]"}),i.jsx("span",{className:"text-white font-medium",children:"用户标签"}),i.jsx("span",{className:"text-gray-500 text-xs",children:"基于《一场 Soul 的创业实验》维度打标"})]}),i.jsxs("div",{className:"mb-3 p-2.5 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-center gap-2 text-xs text-gray-400",children:[i.jsx(hg,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),"命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消"]}),i.jsx("div",{className:"mb-4 space-y-3",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(fe=>i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:fe.category}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:fe.tags.map(ge=>i.jsxs("button",{type:"button",onClick:()=>{F.includes(ge)?zt(ge):R([...F,ge])},className:`px-2 py-0.5 rounded text-xs border transition-all ${F.includes(ge)?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-transparent border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300"}`,children:[F.includes(ge)?"✓ ":"",ge]},ge))})]},fe.category))}),i.jsxs("div",{className:"border-t border-gray-700/50 pt-3",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"已选标签"}),i.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 min-h-[32px]",children:[F.map((fe,ge)=>i.jsxs(Fe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[fe,i.jsx("button",{type:"button",onClick:()=>zt(fe),className:"ml-1 hover:text-red-400",children:i.jsx(er,{className:"w-3 h-3"})})]},ge)),F.length===0&&i.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:I,onChange:fe=>A(fe.target.value),onKeyDown:fe=>fe.key==="Enter"&&ss()}),i.jsx(re,{onClick:ss,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),s.ckbTags&&i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(mm,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"存客宝标签"})]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:(typeof s.ckbTags=="string"?s.ckbTags.split(","):[]).map((fe,ge)=>i.jsx(Fe,{className:"bg-purple-500/20 text-purple-400 border-0",children:fe.trim()},ge))})]})]}),i.jsxs(tn,{value:"journey",className:"flex-1 overflow-auto",children:[i.jsxs("div",{className:"mb-3 p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[i.jsx(Vo,{className:"w-4 h-4 text-[#38bdac]"}),i.jsxs("span",{className:"text-gray-400 text-sm",children:["记录用户从注册到付费的完整行动路径,共 ",o.length," 条记录"]})]}),i.jsx("div",{className:"space-y-2",children:o.length>0?o.map((fe,ge)=>i.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex flex-col items-center",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:Br(fe.action)}),ge0?u.map((fe,ge)=>{var ri;const kn=fe;return i.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((ri=kn.nickname)==null?void 0:ri.charAt(0))||"?"}),i.jsx("span",{className:"text-white text-sm",children:kn.nickname})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[kn.status==="vip"&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),i.jsx("span",{className:"text-gray-500 text-xs",children:kn.createdAt?new Date(kn.createdAt).toLocaleDateString():""})]})]},kn.id||ge)}):i.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),i.jsxs(tn,{value:"shensheshou",className:"flex-1 overflow-auto space-y-4",children:[i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Bi,{className:"w-5 h-5 text-[#38bdac]"}),i.jsx("span",{className:"text-white font-medium",children:"用户资料完善"}),i.jsx("span",{className:"text-gray-500 text-xs",children:"通过多维度查询神射手数据,自动回填用户基础信息"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[i.jsxs("div",{children:[i.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:de,onChange:fe=>Ce(fe.target.value)})]}),i.jsxs("div",{children:[i.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:B,onChange:fe=>me(fe.target.value)})]}),i.jsxs("div",{className:"col-span-2",children:[i.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),i.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:Se,onChange:fe=>rt(fe.target.value)})]})]}),i.jsx(re,{onClick:On,disabled:H,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:H?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Ki,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),i.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),Q&&i.jsx("div",{className:"mt-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400 text-sm",children:Q}),U&&i.jsxs("div",{className:"mt-3 space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"神射手 RFM 分"}),i.jsx("p",{className:"text-2xl font-bold text-[#38bdac]",children:U.rfm_score??"-"})]}),i.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"用户等级"}),i.jsx("p",{className:"text-2xl font-bold text-white",children:U.user_level??"-"})]})]}),U.tags&&U.tags.length>0&&i.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[i.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"神射手标签"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:U.tags.map((fe,ge)=>i.jsx(Fe,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:fe},ge))})]}),U.last_active&&i.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",U.last_active]})]})]}),i.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(Bi,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"推送用户数据到神射手"})]}),i.jsx("p",{className:"text-gray-500 text-xs",children:"将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像"})]}),i.jsx(re,{onClick:mr,disabled:Ye||!s.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:Ye?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):i.jsxs(i.Fragment,{children:[i.jsx(Bi,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!s.phone&&i.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),Qe&&i.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:Qe.error?i.jsx("p",{className:"text-red-400",children:String(Qe.error)}):i.jsxs("div",{className:"space-y-1",children:[i.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[i.jsx(hg,{className:"w-4 h-4"})," 推送成功"]}),Qe.enriched!==void 0&&i.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(Qe.new_tags_added??0)]})]})})]})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3",children:[i.jsxs(re,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"关闭"]}),i.jsxs(re,{onClick:qn,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存修改"]})]})]}):i.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}function tP(){const t=ia(),[e,n]=b.useState(!0),[r,s]=b.useState([]),[a,o]=b.useState([]),[c,u]=b.useState(0),[h,f]=b.useState(0),[m,g]=b.useState(0),[y,v]=b.useState(0),[j,w]=b.useState(null),[k,E]=b.useState(null),[C,M]=b.useState(!1);async function D(){var A;n(!0),w(null);try{try{const ae=await Be("/api/admin/dashboard/overview");if(ae!=null&&ae.success){u(ae.totalUsers??0),f(ae.paidOrderCount??0),g(ae.totalRevenue??0),v(ae.conversionRate??0),o(ae.recentOrders??[]),s(ae.newUsers??[]);return}}catch(ae){console.error("数据概览接口失败,尝试降级拉取",ae)}const[O,W]=await Promise.all([Be("/api/db/users?page=1&pageSize=10"),Be("/api/orders?page=1&pageSize=20&status=paid")]),X=typeof(O==null?void 0:O.total)=="number"?O.total:((A=O==null?void 0:O.users)==null?void 0:A.length)??0,q=(W==null?void 0:W.orders)??[],Z=typeof(W==null?void 0:W.total)=="number"?W.total:q.length,_=q.filter(ae=>ae.status==="paid"||ae.status==="completed"||ae.status==="success"),$=_.reduce((ae,Y)=>ae+Number(Y.amount||0),0),oe=new Set(_.map(ae=>ae.userId).filter(Boolean)),V=X>0&&oe.size>0?oe.size/X*100:0;u(X),f(Z),g($),v(V),o(q.slice(0,5)),s((O==null?void 0:O.users)??[])}catch(O){console.error("降级拉取失败",O);const W=O;(W==null?void 0:W.status)===401?w("登录已过期,请重新登录"):(W==null?void 0:W.name)==="AbortError"?w("请求超时,请检查网络后点击重试"):w("加载失败,请检查网络或联系管理员")}finally{n(!1)}}if(b.useEffect(()=>{D();const A=setInterval(D,3e4);return()=>clearInterval(A)},[]),e)return i.jsxs("div",{className:"p-8 w-full",children:[i.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),i.jsxs("div",{className:"flex flex-col items-center justify-center py-24",children:[i.jsx(qe,{className:"w-12 h-12 text-[#38bdac] animate-spin mb-4"}),i.jsx("span",{className:"text-gray-400",children:"加载中..."})]})]});const F=c,R=A=>{const O=A.productType||"",W=A.description||"";if(W){if(O==="section"&&W.includes("章节")){if(W.includes("-")){const X=W.split("-");if(X.length>=3)return{title:`第${X[1]}章 第${X[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:W,subtitle:"章节购买"}}return O==="fullbook"||W.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:O==="match"||W.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:W,subtitle:O==="section"?"单章":O==="fullbook"?"全书":"其他"}}return O==="section"?{title:`章节 ${A.productId||""}`,subtitle:"单章购买"}:O==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:O==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:O||"其他"}},I=[{title:"总用户数",value:F,icon:Pn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:`¥${(m??0).toFixed(2)}`,icon:dc,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:h,icon:yg,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:`${typeof y=="number"?y.toFixed(1):0}%`,icon:zr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"}];return i.jsxs("div",{className:"p-8 w-full",children:[i.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),j&&i.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[i.jsx("span",{children:j}),i.jsx("button",{type:"button",onClick:()=>D(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:I.map((A,O)=>i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>A.link&&t(A.link),children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsx(tt,{className:"text-sm font-medium text-gray-400",children:A.title}),i.jsx("div",{className:`p-2 rounded-lg ${A.bg}`,children:i.jsx(A.icon,{className:`w-4 h-4 ${A.color}`})})]}),i.jsx(Te,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"text-2xl font-bold text-white",children:A.value}),i.jsx(Bo,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},O))}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between",children:[i.jsx(tt,{className:"text-white",children:"最近订单"}),i.jsxs("button",{type:"button",onClick:()=>D(),className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1",title:"刷新",children:[i.jsx(qe,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),i.jsx(Te,{children:i.jsxs("div",{className:"space-y-3",children:[a.slice(0,5).map(A=>{var Z;const O=A.referrerId?r.find(_=>_.id===A.referrerId):void 0,W=A.referralCode||(O==null?void 0:O.referralCode)||(O==null?void 0:O.nickname)||(A.referrerId?String(A.referrerId).slice(0,8):""),X=R(A),q=A.userNickname||((Z=r.find(_=>_.id===A.userId))==null?void 0:Z.nickname)||"匿名用户";return i.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:[i.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[A.userAvatar?i.jsx("img",{src:A.userAvatar,alt:q,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:_=>{_.currentTarget.style.display="none";const $=_.currentTarget.nextElementSibling;$&&$.classList.remove("hidden")}}):null,i.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 ${A.userAvatar?"hidden":""}`,children:q.charAt(0)}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("button",{type:"button",onClick:()=>{A.userId&&(E(A.userId),M(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:q}),i.jsx("span",{className:"text-gray-600",children:"·"}),i.jsx("span",{className:"text-sm font-medium text-white truncate",children:X.title})]}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[X.subtitle&&X.subtitle!=="章节购买"&&i.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:X.subtitle}),i.jsx("span",{children:new Date(A.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),W&&i.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",W]})]})]}),i.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[i.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(A.amount).toFixed(2)]}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:A.paymentMethod||"微信"})]})]},A.id)}),a.length===0&&i.jsxs("div",{className:"text-center py-12",children:[i.jsx(yg,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),i.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"新注册用户"})}),i.jsx(Te,{children:i.jsxs("div",{className:"space-y-3",children:[r.slice(0,5).map(A=>{var O;return i.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((O=A.nickname)==null?void 0:O.charAt(0))||"?"}),i.jsxs("div",{children:[i.jsx("button",{type:"button",onClick:()=>{E(A.id),M(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:A.nickname||"匿名用户"}),i.jsx("p",{className:"text-xs text-gray-500",children:A.phone||"-"})]})]}),i.jsx("p",{className:"text-xs text-gray-400",children:A.createdAt?new Date(A.createdAt).toLocaleDateString():"-"})]},A.id)}),r.length===0&&i.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})]})]}),i.jsx($x,{open:C,onClose:()=>{M(!1),E(null)},userId:k,onUserUpdated:D})]})}const hr=b.forwardRef(({className:t,...e},n)=>i.jsx("div",{className:"relative w-full overflow-auto",children:i.jsx("table",{ref:n,className:xt("w-full caption-bottom text-sm",t),...e})}));hr.displayName="Table";const fr=b.forwardRef(({className:t,...e},n)=>i.jsx("thead",{ref:n,className:xt("[&_tr]:border-b",t),...e}));fr.displayName="TableHeader";const pr=b.forwardRef(({className:t,...e},n)=>i.jsx("tbody",{ref:n,className:xt("[&_tr:last-child]:border-0",t),...e}));pr.displayName="TableBody";const ct=b.forwardRef(({className:t,...e},n)=>i.jsx("tr",{ref:n,className:xt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));ct.displayName="TableRow";const ke=b.forwardRef(({className:t,...e},n)=>i.jsx("th",{ref:n,className:xt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));ke.displayName="TableHead";const ve=b.forwardRef(({className:t,...e},n)=>i.jsx("td",{ref:n,className:xt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));ve.displayName="TableCell";function Fx(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const s=setTimeout(()=>r(t),e);return()=>clearTimeout(s)},[t,e]),n}function Zr({page:t,totalPages:e,total:n,pageSize:r,onPageChange:s,onPageSizeChange:a,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!a?null:i.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[i.jsxs("span",{children:["共 ",n," 条"]}),a&&i.jsx("select",{value:r,onChange:c=>a(Number(c.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:o.map(c=>i.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:()=>s(1),disabled:t<=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:"首页"}),i.jsx("button",{type:"button",onClick:()=>s(t-1),disabled:t<=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:"上一页"}),i.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),i.jsx("button",{type:"button",onClick:()=>s(t+1),disabled:t>=e,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),i.jsx("button",{type:"button",onClick:()=>s(e),disabled:t>=e,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 nP(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[s,a]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,j]=b.useState(""),w=Fx(v,300),[k,E]=b.useState("all"),[C,M]=b.useState(!0),[D,F]=b.useState(null),[R,I]=b.useState(null),[A,O]=b.useState(""),[W,X]=b.useState(!1);async function q(){M(!0),F(null);try{const Y=k==="all"?"":k==="completed"?"completed":k,L=new URLSearchParams({page:String(f),pageSize:String(g),...Y&&{status:Y},...w&&{search:w}}),[H,ue]=await Promise.all([Be(`/api/orders?${L}`),Be("/api/db/users?page=1&pageSize=500")]);H!=null&&H.success&&(e(H.orders||[]),a(H.total??0),c(H.totalRevenue??0),h(H.todayRevenue??0)),ue!=null&&ue.success&&ue.users&&r(ue.users)}catch(Y){console.error("加载订单失败",Y),F("加载订单失败,请检查网络后重试")}finally{M(!1)}}b.useEffect(()=>{m(1)},[w,k]),b.useEffect(()=>{q()},[f,g,w,k]);const Z=Y=>{var L;return Y.userNickname||((L=n.find(H=>H.id===Y.userId))==null?void 0:L.nickname)||"匿名用户"},_=Y=>{var L;return((L=n.find(H=>H.id===Y))==null?void 0:L.phone)||"-"},$=Y=>{const L=Y.productType||Y.type||"",H=Y.description||"";if(H){if(L==="section"&&H.includes("章节")){if(H.includes("-")){const ue=H.split("-");if(ue.length>=3)return{name:`第${ue[1]}章 第${ue[2]}节`,type:"《一场Soul的创业实验》"}}return{name:H,type:"章节购买"}}return L==="fullbook"||H.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:L==="vip"||H.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:L==="match"||H.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:H,type:"其他"}}return L==="section"?{name:`章节 ${Y.productId||Y.sectionId||""}`,type:"单章"}:L==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:L==="vip"?{name:"VIP年度会员",type:"VIP"}:L==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:L||"其他"}},oe=Math.ceil(s/g)||1;async function V(){var Y;if(!(!(R!=null&&R.orderSn)&&!(R!=null&&R.id))){X(!0),F(null);try{const L=await Rt("/api/admin/orders/refund",{orderSn:R.orderSn||R.id,reason:A||void 0});L!=null&&L.success?(I(null),O(""),q()):F((L==null?void 0:L.error)||"退款失败")}catch(L){const H=L;F(((Y=H==null?void 0:H.data)==null?void 0:Y.error)||"退款失败,请检查网络后重试")}finally{X(!1)}}}function ae(){if(t.length===0){alert("暂无数据可导出");return}const Y=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],L=t.map(Q=>{const ee=$(Q);return[Q.orderSn||Q.id||"",Z(Q),_(Q.userId),ee.name,Number(Q.amount||0).toFixed(2),Q.paymentMethod==="wechat"?"微信支付":Q.paymentMethod==="alipay"?"支付宝":Q.paymentMethod||"微信支付",Q.status==="refunded"?"已退款":Q.status==="paid"||Q.status==="completed"?"已完成":Q.status==="pending"||Q.status==="created"?"待支付":"已失败",Q.status==="refunded"&&Q.refundReason?Q.refundReason:"-",Q.referrerEarnings?Number(Q.referrerEarnings).toFixed(2):"-",Q.createdAt?new Date(Q.createdAt).toLocaleString("zh-CN"):""].join(",")}),H="\uFEFF"+[Y.join(","),...L].join(` +`),ue=new Blob([H],{type:"text/csv;charset=utf-8"}),U=URL.createObjectURL(ue),he=document.createElement("a");he.href=U,he.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,he.click(),URL.revokeObjectURL(U)}return i.jsxs("div",{className:"p-8 w-full",children:[D&&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:D}),i.jsx("button",{type:"button",onClick:()=>F(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:["共 ",t.length," 笔订单"]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsxs(re,{variant:"outline",onClick:q,disabled:C,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 ${C?"animate-spin":""}`}),"刷新"]}),i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("span",{className:"text-gray-400",children:"总收入:"}),i.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),i.jsx("span",{className:"text-gray-600",children:"|"}),i.jsx("span",{className:"text-gray-400",children:"今日:"}),i.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),i.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(Ki,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),i.jsx(ce,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:v,onChange:Y=>j(Y.target.value)})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(DN,{className:"w-4 h-4 text-gray-400"}),i.jsxs("select",{value:k,onChange:Y=>E(Y.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"pending",children:"待支付"}),i.jsx("option",{value:"created",children:"已创建"}),i.jsx("option",{value:"failed",children:"已失败"}),i.jsx("option",{value:"refunded",children:"已退款"})]})]}),i.jsxs(re,{variant:"outline",onClick:ae,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(rM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:C?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.jsxs("div",{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"订单号"}),i.jsx(ke,{className:"text-gray-400",children:"用户"}),i.jsx(ke,{className:"text-gray-400",children:"商品"}),i.jsx(ke,{className:"text-gray-400",children:"金额"}),i.jsx(ke,{className:"text-gray-400",children:"支付方式"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-gray-400",children:"退款原因"}),i.jsx(ke,{className:"text-gray-400",children:"分销佣金"}),i.jsx(ke,{className:"text-gray-400",children:"下单时间"}),i.jsx(ke,{className:"text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[t.map(Y=>{const L=$(Y);return i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsxs(ve,{className:"font-mono text-xs text-gray-400",children:[(Y.orderSn||Y.id||"").slice(0,12),"..."]}),i.jsx(ve,{children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm",children:Z(Y)}),i.jsx("p",{className:"text-gray-500 text-xs",children:_(Y.userId)})]})}),i.jsx(ve,{children:i.jsxs("div",{children:[i.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[L.name,(Y.productType||Y.type)==="vip"&&i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),i.jsx("p",{className:"text-gray-500 text-xs",children:L.type})]})}),i.jsxs(ve,{className:"text-[#38bdac] font-bold",children:["¥",Number(Y.amount||0).toFixed(2)]}),i.jsx(ve,{className:"text-gray-300",children:Y.paymentMethod==="wechat"?"微信支付":Y.paymentMethod==="alipay"?"支付宝":Y.paymentMethod||"微信支付"}),i.jsx(ve,{children:Y.status==="refunded"?i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):Y.status==="paid"||Y.status==="completed"?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):Y.status==="pending"||Y.status==="created"?i.jsx(Fe,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):i.jsx(Fe,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),i.jsx(ve,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:Y.refundReason,children:Y.status==="refunded"&&Y.refundReason?Y.refundReason:"-"}),i.jsx(ve,{className:"text-[#FFD700]",children:Y.referrerEarnings?`¥${Number(Y.referrerEarnings).toFixed(2)}`:"-"}),i.jsx(ve,{className:"text-gray-400 text-sm",children:new Date(Y.createdAt).toLocaleString("zh-CN")}),i.jsx(ve,{children:(Y.status==="paid"||Y.status==="completed")&&i.jsxs(re,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{I(Y),O("")},children:[i.jsx(FN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},Y.id)}),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),i.jsx(Zr,{page:f,totalPages:oe,total:s,pageSize:g,onPageChange:m,onPageSizeChange:Y=>{y(Y),m(1)}})]})})}),i.jsx(Qt,{open:!!R,onOpenChange:Y=>!Y&&I(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:"订单退款"})}),R&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",R.orderSn||R.id]}),i.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(R.amount||0).toFixed(2)]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),i.jsx("div",{className:"form-input",children:i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:A,onChange:Y=>O(Y.target.value)})})]}),i.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>I(null),disabled:W,children:"取消"}),i.jsx(re,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:V,disabled:W,children:W?"退款中...":"确认退款"})]})]})})]})}const ul=b.forwardRef(({className:t,...e},n)=>i.jsx("textarea",{className:xt("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",t),ref:n,...e}));ul.displayName="Textarea";const pu=[{id:"register",label:"注册/登录",icon:"👤",color:"bg-blue-500/20 border-blue-500/40 text-blue-400",desc:"微信授权登录或手机号注册"},{id:"browse",label:"浏览章节",icon:"📖",color:"bg-purple-500/20 border-purple-500/40 text-purple-400",desc:"点击免费/付费章节预览"},{id:"bind_phone",label:"绑定手机",icon:"📱",color:"bg-cyan-500/20 border-cyan-500/40 text-cyan-400",desc:"触发付费章节后绑定手机"},{id:"first_pay",label:"首次付款",icon:"💳",color:"bg-green-500/20 border-green-500/40 text-green-400",desc:"购买单章或全书"},{id:"fill_profile",label:"完善资料",icon:"✍️",color:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400",desc:"填写头像、MBTI、行业等"},{id:"match",label:"派对房匹配",icon:"🤝",color:"bg-orange-500/20 border-orange-500/40 text-orange-400",desc:"参与 Soul 派对房"},{id:"vip",label:"升级 VIP",icon:"👑",color:"bg-amber-500/20 border-amber-500/40 text-amber-400",desc:"付款 ¥1980 购买全书"},{id:"distribution",label:"开启分销",icon:"🔗",color:"bg-[#38bdac]/20 border-[#38bdac]/40 text-[#38bdac]",desc:"生成推广码并推荐好友"}];function rP(){var ls,oi,cs,pa,ds;const[t,e]=AN(),n=t.get("pool"),[r,s]=b.useState([]),[a,o]=b.useState(0),[c,u]=b.useState(1),[h,f]=b.useState(10),[m,g]=b.useState(""),y=Fx(m,300),v=n==="vip"?"vip":n==="complete"?"complete":"all",[j,w]=b.useState(v),[k,E]=b.useState(!0),[C,M]=b.useState(null),[D,F]=b.useState(!1),[R,I]=b.useState("desc");b.useEffect(()=>{n==="vip"?w("vip"):n==="complete"?w("complete"):n==="all"&&w("all")},[n]);const[A,O]=b.useState(!1),[W,X]=b.useState(null),[q,Z]=b.useState(!1),[_,$]=b.useState(!1),[oe,V]=b.useState({referrals:[],stats:{}}),[ae,Y]=b.useState(!1),[L,H]=b.useState(null),[ue,U]=b.useState(!1),[he,Q]=b.useState(null),[ee,de]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Ce,B]=b.useState([]),[me,Se]=b.useState(!1),[rt,Ye]=b.useState(!1),[st,Qe]=b.useState(null),[Xe,ft]=b.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[Pt,Jt]=b.useState([]),[Kn,qn]=b.useState(!1),[ss,zt]=b.useState(!1),[Cr,is]=b.useState(null),[On,pn]=b.useState({name:"",sort:0}),[mr,Br]=b.useState({}),[Gn,fe]=b.useState(!1);async function ge(){var G;E(!0),M(null);try{if(D){const Ke=new URLSearchParams({search:y,limit:String(h*5)}),Ze=await Be(`/api/db/users/rfm?${Ke}`);if(Ze!=null&&Ze.success){let Cn=Ze.users||[];R==="asc"&&(Cn=[...Cn].reverse());const Vr=(c-1)*h;s(Cn.slice(Vr,Vr+h)),o(((G=Ze.users)==null?void 0:G.length)??0),Cn.length===0&&(F(!1),M("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else F(!1),M((Ze==null?void 0:Ze.error)||"RFM 加载失败,已切回普通模式")}else{const Ke=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...j==="vip"&&{vip:"true"},...j==="complete"&&{pool:"complete"}}),Ze=await Be(`/api/db/users?${Ke}`);Ze!=null&&Ze.success?(s(Ze.users||[]),o(Ze.total??0)):M((Ze==null?void 0:Ze.error)||"加载失败")}}catch(Ke){console.error("Load users error:",Ke),M("网络错误")}finally{E(!1)}}b.useEffect(()=>{u(1)},[y,j,D]),b.useEffect(()=>{ge()},[c,h,y,j,D,R]);const kn=Math.ceil(a/h)||1,ri=()=>{D?R==="desc"?I("asc"):(F(!1),I("desc")):(F(!0),I("desc"))},Ms=G=>({S:"bg-amber-500/20 text-amber-400",A:"bg-green-500/20 text-green-400",B:"bg-blue-500/20 text-blue-400",C:"bg-gray-500/20 text-gray-400",D:"bg-red-500/20 text-red-400"})[G||""]||"bg-gray-500/20 text-gray-400";async function ha(G){if(confirm("确定要删除这个用户吗?"))try{const Ke=await Yr(`/api/db/users?id=${encodeURIComponent(G)}`);Ke!=null&&Ke.success?ge():alert("删除失败: "+((Ke==null?void 0:Ke.error)||""))}catch{alert("删除失败")}}const Jn=G=>{X(G),de({phone:G.phone||"",nickname:G.nickname||"",password:"",isAdmin:!!(G.isAdmin??!1),hasFullBook:!!(G.hasFullBook??!1)}),O(!0)},as=()=>{X(null),de({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),O(!0)};async function pt(){if(!ee.phone||!ee.nickname){alert("请填写手机号和昵称");return}Z(!0);try{if(W){const G=await Rt("/api/db/users",{id:W.id,nickname:ee.nickname,isAdmin:ee.isAdmin,hasFullBook:ee.hasFullBook,...ee.password&&{password:ee.password}});if(!(G!=null&&G.success)){alert("更新失败: "+((G==null?void 0:G.error)||""));return}}else{const G=await ht("/api/db/users",{phone:ee.phone,nickname:ee.nickname,password:ee.password,isAdmin:ee.isAdmin});if(!(G!=null&&G.success)){alert("创建失败: "+((G==null?void 0:G.error)||""));return}}O(!1),ge()}catch{alert("保存失败")}finally{Z(!1)}}async function Sn(G){H(G),$(!0),Y(!0);try{const Ke=await Be(`/api/db/users/referrals?userId=${encodeURIComponent(G.id)}`);Ke!=null&&Ke.success?V({referrals:Ke.referrals||[],stats:Ke.stats||{}}):V({referrals:[],stats:{}})}catch{V({referrals:[],stats:{}})}finally{Y(!1)}}const Yn=b.useCallback(async()=>{Se(!0);try{const G=await Be("/api/db/user-rules");G!=null&&G.success&&B(G.rules||[])}catch{}finally{Se(!1)}},[]);async function Dn(){if(!Xe.title){alert("请填写规则标题");return}Z(!0);try{if(st){const G=await Rt("/api/db/user-rules",{id:st.id,...Xe});if(!(G!=null&&G.success)){alert("更新失败: "+((G==null?void 0:G.error)||""));return}}else{const G=await ht("/api/db/user-rules",Xe);if(!(G!=null&&G.success)){alert("创建失败: "+((G==null?void 0:G.error)||""));return}}Ye(!1),Yn()}catch{alert("保存失败")}finally{Z(!1)}}async function fa(G){if(confirm("确定删除?"))try{const Ke=await Yr(`/api/db/user-rules?id=${G}`);Ke!=null&&Ke.success&&Yn()}catch{}}async function si(G){try{await Rt("/api/db/user-rules",{id:G.id,enabled:!G.enabled}),Yn()}catch{}}const Er=b.useCallback(async()=>{qn(!0);try{const G=await Be("/api/db/vip-roles");G!=null&&G.success&&Jt(G.roles||[])}catch{}finally{qn(!1)}},[]);async function ii(){if(!On.name){alert("请填写角色名称");return}Z(!0);try{if(Cr){const G=await Rt("/api/db/vip-roles",{id:Cr.id,...On});if(!(G!=null&&G.success)){alert("更新失败");return}}else{const G=await ht("/api/db/vip-roles",On);if(!(G!=null&&G.success)){alert("创建失败");return}}zt(!1),Er()}catch{alert("保存失败")}finally{Z(!1)}}async function ai(G){if(confirm("确定删除?"))try{const Ke=await Yr(`/api/db/vip-roles?id=${G}`);Ke!=null&&Ke.success&&Er()}catch{}}const mn=b.useCallback(async()=>{fe(!0);try{const G=await Be("/api/db/users/journey-stats");G!=null&&G.success&&G.stats&&Br(G.stats)}catch{}finally{fe(!1)}},[]);return i.jsxs("div",{className:"p-8 w-full",children:[C&&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:C}),i.jsx("button",{type:"button",onClick:()=>M(null),children:"×"})]}),i.jsx("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.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",a," 位注册用户",D&&" · RFM 排序中"]})]})}),i.jsxs(Wc,{defaultValue:"users",className:"w-full",children:[i.jsxs(dl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[i.jsxs(en,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[i.jsx(Pn,{className:"w-4 h-4"})," 用户列表"]}),i.jsxs(en,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:mn,children:[i.jsx(Vo,{className:"w-4 h-4"})," 用户旅程总览"]}),i.jsxs(en,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Yn,children:[i.jsx(Da,{className:"w-4 h-4"})," 规则配置"]}),i.jsxs(en,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Er,children:[i.jsx(Fi,{className:"w-4 h-4"})," VIP 角色"]})]}),i.jsxs(tn,{value:"users",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[i.jsxs(re,{variant:"outline",onClick:ge,disabled:k,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 ${k?"animate-spin":""}`})," 刷新"]}),i.jsxs("select",{value:j,onChange:G=>{const Ke=G.target.value;w(Ke),u(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:D,children:[i.jsx("option",{value:"all",children:"全部用户"}),i.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),i.jsx("option",{value:"complete",children:"完善资料用户"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Ki,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),i.jsx(ce,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:G=>g(G.target.value)})]}),i.jsxs(re,{onClick:as,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(vg,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:k?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.jsxs("div",{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"用户信息"}),i.jsx(ke,{className:"text-gray-400",children:"绑定信息"}),i.jsx(ke,{className:"text-gray-400",children:"购买状态"}),i.jsx(ke,{className:"text-gray-400",children:"分销收益"}),i.jsxs(ke,{className:"text-gray-400 cursor-pointer select-none",onClick:ri,children:[i.jsxs("div",{className:"flex items-center gap-1 group",children:[i.jsx(dc,{className:"w-3.5 h-3.5"}),i.jsx("span",{children:"RFM分值"}),D?R==="desc"?i.jsx(Jo,{className:"w-3.5 h-3.5 text-[#38bdac]"}):i.jsx(jx,{className:"w-3.5 h-3.5 text-[#38bdac]"}):i.jsx(TT,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),D&&i.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),i.jsx(ke,{className:"text-gray-400",children:"注册时间"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[r.map(G=>{var Ke,Ze,Cn;return i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:G.avatar?i.jsx("img",{src:G.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((Ke=G.nickname)==null?void 0:Ke.charAt(0))||"?"}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("button",{type:"button",onClick:()=>{Q(G.id),U(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:G.nickname}),G.isAdmin&&i.jsx(Fe,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),G.openId&&!((Ze=G.id)!=null&&Ze.startsWith("user_"))&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),i.jsx("p",{className:"text-xs text-gray-500 font-mono",children:G.openId?G.openId.slice(0,12)+"...":(Cn=G.id)==null?void 0:Cn.slice(0,12)})]})]})}),i.jsx(ve,{children:i.jsxs("div",{className:"space-y-1",children:[G.phone&&i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"📱"}),i.jsx("span",{className:"text-gray-300",children:G.phone})]}),G.wechatId&&i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"💬"}),i.jsx("span",{className:"text-gray-300",children:G.wechatId})]}),G.openId&&i.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[i.jsx("span",{className:"text-gray-500",children:"🔗"}),i.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:G.openId,children:[G.openId.slice(0,12),"..."]})]}),!G.phone&&!G.wechatId&&!G.openId&&i.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),i.jsx(ve,{children:G.hasFullBook?i.jsx(Fe,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):i.jsx(Fe,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),i.jsx(ve,{children:i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(G.earnings||0)).toFixed(2)]}),parseFloat(String(G.pendingEarnings||0))>0&&i.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(G.pendingEarnings||0)).toFixed(2)]}),i.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>Sn(G),role:"button",tabIndex:0,onKeyDown:Vr=>Vr.key==="Enter"&&Sn(G),children:[i.jsx(Pn,{className:"w-3 h-3"})," 绑定",G.referralCount||0,"人"]})]})}),i.jsx(ve,{children:G.rfmScore!==void 0?i.jsx("div",{className:"flex flex-col gap-1",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-white font-bold text-base",children:G.rfmScore}),i.jsx(Fe,{className:`border-0 text-xs ${Ms(G.rfmLevel)}`,children:G.rfmLevel})]})}):i.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",i.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),i.jsx(ve,{className:"text-gray-400",children:G.createdAt?new Date(G.createdAt).toLocaleDateString():"-"}),i.jsx(ve,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>{Q(G.id),U(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:i.jsx(mg,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Jn(G),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>ha(G.id),title:"删除",children:i.jsx(vn,{className:"w-4 h-4"})})]})})]},G.id)}),r.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),i.jsx(Zr,{page:c,totalPages:kn,total:a,pageSize:h,onPageChange:u,onPageSizeChange:G=>{f(G),u(1)}})]})})})]}),i.jsxs(tn,{value:"journey",children:[i.jsxs("div",{className:"flex items-center justify-between mb-5",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),i.jsxs(re,{variant:"outline",onClick:mn,disabled:Gn,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 ${Gn?"animate-spin":""}`})," 刷新数据"]})]}),i.jsxs("div",{className:"relative mb-8",children:[i.jsx("div",{className:"absolute top-16 left-0 right-0 h-0.5 bg-gradient-to-r from-blue-500/20 via-[#38bdac]/30 to-amber-500/20 mx-20"}),i.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:pu.map((G,Ke)=>i.jsxs("div",{className:"relative flex flex-col items-center",children:[i.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${G.color} text-center cursor-default`,children:[i.jsx("div",{className:"text-2xl mb-1",children:G.icon}),i.jsx("div",{className:`text-xs font-medium ${G.color.split(" ").find(Ze=>Ze.startsWith("text-"))}`,children:G.label}),mr[G.id]!==void 0&&i.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[i.jsx("span",{className:"font-bold text-white",children:mr[G.id]})," 人"]}),i.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:Ke+1})]}),Kei.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[i.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:G.step}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-300",children:G.action}),i.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",G.next]})]})]},G.step))})]}),i.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(zr,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),i.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),Gn?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(qe,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(mr).length>0?i.jsx("div",{className:"space-y-2",children:pu.map(G=>{const Ke=mr[G.id]||0,Ze=Math.max(...pu.map(Vr=>mr[Vr.id]||0),1),Cn=Math.round(Ke/Ze*100);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[G.icon," ",G.label]}),i.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${Cn}%`}})}),i.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:Ke})]},G.id)})}):i.jsx("div",{className:"text-center py-8",children:i.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),i.jsxs(tn,{value:"rules",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程引导规则,定义各行为节点的触发条件与引导内容"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(re,{variant:"outline",onClick:Yn,disabled:me,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 ${me?"animate-spin":""}`})," 刷新"]}),i.jsxs(re,{onClick:()=>{Qe(null),ft({title:"",description:"",trigger:"",sort:0,enabled:!0}),Ye(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),me?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Ce.length===0?i.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[i.jsx(zr,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),i.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),i.jsxs(re,{onClick:Yn,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(qe,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):i.jsx("div",{className:"space-y-2",children:Ce.map(G=>i.jsx("div",{className:`p-4 rounded-lg border transition-all ${G.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[i.jsx(wt,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),i.jsx("span",{className:"text-white font-medium",children:G.title}),G.trigger&&i.jsxs(Fe,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",G.trigger]}),i.jsx(Fe,{className:`text-xs border-0 ${G.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:G.enabled?"启用":"禁用"})]}),G.description&&i.jsx("p",{className:"text-gray-400 text-sm ml-6",children:G.description})]}),i.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[i.jsx(vt,{checked:G.enabled,onCheckedChange:()=>si(G)}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>{Qe(G),ft({title:G.title,description:G.description,trigger:G.trigger,sort:G.sort,enabled:G.enabled}),Ye(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>fa(G.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(vn,{className:"w-4 h-4"})})]})]})},G.id))})]}),i.jsxs(tn,{value:"vip-roles",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"管理用户 VIP 角色分类,这些角色将在用户详情和会员展示中使用"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(re,{variant:"outline",onClick:Er,disabled:Kn,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 ${Kn?"animate-spin":""}`})," 刷新"]}),i.jsxs(re,{onClick:()=>{is(null),pn({name:"",sort:0}),zt(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"})," 添加角色"]})]})]}),Kn?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(qe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Pt.length===0?i.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[i.jsx(Fi,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),i.jsx("p",{className:"text-gray-400 mb-4",children:"暂无 VIP 角色"}),i.jsxs(re,{onClick:()=>{is(null),pn({name:"",sort:0}),zt(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"})," 添加第一个角色"]})]}):i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:Pt.map(G=>i.jsxs("div",{className:"p-4 bg-[#0f2137] border border-amber-500/20 rounded-xl hover:border-amber-500/40 transition-all group",children:[i.jsxs("div",{className:"flex items-start justify-between mb-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Fi,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-white font-medium",children:G.name})]}),i.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx("button",{type:"button",onClick:()=>{is(G),pn({name:G.name,sort:G.sort}),zt(!0)},className:"text-gray-500 hover:text-[#38bdac]",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),i.jsx("button",{type:"button",onClick:()=>ai(G.id),className:"text-gray-500 hover:text-red-400",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]}),i.jsxs("p",{className:"text-gray-600 text-xs",children:["排序: ",G.sort]})]},G.id))})]})]}),i.jsx(Qt,{open:A,onOpenChange:O,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[W?i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(vg,{className:"w-5 h-5 text-[#38bdac]"}),W?"编辑用户":"添加用户"]})}),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:ee.phone,onChange:G=>de({...ee,phone:G.target.value}),disabled:!!W})]}),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:ee.nickname,onChange:G=>de({...ee,nickname:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:W?"新密码 (留空则不修改)":"密码"}),i.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:W?"留空则不修改":"请输入密码",value:ee.password,onChange:G=>de({...ee,password:G.target.value})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(te,{className:"text-gray-300",children:"管理员权限"}),i.jsx(vt,{checked:ee.isAdmin,onCheckedChange:G=>de({...ee,isAdmin:G})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(te,{className:"text-gray-300",children:"已购全书"}),i.jsx(vt,{checked:ee.hasFullBook,onCheckedChange:G=>de({...ee,hasFullBook:G})})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>O(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:pt,disabled:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),q?"保存中...":"保存"]})]})]})}),i.jsx(Qt,{open:rt,onOpenChange:Ye,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}),st?"编辑规则":"添加规则"]})}),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:"例:匹配后填写头像、付款1980需填写信息",value:Xe.title,onChange:G=>ft({...Xe,title:G.target.value})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"规则描述"}),i.jsx(ul,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:Xe.description,onChange:G=>ft({...Xe,description:G.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:Xe.trigger,onChange:G=>ft({...Xe,trigger:G.target.value})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{children:i.jsx(te,{className:"text-gray-300",children:"启用状态"})}),i.jsx(vt,{checked:Xe.enabled,onCheckedChange:G=>ft({...Xe,enabled:G})})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>Ye(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:Dn,disabled:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),q?"保存中...":"保存"]})]})]})}),i.jsx(Qt,{open:ss,onOpenChange:zt,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Fi,{className:"w-5 h-5 text-amber-400"}),Cr?"编辑 VIP 角色":"添加 VIP 角色"]})}),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:On.name,onChange:G=>pn({...On,name:G.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:On.sort,onChange:G=>pn({...On,sort:parseInt(G.target.value)||0})})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>zt(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:ii,disabled:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),q?"保存中...":"保存"]})]})]})}),i.jsx(Qt,{open:_,onOpenChange:$,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Pn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",L==null?void 0:L.nickname]})}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((ls=oe.stats)==null?void 0:ls.total)||0}),i.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsx("div",{className:"text-2xl font-bold text-green-400",children:((oi=oe.stats)==null?void 0:oi.purchased)||0}),i.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((cs=oe.stats)==null?void 0:cs.earnings)||0).toFixed(2)]}),i.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),i.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[i.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((pa=oe.stats)==null?void 0:pa.pendingEarnings)||0).toFixed(2)]}),i.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),ae?i.jsxs("div",{className:"flex items-center justify-center py-8",children:[i.jsx(qe,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((ds=oe.referrals)==null?void 0:ds.length)??0)>0?i.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(oe.referrals??[]).map((G,Ke)=>{var Cn;const Ze=G;return i.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((Cn=Ze.nickname)==null?void 0:Cn.charAt(0))||"?"}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white text-sm",children:Ze.nickname}),i.jsx("div",{className:"text-xs text-gray-500",children:Ze.phone||(Ze.hasOpenId?"微信用户":"未绑定")})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[Ze.status==="vip"&&i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Ze.status==="paid"&&i.jsxs(Fe,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Ze.purchasedSections,"章"]}),Ze.status==="free"&&i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),i.jsx("span",{className:"text-xs text-gray-500",children:Ze.createdAt?new Date(Ze.createdAt).toLocaleDateString():""})]})]},Ze.id||Ke)})}):i.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),i.jsx(bn,{children:i.jsx(re,{variant:"outline",onClick:()=>$(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),i.jsx($x,{open:ue,onClose:()=>U(!1),userId:he,onUserUpdated:ge})]})}function Ju(t,[e,n]){return Math.min(n,Math.max(e,t))}var ok=["PageUp","PageDown"],lk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ck={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},hl="Slider",[kg,sP,iP]=Dx(hl),[dk]=aa(hl,[iP]),[aP,ef]=dk(hl),uk=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:a=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,form:v,...j}=t,w=b.useRef(new Set),k=b.useRef(0),C=o==="horizontal"?oP:lP,[M=[],D]=Va({prop:f,defaultProp:h,onChange:W=>{var q;(q=[...w.current][k.current])==null||q.focus(),m(W)}}),F=b.useRef(M);function R(W){const X=fP(M,W);O(W,X)}function I(W){O(W,k.current)}function A(){const W=F.current[k.current];M[k.current]!==W&&g(M)}function O(W,X,{commit:q}={commit:!1}){const Z=xP(a),_=yP(Math.round((W-r)/a)*a+r,Z),$=Ju(_,[r,s]);D((oe=[])=>{const V=uP(oe,$,X);if(gP(V,u*a)){k.current=V.indexOf($);const ae=String(V)!==String(oe);return ae&&q&&g(V),ae?V:oe}else return oe})}return i.jsx(aP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:s,valueIndexToChangeRef:k,thumbs:w.current,values:M,orientation:o,form:v,children:i.jsx(kg.Provider,{scope:t.__scopeSlider,children:i.jsx(kg.Slot,{scope:t.__scopeSlider,children:i.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...j,ref:e,onPointerDown:nt(j.onPointerDown,()=>{c||(F.current=M)}),min:r,max:s,inverted:y,onSlideStart:c?void 0:R,onSlideMove:c?void 0:I,onSlideEnd:c?void 0:A,onHomeKeyDown:()=>!c&&O(r,0,{commit:!0}),onEndKeyDown:()=>!c&&O(s,M.length-1,{commit:!0}),onStepKeyDown:({event:W,direction:X})=>{if(!c){const _=ok.includes(W.key)||W.shiftKey&&lk.includes(W.key)?10:1,$=k.current,oe=M[$],V=a*_*X;O(oe+V,$,{commit:!0})}}})})})})});uk.displayName=hl;var[hk,fk]=dk(hl,{startEdge:"left",endEdge:"right",size:"width",direction:1}),oP=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:a,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),y=gt(e,C=>g(C)),v=b.useRef(void 0),j=Qh(s),w=j==="ltr",k=w&&!a||!w&&a;function E(C){const M=v.current||m.getBoundingClientRect(),D=[0,M.width],R=Bx(D,k?[n,r]:[r,n]);return v.current=M,R(C-M.left)}return i.jsx(hk,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:i.jsx(pk,{dir:j,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const M=E(C.clientX);o==null||o(M)},onSlideMove:C=>{const M=E(C.clientX);c==null||c(M)},onSlideEnd:()=>{v.current=void 0,u==null||u()},onStepKeyDown:C=>{const D=ck[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:D?-1:1})}})})}),lP=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:a,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=gt(e,f),g=b.useRef(void 0),y=!s;function v(j){const w=g.current||f.current.getBoundingClientRect(),k=[0,w.height],C=Bx(k,y?[r,n]:[n,r]);return g.current=w,C(j-w.top)}return i.jsx(hk,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:i.jsx(pk,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:j=>{const w=v(j.clientY);a==null||a(w)},onSlideMove:j=>{const w=v(j.clientY);o==null||o(w)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:j=>{const k=ck[y?"from-bottom":"from-top"].includes(j.key);u==null||u({event:j,direction:k?-1:1})}})})}),pk=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=ef(hl,n);return i.jsx(ot.span,{...h,ref:e,onKeyDown:nt(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):ok.concat(lk).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:nt(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:nt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:nt(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),a(m))})})}),mk="SliderTrack",gk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=ef(mk,n);return i.jsx(ot.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});gk.displayName=mk;var Sg="SliderRange",xk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=ef(Sg,n),a=fk(Sg,n),o=b.useRef(null),c=gt(e,o),u=s.values.length,h=s.values.map(g=>bk(g,s.min,s.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return i.jsx(ot.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:c,style:{...t.style,[a.startEdge]:f+"%",[a.endEdge]:m+"%"}})});xk.displayName=Sg;var Cg="SliderThumb",yk=b.forwardRef((t,e)=>{const n=sP(t.__scopeSlider),[r,s]=b.useState(null),a=gt(e,c=>s(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return i.jsx(cP,{...t,ref:a,index:o})}),cP=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...a}=t,o=ef(Cg,n),c=fk(Cg,n),[u,h]=b.useState(null),f=gt(e,E=>h(E)),m=u?o.form||!!u.closest("form"):!0,g=zx(u),y=o.values[r],v=y===void 0?0:bk(y,o.min,o.max),j=hP(r,o.values.length),w=g==null?void 0:g[c.size],k=w?pP(w,v,c.direction):0;return b.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),i.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${v}% + ${k}px)`},children:[i.jsx(kg.ItemSlot,{scope:t.__scopeSlider,children:i.jsx(ot.span,{role:"slider","aria-label":t["aria-label"]||j,"aria-valuemin":o.min,"aria-valuenow":y,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...a,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:nt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&i.jsx(vk,{name:s??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});yk.displayName=Cg;var dP="RadioBubbleInput",vk=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),a=gt(s,r),o=_x(e);return b.useEffect(()=>{const c=s.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),i.jsx(ot.input,{style:{display:"none"},...n,ref:a,defaultValue:e})});vk.displayName=dP;function uP(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,a)=>s-a)}function bk(t,e,n){const a=100/(n-e)*(t-e);return Ju(a,[0,100])}function hP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function fP(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function pP(t,e,n){const r=t/2,a=Bx([0,50],[0,r]);return(r-a(e)*n)*n}function mP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function gP(t,e){if(e>0){const n=mP(t);return Math.min(...n)>=e}return!0}function Bx(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function xP(t){return(String(t).split(".")[1]||"").length}function yP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var vP=uk,bP=gk,wP=xk,NP=yk;function jP({className:t,defaultValue:e,value:n,min:r=0,max:s=100,...a}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,s],[n,e,r,s]);return i.jsxs(vP,{defaultValue:e,value:n,min:r,max:s,className:xt("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...a,children:[i.jsx(bP,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:i.jsx(wP,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>i.jsx(NP,{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"},u))]})}const kP={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function wk(t){const[e,n]=b.useState(kP),[r,s]=b.useState(!0),[a,o]=b.useState(!1);b.useEffect(()=>{Be("/api/admin/referral-settings").then(h=>{const f=h==null?void 0:h.data;f&&typeof f=="object"&&n({distributorShare:f.distributorShare??90,minWithdrawAmount:f.minWithdrawAmount??10,bindingDays:f.bindingDays??30,userDiscount:f.userDiscount??5,enableAutoWithdraw:f.enableAutoWithdraw??!1,vipOrderShareVip:f.vipOrderShareVip??20,vipOrderShareNonVip:f.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>s(!1))},[]);const c=async()=>{o(!0);try{const h={distributorShare:Number(e.distributorShare)||0,minWithdrawAmount:Number(e.minWithdrawAmount)||0,bindingDays:Number(e.bindingDays)||0,userDiscount:Number(e.userDiscount)||0,enableAutoWithdraw:!!e.enableAutoWithdraw,vipOrderShareVip:Number(e.vipOrderShareVip)||20,vipOrderShareNonVip:Number(e.vipOrderShareNonVip)||10},f=await ht("/api/admin/referral-settings",h);if(!f||f.success===!1){alert("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}alert(`✅ 分销配置已保存成功! + +• 小程序与网站的推广规则会一起生效 +• 绑定关系会使用新的天数配置 +• 佣金比例会立即应用到新订单 + +如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),alert("保存失败: "+(h instanceof Error?h.message:String(h)))}finally{o(!1)}},u=h=>f=>{const m=parseFloat(f.target.value||"0");n(g=>({...g,[h]:isNaN(m)?0:m}))};return r?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(Yo,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),i.jsxs(re,{onClick:c,disabled:a||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"flex items-center gap-2 text-white",children:[i.jsx(rA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),i.jsx(It,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),i.jsx(Te,{className:"space-y-6",children:i.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(iu,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.userDiscount,onChange:u("userDiscount")}),i.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(Pn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(jP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),i.jsx(ce,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:e.distributorShare,onChange:u("distributorShare")})]}),i.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",i.jsxs("span",{className:"text-[#38bdac] font-mono",children:[e.distributorShare,"%"]}),";会员订单见下方。"]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(iu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareVip,onChange:u("vipOrderShareVip")}),i.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(iu,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),i.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareNonVip,onChange:u("vipOrderShareNonVip")}),i.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[i.jsx(Pn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),i.jsx(ce,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:e.bindingDays,onChange:u("bindingDays")}),i.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"flex items-center gap-2 text-white",children:[i.jsx(Yo,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),i.jsx(It,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),i.jsx(Te,{className:"space-y-6",children:i.jsxs("div",{className:"grid grid-cols-2 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,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:e.minWithdrawAmount,onChange:u("minWithdrawAmount")}),i.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",i.jsx(Fe,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),i.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[i.jsx(vt,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),i.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(et,{children:i.jsxs(tt,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[i.jsx(iu,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),i.jsxs(Te,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[i.jsxs("p",{children:["1. 以上配置会写入"," ",i.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),i.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),i.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function SP(){var Ce;const[t,e]=b.useState("overview"),[n,r]=b.useState([]),[s,a]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState([]),[g,y]=b.useState(!0),[v,j]=b.useState(null),[w,k]=b.useState(""),[E,C]=b.useState("all"),[M,D]=b.useState(1),[F,R]=b.useState(10),[I,A]=b.useState(0),[O,W]=b.useState(new Set),[X,q]=b.useState(null),[Z,_]=b.useState(""),[$,oe]=b.useState(!1);b.useEffect(()=>{V()},[]),b.useEffect(()=>{D(1)},[t,E]),b.useEffect(()=>{ae(t)},[t]),b.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&ae(t,!0)},[M,F,E,w]);async function V(){j(null);try{const B=await Be("/api/admin/distribution/overview");B!=null&&B.success&&B.overview&&a(B.overview)}catch(B){console.error("[Admin] 概览接口异常:",B),j("加载概览失败")}try{const B=await Be("/api/db/users");m((B==null?void 0:B.users)||[])}catch(B){console.error("[Admin] 用户数据加载失败:",B)}}async function ae(B,me=!1){var Se;if(!(!me&&O.has(B))){y(!0);try{const rt=f;switch(B){case"overview":break;case"orders":{try{const Ye=new URLSearchParams({page:String(M),pageSize:String(F),...E!=="all"&&{status:E},...w&&{search:w}}),st=await Be(`/api/orders?${Ye}`);if(st!=null&&st.success&&st.orders){const Qe=st.orders.map(Xe=>{const ft=rt.find(Jt=>Jt.id===Xe.userId),Pt=Xe.referrerId?rt.find(Jt=>Jt.id===Xe.referrerId):null;return{...Xe,amount:parseFloat(String(Xe.amount))||0,userNickname:(ft==null?void 0:ft.nickname)||Xe.userNickname||"未知用户",userPhone:(ft==null?void 0:ft.phone)||Xe.userPhone||"-",referrerNickname:(Pt==null?void 0:Pt.nickname)||null,referrerCode:(Pt==null?void 0:Pt.referralCode)??null,type:Xe.productType||Xe.type}});r(Qe),A(st.total??Qe.length)}else r([]),A(0)}catch(Ye){console.error(Ye),j("加载订单失败"),r([])}break}case"bindings":{try{const Ye=new URLSearchParams({page:String(M),pageSize:String(F),...E!=="all"&&{status:E}}),st=await Be(`/api/db/distribution?${Ye}`);c((st==null?void 0:st.bindings)||[]),A((st==null?void 0:st.total)??((Se=st==null?void 0:st.bindings)==null?void 0:Se.length)??0)}catch(Ye){console.error(Ye),j("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const Ye=E==="completed"?"success":E==="rejected"?"failed":E,st=new URLSearchParams({...Ye&&Ye!=="all"&&{status:Ye},page:String(M),pageSize:String(F)}),Qe=await Be(`/api/admin/withdrawals?${st}`);if(Qe!=null&&Qe.success&&Qe.withdrawals){const Xe=Qe.withdrawals.map(ft=>({...ft,account:ft.account??"未绑定微信号",status:ft.status==="success"?"completed":ft.status==="failed"?"rejected":ft.status}));h(Xe),A((Qe==null?void 0:Qe.total)??Xe.length)}else Qe!=null&&Qe.success||j(`获取提现记录失败: ${(Qe==null?void 0:Qe.error)||"未知错误"}`),h([])}catch(Ye){console.error(Ye),j("加载提现数据失败"),h([])}break}}W(Ye=>new Set(Ye).add(B))}catch(rt){console.error(rt)}finally{y(!1)}}}async function Y(){j(null),W(B=>{const me=new Set(B);return me.delete(t),me}),t==="overview"&&V(),await ae(t,!0)}async function L(B){if(confirm("确认审核通过并打款?"))try{const me=await Rt("/api/admin/withdrawals",{id:B,action:"approve"});if(!(me!=null&&me.success)){const Se=(me==null?void 0:me.message)||(me==null?void 0:me.error)||"操作失败";alert(Se);return}await Y()}catch(me){console.error(me),alert("操作失败")}}async function H(B){const me=prompt("请输入拒绝原因:");if(me)try{const Se=await Rt("/api/admin/withdrawals",{id:B,action:"reject",errorMessage:me});if(!(Se!=null&&Se.success)){alert((Se==null?void 0:Se.error)||"操作失败");return}await Y()}catch(Se){console.error(Se),alert("操作失败")}}async function ue(){var B;if(!(!(X!=null&&X.orderSn)&&!(X!=null&&X.id))){oe(!0),j(null);try{const me=await Rt("/api/admin/orders/refund",{orderSn:X.orderSn||X.id,reason:Z||void 0});me!=null&&me.success?(q(null),_(""),await ae("orders",!0)):j((me==null?void 0:me.error)||"退款失败")}catch(me){const Se=me;j(((B=Se==null?void 0:Se.data)==null?void 0:B.error)||"退款失败,请检查网络后重试")}finally{oe(!1)}}}function U(B){const me={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"},Se={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return i.jsx(Fe,{className:`${me[B]||"bg-gray-500/20 text-gray-400"} border-0`,children:Se[B]||B})}const he=Math.ceil(I/F)||1,Q=n,ee=o.filter(B=>{var Se,rt,Ye,st;if(!w)return!0;const me=w.toLowerCase();return((Se=B.refereeNickname)==null?void 0:Se.toLowerCase().includes(me))||((rt=B.refereePhone)==null?void 0:rt.includes(me))||((Ye=B.referrerName)==null?void 0:Ye.toLowerCase().includes(me))||((st=B.referrerCode)==null?void 0:st.toLowerCase().includes(me))}),de=u.filter(B=>{var Se;if(!w)return!0;const me=w.toLowerCase();return((Se=B.userName)==null?void 0:Se.toLowerCase().includes(me))||B.account&&B.account.toLowerCase().includes(me)});return i.jsxs("div",{className:"p-8 w-full",children:[v&&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:v}),i.jsx("button",{type:"button",onClick:()=>j(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:"推广中心"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),i.jsxs(re,{onClick:Y,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[i.jsx(qe,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),"刷新数据"]})]}),i.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4 flex-wrap",children:[{key:"overview",label:"数据概览",icon:dc},{key:"orders",label:"订单管理",icon:Wu},{key:"bindings",label:"绑定管理",icon:Ns},{key:"withdrawals",label:"提现审核",icon:Yo},{key:"settings",label:"推广设置",icon:Da}].map(B=>i.jsxs("button",{type:"button",onClick:()=>{e(B.key),C("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===B.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[i.jsx(B.icon,{className:"w-4 h-4"}),B.label]},B.key))}),g?i.jsxs("div",{className:"flex items-center justify-center py-20",children:[i.jsx(qe,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),i.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):i.jsxs(i.Fragment,{children:[t==="overview"&&s&&i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayClicks}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"总点击次数(实时)"})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:i.jsx(mg,{className:"w-6 h-6 text-blue-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日独立用户"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayUniqueVisitors??0}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"去重访客数(实时)"})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/20 flex items-center justify-center",children:i.jsx(Pn,{className:"w-6 h-6 text-cyan-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日总文章点击率"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(s.todayClickRate??0).toFixed(2)}),i.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"人均点击(总点击/独立用户)"})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-500/20 flex items-center justify-center",children:i.jsx(dc,{className:"w-6 h-6 text-amber-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayBindings})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:i.jsx(Ns,{className:"w-6 h-6 text-green-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),i.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:s.todayConversions})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:i.jsx(Tb,{className:"w-6 h-6 text-purple-400"})})]})})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),i.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",s.todayEarnings.toFixed(2)]})]}),i.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:i.jsx(Wu,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((Ce=s.todayClicksByPage)==null?void 0:Ce.length)??0)>0&&i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(mg,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),i.jsx(Te,{children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[i.jsx("th",{className:"pb-3 pr-4",children:"来源页/文章"}),i.jsx("th",{className:"pb-3 pr-4 text-right",children:"今日点击"}),i.jsx("th",{className:"pb-3 text-right",children:"占比"})]})}),i.jsx("tbody",{children:[...s.todayClicksByPage??[]].sort((B,me)=>me.clicks-B.clicks).map((B,me)=>i.jsxs("tr",{className:"border-b border-gray-700/50",children:[i.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:B.page||"(未区分)"}),i.jsx("td",{className:"py-2 pr-4 text-right text-white",children:B.clicks}),i.jsxs("td",{className:"py-2 text-right text-gray-400",children:[s.todayClicks>0?(B.clicks/s.todayClicks*100).toFixed(1):0,"%"]})]},me))})]})})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Ee,{className:"bg-orange-500/10 border-orange-500/30",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:i.jsx(fg,{className:"w-6 h-6 text-orange-400"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),i.jsxs("p",{className:"text-2xl font-bold text-white",children:[s.expiringBindings," 个"]}),i.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),i.jsx(Ee,{className:"bg-blue-500/10 border-blue-500/30",children:i.jsx(Te,{className:"p-6",children:i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:i.jsx(Yo,{className:"w-6 h-6 text-blue-400"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),i.jsxs("p",{className:"text-2xl font-bold text-white",children:[s.pendingWithdrawals," 笔"]}),i.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",s.pendingWithdrawAmount.toFixed(2)]})]}),i.jsx(re,{onClick:()=>e("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(et,{children:i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(kc,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),i.jsx(Te,{children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.monthClicks})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.monthBindings})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.monthConversions})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),i.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",s.monthEarnings.toFixed(2)]})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(et,{children:i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(dc,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),i.jsxs(Te,{children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.totalClicks.toLocaleString()})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.totalBindings.toLocaleString()})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),i.jsx("p",{className:"text-xl font-bold text-white",children:s.totalConversions})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[i.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),i.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",s.totalEarnings.toFixed(2)]})]})]}),i.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[i.jsx("span",{className:"text-gray-300",children:"点击转化率"}),i.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[s.conversionRate,"%"]})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsx(et,{children:i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Pn,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),i.jsx(Te,{children:i.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-white",children:s.totalDistributors}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-green-400",children:s.activeDistributors}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),i.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[i.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),i.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),t==="orders"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ki,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),i.jsx(ce,{value:w,onChange:B=>k(B.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),i.jsxs("select",{value:E,onChange:B=>C(B.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"pending",children:"待支付"}),i.jsx("option",{value:"failed",children:"已失败"}),i.jsx("option",{value:"refunded",children:"已退款"})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-0",children:[n.length===0?i.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Q.map(B=>{var me,Se;return i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(me=B.id)==null?void 0:me.slice(0,12),"..."]}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm",children:B.userNickname}),i.jsx("p",{className:"text-gray-500 text-xs",children:B.userPhone})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm",children:(()=>{const rt=B.productType||B.type;return rt==="fullbook"?`${B.bookName||"《底层逻辑》"} - 全本`:rt==="match"?"匹配次数购买":`${B.bookName||"《底层逻辑》"} - ${B.sectionTitle||B.chapterTitle||`章节${B.productId||B.sectionId||""}`}`})()}),i.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const rt=B.productType||B.type;return rt==="fullbook"?"全书解锁":rt==="match"?"功能权益":B.chapterTitle||"单章购买"})()})]})}),i.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof B.amount=="number"?B.amount.toFixed(2):parseFloat(String(B.amount||"0")).toFixed(2)]}),i.jsx("td",{className:"p-4 text-gray-300",children:B.paymentMethod==="wechat"?"微信支付":B.paymentMethod==="alipay"?"支付宝":B.paymentMethod||"微信支付"}),i.jsx("td",{className:"p-4",children:B.status==="refunded"?i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):B.status==="completed"||B.status==="paid"?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):B.status==="pending"||B.status==="created"?i.jsx(Fe,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):i.jsx(Fe,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),i.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:B.refundReason,children:B.status==="refunded"&&B.refundReason?B.refundReason:"-"}),i.jsx("td",{className:"p-4 text-gray-300 text-sm",children:B.referrerId||B.referralCode?i.jsxs("span",{title:B.referralCode||B.referrerCode||B.referrerId||"",children:[B.referrerNickname||B.referralCode||B.referrerCode||((Se=B.referrerId)==null?void 0:Se.slice(0,8)),(B.referralCode||B.referrerCode)&&` (${B.referralCode||B.referrerCode})`]}):"-"}),i.jsx("td",{className:"p-4 text-[#FFD700]",children:B.referrerEarnings?`¥${(typeof B.referrerEarnings=="number"?B.referrerEarnings:parseFloat(String(B.referrerEarnings))).toFixed(2)}`:"-"}),i.jsx("td",{className:"p-4 text-gray-400 text-sm",children:B.createdAt?new Date(B.createdAt).toLocaleString("zh-CN"):"-"}),i.jsx("td",{className:"p-4",children:(B.status==="paid"||B.status==="completed")&&i.jsxs(re,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{q(B),_("")},children:[i.jsx(FN,{className:"w-3 h-3 mr-1"}),"退款"]})})]},B.id)})})]})}),t==="orders"&&i.jsx(Zr,{page:M,totalPages:he,total:I,pageSize:F,onPageChange:D,onPageSizeChange:B=>{R(B),D(1)}})]})})]}),t==="bindings"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ki,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),i.jsx(ce,{value:w,onChange:B=>k(B.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),i.jsxs("select",{value:E,onChange:B=>C(B.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"active",children:"有效"}),i.jsx("option",{value:"converted",children:"已转化"}),i.jsx("option",{value:"expired",children:"已过期"})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-0",children:[ee.length===0?i.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:ee.map(B=>i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-medium",children:B.refereeNickname||"匿名用户"}),i.jsx("p",{className:"text-gray-500 text-xs",children:B.refereePhone})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:B.referrerName||"-"}),i.jsx("p",{className:"text-gray-500 text-xs font-mono",children:B.referrerCode})]})}),i.jsx("td",{className:"p-4 text-gray-400",children:B.boundAt?new Date(B.boundAt).toLocaleDateString("zh-CN"):"-"}),i.jsx("td",{className:"p-4 text-gray-400",children:B.expiresAt?new Date(B.expiresAt).toLocaleDateString("zh-CN"):"-"}),i.jsx("td",{className:"p-4",children:U(B.status)}),i.jsx("td",{className:"p-4",children:B.commission?i.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",B.commission.toFixed(2)]}):i.jsx("span",{className:"text-gray-500",children:"-"})})]},B.id))})]})}),t==="bindings"&&i.jsx(Zr,{page:M,totalPages:he,total:I,pageSize:F,onPageChange:D,onPageSizeChange:B=>{R(B),D(1)}})]})})]}),t==="withdrawals"&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Ki,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),i.jsx(ce,{value:w,onChange:B=>k(B.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),i.jsxs("select",{value:E,onChange:B=>C(B.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"pending",children:"待审核"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-0",children:[de.length===0?i.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:de.map(B=>i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsx("td",{className:"p-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[B.userAvatar?i.jsx("img",{src:B.userAvatar,alt:"",className:"w-8 h-8 rounded-full object-cover"}):i.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(B.userName||B.name||"?").slice(0,1)}),i.jsx("p",{className:"text-white font-medium",children:B.userName||B.name})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",B.amount.toFixed(2)]})}),i.jsx("td",{className:"p-4",children:i.jsx(Fe,{className:B.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:B.method==="wechat"?"微信":"支付宝"})}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-mono text-xs",children:B.account}),i.jsx("p",{className:"text-gray-500 text-xs",children:B.name})]})}),i.jsx("td",{className:"p-4 text-gray-400",children:B.createdAt?new Date(B.createdAt).toLocaleString("zh-CN"):"-"}),i.jsx("td",{className:"p-4",children:U(B.status)}),i.jsx("td",{className:"p-4 text-right",children:B.status==="pending"&&i.jsxs("div",{className:"flex gap-2 justify-end",children:[i.jsxs(re,{size:"sm",onClick:()=>L(B.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Tb,{className:"w-4 h-4 mr-1"}),"通过"]}),i.jsxs(re,{size:"sm",variant:"outline",onClick:()=>H(B.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[i.jsx(PN,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},B.id))})]})}),t==="withdrawals"&&i.jsx(Zr,{page:M,totalPages:he,total:I,pageSize:F,onPageChange:D,onPageSizeChange:B=>{R(B),D(1)}})]})})]})]}),i.jsx(Qt,{open:!!X,onOpenChange:B=>!B&&q(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[i.jsx(Xt,{children:i.jsx(Zt,{className:"text-white",children:"订单退款"})}),X&&i.jsxs("div",{className:"space-y-4",children:[i.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",X.orderSn||X.id]}),i.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof X.amount=="number"?X.amount.toFixed(2):parseFloat(String(X.amount||"0")).toFixed(2)]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),i.jsx("div",{className:"form-input",children:i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:Z,onChange:B=>_(B.target.value)})})]}),i.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>q(null),disabled:$,children:"取消"}),i.jsx(re,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:ue,disabled:$,children:$?"退款中...":"确认退款"})]})]})}),t==="settings"&&i.jsx("div",{className:"-mx-8 -mt-6",children:i.jsx(wk,{embedded:!0})})]})}function CP(){const[t,e]=b.useState([]),[n,r]=b.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[s,a]=b.useState(!0),[o,c]=b.useState(null),[u,h]=b.useState("all"),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,j]=b.useState(0),[w,k]=b.useState(null);async function E(){var R,I,A,O,W,X,q;a(!0),c(null);try{const Z=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),_=await Be(`/api/admin/withdrawals?${Z}`);if(_!=null&&_.success){const $=_.withdrawals||[];e($),j(_.total??((R=_.stats)==null?void 0:R.total)??$.length),r({total:((I=_.stats)==null?void 0:I.total)??_.total??$.length,pendingCount:((A=_.stats)==null?void 0:A.pendingCount)??0,pendingAmount:((O=_.stats)==null?void 0:O.pendingAmount)??0,successCount:((W=_.stats)==null?void 0:W.successCount)??0,successAmount:((X=_.stats)==null?void 0:X.successAmount)??0,failedCount:((q=_.stats)==null?void 0:q.failedCount)??0})}else c("加载提现记录失败")}catch(Z){console.error("Load withdrawals error:",Z),c("加载失败,请检查网络后重试")}finally{a(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{E()},[u,f,g]);const C=Math.ceil(v/g)||1;async function M(R){const I=t.find(A=>A.id===R);if(I!=null&&I.userCommissionInfo&&I.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${I.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 + +确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(R);try{const A=await Rt("/api/admin/withdrawals",{id:R,action:"approve"});A!=null&&A.success?E():alert("操作失败: "+((A==null?void 0:A.error)??""))}catch{alert("操作失败")}finally{k(null)}}async function D(R){const I=prompt("请输入拒绝原因(将返还用户余额):");if(I){k(R);try{const A=await Rt("/api/admin/withdrawals",{id:R,action:"reject",errorMessage:I});A!=null&&A.success?E():alert("操作失败: "+((A==null?void 0:A.error)??""))}catch{alert("操作失败")}finally{k(null)}}}function F(R){switch(R){case"pending":return i.jsx(Fe,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return i.jsx(Fe,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return i.jsx(Fe,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return i.jsx(Fe,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return i.jsx(Fe,{className:"bg-gray-500/20 text-gray-400 border-0",children:R})}}return i.jsxs("div",{className:"p-8 w-full",children:[o&&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:o}),i.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),i.jsxs("div",{className:"flex justify-between items-start mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),i.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),i.jsxs(re,{variant:"outline",onClick:E,disabled:s,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 ${s?"animate-spin":""}`}),"刷新"]})]}),i.jsx(Ee,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:i.jsx(Te,{className:"p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(Wu,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),i.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",i.jsx("span",{className:"text-white font-medium",children:"90%"})]}),i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),i.jsxs("p",{children:["• ",i.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),i.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),i.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),i.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),i.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),i.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),i.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsxs(Te,{className:"p-4 text-center",children:[i.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),i.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),i.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(R=>i.jsx(re,{variant:u===R?"default":"outline",size:"sm",onClick:()=>h(R),className:u===R?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:R==="all"?"全部":R==="pending"?"待处理":R==="success"?"已完成":"已拒绝"},R))}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{className:"p-0",children:s?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:"加载中..."})]}):t.length===0?i.jsxs("div",{className:"text-center py-12",children:[i.jsx(Yo,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),i.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[i.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),i.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),i.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),i.jsx("tbody",{className:"divide-y divide-gray-700/50",children:t.map(R=>i.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[i.jsx("td",{className:"p-4 text-gray-400",children:new Date(R.createdAt??"").toLocaleString()}),i.jsx("td",{className:"p-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[R.userAvatar?i.jsx("img",{src:R.userAvatar,alt:R.userName??"",className:"w-8 h-8 rounded-full object-cover"}):i.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(R.userName??"?").charAt(0)}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-white",children:R.userName??"未知"}),i.jsx("p",{className:"text-xs text-gray-500",children:R.userPhone??R.referralCode??(R.userId??"").slice(0,10)})]})]})}),i.jsx("td",{className:"p-4",children:i.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(R.amount).toFixed(2)]})}),i.jsx("td",{className:"p-4",children:R.userCommissionInfo?i.jsxs("div",{className:"text-xs space-y-1",children:[i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),i.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",R.userCommissionInfo.totalCommission.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"已提现:"}),i.jsxs("span",{className:"text-gray-400",children:["¥",R.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between gap-4",children:[i.jsx("span",{className:"text-gray-500",children:"待审核:"}),i.jsxs("span",{className:"text-orange-400",children:["¥",R.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),i.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[i.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),i.jsxs("span",{className:R.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",R.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):i.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),i.jsxs("td",{className:"p-4",children:[F(R.status),R.errorMessage&&i.jsx("p",{className:"text-xs text-red-400 mt-1",children:R.errorMessage})]}),i.jsx("td",{className:"p-4 text-gray-400",children:R.processedAt?new Date(R.processedAt).toLocaleString():"-"}),i.jsx("td",{className:"p-4 text-gray-400",children:R.userConfirmedAt?i.jsxs("span",{className:"text-green-400",title:R.userConfirmedAt,children:["已确认 ",new Date(R.userConfirmedAt).toLocaleString()]}):"-"}),i.jsxs("td",{className:"p-4 text-right",children:[(R.status==="pending"||R.status==="pending_confirm")&&i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsxs(re,{size:"sm",onClick:()=>M(R.id),disabled:w===R.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[i.jsx(Kh,{className:"w-4 h-4 mr-1"}),"批准"]}),i.jsxs(re,{size:"sm",variant:"outline",onClick:()=>D(R.id),disabled:w===R.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(R.status==="success"||R.status==="completed")&&R.transactionId&&i.jsx("span",{className:"text-xs text-gray-500 font-mono",children:R.transactionId})]})]},R.id))})]})}),i.jsx(Zr,{page:f,totalPages:C,total:v,pageSize:g,onPageChange:m,onPageSizeChange:R=>{y(R),m(1)}})]})})})]})}var Cm={exports:{}},Em={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Xb;function EP(){if(Xb)return Em;Xb=1;var t=Fc();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var y=g(),v=r({inst:{value:y,getSnapshot:g}}),j=v[0].inst,w=v[1];return a(function(){j.value=y,j.getSnapshot=g,u(j)&&w({inst:j})},[m,y,g]),s(function(){return u(j)&&w({inst:j}),m(function(){u(j)&&w({inst:j})})},[m]),o(y),y}function u(m){var g=m.getSnapshot;m=m.value;try{var y=g();return!n(m,y)}catch{return!0}}function h(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Em.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Em}var Zb;function Nk(){return Zb||(Zb=1,Cm.exports=EP()),Cm.exports}var jk=Nk();function Mn(t){this.content=t}Mn.prototype={constructor:Mn,find:function(t){for(var e=0;e>1}};Mn.from=function(t){if(t instanceof Mn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Mn(e)};function kk(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),a=e.child(r);if(s==a){n+=s.nodeSize;continue}if(!s.sameMarkup(a))return n;if(s.isText&&s.text!=a.text){for(let o=0;s.text[o]==a.text[o];o++)n++;return n}if(s.content.size||a.content.size){let o=kk(s.content,a.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function Sk(t,e,n,r){for(let s=t.childCount,a=e.childCount;;){if(s==0||a==0)return s==a?null:{a:n,b:r};let o=t.child(--s),c=e.child(--a),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,s+c,a||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,s+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let a="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?s?typeof s=="function"?s(c):s:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:a+=r),a+=h},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),a=1);ae)for(let a=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),s+=c.nodeSize),o=u}return new pe(r,s)}cutByIndex(e,n){return e==n?pe.empty:e==0&&n==this.content.length?this:new pe(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new pe(s,a)}addToStart(e){return new pe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new pe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),a=r+s.nodeSize;if(a>=e)return a==e?mu(n+1,a):mu(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return pe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new pe(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return pe.empty;let n,r=0;for(let s=0;sthis.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-s.type.rank),n}};jt.none=[];class Qu extends Error{}class Me{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Ek(this.content,e+this.openStart,n);return r&&new Me(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Me(Ck(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Me.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Me(pe.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)s++;return new Me(e,r,s)}}Me.empty=new Me(pe.empty,0,0);function Ck(t,e,n){let{index:r,offset:s}=t.findIndex(e),a=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(s==e||a.isText){if(c!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,a.copy(Ck(a.content,e-s-1,n-s-1)))}function Ek(t,e,n,r){let{index:s,offset:a}=t.findIndex(e),o=t.maybeChild(s);if(a==e||o.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Ek(o.content,e-a-1,n,o);return c&&t.replaceChild(s,o.copy(c))}function TP(t,e,n){if(n.openStart>t.depth)throw new Qu("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Qu("Inconsistent open depths");return Tk(t,e,n,0)}function Tk(t,e,n,r){let s=t.index(r),a=t.node(r);if(s==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function uc(t,e,n,r){let s=(e||t).node(n),a=0,o=e?e.index(n):s.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(_a(t.nodeAfter,r),a++));for(let c=a;cs&&Tg(t,e,s+1),o=r.depth>s&&Tg(n,r,s+1),c=[];return uc(null,t,s,c),a&&o&&e.index(s)==n.index(s)?(Mk(a,o),_a(za(a,Ak(t,e,n,r,s+1)),c)):(a&&_a(za(a,Xu(t,e,s+1)),c),uc(e,n,s,c),o&&_a(za(o,Xu(n,r,s+1)),c)),uc(r,null,s,c),new pe(c)}function Xu(t,e,n){let r=[];if(uc(null,t,n,r),t.depth>n){let s=Tg(t,e,n+1);_a(za(s,Xu(t,e,n+1)),r)}return uc(e,null,n,r),new pe(r)}function MP(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)s=e.node(a).copy(pe.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class Ec{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let a=0;a0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Zu(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,a=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(a),h=a-u;if(r.push(o,c,s+u),!h||(o=o.child(c),o.isText))break;a=h-1,s+=u+1}return new Ec(n,r,a)}static resolveCached(e,n){let r=e1.get(e);if(r)for(let a=0;ae&&this.nodesBetween(e,n,a=>(r.isInSet(a.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Rk(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=pe.empty,s=0,a=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,a),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=s;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=pe.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,s,r);return a.type.checkAttrs(a.attrs),a}};Js.prototype.text=void 0;class eh extends Js{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Rk(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new eh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new eh(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Rk(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Wa{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new PP(e,n);if(r.next==null)return Wa.empty;let s=Ik(r);r.next&&r.err("Unexpected trailing text");let a=FP($P(s));return BP(a,r),a}matchType(e){for(let n=0;nh.createAndFill()));for(let h=0;h=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s{let a=s+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return a}).join(` +`)}}Wa.empty=new Wa(!0);class PP{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Ik(t){let e=[];do e.push(OP(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function OP(t){let e=[];do e.push(DP(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function DP(t){let e=zP(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=LP(t,e);else break;return e}function t1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function LP(t,e){let n=t1(t),r=n;return t.eat(",")&&(t.next!="}"?r=t1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function _P(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let a in n){let o=n[a];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function zP(t){if(t.eat("(")){let e=Ik(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=_P(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function $P(t){let e=[[]];return s(a(t,0),n()),e;function n(){return e.push([])-1}function r(o,c,u){let h={term:u,to:c};return e[o].push(h),h}function s(o,c){o.forEach(u=>u.to=c)}function a(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(a(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=a(o.exprs[u],c);if(u==o.exprs.length-1)return h;s(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),s(a(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return s(a(o.expr,c),u),s(a(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(a(o.expr,c));if(o.type=="range"){let u=c;for(let h=0;h{t[o].forEach(({term:c,to:u})=>{if(!c)return;let h;for(let f=0;f{h||s.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let a=e[r.join(",")]=new Wa(r.indexOf(t.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Dk(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Js(this,this.computeAttrs(e),pe.from(n),jt.setFrom(r))}createChecked(e=null,n,r){return n=pe.from(n),this.checkContent(n),new Js(this,this.computeAttrs(e),n,jt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=pe.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),a=s&&s.fillBefore(pe.empty,!0);return a?new Js(this,e,n.append(a),jt.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[a]=new zk(a,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function VP(t,e,n){let r=n.split("|");return s=>{let a=s===null?"null":typeof s;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${a}`)}}class HP{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?VP(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class tf{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=_k(e,s.attrs),this.excluded=null;let a=Ok(this.attrs);this.instance=a?new jt(this,a):null}create(e=null){return!e&&this.instance?this.instance:new jt(this,Dk(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((a,o)=>r[a]=new tf(a,s++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class $k{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=Mn.from(e.nodes),n.marks=Mn.from(e.marks||{}),this.nodes=r1.compile(this.spec.nodes,this),this.marks=tf.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let a=this.nodes[s],o=a.spec.content||"",c=a.spec.marks;if(a.contentMatch=r[o]||(r[o]=Wa.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=c=="_"?null:c?s1(this,c.split(" ")):c==""||!a.inlineContent?[]:null}for(let s in this.marks){let a=this.marks[s],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:s1(this,o.split(" "))}this.nodeFromJSON=s=>Js.fromJSON(this,s),this.markFromJSON=s=>jt.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof r1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new eh(r,r.defaultAttrs,e,jt.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function s1(t,e){let n=[];for(let r=0;r-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function WP(t){return t.tag!=null}function UP(t){return t.style!=null}class Gi{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(WP(s))this.tags.push(s);else if(UP(s)){let a=/[^=]*/.exec(s.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let a=e.nodes[s.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let r=new a1(this,n,!1);return r.addAll(e,jt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new a1(this,n,!0);return r.addAll(e,jt.none,n.from,n.to),Me.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;se.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let a=s.priority==null?50:s.priority,o=0;for(;o{r(o=o1(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let a=e.nodes[s].spec.parseDOM;a&&a.forEach(o=>{r(o=o1(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Gi(e,Gi.schemaRules(e)))}}const Fk={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},KP={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Bk={ol:!0,ul:!0},Tc=1,Ag=2,hc=4;function i1(t,e,n){return e!=null?(e?Tc:0)|(e==="full"?Ag:0):t&&t.whitespace=="pre"?Tc|Ag:n&~hc}class gu{constructor(e,n,r,s,a,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=jt.none,this.match=a||(o&hc?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(pe.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Tc)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-s[0].length))}}let n=pe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(pe.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Fk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class a1{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,a,o=i1(null,n.preserveWhitespace,0)|(r?hc:0);s?a=new gu(s.type,s.attrs,jt.none,!0,n.topMatch||s.type.contentMatch,o):r?a=new gu(null,null,jt.none,!0,null,o):a=new gu(e.schema.topNodeType,null,jt.none,!0,null,o),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,a=s.options&Ag?"full":this.localPreserveWS||(s.options&Tc)>0,{schema:o}=this.parser;if(a==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,` +`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(h)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,s){let a,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(a=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}a&&this.sync(c)&&this.open--}addAll(e,n,r,s){let a=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=s==null?null:e.childNodes[s];o!=c;o=o.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(o,n);this.findAtPoint(e,a)}findPlace(e,n,r){let s,a;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!s||s.length>h.length+c)&&(s=h,a=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!s)return null;this.sync(a);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):l1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new gu(e,n,u,s,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Tc)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(s?0:1),o=(c,u)=>{for(;c>=0;c--){let h=n[c];if(h==""){if(c==n.length-1||c==0)continue;for(;u>=a;u--)if(o(c-1,u))return!0;return!1}else{let f=u>0||u==0&&s?this.nodes[u].type:r&&u>=a?r.node(u-a).type:null;if(!f||f.name!=h&&!f.isInGroup(h))return!1;u--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function qP(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Bk.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function GP(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function o1(t){let e={};for(let n in t)e[n]=t[n];return e}function l1(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let a=[],o=c=>{a.push(c);for(let u=0;u{if(a.length||o.marks.length){let c=0,u=0;for(;c=0;s--){let a=this.serializeMark(e.marks[s],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&Du(Mm(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return Du(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new eo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=c1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return c1(e.marks)}}function c1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Mm(t){return t.document||window.document}const d1=new WeakMap;function JP(t){let e=d1.get(t);return e===void 0&&d1.set(t,e=YP(t)),e}function YP(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let c,u=n?t.createElementNS(n,s):t.createElement(s),h=e[1],f=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){f=2;for(let m in h)if(h[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=f;mf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:y,contentDOM:v}=Du(t,g,n,r);if(u.appendChild(y),v){if(c)throw new RangeError("Multiple content holes");c=v}}}return{dom:u,contentDOM:c}}const Vk=65535,Hk=Math.pow(2,16);function QP(t,e){return t+e*Hk}function u1(t){return t&Vk}function XP(t){return(t-(t&Vk))/Hk}const Wk=1,Uk=2,Lu=4,Kk=8;class Rg{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Kk)>0}get deletedBefore(){return(this.delInfo&(Wk|Lu))>0}get deletedAfter(){return(this.delInfo&(Uk|Lu))>0}get deletedAcross(){return(this.delInfo&Lu)>0}}class Nr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Nr.empty)return Nr.empty}recover(e){let n=0,r=u1(e);if(!this.inverted)for(let s=0;se)break;let h=this.ranges[c+a],f=this.ranges[c+o],m=u+h;if(e<=m){let g=h?e==u?-1:e==m?1:n:n,y=u+s+(g<0?0:f);if(r)return y;let v=e==(n<0?u:m)?null:QP(c/3,e-u),j=e==u?Uk:e==m?Wk:Lu;return(n<0?e!=u:e!=m)&&(j|=Kk),new Rg(y,j,v)}s+=f-h}return r?e+s:new Rg(e+s,0,null)}touches(e,n){let r=0,s=u1(n),a=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;ce)break;let h=this.ranges[c+a],f=u+h;if(e<=f&&c==s*3)return!0;r+=this.ranges[c+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,a=0;s=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Mc;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ra&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return on.fromReplace(e,this.from,this.to,a)}invert(){return new Xr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Vi(n.pos,r.pos,this.mark)}merge(e){return e instanceof Vi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Vi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Vi(n.from,n.to,e.markFromJSON(n.mark))}}Un.jsonID("addMark",Vi);class Xr extends Un{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Me(Vx(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return on.fromReplace(e,this.from,this.to,r)}invert(){return new Vi(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Xr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Xr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Xr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Xr(n.from,n.to,e.markFromJSON(n.mark))}}Un.jsonID("removeMark",Xr);class Hi extends Un{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return on.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return on.fromReplace(e,this.pos,this.pos+1,new Me(pe.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;sr.pos?null:new Nn(n.pos,r.pos,s,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Nn(n.from,n.to,n.gapFrom,n.gapTo,Me.fromJSON(e,n.slice),n.insert,!!n.structure)}}Un.jsonID("replaceAround",Nn);function Ig(t,e,n){let r=t.resolve(e),s=n-e,a=r.depth;for(;s>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,s--;if(s>0){let o=r.node(a).maybeChild(r.indexAfter(a));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function ZP(t,e,n,r){let s=[],a=[],o,c;t.doc.nodesBetween(e,n,(u,h,f)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&f.type.allowsMarkType(r.type)){let g=Math.max(h,e),y=Math.min(h+u.nodeSize,n),v=r.addToSet(m);for(let j=0;jt.step(u)),a.forEach(u=>t.step(u))}function eO(t,e,n,r){let s=[],a=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;a++;let u=null;if(r instanceof tf){let h=o.marks,f;for(;f=r.isInSet(h);)(u||(u=[])).push(f),h=f.removeFromSet(h)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let h=Math.min(c+o.nodeSize,n);for(let f=0;ft.step(new Xr(o.from,o.to,o.style)))}function Hx(t,e,n,r=n.contentMatch,s=!0){let a=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function tO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function fl(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,a=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+s,u=t.$to.indexAfter(r)-a;if(rn;v--)j||r.index(v)>0?(j=!0,f=pe.from(r.node(v).copy(f)),m++):u--;let g=pe.empty,y=0;for(let v=a,j=!1;v>n;v--)j||s.after(v+1)=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=pe.from(n[o].type.create(n[o].attrs,r))}let s=e.start,a=e.end;t.step(new Nn(s,a,s,a,new Me(r,0,0),n.length,!0))}function aO(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(o,c)=>{let u=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,u)&&oO(t.doc,t.mapping.slice(a).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!v?h=!1:!y&&v&&(h=!0)}h===!1&&Gk(t,o,c,a),Hx(t,t.mapping.slice(a).map(c,1),r,void 0,h===null);let f=t.mapping.slice(a),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new Nn(m,g,m+1,g-1,new Me(pe.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&qk(t,o,c,a),!1}})}function qk(t,e,n,r){e.forEach((s,a)=>{if(s.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(s.text);){let u=t.mapping.slice(r).map(n+1+a+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function Gk(t,e,n,r){e.forEach((s,a)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+a);t.replaceWith(o,o+1,e.type.schema.text(` +`))}})}function oO(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function lO(t,e,n,r,s){let a=t.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");n||(n=a.type);let o=n.create(r,null,s||a.marks);if(a.isLeaf)return t.replaceWith(e,e+a.nodeSize,o);if(!n.validContent(a.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Nn(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new Me(pe.from(o),0,0),1,!0))}function Ys(t,e,n=1,r){let s=t.resolve(e),a=s.depth-n,o=r&&r[r.length-1]||s.parent;if(a<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let h=s.depth-1,f=n-2;h>a;h--,f--){let m=s.node(h),g=s.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),v=r&&r[f+1];v&&(y=y.replaceChild(0,v.type.create(v.attrs)));let j=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!j.type.validContent(y))return!1}let c=s.indexAfter(a),u=r&&r[0];return s.node(a).canReplaceWith(c,c,u?u.type:s.node(a+1).type)}function cO(t,e,n=1,r){let s=t.doc.resolve(e),a=pe.empty,o=pe.empty;for(let c=s.depth,u=s.depth-n,h=n-1;c>u;c--,h--){a=pe.from(s.node(c).copy(a));let f=r&&r[h];o=pe.from(f?f.type.create(f.attrs,o):s.node(c).copy(o))}t.step(new wn(e,e,new Me(a.append(o),n,n),!0))}function oa(t,e){let n=t.resolve(e),r=n.index();return Jk(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function dO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s0?(a=r.node(s+1),c++,o=r.node(s).maybeChild(c)):(a=r.node(s).maybeChild(c-1),o=r.node(s+1)),a&&!a.isTextblock&&Jk(a,o)&&r.node(s).canReplace(c,c+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function uO(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,a=t.doc.resolve(e-n),o=a.node().type;if(s&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(s);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);Gk(t,f.node(),f.before(),c)}o.inlineContent&&Hx(t,e+n-1,o,a.node().contentMatchAt(a.index()),r==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new wn(h,u.map(e+n,-1),Me.empty,!0)),r===!0){let f=t.doc.resolve(h);qk(t,f.node(),f.before(),t.steps.length)}return t}function hO(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let a=r.index(s);if(r.node(s).canReplaceWith(a,a,n))return r.before(s+1);if(a>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a=0;o--){let c=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(c>0?1:0),h=r.node(o),f=!1;if(a==1)f=h.canReplace(u,u,s);else{let m=h.contentMatchAt(u).findWrapping(s.firstChild.type);f=m&&h.canReplaceWith(u,u,m[0])}if(f)return c==0?r.pos:c<0?r.before(o+1):r.after(o+1)}return null}function rf(t,e,n=e,r=Me.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),a=t.resolve(n);return Qk(s,a,r)?new wn(e,n,r):new fO(s,a,r).fit()}function Qk(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class fO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=pe.empty;for(let s=0;s<=e.depth;s++){let a=e.node(s);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=pe.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let a=this.placed,o=r.depth,c=s.depth;for(;o&&c&&a.childCount==1;)a=a.firstChild.content,o--,c--;let u=new Me(a,o,c);return e>-1?new Nn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new wn(r.pos,s.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r1&&(s=0),a.type.spec.isolating&&s<=r){e=r;break}n=a.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,a=null;r?(a=Rm(this.unplaced.content,r-1).firstChild,s=a.content):s=this.unplaced.content;let o=s.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:h}=this.frontier[c],f,m=null;if(n==1&&(o?h.matchType(o.type)||(m=h.fillBefore(pe.from(o),!1)):a&&u.compatibleContent(a.type)))return{sliceDepth:r,frontierDepth:c,parent:a,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:a,wrap:f};if(a&&h.matchType(a.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Rm(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new Me(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Rm(e,n);if(s.childCount<=1&&n>0){let a=e.size-n<=n+s.size;this.unplaced=new Me(rc(e,n-1,1),n-1,a?n-1:r)}else this.unplaced=new Me(rc(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:a}){for(;this.depth>n;)this.closeFrontierNode();if(a)for(let j=0;j1||u==0||j.content.size)&&(m=w,f.push(Xk(j.mark(g.allowedMarks(j.marks)),h==1?u:0,h==c.childCount?y:-1)))}let v=h==c.childCount;v||(y=-1),this.placed=sc(this.placed,n,pe.from(f)),this.frontier[n].match=m,v&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let j=0,w=c;j1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],a=n=0;c--){let{match:u,type:h}=this.frontier[c],f=Im(e,c,h,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:o,move:a?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=sc(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),a=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,a)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=sc(this.placed,this.depth,pe.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(pe.empty,!0);n.childCount&&(this.placed=sc(this.placed,this.frontier.length,n))}}function rc(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(rc(t.firstChild.content,e-1,n)))}function sc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(sc(t.lastChild.content,e-1,n)))}function Rm(t,e){for(let n=0;n1&&(r=r.replaceChild(0,Xk(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(pe.empty,!0)))),t.copy(r)}function Im(t,e,n,r,s){let a=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let c=r.fillBefore(a.content,!0,o);return c&&!pO(n,a.content,o)?c:null}function pO(t,e,n){for(let r=n;r0;g--,y--){let v=s.node(g).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(g)>-1?c=g:s.before(g)==y&&o.splice(1,0,-g)}let u=o.indexOf(c),h=[],f=r.openStart;for(let g=r.content,y=0;;y++){let v=g.firstChild;if(h.push(v),y==r.openStart)break;g=v.content}for(let g=f-1;g>=0;g--){let y=h[g],v=mO(y.type);if(v&&!y.sameMarkup(s.node(Math.abs(c)-1)))f=g;else if(v||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+f+1)%(r.openStart+1),v=h[y];if(v)for(let j=0;j=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=o[g];y<0||(e=s.before(y),n=a.after(y))}}function Zk(t,e,n,r,s){if(er){let a=s.contentMatchAt(0),o=a.fillBefore(t).append(t);t=o.append(a.matchFragment(o).fillBefore(pe.empty,!0))}return t}function xO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=hO(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new Me(pe.from(r),0,0))}function yO(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n),a=eS(r,s);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),s.indexAfter(c-1))))return t.delete(r.before(c),s.after(c))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function eS(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let a=t.start(s);if(ae.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(a==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==a-1)&&n.push(s)}return n}class Ko extends Un{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return on.fail("No node at attribute step's position");let r=Object.create(null);for(let a in n.attrs)r[a]=n.attrs[a];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return on.fromReplace(e,this.pos,this.pos+1,new Me(pe.from(s),0,n.isLeaf?0:1))}getMap(){return Nr.empty}invert(e){return new Ko(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ko(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ko(n.pos,n.attr,n.value)}}Un.jsonID("attr",Ko);class Ac extends Un{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return on.ok(r)}getMap(){return Nr.empty}invert(e){return new Ac(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ac(n.attr,n.value)}}Un.jsonID("docAttr",Ac);let Xo=class extends Error{};Xo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Xo.prototype=Object.create(Error.prototype);Xo.prototype.constructor=Xo;Xo.prototype.name="TransformError";class Ux{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Mc}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Xo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r{e=Math.min(e,c),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Me.empty){let s=rf(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new Me(pe.from(r),0,0))}delete(e,n){return this.replace(e,n,Me.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return gO(this,e,n,r),this}replaceRangeWith(e,n,r){return xO(this,e,n,r),this}deleteRange(e,n){return yO(this,e,n),this}lift(e,n){return nO(this,e,n),this}join(e,n=1){return uO(this,e,n),this}wrap(e,n){return iO(this,e,n),this}setBlockType(e,n=e,r,s=null){return aO(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return lO(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Ko(e,n,r)),this}setDocAttribute(e,n){return this.step(new Ac(e,n)),this}addNodeMark(e,n){return this.step(new Hi(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof jt)n.isInSet(r.marks)&&this.step(new Ua(e,n));else{let s=r.marks,a,o=[];for(;a=n.isInSet(s);)o.push(new Ua(e,a)),s=a.removeFromSet(s);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return cO(this,e,n,r),this}addMark(e,n,r){return ZP(this,e,n,r),this}removeMark(e,n,r){return eO(this,e,n,r),this}clearIncompatible(e,n,r){return Hx(this,e,n,r),this}}const Pm=Object.create(null);class Ge{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new tS(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;a--){let o=n<0?Lo(e.node(0),e.node(a),e.before(a+1),e.index(a),n,r):Lo(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new kr(e.node(0))}static atStart(e){return Lo(e,e,0,0,1)||new kr(e)}static atEnd(e){return Lo(e,e,e.content.size,e.childCount,-1)||new kr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Pm[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Pm)throw new RangeError("Duplicate use of selection JSON ID "+e);return Pm[e]=n,n.prototype.jsonID=e,n}getBookmark(){return He.between(this.$anchor,this.$head).getBookmark()}}Ge.prototype.visible=!0;class tS{constructor(e,n){this.$from=e,this.$to=n}}let f1=!1;function p1(t){!f1&&!t.parent.inlineContent&&(f1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class He extends Ge{constructor(e,n=e){p1(e),p1(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ge.near(r);let s=e.resolve(n.map(this.anchor));return new He(s.parent.inlineContent?s:r,r)}replace(e,n=Me.empty){if(super.replace(e,n),n==Me.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof He&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new sf(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new He(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let a=Ge.findFrom(n,r,!0)||Ge.findFrom(n,-r,!0);if(a)n=a.$head;else return Ge.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(Ge.findFrom(e,-r,!0)||Ge.findFrom(e,r,!0)).$anchor,e.pos0?0:1);s>0?o=0;o+=s){let c=e.child(o);if(c.isAtom){if(!a&&Ve.isSelectable(c))return Ve.create(t,n-(s<0?c.nodeSize:0))}else{let u=Lo(t,c,n+s,s<0?c.childCount:0,s,a);if(u)return u}n+=c.nodeSize*s}return null}function m1(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(Ge.near(t.doc.resolve(o),n))}const g1=1,xu=2,x1=4;class bO extends Ux{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=xu,this}ensureMarks(e){return jt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&xu)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~xu,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||jt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let a=this.storedMarks;if(!a){let o=this.doc.resolve(n);a=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,a)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Ge.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=x1,this}get scrolledIntoView(){return(this.updated&x1)>0}}function y1(t,e){return!e||!t?t:t.bind(e)}class ic{constructor(e,n,r){this.name=e,this.init=y1(n.init,r),this.apply=y1(n.apply,r)}}const wO=[new ic("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ic("selection",{init(t,e){return t.selection||Ge.atStart(e.doc)},apply(t){return t.selection}}),new ic("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ic("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Om{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=wO.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ic(r.key,r.spec.state,r))})}}class Wo{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],a=s.spec.state;a&&a.toJSON&&(n[r]=a.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new Om(e.schema,e.plugins),a=new Wo(s);return s.fields.forEach(o=>{if(o.name=="doc")a.doc=Js.fromJSON(e.schema,n.doc);else if(o.name=="selection")a.selection=Ge.fromJSON(a.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(a.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],h=u.spec.state;if(u.key==o.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){a[o.name]=h.fromJSON.call(u,e,n[c],a);return}}a[o.name]=o.init(e,a)}}),a}}function nS(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=nS(s,e,{})),n[r]=s}return n}class Ct{constructor(e){this.spec=e,this.props={},e.props&&nS(e.props,this,this.props),this.key=e.key?e.key.key:rS("plugin")}getState(e){return e[this.key]}}const Dm=Object.create(null);function rS(t){return t in Dm?t+"$"+ ++Dm[t]:(Dm[t]=0,t+"$")}class _t{constructor(e="key"){this.key=rS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const qx=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function sS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const iS=(t,e,n)=>{let r=sS(t,n);if(!r)return!1;let s=Gx(r);if(!s){let o=r.blockRange(),c=o&&fl(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let a=s.nodeBefore;if(pS(t,s,e,-1))return!0;if(r.parent.content.size==0&&(Zo(a,"end")||Ve.isSelectable(a)))for(let o=r.depth;;o--){let c=rf(t.doc,r.before(o),r.after(o),Me.empty);if(c&&c.slice.size1)break}return a.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-a.nodeSize,s.pos).scrollIntoView()),!0):!1},NO=(t,e,n)=>{let r=sS(t,n);if(!r)return!1;let s=Gx(r);return s?aS(t,s,e):!1},jO=(t,e,n)=>{let r=lS(t,n);if(!r)return!1;let s=Jx(r);return s?aS(t,s,e):!1};function aS(t,e,n){let r=e.nodeBefore,s=r,a=e.pos-1;for(;!s.isTextblock;a--){if(s.type.spec.isolating)return!1;let f=s.lastChild;if(!f)return!1;s=f}let o=e.nodeAfter,c=o,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let f=c.firstChild;if(!f)return!1;c=f}let h=rf(t.doc,a,u,Me.empty);if(!h||h.from!=a||h instanceof wn&&h.slice.size>=u-a)return!1;if(n){let f=t.tr.step(h);f.setSelection(He.create(f.doc,a)),n(f.scrollIntoView())}return!0}function Zo(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const oS=(t,e,n)=>{let{$head:r,empty:s}=t.selection,a=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;a=Gx(r)}let o=a&&a.nodeBefore;return!o||!Ve.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ve.create(t.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Gx(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function lS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=lS(t,n);if(!r)return!1;let s=Jx(r);if(!s)return!1;let a=s.nodeAfter;if(pS(t,s,e,1))return!0;if(r.parent.content.size==0&&(Zo(a,"start")||Ve.isSelectable(a))){let o=rf(t.doc,r.before(),r.after(),Me.empty);if(o&&o.slice.size{let{$head:r,empty:s}=t.selection,a=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof Ve,s;if(r){if(n.node.isTextblock||!oa(t.doc,n.from))return!1;s=n.from}else if(s=nf(t.doc,n.from,-1),s==null)return!1;if(e){let a=t.tr.join(s);r&&a.setSelection(Ve.create(a.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},SO=(t,e)=>{let n=t.selection,r;if(n instanceof Ve){if(n.node.isTextblock||!oa(t.doc,n.to))return!1;r=n.to}else if(r=nf(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},CO=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),a=s&&fl(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)},uS=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` +`).scrollIntoView()),!0)};function Yx(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),a=n.indexAfter(-1),o=Yx(s.contentMatchAt(a));if(!o||!s.canReplaceWith(a,a,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(Ge.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},hS=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof kr||r.parent.inlineContent||s.parent.inlineContent)return!1;let a=Yx(s.parent.contentMatchAt(s.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let a=n.before();if(Ys(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let r=n.blockRange(),s=r&&fl(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function TO(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof Ve&&e.selection.node.isBlock)return!r.parentOffset||!Ys(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,c,u=!1,h=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){u=r.end(y)==r.pos+(r.depth-y),h=r.start(y)==r.pos-(r.depth-y),c=Yx(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),a.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;a.unshift(null)}let f=e.tr;(e.selection instanceof He||e.selection instanceof kr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=Ys(f.doc,m,a.length,a);if(g||(a[0]=c?{type:c}:null,g=Ys(f.doc,m,a.length,a)),!g)return!1;if(f.split(m,a.length,a),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),v=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(v.index(),v.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const MO=TO(),AO=(t,e)=>{let{$from:n,to:r}=t.selection,s,a=n.sharedDepth(r);return a==0?!1:(s=n.before(a),e&&e(t.tr.setSelection(Ve.create(t.doc,s))),!0)};function RO(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,a=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(a-1,a)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(a,a+1)||!(s.isTextblock||oa(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function pS(t,e,n,r){let s=e.nodeBefore,a=e.nodeAfter,o,c,u=s.type.spec.isolating||a.type.spec.isolating;if(!u&&RO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&c.matchType(o[0]||a.type).validEnd){if(n){let y=e.pos+a.nodeSize,v=pe.empty;for(let k=o.length-1;k>=0;k--)v=pe.from(o[k].create(null,v));v=pe.from(s.copy(v));let j=t.tr.step(new Nn(e.pos-1,y,e.pos,y,new Me(v,1,0),o.length,!0)),w=j.doc.resolve(y+2*o.length);w.nodeAfter&&w.nodeAfter.type==s.type&&oa(j.doc,w.pos)&&j.join(w.pos),n(j.scrollIntoView())}return!0}let f=a.type.spec.isolating||r>0&&u?null:Ge.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&fl(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&Zo(a,"start",!0)&&Zo(s,"end")){let y=s,v=[];for(;v.push(y),!y.isTextblock;)y=y.lastChild;let j=a,w=1;for(;!j.isTextblock;j=j.firstChild)w++;if(y.canReplace(y.childCount,y.childCount,j.content)){if(n){let k=pe.empty;for(let C=v.length-1;C>=0;C--)k=pe.from(v[C].copy(k));let E=t.tr.step(new Nn(e.pos-v.length,e.pos+a.nodeSize,e.pos+w,e.pos+a.nodeSize-w,new Me(k,v.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function mS(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,a=s.depth;for(;s.node(a).isInline;){if(!a)return!1;a--}return s.node(a).isTextblock?(n&&n(e.tr.setSelection(He.create(e.doc,t<0?s.start(a):s.end(a)))),!0):!1}}const IO=mS(-1),PO=mS(1);function OO(t,e=null){return function(n,r){let{$from:s,$to:a}=n.selection,o=s.blockRange(a),c=o&&Wx(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function v1(t,e=null){return function(n,r){let s=!1;for(let a=0;a{if(s)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)s=!0;else{let f=n.doc.resolve(h),m=f.index();s=f.parent.canReplaceWith(m,m+1,t)}})}if(!s)return!1;if(r){let a=n.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);a=new Zu(u,u,e.depth),e.endIndex=0;f--)a=pe.from(n[f].type.create(n[f].attrs,a));t.step(new Nn(e.start-(r?2:0),e.end,e.start,e.end,new Me(a,0,0),n.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==t);return a?n?r.node(a.depth-1).type==t?$O(e,n,t,a):FO(e,n,a):!0:!1}}function $O(t,e,n,r){let s=t.tr,a=r.end,o=r.$to.end(r.depth);aj;v--)y-=s.child(v).nodeSize,r.delete(y-1,y+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==s.childCount,h=a.node(-1),f=a.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?pe.empty:pe.from(s))))return!1;let m=a.pos,g=m+o.nodeSize;return r.step(new Nn(m-(c?1:0),g+(u?1:0),m+1,g-1,new Me((c?pe.empty:pe.from(s.copy(pe.empty))).append(u?pe.empty:pe.from(s.copy(pe.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function BO(t){return function(e,n){let{$from:r,$to:s}=e.selection,a=r.blockRange(s,h=>h.childCount>0&&h.firstChild.type==t);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let c=a.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=pe.from(h?t.create():null),m=new Me(pe.from(t.create(null,pe.from(c.type.create(null,f)))),h?3:1,0),g=a.start,y=a.end;n(e.tr.step(new Nn(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const An=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},el=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Pg=null;const Ks=function(t,e,n){let r=Pg||(Pg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},VO=function(){Pg=null},Ka=function(t,e,n,r){return n&&(b1(t,e,n,r,-1)||b1(t,e,n,r,1))},HO=/^(img|br|input|textarea|hr)$/i;function b1(t,e,n,r,s){for(var a;;){if(t==n&&e==r)return!0;if(e==(s<0?0:_r(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Uc(t)||HO.test(t.nodeName)||t.contentEditable=="false")return!1;e=An(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((a=o.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?_r(t):0}else return!1}}function _r(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function WO(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=_r(t)}else if(t.parentNode&&!Uc(t))e=An(t),t=t.parentNode;else return null}}function UO(t,e){for(;;){if(t.nodeType==3&&e2),Lr=tl||(ks?/Mac/.test(ks.platform):!1),yS=ks?/Win/.test(ks.platform):!1,Gs=/Android \d/.test(la),Kc=!!w1&&"webkitFontSmoothing"in w1.documentElement.style,JO=Kc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function YO(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Bs(t,e){return typeof t=="number"?t:t[e]}function QO(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function N1(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=el(o);continue}let c=o,u=c==a.body,h=u?YO(a):QO(c),f=0,m=0;if(e.toph.bottom-Bs(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+Bs(s,"top")-h.top:e.bottom-h.bottom+Bs(s,"bottom")),e.lefth.right-Bs(r,"right")&&(f=e.right-h.right+Bs(s,"right")),f||m)if(u)a.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let j=c.scrollLeft-y,w=c.scrollTop-v;e={left:e.left-j,top:e.top-w,right:e.right-j,bottom:e.bottom-w}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:el(o)}}function XO(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let a=(e.left+e.right)/2,o=n+1;o=n-20){r=c,s=u.top;break}}return{refDOM:r,refTop:s,stack:vS(t.dom)}}function vS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=el(r));return e}function ZO({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;bS(n,r==0?0:r-e)}function bS(t,e){for(let n=0;n=c){o=Math.max(v.bottom,o),c=Math.min(v.top,c);let j=v.left>e.left?v.left-e.left:v.right=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!u&&v.left<=e.left&&v.right>=e.left&&(u=f,h={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(a=m+1)}}return!n&&u&&(n=u,s=h,r=0),n&&n.nodeType==3?tD(n,s):!n||r&&n.nodeType==1?{node:t,offset:a}:wS(n,s)}function tD(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let a=0;a=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function Xx(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function nD(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,a)}function sD(t,e,n,r){let s=-1;for(let a=e,o=!1;a!=t.dom;){let c=t.docView.nearestDesc(a,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?s=c.posBefore:(!o&&u.right-1?s:t.docView.posFromDOM(e,n,-1)}function NS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&s++}let h;Kc&&s&&r.nodeType==1&&(h=r.childNodes[s-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(c=sD(t,r,s,e))}c==null&&(c=rD(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function j1(t){return t.top=0&&s==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Ql(Ii(Ks(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&s&&(n<0||s==_r(r))){let u=r.childNodes[s-1];if(u.nodeType==1)return Lm(u.getBoundingClientRect(),!1)}if(a==null&&s<_r(r)){let u=r.childNodes[s];if(u.nodeType==1)return Lm(u.getBoundingClientRect(),!0)}return Lm(r.getBoundingClientRect(),n>=0)}if(a==null&&s&&(n<0||s==_r(r))){let u=r.childNodes[s-1],h=u.nodeType==3?Ks(u,_r(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Ql(Ii(h,1),!1)}if(a==null&&s<_r(r)){let u=r.childNodes[s];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let h=u?u.nodeType==3?Ks(u,0,o?0:1):u.nodeType==1?u:null:null;if(h)return Ql(Ii(h,-1),!0)}return Ql(Ii(r.nodeType==3?Ks(r):r,-n),n>=0)}function Ql(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Lm(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function kS(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function oD(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return kS(t,e,()=>{let{node:a}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(a,!0);if(!c)break;if(c.node.isBlock){a=c.contentDOM||c.dom;break}a=c.dom.parentNode}let o=jS(t,s.pos,1);for(let c=a.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=Ks(c,0,c.nodeValue.length).getClientRects();else continue;for(let h=0;hf.top+1&&(n=="up"?o.top-f.top>(f.bottom-o.top)*2:f.bottom-o.bottom>(o.bottom-f.top)*2))return!1}}return!0})}const lD=/[\u0590-\u08ac]/;function cD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,a=!s,o=s==r.parent.content.size,c=t.domSelection();return c?!lD.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?a:o:kS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:j}=t.domSelectionRange(),w=v&&!y.contains(v.nodeType==1?v:v.parentNode)||u==v&&h==j;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),w}):r.pos==r.start()||r.pos==r.end()}let k1=null,S1=null,C1=!1;function dD(t,e,n){return k1==e&&S1==n?C1:(k1=e,S1=n,C1=n=="up"||n=="down"?oD(t,e,n):cD(t,e,n))}const Fr=0,E1=1,Ra=2,Ss=3;class qc{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Fr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nAn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let a=e;;a=a.parentNode){if(a==this.dom){s=!1;break}if(a.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){s=!0;break}if(a.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let a=this.getDesc(s),o;if(a&&(!n||a.node))if(r&&(o=a.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return a}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let a=this.getDesc(s);if(a)return a.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof CS){s=e-a;break}a=c}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let a;r&&!(a=this.children[r-1]).size&&a instanceof SS&&a.side>=0;r--);if(n<=0){let a,o=!0;for(;a=r?this.children[r-1]:null,!(!a||a.dom.parentNode==this.contentDOM);r--,o=!1);return a&&n&&o&&!a.border&&!a.domAtom?a.domFromPos(a.size,n):{node:this.contentDOM,offset:a?An(a.dom)+1:0}}else{let a,o=!0;for(;a=r=f&&n<=h-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=o;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){s=An(g.dom)+1;break}e-=g.size}s==-1&&(s=0)}if(s>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fv&&on){let v=c;c=u,u=v}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s=r:er){let c=r+a.border,u=o-a.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?Ra:E1,e==c&&n==u&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=Ss:a.markDirty(e-c,n-c);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Ra:Ss}r=o}this.dirty=Ra}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ra:E1;n.dirty{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)})),!n.type.spec.raw){if(o.nodeType!=1){let c=document.createElement("span");c.appendChild(o),o=c}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,a=this}matchesWidget(e){return this.dirty==Fr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class uD extends qc{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class qa extends qc{constructor(e,n,r,s,a){super(e,[],r,s),this.mark=n,this.spec=a}static create(e,n,r,s){let a=s.nodeViews[n.type.name],o=a&&a(n,s,r);return(!o||!o.dom)&&(o=eo.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new qa(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ss||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ss&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Fr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(a=zg(a,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,s),f=h&&h.dom,m=h&&h.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:m}=eo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let g=f;return f=MS(f,r,n),h?u=new hD(e,n,r,s,f,m||null,g,h,a,o+1):n.isText?new of(e,n,r,s,f,g,a):new Yi(e,n,r,s,f,m||null,g,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>pe.empty)}return e}matchesNode(e,n,r){return this.dirty==Fr&&e.eq(this.node)&&th(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,a=e.composing?this.localCompositionInfo(e,n):null,o=a&&a.pos>-1?a:null,c=a&&a.pos<0,u=new pD(this,o&&o.node,e);xD(this.node,this.innerDeco,(h,f,m)=>{h.spec.marks?u.syncToMarks(h.spec.marks,r,e,f):h.type.side>=0&&!m&&u.syncToMarks(f==this.node.childCount?jt.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,s)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>s&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,s)||u.addNode(h,f,m,e,s),s+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Ra)&&(o&&this.protectLocalComposition(e,o),ES(this.contentDOM,this.children,e),tl&&yD(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof He)||rn+this.node.content.size)return null;let a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let o=a.nodeValue,c=vD(this.node.content,o,r-n,s-n);return c<0?null:{node:a,pos:c,text:o}}else return{node:a,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let a=n;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let o=new uD(this,a,n,s);e.input.compositionNodes.push(o),this.children=zg(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==Ss||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Fr}updateOuterDeco(e){if(th(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=TS(this.dom,this.nodeDOM,_g(this.outerDeco,this.node,n),_g(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function T1(t,e,n,r,s){MS(r,e,t);let a=new Yi(void 0,t,e,n,r,r,r,s,0);return a.contentDOM&&a.updateChildren(s,0),a}class of extends Yi{constructor(e,n,r,s,a,o,c){super(e,n,r,s,a,null,o,c,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==Ss||this.dirty!=Fr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Fr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Fr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),a=document.createTextNode(s.text);return new of(this.parent,s,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ss)}get domAtom(){return!1}isText(e){return this.node.text==e}}class CS extends qc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Fr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class hD extends Yi{constructor(e,n,r,s,a,o,c,u,h,f){super(e,n,r,s,a,o,c,h,f),this.spec=u}update(e,n,r,s){if(this.dirty==Ss)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let a=this.spec.update(e,n,r);return a&&this.updateInner(e,n,r,s),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ES(t,e,n){let r=t.firstChild,s=!1;for(let a=0;a>1,c=Math.min(o,e.length);for(;a-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let f=qa.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,f),this.top=f,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let a=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))a=this.top.children.indexOf(o,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c0;){let c;for(;;)if(r){let h=n.children[r-1];if(h instanceof qa)n=h,r=h.children.length;else{c=h,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(s-1))break;--s,a.set(c,s),o.push(c)}}return{index:s,matched:a,matches:o.reverse()}}function gD(t,e){return t.type.side-e.type.side}function xD(t,e,n,r){let s=e.locals(t),a=0;if(s.length==0){for(let h=0;ha;)c.push(s[o++]);let v=a+g.nodeSize;if(g.isText){let w=v;o!w.inline):c.slice();r(g,j,e.forChild(a,g),y),a=v}}function yD(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function vD(t,e,n,r){for(let s=0,a=0;s=n){if(a>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let h=c=0&&h+e.length+c>=n)return c+h;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function zg(t,e,n,r,s){let a=[];for(let o=0,c=0;o=n||f<=e?a.push(u):(hn&&a.push(u.slice(n-h,u.size,r)))}return a}function Zx(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),a=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(af(n)){for(u=o;s&&!s.node;)s=s.parent;let m=s.node;if(s&&m.isAtom&&Ve.isSelectable(m)&&s.parent&&!(m.isInline&&KO(n.focusNode,n.focusOffset,s.dom))){let g=s.posBefore;h=new Ve(o==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let y=0;y{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!AS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function wD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,An(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ur&&Ji<=11&&(n.disabled=!0,n.disabled=!1)}function RS(t,e){if(e instanceof Ve){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(P1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else P1(t)}function P1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function e0(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||He.between(e,n,r)}function O1(t){return t.editable&&!t.hasFocus()?!1:IS(t)}function IS(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function ND(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ka(e.node,e.offset,n.anchorNode,n.anchorOffset)}function $g(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),a=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return a&&Ge.findFrom(a,e)}function Pi(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function D1(t,e,n){let r=t.state.selection;if(r instanceof He)if(n.indexOf("s")>-1){let{$head:s}=r,a=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+a.nodeSize*(e<0?-1:1));return Pi(t,new He(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=$g(t.state,e);return s&&s instanceof Ve?Pi(t,s):!1}else if(!(Lr&&n.indexOf("m")>-1)){let s=r.$head,a=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!a||a.isText)return!1;let c=e<0?s.pos-a.nodeSize:s.pos;return a.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?Ve.isSelectable(a)?Pi(t,new Ve(e<0?t.state.doc.resolve(s.pos-a.nodeSize):s)):Kc?Pi(t,new He(t.state.doc.resolve(e<0?c:c+a.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ve&&r.node.isInline)return Pi(t,new He(e>0?r.$to:r.$from));{let s=$g(t.state,e);return s?Pi(t,s):!1}}}function nh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function pc(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Do(t,e){return e<0?jD(t):kD(t)}function jD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,a,o=!1;for($r&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(pc(c,-1))s=n,a=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(PS(n))break;{let c=n.previousSibling;for(;c&&pc(c,-1);)s=n.parentNode,a=An(c),c=c.previousSibling;if(c)n=c,r=nh(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Fg(t,n,r):s&&Fg(t,s,a)}function kD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=nh(n),a,o;for(;;)if(r{t.state==s&&Qs(t)},50)}function L1(t,e){let n=t.state.doc.resolve(e);if(!(In||yS)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let a=t.coordsAtPos(e-1),o=(a.top+a.bottom)/2;if(o>s.top&&o1)return a.lefts.top&&o1)return a.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function _1(t,e,n){let r=t.state.selection;if(r instanceof He&&!r.empty||n.indexOf("s")>-1||Lr&&n.indexOf("m")>-1)return!1;let{$from:s,$to:a}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=$g(t.state,e);if(o&&o instanceof Ve)return Pi(t,o)}if(!s.parent.inlineContent){let o=e<0?s:a,c=r instanceof kr?Ge.near(o,e):Ge.findFrom(o,e);return c?Pi(t,c):!1}return!1}function z1(t,e){if(!(t.state.selection instanceof He))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let o=t.state.tr;return e<0?o.delete(n.pos-a.nodeSize,n.pos):o.delete(n.pos,n.pos+a.nodeSize),t.dispatch(o),!0}return!1}function $1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function ED(t){if(!Hn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;$1(t,r,"true"),setTimeout(()=>$1(t,r,"false"),20)}return!1}function TD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function MD(t,e){let n=e.keyCode,r=TD(e);if(n==8||Lr&&n==72&&r=="c")return z1(t,-1)||Do(t,-1);if(n==46&&!e.shiftKey||Lr&&n==68&&r=="c")return z1(t,1)||Do(t,1);if(n==13||n==27)return!0;if(n==37||Lr&&n==66&&r=="c"){let s=n==37?L1(t,t.state.selection.from)=="ltr"?-1:1:-1;return D1(t,s,r)||Do(t,s)}else if(n==39||Lr&&n==70&&r=="c"){let s=n==39?L1(t,t.state.selection.from)=="ltr"?1:-1:1;return D1(t,s,r)||Do(t,s)}else{if(n==38||Lr&&n==80&&r=="c")return _1(t,-1,r)||Do(t,-1);if(n==40||Lr&&n==78&&r=="c")return ED(t)||_1(t,1,r)||Do(t,1);if(r==(Lr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function t0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:s,openEnd:a}=e;for(;s>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,a--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let o=t.someProp("clipboardSerializer")||eo.fromSchema(t.state.schema),c=$S(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=zS[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let v=c.createElement(f[y]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${s} ${a}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,` + +`);return{dom:u,text:g,slice:e}}function OS(t,e,n,r,s){let a=s.parent.type.spec.code,o,c;if(!n&&!e)return null;let u=!!e&&(r||a||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,a||r,t)}),a)return c=new Me(pe.from(t.state.schema.text(e.replace(/\r\n?/g,` +`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,s,r,t));if(m)c=m;else{let g=s.marks(),{schema:y}=t.state,v=eo.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(j=>{let w=o.appendChild(document.createElement("p"));j&&w.appendChild(v.serializeNode(y.text(j,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=PD(n),Kc&&OD(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||Gi.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:s,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!AD.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=DD(F1(c,+f[1],+f[2]),f[4]);else if(c=Me.maxOpen(RD(c.content,s),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const AD=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function RD(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),a,o=[];if(t.forEach(c=>{if(!o)return;let u=s.findWrapping(c.type),h;if(!u)return o=null;if(h=o.length&&a.length&&LS(u,a,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=_S(o[o.length-1],a.length));let f=DS(c,u);o.push(f),s=s.matchType(f.type),a=u}}),o)return pe.from(o)}return t}function DS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,pe.from(t));return t}function LS(t,e,n,r,s){if(s1&&(a=0),s=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,a<=s).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(pe.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function F1(t,e,n){return en})),zm.createHTML(t)):t}function PD(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=$S().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&zS[r[1].toLowerCase()])&&(t=s.map(a=>"<"+a+">").join("")+t+s.map(a=>"").reverse().join("")),n.innerHTML=ID(t),s)for(let a=0;a=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;s=pe.from(u.create(r[c+1],s)),a++,o++}return new Me(s,a,o)}const tr={},nr={},LD={touchstart:!0,touchmove:!0};class _D{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function zD(t){for(let e in tr){let n=tr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{FD(t,r)&&!n0(t,r)&&(t.editable||!(r.type in nr))&&n(t,r)},LD[e]?{passive:!0}:void 0)}Hn&&t.dom.addEventListener("input",()=>null),Vg(t)}function Wi(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function $D(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Vg(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>n0(t,r))})}function n0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function FD(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function BD(t,e){!n0(t,e)&&tr[e.type]&&(t.editable||!(e.type in nr))&&tr[e.type](t,e)}nr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!BS(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Gs&&In&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),tl&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,Aa(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||MD(t,n)?n.preventDefault():Wi(t,"key")};nr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};nr.keypress=(t,e)=>{let n=e;if(BS(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Lr&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof He)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),a=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,a))&&t.dispatch(a()),n.preventDefault()}};function lf(t){return{left:t.clientX,top:t.clientY}}function VD(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function r0(t,e,n,r,s){if(r==-1)return!1;let a=t.state.doc.resolve(r);for(let o=a.depth+1;o>0;o--)if(t.someProp(e,c=>o>a.depth?c(t,n,a.nodeAfter,a.before(o),s,!0):c(t,n,a.node(o),a.before(o),s,!1)))return!0;return!1}function qo(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function HD(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ve.isSelectable(r)?(qo(t,new Ve(n)),!0):!1}function WD(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof Ve&&(r=n.node);let a=t.state.doc.resolve(e);for(let o=a.depth+1;o>0;o--){let c=o>a.depth?a.nodeAfter:a.node(o);if(Ve.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?s=a.before(n.$from.depth):s=a.before(o);break}}return s!=null?(qo(t,Ve.create(t.state.doc,s)),!0):!1}function UD(t,e,n,r,s){return r0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",a=>a(t,e,r))||(s?WD(t,n):HD(t,n))}function KD(t,e,n,r){return r0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function qD(t,e,n,r){return r0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||GD(t,n,r)}function GD(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(qo(t,He.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let a=s.depth+1;a>0;a--){let o=a>s.depth?s.nodeAfter:s.node(a),c=s.before(a);if(o.inlineContent)qo(t,He.create(r,c+1,c+1+o.content.size));else if(Ve.isSelectable(o))qo(t,Ve.create(r,c));else continue;return!0}}function s0(t){return rh(t)}const FS=Lr?"metaKey":"ctrlKey";tr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=s0(t),s=Date.now(),a="singleClick";s-t.input.lastClick.time<500&&VD(n,t.input.lastClick)&&!n[FS]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=t.posAtCoords(lf(n));o&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new JD(t,o,n,!!r)):(a=="doubleClick"?KD:qD)(t,o.pos,o.inside,n)?n.preventDefault():Wi(t,"pointer"))};class JD{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[FS],this.allowDefault=r.shiftKey;let a,o;if(n.inside>-1)a=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);a=f.parent,o=f.depth?f.before():0}const c=s?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&a.type.spec.draggable&&a.type.spec.selectable!==!1||h instanceof Ve&&h.from<=o&&h.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&$r&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wi(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Qs(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(lf(e))),this.updateAllowDefault(e),this.allowDefault||!n?Wi(this.view,"pointer"):UD(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Hn&&this.mightDrag&&!this.mightDrag.node.isAtom||In&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(qo(this.view,Ge.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Wi(this.view,"pointer")}move(e){this.updateAllowDefault(e),Wi(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}tr.touchstart=t=>{t.input.lastTouch=Date.now(),s0(t),Wi(t,"pointer")};tr.touchmove=t=>{t.input.lastTouch=Date.now(),Wi(t,"pointer")};tr.contextmenu=t=>s0(t);function BS(t,e){return t.composing?!0:Hn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const YD=Gs?5e3:-1;nr.compositionstart=nr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof He&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||In&&yS&&QD(t)))t.markCursor=t.state.storedMarks||n.marks(),rh(t,!0),t.markCursor=null;else if(rh(t,!e.selection.empty),$r&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,a=r.focusOffset;s&&s.nodeType==1&&a!=0;){let o=a<0?s.lastChild:s.childNodes[a-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else s=o,a=-1}}t.input.composing=!0}VS(t,YD)};function QD(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}nr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,VS(t,20))};function VS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>rh(t),e))}function HS(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=ZD());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function XD(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=WO(e.focusNode,e.focusOffset),r=UO(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,a=t.domObserver.lastChangedTextNode;if(n==a||r==a)return a;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function ZD(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function rh(t,e=!1){if(!(Gs&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),HS(t),e||t.docView&&t.docView.dirty){let n=Zx(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function eL(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Rc=ur&&Ji<15||tl&&JO<604;tr.copy=nr.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let a=Rc?null:n.clipboardData,o=r.content(),{dom:c,text:u}=t0(t,o);a?(n.preventDefault(),a.clearData(),a.setData("text/html",c.innerHTML),a.setData("text/plain",u)):eL(t,c),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function tL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function nL(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ic(t,r.value,null,s,e):Ic(t,r.textContent,r.innerHTML,s,e)},50)}function Ic(t,e,n,r,s){let a=OS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,s,a||Me.empty)))return!0;if(!a)return!1;let o=tL(a),c=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(a);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function WS(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}nr.paste=(t,e)=>{let n=e;if(t.composing&&!Gs)return;let r=Rc?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Ic(t,WS(r),r.getData("text/html"),s,n)?n.preventDefault():nL(t,n)};class US{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const rL=Lr?"altKey":"ctrlKey";function KS(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[rL]}tr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,a=s.empty?null:t.posAtCoords(lf(n)),o;if(!(a&&a.pos>=s.from&&a.pos<=(s instanceof Ve?s.to-1:s.to))){if(r&&r.mightDrag)o=Ve.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=Ve.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=t0(t,c);(!n.dataTransfer.files.length||!In||xS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Rc?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Rc||n.dataTransfer.setData("text/plain",h),t.dragging=new US(f,KS(t,n),o)};tr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};nr.dragover=nr.dragenter=(t,e)=>e.preventDefault();nr.drop=(t,e)=>{try{sL(t,e,t.dragging)}finally{t.dragging=null}};function sL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(lf(e));if(!r)return;let s=t.state.doc.resolve(r.pos),a=n&&n.slice;a?t.someProp("transformPasted",y=>{a=y(a,t,!1)}):a=OS(t,WS(e.dataTransfer),Rc?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&KS(t,e));if(t.someProp("handleDrop",y=>y(t,e,a||Me.empty,o))){e.preventDefault();return}if(!a)return;e.preventDefault();let c=a?Yk(t.state.doc,s.pos,a):s.pos;c==null&&(c=s.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,a.content.firstChild):u.replaceRange(h,h,a),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&Ve.isSelectable(a.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(a.content.firstChild))u.setSelection(new Ve(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,j,w,k)=>y=k),u.setSelection(e0(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}tr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Qs(t)},20))};tr.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};tr.beforeinput=(t,e)=>{if(In&&Gs&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",a=>a(t,Aa(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in nr)tr[t]=nr[t];function Pc(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class sh{constructor(e,n){this.toDOM=e,this.spec=n||$a,this.side=this.spec.side||0}map(e,n,r,s){let{pos:a,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new hn(a-r,a-r,this)}valid(){return!0}eq(e){return this==e||e instanceof sh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Pc(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Qi{constructor(e,n){this.attrs=e,this.spec=n||$a}map(e,n,r,s){let a=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return a>=o?null:new hn(a,o,this)}valid(e,n){return n.from=e&&(!a||a(c.spec))&&r.push(c.copy(c.from+s,c.to+s))}for(let o=0;oe){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,s+c,a)}}map(e,n,r){return this==Bn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||$a)}mapInner(e,n,r,s,a){let o;for(let c=0;c{let h=u+r,f;if(f=GS(n,c,h)){for(s||(s=this.children.slice());ac&&m.to=e){this.children[c]==e&&(r=this.children[c+2]);break}let a=e+1,o=a+n.content.size;for(let c=0;ca&&u.type instanceof Qi){let h=Math.max(a,u.from)-a,f=Math.min(o,u.to)-a;hs.map(e,n,$a));return Li.from(r)}forChild(e,n){if(n.isLeaf)return Nt.empty;let r=[];for(let s=0;sn instanceof Nt)?e:e.reduce((n,r)=>n.concat(r instanceof Nt?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let w=j-v-(y-g);for(let k=0;kE+f-m)continue;let C=c[k]+f-m;y>=C?c[k+1]=g<=C?-2:-1:g>=f&&w&&(c[k]+=w,c[k+1]+=w)}m+=w}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let g=n.map(t[h+1]+a,-1),y=g-s,{index:v,offset:j}=r.content.findIndex(m),w=r.maybeChild(v);if(w&&j==m&&j+w.nodeSize==y){let k=c[h+2].mapInner(n,w,f+1,t[h]+a+1,o);k!=Bn?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=aL(c,t,e,n,s,a,o),f=ih(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=GS(t,c,u+n);if(h){a=!0;let f=ih(h,c,n+u+1,r);f!=Bn&&s.push(u,u+c.nodeSize,f)}});let o=qS(a?JS(t):t,-n).sort(Fa);for(let c=0;c0;)e++;t.splice(e,0,n)}function $m(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Bn&&e.push(r)}),t.cursorWrapper&&e.push(Nt.create(t.state.doc,[t.cursorWrapper.deco])),Li.from(e)}const oL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lL=ur&&Ji<=11;class cL{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class dL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new cL,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;ss.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Hn&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),lL&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,oL)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(O1(this.view)){if(this.suppressingSelectionUpdates)return Qs(this.view);if(ur&&Ji<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ka(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let a=e.focusNode;a;a=el(a))n.add(a);for(let a=e.anchorNode;a;a=el(a))if(n.has(a)){r=a;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&O1(e)&&!this.ignoreSelectionChange(r),a=-1,o=-1,c=!1,u=[];if(e.editable)for(let f=0;ff.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let m=f.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&f.parentNode.removeChild(f)}}else if($r&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||fL(e,m)!=y)&&g.remove()}}}let h=null;a<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||s)&&(a>-1&&(e.docView.markDirty(a,o),uL(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,pL(e,u)),this.handleDOMChange(a,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Qs(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fs;w--){let k=r.childNodes[w-1],E=k.pmViewDesc;if(k.nodeName=="BR"&&!E){a=w;break}if(!E||E.size)break}let m=t.state.doc,g=t.someProp("domParser")||Gi.fromSchema(t.state.schema),y=m.resolve(o),v=null,j=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:s,to:a,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:gL,context:y});if(h&&h[0].pos!=null){let w=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=w),v={anchor:w+o,head:k+o}}return{doc:j,sel:v,from:o,to:c}}function gL(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Hn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Hn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const xL=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function yL(t,e,n,r,s){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let R=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,I=Zx(t,R);if(I&&!t.state.selection.eq(I)){if(In&&Gs&&t.input.lastKeyCode===13&&Date.now()-100O(t,Aa(13,"Enter"))))return;let A=t.state.tr.setSelection(I);R=="pointer"?A.setMeta("pointer",!0):R=="key"&&A.scrollIntoView(),a&&A.setMeta("composition",a),t.dispatch(A)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=mL(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,y;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Gs)&&s.some(R=>R.nodeType==1&&!xL.test(R.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",R=>R(t,Aa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof He&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let R=K1(t,t.state.doc,h.sel);if(R&&!R.eq(t.state.selection)){let I=t.state.tr.setSelection(R);a&&I.setMeta("composition",a),t.dispatch(I)}}return}t.state.selection.fromt.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?v.start=t.state.selection.from:v.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),ur&&Ji<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>h.from&&h.doc.textBetween(v.start-h.from-1,v.start-h.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let j=h.doc.resolveNoCache(v.start-h.from),w=h.doc.resolveNoCache(v.endB-h.from),k=f.resolve(v.start),E=j.sameParent(w)&&j.parent.inlineContent&&k.end()>=v.endA;if((tl&&t.input.lastIOSEnter>Date.now()-225&&(!E||s.some(R=>R.nodeName=="DIV"||R.nodeName=="P"))||!E&&j.posR(t,Aa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&bL(f,v.start,v.endA,j,w)&&t.someProp("handleKeyDown",R=>R(t,Aa(8,"Backspace")))){Gs&&In&&t.domObserver.suppressSelectionUpdates();return}In&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),Gs&&!E&&j.start()!=w.start()&&w.parentOffset==0&&j.depth==w.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==v.endA&&(v.endB-=2,w=h.doc.resolveNoCache(v.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(R){return R(t,Aa(13,"Enter"))})},20));let C=v.start,M=v.endA,D=R=>{let I=R||t.state.tr.replace(C,M,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let A=K1(t,I.doc,h.sel);A&&!(In&&t.composing&&A.empty&&(v.start!=v.endB||t.input.lastChromeDeleteQs(t),20));let R=D(t.state.tr.delete(C,M)),I=f.resolve(v.start).marksAcross(f.resolve(v.endA));I&&R.ensureMarks(I),t.dispatch(R)}else if(v.endA==v.endB&&(F=vL(j.parent.content.cut(j.parentOffset,w.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start())))){let R=D(t.state.tr);F.type=="add"?R.addMark(C,M,F.mark):R.removeMark(C,M,F.mark),t.dispatch(R)}else if(j.parent.child(j.index()).isText&&j.index()==w.index()-(w.textOffset?0:1)){let R=j.parent.textBetween(j.parentOffset,w.parentOffset),I=()=>D(t.state.tr.insertText(R,C,M));t.someProp("handleTextInput",A=>A(t,C,M,R,I))||t.dispatch(I())}else t.dispatch(D());else t.dispatch(D())}function K1(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:e0(t,e.resolve(n.anchor),e.resolve(n.head))}function vL(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,a=r,o,c,u;for(let f=0;ff.mark(c.addToSet(f.marks));else if(s.length==0&&a.length==1)c=a[0],o="remove",u=f=>f.mark(c.removeFromSet(f.marks));else return null;let h=[];for(let f=0;fn||Fm(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let a=t.node(r).maybeChild(t.indexAfter(r));for(;a&&!a.isLeaf;)a=a.firstChild,s++}return s}function wL(t,e,n,r,s){let a=t.findDiffStart(e,n);if(a==null)return null;let{a:o,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let u=Math.max(0,a-Math.min(o,c));r-=o+u-a}if(o=o?a-r:0;a-=u,a&&a=c?a-r:0;a-=u,a&&a=56320&&e<=57343&&n>=55296&&n<=56319}class YS{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new _D,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(X1),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Y1(this),J1(this),this.nodeViews=Q1(this),this.docView=T1(this.state.doc,G1(this),$m(this),this.dom,this),this.domObserver=new dL(this,(r,s,a,o)=>yL(this,r,s,a,o)),this.domObserver.start(),zD(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Vg(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(X1),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,a=!1,o=!1;e.storedMarks&&this.composing&&(HS(this),o=!0),this.state=e;let c=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=Q1(this);jL(y,this.nodeViews)&&(this.nodeViews=y,a=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Vg(this),this.editable=Y1(this),J1(this);let u=$m(this),h=G1(this),f=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",m=a||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(s.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&XO(this);if(o){this.domObserver.stop();let y=m&&(ur||In)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&NL(s.selection,e.selection);if(m){let v=In?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=XD(this)),(a||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=T1(e.doc,h,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&ND(this))?Qs(this,y):(RS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&ZO(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ve){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&N1(this,n.getBoundingClientRect(),e)}else N1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(a))==r.node&&(s=a)}this.dragging=new US(e.slice,e.move,s<0?void 0:Ve.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return iD(this,e)}coordsAtPos(e,n=1){return jS(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return dD(this,n||this.state,e)}pasteHTML(e,n){return Ic(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ic(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return t0(this,e)}destroy(){this.docView&&($D(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],$m(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,VO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return BD(this,e)}domSelectionRange(){let e=this.domSelection();return e?Hn&&this.root.nodeType===11&&qO(this.dom.ownerDocument)==this.dom&&hL(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}YS.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function G1(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[hn.node(0,t.state.doc.content.size,e)]}function J1(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:hn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Y1(t){return!t.someProp("editable",e=>e(t.state)===!1)}function NL(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Q1(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function jL(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function X1(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Zi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ah={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},kL=typeof navigator<"u"&&/Mac/.test(navigator.platform),SL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Rn=0;Rn<10;Rn++)Zi[48+Rn]=Zi[96+Rn]=String(Rn);for(var Rn=1;Rn<=24;Rn++)Zi[Rn+111]="F"+Rn;for(var Rn=65;Rn<=90;Rn++)Zi[Rn]=String.fromCharCode(Rn+32),ah[Rn]=String.fromCharCode(Rn);for(var Bm in Zi)ah.hasOwnProperty(Bm)||(ah[Bm]=Zi[Bm]);function CL(t){var e=kL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||SL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ah:Zi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const EL=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),TL=typeof navigator<"u"&&/Win/.test(navigator.platform);function ML(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,a,o;for(let c=0;c{for(var n in e)IL(t,n,{get:e[n],enumerable:!0})};function cf(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:a}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return a},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,a=n.storedMarks,n}}}var df=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,a=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(a);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:a}=r,o=[],c=!!t,u=t||s.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...v)=>{const j=this.buildProps(u,e),w=g(...v)(j);return o.push(w),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,a=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...a,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:a}=r,o={tr:t,editor:r,view:a,state:cf({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...h)=>u(...h)(o)]))}};return o}},QS={};l0(QS,{blur:()=>PL,clearContent:()=>OL,clearNodes:()=>DL,command:()=>LL,createParagraphNear:()=>_L,cut:()=>zL,deleteCurrentNode:()=>$L,deleteNode:()=>FL,deleteRange:()=>BL,deleteSelection:()=>VL,enter:()=>HL,exitCode:()=>WL,extendMarkRange:()=>UL,first:()=>KL,focus:()=>GL,forEach:()=>JL,insertContent:()=>YL,insertContentAt:()=>ZL,joinBackward:()=>n8,joinDown:()=>t8,joinForward:()=>r8,joinItemBackward:()=>s8,joinItemForward:()=>i8,joinTextblockBackward:()=>a8,joinTextblockForward:()=>o8,joinUp:()=>e8,keyboardShortcut:()=>c8,lift:()=>d8,liftEmptyBlock:()=>u8,liftListItem:()=>h8,newlineInCode:()=>f8,resetAttributes:()=>p8,scrollIntoView:()=>m8,selectAll:()=>g8,selectNodeBackward:()=>x8,selectNodeForward:()=>y8,selectParentNode:()=>v8,selectTextblockEnd:()=>b8,selectTextblockStart:()=>w8,setContent:()=>N8,setMark:()=>V8,setMeta:()=>H8,setNode:()=>W8,setNodeSelection:()=>U8,setTextDirection:()=>K8,setTextSelection:()=>q8,sinkListItem:()=>G8,splitBlock:()=>J8,splitListItem:()=>Y8,toggleList:()=>Q8,toggleMark:()=>X8,toggleNode:()=>Z8,toggleWrap:()=>e6,undoInputRule:()=>t6,unsetAllMarks:()=>n6,unsetMark:()=>r6,unsetTextDirection:()=>s6,updateAttributes:()=>i6,wrapIn:()=>a6,wrapInList:()=>o6});var PL=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),OL=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),DL=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:a,$to:o})=>{t.doc.nodesBetween(a.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const v=fl(y);if(c.type.isTextblock){const{defaultType:j}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,j)}(v||v===0)&&e.lift(y,v)})}),!0},LL=t=>e=>t(e),_L=()=>({state:t,dispatch:e})=>hS(t,e),zL=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,a=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,a.content),r.setSelection(new He(r.doc.resolve(Math.max(o-1,0)))),!0},$L=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let a=s.depth;a>0;a-=1)if(s.node(a).type===r.type){if(e){const c=s.before(a),u=s.after(a);t.delete(c,u).scrollIntoView()}return!0}return!1};function ln(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var FL=t=>({tr:e,state:n,dispatch:r})=>{const s=ln(t,n.schema),a=e.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===s){if(r){const u=a.before(o),h=a.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},BL=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},VL=()=>({state:t,dispatch:e})=>qx(t,e),HL=()=>({commands:t})=>t.keyboardShortcut("Enter"),WL=()=>({state:t,dispatch:e})=>EO(t,e);function c0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function oh(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:c0(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function XS(t,e,n={}){return t.find(r=>r.type===e&&oh(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function Z1(t,e,n={}){return!!XS(t,e,n)}function d0(t,e,n){var r;if(!t||!e)return;let s=t.parent.childAfter(t.parentOffset);if((!s.node||!s.node.marks.some(f=>f.type===e))&&(s=t.parent.childBefore(t.parentOffset)),!s.node||!s.node.marks.some(f=>f.type===e)||(n=n||((r=s.node.marks[0])==null?void 0:r.attrs),!XS([...s.node.marks],e,n)))return;let o=s.index,c=t.start()+s.offset,u=o+1,h=c+s.node.nodeSize;for(;o>0&&Z1([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:r,dispatch:s})=>{const a=ni(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(s){const m=d0(u,a,e);if(m&&m.from<=h&&m.to>=f){const g=He.create(o,m.from,m.to);n.setSelection(g)}}return!0},KL=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:s,dispatch:a})=>{e={scrollIntoView:!0,...e};const o=()=>{(lh()||ew())&&r.dom.focus(),qL()&&!lh()&&!ew()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(a&&t===null&&!ZS(n.state.selection))return o(),!0;const c=eC(s.doc,t)||n.state.selection,u=n.state.selection.eq(c);return a&&(u||s.setSelection(c),u&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},JL=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),YL=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),tC=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&tC(r)}return t};function yu(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return tC(n)}function Oc(t,e,n){if(t instanceof Js||t instanceof pe)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return pe.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(a){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",a),Oc("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,c="";const u=new $k({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(o=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(n.slice?Gi.fromSchema(u).parseSlice(yu(t),n.parseOptions):Gi.fromSchema(u).parse(yu(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const a=Gi.fromSchema(e);return n.slice?a.parseSlice(yu(t),n.parseOptions).content:a.parse(yu(t),n.parseOptions)}return Oc("",e,n)}function QL(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(Ge.near(t.doc.resolve(o),n))}var XL=t=>!("type"in t),ZL=(t,e,n)=>({tr:r,dispatch:s,editor:a})=>{var o;if(s){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=w=>{a.emit("contentError",{editor:a,error:w,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{Oc(e,a.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(w){u(w)}try{c=Oc(e,a.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:a.options.enableContentCheck})}catch(w){return u(w),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((XL(c)?c:[c]).forEach(w=>{w.check(),g=g?w.isText&&w.marks.length===0:!1,y=y?w.isBlock:!1}),f===m&&y){const{parent:w}=r.doc.resolve(f);w.isTextblock&&!w.type.spec.code&&!w.childCount&&(f-=1,m+=1)}let j;if(g){if(Array.isArray(e))j=e.map(w=>w.text||"").join("");else if(e instanceof pe){let w="";e.forEach(k=>{k.text&&(w+=k.text)}),j=w}else typeof e=="object"&&e&&e.text?j=e.text:j=e;r.insertText(j,f,m)}else{j=c;const w=r.doc.resolve(f),k=w.node(),E=w.parentOffset===0,C=k.isText||k.isTextblock,M=k.content.size>0;E&&C&&M&&(f=Math.max(0,f-1)),r.replaceWith(f,m,j)}n.updateSelection&&QL(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:j}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:j})}return!0},e8=()=>({state:t,dispatch:e})=>kO(t,e),t8=()=>({state:t,dispatch:e})=>SO(t,e),n8=()=>({state:t,dispatch:e})=>iS(t,e),r8=()=>({state:t,dispatch:e})=>cS(t,e),s8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=nf(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},i8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=nf(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},a8=()=>({state:t,dispatch:e})=>NO(t,e),o8=()=>({state:t,dispatch:e})=>jO(t,e);function nC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function l8(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,a,o;for(let c=0;c({editor:e,view:n,tr:r,dispatch:s})=>{const a=l8(t).split(/-(?!$)/),o=a.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",h=>h(n,c))});return u==null||u.steps.forEach(h=>{const f=h.map(r.mapping);f&&s&&r.maybeStep(f)}),!0};function ea(t,e,n={}){const{from:r,to:s,empty:a}=t.selection,o=e?ln(e,t.schema):null,c=[];t.doc.nodesBetween(r,s,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),v=Math.min(s,g+m.nodeSize);c.push({node:m,from:y,to:v})});const u=s-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>oh(m.node.attrs,n,{strict:!1}));return a?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var d8=(t,e={})=>({state:n,dispatch:r})=>{const s=ln(t,n.schema);return ea(n,s,e)?CO(n,r):!1},u8=()=>({state:t,dispatch:e})=>fS(t,e),h8=t=>({state:e,dispatch:n})=>{const r=ln(t,e.schema);return zO(r)(e,n)},f8=()=>({state:t,dispatch:e})=>uS(t,e);function uf(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function tw(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var p8=(t,e)=>({tr:n,state:r,dispatch:s})=>{let a=null,o=null;const c=uf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(a=ln(t,r.schema)),c==="mark"&&(o=ni(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{r.doc.nodesBetween(h.$from.pos,h.$to.pos,(f,m)=>{a&&a===f.type&&(u=!0,s&&n.setNodeMarkup(m,void 0,tw(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,s&&n.addMark(m,m+f.nodeSize,o.create(tw(g.attrs,e))))})})}),u},m8=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),g8=()=>({tr:t,dispatch:e})=>{if(e){const n=new kr(t.doc);t.setSelection(n)}return!0},x8=()=>({state:t,dispatch:e})=>oS(t,e),y8=()=>({state:t,dispatch:e})=>dS(t,e),v8=()=>({state:t,dispatch:e})=>AO(t,e),b8=()=>({state:t,dispatch:e})=>PO(t,e),w8=()=>({state:t,dispatch:e})=>IO(t,e);function Hg(t,e,n={},r={}){return Oc(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var N8=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:a,dispatch:o,commands:c})=>{const{doc:u}=a;if(r.preserveWhitespace!=="full"){const h=Hg(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&a.replaceWith(0,u.content.size,h).setMeta("preventUpdate",!n),!0}return o&&a.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function rC(t,e){const n=ni(e,t.schema),{from:r,to:s,empty:a}=t.selection,o=[];a?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function sC(t,e){const n=new Ux(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function j8(t){for(let e=0;e{n(s)&&r.push({node:s,pos:a})}),r}function iC(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function hf(t){return e=>iC(e.$from,t)}function $e(t,e,n){return t.config[e]===void 0&&t.parent?$e(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?$e(t.parent,e,n):null}):t.config[e]}function u0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=$e(e,"addExtensions",n);return r?[e,...u0(r())]:e}).flat(10)}function h0(t,e){const n=eo.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function aC(t){return typeof t=="function"}function mt(t,e=void 0,...n){return aC(t)?e?t.bind(e)(...n):t(...n):t}function S8(t={}){return Object.keys(t).length===0&&t.constructor===Object}function nl(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function oC(t){const e=[],{nodeExtensions:n,markExtensions:r}=nl(t),s=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(h=>h.name!=="text").map(h=>h.name),c=r.map(h=>h.name),u=[...o,...c];return t.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage,extensions:s},m=$e(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let v;Array.isArray(y.types)?v=y.types:y.types==="*"?v=u:y.types==="nodes"?v=o:y.types==="marks"?v=c:v=[],v.forEach(j=>{Object.entries(y.attributes).forEach(([w,k])=>{e.push({type:j,name:w,attribute:{...a,...k}})})})})}),s.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=$e(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([y,v])=>{const j={...a,...v};typeof(j==null?void 0:j.default)=="function"&&(j.default=j.default()),j!=null&&j.isRequired&&(j==null?void 0:j.default)===void 0&&delete j.default,e.push({type:h.name,name:y,attribute:j})})}),e}function C8(t){const e=[];let n="",r=!1,s=!1,a=0;const o=t.length;for(let c=0;c0){a-=1,n+=u;continue}if(u===";"&&a===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function nw(t){const e=[],n=C8(t||""),r=n.length;for(let s=0;s!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,a])=>{if(!r[s]){r[s]=a;return}if(s==="class"){const c=a?String(a).split(" "):[],u=r[s]?r[s].split(" "):[],h=c.filter(f=>!u.includes(f));r[s]=[...u,...h].join(" ")}else if(s==="style"){const c=new Map([...nw(r[s]),...nw(a)]);r[s]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[s]=a}),r},{})}function Dc(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>bt(n,r),{})}function E8(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function rw(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((a,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):E8(n.getAttribute(o.name));return c==null?a:{...a,[o.name]:c}},{});return{...r,...s}}}}function sw(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&S8(n)?!1:n!=null))}function iw(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function T8(t,e){var n;const r=oC(t),{nodeExtensions:s,markExtensions:a}=nl(t),o=(n=s.find(h=>$e(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(s.map(h=>{const f=r.filter(k=>k.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((k,E)=>{const C=$e(E,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),y=sw({...g,content:mt($e(h,"content",m)),marks:mt($e(h,"marks",m)),group:mt($e(h,"group",m)),inline:mt($e(h,"inline",m)),atom:mt($e(h,"atom",m)),selectable:mt($e(h,"selectable",m)),draggable:mt($e(h,"draggable",m)),code:mt($e(h,"code",m)),whitespace:mt($e(h,"whitespace",m)),linebreakReplacement:mt($e(h,"linebreakReplacement",m)),defining:mt($e(h,"defining",m)),isolating:mt($e(h,"isolating",m)),attrs:Object.fromEntries(f.map(iw))}),v=mt($e(h,"parseHTML",m));v&&(y.parseDOM=v.map(k=>rw(k,f)));const j=$e(h,"renderHTML",m);j&&(y.toDOM=k=>j({node:k,HTMLAttributes:Dc(k,f)}));const w=$e(h,"renderText",m);return w&&(y.toText=w),[h.name,y]})),u=Object.fromEntries(a.map(h=>{const f=r.filter(w=>w.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((w,k)=>{const E=$e(k,"extendMarkSchema",m);return{...w,...E?E(h):{}}},{}),y=sw({...g,inclusive:mt($e(h,"inclusive",m)),excludes:mt($e(h,"excludes",m)),group:mt($e(h,"group",m)),spanning:mt($e(h,"spanning",m)),code:mt($e(h,"code",m)),attrs:Object.fromEntries(f.map(iw))}),v=mt($e(h,"parseHTML",m));v&&(y.parseDOM=v.map(w=>rw(w,f)));const j=$e(h,"renderHTML",m);return j&&(y.toDOM=w=>j({mark:w,HTMLAttributes:Dc(w,f)})),[h.name,y]}));return new $k({topNode:o,nodes:c,marks:u})}function M8(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function mc(t){return t.sort((n,r)=>{const s=$e(n,"priority")||100,a=$e(r,"priority")||100;return s>a?-1:sr.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function cC(t,e,n){const{from:r,to:s}=e,{blockSeparator:a=` + +`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,s,(u,h,f,m)=>{var g;u.isBlock&&h>r&&(c+=a);const y=o==null?void 0:o[u.type.name];if(y)return f&&(c+=y({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(r,h)-h,s-h))}),c}function A8(t,e){const n={from:0,to:t.content.size};return cC(t,n,e)}function dC(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function R8(t,e){const n=ln(e,t.schema),{from:r,to:s}=t.selection,a=[];t.doc.nodesBetween(r,s,c=>{a.push(c)});const o=a.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function uC(t,e){const n=uf(typeof e=="string"?e:e.name,t.schema);return n==="node"?R8(t,e):n==="mark"?rC(t,e):{}}function I8(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function P8(t){const e=I8(t);return e.length===1?e:e.filter((n,r)=>!e.filter((a,o)=>o!==r).some(a=>n.oldRange.from>=a.oldRange.from&&n.oldRange.to<=a.oldRange.to&&n.newRange.from>=a.newRange.from&&n.newRange.to<=a.newRange.to))}function hC(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,a)=>{const o=[];if(s.ranges.length)s.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[a];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const h=e.slice(a).map(c,-1),f=e.slice(a).map(u),m=e.invert().map(h,-1),g=e.invert().map(f);r.push({oldRange:{from:m,to:g},newRange:{from:h,to:f}})})}),P8(r)}function f0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const a=n.resolve(t),o=d0(a,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,a)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:a,to:a+s.nodeSize,mark:o})))}),r}var O8=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let a=r,o=null;for(;a>0&&o===null;){const c=s.node(a);(c==null?void 0:c.type.name)===e?o=c:a-=1}return[o,a]};function Xl(t,e){return e.nodes[t]||e.marks[t]||null}function _u(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(a=>a.type===e&&a.name===r);return s?s.attribute.keepOnSplit:!1}))}var D8=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,a,o,c)=>{var u,h;const f=((h=(u=s.type.spec).toText)==null?void 0:h.call(u,{node:s,pos:a,parent:o,index:c}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?f:f.slice(0,Math.max(0,r-a))}),n};function Wg(t,e,n={}){const{empty:r,ranges:s}=t.selection,a=e?ni(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>a?a.name===m.type.name:!0).find(m=>oh(m.attrs,n,{strict:!1}));let o=0;const c=[];if(s.forEach(({$from:m,$to:g})=>{const y=m.pos,v=g.pos;t.doc.nodesBetween(y,v,(j,w)=>{if(a&&j.inlineContent&&!j.type.allowsMarkType(a))return!1;if(!j.isText&&!j.marks.length)return;const k=Math.max(y,w),E=Math.min(v,w+j.nodeSize),C=E-k;o+=C,c.push(...j.marks.map(M=>({mark:M,from:k,to:E})))})}),o===0)return!1;const u=c.filter(m=>a?a.name===m.mark.type.name:!0).filter(m=>oh(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),h=c.filter(m=>a?m.mark.type!==a&&m.mark.type.excludes(a):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+h:u)>=o}function L8(t,e,n={}){if(!e)return ea(t,null,n)||Wg(t,null,n);const r=uf(e,t.schema);return r==="node"?ea(t,e,n):r==="mark"?Wg(t,e,n):!1}var _8=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const a=hf(c=>c.type.name===e)(t.selection);if(!a)return!1;const o=t.doc.resolve(a.pos+1);return s.pos+1===o.end()}return!(r.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function aw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function ow(t,e){const{nodeExtensions:n}=nl(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},a=mt($e(r,"group",s));return typeof a!="string"?!1:a.split(" ").includes("list")}function ff(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(a=>{s!==!1&&(ff(a,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function fC(t){return t instanceof Ve}var pC=class mC{constructor(e){this.position=e}static fromJSON(e){return new mC(e.position)}toJSON(){return{position:this.position}}};function $8(t,e){const n=e.mapping.mapResult(t.position);return{position:new pC(n.pos),mapResult:n}}function F8(t){return new pC(t)}function B8(t,e,n){var r;const{selection:s}=e;let a=null;if(ZS(s)&&(a=s.$cursor),a){const c=(r=t.storedMarks)!=null?r:a.marks();return a.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(h=>h.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:c,$to:u})=>{let h=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(f,m,g)=>{if(h)return!1;if(f.isInline){const y=!g||g.type.allowsMarkType(n),v=!!n.isInSet(f.marks)||!f.marks.some(j=>j.type.excludes(n));h=y&&v}return!h}),h})}var V8=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:a}=n,{empty:o,ranges:c}=a,u=ni(t,r.schema);if(s)if(o){const h=rC(r,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(f,m,(g,y)=>{const v=Math.max(y,f),j=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(v,j,u.create({...k.attrs,...e}))}):n.addMark(v,j,u.create(e))})});return B8(r,n,u)},H8=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),W8=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const a=ln(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?s().command(({commands:c})=>v1(a,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>v1(a,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},U8=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=Pa(t,0,r.content.size),a=Ve.create(r,s);e.setSelection(a)}return!0},K8=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:a}=r;let o,c;return typeof e=="number"?(o=e,c=e):e&&"from"in e&&"to"in e?(o=e.from,c=e.to):(o=a.from,c=a.to),s&&n.doc.nodesBetween(o,c,(u,h)=>{u.isText||n.setNodeMarkup(h,void 0,{...u.attrs,dir:t})}),!0},q8=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:a}=typeof t=="number"?{from:t,to:t}:t,o=He.atStart(r).from,c=He.atEnd(r).to,u=Pa(s,o,c),h=Pa(a,o,c),f=He.create(r,u,h);e.setSelection(f)}return!0},G8=t=>({state:e,dispatch:n})=>{const r=ln(t,e.schema);return BO(r)(e,n)};function lw(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var J8=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:a,doc:o}=e,{$from:c,$to:u}=a,h=s.extensionManager.attributes,f=_u(h,c.node().type.name,c.node().attrs);if(a instanceof Ve&&a.node.isBlock)return!c.parentOffset||!Ys(o,c.pos)?!1:(r&&(t&&lw(n,s.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:j8(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:f}]:void 0,v=Ys(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!v&&Ys(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(v=!0,y=g?[{type:g,attrs:f}]:void 0),r){if(v&&(a instanceof He&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const j=e.mapping.map(c.before()),w=e.doc.resolve(j);c.node(-1).canReplaceWith(w.index(),w.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&lw(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return v},Y8=(t,e={})=>({tr:n,state:r,dispatch:s,editor:a})=>{var o;const c=ln(t,r.schema),{$from:u,$to:h}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=a.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(s){let k=pe.empty;const E=u.index(-1)?1:u.index(-2)?2:3;for(let I=u.depth-E;I>=u.depth-3;I-=1)k=pe.from(u.node(I).copy(k));const C=u.indexAfter(-1){if(R>-1)return!1;I.isTextblock&&I.content.size===0&&(R=A+1)}),R>-1&&n.setSelection(He.near(n.doc.resolve(R))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={..._u(g,m.type.name,m.attrs),...e},j={..._u(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const w=y?[{type:c,attrs:v},{type:y,attrs:j}]:[{type:c,attrs:v}];if(!Ys(n.doc,u.pos,2))return!1;if(s){const{selection:k,storedMarks:E}=r,{splittableMarks:C}=a.extensionManager,M=E||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,w).scrollIntoView(),!M||!s)return!0;const D=M.filter(F=>C.includes(F.type.name));n.ensureMarks(D)}return!0},Hm=(t,e)=>{const n=hf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&oa(t.doc,n.pos)&&t.join(n.pos),!0},Wm=(t,e)=>{const n=hf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&oa(t.doc,r)&&t.join(r),!0},Q8=(t,e,n,r={})=>({editor:s,tr:a,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=s.extensionManager,y=ln(t,o.schema),v=ln(e,o.schema),{selection:j,storedMarks:w}=o,{$from:k,$to:E}=j,C=k.blockRange(E),M=w||j.$to.parentOffset&&j.$from.marks();if(!C)return!1;const D=hf(F=>ow(F.type.name,m))(j);if(C.depth>=1&&D&&C.depth-D.depth<=1){if(D.node.type===y)return h.liftListItem(v);if(ow(D.node.type.name,m)&&y.validContent(D.node.content)&&c)return u().command(()=>(a.setNodeMarkup(D.pos,y),!0)).command(()=>Hm(a,y)).command(()=>Wm(a,y)).run()}return!n||!M||!c?u().command(()=>f().wrapInList(y,r)?!0:h.clearNodes()).wrapInList(y,r).command(()=>Hm(a,y)).command(()=>Wm(a,y)).run():u().command(()=>{const F=f().wrapInList(y,r),R=M.filter(I=>g.includes(I.type.name));return a.ensureMarks(R),F?!0:h.clearNodes()}).wrapInList(y,r).command(()=>Hm(a,y)).command(()=>Wm(a,y)).run()},X8=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:a=!1}=n,o=ni(t,r.schema);return Wg(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:a}):s.setMark(o,e)},Z8=(t,e,n={})=>({state:r,commands:s})=>{const a=ln(t,r.schema),o=ln(e,r.schema),c=ea(r,a,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?s.setNode(o,u):s.setNode(a,{...u,...n})},e6=(t,e={})=>({state:n,commands:r})=>{const s=ln(t,n.schema);return ea(n,s,e)?r.lift(s):r.wrapIn(s,e)},t6=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r=0;u-=1)o.step(c.steps[u].invert(c.docs[u]));if(a.text){const u=o.doc.resolve(a.from).marks();o.replaceWith(a.from,a.to,t.schema.text(a.text,u))}else o.delete(a.from,a.to)}return!0}}return!1},n6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:s}=n;return r||e&&s.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},r6=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var a;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=ni(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!s)return!0;if(f&&o){let{from:g,to:y}=c;const v=(a=h.marks().find(w=>w.type===u))==null?void 0:a.attrs,j=d0(h,u,v);j&&(g=j.from,y=j.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},s6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let a,o;return typeof t=="number"?(a=t,o=t):t&&"from"in t&&"to"in t?(a=t.from,o=t.to):(a=s.from,o=s.to),r&&e.doc.nodesBetween(a,o,(c,u)=>{if(c.isText)return;const h={...c.attrs};delete h.dir,e.setNodeMarkup(u,void 0,h)}),!0},i6=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let a=null,o=null;const c=uf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(a=ln(t,r.schema)),c==="mark"&&(o=ni(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,y,v,j;n.selection.empty?r.doc.nodesBetween(f,m,(w,k)=>{a&&a===w.type&&(u=!0,v=Math.max(k,f),j=Math.min(k+w.nodeSize,m),g=k,y=w)}):r.doc.nodesBetween(f,m,(w,k)=>{k=f&&k<=m&&(a&&a===w.type&&(u=!0,s&&n.setNodeMarkup(k,void 0,{...w.attrs,...e})),o&&w.marks.length&&w.marks.forEach(E=>{if(o===E.type&&(u=!0,s)){const C=Math.max(k,f),M=Math.min(k+w.nodeSize,m);n.addMark(C,M,o.create({...E.attrs,...e}))}}))}),y&&(g!==void 0&&s&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(w=>{o===w.type&&s&&n.addMark(v,j,o.create({...w.attrs,...e}))}))}),u},a6=(t,e={})=>({state:n,dispatch:r})=>{const s=ln(t,n.schema);return OO(s,e)(n,r)},o6=(t,e={})=>({state:n,dispatch:r})=>{const s=ln(t,n.schema);return DO(s,e)(n,r)},l6=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},pf=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},c6=(t,e)=>{if(c0(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function vu(t){var e;const{editor:n,from:r,to:s,text:a,rules:o,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let f=!1;const m=D8(h)+a;return o.forEach(g=>{if(f)return;const y=c6(m,g.find);if(!y)return;const v=u.state.tr,j=cf({state:u.state,transaction:v}),w={from:r-(y[0].length-a.length),to:s},{commands:k,chain:E,can:C}=new df({editor:n,state:j});g.handler({state:j,range:w,match:y,commands:k,chain:E,can:C})===null||!v.steps.length||(g.undoable&&v.setMeta(c,{transform:v,from:r,to:s,text:a}),u.dispatch(v),f=!0)}),f}function d6(t){const{editor:e,rules:n}=t,r=new Ct({state:{init(){return null},apply(s,a,o){const c=s.getMeta(r);if(c)return c;const u=s.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=h0(pe.from(f),o.schema);const{from:m}=u,g=m+f.length;vu({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:a}},props:{handleTextInput(s,a,o,c){return vu({editor:e,from:a,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:a}=s.state.selection;a&&vu({editor:e,from:a.pos,to:a.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,a){if(a.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?vu({editor:e,from:o.pos,to:o.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function u6(t){return Object.prototype.toString.call(t).slice(8,-1)}function bu(t){return u6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function gC(t,e){const n={...t};return bu(t)&&bu(e)&&Object.keys(e).forEach(r=>{bu(e[r])&&bu(t[r])?n[r]=gC(t[r],e[r]):n[r]=e[r]}),n}var p0=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...mt($e(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...mt($e(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>gC(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},to=class xC extends p0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new xC(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(h=>(h==null?void 0:h.type.name)===n.name))return!1;const u=o.find(h=>(h==null?void 0:h.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function h6(t){return typeof t=="number"}var f6=class{constructor(t){this.find=t.find,this.handler=t.handler}},p6=(t,e,n)=>{if(c0(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const a=[s.text];return a.index=s.index,a.input=t,a.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(s.replaceWith)),a}):[]};function m6(t){const{editor:e,state:n,from:r,to:s,rule:a,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new df({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,s,(y,v)=>{var j,w,k,E,C;if((w=(j=y.type)==null?void 0:j.spec)!=null&&w.code||!(y.isText||y.isTextblock||y.isInline))return;const M=(C=(E=(k=y.content)==null?void 0:k.size)!=null?E:y.nodeSize)!=null?C:0,D=Math.max(r,v),F=Math.min(s,v+M);if(D>=F)return;const R=y.isText?y.text||"":y.textBetween(D-v,F-v,void 0,"");p6(R,a.find,o).forEach(A=>{if(A.index===void 0)return;const O=D+A.index+1,W=O+A[0].length,X={from:n.tr.mapping.map(O),to:n.tr.mapping.map(W)},q=a.handler({state:n,range:X,match:A,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(q)})}),m.every(y=>y!==null)}var wu=null,g6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function x6(t){const{editor:e,rules:n}=t;let r=null,s=!1,a=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:m,to:g,rule:y,pasteEvt:v})=>{const j=f.tr,w=cf({state:f,transaction:j});if(!(!m6({editor:e,state:w,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:v,dropEvent:c})||!j.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,j}};return n.map(f=>new Ct({view(m){const g=v=>{var j;r=(j=m.dom.parentElement)!=null&&j.contains(v.target)?m.dom.parentElement:null,r&&(wu=e)},y=()=>{wu&&(wu=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(a=r===m.dom.parentElement,c=g,!a){const y=wu;y!=null&&y.isEditable&&setTimeout(()=>{const v=y.state.selection;v&&y.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,g)=>{var y;const v=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,s=!!(v!=null&&v.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,y)=>{const v=m[0],j=v.getMeta("uiEvent")==="paste"&&!s,w=v.getMeta("uiEvent")==="drop"&&!a,k=v.getMeta("applyPasteRules"),E=!!k;if(!j&&!w&&!E)return;if(E){let{text:D}=k;typeof D=="string"?D=D:D=h0(pe.from(D),y.schema);const{from:F}=k,R=F+D.length,I=g6(D);return u({rule:f,state:y,from:F,to:{b:R},pasteEvt:I})}const C=g.doc.content.findDiffStart(y.doc.content),M=g.doc.content.findDiffEnd(y.doc.content);if(!(!h6(C)||!M||C===M.b))return u({rule:f,state:y,from:C,to:M,pasteEvt:o})}}))}var mf=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=lC(t),this.schema=T8(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Xl(e.name,this.schema)},r=$e(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return mc([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Xl(r.name,this.schema)},a=[],o=$e(r,"addKeyboardShortcuts",s);let c={};if(r.type==="mark"&&$e(r,"exitable",s)&&(c.ArrowRight=()=>to.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,v])=>[y,()=>v({editor:t})]));c={...c,...g}}const u=RL(c);a.push(u);const h=$e(r,"addInputRules",s);if(aw(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const y=d6({editor:t,rules:g}),v=Array.isArray(y)?y:[y];a.push(...v)}}const f=$e(r,"addPasteRules",s);if(aw(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const y=x6({editor:t,rules:g});a.push(...y)}}const m=$e(r,"addProseMirrorPlugins",s);if(m){const g=m();a.push(...g)}return a})}get attributes(){return oC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=nl(this.extensions);return Object.fromEntries(e.filter(n=>!!$e(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ln(n.name,this.schema)},a=$e(n,"addNodeView",s);if(!a)return[];const o=a();if(!o)return[];const c=(u,h,f,m,g)=>{const y=Dc(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return mc([...this.extensions].reverse()).reduceRight((r,s)=>{const a={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Xl(s.name,this.schema)},o=$e(s,"dispatchTransaction",a);return o?c=>{o.call(a,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return mc([...this.extensions]).reduce((r,s)=>{const a={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:Xl(s.name,this.schema)},o=$e(s,"transformPastedHTML",a);return o?(c,u)=>{const h=r(c,u);return o.call(a,h)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=nl(this.extensions);return Object.fromEntries(e.filter(n=>!!$e(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ni(n.name,this.schema)},a=$e(n,"addMarkView",s);if(!a)return[];const o=(c,u,h)=>{const f=Dc(c,r);return a()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{I6(c,t,m)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Xl(e.name,this.schema)};e.type==="mark"&&((n=mt($e(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const s=$e(e,"onBeforeCreate",r),a=$e(e,"onCreate",r),o=$e(e,"onUpdate",r),c=$e(e,"onSelectionUpdate",r),u=$e(e,"onTransaction",r),h=$e(e,"onFocus",r),f=$e(e,"onBlur",r),m=$e(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),a&&this.editor.on("create",a),o&&this.editor.on("update",o),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),f&&this.editor.on("blur",f),m&&this.editor.on("destroy",m)})}};mf.resolve=lC;mf.sort=mc;mf.flatten=u0;var y6={};l0(y6,{ClipboardTextSerializer:()=>vC,Commands:()=>bC,Delete:()=>wC,Drop:()=>NC,Editable:()=>jC,FocusEvents:()=>SC,Keymap:()=>CC,Paste:()=>EC,Tabindex:()=>TC,TextDirection:()=>MC,focusEventsPluginKey:()=>kC});var Gt=class yC extends p0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new yC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},vC=Gt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ct({key:new _t("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,{ranges:a}=s,o=Math.min(...a.map(f=>f.$from.pos)),c=Math.max(...a.map(f=>f.$to.pos)),u=dC(n);return cC(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),bC=Gt.create({name:"commands",addCommands(){return{...QS}}}),wC=Gt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const a=()=>{var o,c,u,h;if((h=(u=(c=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?h:t.getMeta("y-sync$"))return;const f=sC(t.before,[t,...e]);hC(f).forEach(y=>{f.mapping.mapResult(y.oldRange.from).deletedAfter&&f.mapping.mapResult(y.oldRange.to).deletedBefore&&f.before.nodesBetween(y.oldRange.from,y.oldRange.to,(v,j)=>{const w=j+v.nodeSize-2,k=y.oldRange.from<=j&&w<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:v,from:j,to:w,newFrom:f.mapping.map(j),newTo:f.mapping.map(w),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((y,v)=>{var j,w;if(y instanceof Xr){const k=g.slice(v).map(y.from,-1),E=g.slice(v).map(y.to),C=g.invert().map(k,-1),M=g.invert().map(E),D=(j=f.doc.nodeAt(k-1))==null?void 0:j.marks.some(R=>R.eq(y.mark)),F=(w=f.doc.nodeAt(E))==null?void 0:w.marks.some(R=>R.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:C,to:M},newRange:{from:k,to:E},partial:!!(F||D),editor:this.editor,transaction:t,combinedTransform:f})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(a,0):a()}}),NC=Gt.create({name:"drop",addProseMirrorPlugins(){return[new Ct({key:new _t("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),jC=Gt.create({name:"editable",addProseMirrorPlugins(){return[new Ct({key:new _t("editable"),props:{editable:()=>this.editor.options.editable}})]}}),kC=new _t("focusEvents"),SC=Gt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ct({key:kC,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),CC=Gt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:f,$anchor:m}=u,{pos:g,parent:y}=m,v=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,j=v.parent.type.spec.isolating,w=m.pos-m.parentOffset,k=j&&v.parent.childCount===1?w===m.pos:Ge.atStart(h).from===g;return!f||!y.type.isTextblock||y.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},a={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return lh()||nC()?a:s},addProseMirrorPlugins(){return[new Ct({key:new _t("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(j=>j.getMeta("composition")))return;const r=t.some(j=>j.docChanged)&&!e.doc.eq(n.doc),s=t.some(j=>j.getMeta("preventClearDocument"));if(!r||s)return;const{empty:a,from:o,to:c}=e.selection,u=Ge.atStart(e.doc).from,h=Ge.atEnd(e.doc).to;if(a||!(o===u&&c===h)||!ff(n.doc))return;const g=n.tr,y=cf({state:n,transaction:g}),{commands:v}=new df({editor:this.editor,state:y});if(v.clearNodes(),!!g.steps.length)return g}})]}}),EC=Gt.create({name:"paste",addProseMirrorPlugins(){return[new Ct({key:new _t("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),TC=Gt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ct({key:new _t("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),MC=Gt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=nl(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ct({key:new _t("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),v6=class ac{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new ac(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ac(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ac(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,c=this.pos+r+(a?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!s&&!o&&u.depth<=this.depth)return;const h=new ac(u,this.editor,s,s||o?n:null);s&&(h.actualDepth=this.depth+1),e.push(h)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const a=s.node.attrs,o=Object.keys(n);for(let c=0;c{r&&s.length>0||(o.node.type.name===e&&a.every(u=>n[u]===o.node.attrs[u])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},b6=`.ProseMirror { + position: relative; +} + +.ProseMirror { + word-wrap: break-word; + white-space: pre-wrap; + white-space: break-spaces; + -webkit-font-variant-ligatures: none; + font-variant-ligatures: none; + font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ +} + +.ProseMirror [contenteditable="false"] { + white-space: normal; +} + +.ProseMirror [contenteditable="false"] [contenteditable="true"] { + white-space: pre-wrap; +} + +.ProseMirror pre { + white-space: pre-wrap; +} + +img.ProseMirror-separator { + display: inline !important; + border: none !important; + margin: 0 !important; + width: 0 !important; + height: 0 !important; +} + +.ProseMirror-gapcursor { + display: none; + pointer-events: none; + position: absolute; + margin: 0; +} + +.ProseMirror-gapcursor:after { + content: ""; + display: block; + position: absolute; + top: -2px; + width: 20px; + border-top: 1px solid black; + animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; +} + +@keyframes ProseMirror-cursor-blink { + to { + visibility: hidden; + } +} + +.ProseMirror-hideselection *::selection { + background: transparent; +} + +.ProseMirror-hideselection *::-moz-selection { + background: transparent; +} + +.ProseMirror-hideselection * { + caret-color: transparent; +} + +.ProseMirror-focused .ProseMirror-gapcursor { + display: block; +}`;function w6(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var N6=class extends l6{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:$8,createMappablePosition:F8},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:a})=>this.options.onDrop(r,s,a)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=eC(e,this.options.autofocus);this.editorState=Wo.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=w6(b6,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=aC(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const a=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(a))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[jC,vC.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),bC,SC,CC,TC,NC,EC,wC,MC.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new mf(r,this)}createCommandManager(){this.commandManager=new df({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Hg(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Hg(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,a=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new YS(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(h=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(h)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),a=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(h=>h.getMeta("focus")||h.getMeta("blur")),c=o==null?void 0:o.getMeta("focus"),u=o==null?void 0:o.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(h=>h.docChanged)||a.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return uC(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return L8(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return h0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` + +`,textSerializers:n={}}=t||{};return A8(this.state.doc,{blockSeparator:e,textSerializers:{...dC(this.schema),...n}})}get isEmpty(){return ff(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new v6(e,this)}get $doc(){return this.$pos(0)}};function rl(t){return new pf({find:t.find,handler:({state:e,range:n,match:r})=>{const s=mt(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:a}=e,o=r[r.length-1],c=r[0];if(o){const u=c.search(/\S/),h=n.from+c.indexOf(o),f=h+o.length;if(f0(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(j=>j===t.type&&j!==y.mark.type)).filter(y=>y.to>h).length)return null;fn.from&&a.delete(n.from+u,h);const g=n.from+u+o.length;a.addMark(n.from+u,g,t.type.create(s||{})),a.removeStoredMark(t.type)}},undoable:t.undoable})}function AC(t){return new pf({find:t.find,handler:({state:e,range:n,match:r})=>{const s=mt(t.getAttributes,void 0,r)||{},{tr:a}=e,o=n.from;let c=n.to;const u=t.type.create(s);if(r[1]){const h=r[0].lastIndexOf(r[1]);let f=o+h;f>c?f=c:c=f+r[1].length;const m=r[0][r[0].length-1];a.insertText(m,o+r[0].length-1),a.replaceWith(f,c,u)}else if(r[0]){const h=t.type.isInline?o:o-1;a.insert(h,t.type.create(s)).delete(a.mapping.map(o),a.mapping.map(c))}a.scrollIntoView()},undoable:t.undoable})}function Ug(t){return new pf({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),a=mt(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,a)},undoable:t.undoable})}function sl(t){return new pf({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const a=mt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&Wx(u,t.type,a);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:y}=t.editor.extensionManager,v=g||m.$to.parentOffset&&m.$from.marks();if(v){const j=v.filter(w=>y.includes(w.type.name));o.ensureMarks(j)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(m,a).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&oa(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var j6=t=>"touches"in t,k6=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,h=c.clientY-this.startY;this.handleResize(u,h)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.touches[0];if(!u)return;const h=u.clientX-this.startX,f=u.clientY-this.startY;this.handleResize(h,f)},this.handleMouseUp=()=>{if(!this.isResizing)return;const c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,u),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,s,a,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(s=t.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(a=t.options)!=null&&a.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),a=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),a&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,j6(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),a=this.applyConstraints(r,s,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const a=t.includes("right"),o=t.includes("left"),c=t.includes("bottom"),u=t.includes("top");return a?r=this.startWidth+e:o&&(r=this.startWidth-e),c?s=this.startHeight+n:u&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(a?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s,a,o;if(!n){let h=Math.max(this.minSize.width,t),f=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(h=Math.min(this.maxSize.width,h)),(s=this.maxSize)!=null&&s.height&&(f=Math.min(this.maxSize.height,f)),{width:h,height:f}}let c=t,u=e;return cthis.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function S6(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ve){const a=r.index();return r.parent.canReplaceWith(a,a+1,e)}let s=r.depth;for(;s>=0;){const a=r.index(s);if(r.node(s).contentMatchAt(a).matchType(e))return!0;s-=1}return!1}function C6(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var E6={};l0(E6,{createAtomBlockMarkdownSpec:()=>T6,createBlockMarkdownSpec:()=>M6,createInlineMarkdownSpec:()=>RC,parseAttributes:()=>m0,parseIndentedBlocks:()=>Kg,renderNestedMarkdownContent:()=>x0,serializeAttributes:()=>g0});function m0(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const h=s.map(f=>f.trim().slice(1));e.class=h.join(" ")}const a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(e.id=a[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,h,f])=>{var m;const g=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),y=n[g];y&&(e[h]=y.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function g0(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function T6(t){const{nodeName:e,name:n,parseAttributes:r=m0,serializeAttributes:s=g0,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{const g={...a,...f.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),y=(m=f.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,m,g){const y=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),v=f.match(y);if(!v)return;const j=v[1]||"",w=r(j);if(!o.find(E=>!(E in w)))return{type:e,raw:v[0],attributes:w}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=s(m),y=g?` {${g}}`:"";return`:::${u}${y} :::`}}}function M6(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=m0,serializeAttributes:a=g0,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const g={};return u.forEach(y=>{y in m&&(g[y]=m[y])}),g};return{parseMarkdown:(m,g)=>{let y;if(r){const j=r(m);y=typeof j=="string"?[{type:"text",text:j}]:j}else c==="block"?y=g.parseChildren(m.tokens||[]):y=g.parseInline(m.tokens||[]);const v={...o,...m.attributes};return g.createNode(e,v,y)},markdownTokenizer:{name:e,level:"block",start(m){var g;const y=new RegExp(`^:::${h}`,"m"),v=(g=m.match(y))==null?void 0:g.index;return v!==void 0?v:-1},tokenize(m,g,y){var v;const j=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),w=m.match(j);if(!w)return;const[k,E=""]=w,C=s(E);let M=1;const D=k.length;let F="";const R=/^:::([\w-]*)(\s.*)?/gm,I=m.slice(D);for(R.lastIndex=0;;){const A=R.exec(I);if(A===null)break;const O=A.index,W=A[1];if(!((v=A[2])!=null&&v.endsWith(":::"))){if(W)M+=1;else if(M-=1,M===0){const X=I.slice(0,O);F=X.trim();const q=m.slice(0,D+O+A[0].length);let Z=[];if(F)if(c==="block")for(Z=y.blockTokens(X),Z.forEach(_=>{_.text&&(!_.tokens||_.tokens.length===0)&&(_.tokens=y.inlineTokens(_.text))});Z.length>0;){const _=Z[Z.length-1];if(_.type==="paragraph"&&(!_.text||_.text.trim()===""))Z.pop();else break}else Z=y.inlineTokens(F);return{type:e,raw:q,attributes:C,content:F,tokens:Z}}}}}},renderMarkdown:(m,g)=>{const y=f(m.attrs||{}),v=a(y),j=v?` {${v}}`:"",w=g.renderChildren(m.content||[],` + +`);return`:::${h}${j} + +${w} + +:::`}}}function A6(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,a,o]=r;e[s]=a||o,r=n.exec(t)}return e}function R6(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function RC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=A6,serializeAttributes:a=R6,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const y={};return u.forEach(v=>{const j=typeof v=="string"?v:v.name,w=typeof v=="string"?void 0:v.skipIfDefault;if(j in g){const k=g[j];if(w!==void 0&&k===w)return;y[j]=k}}),y},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,y)=>{const v={...o,...g.attributes};if(c)return y.createNode(e,v);const j=r?r(g):g.content||"";return j?y.createNode(e,v,[y.createTextNode(j)]):y.createNode(e,v,[])},markdownTokenizer:{name:e,level:"inline",start(g){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),v=g.match(y),j=v==null?void 0:v.index;return j!==void 0?j:-1},tokenize(g,y,v){const j=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),w=g.match(j);if(!w)return;let k="",E="";if(c){const[,M]=w;E=M}else{const[,M,D]=w;E=M,k=D||""}const C=s(E.trim());return{type:e,raw:w[0],content:k.trim(),attributes:C}}},renderMarkdown:g=>{let y="";r?y=r(g):g.content&&g.content.length>0&&(y=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const v=f(g.attrs||{}),j=a(v),w=j?` ${j}`:"";return c?`[${h}${w}]`:`[${h}${w}]${y}[/${h}]`}}}function Kg(t,e,n){var r,s,a,o;const c=t.split(` +`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(g.trim()===""){f+=1,h=`${h}${g} +`;continue}else return}const v=e.extractItemData(y),{indentLevel:j,mainContent:w}=v;h=`${h}${g} +`;const k=[w];for(f+=1;fO.trim()!=="");if(R===-1)break;if((((s=(r=c[f+1+R].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>j){k.push(D),h=`${h}${D} +`,f+=1;continue}else break}if((((o=(a=D.match(/^(\s*)/))==null?void 0:a[1])==null?void 0:o.length)||0)>j)k.push(D),h=`${h}${D} +`,f+=1;else break}let E;const C=k.slice(1);if(C.length>0){const D=C.map(F=>F.slice(j+m)).join(` +`);D.trim()&&(e.customNestedParser?E=e.customNestedParser(D):E=n.blockTokens(D))}const M=e.createToken(v,E);u.push(M)}if(u.length!==0)return{items:u,raw:h}}function x0(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[a,...o]=t.content,c=e.renderChildren([a]),u=[`${s}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` +`).map(g=>g?e.indent(g):"").join(` +`);u.push(m)}}),u.join(` +`)}function I6(t,e,n={}){const{state:r}=e,{doc:s,tr:a}=r,o=t;s.descendants((c,u)=>{const h=a.mapping.map(u),f=a.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(y=>{if(y!==o)return!1;m=y}),!m)return;let g=!1;if(Object.keys(n).forEach(y=>{n[y]!==m.attrs[y]&&(g=!0)}),g){const y=t.type.create({...t.attrs,...n});a.removeMark(h,f,t.type),a.addMark(h,f,y)}}),a.docChanged&&e.view.dispatch(a)}var fn=class IC extends p0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new IC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Ga(t){return new f6({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const a=mt(t.getAttributes,void 0,r,s);if(a===!1||a===null)return null;const{tr:o}=e,c=r[r.length-1],u=r[0];let h=n.to;if(c){const f=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(f0(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(w=>w===t.type&&w!==v.mark.type)).filter(v=>v.to>m).length)return null;gn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(a||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:P6,getOwnPropertySymbols:O6}=Object,{hasOwnProperty:D6}=Object.prototype;function Um(t,e){return function(r,s,a){return t(r,s,a)&&e(r,s,a)}}function Nu(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:a}=s,o=a.get(n),c=a.get(r);if(o&&c)return o===r&&c===n;a.set(n,r),a.set(r,n);const u=t(n,r,s);return a.delete(n),a.delete(r),u}}function L6(t){return t!=null?t[Symbol.toStringTag]:void 0}function cw(t){return P6(t).concat(O6(t))}const _6=Object.hasOwn||((t,e)=>D6.call(t,e));function no(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const z6="__v",$6="__o",F6="_owner",{getOwnPropertyDescriptor:dw,keys:uw}=Object;function B6(t,e){return t.byteLength===e.byteLength&&ch(new Uint8Array(t),new Uint8Array(e))}function V6(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function H6(t,e){return t.byteLength===e.byteLength&&ch(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function W6(t,e){return no(t.getTime(),e.getTime())}function U6(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function K6(t,e){return t===e}function hw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),a=t.entries();let o,c,u=0;for(;(o=a.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(s[m]){m++;continue}const g=o.value,y=c.value;if(n.equals(g[0],y[0],u,m,t,e,n)&&n.equals(g[1],y[1],g[0],y[0],t,e,n)){f=s[m]=!0;break}m++}if(!f)return!1;u++}return!0}const q6=no;function G6(t,e,n){const r=uw(t);let s=r.length;if(uw(e).length!==s)return!1;for(;s-- >0;)if(!PC(t,e,n,r[s]))return!1;return!0}function Zl(t,e,n){const r=cw(t);let s=r.length;if(cw(e).length!==s)return!1;let a,o,c;for(;s-- >0;)if(a=r[s],!PC(t,e,n,a)||(o=dw(t,a),c=dw(e,a),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function J6(t,e){return no(t.valueOf(),e.valueOf())}function Y6(t,e){return t.source===e.source&&t.flags===e.flags}function fw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),a=t.values();let o,c;for(;(o=a.next())&&!o.done;){const u=e.values();let h=!1,f=0;for(;(c=u.next())&&!c.done;){if(!s[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=s[f]=!0;break}f++}if(!h)return!1}return!0}function ch(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function Q6(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function PC(t,e,n,r){return(r===F6||r===$6||r===z6)&&(t.$$typeof||e.$$typeof)?!0:_6(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const X6="[object ArrayBuffer]",Z6="[object Arguments]",e_="[object Boolean]",t_="[object DataView]",n_="[object Date]",r_="[object Error]",s_="[object Map]",i_="[object Number]",a_="[object Object]",o_="[object RegExp]",l_="[object Set]",c_="[object String]",d_={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},u_="[object URL]",h_=Object.prototype.toString;function f_({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:y,unknownTagComparators:v}){return function(w,k,E){if(w===k)return!0;if(w==null||k==null)return!1;const C=typeof w;if(C!==typeof k)return!1;if(C!=="object")return C==="number"?c(w,k,E):C==="function"?a(w,k,E):!1;const M=w.constructor;if(M!==k.constructor)return!1;if(M===Object)return u(w,k,E);if(Array.isArray(w))return e(w,k,E);if(M===Date)return r(w,k,E);if(M===RegExp)return f(w,k,E);if(M===Map)return o(w,k,E);if(M===Set)return m(w,k,E);const D=h_.call(w);if(D===n_)return r(w,k,E);if(D===o_)return f(w,k,E);if(D===s_)return o(w,k,E);if(D===l_)return m(w,k,E);if(D===a_)return typeof w.then!="function"&&typeof k.then!="function"&&u(w,k,E);if(D===u_)return y(w,k,E);if(D===r_)return s(w,k,E);if(D===Z6)return u(w,k,E);if(d_[D])return g(w,k,E);if(D===X6)return t(w,k,E);if(D===t_)return n(w,k,E);if(D===e_||D===i_||D===c_)return h(w,k,E);if(v){let F=v[D];if(!F){const R=L6(w);R&&(F=v[R])}if(F)return F(w,k,E)}return!1}}function p_({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:B6,areArraysEqual:n?Zl:V6,areDataViewsEqual:H6,areDatesEqual:W6,areErrorsEqual:U6,areFunctionsEqual:K6,areMapsEqual:n?Um(hw,Zl):hw,areNumbersEqual:q6,areObjectsEqual:n?Zl:G6,arePrimitiveWrappersEqual:J6,areRegExpsEqual:Y6,areSetsEqual:n?Um(fw,Zl):fw,areTypedArraysEqual:n?Um(ch,Zl):ch,areUrlsEqual:Q6,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=Nu(r.areArraysEqual),a=Nu(r.areMapsEqual),o=Nu(r.areObjectsEqual),c=Nu(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:c})}return r}function m_(t){return function(e,n,r,s,a,o,c){return t(e,n,c)}}function g_({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(c,u){const{cache:h=t?new WeakMap:void 0,meta:f}=n();return e(c,u,{cache:h,equals:r,meta:f,strict:s})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const a={cache:void 0,equals:r,meta:void 0,strict:s};return function(c,u){return e(c,u,a)}}const x_=ca();ca({strict:!0});ca({circular:!0});ca({circular:!0,strict:!0});ca({createInternalComparator:()=>no});ca({strict:!0,createInternalComparator:()=>no});ca({circular:!0,createInternalComparator:()=>no});ca({circular:!0,createInternalComparator:()=>no,strict:!0});function ca(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,a=p_(t),o=f_(a),c=n?n(o):m_(o);return g_({circular:e,comparator:o,createState:r,equals:c,strict:s})}var Km={exports:{}},qm={};/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var pw;function y_(){if(pw)return qm;pw=1;var t=Fc(),e=Nk();function n(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,a=t.useRef,o=t.useEffect,c=t.useMemo,u=t.useDebugValue;return qm.useSyncExternalStoreWithSelector=function(h,f,m,g,y){var v=a(null);if(v.current===null){var j={hasValue:!1,value:null};v.current=j}else j=v.current;v=c(function(){function k(F){if(!E){if(E=!0,C=F,F=g(F),y!==void 0&&j.hasValue){var R=j.value;if(y(R,F))return M=R}return M=F}if(R=M,r(C,F))return R;var I=g(F);return y!==void 0&&y(R,I)?(C=F,R):(C=F,M=I)}var E=!1,C,M,D=m===void 0?null:m;return[function(){return k(f())},D===null?void 0:function(){return k(D())}]},[f,m,g,y]);var w=s(h,v[0],v[1]);return o(function(){j.hasValue=!0,j.value=w},[w]),u(w),w},qm}var mw;function v_(){return mw||(mw=1,Km.exports=y_()),Km.exports}var b_=v_(),w_=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},N_=({contentComponent:t})=>{const e=jk.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return i.jsx(i.Fragment,{children:Object.values(e)})};function j_(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:bN.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var k_=class extends Zn.Component{constructor(t){var e;super(t),this.editorContentRef=Zn.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=j_(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:w_(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&i.jsx(N_,{contentComponent:t.contentComponent})]})}},S_=b.forwardRef((t,e)=>{const n=Zn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Zn.createElement(k_,{key:n,innerRef:e,...t})}),OC=Zn.memo(S_),C_=typeof window<"u"?b.useLayoutEffect:b.useEffect,E_=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function T_(t){var e;const[n]=b.useState(()=>new E_(t.editor)),r=b_.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:x_);return C_(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(r),r}var M_=!1,qg=typeof window>"u",A_=qg||!!(typeof window<"u"&&window.next),R_=class DC{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?qg||A_?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,a;return(a=(s=this.options.current).onBeforeCreate)==null?void 0:a.call(s,...r)},onBlur:(...r)=>{var s,a;return(a=(s=this.options.current).onBlur)==null?void 0:a.call(s,...r)},onCreate:(...r)=>{var s,a;return(a=(s=this.options.current).onCreate)==null?void 0:a.call(s,...r)},onDestroy:(...r)=>{var s,a;return(a=(s=this.options.current).onDestroy)==null?void 0:a.call(s,...r)},onFocus:(...r)=>{var s,a;return(a=(s=this.options.current).onFocus)==null?void 0:a.call(s,...r)},onSelectionUpdate:(...r)=>{var s,a;return(a=(s=this.options.current).onSelectionUpdate)==null?void 0:a.call(s,...r)},onTransaction:(...r)=>{var s,a;return(a=(s=this.options.current).onTransaction)==null?void 0:a.call(s,...r)},onUpdate:(...r)=>{var s,a;return(a=(s=this.options.current).onUpdate)==null?void 0:a.call(s,...r)},onContentError:(...r)=>{var s,a;return(a=(s=this.options.current).onContentError)==null?void 0:a.call(s,...r)},onDrop:(...r)=>{var s,a;return(a=(s=this.options.current).onDrop)==null?void 0:a.call(s,...r)},onPaste:(...r)=>{var s,a;return(a=(s=this.options.current).onPaste)==null?void 0:a.call(s,...r)},onDelete:(...r)=>{var s,a;return(a=(s=this.options.current).onDelete)==null?void 0:a.call(s,...r)}};return new N6(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,a)=>{var o;return s===((o=n.extensions)==null?void 0:o[a])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?DC.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function I_(t={},e=[]){const n=b.useRef(t);n.current=t;const[r]=b.useState(()=>new R_(n)),s=jk.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(s),b.useEffect(r.onRender(e)),T_({editor:s,selector:({transactionNumber:a})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&a===0?0:a+1}),s}var LC=b.createContext({editor:null});LC.Consumer;var P_=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),O_=()=>b.useContext(P_);Zn.forwardRef((t,e)=>{const{onDragStart:n}=O_(),r=t.as||"div";return i.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Zn.createContext({markViewContentRef:()=>{}});var y0=b.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});y0.displayName="TiptapContext";var D_=()=>b.useContext(y0);function _C({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const s=b.useMemo(()=>({editor:r}),[r]),a=b.useMemo(()=>({editor:r}),[r]);return i.jsx(LC.Provider,{value:a,children:i.jsx(y0.Provider,{value:s,children:n})})}_C.displayName="Tiptap";function zC({...t}){const{editor:e}=D_();return i.jsx(OC,{editor:e,...t})}zC.displayName="Tiptap.Content";Object.assign(_C,{Content:zC});var dh=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},L_=/^\s*>\s$/,__=fn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return dh("blockquote",{...bt(this.options.HTMLAttributes,t),children:dh("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(s=>{const c=e.renderChildren([s]).split(` +`).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(c.join(` +`))}),r.join(` +${n} +`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[sl({find:L_,type:this.type})]}}),z_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,$_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,F_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,B_=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,V_=to.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return dh("strong",{...bt(this.options.HTMLAttributes,t),children:dh("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[rl({find:z_,type:this.type}),rl({find:F_,type:this.type})]},addPasteRules(){return[Ga({find:$_,type:this.type}),Ga({find:B_,type:this.type})]}}),H_=/(^|[^`])`([^`]+)`(?!`)$/,W_=/(^|[^`])`([^`]+)`(?!`)/g,U_=to.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",bt(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[rl({find:H_,type:this.type})]},addPasteRules(){return[Ga({find:W_,type:this.type})]}}),Gm=4,K_=/^```([a-z]+)?[\s\n]$/,q_=/^~~~([a-z]+)?[\s\n]$/,G_=fn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Gm,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const a=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return a||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",bt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(` +`):r=`\`\`\`${s} + +\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Gm,{state:r}=t,{selection:s}=r,{$from:a,empty:o}=s;if(a.parent.type!==this.type)return!1;const c=" ".repeat(n);return o?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:h,to:f}=s,y=r.doc.textBetween(h,f,` +`,` +`).split(` +`).map(v=>c+v).join(` +`);return u.replaceWith(h,f,r.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Gm,{state:r}=t,{selection:s}=r,{$from:a,empty:o}=s;return a.parent.type!==this.type?!1:o?t.commands.command(({tr:c})=>{var u;const{pos:h}=a,f=a.start(),m=a.end(),y=r.doc.textBetween(f,m,` +`,` +`).split(` +`);let v=0,j=0;const w=h-f;for(let F=0;F=w){v=F;break}j+=y[F].length+1}const E=((u=y[v].match(/^ */))==null?void 0:u[0])||"",C=Math.min(E.length,n);if(C===0)return!0;let M=f;for(let F=0;F{const{from:u,to:h}=s,g=r.doc.textBetween(u,h,` +`,` +`).split(` +`).map(y=>{var v;const j=((v=y.match(/^ */))==null?void 0:v[0])||"",w=Math.min(j.length,n);return y.slice(w)}).join(` +`);return c.replaceWith(u,h,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` + +`);return!a||!o?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:a}=n;if(!a||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const c=s.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(Ge.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ug({find:K_,type:this.type,getAttributes:t=>({language:t[1]})}),Ug({find:q_,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ct({key:new _t("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,a=s==null?void 0:s.mode;if(!n||!a)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,` +`));return o.replaceSelectionWith(this.type.create({language:a},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(He.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),J_=fn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` + +`):""}),Y_=fn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",bt(this.options.HTMLAttributes,t)]},renderText(){return` +`},renderMarkdown:()=>` +`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:a}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=a||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Q_=fn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,bt(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Ug({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),X_=fn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",bt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!S6(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return fC(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:a,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(He.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(Ve.create(o.doc,u.pos)):o.setSelection(He.create(o.doc,u.pos));else{const f=a.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(He.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[AC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Z_=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ez=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,tz=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,nz=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,rz=to.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[rl({find:Z_,type:this.type}),rl({find:tz,type:this.type})]},addPasteRules(){return[Ga({find:ez,type:this.type}),Ga({find:nz,type:this.type})]}});const sz="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",iz="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Gg="numeric",Jg="ascii",Yg="alpha",gc="asciinumeric",oc="alphanumeric",Qg="domain",$C="emoji",az="scheme",oz="slashscheme",Jm="whitespace";function lz(t,e){return t in e||(e[t]=[]),e[t]}function Oa(t,e,n){e[Gg]&&(e[gc]=!0,e[oc]=!0),e[Jg]&&(e[gc]=!0,e[Yg]=!0),e[gc]&&(e[oc]=!0),e[Yg]&&(e[oc]=!0),e[oc]&&(e[Qg]=!0),e[$C]&&(e[Qg]=!0);for(const r in e){const s=lz(r,n);s.indexOf(t)<0&&s.push(t)}}function cz(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function dr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}dr.groups={};dr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,s),Wt=(t,e,n,r,s)=>t.tr(e,n,r,s),gw=(t,e,n,r,s)=>t.ts(e,n,r,s),we=(t,e,n,r,s)=>t.tt(e,n,r,s),Ws="WORD",Xg="UWORD",FC="ASCIINUMERICAL",BC="ALPHANUMERICAL",Lc="LOCALHOST",Zg="TLD",ex="UTLD",zu="SCHEME",zo="SLASH_SCHEME",v0="NUM",tx="WS",b0="NL",xc="OPENBRACE",yc="CLOSEBRACE",uh="OPENBRACKET",hh="CLOSEBRACKET",fh="OPENPAREN",ph="CLOSEPAREN",mh="OPENANGLEBRACKET",gh="CLOSEANGLEBRACKET",xh="FULLWIDTHLEFTPAREN",yh="FULLWIDTHRIGHTPAREN",vh="LEFTCORNERBRACKET",bh="RIGHTCORNERBRACKET",wh="LEFTWHITECORNERBRACKET",Nh="RIGHTWHITECORNERBRACKET",jh="FULLWIDTHLESSTHAN",kh="FULLWIDTHGREATERTHAN",Sh="AMPERSAND",Ch="APOSTROPHE",Eh="ASTERISK",Oi="AT",Th="BACKSLASH",Mh="BACKTICK",Ah="CARET",_i="COLON",w0="COMMA",Rh="DOLLAR",ys="DOT",Ih="EQUALS",N0="EXCLAMATION",Dr="HYPHEN",vc="PERCENT",Ph="PIPE",Oh="PLUS",Dh="POUND",bc="QUERY",j0="QUOTE",VC="FULLWIDTHMIDDLEDOT",k0="SEMI",vs="SLASH",wc="TILDE",Lh="UNDERSCORE",HC="EMOJI",_h="SYM";var WC=Object.freeze({__proto__:null,ALPHANUMERICAL:BC,AMPERSAND:Sh,APOSTROPHE:Ch,ASCIINUMERICAL:FC,ASTERISK:Eh,AT:Oi,BACKSLASH:Th,BACKTICK:Mh,CARET:Ah,CLOSEANGLEBRACKET:gh,CLOSEBRACE:yc,CLOSEBRACKET:hh,CLOSEPAREN:ph,COLON:_i,COMMA:w0,DOLLAR:Rh,DOT:ys,EMOJI:HC,EQUALS:Ih,EXCLAMATION:N0,FULLWIDTHGREATERTHAN:kh,FULLWIDTHLEFTPAREN:xh,FULLWIDTHLESSTHAN:jh,FULLWIDTHMIDDLEDOT:VC,FULLWIDTHRIGHTPAREN:yh,HYPHEN:Dr,LEFTCORNERBRACKET:vh,LEFTWHITECORNERBRACKET:wh,LOCALHOST:Lc,NL:b0,NUM:v0,OPENANGLEBRACKET:mh,OPENBRACE:xc,OPENBRACKET:uh,OPENPAREN:fh,PERCENT:vc,PIPE:Ph,PLUS:Oh,POUND:Dh,QUERY:bc,QUOTE:j0,RIGHTCORNERBRACKET:bh,RIGHTWHITECORNERBRACKET:Nh,SCHEME:zu,SEMI:k0,SLASH:vs,SLASH_SCHEME:zo,SYM:_h,TILDE:wc,TLD:Zg,UNDERSCORE:Lh,UTLD:ex,UWORD:Xg,WORD:Ws,WS:tx});const Vs=/[a-z]/,ec=new RegExp("\\p{L}","u"),Ym=new RegExp("\\p{Emoji}","u"),Hs=/\d/,Qm=/\s/,xw="\r",Xm=` +`,dz="️",uz="‍",Zm="";let ju=null,ku=null;function hz(t=[]){const e={};dr.groups=e;const n=new dr;ju==null&&(ju=yw(sz)),ku==null&&(ku=yw(iz)),we(n,"'",Ch),we(n,"{",xc),we(n,"}",yc),we(n,"[",uh),we(n,"]",hh),we(n,"(",fh),we(n,")",ph),we(n,"<",mh),we(n,">",gh),we(n,"(",xh),we(n,")",yh),we(n,"「",vh),we(n,"」",bh),we(n,"『",wh),we(n,"』",Nh),we(n,"<",jh),we(n,">",kh),we(n,"&",Sh),we(n,"*",Eh),we(n,"@",Oi),we(n,"`",Mh),we(n,"^",Ah),we(n,":",_i),we(n,",",w0),we(n,"$",Rh),we(n,".",ys),we(n,"=",Ih),we(n,"!",N0),we(n,"-",Dr),we(n,"%",vc),we(n,"|",Ph),we(n,"+",Oh),we(n,"#",Dh),we(n,"?",bc),we(n,'"',j0),we(n,"/",vs),we(n,";",k0),we(n,"~",wc),we(n,"_",Lh),we(n,"\\",Th),we(n,"・",VC);const r=Wt(n,Hs,v0,{[Gg]:!0});Wt(r,Hs,r);const s=Wt(r,Vs,FC,{[gc]:!0}),a=Wt(r,ec,BC,{[oc]:!0}),o=Wt(n,Vs,Ws,{[Jg]:!0});Wt(o,Hs,s),Wt(o,Vs,o),Wt(s,Hs,s),Wt(s,Vs,s);const c=Wt(n,ec,Xg,{[Yg]:!0});Wt(c,Vs),Wt(c,Hs,a),Wt(c,ec,c),Wt(a,Hs,a),Wt(a,Vs),Wt(a,ec,a);const u=we(n,Xm,b0,{[Jm]:!0}),h=we(n,xw,tx,{[Jm]:!0}),f=Wt(n,Qm,tx,{[Jm]:!0});we(n,Zm,f),we(h,Xm,u),we(h,Zm,f),Wt(h,Qm,f),we(f,xw),we(f,Xm),Wt(f,Qm,f),we(f,Zm,f);const m=Wt(n,Ym,HC,{[$C]:!0});we(m,"#"),Wt(m,Ym,m),we(m,dz,m);const g=we(m,uz);we(g,"#"),Wt(g,Ym,m);const y=[[Vs,o],[Hs,s]],v=[[Vs,null],[ec,c],[Hs,a]];for(let j=0;jj[0]>w[0]?1:-1);for(let j=0;j=0?E[Qg]=!0:Vs.test(w)?Hs.test(w)?E[gc]=!0:E[Jg]=!0:E[Gg]=!0,gw(n,w,w,E)}return gw(n,"localhost",Lc,{ascii:!0}),n.jd=new dr(_h),{start:n,tokens:Object.assign({groups:e},WC)}}function UC(t,e){const n=fz(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,s=[];let a=0,o=0;for(;o=0&&(m+=n[o].length,g++),h+=n[o].length,a+=n[o].length,o++;a-=m,o-=g,h-=m,s.push({t:f.t,v:e.slice(a-h,a),s:a-h,e:a})}return s}function fz(t){const e=[],n=t.length;let r=0;for(;r56319||r+1===n||(a=t.charCodeAt(r+1))<56320||a>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Mi(t,e,n,r,s){let a;const o=e.length;for(let c=0;c=0;)a++;if(a>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+a),10);o>0;o--)n.pop();r+=a}else n.push(t[r]),r++}return e}const _c={defaultProtocol:"http",events:null,format:vw,formatHref:vw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function S0(t,e=null){let n=Object.assign({},_c);t&&(n=Object.assign(n,t instanceof S0?t.o:t));const r=n.ignoreTags,s=[];for(let a=0;an?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=_c.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),a=this.toFormattedString(t),o={},c=t.get("className",n,e),u=t.get("target",n,e),h=t.get("rel",n,e),f=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,c&&(o.class=c),u&&(o.target=u),h&&(o.rel=h),f&&Object.assign(o,f),{tagName:s,attributes:o,content:a,eventListeners:m}}};function gf(t,e){class n extends KC{constructor(s,a){super(s,a),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const bw=gf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ww=gf("text"),pz=gf("nl"),Su=gf("url",{isLink:!0,toHref(t=_c.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Lc&&t[1].t===_i}}),Or=t=>new dr(t);function mz({groups:t}){const e=t.domain.concat([Sh,Eh,Oi,Th,Mh,Ah,Rh,Ih,Dr,v0,vc,Ph,Oh,Dh,vs,_h,wc,Lh]),n=[Ch,_i,w0,ys,N0,vc,bc,j0,k0,mh,gh,xc,yc,hh,uh,fh,ph,xh,yh,vh,bh,wh,Nh,jh,kh],r=[Sh,Ch,Eh,Th,Mh,Ah,Rh,Ih,Dr,xc,yc,vc,Ph,Oh,Dh,bc,vs,_h,wc,Lh],s=Or(),a=we(s,wc);it(a,r,a),it(a,t.domain,a);const o=Or(),c=Or(),u=Or();it(s,t.domain,o),it(s,t.scheme,c),it(s,t.slashscheme,u),it(o,r,a),it(o,t.domain,o);const h=we(o,Oi);we(a,Oi,h),we(c,Oi,h),we(u,Oi,h);const f=we(a,ys);it(f,r,a),it(f,t.domain,a);const m=Or();it(h,t.domain,m),it(m,t.domain,m);const g=we(m,ys);it(g,t.domain,m);const y=Or(bw);it(g,t.tld,y),it(g,t.utld,y),we(h,Lc,y);const v=we(m,Dr);we(v,Dr,v),it(v,t.domain,m),it(y,t.domain,m),we(y,ys,g),we(y,Dr,v);const j=we(y,_i);it(j,t.numeric,bw);const w=we(o,Dr),k=we(o,ys);we(w,Dr,w),it(w,t.domain,o),it(k,r,a),it(k,t.domain,o);const E=Or(Su);it(k,t.tld,E),it(k,t.utld,E),it(E,t.domain,o),it(E,r,a),we(E,ys,k),we(E,Dr,w),we(E,Oi,h);const C=we(E,_i),M=Or(Su);it(C,t.numeric,M);const D=Or(Su),F=Or();it(D,e,D),it(D,n,F),it(F,e,D),it(F,n,F),we(E,vs,D),we(M,vs,D);const R=we(c,_i),I=we(u,_i),A=we(I,vs),O=we(A,vs);it(c,t.domain,o),we(c,ys,k),we(c,Dr,w),it(u,t.domain,o),we(u,ys,k),we(u,Dr,w),it(R,t.domain,D),we(R,vs,D),we(R,bc,D),it(O,t.domain,D),it(O,e,D),we(O,vs,D);const W=[[xc,yc],[uh,hh],[fh,ph],[mh,gh],[xh,yh],[vh,bh],[wh,Nh],[jh,kh]];for(let X=0;X=0&&g++,s++,f++;if(g<0)s-=f,s0&&(a.push(eg(ww,e,o)),o=[]),s-=g,f-=g;const y=m.t,v=n.slice(s-f,s);a.push(eg(y,e,v))}}return o.length>0&&a.push(eg(ww,e,o)),a}function eg(t,e,n){const r=n[0].s,s=n[n.length-1].e,a=e.slice(r,s);return new t(a,n)}const xz=typeof console<"u"&&console&&console.warn||(()=>{}),yz="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",At={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function vz(){return dr.groups={},At.scanner=null,At.parser=null,At.tokenQueue=[],At.pluginQueue=[],At.customSchemes=[],At.initialized=!1,At}function Nw(t,e=!1){if(At.initialized&&xz(`linkifyjs: already initialized - will not register custom scheme "${t}" ${yz}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. +1. Must only contain digits, lowercase ASCII letters or "-" +2. Cannot start or end with "-" +3. "-" cannot repeat`);At.customSchemes.push([t,e])}function bz(){At.scanner=hz(At.customSchemes);for(let t=0;t{const s=e.some(h=>h.docChanged)&&!n.doc.eq(r.doc),a=e.some(h=>h.getMeta("preventAutolink"));if(!s||a)return;const{tr:o}=r,c=sC(n.doc,[...e]);if(hC(c).forEach(({newRange:h})=>{const f=k8(r.doc,h,y=>y.isTextblock);let m,g;if(f.length>1)m=f[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(h.from,h.to," "," ");if(!Nz.test(y))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const y=g.split(wz).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],j=m.pos+g.lastIndexOf(v);if(!v)return!1;const w=C0(v).map(k=>k.toObject(t.defaultProtocol));if(!kz(w))return!1;w.filter(k=>k.isLink).map(k=>({...k,from:j+k.start+1,to:j+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{f0(k.from,k.to,r.doc).some(E=>E.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function Cz(t){return new Ct({key:new _t("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,a;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const u=r.target;if(!u)return!1;const h=t.editor.view.dom;o=u.closest("a"),o&&!h.contains(o)&&(o=null)}if(!o)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=uC(e.state,t.type.name),h=(s=o.href)!=null?s:u.href,f=(a=o.target)!=null?a:u.target;h&&(window.open(h,f),c=!0)}return c}}})}function Ez(t){return new Ct({key:new _t("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:a}=e,{selection:o}=a,{empty:c}=o;if(c)return!1;let u="";r.content.forEach(f=>{u+=f.textContent});const h=qC(u,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===u);return!u||!h||s!==void 0&&!s(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function Ma(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(jz,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var GC=to.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Nw(t);return}Nw(t.scheme,t.optionalSlashes)})},onDestroy(){vz()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Ma(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Ma(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Ma(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",bt(this.options.HTMLAttributes,t),0]:["a",bt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,a;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(a=(s=t.attrs)==null?void 0:s.title)!=null?a:"",u=e.renderChildren(t);return c?`[${u}](${o} "${c}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ma(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Ma(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Ga({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,s=qC(t).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:o=>!!Ma(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(a=>{this.options.shouldAutoLink(a.value)&&e.push({text:a.value,data:{href:a.href},index:a.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Sz({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Ma(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Cz({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Ez({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Tz=GC,Mz=Object.defineProperty,Az=(t,e)=>{for(var n in e)Mz(t,n,{get:e[n],enumerable:!0})},Rz="listItem",jw="textStyle",kw=/^\s*([-+*])\s$/,JC=fn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",bt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Rz,this.editor.getAttributes(jw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=sl({find:kw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=sl({find:kw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(jw),editor:this.editor})),[t]}}),YC=fn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",bt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(s=>s.type==="paragraph"))n=e.parseChildren(t.tokens);else{const s=t.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),c=e.parseChildren(o);n.push(...c)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>x0(t,e,r=>{var s,a;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((a=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:a.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Iz={};Az(Iz,{findListItemPos:()=>Gc,getNextListDepth:()=>T0,handleBackspace:()=>nx,handleDelete:()=>rx,hasListBefore:()=>QC,hasListItemAfter:()=>Pz,hasListItemBefore:()=>XC,listItemHasSubList:()=>ZC,nextListIsDeeper:()=>e2,nextListIsHigher:()=>t2});var Gc=(t,e)=>{const{$from:n}=e.selection,r=ln(t,e.schema);let s=null,a=n.depth,o=n.pos,c=null;for(;a>0&&c===null;)s=n.node(a),s.type===r?c=a:(a-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},T0=(t,e)=>{const n=Gc(t,e);if(!n)return!1;const[,r]=O8(e,t,n.$pos.pos+4);return r},QC=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),a=t.doc.resolve(s).node();return!(!a||!n.includes(a.type.name))},XC=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},ZC=(t,e,n)=>{if(!n)return!1;const r=ln(t,e.schema);let s=!1;return n.descendants(a=>{a.type===r&&(s=!0)}),s},nx=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!ea(t.state,e)&&QC(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((g,y)=>{g.type.name===e&&h.push({node:g,pos:y})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!ea(t.state,e)||!z8(t.state))return!1;const r=Gc(e,t.state);if(!r)return!1;const a=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=ZC(e,t.state,a);return XC(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},e2=(t,e)=>{const n=T0(t,e),r=Gc(t,e);return!r||!n?!1:n>r.depth},t2=(t,e)=>{const n=T0(t,e),r=Gc(t,e);return!r||!n?!1:n{if(!ea(t.state,e)||!_8(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:e2(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():t2(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Pz=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},n2=Gt.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&rx(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&rx(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&nx(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&nx(t,n,r)&&(e=!0)}),e}}}}),Sw=/^(\s*)(\d+)\.\s+(.*)$/,Oz=/^\s/;function Dz(t){const e=[];let n=0,r=0;for(;ne;)g.push(t[m]),m+=1;if(g.length>0){const y=Math.min(...g.map(j=>j.indent)),v=r2(g,y,n);h.push({type:"list",ordered:!0,start:g[0].number,items:v,raw:g.map(j=>j.raw).join(` +`)})}s.push({type:"list_item",raw:o.raw,tokens:h}),a=m}else a+=1}return s}function Lz(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const a=e.parseChildren([s]);r.push({type:"paragraph",content:a})}else{const a=e.parseChildren([s]);a.length>0&&r.push(...a)}}),{type:"listItem",content:r}})}var _z="listItem",Cw="textStyle",Ew=/^(\d+)\.\s$/,s2=fn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",bt(this.options.HTMLAttributes,n),0]:["ol",bt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?Lz(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const s=t.split(` +`),[a,o]=Dz(s);if(a.length===0)return;const c=r2(a,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=a[0])==null?void 0:r.number)||1,items:c,raw:s.slice(0,o).join(` +`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_z,this.editor.getAttributes(Cw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=sl({find:Ew,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=sl({find:Ew,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Cw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),zz=/^\s*(\[([( |x])?\])\s$/,$z=fn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",bt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return x0(t,e,s)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),a=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var g,y;c.ariaLabel=((y=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:y.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),a.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:y})=>{const v=n();if(typeof v!="number")return!1;const j=y.doc.nodeAt(v);return y.setNodeMarkup(v,void 0,{...j==null?void 0:j.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{s.setAttribute(m,g)}),s.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,a.append(c,o),s.append(a,u),Object.entries(e).forEach(([m,g])=>{s.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:s,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;s.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,y=Dc(m,g),v=new Set(Object.keys(y)),j=this.options.HTMLAttributes;return f.forEach(w=>{v.has(w)||(w in j?s.setAttribute(w,j[w]):s.removeAttribute(w))}),Object.entries(y).forEach(([w,k])=>{k==null?w in j?s.setAttribute(w,j[w]):s.removeAttribute(w):s.setAttribute(w,k)}),f=v,!0}}}},addInputRules(){return[sl({find:zz,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Fz=fn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",bt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=a=>{const o=Kg(a,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(a)},s=Kg(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,o)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Gt.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(JC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(YC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(n2.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(s2.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push($z.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Fz.configure(this.options.taskList)),t}});var Tw=" ",Bz=" ",Vz=fn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",bt(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===Tw||r[0].text===Bz)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?Tw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Hz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Wz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Uz=to.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",bt(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[rl({find:Hz,type:this.type})]},addPasteRules(){return[Ga({find:Wz,type:this.type})]}}),Kz=fn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),qz=to.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",bt(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const a=s[2].trim();return{type:"underline",raw:s[0],text:a,tokens:n.inlineTokens(a)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Gz(t={}){return new Ct({view(e){return new Jz(e,t)}})}class Jz{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let a=o=>{this[s](o)};return e.dom.addEventListener(s,a),{name:s,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,a=s.getBoundingClientRect(),o=a.width/s.offsetWidth,c=a.height/s.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let y=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(y){let v=y.getBoundingClientRect(),j=m?v.bottom:v.top;m&&g&&(j=(j+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let w=this.width/2*c;r={left:v.left,right:v.right,top:j-w,bottom:j+w}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,y=m.height/u.offsetHeight;h=m.left-u.scrollLeft*g,f=m.top-u.scrollTop*y}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,a=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!a){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=Yk(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Kt extends Ge{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Kt.valid(r)?new Kt(r):Ge.near(r)}content(){return Me.empty}eq(e){return e instanceof Kt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Kt(e.resolve(n.pos))}getBookmark(){return new M0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Yz(e)||!Qz(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Kt.valid(e))return e;let s=e.pos,a=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)0){a=c.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let u=e.doc.resolve(s);if(Kt.valid(u))return u}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!Ve.isSelectable(a)){e=e.doc.resolve(s+a.nodeSize*n),r=!1;continue e}break}a=o,s+=n;let c=e.doc.resolve(s);if(Kt.valid(c))return c}return null}}}Kt.prototype.visible=!1;Kt.findFrom=Kt.findGapCursorFrom;Ge.jsonID("gapcursor",Kt);class M0{constructor(e){this.pos=e}map(e){return new M0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Kt.valid(n)?new Kt(n):Ge.near(n)}}function i2(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Yz(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||i2(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Qz(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||i2(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Xz(){return new Ct({props:{decorations:n7,createSelectionBetween(t,e,n){return e.pos==n.pos&&Kt.valid(n)?new Kt(n):null},handleClick:e7,handleKeyDown:Zz,handleDOMEvents:{beforeinput:t7}}})}const Zz=o0({ArrowLeft:Cu("horiz",-1),ArrowRight:Cu("horiz",1),ArrowUp:Cu("vert",-1),ArrowDown:Cu("vert",1)});function Cu(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,a){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof He){if(!a.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=Kt.findGapCursorFrom(c,e,u);return h?(s&&s(r.tr.setSelection(new Kt(h))),!0):!1}}function e7(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Kt.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&Ve.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Kt(r))),!0)}function t7(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Kt))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=pe.empty;for(let o=r.length-1;o>=0;o--)s=pe.from(r[o].createAndFill(null,s));let a=t.state.tr.replace(n.pos,n.pos,new Me(s,0,0));return a.setSelection(He.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function n7(t){if(!(t.selection instanceof Kt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Nt.create(t.doc,[hn.widget(t.selection.head,e,{key:"gapcursor"})])}var zh=200,jn=function(){};jn.prototype.append=function(e){return e.length?(e=jn.from(e),!this.length&&e||e.length=n?jn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};jn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};jn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};jn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(a,o){return s.push(e(a,o))},n,r),s};jn.from=function(e){return e instanceof jn?e:e&&e.length?new a2(e):jn.empty};var a2=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(s,a){return s==0&&a==this.length?this:new e(this.values.slice(s,a))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,a,o,c){for(var u=a;u=o;u--)if(s(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=zh)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=zh)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(jn);jn.empty=new a2([]);var r7=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rc&&this.right.forEachInner(r,Math.max(s-c,0),Math.min(this.length,a)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,a,o){var c=this.left.length;if(s>c&&this.right.forEachInvertedInner(r,s-c,Math.max(a,c)-c,o+c)===!1||a=a?this.right.slice(r-a,s-a):this.left.slice(r,a).append(this.right.slice(0,s-a))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(jn);const s7=500;class Qr{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,a;n&&(s=this.remapping(r,this.items.length),a=s.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){s||(s=this.remapping(r,g+1),a=s.maps.length),a--,f.push(m);return}if(s){f.push(new Ai(m.map));let y=m.step.map(s.slice(a)),v;y&&o.maybeStep(y).doc&&(v=o.mapping.maps[o.mapping.maps.length-1],h.push(new Ai(v,void 0,void 0,h.length+f.length))),a--,v&&s.appendMap(v,a)}else o.maybeStep(m.step);if(m.selection)return c=s?m.selection.map(s.slice(a)):m.selection,u=new Qr(this.items.slice(0,r).append(f.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:c}}addTransform(e,n,r,s){let a=[],o=this.eventCount,c=this.items,u=!s&&c.length?c.get(c.length-1):null;for(let f=0;fa7&&(c=i7(c,h),o-=h),new Qr(c.append(a),o)}remapping(e,n){let r=new Mc;return this.items.forEach((s,a)=>{let o=s.mirrorOffset!=null&&a-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Qr(this.items.append(e.map(n=>new Ai(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),a=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},s);let u=n;this.items.forEach(g=>{let y=a.getMirror(--u);if(y==null)return;o=Math.min(o,y);let v=a.maps[y];if(g.step){let j=e.steps[y].invert(e.docs[y]),w=g.selection&&g.selection.map(a.slice(u+1,y));w&&c++,r.push(new Ai(v,j,w))}else r.push(new Ai(v))},s);let h=[];for(let g=n;gs7&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,s=[],a=0;return this.items.forEach((o,c)=>{if(c>=e)s.push(o),o.selection&&a++;else if(o.step){let u=o.step.map(n.slice(r)),h=u&&u.getMap();if(r--,h&&n.appendMap(h,r),u){let f=o.selection&&o.selection.map(n.slice(r));f&&a++;let m=new Ai(h.invert(),u,f),g,y=s.length-1;(g=s.length&&s[y].merge(m))?s[y]=g:s.push(m)}}else o.map&&r--},this.items.length,0),new Qr(jn.from(s.reverse()),a)}}Qr.empty=new Qr(jn.empty,0);function i7(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}let Ai=class o2{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new o2(n.getMap().invert(),n,this.selection)}}};class Di{constructor(e,n,r,s,a){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=a}}const a7=20;function o7(t,e,n,r){let s=n.getMeta(Ba),a;if(s)return s.historyState;n.getMeta(d7)&&(t=new Di(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Ba))return o.getMeta(Ba).redo?new Di(t.done.addTransform(n,void 0,r,$u(e)),t.undone,Mw(n.mapping.maps),t.prevTime,t.prevComposition):new Di(t.done,t.undone.addTransform(n,void 0,r,$u(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!l7(n,t.prevRanges)),h=o?tg(t.prevRanges,n.mapping):Mw(n.mapping.maps);return new Di(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,$u(e)),Qr.empty,h,n.time,c??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Di(t.done.rebased(n,a),t.undone.rebased(n,a),tg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Di(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),tg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function l7(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let a=0;a=e[a]&&(n=!0)}),n}function Mw(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,a,o)=>e.push(a,o));return e}function tg(t,e){if(!t)return null;let n=[];for(let r=0;r{let s=Ba.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let a=c7(s,n,t);a&&r(e?a.scrollIntoView():a)}return!0}}const c2=l2(!1,!0),d2=l2(!0,!0);Gt.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Ct({key:new _t("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const a=this.storage.characters({node:r.doc});if(a>s){const o=a-s,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(c,u);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),a=this.storage.characters({node:e.doc});if(a<=r||s>r&&a>r&&a<=s)return!0;if(s>r&&a>r&&a>s||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=a-r,h=c-u,f=c;return e.deleteRange(h,f),!(this.storage.characters({node:e.doc})>r)}})]}});var h7=Gt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Gz(this.options)]}});Gt.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ct({key:new _t("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,a=[];if(!n||!r)return Nt.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(s>=h&&s<=h+u.nodeSize-1))return!1;o+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(s>=h&&s<=h+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&o-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";a.push(hn.node(h,h+u.nodeSize,{class:this.options.className}))}),Nt.create(t,a)}}})]}});var f7=Gt.create({name:"gapCursor",addProseMirrorPlugins(){return[Xz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=mt($e(t,"allowGapCursor",n)))!=null?e:null}}}),Rw="placeholder";function p7(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var m7=Gt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Rw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${p7(this.options.dataAttribute)}`:`data-${Rw}`;return[new Ct({key:new _t("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=n,a=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((c,u)=>{const h=s>=u&&s<=u+c.nodeSize,f=!c.isLeaf&&ff(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=hn.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});a.push(g)}return this.options.includeChildren}),Nt.create(e,a)}}})]}});Gt.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Ct({key:new _t("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||fC(n.selection)||t.view.dragging?null:Nt.create(n.doc,[hn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Iw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var g7=Gt.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new _t(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new Ct({key:e,appendTransaction:(s,a,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,g=h.nodes[n];if(f)return u.insert(m,g.create())},state:{init:(s,a)=>{const o=a.tr.doc.lastChild;return!Iw({node:o,types:r})},apply:(s,a)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return a;const o=s.doc.lastChild;return!Iw({node:o,types:r})}}})]}}),x7=Gt.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>c2(t,e),redo:()=>({state:t,dispatch:e})=>d2(t,e)}},addProseMirrorPlugins(){return[u7(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),y7=Gt.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(V_.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(__.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(JC.configure(this.options.bulletList)),this.options.code!==!1&&s.push(U_.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(G_.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(J_.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(h7.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(f7.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(Y_.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(Q_.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(x7.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(X_.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(rz.configure(this.options.italic)),this.options.listItem!==!1&&s.push(YC.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(n2.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(GC.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(s2.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(Vz.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(Uz.configure(this.options.strike)),this.options.text!==!1&&s.push(Kz.configure(this.options.text)),this.options.underline!==!1&&s.push(qz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(g7.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),v7=y7,b7=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,w7=fn.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",bt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,a,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(s=(r=t.attrs)==null?void 0:r.alt)!=null?s:"",h=(o=(a=t.attrs)==null?void 0:a.title)!=null?o:"";return h?`![${u}](${c} "${h}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:a,HTMLAttributes:o,editor:c})=>{const u=document.createElement("img");Object.entries(o).forEach(([m,g])=>{if(g!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,g);break}}),u.src=o.src;const h=new k6({element:u,editor:c,node:s,getPos:a,onResize:(m,g)=>{u.style.width=`${m}px`,u.style.height=`${g}px`},onCommit:(m,g)=>{const y=a();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:m,height:g}).run()},onUpdate:(m,g,y)=>m.type===s.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),f=h.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",u.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[AC({find:b7,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),N7=w7;function j7(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:a,startOfLine:o,$position:c}=t,u=r&&!s,h=C6(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=s?"":h,y=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),v=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!v)return null;const j=c.pos-v.length,w=Array.from(v.matchAll(y)).pop();if(!w||w.input===void 0||w.index===void 0)return null;const k=w.input.slice(Math.max(0,w.index-1),w.index),E=new RegExp(`^[${a==null?void 0:a.join("")}\0]?$`).test(k);if(a!==null&&!E)return null;const C=j+w.index;let M=C+w[0].length;return u&&f.test(v.slice(M-1,M+1))&&(w[0]+=" ",M+=1),C=c.pos?{range:{from:C,to:M},query:w[0].slice(n.length),text:w[0]}:null}var k7=new _t("suggestion");function S7({pluginKey:t=k7,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:a=[" "],startOfLine:o=!1,decorationTag:c="span",decorationClass:u="suggestion",decorationContent:h="",decorationEmptyClass:f="is-empty",command:m=()=>null,items:g=()=>[],render:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:j=j7,shouldShow:w}){let k;const E=y==null?void 0:y(),C=()=>{const R=e.state.selection.$anchor.pos,I=e.view.coordsAtPos(R),{top:A,right:O,bottom:W,left:X}=I;try{return new DOMRect(X,A,O-X,W-A)}catch{return null}},M=(R,I)=>I?()=>{const A=t.getState(e.state),O=A==null?void 0:A.decorationId,W=R.dom.querySelector(`[data-decoration-id="${O}"]`);return(W==null?void 0:W.getBoundingClientRect())||null}:C;function D(R,I){var A;try{const W=t.getState(R.state),X=W!=null&&W.decorationId?R.dom.querySelector(`[data-decoration-id="${W.decorationId}"]`):null,q={editor:e,range:(W==null?void 0:W.range)||{from:0,to:0},query:(W==null?void 0:W.query)||null,text:(W==null?void 0:W.text)||null,items:[],command:Z=>m({editor:e,range:(W==null?void 0:W.range)||{from:0,to:0},props:Z}),decorationNode:X,clientRect:M(R,X)};(A=E==null?void 0:E.onExit)==null||A.call(E,q)}catch{}const O=R.state.tr.setMeta(I,{exit:!0});R.dispatch(O)}const F=new Ct({key:t,view(){return{update:async(R,I)=>{var A,O,W,X,q,Z,_;const $=(A=this.key)==null?void 0:A.getState(I),oe=(O=this.key)==null?void 0:O.getState(R.state),V=$.active&&oe.active&&$.range.from!==oe.range.from,ae=!$.active&&oe.active,Y=$.active&&!oe.active,L=!ae&&!Y&&$.query!==oe.query,H=ae||V&&L,ue=L||V,U=Y||V&&L;if(!H&&!ue&&!U)return;const he=U&&!H?$:oe,Q=R.dom.querySelector(`[data-decoration-id="${he.decorationId}"]`);k={editor:e,range:he.range,query:he.query,text:he.text,items:[],command:ee=>m({editor:e,range:he.range,props:ee}),decorationNode:Q,clientRect:M(R,Q)},H&&((W=E==null?void 0:E.onBeforeStart)==null||W.call(E,k)),ue&&((X=E==null?void 0:E.onBeforeUpdate)==null||X.call(E,k)),(ue||H)&&(k.items=await g({editor:e,query:he.query})),U&&((q=E==null?void 0:E.onExit)==null||q.call(E,k)),ue&&((Z=E==null?void 0:E.onUpdate)==null||Z.call(E,k)),H&&((_=E==null?void 0:E.onStart)==null||_.call(E,k))},destroy:()=>{var R;k&&((R=E==null?void 0:E.onExit)==null||R.call(E,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(R,I,A,O){const{isEditable:W}=e,{composing:X}=e.view,{selection:q}=R,{empty:Z,from:_}=q,$={...I},oe=R.getMeta(t);if(oe&&oe.exit)return $.active=!1,$.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null,$;if($.composing=X,W&&(Z||e.view.composing)){(_I.range.to)&&!X&&!I.composing&&($.active=!1);const V=j({char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:a,startOfLine:o,$position:q.$from}),ae=`id_${Math.floor(Math.random()*4294967295)}`;V&&v({editor:e,state:O,range:V.range,isActive:I.active})&&(!w||w({editor:e,range:V.range,query:V.query,text:V.text,transaction:R}))?($.active=!0,$.decorationId=I.decorationId?I.decorationId:ae,$.range=V.range,$.query=V.query,$.text=V.text):$.active=!1}else $.active=!1;return $.active||($.decorationId=null,$.range={from:0,to:0},$.query=null,$.text=null),$}},props:{handleKeyDown(R,I){var A,O,W,X;const{active:q,range:Z}=F.getState(R.state);if(!q)return!1;if(I.key==="Escape"||I.key==="Esc"){const $=F.getState(R.state),oe=(A=k==null?void 0:k.decorationNode)!=null?A:null,V=oe??($!=null&&$.decorationId?R.dom.querySelector(`[data-decoration-id="${$.decorationId}"]`):null);if(((O=E==null?void 0:E.onKeyDown)==null?void 0:O.call(E,{view:R,event:I,range:$.range}))||!1)return!0;const Y={editor:e,range:$.range,query:$.query,text:$.text,items:[],command:L=>m({editor:e,range:$.range,props:L}),decorationNode:V,clientRect:V?()=>V.getBoundingClientRect()||null:null};return(W=E==null?void 0:E.onExit)==null||W.call(E,Y),D(R,t),!0}return((X=E==null?void 0:E.onKeyDown)==null?void 0:X.call(E,{view:R,event:I,range:Z}))||!1},decorations(R){const{active:I,range:A,decorationId:O,query:W}=F.getState(R);if(!I)return null;const X=!(W!=null&&W.length),q=[u];return X&&q.push(f),Nt.create(R.doc,[hn.inline(A.from,A.to,{nodeName:c,class:q.join(" "),"data-decoration-id":O,"data-decoration-content":h})])}}});return F}function C7({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const s=new _t;return{editor:t,char:r,pluginKey:s,command:({editor:a,range:o,props:c})=>{var u,h,f;const m=a.view.state.selection.$to.nodeAfter;((u=m==null?void 0:m.text)==null?void 0:u.startsWith(" "))&&(o.to+=1),a.chain().focus().insertContentAt(o,[{type:n,attrs:{...c,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(h=a.view.dom.ownerDocument.defaultView)==null?void 0:h.getSelection())==null||f.collapseToEnd()},allow:({state:a,range:o})=>{const c=a.doc.resolve(o.from),u=a.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(u)},...e}}function u2(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>C7({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Pw(t,e){const n=u2(t),r=n.find(s=>s.char===e);return r||(n.length?n[0]:null)}var E7=fn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,s;return["span",bt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(s=e.attrs.label)!=null?s:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=Pw(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",bt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=bt({"data-type":this.name},this.options.HTMLAttributes,e);const s=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof s=="string"?["span",bt({"data-type":this.name},this.options.HTMLAttributes,e),s]:s},...RC({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,a,o]=r,c=a??o;e[s==="char"?"mentionSuggestionChar":s]=c,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:Pw(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:s,anchor:a}=r;if(!s)return!1;let o=new Js,c=0;return e.doc.nodesBetween(a-1,a,(u,h)=>{if(u.type.name===this.name)return n=!0,o=u,c=h,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,c,c+o.nodeSize),n})}},addProseMirrorPlugins(){return u2(this).map(S7)}}),T7=E7,M7=m7;let sx,ix;if(typeof WeakMap<"u"){let t=new WeakMap;sx=e=>t.get(e),ix=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;sx=r=>{for(let s=0;s(n==10&&(n=0),t[n++]=r,t[n++]=s)}var qt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(a||(a=[])).push({type:"overlong_rowspan",pos:f,n:k-C});break}const M=s+C*e;for(let D=0;Dr&&(a+=h.attrs.colspan)}}for(let o=0;o1&&(n=!0)}e==-1?e=a:e!=a&&(e=Math.max(e,a))}return e}function I7(t,e,n){t.problems||(t.problems=[]);const r={};for(let s=0;s0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function O7(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function rs(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function xf(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Ja(e.$head)||D7(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function D7(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function ax(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function L7(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function A0(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function h2(t,e,n){const r=t.node(-1),s=qt.get(r),a=t.start(-1),o=s.nextCell(t.pos-a,e,n);return o==null?null:t.node(0).resolve(a+o)}function Ya(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function f2(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;sf!=n.pos-a);u.unshift(n.pos-a);const h=u.map(f=>{const m=r.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=a+f+1;return new tS(c.resolve(g),c.resolve(g+m.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),s=e.resolve(n.map(this.$headCell.pos));if(ax(r)&&ax(s)&&A0(r,s)){const a=this.$anchorCell.node(-1)!=r.node(-1);return a&&this.isRowSelection()?Us.rowSelection(r,s):a&&this.isColSelection()?Us.colSelection(r,s):new Us(r,s)}return He.between(r,s)}content(){const e=this.$anchorCell.node(-1),n=qt.get(e),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),a={},o=[];for(let u=s.top;u0||w>0){let k=v.attrs;if(j>0&&(k=Ya(k,0,j)),w>0&&(k=Ya(k,k.colspan-w,w)),y.lefts.bottom){const k={...v.attrs,rowspan:Math.min(y.bottom,s.bottom)-Math.max(y.top,s.top)};y.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),s=qt.get(r),a=e.start(-1),o=s.findCell(e.pos-a),c=s.findCell(n.pos-a),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(a+s.map[o.left])),c.bottom0&&(n=u.resolve(a+s.map[c.left])),o.bottom0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,c=a+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof Us&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),s=qt.get(r),a=e.start(-1),o=s.findCell(e.pos-a),c=s.findCell(n.pos-a),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(a+s.map[o.top*s.width])),c.right0&&(n=u.resolve(a+s.map[c.top*s.width])),o.right{e.push(hn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Nt.create(t.doc,e)}function F7({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(s+1)=0&&!(e.before(a+1)>e.start(a));a--,r--);return n==r&&/row|table/.test(t.node(s).type.spec.tableRole)}function B7({$from:t,$to:e}){let n,r;for(let s=t.depth;s>0;s--){const a=t.node(s);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){n=a;break}}for(let s=e.depth;s>0;s--){const a=e.node(s);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){r=a;break}}return n!==r&&e.parentOffset===0}function V7(t,e,n){const r=(e||t).selection,s=(e||t).doc;let a,o;if(r instanceof Ve&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")a=St.create(s,r.from);else if(o=="row"){const c=s.resolve(r.from+1);a=St.rowSelection(c,c)}else if(!n){const c=qt.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];a=St.create(s,u+1,h)}}else r instanceof He&&F7(r)?a=He.create(s,r.from):r instanceof He&&B7(r)&&(a=He.create(s,r.$from.start(),r.$from.end()));return a&&(e||(e=t.tr)).setSelection(a),e}const H7=new _t("fix-tables");function m2(t,e,n,r){const s=t.childCount,a=e.childCount;e:for(let o=0,c=0;o{s.type.spec.tableRole=="table"&&(n=W7(t,s,a,n))};return e?e.doc!=t.doc&&m2(e.doc,t.doc,0,r):t.doc.descendants(r),n}function W7(t,e,n,r){const s=qt.get(e);if(!s.problems)return r;r||(r=t.tr);const a=[];for(let u=0;u0){let y="cell";f.firstChild&&(y=f.firstChild.type.spec.tableRole);const v=[];for(let w=0;w0?-1:0;_7(e,r,s+a)&&(a=s==0||s==e.width?null:0);for(let o=0;o0&&s0&&e.map[c-1]==u||s0?-1:0;J7(e,r,s+c)&&(c=s==0||s==e.height?null:0);for(let h=0,f=e.width*s;h0&&s0&&m==e.map[f-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),h+=g.colspan-1}else if(s0&&n[a]==n[a-1]||r.right0&&n[s]==n[s-t]||r.bottom0){const f=u+1+h.content.size,m=Ow(h)?u+1:f;a.replaceWith(m+r.tableStart,f+r.tableStart,c)}a.setSelection(new St(a.doc.resolve(u+r.tableStart))),e(a)}return!0}function Lw(t,e){const n=Wn(t.schema);return t$(({node:r})=>n[r.type.spec.tableRole])(t,e)}function t$(t){return(e,n)=>{const r=e.selection;let s,a;if(r instanceof St){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{var o;if(s=O7(r.$from),!s)return!1;a=(o=Ja(r.$from))===null||o===void 0?void 0:o.pos}if(s==null||a==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let c=s.attrs;const u=[],h=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const f=Es(e),m=e.tr;for(let y=0;y{o.attrs[t]!==e&&a.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):a.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[t]:e}),r(a)}return!0}}function r$(t){return function(e,n){if(!rs(e))return!1;if(n){const r=Wn(e.schema),s=Es(e),a=e.tr,o=s.map.cellsInRect(t=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:t=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),c=o.map(u=>s.table.nodeAt(u));for(let u=0;u{const y=g+a.tableStart,v=o.doc.nodeAt(y);v&&o.setNodeMarkup(y,m,v.attrs)}),r(o)}return!0}}zc("row",{useDeprecatedLogic:!0});zc("column",{useDeprecatedLogic:!0});const s$=zc("cell",{useDeprecatedLogic:!0});function i$(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,s=t.before();r>=0;r--){const a=t.node(-1).child(r),o=a.lastChild;if(o)return s-1-o.nodeSize;s-=a.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Eu(t,e){const n=t.selection;if(!(n instanceof St))return!1;if(e){const r=t.tr,s=Wn(t.schema).cell.createAndFill().content;n.forEachCell((a,o)=>{a.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+a.nodeSize-1),new Me(s,0,0))}),r.docChanged&&e(r)}return!0}function o$(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const s=e.child(0),a=s.type.spec.tableRole,o=s.type.schema,c=[];if(a=="row")for(let u=0;u=0;o--){const{rowspan:c,colspan:u}=a.child(o).attrs;for(let h=s;h=e.length&&e.push(pe.empty),n[s]r&&(g=g.type.createChecked(Ya(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let y=1;ys&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,s-m.attrs.rowspan)},m.content)),u.push(m)}a.push(pe.from(u))}n=a,e=s}return{width:t,height:e,rows:n}}function d$(t,e,n,r,s,a,o){const c=t.doc.type.schema,u=Wn(c);let h,f;if(s>e.width)for(let m=0,g=0;me.height){const m=[];for(let v=0,j=(e.height-1)*e.width;v=e.width?!1:n.nodeAt(e.map[j+v]).type==u.header_cell;m.push(w?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,pe.from(m)),y=[];for(let v=e.height;v{if(!s)return!1;const a=n.selection;if(a instanceof St)return Fu(n,r,Ge.near(a.$headCell,e));if(t!="horiz"&&!a.empty)return!1;const o=v2(s,t,e);if(o==null)return!1;if(t=="horiz")return Fu(n,r,Ge.near(n.doc.resolve(a.head+e),e));{const c=n.doc.resolve(o),u=h2(c,t,e);let h;return u?h=Ge.near(u,1):e<0?h=Ge.near(n.doc.resolve(c.before(-1)),-1):h=Ge.near(n.doc.resolve(c.after(-1)),1),Fu(n,r,h)}}}function Mu(t,e){return(n,r,s)=>{if(!s)return!1;const a=n.selection;let o;if(a instanceof St)o=a;else{const u=v2(s,t,e);if(u==null)return!1;o=new St(n.doc.resolve(u))}const c=h2(o.$headCell,t,e);return c?Fu(n,r,new St(o.$anchorCell,c)):!1}}function h$(t,e){const n=t.state.doc,r=Ja(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new St(r))),!0):!1}function f$(t,e,n){if(!rs(t.state))return!1;let r=o$(n);const s=t.state.selection;if(s instanceof St){r||(r={width:1,height:1,rows:[pe.from(ox(Wn(t.state.schema).cell,n))]});const a=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),c=qt.get(a).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=c$(r,c.right-c.left,c.bottom-c.top),Bw(t.state,t.dispatch,o,c,r),!0}else if(r){const a=xf(t.state),o=a.start(-1);return Bw(t.state,t.dispatch,o,qt.get(a.node(-1)).findCell(a.pos-o),r),!0}else return!1}function p$(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Vw(t,e.target);let s;if(e.shiftKey&&t.state.selection instanceof St)a(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(s=Ja(t.state.selection.$anchor))!=null&&((n=rg(t,e))===null||n===void 0?void 0:n.pos)!=s.pos)a(s,e),e.preventDefault();else if(!r)return;function a(u,h){let f=rg(t,h);const m=zi.getState(t.state)==null;if(!f||!A0(u,f))if(m)f=u;else return;const g=new St(u,f);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(zi,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),zi.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(zi,-1))}function c(u){const h=u,f=zi.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(Vw(t,h.target)!=r&&(m=rg(t,e),!m))return o();m&&a(m,h)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",c)}function v2(t,e,n){if(!(t.state.selection instanceof He))return null;const{$head:r}=t.state.selection;for(let s=r.depth-1;s>=0;s--){const a=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole=="cell"||a.type.spec.tableRole=="header_cell"){const o=r.before(s),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function Vw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function rg(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:s}=n;return r>=0&&Ja(t.state.doc.resolve(r))||Ja(t.state.doc.resolve(s))}var m$=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),lx(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,lx(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function lx(t,e,n,r,s,a){let o=0,c=!0,u=e.firstChild;const h=t.firstChild;if(h){for(let m=0,g=0;mnew r(m,n,g)),new x$(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=jr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{y$(o,c,t,s)},mouseleave:o=>{v$(o)},mousedown:(o,c)=>{b$(o,c,e,n)}},decorations:o=>{const c=jr.getState(o);if(c&&c.activeHandle>-1)return S$(o,c.activeHandle)},nodeViews:{}}});return a}var x$=class Bu{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(jr);if(r&&r.setHandle!=null)return new Bu(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Bu(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let s=e.mapping.map(n.activeHandle,-1);return ax(e.doc.resolve(s))||(s=-1),new Bu(s,n.dragging)}return n}};function y$(t,e,n,r){if(!t.editable)return;const s=jr.getState(t.state);if(s&&!s.dragging){const a=N$(e.target);let o=-1;if(a){const{left:c,right:u}=a.getBoundingClientRect();e.clientX-c<=n?o=Hw(t,e,"left",n):u-e.clientX<=n&&(o=Hw(t,e,"right",n))}if(o!=s.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=qt.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}b2(t,o)}}}function v$(t){if(!t.editable)return;const e=jr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&b2(t,-1)}function b$(t,e,n,r){var s;if(!t.editable)return!1;const a=(s=t.dom.ownerDocument.defaultView)!==null&&s!==void 0?s:window,o=jr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=w$(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(jr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){a.removeEventListener("mouseup",h),a.removeEventListener("mousemove",f);const g=jr.getState(t.state);g!=null&&g.dragging&&(j$(t,g.activeHandle,Ww(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(jr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=jr.getState(t.state);if(g&&g.dragging){const y=Ww(g.dragging,m,n);Uw(t,g.activeHandle,y,r)}}return Uw(t,o.activeHandle,u,r),a.addEventListener("mouseup",h),a.addEventListener("mousemove",f),e.preventDefault(),!0}function w$(t,e,{colspan:n,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const a=t.domAtPos(e);let o=a.node.childNodes[a.offset].offsetWidth,c=n;if(r)for(let u=0;u{var e,n;const r=t.getAttribute("colwidth"),s=r?r.split(",").map(a=>parseInt(a,10)):null;if(!s){const a=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&a&&a[o]){const c=a[o].getAttribute("width");return c?[parseInt(c,10)]:null}}return s}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",bt(this.options.HTMLAttributes,t),0]}}),N2=fn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",bt(this.options.HTMLAttributes,t),0]}}),j2=fn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",bt(this.options.HTMLAttributes,t),0]}});function cx(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Kw(t,e,n,r,s,a){var o;let c=0,u=!0,h=e.firstChild;const f=t.firstChild;if(f!==null)for(let g=0,y=0;g{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function A$(t,e,n,r,s){const a=M$(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!R$(e))return!1;let n=0;const r=iC(e.ranges[0].$from,a=>a.type.name==="table");return r==null||r.node.descendants(a=>{if(a.type.name==="table")return!1;["tableCell","tableHeader"].includes(a.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},I$="";function P$(t){return(t||"").replace(/\s+/g," ").trim()}function O$(t,e,n={}){var r;const s=(r=n.cellLineSeparator)!=null?r:I$;if(!t||!t.content||t.content.length===0)return"";const a=[];t.content.forEach(v=>{const j=[];v.content&&v.content.forEach(w=>{let k="";w.content&&Array.isArray(w.content)&&w.content.length>1?k=w.content.map(D=>e.renderChildren(D)).join(s):k=w.content?e.renderChildren(w.content):"";const E=P$(k),C=w.type==="tableHeader";j.push({text:E,isHeader:C})}),a.push(j)});const o=a.reduce((v,j)=>Math.max(v,j.length),0);if(o===0)return"";const c=new Array(o).fill(0);a.forEach(v=>{var j;for(let w=0;wc[w]&&(c[w]=E),c[w]<3&&(c[w]=3)}});const u=(v,j)=>v+" ".repeat(Math.max(0,j-v.length)),h=a[0],f=h.some(v=>v.isHeader);let m=` +`;const g=new Array(o).fill(0).map((v,j)=>f&&h[j]&&h[j].text||"");return m+=`| ${g.map((v,j)=>u(v,c[j])).join(" | ")} | +`,m+=`| ${c.map(v=>"-".repeat(Math.max(3,v))).join(" | ")} | +`,(f?a.slice(1):a).forEach(v=>{m+=`| ${new Array(o).fill(0).map((j,w)=>u(v[w]&&v[w].text||"",c[w])).join(" | ")} | +`}),m}var D$=O$,k2=fn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:E$,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=T$(t,this.options.cellMinWidth),a=e.style;function o(){return a||(r?`width: ${r}`:`min-width: ${s}`)}const c=["table",bt(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},c]:c},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(s=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const s=[];r.forEach(a=>{s.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>D$(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:a})=>{const o=A$(a.schema,t,e,n);if(s){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(He.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>U7(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>K7(t,e),deleteColumn:()=>({state:t,dispatch:e})=>G7(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Y7(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Q7(t,e),deleteRow:()=>({state:t,dispatch:e})=>Z7(t,e),deleteTable:()=>({state:t,dispatch:e})=>a$(t,e),mergeCells:()=>({state:t,dispatch:e})=>Dw(t,e),splitCell:()=>({state:t,dispatch:e})=>Lw(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>zc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>zc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>s$(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Dw(t,e)?!0:Lw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>n$(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>zw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>zw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&g2(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=St.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Au,"Mod-Backspace":Au,Delete:Au,"Mod-Delete":Au}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[g$({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],C$({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:mt($e(t,"tableRole",e))}}});Gt.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(k2.configure(this.options.table)),this.options.tableCell!==!1&&t.push(w2.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(N2.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(j2.configure(this.options.tableRow)),t}});function L$(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 + +`),e=e.replace(/]*>(.*?)<\/h2>/gi,`## $1 + +`),e=e.replace(/]*>(.*?)<\/h3>/gi,`### $1 + +`),e=e.replace(/]*>(.*?)<\/strong>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/b>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/em>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/i>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/s>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/del>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/code>/gi,"`$1`"),e=e.replace(/]*>(.*?)<\/blockquote>/gi,`> $1 + +`),e=e.replace(/]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi,"![$2]($1)"),e=e.replace(/]*src="([^"]*)"[^>]*>/gi,"![]($1)"),e=e.replace(/]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi,"[$2]($1)"),e=e.replace(/]*>(.*?)<\/li>/gi,`- $1 +`),e=e.replace(/<\/?[uo]l[^>]*>/gi,` +`),e=e.replace(//gi,` +`),e=e.replace(/]*>(.*?)<\/p>/gi,`$1 + +`),e=e.replace(//gi,`--- + +`),e=e.replace(/]*data-type="mention"[^>]*data-id="([^"]*)"[^>]*>@([^<]*)<\/span>/gi,"@$2"),e=e.replace(/]*data-type="linkTag"[^>]*data-url="([^"]*)"[^>]*>#([^<]*)<\/span>/gi,"#[$2]($1)"),e=e.replace(/<[^>]+>/g,""),e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"),e=e.replace(/\n{3,}/g,` + +`),e.trim()}function Gw(t){if(!t)return"";if(t.startsWith("<")&&t.includes("$1"),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 _$=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}}}}),S2=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(Gw(t)),v=I_({extensions:[v7,N7.configure({inline:!0,allowBase64:!0}),Tz.configure({openOnClick:!1,HTMLAttributes:{class:"rich-link"}}),T7.configure({HTMLAttributes:{class:"mention-tag"},suggestion:_$(r)}),M7.configure({placeholder:a}),k2.configure({resizable:!0}),j2,w2,N2],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:()=>L$((v==null?void 0:v.getHTML())||"")})),b.useEffect(()=>{if(v&&t!==v.getHTML()){const E=Gw(t);E!==v.getHTML()&&v.commands.setContent(E)}},[t]);const j=b.useCallback(async E=>{var M;const C=(M=E.target.files)==null?void 0:M[0];if(!(!C||!v)){if(n){const D=await n(C);D&&v.chain().focus().setImage({src:D}).run()}else{const D=new FileReader;D.onload=()=>{typeof D.result=="string"&&v.chain().focus().setImage({src:D.result}).run()},D.readAsDataURL(C)}E.target.value=""}},[v,n]),w=b.useCallback(E=>{v&&v.chain().focus().insertContent({type:"text",marks:[{type:"link",attrs:{href:E.url,target:"_blank"}}],text:`#${E.label}`}).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(RT,{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(AM,{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(CA,{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(QT,{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(bM,{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(NM,{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(kM,{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(FM,{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(zM,{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(uA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().setHorizontalRule().run(),type:"button",children:i.jsx(QM,{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(zN,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>g(!m),className:v.isActive("link")?"is-active":"",type:"button",children:i.jsx(xg,{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(TA,{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(DA,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v.chain().focus().redo().run(),disabled:!v.can().redo(),type:"button",children:i.jsx(fA,{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(M=>M.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(OC,{editor:v})]}):null});S2.displayName="RichEditor";const z$=["top","right","bottom","left"],ta=Math.min,wr=Math.max,$h=Math.round,Ru=Math.floor,js=t=>({x:t,y:t}),$$={left:"right",right:"left",bottom:"top",top:"bottom"},F$={start:"end",end:"start"};function dx(t,e,n){return wr(t,ta(e,n))}function Zs(t,e){return typeof t=="function"?t(e):t}function ei(t){return t.split("-")[0]}function pl(t){return t.split("-")[1]}function R0(t){return t==="x"?"y":"x"}function I0(t){return t==="y"?"height":"width"}const B$=new Set(["top","bottom"]);function ws(t){return B$.has(ei(t))?"y":"x"}function P0(t){return R0(ws(t))}function V$(t,e,n){n===void 0&&(n=!1);const r=pl(t),s=P0(t),a=I0(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(o=Fh(o)),[o,Fh(o)]}function H$(t){const e=Fh(t);return[ux(t),e,ux(e)]}function ux(t){return t.replace(/start|end/g,e=>F$[e])}const Jw=["left","right"],Yw=["right","left"],W$=["top","bottom"],U$=["bottom","top"];function K$(t,e,n){switch(t){case"top":case"bottom":return n?e?Yw:Jw:e?Jw:Yw;case"left":case"right":return e?W$:U$;default:return[]}}function q$(t,e,n,r){const s=pl(t);let a=K$(ei(t),n==="start",r);return s&&(a=a.map(o=>o+"-"+s),e&&(a=a.concat(a.map(ux)))),a}function Fh(t){return t.replace(/left|right|bottom|top/g,e=>$$[e])}function G$(t){return{top:0,right:0,bottom:0,left:0,...t}}function C2(t){return typeof t!="number"?G$(t):{top:t,right:t,bottom:t,left:t}}function Bh(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 Qw(t,e,n){let{reference:r,floating:s}=t;const a=ws(e),o=P0(e),c=I0(o),u=ei(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 J$(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}=Zs(e,t),v=C2(y),w=c[g?m==="floating"?"reference":"floating":m],k=Bh(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)),M=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},D=Bh(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:C,strategy:u}):E);return{top:(k.top-D.top+v.top)/M.y,bottom:(D.bottom-k.bottom+v.bottom)/M.y,left:(k.left-D.left+v.left)/M.x,right:(D.right-k.right+v.right)/M.x}}const Y$=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}=Qw(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}=Zs(t,e)||{};if(h==null)return{};const m=C2(f),g={x:n,y:r},y=P0(s),v=I0(y),j=await o.getDimensions(h),w=y==="y",k=w?"top":"left",E=w?"bottom":"right",C=w?"clientHeight":"clientWidth",M=a.reference[v]+a.reference[y]-g[y]-a.floating[v],D=g[y]-a.reference[y],F=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let R=F?F[C]:0;(!R||!await(o.isElement==null?void 0:o.isElement(F)))&&(R=c.floating[C]||a.floating[v]);const I=M/2-D/2,A=R/2-j[v]/2-1,O=ta(m[k],A),W=ta(m[E],A),X=O,q=R-j[v]-W,Z=R/2-j[v]/2+I,_=dx(X,Z,q),$=!u.arrow&&pl(s)!=null&&Z!==_&&a.reference[v]/2-(ZZ<=0)){var W,X;const Z=(((W=a.flip)==null?void 0:W.index)||0)+1,_=R[Z];if(_&&(!(m==="alignment"?E!==ws(_):!1)||O.every(V=>ws(V.placement)===E?V.overflows[0]>0:!0)))return{data:{index:Z,overflows:O},reset:{placement:_}};let $=(X=O.filter(oe=>oe.overflows[0]<=0).sort((oe,V)=>oe.overflows[1]-V.overflows[1])[0])==null?void 0:X.placement;if(!$)switch(y){case"bestFit":{var q;const oe=(q=O.filter(V=>{if(F){const ae=ws(V.placement);return ae===E||ae==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(ae=>ae>0).reduce((ae,Y)=>ae+Y,0)]).sort((V,ae)=>V[1]-ae[1])[0])==null?void 0:q[0];oe&&($=oe);break}case"initialPlacement":$=c;break}if(s!==$)return{reset:{placement:$}}}return{}}}};function Xw(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Zw(t){return z$.some(e=>t[e]>=0)}const Z$=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...a}=Zs(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...a,elementContext:"reference"}),c=Xw(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Zw(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...a,altBoundary:!0}),c=Xw(o,n.floating);return{data:{escapedOffsets:c,escaped:Zw(c)}}}default:return{}}}}},E2=new Set(["left","top"]);async function eF(t,e){const{placement:n,platform:r,elements:s}=t,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=ei(n),c=pl(n),u=ws(n)==="y",h=E2.has(o)?-1:1,f=a&&u?-1:1,m=Zs(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 tF=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 eF(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}}}}},nF=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}=Zs(t,e),f={x:n,y:r},m=await a.detectOverflow(e,h),g=ws(ei(s)),y=R0(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],M=v-m[E];v=dx(C,v,M)}if(c){const k=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=j+m[k],M=j-m[E];j=dx(C,j,M)}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}}}}}},rF=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}=Zs(t,e),f={x:n,y:r},m=ws(s),g=R0(m);let y=f[g],v=f[m];const j=Zs(c,e),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(u){const C=g==="y"?"height":"width",M=a.reference[g]-a.floating[C]+w.mainAxis,D=a.reference[g]+a.reference[C]-w.mainAxis;yD&&(y=D)}if(h){var k,E;const C=g==="y"?"width":"height",M=E2.has(ei(s)),D=a.reference[m]-a.floating[C]+(M&&((k=o.offset)==null?void 0:k[m])||0)+(M?0:w.crossAxis),F=a.reference[m]+a.reference[C]+(M?0:((E=o.offset)==null?void 0:E[m])||0)-(M?w.crossAxis:0);vF&&(v=F)}return{[g]:y,[m]:v}}}},sF=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}=Zs(t,e),f=await o.detectOverflow(e,h),m=ei(s),g=pl(s),y=ws(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,M=ta(j-f[w],E),D=ta(v-f[k],C),F=!e.middlewareData.shift;let R=M,I=D;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(I=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(R=E),F&&!g){const O=wr(f.left,0),W=wr(f.right,0),X=wr(f.top,0),q=wr(f.bottom,0);y?I=v-2*(O!==0||W!==0?O+W:wr(f.left,f.right)):R=j-2*(X!==0||q!==0?X+q:wr(f.top,f.bottom))}await u({...e,availableWidth:I,availableHeight:R});const A=await o.getDimensions(c.floating);return v!==A.width||j!==A.height?{reset:{rects:!0}}:{}}}};function yf(){return typeof window<"u"}function ml(t){return T2(t)?(t.nodeName||"").toLowerCase():"#document"}function Sr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ts(t){var e;return(e=(T2(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function T2(t){return yf()?t instanceof Node||t instanceof Sr(t).Node:!1}function es(t){return yf()?t instanceof Element||t instanceof Sr(t).Element:!1}function Cs(t){return yf()?t instanceof HTMLElement||t instanceof Sr(t).HTMLElement:!1}function eN(t){return!yf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Sr(t).ShadowRoot}const iF=new Set(["inline","contents"]);function Jc(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=ts(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!iF.has(s)}const aF=new Set(["table","td","th"]);function oF(t){return aF.has(ml(t))}const lF=[":popover-open",":modal"];function vf(t){return lF.some(e=>{try{return t.matches(e)}catch{return!1}})}const cF=["transform","translate","scale","rotate","perspective"],dF=["transform","translate","scale","rotate","perspective","filter"],uF=["paint","layout","strict","content"];function O0(t){const e=D0(),n=es(t)?ts(t):t;return cF.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)||dF.some(r=>(n.willChange||"").includes(r))||uF.some(r=>(n.contain||"").includes(r))}function hF(t){let e=na(t);for(;Cs(e)&&!il(e);){if(O0(e))return e;if(vf(e))return null;e=na(e)}return null}function D0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const fF=new Set(["html","body","#document"]);function il(t){return fF.has(ml(t))}function ts(t){return Sr(t).getComputedStyle(t)}function bf(t){return es(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function na(t){if(ml(t)==="html")return t;const e=t.assignedSlot||t.parentNode||eN(t)&&t.host||Ts(t);return eN(e)?e.host:e}function M2(t){const e=na(t);return il(e)?t.ownerDocument?t.ownerDocument.body:t.body:Cs(e)&&Jc(e)?e:M2(e)}function $c(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=M2(t),a=s===((r=t.ownerDocument)==null?void 0:r.body),o=Sr(s);if(a){const c=hx(o);return e.concat(o,o.visualViewport||[],Jc(s)?s:[],c&&n?$c(c):[])}return e.concat(s,$c(s,[],n))}function hx(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function A2(t){const e=ts(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Cs(t),a=s?t.offsetWidth:n,o=s?t.offsetHeight:r,c=$h(n)!==a||$h(r)!==o;return c&&(n=a,r=o),{width:n,height:r,$:c}}function L0(t){return es(t)?t:t.contextElement}function Go(t){const e=L0(t);if(!Cs(e))return js(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:a}=A2(e);let o=(a?$h(n.width):n.width)/r,c=(a?$h(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const pF=js(0);function R2(t){const e=Sr(t);return!D0()||!e.visualViewport?pF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function mF(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Sr(t)?!1:e}function Qa(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=L0(t);let o=js(1);e&&(r?es(r)&&(o=Go(r)):o=Go(t));const c=mF(a,n,r)?R2(a):js(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=Sr(a),y=r&&es(r)?Sr(r):r;let v=g,j=hx(v);for(;j&&r&&y!==v;){const w=Go(j),k=j.getBoundingClientRect(),E=ts(j),C=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*w.x,M=k.top+(j.clientTop+parseFloat(E.paddingTop))*w.y;u*=w.x,h*=w.y,f*=w.x,m*=w.y,u+=C,h+=M,v=Sr(j),j=hx(v)}}return Bh({width:f,height:m,x:u,y:h})}function wf(t,e){const n=bf(t).scrollLeft;return e?e.left+n:Qa(Ts(t)).left+n}function I2(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-wf(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function gF(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const a=s==="fixed",o=Ts(r),c=e?vf(e.floating):!1;if(r===o||c&&a)return n;let u={scrollLeft:0,scrollTop:0},h=js(1);const f=js(0),m=Cs(r);if((m||!m&&!a)&&((ml(r)!=="body"||Jc(o))&&(u=bf(r)),Cs(r))){const y=Qa(r);h=Go(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=o&&!m&&!a?I2(o,u):js(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 xF(t){return Array.from(t.getClientRects())}function yF(t){const e=Ts(t),n=bf(t),r=t.ownerDocument.body,s=wr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=wr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+wf(t);const c=-n.scrollTop;return ts(r).direction==="rtl"&&(o+=wr(e.clientWidth,r.clientWidth)-s),{width:s,height:a,x:o,y:c}}const tN=25;function vF(t,e){const n=Sr(t),r=Ts(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=D0();(!f||f&&e==="fixed")&&(c=s.offsetLeft,u=s.offsetTop)}const h=wf(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<=tN&&(a-=v)}else h<=tN&&(a+=h);return{width:a,height:o,x:c,y:u}}const bF=new Set(["absolute","fixed"]);function wF(t,e){const n=Qa(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,a=Cs(t)?Go(t):js(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 nN(t,e,n){let r;if(e==="viewport")r=vF(t,n);else if(e==="document")r=yF(Ts(t));else if(es(e))r=wF(e,n);else{const s=R2(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Bh(r)}function P2(t,e){const n=na(t);return n===e||!es(n)||il(n)?!1:ts(n).position==="fixed"||P2(n,e)}function NF(t,e){const n=e.get(t);if(n)return n;let r=$c(t,[],!1).filter(c=>es(c)&&ml(c)!=="body"),s=null;const a=ts(t).position==="fixed";let o=a?na(t):t;for(;es(o)&&!il(o);){const c=ts(o),u=O0(o);!u&&c.position==="fixed"&&(s=null),(a?!u&&!s:!u&&c.position==="static"&&!!s&&bF.has(s.position)||Jc(o)&&!u&&P2(t,o))?r=r.filter(f=>f!==o):s=c,o=na(o)}return e.set(t,r),r}function jF(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?vf(e)?[]:NF(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=nN(e,f,s);return h.top=wr(m.top,h.top),h.right=ta(m.right,h.right),h.bottom=ta(m.bottom,h.bottom),h.left=wr(m.left,h.left),h},nN(e,c,s));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function kF(t){const{width:e,height:n}=A2(t);return{width:e,height:n}}function SF(t,e,n){const r=Cs(e),s=Ts(e),a=n==="fixed",o=Qa(t,!0,a,e);let c={scrollLeft:0,scrollTop:0};const u=js(0);function h(){u.x=wf(s)}if(r||!r&&!a)if((ml(e)!=="body"||Jc(s))&&(c=bf(e)),r){const y=Qa(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?I2(s,c):js(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 sg(t){return ts(t).position==="static"}function rN(t,e){if(!Cs(t)||ts(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Ts(t)===n&&(n=n.ownerDocument.body),n}function O2(t,e){const n=Sr(t);if(vf(t))return n;if(!Cs(t)){let s=na(t);for(;s&&!il(s);){if(es(s)&&!sg(s))return s;s=na(s)}return n}let r=rN(t,e);for(;r&&oF(r)&&sg(r);)r=rN(r,e);return r&&il(r)&&sg(r)&&!O0(r)?n:r||hF(t)||n}const CF=async function(t){const e=this.getOffsetParent||O2,n=this.getDimensions,r=await n(t.floating);return{reference:SF(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function EF(t){return ts(t).direction==="rtl"}const TF={convertOffsetParentRelativeRectToViewportRelativeRect:gF,getDocumentElement:Ts,getClippingRect:jF,getOffsetParent:O2,getElementRects:CF,getClientRects:xF,getDimensions:kF,getScale:Go,isElement:es,isRTL:EF};function D2(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function MF(t,e){let n=null,r;const s=Ts(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=Ru(m),j=Ru(s.clientWidth-(f+g)),w=Ru(s.clientHeight-(m+y)),k=Ru(f),C={rootMargin:-v+"px "+-j+"px "+-w+"px "+-k+"px",threshold:wr(0,ta(1,u))||1};let M=!0;function D(F){const R=F[0].intersectionRatio;if(R!==u){if(!M)return o();R?o(!1,R):r=setTimeout(()=>{o(!1,1e-7)},1e3)}R===1&&!D2(h,t.getBoundingClientRect())&&o(),M=!1}try{n=new IntersectionObserver(D,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(D,C)}n.observe(t)}return o(!0),a}function AF(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=L0(t),f=s||a?[...h?$c(h):[],...$c(e)]:[];f.forEach(k=>{s&&k.addEventListener("scroll",n,{passive:!0}),a&&k.addEventListener("resize",n)});const m=h&&c?MF(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?Qa(t):null;u&&w();function w(){const k=Qa(t);j&&!D2(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 RF=tF,IF=nF,PF=X$,OF=sF,DF=Z$,sN=Q$,LF=rF,_F=(t,e,n)=>{const r=new Map,s={platform:TF,...n},a={...s.platform,_c:r};return Y$(t,e,{...s,platform:a})};var zF=typeof document<"u",$F=function(){},Vu=zF?b.useLayoutEffect:$F;function Vh(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(!Vh(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)&&!Vh(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function L2(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function iN(t,e){const n=L2(t);return Math.round(e*n)/n}function ig(t){const e=b.useRef(t);return Vu(()=>{e.current=t}),e}function FF(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);Vh(g,r)||y(r);const[v,j]=b.useState(null),[w,k]=b.useState(null),E=b.useCallback(V=>{V!==F.current&&(F.current=V,j(V))},[]),C=b.useCallback(V=>{V!==R.current&&(R.current=V,k(V))},[]),M=a||v,D=o||w,F=b.useRef(null),R=b.useRef(null),I=b.useRef(f),A=u!=null,O=ig(u),W=ig(s),X=ig(h),q=b.useCallback(()=>{if(!F.current||!R.current)return;const V={placement:e,strategy:n,middleware:g};W.current&&(V.platform=W.current),_F(F.current,R.current,V).then(ae=>{const Y={...ae,isPositioned:X.current!==!1};Z.current&&!Vh(I.current,Y)&&(I.current=Y,Bc.flushSync(()=>{m(Y)}))})},[g,e,n,W,X]);Vu(()=>{h===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,m(V=>({...V,isPositioned:!1})))},[h]);const Z=b.useRef(!1);Vu(()=>(Z.current=!0,()=>{Z.current=!1}),[]),Vu(()=>{if(M&&(F.current=M),D&&(R.current=D),M&&D){if(O.current)return O.current(M,D,q);q()}},[M,D,q,O,A]);const _=b.useMemo(()=>({reference:F,floating:R,setReference:E,setFloating:C}),[E,C]),$=b.useMemo(()=>({reference:M,floating:D}),[M,D]),oe=b.useMemo(()=>{const V={position:n,left:0,top:0};if(!$.floating)return V;const ae=iN($.floating,f.x),Y=iN($.floating,f.y);return c?{...V,transform:"translate("+ae+"px, "+Y+"px)",...L2($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ae,top:Y}},[n,c,$.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:q,refs:_,elements:$,floatingStyles:oe}),[f,q,_,$,oe])}const BF=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?sN({element:r.current,padding:s}).fn(n):{}:r?sN({element:r,padding:s}).fn(n):{}}}},VF=(t,e)=>({...RF(t),options:[t,e]}),HF=(t,e)=>({...IF(t),options:[t,e]}),WF=(t,e)=>({...LF(t),options:[t,e]}),UF=(t,e)=>({...PF(t),options:[t,e]}),KF=(t,e)=>({...OF(t),options:[t,e]}),qF=(t,e)=>({...DF(t),options:[t,e]}),GF=(t,e)=>({...BF(t),options:[t,e]});var JF="Arrow",_2=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...a}=t;return i.jsx(ot.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"})})});_2.displayName=JF;var YF=_2,_0="Popper",[z2,$2]=aa(_0),[QF,F2]=z2(_0),B2=t=>{const{__scopePopper:e,children:n}=t,[r,s]=b.useState(null);return i.jsx(QF,{scope:e,anchor:r,onAnchorChange:s,children:n})};B2.displayName=_0;var V2="PopperAnchor",H2=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,a=F2(V2,n),o=b.useRef(null),c=gt(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(ot.div,{...s,ref:c})});H2.displayName=V2;var z0="PopperContent",[XF,ZF]=z2(z0),W2=b.forwardRef((t,e)=>{var ee,de,Ce,B,me,Se;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=F2(z0,n),[k,E]=b.useState(null),C=gt(e,rt=>E(rt)),[M,D]=b.useState(null),F=zx(M),R=(F==null?void 0:F.width)??0,I=(F==null?void 0:F.height)??0,A=r+(a!=="center"?"-"+a:""),O=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},W=Array.isArray(h)?h:[h],X=W.length>0,q={padding:O,boundary:W.filter(tB),altBoundary:X},{refs:Z,floatingStyles:_,placement:$,isPositioned:oe,middlewareData:V}=FF({strategy:"fixed",placement:A,whileElementsMounted:(...rt)=>AF(...rt,{animationFrame:y==="always"}),elements:{reference:w.anchor},middleware:[VF({mainAxis:s+I,alignmentAxis:o}),u&&HF({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?WF():void 0,...q}),u&&UF({...q}),KF({...q,apply:({elements:rt,rects:Ye,availableWidth:st,availableHeight:Qe})=>{const{width:Xe,height:ft}=Ye.reference,Pt=rt.floating.style;Pt.setProperty("--radix-popper-available-width",`${st}px`),Pt.setProperty("--radix-popper-available-height",`${Qe}px`),Pt.setProperty("--radix-popper-anchor-width",`${Xe}px`),Pt.setProperty("--radix-popper-anchor-height",`${ft}px`)}}),M&&GF({element:M,padding:c}),nB({arrowWidth:R,arrowHeight:I}),g&&qF({strategy:"referenceHidden",...q})]}),[ae,Y]=q2($),L=Xi(v);Vn(()=>{oe&&(L==null||L())},[oe,L]);const H=(ee=V.arrow)==null?void 0:ee.x,ue=(de=V.arrow)==null?void 0:de.y,U=((Ce=V.arrow)==null?void 0:Ce.centerOffset)!==0,[he,Q]=b.useState();return Vn(()=>{k&&Q(window.getComputedStyle(k).zIndex)},[k]),i.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{..._,transform:oe?_.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(B=V.transformOrigin)==null?void 0:B.x,(me=V.transformOrigin)==null?void 0:me.y].join(" "),...((Se=V.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:i.jsx(XF,{scope:n,placedSide:ae,onArrowChange:D,arrowX:H,arrowY:ue,shouldHideArrow:U,children:i.jsx(ot.div,{"data-side":ae,"data-align":Y,...j,ref:C,style:{...j.style,animation:oe?void 0:"none"}})})})});W2.displayName=z0;var U2="PopperArrow",eB={top:"bottom",right:"left",bottom:"top",left:"right"},K2=b.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,a=ZF(U2,r),o=eB[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(YF,{...s,ref:n,style:{...s.style,display:"block"}})})});K2.displayName=U2;function tB(t){return t!==null}var nB=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]=q2(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 q2(t){const[e,n="center"]=t.split("-");return[e,n]}var rB=B2,sB=H2,iB=W2,aB=K2,G2=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"}),oB="VisuallyHidden",lB=b.forwardRef((t,e)=>i.jsx(ot.span,{...t,ref:e,style:{...G2,...t.style}}));lB.displayName=oB;var cB=[" ","Enter","ArrowUp","ArrowDown"],dB=[" ","Enter"],Xa="Select",[Nf,jf,uB]=Dx(Xa),[gl]=aa(Xa,[uB,$2]),kf=$2(),[hB,da]=gl(Xa),[fB,pB]=gl(Xa),J2=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=kf(e),[w,k]=b.useState(null),[E,C]=b.useState(null),[M,D]=b.useState(!1),F=Qh(h),[R,I]=Va({prop:r,defaultProp:s??!1,onChange:a,caller:Xa}),[A,O]=Va({prop:o,defaultProp:c,onChange:u,caller:Xa}),W=b.useRef(null),X=w?v||!!w.closest("form"):!0,[q,Z]=b.useState(new Set),_=Array.from(q).map($=>$.props.value).join(";");return i.jsx(rB,{...j,children:i.jsxs(hB,{required:y,scope:e,trigger:w,onTriggerChange:k,valueNode:E,onValueNodeChange:C,valueNodeHasChildren:M,onValueNodeHasChildrenChange:D,contentId:qi(),value:A,onValueChange:O,open:R,onOpenChange:I,dir:F,triggerPointerDownPosRef:W,disabled:g,children:[i.jsx(Nf.Provider,{scope:e,children:i.jsx(fB,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback($=>{Z(oe=>new Set(oe).add($))},[]),onNativeOptionRemove:b.useCallback($=>{Z(oe=>{const V=new Set(oe);return V.delete($),V})},[]),children:n})}),X?i.jsxs(xE,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:A,onChange:$=>O($.target.value),disabled:g,form:v,children:[A===void 0?i.jsx("option",{value:""}):null,Array.from(q)]},_):null]})})};J2.displayName=Xa;var Y2="SelectTrigger",Q2=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,a=kf(n),o=da(Y2,n),c=o.disabled||r,u=gt(e,o.onTriggerChange),h=jf(n),f=b.useRef("touch"),[m,g,y]=vE(j=>{const w=h().filter(C=>!C.disabled),k=w.find(C=>C.value===o.value),E=bE(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(sB,{asChild:!0,...a,children:i.jsx(ot.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":yE(o.value)?"":void 0,...s,ref:u,onClick:nt(s.onClick,j=>{j.currentTarget.focus(),f.current!=="mouse"&&v(j)}),onPointerDown:nt(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:nt(s.onKeyDown,j=>{const w=m.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&g(j.key),!(w&&j.key===" ")&&cB.includes(j.key)&&(v(),j.preventDefault())})})})});Q2.displayName=Y2;var X2="SelectValue",Z2=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:a,placeholder:o="",...c}=t,u=da(X2,n),{onValueNodeHasChildrenChange:h}=u,f=a!==void 0,m=gt(e,u.onValueNodeChange);return Vn(()=>{h(f)},[h,f]),i.jsx(ot.span,{...c,ref:m,style:{pointerEvents:"none"},children:yE(u.value)?i.jsx(i.Fragment,{children:o}):a})});Z2.displayName=X2;var mB="SelectIcon",eE=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return i.jsx(ot.span,{"aria-hidden":!0,...s,ref:e,children:r||"▼"})});eE.displayName=mB;var gB="SelectPortal",tE=t=>i.jsx(Ax,{asChild:!0,...t});tE.displayName=gB;var Za="SelectContent",nE=b.forwardRef((t,e)=>{const n=da(Za,t.__scopeSelect),[r,s]=b.useState();if(Vn(()=>{s(new DocumentFragment)},[]),!n.open){const a=r;return a?Bc.createPortal(i.jsx(rE,{scope:t.__scopeSelect,children:i.jsx(Nf.Slot,{scope:t.__scopeSelect,children:i.jsx("div",{children:t.children})})}),a):null}return i.jsx(sE,{...t,ref:e})});nE.displayName=Za;var Jr=10,[rE,ua]=gl(Za),xB="SelectContentImpl",yB=Cc("SelectContent.RemoveScroll"),sE=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=da(Za,n),[C,M]=b.useState(null),[D,F]=b.useState(null),R=gt(e,ee=>M(ee)),[I,A]=b.useState(null),[O,W]=b.useState(null),X=jf(n),[q,Z]=b.useState(!1),_=b.useRef(!1);b.useEffect(()=>{if(C)return xj(C)},[C]),lj();const $=b.useCallback(ee=>{const[de,...Ce]=X().map(Se=>Se.ref.current),[B]=Ce.slice(-1),me=document.activeElement;for(const Se of ee)if(Se===me||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===de&&D&&(D.scrollTop=0),Se===B&&D&&(D.scrollTop=D.scrollHeight),Se==null||Se.focus(),document.activeElement!==me))return},[X,D]),oe=b.useCallback(()=>$([I,C]),[$,I,C]);b.useEffect(()=>{q&&oe()},[q,oe]);const{onOpenChange:V,triggerPointerDownPosRef:ae}=E;b.useEffect(()=>{if(C){let ee={x:0,y:0};const de=B=>{var me,Se;ee={x:Math.abs(Math.round(B.pageX)-(((me=ae.current)==null?void 0:me.x)??0)),y:Math.abs(Math.round(B.pageY)-(((Se=ae.current)==null?void 0:Se.y)??0))}},Ce=B=>{ee.x<=10&&ee.y<=10?B.preventDefault():C.contains(B.target)||V(!1),document.removeEventListener("pointermove",de),ae.current=null};return ae.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",Ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",Ce,{capture:!0})}}},[C,V,ae]),b.useEffect(()=>{const ee=()=>V(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[V]);const[Y,L]=vE(ee=>{const de=X().filter(me=>!me.disabled),Ce=de.find(me=>me.ref.current===document.activeElement),B=bE(de,ee,Ce);B&&setTimeout(()=>B.ref.current.focus())}),H=b.useCallback((ee,de,Ce)=>{const B=!_.current&&!Ce;(E.value!==void 0&&E.value===de||B)&&(A(ee),B&&(_.current=!0))},[E.value]),ue=b.useCallback(()=>C==null?void 0:C.focus(),[C]),U=b.useCallback((ee,de,Ce)=>{const B=!_.current&&!Ce;(E.value!==void 0&&E.value===de||B)&&W(ee)},[E.value]),he=r==="popper"?fx:iE,Q=he===fx?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:j,avoidCollisions:w}:{};return i.jsx(rE,{scope:n,content:C,viewport:D,onViewportChange:F,itemRefCallback:H,selectedItem:I,onItemLeave:ue,itemTextRefCallback:U,focusSelectedItem:oe,selectedItemText:O,position:r,isPositioned:q,searchRef:Y,children:i.jsx(Rx,{as:yB,allowPinchZoom:!0,children:i.jsx(Mx,{asChild:!0,trapped:E.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:nt(s,ee=>{var de;(de=E.trigger)==null||de.focus({preventScroll:!0}),ee.preventDefault()}),children:i.jsx(Tx,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:i.jsx(he,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:ee=>ee.preventDefault(),...k,...Q,onPlaced:()=>Z(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:nt(k.onKeyDown,ee=>{const de=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!de&&ee.key.length===1&&L(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let B=X().filter(me=>!me.disabled).map(me=>me.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(B=B.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const me=ee.target,Se=B.indexOf(me);B=B.slice(Se+1)}setTimeout(()=>$(B)),ee.preventDefault()}})})})})})})});sE.displayName=xB;var vB="SelectItemAlignedPosition",iE=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,a=da(Za,n),o=ua(Za,n),[c,u]=b.useState(null),[h,f]=b.useState(null),m=gt(e,R=>f(R)),g=jf(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(),I=h.getBoundingClientRect(),A=a.valueNode.getBoundingClientRect(),O=k.getBoundingClientRect();if(a.dir!=="rtl"){const me=O.left-I.left,Se=A.left-me,rt=R.left-Se,Ye=R.width+rt,st=Math.max(Ye,I.width),Qe=window.innerWidth-Jr,Xe=Ju(Se,[Jr,Math.max(Jr,Qe-st)]);c.style.minWidth=Ye+"px",c.style.left=Xe+"px"}else{const me=I.right-O.right,Se=window.innerWidth-A.right-me,rt=window.innerWidth-R.right-Se,Ye=R.width+rt,st=Math.max(Ye,I.width),Qe=window.innerWidth-Jr,Xe=Ju(Se,[Jr,Math.max(Jr,Qe-st)]);c.style.minWidth=Ye+"px",c.style.right=Xe+"px"}const W=g(),X=window.innerHeight-Jr*2,q=j.scrollHeight,Z=window.getComputedStyle(h),_=parseInt(Z.borderTopWidth,10),$=parseInt(Z.paddingTop,10),oe=parseInt(Z.borderBottomWidth,10),V=parseInt(Z.paddingBottom,10),ae=_+$+q+V+oe,Y=Math.min(w.offsetHeight*5,ae),L=window.getComputedStyle(j),H=parseInt(L.paddingTop,10),ue=parseInt(L.paddingBottom,10),U=R.top+R.height/2-Jr,he=X-U,Q=w.offsetHeight/2,ee=w.offsetTop+Q,de=_+$+ee,Ce=ae-de;if(de<=U){const me=W.length>0&&w===W[W.length-1].ref.current;c.style.bottom="0px";const Se=h.clientHeight-j.offsetTop-j.offsetHeight,rt=Math.max(he,Q+(me?ue:0)+Se+oe),Ye=de+rt;c.style.height=Ye+"px"}else{const me=W.length>0&&w===W[0].ref.current;c.style.top="0px";const rt=Math.max(U,_+j.offsetTop+(me?H:0)+Q)+Ce;c.style.height=rt+"px",j.scrollTop=de-U+j.offsetTop}c.style.margin=`${Jr}px 0`,c.style.minHeight=Y+"px",c.style.maxHeight=X+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,a.trigger,a.valueNode,c,h,j,w,k,a.dir,r]);Vn(()=>C(),[C]);const[M,D]=b.useState();Vn(()=>{h&&D(window.getComputedStyle(h).zIndex)},[h]);const F=b.useCallback(R=>{R&&v.current===!0&&(C(),E==null||E(),v.current=!1)},[C,E]);return i.jsx(wB,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:F,children:i.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:i.jsx(ot.div,{...s,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});iE.displayName=vB;var bB="SelectPopperPosition",fx=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Jr,...a}=t,o=kf(n);return i.jsx(iB,{...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)"}})});fx.displayName=bB;var[wB,$0]=gl(Za,{}),px="SelectViewport",aE=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,a=ua(px,n),o=$0(px,n),c=gt(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(Nf.Slot,{scope:n,children:i.jsx(ot.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:nt(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-Jr*2,j=parseFloat(m.style.minHeight),w=parseFloat(m.style.height),k=Math.max(j,w);if(k0?M:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});aE.displayName=px;var oE="SelectGroup",[NB,jB]=gl(oE),kB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=qi();return i.jsx(NB,{scope:n,id:s,children:i.jsx(ot.div,{role:"group","aria-labelledby":s,...r,ref:e})})});kB.displayName=oE;var lE="SelectLabel",SB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=jB(lE,n);return i.jsx(ot.div,{id:s.id,...r,ref:e})});SB.displayName=lE;var Hh="SelectItem",[CB,cE]=gl(Hh),dE=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:a,...o}=t,c=da(Hh,n),u=ua(Hh,n),h=c.value===r,[f,m]=b.useState(a??""),[g,y]=b.useState(!1),v=gt(e,E=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,E,r,s)}),j=qi(),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(CB,{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(Nf.ItemSlot,{scope:n,value:r,disabled:s,textValue:f,children:i.jsx(ot.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:nt(o.onFocus,()=>y(!0)),onBlur:nt(o.onBlur,()=>y(!1)),onClick:nt(o.onClick,()=>{w.current!=="mouse"&&k()}),onPointerUp:nt(o.onPointerUp,()=>{w.current==="mouse"&&k()}),onPointerDown:nt(o.onPointerDown,E=>{w.current=E.pointerType}),onPointerMove:nt(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:nt(o.onPointerLeave,E=>{var C;E.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:nt(o.onKeyDown,E=>{var M;((M=u.searchRef)==null?void 0:M.current)!==""&&E.key===" "||(dB.includes(E.key)&&k(),E.key===" "&&E.preventDefault())})})})})});dE.displayName=Hh;var lc="SelectItemText",uE=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...a}=t,o=da(lc,n),c=ua(lc,n),u=cE(lc,n),h=pB(lc,n),[f,m]=b.useState(null),g=gt(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 Vn(()=>(j(v),()=>w(v)),[j,w,v]),i.jsxs(i.Fragment,{children:[i.jsx(ot.span,{id:u.textId,...a,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Bc.createPortal(a.children,o.valueNode):null]})});uE.displayName=lc;var hE="SelectItemIndicator",fE=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return cE(hE,n).isSelected?i.jsx(ot.span,{"aria-hidden":!0,...r,ref:e}):null});fE.displayName=hE;var mx="SelectScrollUpButton",pE=b.forwardRef((t,e)=>{const n=ua(mx,t.__scopeSelect),r=$0(mx,t.__scopeSelect),[s,a]=b.useState(!1),o=gt(e,r.onScrollButtonChange);return Vn(()=>{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(gE,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});pE.displayName=mx;var gx="SelectScrollDownButton",mE=b.forwardRef((t,e)=>{const n=ua(gx,t.__scopeSelect),r=$0(gx,t.__scopeSelect),[s,a]=b.useState(!1),o=gt(e,r.onScrollButtonChange);return Vn(()=>{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(gE,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});mE.displayName=gx;var gE=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,a=ua("SelectScrollButton",n),o=b.useRef(null),c=jf(n),u=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>u(),[u]),Vn(()=>{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(ot.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:nt(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:nt(s.onPointerMove,()=>{var h;(h=a.onItemLeave)==null||h.call(a),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:nt(s.onPointerLeave,()=>{u()})})}),EB="SelectSeparator",TB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return i.jsx(ot.div,{"aria-hidden":!0,...r,ref:e})});TB.displayName=EB;var xx="SelectArrow",MB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=kf(n),a=da(xx,n),o=ua(xx,n);return a.open&&o.position==="popper"?i.jsx(aB,{...s,...r,ref:e}):null});MB.displayName=xx;var AB="SelectBubbleInput",xE=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const s=b.useRef(null),a=gt(r,s),o=_x(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(ot.select,{...n,style:{...G2,...n.style},ref:a,defaultValue:e})});xE.displayName=AB;function yE(t){return t===""||t===void 0}function vE(t){const e=Xi(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 bE(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=RB(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 RB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var IB=J2,wE=Q2,PB=Z2,OB=eE,DB=tE,NE=nE,LB=aE,jE=dE,_B=uE,zB=fE,$B=pE,FB=mE;const tc=IB,nc=PB,$o=b.forwardRef(({className:t,children:e,...n},r)=>i.jsxs(wE,{ref:r,className:xt("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(OB,{asChild:!0,children:i.jsx(Jo,{className:"h-4 w-4 opacity-50"})})]}));$o.displayName=wE.displayName;const Fo=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>i.jsx(DB,{children:i.jsxs(NE,{ref:s,className:xt("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($B,{className:"flex cursor-default items-center justify-center py-1",children:i.jsx(jx,{className:"h-4 w-4"})}),i.jsx(LB,{className:"p-1",children:e}),i.jsx(FB,{className:"flex cursor-default items-center justify-center py-1",children:i.jsx(Jo,{className:"h-4 w-4"})})]})}));Fo.displayName=NE.displayName;const xs=b.forwardRef(({className:t,children:e,...n},r)=>i.jsxs(jE,{ref:r,className:xt("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(zB,{children:i.jsx(Kh,{className:"h-4 w-4"})})}),i.jsx(_B,{children:e})]}));xs.displayName=jE.displayName;const BB=["一","二","三","四","五","六","七","八","九","十"];function ag(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 VB({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),M=(O,W)=>(w==null?void 0:w.type)===O&&(w==null?void 0:w.id)===W,D=(O,W)=>(E==null?void 0:E.type)===O&&(E==null?void 0:E.id)===W,F=b.useCallback(()=>{const O=[];for(const W of t)for(const X of W.chapters)for(const q of X.sections)O.push({id:q.id,partId:W.id,partTitle:W.title,chapterId:X.id,chapterTitle:X.title});return O},[t]),R=b.useCallback(async(O,W,X,q)=>{var V;O.preventDefault(),O.stopPropagation();const Z=O.dataTransfer.getData("text/plain"),_=ag(Z);if(!_||_.type===W&&_.id===X)return;const $=F(),oe=new Map($.map(ae=>[ae.id,ae]));if(_.type==="part"&&W==="part"){const ae=t.map(U=>U.id),Y=ae.indexOf(_.id),L=ae.indexOf(X);if(Y===-1||L===-1)return;const H=[...ae];H.splice(Y,1),H.splice(YQ.id===U);if(he)for(const Q of he.chapters)for(const ee of Q.sections){const de=oe.get(ee.id);de&&ue.push(de)}}await r(ue);return}if(_.type==="chapter"&&(W==="chapter"||W==="section"||W==="part")){const ae=t.find(de=>de.chapters.some(Ce=>Ce.id===_.id)),Y=ae==null?void 0:ae.chapters.find(de=>de.id===_.id);if(!ae||!Y)return;let L,H,ue=null;if(W==="section"){const de=oe.get(X);if(!de)return;L=de.partId,H=de.partTitle,ue=X}else if(W==="chapter"){const de=t.find(me=>me.chapters.some(Se=>Se.id===X)),Ce=de==null?void 0:de.chapters.find(me=>me.id===X);if(!de||!Ce)return;L=de.id,H=de.title;const B=$.filter(me=>me.chapterId===X).pop();ue=(B==null?void 0:B.id)??null}else{const de=t.find(B=>B.id===X);if(!de||!de.chapters[0])return;L=de.id,H=de.title;const Ce=$.filter(B=>B.partId===de.id&&B.chapterId===de.chapters[0].id);ue=((V=Ce[Ce.length-1])==null?void 0:V.id)??null}const U=Y.sections.map(de=>de.id),he=$.filter(de=>!U.includes(de.id));let Q=he.length;if(ue){const de=he.findIndex(Ce=>Ce.id===ue);de>=0&&(Q=de+1)}const ee=U.map(de=>({...oe.get(de),partId:L,partTitle:H,chapterId:Y.id,chapterTitle:Y.title}));await r([...he.slice(0,Q),...ee,...he.slice(Q)]);return}if(_.type==="section"&&(W==="section"||W==="chapter"||W==="part")){if(!q)return;const{partId:ae,partTitle:Y,chapterId:L,chapterTitle:H}=q;let ue;if(W==="section")ue=$.findIndex(Ce=>Ce.id===X);else if(W==="chapter"){const Ce=$.filter(B=>B.chapterId===X).pop();ue=Ce?$.findIndex(B=>B.id===Ce.id)+1:$.length}else{const Ce=t.find(Se=>Se.id===X);if(!(Ce!=null&&Ce.chapters[0]))return;const B=$.filter(Se=>Se.partId===Ce.id&&Se.chapterId===Ce.chapters[0].id),me=B[B.length-1];ue=me?$.findIndex(Se=>Se.id===me.id)+1:0}const U=$.findIndex(Ce=>Ce.id===_.id);if(U===-1)return;const he=$.filter(Ce=>Ce.id!==_.id),Q=U({onDragEnter:q=>{q.preventDefault(),q.stopPropagation(),q.dataTransfer.dropEffect="move",C({type:O,id:W})},onDragOver:q=>{q.preventDefault(),q.stopPropagation(),q.dataTransfer.dropEffect="move",C({type:O,id:W})},onDragLeave:()=>C(null),onDrop:q=>{C(null);const Z=ag(q.dataTransfer.getData("text/plain"));if(Z&&!(O==="section"&&Z.type==="section"&&Z.id===W))if(O==="part")if(Z.type==="part")R(q,"part",W);else{const _=t.find(oe=>oe.id===W);(_==null?void 0:_.chapters[0])&&X&&R(q,"part",W,X)}else O==="chapter"&&X?(Z.type==="section"||Z.type==="chapter")&&R(q,"chapter",W,X):O==="section"&&X&&R(q,"section",W,X)}}),A=O=>BB[O]??String(O+1);return i.jsx("div",{className:"space-y-3",children:t.map((O,W)=>{var Y,L,H,ue;const X=O.title==="序言"||O.title.includes("序言"),q=O.title==="尾声"||O.title.includes("尾声"),Z=O.title==="附录"||O.title.includes("附录"),_=D("part",O.id),$=e.includes(O.id),oe=O.chapters.length,V=O.chapters.reduce((U,he)=>U+he.sections.length,0);if(X&&O.chapters.length===1&&O.chapters[0].sections.length===1){const U=O.chapters[0].sections[0],he=D("section",U.id),Q={partId:O.id,partTitle:O.title,chapterId:O.chapters[0].id,chapterTitle:O.chapters[0].title};return i.jsxs("div",{draggable:!0,onDragStart:ee=>{ee.stopPropagation(),ee.dataTransfer.setData("text/plain","section:"+U.id),ee.dataTransfer.effectAllowed="move",k({type:"section",id:U.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] ${he?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${M("section",U.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",U.id,Q),children:[i.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[i.jsx($s,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ee=>ee.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(U.id),onChange:()=>y(U.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(zr,{className:"w-4 h-4 text-gray-400"})}),i.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[O.chapters[0].title," | ",U.title]}),j.includes(U.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Ho,{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:ee=>ee.stopPropagation(),onClick:ee=>ee.stopPropagation(),children:[U.price===0||U.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:["¥",U.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",U.clickCount??0," · 付款 ",U.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(U.hotScore??0).toFixed(1)," · 第",U.hotRank&&U.hotRank>0?U.hotRank:"-","名"]}),v&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(U),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(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(U),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]})]},O.id)}if(O.title==="2026每日派对干货"||O.title.includes("2026每日派对干货")){const U=D("part",O.id);return i.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${U?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...I("part",O.id,{partId:O.id,partTitle:O.title,chapterId:((Y=O.chapters[0])==null?void 0:Y.id)??"",chapterTitle:((L=O.chapters[0])==null?void 0:L.title)??""}),children:[i.jsxs("div",{draggable:!0,onDragStart:he=>{he.stopPropagation(),he.dataTransfer.setData("text/plain","part:"+O.id),he.dataTransfer.effectAllowed="move",k({type:"part",id:O.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 ${M("part",O.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>n(O.id),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx($s,{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:O.title}),i.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",V," 节"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:he=>he.stopPropagation(),onClick:he=>he.stopPropagation(),children:[o&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:i.jsx(Lt,{className:"w-3.5 h-3.5"})}),h&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),f&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(O),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:i.jsx(vn,{className:"w-3.5 h-3.5"})}),i.jsxs("span",{className:"text-xs text-gray-500",children:[oe,"章"]}),$?i.jsx(Jo,{className:"w-5 h-5 text-gray-500"}):i.jsx(Bo,{className:"w-5 h-5 text-gray-500"})]})]}),$&&O.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:O.chapters.map(he=>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:he.title}),i.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:Q=>Q.stopPropagation(),children:[m&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>m(O,he),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),c&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>c(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:i.jsx(Lt,{className:"w-3.5 h-3.5"})}),u&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>u(O,he),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx("div",{className:"space-y-1 pl-2",children:he.sections.map(Q=>{const ee=D("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+Q.id),de.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 ${ee?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${M("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",Q.id,{partId:O.id,partTitle:O.title,chapterId:he.id,chapterTitle:he.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx($s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.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(Ho,{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(re,{variant:"ghost",size:"sm",onClick:()=>v(Q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),i.jsx(re,{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(wt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{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(vn,{className:"w-3.5 h-3.5"})})]})]},Q.id)})})]},he.id))})]},O.id)}if(Z)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:O.chapters.map((U,he)=>U.sections.length>0?U.sections.map(Q=>{const ee=D("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+Q.id),de.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 ${ee?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${M("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",Q.id,{partId:O.id,partTitle:O.title,chapterId:U.id,chapterTitle:U.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx($s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:de=>de.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:["附录",he+1," | ",U.title," | ",Q.title]}),j.includes(Q.id)&&i.jsx("span",{title:"已置顶",children:i.jsx(Ho,{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(re,{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(re,{variant:"ghost",size:"sm",onClick:()=>s(Q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>a(Q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx(Bo,{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:["附录",he+1," | ",U.title,"(空)"]}),i.jsx(Bo,{className:"w-4 h-4 text-gray-500 shrink-0"})]},U.id))})]},O.id);if(q&&O.chapters.length===1&&O.chapters[0].sections.length===1){const U=O.chapters[0].sections[0],he=D("section",U.id),Q={partId:O.id,partTitle:O.title,chapterId:O.chapters[0].id,chapterTitle:O.chapters[0].title};return i.jsxs("div",{draggable:!0,onDragStart:ee=>{ee.stopPropagation(),ee.dataTransfer.setData("text/plain","section:"+U.id),ee.dataTransfer.effectAllowed="move",k({type:"section",id:U.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] ${he?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${M("section",U.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",U.id,Q),children:[i.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[i.jsx($s,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ee=>ee.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(U.id),onChange:()=>y(U.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(zr,{className:"w-4 h-4 text-gray-400"})}),i.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[O.chapters[0].title," | ",U.title]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:ee=>ee.stopPropagation(),onClick:ee=>ee.stopPropagation(),children:[U.price===0||U.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:["¥",U.price]}),i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",U.clickCount??0," · 付款 ",U.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(U.hotScore??0).toFixed(1)," · 第",U.hotRank&&U.hotRank>0?U.hotRank:"-","名"]}),v&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(U),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(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(U),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]})]},O.id)}return q?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:O.chapters.map(U=>U.sections.map(he=>{const Q=D("section",he.id);return i.jsxs("div",{draggable:!0,onDragStart:ee=>{ee.stopPropagation(),ee.dataTransfer.setData("text/plain","section:"+he.id),ee.dataTransfer.effectAllowed="move",k({type:"section",id:he.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"} ${M("section",he.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...I("section",he.id,{partId:O.id,partTitle:O.title,chapterId:U.id,chapterTitle:U.title}),children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[i.jsx($s,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&i.jsx("label",{className:"shrink-0 flex items-center",onClick:ee=>ee.stopPropagation(),children:i.jsx("input",{type:"checkbox",checked:g.includes(he.id),onChange:()=>y(he.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:[U.title," | ",he.title]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",he.clickCount??0," · 付款 ",he.payCount??0]}),i.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(he.hotScore??0).toFixed(1)," · 第",he.hotRank&&he.hotRank>0?he.hotRank:"-","名"]}),v&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(he),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(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>s(he),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(he),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]})]},he.id)}))})]},O.id):i.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${_?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...I("part",O.id,{partId:O.id,partTitle:O.title,chapterId:((H=O.chapters[0])==null?void 0:H.id)??"",chapterTitle:((ue=O.chapters[0])==null?void 0:ue.title)??""}),children:[i.jsxs("div",{draggable:!0,onDragStart:U=>{U.stopPropagation(),U.dataTransfer.setData("text/plain","part:"+O.id),U.dataTransfer.effectAllowed="move",k({type:"part",id:O.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 ${M("part",O.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>n(O.id),children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx($s,{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:A(W)}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-bold text-white text-base",children:O.title}),i.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",V," 节"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:U=>U.stopPropagation(),onClick:U=>U.stopPropagation(),children:[o&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:i.jsx(Lt,{className:"w-3.5 h-3.5"})}),h&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),f&&i.jsx(re,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(O),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:i.jsx(vn,{className:"w-3.5 h-3.5"})}),i.jsxs("span",{className:"text-xs text-gray-500",children:[oe,"章"]}),$?i.jsx(Jo,{className:"w-5 h-5 text-gray-500"}):i.jsx(Bo,{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:O.chapters.map(U=>{const he=D("chapter",U.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:"+U.id),Q.dataTransfer.effectAllowed="move",k({type:"chapter",id:U.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:Q=>{Q.preventDefault(),Q.stopPropagation(),Q.dataTransfer.dropEffect="move",C({type:"chapter",id:U.id})},onDragOver:Q=>{Q.preventDefault(),Q.stopPropagation(),Q.dataTransfer.dropEffect="move",C({type:"chapter",id:U.id})},onDragLeave:()=>C(null),onDrop:Q=>{C(null);const ee=ag(Q.dataTransfer.getData("text/plain"));if(!ee)return;const de={partId:O.id,partTitle:O.title,chapterId:U.id,chapterTitle:U.title};(ee.type==="section"||ee.type==="chapter")&&R(Q,"chapter",U.id,de)},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 ${he?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${M("chapter",U.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[i.jsx($s,{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:U.title})]}),i.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:Q=>Q.stopPropagation(),children:[m&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>m(O,U),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:i.jsx(wt,{className:"w-3.5 h-3.5"})}),c&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>c(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:i.jsx(Lt,{className:"w-3.5 h-3.5"})}),u&&i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>u(O,U),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:i.jsx(vn,{className:"w-3.5 h-3.5"})})]})]}),i.jsx("div",{className:"space-y-1 pl-2",children:U.sections.map(Q=>{const ee=D("section",Q.id);return i.jsxs("div",{draggable:!0,onDragStart:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","section:"+Q.id),de.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 ${ee?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${M("section",Q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...I("section",Q.id,{partId:O.id,partTitle:O.title,chapterId:U.id,chapterTitle:U.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:de=>de.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($s,{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(Ho,{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:de=>de.stopPropagation(),onClick:de=>de.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(re,{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(re,{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(wt,{className:"w-3.5 h-3.5"})}),i.jsx(re,{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(vn,{className:"w-3.5 h-3.5"})})]})]})]},Q.id)})})]},U.id)})})]},O.id)})})}function HB(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 WB(){var gr,rd,rr;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),[M,D]=b.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),[F,R]=b.useState(null),[I,A]=b.useState(!1),[O,W]=b.useState(!1),[X,q]=b.useState(null),[Z,_]=b.useState(!1),[$,oe]=b.useState([]),[V,ae]=b.useState(!1),[Y,L]=b.useState(""),[H,ue]=b.useState(""),[U,he]=b.useState(!1),[Q,ee]=b.useState(""),[de,Ce]=b.useState(!1),[B,me]=b.useState(null),[Se,rt]=b.useState(!1),[Ye,st]=b.useState(!1),[Qe,Xe]=b.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[ft,Pt]=b.useState(!1),[Jt,Kn]=b.useState(!1),[qn,ss]=b.useState(1),[zt,Cr]=b.useState([]),[is,On]=b.useState(!1),[pn,mr]=b.useState(20),[Br,Gn]=b.useState(!1),[fe,ge]=b.useState(!1),[kn,ri]=b.useState([]),[Ms,ha]=b.useState([]),[Jn,as]=b.useState({personId:"",name:"",label:""}),[pt,Sn]=b.useState({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),Yn=b.useRef(null),Dn=HB(t),fa=t.length,si=[...t].sort((P,ie)=>(ie.hotScore??0)-(P.hotScore??0)),Er=10,ii=Math.max(1,Math.ceil(si.length/Er)),ai=si.slice((qn-1)*Er,qn*Er),mn=async()=>{r(!0);try{const P=await Be("/api/db/book?action=list",{cache:"no-store"});e(Array.isArray(P==null?void 0:P.sections)?P.sections:[])}catch(P){console.error(P),e([])}finally{r(!1)}};b.useEffect(()=>{mn()},[]);const ls=P=>{a(ie=>ie.includes(P)?ie.filter(Ae=>Ae!==P):[...ie,P])},oi=b.useCallback(P=>{const ie=t,Ae=P.flatMap(Re=>{const Ot=ie.find(Vt=>Vt.id===Re.id);return Ot?[{...Ot,partId:Re.partId,partTitle:Re.partTitle,chapterId:Re.chapterId,chapterTitle:Re.chapterTitle}]:[]});return e(Ae),Rt("/api/db/book",{action:"reorder",items:P}).then(Re=>{Re&&Re.success===!1&&(e(ie),alert("排序失败: "+(Re&&typeof Re=="object"&&"error"in Re?Re.error:"未知错误")))}).catch(Re=>{e(ie),console.error("排序失败:",Re),alert("排序失败: "+(Re instanceof Error?Re.message:"网络或服务异常"))}),Promise.resolve()},[t]),cs=async P=>{if(confirm(`确定要删除章节「${P.title}」吗?此操作不可恢复。`))try{const ie=await Yr(`/api/db/book?id=${encodeURIComponent(P.id)}`);ie&&ie.success!==!1?(alert("已删除"),mn()):alert("删除失败: "+(ie&&typeof ie=="object"&&"error"in ie?ie.error:"未知错误"))}catch(ie){console.error(ie),alert("删除失败")}},pa=b.useCallback(async()=>{Pt(!0);try{const P=await Be("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),ie=P&&P.data;ie&&typeof ie.readWeight=="number"&&typeof ie.recencyWeight=="number"&&typeof ie.payWeight=="number"&&Xe({readWeight:Math.max(0,Math.min(1,ie.readWeight)),recencyWeight:Math.max(0,Math.min(1,ie.recencyWeight)),payWeight:Math.max(0,Math.min(1,ie.payWeight))})}catch{}finally{Pt(!1)}},[]);b.useEffect(()=>{Ye&&pa()},[Ye,pa]);const ds=async()=>{const{readWeight:P,recencyWeight:ie,payWeight:Ae}=Qe,Re=P+ie+Ae;if(Math.abs(Re-1)>.001){alert("三个权重之和必须等于 1");return}Kn(!0);try{const Ot=await ht("/api/db/config",{key:"article_ranking_weights",value:{readWeight:P,recencyWeight:ie,payWeight:Ae},description:"文章排名算法权重"});Ot&&Ot.success!==!1?(alert("已保存"),mn()):alert("保存失败: "+(Ot&&typeof Ot=="object"&&"error"in Ot?Ot.error:""))}catch(Ot){console.error(Ot),alert("保存失败")}finally{Kn(!1)}},G=b.useCallback(async()=>{On(!0);try{const P=await Be("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),ie=P&&P.data;Array.isArray(ie)&&Cr(ie)}catch{}finally{On(!1)}},[]),Ke=b.useCallback(async()=>{try{const P=await Be("/api/db/persons");P!=null&&P.success&&P.persons&&ri(P.persons.map(ie=>({id:ie.personId,name:ie.name,label:ie.label})))}catch{}},[]),Ze=b.useCallback(async()=>{try{const P=await Be("/api/db/link-tags");P!=null&&P.success&&P.linkTags&&ha(P.linkTags.map(ie=>({id:ie.tagId,label:ie.label,url:ie.url,type:ie.type,appId:ie.appId,pagePath:ie.pagePath})))}catch{}},[]),Cn=async P=>{const ie=zt.includes(P)?zt.filter(Ae=>Ae!==P):[...zt,P];Cr(ie);try{await ht("/api/db/config",{key:"pinned_section_ids",value:ie,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{Cr(zt)}},Vr=b.useCallback(async()=>{Gn(!0);try{const P=await Be("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),ie=P&&P.data;typeof ie=="number"&&ie>0&&ie<=100&&mr(ie)}catch{}finally{Gn(!1)}},[]),Sf=async()=>{if(pn<1||pn>100){alert("预览比例需在 1~100 之间");return}ge(!0);try{const P=await ht("/api/db/config",{key:"unpaid_preview_percent",value:pn,description:"小程序未付费内容默认预览比例(%)"});P&&P.success!==!1?alert("已保存"):alert("保存失败: "+(P.error||""))}catch{alert("保存失败")}finally{ge(!1)}};b.useEffect(()=>{G(),Vr(),Ke(),Ze()},[G,Vr,Ke,Ze]);const us=async P=>{me({section:P,orders:[]}),rt(!0);try{const ie=await Be(`/api/db/book?action=section-orders&id=${encodeURIComponent(P.id)}`),Ae=ie!=null&&ie.success&&Array.isArray(ie.orders)?ie.orders:[];me(Re=>Re?{...Re,orders:Ae}:null)}catch(ie){console.error(ie),me(Ae=>Ae?{...Ae,orders:[]}:null)}finally{rt(!1)}},ro=async P=>{m(!0);try{const ie=await Be(`/api/db/book?action=read&id=${encodeURIComponent(P.id)}`);if(ie!=null&&ie.success&&ie.section){const Ae=ie.section;c({id:P.id,originalId:P.id,title:ie.section.title??P.title,price:ie.section.price??P.price,content:ie.section.content??"",filePath:P.filePath,isFree:P.isFree||P.price===0,isNew:Ae.isNew??P.isNew,isPinned:zt.includes(P.id),hotScore:P.hotScore??0})}else c({id:P.id,originalId:P.id,title:P.title,price:P.price,content:"",filePath:P.filePath,isFree:P.isFree,isNew:P.isNew,isPinned:zt.includes(P.id),hotScore:P.hotScore??0}),ie&&!ie.success&&alert("无法读取文件内容: "+(ie.error||"未知错误"))}catch(ie){console.error(ie),c({id:P.id,title:P.title,price:P.price,content:"",filePath:P.filePath,isFree:P.isFree})}finally{m(!1)}},Yc=async()=>{var P;if(o){y(!0);try{let ie=o.content||"";const Ae=[new RegExp(`^#+\\s*${o.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${o.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(P=o.title)==null?void 0:P.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const hs of Ae)ie=ie.replace(hs,"");ie=ie.replace(/^\s*\n+/,"").trim();const Re=o.originalId||o.id,Ot=o.id!==Re,Vt=await Rt("/api/db/book",{id:Re,...Ot?{newId:o.id}:{},title:o.title,price:o.isFree?0:o.price,content:ie,isFree:o.isFree||o.price===0,isNew:o.isNew,hotScore:o.hotScore,saveToFile:!0}),Ln=Ot?o.id:Re;o.isPinned!==zt.includes(Ln)&&await Cn(Ln),Vt&&Vt.success!==!1?(alert(`已保存章节: ${o.title}`),c(null),mn()):alert("保存失败: "+(Vt&&typeof Vt=="object"&&"error"in Vt?Vt.error:"未知错误"))}catch(ie){console.error(ie),alert("保存失败")}finally{y(!1)}}},Cf=async()=>{if(!M.id||!M.title){alert("请填写章节ID和标题");return}y(!0);try{const P=await Rt("/api/db/book",{id:M.id,title:M.title,price:M.price,content:M.content,partId:M.partId,chapterId:M.chapterId,saveToFile:!1});P&&P.success!==!1?(alert(`章节创建成功: ${M.title}`),h(!1),D({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),mn()):alert("创建失败: "+(P&&typeof P=="object"&&"error"in P?P.error:"未知错误"))}catch(P){console.error(P),alert("创建失败")}finally{y(!1)}},Qc=P=>{D(ie=>{var Ae;return{...ie,partId:P.id,chapterId:((Ae=P.chapters[0])==null?void 0:Ae.id)??"chapter-1"}}),h(!0)},Xc=P=>{R({id:P.id,title:P.title})},Zc=async()=>{var P;if((P=F==null?void 0:F.title)!=null&&P.trim()){A(!0);try{const ie=t.map(Re=>({id:Re.id,partId:Re.partId||"part-1",partTitle:Re.partId===F.id?F.title.trim():Re.partTitle||"",chapterId:Re.chapterId||"chapter-1",chapterTitle:Re.chapterTitle||""})),Ae=await Rt("/api/db/book",{action:"reorder",items:ie});Ae&&Ae.success!==!1?(R(null),mn()):alert("更新篇名失败: "+(Ae&&typeof Ae=="object"&&"error"in Ae?Ae.error:"未知错误"))}catch(ie){console.error(ie),alert("更新篇名失败")}finally{A(!1)}}},ed=P=>{const ie=P.chapters.length+1,Ae=`chapter-${P.id}-${ie}-${Date.now()}`;D({id:`${ie}.1`,title:"新章节",price:1,partId:P.id,chapterId:Ae,content:""}),h(!0)},Ef=(P,ie)=>{q({part:P,chapter:ie,title:ie.title})},Tf=async()=>{var P;if((P=X==null?void 0:X.title)!=null&&P.trim()){_(!0);try{const ie=t.map(Re=>({id:Re.id,partId:Re.partId||X.part.id,partTitle:Re.partId===X.part.id?X.part.title:Re.partTitle||"",chapterId:Re.chapterId||X.chapter.id,chapterTitle:Re.partId===X.part.id&&Re.chapterId===X.chapter.id?X.title.trim():Re.chapterTitle||""})),Ae=await Rt("/api/db/book",{action:"reorder",items:ie});Ae&&Ae.success!==!1?(q(null),mn()):alert("保存失败: "+(Ae&&typeof Ae=="object"&&"error"in Ae?Ae.error:"未知错误"))}catch(ie){console.error(ie),alert("保存失败")}finally{_(!1)}}},$t=async(P,ie)=>{const Ae=ie.sections.map(Re=>Re.id);if(Ae.length===0){alert("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${P.chapters.indexOf(ie)+1}章 | ${ie.title}」吗?将删除共 ${Ae.length} 节,此操作不可恢复。`))try{for(const Re of Ae)await Yr(`/api/db/book?id=${encodeURIComponent(Re)}`);mn()}catch(Re){console.error(Re),alert("删除失败")}},Mf=async()=>{if(!Q.trim()){alert("请输入篇名");return}Ce(!0);try{const P=`part-new-${Date.now()}`,ie="chapter-1",Ae=`part-placeholder-${Date.now()}`,Re=await Rt("/api/db/book",{id:Ae,title:"占位节(可编辑)",price:0,content:"",partId:P,partTitle:Q.trim(),chapterId:ie,chapterTitle:"第1章 | 待编辑",saveToFile:!1});Re&&Re.success!==!1?(alert(`篇「${Q}」创建成功,请编辑占位节`),W(!1),ee(""),mn()):alert("创建失败: "+(Re&&typeof Re=="object"&&"error"in Re?Re.error:"未知错误"))}catch(P){console.error(P),alert("创建失败")}finally{Ce(!1)}},xl=async()=>{if($.length===0){alert("请先勾选要移动的章节");return}const P=Dn.find(Ae=>Ae.id===Y),ie=P==null?void 0:P.chapters.find(Ae=>Ae.id===H);if(!P||!ie||!Y||!H){alert("请选择目标篇和章");return}he(!0);try{const Ae=()=>{const Ln=new Set($),hs=t.map(sn=>({id:sn.id,partId:sn.partId||"",partTitle:sn.partTitle||"",chapterId:sn.chapterId||"",chapterTitle:sn.chapterTitle||""})),Af=hs.filter(sn=>Ln.has(sn.id)).map(sn=>({...sn,partId:Y,partTitle:P.title||Y,chapterId:H,chapterTitle:ie.title||H})),As=hs.filter(sn=>!Ln.has(sn.id));let ao=As.length;for(let sn=As.length-1;sn>=0;sn-=1){const li=As[sn];if(li.partId===Y&&li.chapterId===H){ao=sn+1;break}}return[...As.slice(0,ao),...Af,...As.slice(ao)]},Re=async()=>{const Ln=Ae(),hs=await Rt("/api/db/book",{action:"reorder",items:Ln});return hs&&hs.success!==!1?(alert(`已移动 ${$.length} 节到「${P.title}」-「${ie.title}」`),ae(!1),oe([]),await mn(),!0):!1},Ot={action:"move-sections",sectionIds:$,targetPartId:Y,targetChapterId:H,targetPartTitle:P.title||Y,targetChapterTitle:ie.title||H},Vt=await Rt("/api/db/book",Ot);if(Vt&&Vt.success!==!1)alert(`已移动 ${Vt.count??$.length} 节到「${P.title}」-「${ie.title}」`),ae(!1),oe([]),await mn();else{const Ln=Vt&&typeof Vt=="object"&&"error"in Vt?Vt.error||"":"未知错误";if((Ln.includes("缺少 id")||Ln.includes("无效的 action"))&&await Re())return;alert("移动失败: "+Ln)}}catch(Ae){console.error(Ae),alert("移动失败: "+(Ae instanceof Error?Ae.message:"网络或服务异常"))}finally{he(!1)}},td=P=>{oe(ie=>ie.includes(P)?ie.filter(Ae=>Ae!==P):[...ie,P])},so=async P=>{const ie=t.filter(Ae=>Ae.partId===P.id).map(Ae=>Ae.id);if(ie.length===0){alert("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${P.title}」整篇吗?将删除共 ${ie.length} 节内容,此操作不可恢复。`))try{for(const Ae of ie)await Yr(`/api/db/book?id=${encodeURIComponent(Ae)}`);mn()}catch(Ae){console.error(Ae),alert("删除失败")}},nd=async()=>{var P;if(v.trim()){C(!0);try{const ie=await Be(`/api/search?q=${encodeURIComponent(v)}`);ie!=null&&ie.success&&((P=ie.data)!=null&&P.results)?k(ie.data.results):(k([]),ie&&!ie.success&&alert("搜索失败: "+ie.error))}catch(ie){console.error(ie),k([]),alert("搜索失败")}finally{C(!1)}}},io=Dn.find(P=>P.id===M.partId),ma=(io==null?void 0:io.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:["共 ",Dn.length," 篇 · ",fa," 节内容"]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(re,{onClick:()=>st(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[i.jsx(au,{className:"w-4 h-4 mr-2"}),"排名算法"]}),i.jsxs(re,{onClick:()=>{const P=typeof window<"u"?`${window.location.origin}/api-doc`:"";P&&window.open(P,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(Ns,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),i.jsx(Qt,{open:u,onOpenChange:h,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Lt,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),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:"如: 9.15",value:M.id,onChange:P=>D({...M,id: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:M.price,onChange:P=>D({...M,price:Number(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:M.title,onChange:P=>D({...M,title:P.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(tc,{value:M.partId,onValueChange:P=>D({...M,partId:P,chapterId:"chapter-1"}),children:[i.jsx($o,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(nc,{})}),i.jsxs(Fo,{className:"bg-[#0f2137] border-gray-700",children:[Dn.map(P=>i.jsx(xs,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id)),Dn.length===0&&i.jsx(xs,{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(tc,{value:M.chapterId,onValueChange:P=>D({...M,chapterId:P}),children:[i.jsx($o,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(nc,{})}),i.jsxs(Fo,{className:"bg-[#0f2137] border-gray-700",children:[ma.map(P=>i.jsx(xs,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id)),ma.length===0&&i.jsx(xs,{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:"内容 (Markdown格式)"}),i.jsx(ul,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[300px] font-mono text-sm placeholder:text-gray-500",placeholder:"输入章节内容...",value:M.content,onChange:P=>D({...M,content:P.target.value})})]})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>h(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:Cf,disabled:g||!M.id||!M.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(Lt,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),i.jsx(Qt,{open:!!F,onOpenChange:P=>!P&&R(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),F&&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:F.title,onChange:P=>R({...F,title:P.target.value}),placeholder:"输入篇名"})]})}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>R(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:Zc,disabled:I||!((gr=F==null?void 0:F.title)!=null&&gr.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:I?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),i.jsx(Qt,{open:!!X,onOpenChange:P=>!P&&q(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),X&&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:X.title,onChange:P=>q({...X,title:P.target.value}),placeholder:"输入章节名称"})]})}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>q(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:Tf,disabled:Z||!((rd=X==null?void 0:X.title)!=null&&rd.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Z?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),i.jsx(Qt,{open:V,onOpenChange:P=>{var ie;if(ae(P),P&&Dn.length>0){const Ae=Dn[0];L(Ae.id),ue(((ie=Ae.chapters[0])==null?void 0:ie.id)??"")}},children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsx(Zt,{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(tc,{value:Y,onValueChange:P=>{var Ae;L(P);const ie=Dn.find(Re=>Re.id===P);ue(((Ae=ie==null?void 0:ie.chapters[0])==null?void 0:Ae.id)??"")},children:[i.jsx($o,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(nc,{placeholder:"选择篇"})}),i.jsx(Fo,{className:"bg-[#0f2137] border-gray-700",children:Dn.map(P=>i.jsx(xs,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id))})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"目标章"}),i.jsxs(tc,{value:H,onValueChange:ue,children:[i.jsx($o,{className:"bg-[#0a1628] border-gray-700 text-white",children:i.jsx(nc,{placeholder:"选择章"})}),i.jsx(Fo,{className:"bg-[#0f2137] border-gray-700",children:(((rr=Dn.find(P=>P.id===Y))==null?void 0:rr.chapters)??[]).map(P=>i.jsx(xs,{value:P.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:P.title},P.id))})]})]})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>ae(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:xl,disabled:U||$.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:U?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),i.jsx(Qt,{open:!!B,onOpenChange:P=>!P&&me(null),children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white",children:["付款记录 — ",(B==null?void 0:B.section.title)??""]})}),i.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Se?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:"加载中..."})]}):B&&B.orders.length===0?i.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):B?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:B.orders.map(P=>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:`查看订单 ${P.orderSn}`,onClick:()=>window.open(`/orders?search=${P.orderSn??P.id??""}`,"_blank"),children:P.orderSn?P.orderSn.length>16?P.orderSn.slice(0,8)+"..."+P.orderSn.slice(-6):P.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:`查看用户 ${P.userId??P.openId??""}`,onClick:()=>window.open(`/users?search=${P.userId??P.openId??""}`,"_blank"),children:(()=>{const ie=P.userId??P.openId??"-";return ie.length>12?ie.slice(0,6)+"..."+ie.slice(-4):ie})()})}),i.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",P.amount??0]}),i.jsx("td",{className:"py-2 pr-2 text-gray-300",children:P.status??"-"}),i.jsx("td",{className:"py-2 pr-2 text-gray-500",children:P.payTime??P.createdAt??"-"})]},P.id??P.orderSn??""))})]}):null})]})}),i.jsx(Qt,{open:Ye,onOpenChange:st,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(au,{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)"}),ft?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:Qe.readWeight,onChange:P=>Xe(ie=>({...ie,readWeight:Math.max(0,Math.min(1,parseFloat(P.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:Qe.recencyWeight,onChange:P=>Xe(ie=>({...ie,recencyWeight:Math.max(0,Math.min(1,parseFloat(P.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:Qe.payWeight,onChange:P=>Xe(ie=>({...ie,payWeight:Math.max(0,Math.min(1,parseFloat(P.target.value)||0))}))})]})]}),i.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(Qe.readWeight+Qe.recencyWeight+Qe.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(re,{onClick:ds,disabled:Jt||Math.abs(Qe.readWeight+Qe.recencyWeight+Qe.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Jt?"保存中...":"保存权重"})]})]})]})}),i.jsx(Qt,{open:O,onOpenChange:W,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(Lt,{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:P=>ee(P.target.value),placeholder:"输入篇名"})]})}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>{W(!1),ee("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsx(re,{onClick:Mf,disabled:de||!Q.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:de?i.jsxs(i.Fragment,{children:[i.jsx(qe,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),i.jsx(Qt,{open:!!o,onOpenChange:()=>c(null),children:i.jsxs(Ut,{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(Xt,{className:"shrink-0 px-6 pt-6 pb-2",children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[i.jsx(wt,{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:P=>c({...o,id:P.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:P=>c({...o,price:Number(P.target.value),isFree:Number(P.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:P=>c({...o,isFree:P.target.checked,price:P.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:P=>c({...o,isNew:P.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:P=>c({...o,isPinned:P.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.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:o.hotScore??0,onChange:P=>c({...o,hotScore:Math.max(0,parseFloat(P.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:P=>c({...o,title:P.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(S2,{ref:Yn,content:o.content||"",onChange:P=>c({...o,content:P}),onImageUpload:async P=>{var Ot;const ie=new FormData;ie.append("file",P),ie.append("folder","book-images");const Re=await(await fetch(Qo("/api/upload"),{method:"POST",body:ie,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((Ot=Re==null?void 0:Re.data)==null?void 0:Ot.url)||(Re==null?void 0:Re.url)||""},persons:kn,linkTags:Ms,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),i.jsxs(bn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[o&&i.jsxs(re,{variant:"outline",onClick:()=>us({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(zr,{className:"w-4 h-4 mr-2"}),"付款记录"]}),i.jsxs(re,{variant:"outline",onClick:()=>c(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsx(re,{onClick:Yc,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(rn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),i.jsxs(Wc,{defaultValue:"chapters",className:"space-y-6",children:[i.jsxs(dl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[i.jsxs(en,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[i.jsx(zr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),i.jsxs(en,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[i.jsx(Ab,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),i.jsxs(en,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[i.jsx(Ki,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),i.jsxs(en,{value:"link-ai",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[i.jsx(Ns,{className:"w-4 h-4 mr-2"}),"链接AI"]})]}),i.jsxs(tn,{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(zr,{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:fa}),i.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsxs(re,{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(Lt,{className:"w-4 h-4 mr-2"}),"新建章节"]}),i.jsxs(re,{onClick:()=>W(!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(Lt,{className:"w-4 h-4 mr-2"}),"新建篇"]}),i.jsxs(re,{variant:"outline",onClick:()=>ae(!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(VB,{parts:Dn,expandedParts:s,onTogglePart:ls,onReorder:oi,onReadSection:ro,onDeleteSection:cs,onAddSectionInPart:Qc,onAddChapterInPart:ed,onDeleteChapter:$t,onEditPart:Xc,onDeletePart:so,onEditChapter:Ef,selectedSectionIds:$,onToggleSectionSelect:td,onShowSectionOrders:us,pinnedSectionIds:zt})]}),i.jsx(tn,{value:"search",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"内容搜索"})}),i.jsxs(Te,{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:P=>j(P.target.value),onKeyDown:P=>P.key==="Enter"&&nd()}),i.jsx(re,{onClick:nd,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(Ki,{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(P=>i.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>ro({id:P.id,title:P.title,price:P.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:P.id}),i.jsx("span",{className:"text-white",children:P.title}),zt.includes(P.id)&&i.jsx(Ho,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),i.jsx(Fe,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:P.matchType==="title"?"标题匹配":"内容匹配"})]}),P.snippet&&i.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:P.snippet}),(P.partTitle||P.chapterTitle)&&i.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[P.partTitle," · ",P.chapterTitle]})]},P.id))]})]})]})}),i.jsxs(tn,{value:"ranking",className:"space-y-4",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{className:"pb-3",children:i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(au,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),i.jsx(Te,{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:pn,onChange:P=>mr(Math.max(1,Math.min(100,Number(P.target.value)||20))),disabled:Br}),i.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),i.jsx(re,{size:"sm",onClick:Sf,disabled:fe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:fe?"保存中...":"保存"}),i.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",pn,"% 内容"]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsx(et,{className:"pb-3",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(Ab,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",i.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",si.length," 节"]})]}),i.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[i.jsx(re,{variant:"ghost",size:"sm",disabled:qn<=1,onClick:()=>ss(P=>Math.max(1,P-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:i.jsx($T,{className:"w-4 h-4"})}),i.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[qn," / ",ii]}),i.jsx(re,{variant:"ghost",size:"sm",disabled:qn>=ii,onClick:()=>ss(P=>Math.min(ii,P+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:i.jsx(Bo,{className:"w-4 h-4"})})]})]})}),i.jsx(Te,{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:"编辑"})]}),ai.map((P,ie)=>{const Ae=(qn-1)*Er+ie+1,Re=zt.includes(P.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 ${Re?"bg-amber-500/5":""}`,children:[i.jsx("span",{className:`text-sm font-bold ${Ae<=3?"text-amber-400":"text-gray-500"}`,children:Ae<=3?["🥇","🥈","🥉"][Ae-1]:`#${Ae}`}),i.jsx(re,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${Re?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>Cn(P.id),disabled:is,title:Re?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:Re?i.jsx(Ho,{className:"w-3.5 h-3.5 fill-current"}):i.jsx(oA,{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:P.title}),i.jsxs("span",{className:"text-gray-600 text-xs",children:[P.partTitle," · ",P.chapterTitle]})]}),i.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:P.clickCount??0}),i.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:P.payCount??0}),i.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(P.hotScore??0).toFixed(1)}),i.jsx("div",{className:"text-right",children:i.jsx(re,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>ro({id:P.id,title:P.title,price:P.price,filePath:""}),title:"编辑文章",children:i.jsx(wt,{className:"w-3 h-3"})})})]},P.id)}),ai.length===0&&i.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),i.jsxs(tn,{value:"link-ai",className:"space-y-4",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"pb-3",children:[i.jsxs(tt,{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(Te,{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:Jn.name,onChange:P=>as({...Jn,name:P.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:Jn.personId,onChange:P=>as({...Jn,personId:P.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:Jn.label,onChange:P=>as({...Jn,label:P.target.value})})]}),i.jsxs(re,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8",onClick:async()=>{if(!Jn.name)return alert("名称必填");const P={...Jn};P.personId||(P.personId=Jn.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36)),await ht("/api/db/persons",P),as({personId:"",name:"",label:""}),Ke()},children:[i.jsx(Lt,{className:"w-3 h-3 mr-1"}),"添加"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[kn.map(P=>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-[#38bdac] font-bold text-base",children:["@",P.name]}),i.jsx("span",{className:"text-gray-600 text-xs font-mono",children:P.id}),P.label&&i.jsx(Fe,{variant:"secondary",className:"bg-purple-500/20 text-purple-300 border-purple-500/30 text-[10px]",children:P.label})]}),i.jsx(re,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await Yr(`/api/db/persons?personId=${P.id}`),Ke()},children:i.jsx(er,{className:"w-3 h-3"})})]},P.id)),kn.length===0&&i.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"pb-3",children:[i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(yM,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),i.jsxs(Te,{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:pt.tagId,onChange:P=>Sn({...pt,tagId:P.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:pt.label,onChange:P=>Sn({...pt,label:P.target.value})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:"类型"}),i.jsxs(tc,{value:pt.type,onValueChange:P=>Sn({...pt,type:P}),children:[i.jsx($o,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",children:i.jsx(nc,{})}),i.jsxs(Fo,{children:[i.jsx(xs,{value:"url",children:"网页链接"}),i.jsx(xs,{value:"miniprogram",children:"小程序"}),i.jsx(xs,{value:"ckb",children:"存客宝"})]})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(te,{className:"text-gray-400 text-xs",children:pt.type==="url"?"URL地址":pt.type==="ckb"?"存客宝计划URL":"小程序AppID"}),i.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:pt.type==="url"?"https://...":pt.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"wx...",value:pt.type==="url"||pt.type==="ckb"?pt.url:pt.appId,onChange:P=>{pt.type==="url"||pt.type==="ckb"?Sn({...pt,url:P.target.value}):Sn({...pt,appId:P.target.value})}})]}),pt.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:pt.pagePath,onChange:P=>Sn({...pt,pagePath:P.target.value})})]}),i.jsxs(re,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:async()=>{if(!pt.tagId||!pt.label)return alert("标签ID和显示文字必填");const P={...pt};P.type==="miniprogram"&&P.appId&&(P.url=`weixin://dl/business/?appid=${P.appId}&path=${P.pagePath}`),await ht("/api/db/link-tags",P),Sn({tagId:"",label:"",url:"",type:"url",appId:"",pagePath:""}),Ze()},children:[i.jsx(Lt,{className:"w-3 h-3 mr-1"}),"添加"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[Ms.map(P=>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:["#",P.label]}),i.jsx(Fe,{variant:"secondary",className:`text-[10px] ${P.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":"bg-gray-700 text-gray-300"}`,children:P.type==="url"?"网页":P.type==="ckb"?"存客宝":"小程序"}),i.jsxs("a",{href:P.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[250px] hover:underline flex items-center gap-1",children:[P.url," ",i.jsx(Xs,{className:"w-3 h-3 shrink-0"})]})]}),i.jsx(re,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await Yr(`/api/db/link-tags?tagId=${P.id}`),Ze()},children:i.jsx(er,{className:"w-3 h-3"})})]},P.id)),Ms.length===0&&i.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"pb-3",children:[i.jsxs(tt,{className:"text-white text-base flex items-center gap-2",children:[i.jsx(au,{className:"w-4 h-4 text-green-400"}),"存客宝绑定"]}),i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),i.jsxs(Te,{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 qs={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 aN(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):qs.stats}function oN(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):qs.highlights}function kE(){const[t,e]=b.useState(qs),[n,r]=b.useState(!0),[s,a]=b.useState(!1),[o,c]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{Be("/api/admin/author-settings").then(k=>{const E=k==null?void 0:k.data;E&&typeof E=="object"&&e({name:String(E.name??qs.name),avatar:String(E.avatar??qs.avatar),avatarImg:String(E.avatarImg??""),title:String(E.title??qs.title),bio:String(E.bio??qs.bio),stats:aN(E.stats).length?aN(E.stats):qs.stats,highlights:oN(E.highlights).length?oN(E.highlights):qs.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(M=>M.label||M.value),highlights:t.highlights.filter(Boolean)},E=await ht("/api/admin/author-settings",k);if(!E||E.success===!1){alert("保存失败: "+(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),alert("保存失败: "+(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 M=new FormData;M.append("file",E),M.append("folder","avatars");const D=Sx(),F={};D&&(F.Authorization=`Bearer ${D}`);const I=await(await fetch(Qo("/api/upload"),{method:"POST",body:M,credentials:"include",headers:F})).json();I!=null&&I.success&&(I!=null&&I.url)?e(A=>({...A,avatarImg:I.url})):alert("上传失败: "+((I==null?void 0:I.error)||"未知错误"))}catch(M){console.error(M),alert("上传失败")}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,M)=>M!==k)})),y=(k,E,C)=>e(M=>({...M,stats:M.stats.map((D,F)=>F===k?{...D,[E]:C}:D)})),v=()=>e(k=>({...k,highlights:[...k.highlights,""]})),j=k=>e(E=>({...E,highlights:E.highlights.filter((C,M)=>M!==k)})),w=(k,E)=>e(C=>({...C,highlights:C.highlights.map((M,D)=>D===k?E:M)}));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(La,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),i.jsxs(re,{onClick:h,disabled:s||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),s?"保存中...":"保存"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"flex items-center gap-2 text-white",children:[i.jsx(La,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),i.jsx(It,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),i.jsxs(Te,{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(zN,{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(re,{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(Uu,{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:Qo(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(ul,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsx(tt,{className:"text-white",children:"统计数据"}),i.jsx(It,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),i.jsxs(Te,{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(re,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(E),children:i.jsx(er,{className:"w-4 h-4"})})]},E)),i.jsxs(re,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsx(tt,{className:"text-white",children:"亮点标签"}),i.jsx(It,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),i.jsxs(Te,{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(re,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>j(E),children:i.jsx(er,{className:"w-4 h-4"})})]},E)),i.jsxs(re,{variant:"outline",size:"sm",onClick:v,className:"border-gray-600 text-gray-400",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function SE(){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=Fx(h,300),[g,y]=b.useState(!0),[v,j]=b.useState(null),[w,k]=b.useState(!1),[E,C]=b.useState(null),[M,D]=b.useState(""),[F,R]=b.useState(""),[I,A]=b.useState(""),[O,W]=b.useState("admin"),[X,q]=b.useState("active"),[Z,_]=b.useState(!1);async function $(){var H;y(!0),j(null);try{const ue=new URLSearchParams({page:String(s),pageSize:String(o)});m.trim()&&ue.set("search",m.trim());const U=await Be(`/api/admin/users?${ue}`);U!=null&&U.success?(e(U.records||[]),r(U.total??0),u(U.totalPages??0)):j(U.error||"加载失败")}catch(ue){const U=ue;j(U.status===403?"无权限访问":((H=U==null?void 0:U.data)==null?void 0:H.error)||"加载失败"),e([])}finally{y(!1)}}b.useEffect(()=>{$()},[s,o,m]);const oe=()=>{C(null),D(""),R(""),A(""),W("admin"),q("active"),k(!0)},V=H=>{C(H),D(H.username),R(""),A(H.name||""),W(H.role==="super_admin"?"super_admin":"admin"),q(H.status==="disabled"?"disabled":"active"),k(!0)},ae=async()=>{var H;if(!M.trim()){j("用户名不能为空");return}if(!E&&!F){j("新建时密码必填,至少 6 位");return}if(F&&F.length<6){j("密码至少 6 位");return}j(null),_(!0);try{if(E){const ue=await Rt("/api/admin/users",{id:E.id,password:F||void 0,name:I.trim(),role:O,status:X});ue!=null&&ue.success?(k(!1),$()):j((ue==null?void 0:ue.error)||"保存失败")}else{const ue=await ht("/api/admin/users",{username:M.trim(),password:F,name:I.trim(),role:O});ue!=null&&ue.success?(k(!1),$()):j((ue==null?void 0:ue.error)||"保存失败")}}catch(ue){const U=ue;j(((H=U==null?void 0:U.data)==null?void 0:H.error)||"保存失败")}finally{_(!1)}},Y=async H=>{var ue;if(confirm("确定删除该管理员?"))try{const U=await Yr(`/api/admin/users?id=${H}`);U!=null&&U.success?$():j((U==null?void 0:U.error)||"删除失败")}catch(U){const he=U;j(((ue=he==null?void 0:he.data)==null?void 0:ue.error)||"删除失败")}},L=H=>{if(!H)return"-";try{const ue=new Date(H);return isNaN(ue.getTime())?H:ue.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(qh,{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(re,{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(re,{onClick:oe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:g?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(i.Fragment,{children:[i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"用户名"}),i.jsx(ke,{className:"text-gray-400",children:"昵称"}),i.jsx(ke,{className:"text-gray-400",children:"角色"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-gray-400",children:"创建时间"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[t.map(H=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:H.id}),i.jsx(ve,{className:"text-white font-medium",children:H.username}),i.jsx(ve,{className:"text-gray-400",children:H.name||"-"}),i.jsx(ve,{children:i.jsx(Fe,{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(ve,{children:i.jsx(Fe,{variant:"outline",className:H.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:H.status==="active"?"正常":"已禁用"})}),i.jsx(ve,{className:"text-gray-500 text-sm",children:L(H.createdAt)}),i.jsxs(ve,{className:"text-right",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>V(H),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>Y(H.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(vn,{className:"w-4 h-4"})})]})]},H.id)),t.length===0&&!g&&i.jsx(ct,{children:i.jsx(ve,{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(Zr,{page:s,pageSize:o,total:n,totalPages:c,onPageChange:a})})]})})}),i.jsx(Qt,{open:w,onOpenChange:k,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[i.jsx(Xt,{children:i.jsx(Zt,{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:M,onChange:H=>D(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:F,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:I,onChange:H=>A(H.target.value)})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{className:"text-gray-300",children:"角色"}),i.jsxs("select",{value:O,onChange:H=>W(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:X,onChange:H=>q(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(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:ae,disabled:Z,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),Z?"保存中...":"保存"]})]})]})})]})}const UB={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},KB={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},qB={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...KB}},GB={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},JB=["system","author","admin"];function YB(){const[t,e]=AN(),n=t.get("tab")??"system",r=JB.includes(n)?n:"system",[s,a]=b.useState(qB),[o,c]=b.useState(GB),[u,h]=b.useState(UB),[f,m]=b.useState(!1),[g,y]=b.useState(!0),[v,j]=b.useState(!1),[w,k]=b.useState(""),[E,C]=b.useState(""),[M,D]=b.useState(!1),[F,R]=b.useState(!1),I=(q,Z,_=!1)=>{k(q),C(Z),D(_),j(!0)};b.useEffect(()=>{(async()=>{try{const Z=await Be("/api/admin/settings");if(!Z||Z.success===!1)return;if(Z.featureConfig&&Object.keys(Z.featureConfig).length&&c(_=>({..._,...Z.featureConfig})),Z.mpConfig&&typeof Z.mpConfig=="object"&&h(_=>({..._,...Z.mpConfig})),Z.siteSettings&&typeof Z.siteSettings=="object"){const _=Z.siteSettings;a($=>({...$,...typeof _.sectionPrice=="number"&&{sectionPrice:_.sectionPrice},...typeof _.baseBookPrice=="number"&&{baseBookPrice:_.baseBookPrice},...typeof _.distributorShare=="number"&&{distributorShare:_.distributorShare},..._.authorInfo&&typeof _.authorInfo=="object"&&{authorInfo:{...$.authorInfo,..._.authorInfo}}}))}}catch(Z){console.error("Load settings error:",Z)}finally{y(!1)}})()},[]);const A=async(q,Z)=>{R(!0);try{const _=await ht("/api/admin/settings",{featureConfig:q});if(!_||_.success===!1){Z(),I("保存失败",(_==null?void 0:_.error)??"未知错误",!0);return}I("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(_){console.error("Save feature config error:",_),Z(),I("保存失败",_ instanceof Error?_.message:String(_),!0)}finally{R(!1)}},O=(q,Z)=>{const _=o,$={..._,[q]:Z};c($),A($,()=>c(_))},W=async()=>{m(!0);try{const q=await ht("/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(!q||q.success===!1){I("保存失败",(q==null?void 0:q.error)??"未知错误",!0);return}I("已保存","设置已保存成功。")}catch(q){console.error("Save settings error:",q),I("保存失败",q instanceof Error?q.message:String(q),!0)}finally{m(!1)}},X=q=>{e(q==="system"?{}:{tab:q})};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(re,{onClick:W,disabled:f,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),f?"保存中...":"保存设置"]})]}),i.jsxs(Wc,{value:r,onValueChange:X,className:"w-full",children:[i.jsxs(dl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[i.jsxs(en,{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(Da,{className:"w-4 h-4 mr-2"}),"系统设置"]}),i.jsxs(en,{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(pm,{className:"w-4 h-4 mr-2"}),"作者详情"]}),i.jsxs(en,{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(qh,{className:"w-4 h-4 mr-2"}),"管理员"]})]}),i.jsx(tn,{value:"system",className:"mt-0",children:i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(pm,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),i.jsx(It,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),i.jsxs(Te,{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(pm,{className:"w-3 h-3"}),"主理人名称"]}),i.jsx(ce,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:s.authorInfo.name??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,name:q.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(kc,{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:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,startDate:q.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(kc,{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:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,liveTime:q.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($N,{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:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,platform:q.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(zr,{className:"w-3 h-3"}),"简介描述"]}),i.jsx(ce,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:s.authorInfo.description??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,description:q.target.value}}))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(te,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),i.jsx(ul,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:s.authorInfo.bio??"",onChange:q=>a(Z=>({...Z,authorInfo:{...Z.authorInfo,bio:q.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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Wu,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),i.jsx(It,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),i.jsx(Te,{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:q=>a(Z=>({...Z,sectionPrice:Number.parseFloat(q.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:q=>a(Z=>({...Z,baseBookPrice:Number.parseFloat(q.target.value)||9.9}))})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Sc,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),i.jsx(It,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),i.jsx(Te,{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:q=>h(Z=>({...Z,appId:q.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:q=>h(Z=>({...Z,withdrawSubscribeTmplId:q.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:q=>h(Z=>({...Z,mchId:q.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:q=>h(Z=>({...Z,minWithdraw:Number.parseFloat(q.target.value)||10}))})]})]})})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Da,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),i.jsx(It,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),i.jsxs(Te,{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(Pn,{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(vt,{id:"match-enabled",checked:o.matchEnabled,disabled:F,onCheckedChange:q=>O("matchEnabled",q)})]}),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(dM,{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(vt,{id:"referral-enabled",checked:o.referralEnabled,disabled:F,onCheckedChange:q=>O("referralEnabled",q)})]}),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(zr,{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(vt,{id:"search-enabled",checked:o.searchEnabled,disabled:F,onCheckedChange:q=>O("searchEnabled",q)})]}),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(Da,{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(vt,{id:"about-enabled",checked:o.aboutEnabled,disabled:F,onCheckedChange:q=>O("aboutEnabled",q)})]})]}),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(tn,{value:"author",className:"mt-0",children:i.jsx(kE,{})}),i.jsx(tn,{value:"admin",className:"mt-0",children:i.jsx(SE,{})})]}),i.jsx(Qt,{open:v,onOpenChange:j,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[i.jsxs(Xt,{children:[i.jsx(Zt,{className:M?"text-red-400":"text-[#38bdac]",children:w}),i.jsx(MI,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:E})]}),i.jsx(bn,{className:"mt-4",children:i.jsx(re,{onClick:()=>j(!1),className:M?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const lN={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 QB(){const[t,e]=b.useState(!1),[n,r]=b.useState(lN),[s,a]=b.useState(""),o=async()=>{e(!0);try{const k=await Be("/api/config");k!=null&&k.paymentMethods&&r({...lN,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};b.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await ht("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),alert("配置已保存!")}catch(k){console.error("保存失败:",k),alert("保存失败: "+(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(re,{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(re,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{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(IN,{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(Wc,{defaultValue:"wechat",className:"space-y-6",children:[i.jsxs(dl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[i.jsxs(en,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[i.jsx(Sc,{className:"w-4 h-4 mr-2"}),"微信"]}),i.jsxs(en,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[i.jsx(pg,{className:"w-4 h-4 mr-2"}),"支付宝"]}),i.jsxs(en,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[i.jsx(Eb,{className:"w-4 h-4 mr-2"}),"USDT"]}),i.jsxs(en,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[i.jsx(gg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),i.jsx(tn,{value:"wechat",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(tt,{className:"text-[#07C160] flex items-center gap-2",children:[i.jsx(Sc,{className:"w-5 h-5"}),"微信支付配置"]}),i.jsx(It,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),i.jsx(vt,{checked:!!y.enabled,onCheckedChange:k=>h("enabled",k)})]}),i.jsxs(Te,{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(Xs,{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(tn,{value:"alipay",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(tt,{className:"text-[#1677FF] flex items-center gap-2",children:[i.jsx(pg,{className:"w-5 h-5"}),"支付宝配置"]}),i.jsx(It,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),i.jsx(vt,{checked:!!v.enabled,onCheckedChange:k=>f("enabled",k)})]}),i.jsxs(Te,{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(re,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(v.partnerId??""),"pid"),children:s==="pid"?i.jsx(Kh,{className:"w-4 h-4 text-green-500"}):i.jsx(ON,{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(Xs,{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(tn,{value:"usdt",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(tt,{className:"text-[#26A17B] flex items-center gap-2",children:[i.jsx(Eb,{className:"w-5 h-5"}),"USDT配置"]}),i.jsx(It,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),i.jsx(vt,{checked:!!j.enabled,onCheckedChange:k=>m("enabled",k)})]}),i.jsxs(Te,{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(tn,{value:"paypal",className:"space-y-4",children:i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between pb-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsxs(tt,{className:"text-[#169BD7] flex items-center gap-2",children:[i.jsx(gg,{className:"w-5 h-5"}),"PayPal配置"]}),i.jsx(It,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),i.jsx(vt,{checked:!!w.enabled,onCheckedChange:k=>g("enabled",k)})]}),i.jsxs(Te,{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 XB={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},ZB={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},eV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function tV(){const[t,e]=b.useState({siteConfig:{...XB},menuConfig:{...ZB},pageConfig:{...eV}}),[n,r]=b.useState(!1),[s,a]=b.useState(!1);b.useEffect(()=>{Be("/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 ht("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await ht("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await ht("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),alert("配置已保存")}catch(f){console.error(f),alert("保存失败: "+(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(re,{onClick:o,disabled:s,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),s?"保存中...":n?"已保存":"保存设置"]})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(gg,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),i.jsx(It,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),i.jsxs(Te,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(eA,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),i.jsx(It,{className:"text-gray-400",children:"配置网站主题色"})]}),i.jsx(Te,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(qM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),i.jsx(It,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),i.jsx(Te,{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(vt,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(oM,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),i.jsx(It,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),i.jsxs(Te,{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 nV(){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 Be("/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 ht("/api/db/config",{key:"live_qr_codes",value:v,description:"群活码配置"}),alert("群活码配置已保存!"),await u()}catch(y){console.error(y),alert("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await ht("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),alert("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(v){console.error(v),alert("保存失败: "+(v instanceof Error?v.message:String(v)))}},g=()=>{n?window.open(n,"_blank"):alert("请先配置微信群链接")};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(IN,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-[#07C160] flex items-center gap-2",children:[i.jsx(Mb,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),i.jsx(It,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),i.jsxs(Te,{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(xg,{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(re,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:s==="group"?i.jsx(Kh,{className:"w-4 h-4 text-green-500"}):i.jsx(ON,{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(Xs,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs(re,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[i.jsx(Uu,{className:"w-4 h-4 mr-2"}),"保存配置"]}),i.jsxs(re,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[i.jsx(Xs,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Mb,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),i.jsx(It,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),i.jsxs(Te,{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(xg,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),i.jsx(ul,{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(re,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Uu,{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 cN={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}},rV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function sV(){const[t,e]=b.useState(cN),[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 Be("/api/db/config/full?key=match_config"),M=(C==null?void 0:C.data)??(C==null?void 0:C.config);M&&e({...cN,...M})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};b.useEffect(()=>{g()},[]);const y=async()=>{a(!0);try{const C=await ht("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?alert("配置保存成功!"):alert("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),alert("保存失败")}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){alert("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const M=C.findIndex(D=>D.id===u.id);M!==-1&&(C[M]={...f})}else{if(C.some(M=>M.id===f.id)){alert("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(M=>M.id!==C)})},E=C=>{e({...t,matchTypes:t.matchTypes.map(M=>M.id===C?{...M,enabled:!M.enabled}:M)})};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(Da,{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(re,{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(re,{onClick:y,disabled:s,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),s?"保存中...":"保存配置"]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Bi,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),i.jsx(It,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),i.jsxs(Te,{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(vt,{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(vt,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),i.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Pn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),i.jsx(It,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),i.jsxs(re,{onClick:j,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),i.jsx(Te,{children:i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"图标"}),i.jsx(ke,{className:"text-gray-400",children:"类型ID"}),i.jsx(ke,{className:"text-gray-400",children:"显示名称"}),i.jsx(ke,{className:"text-gray-400",children:"匹配标签"}),i.jsx(ke,{className:"text-gray-400",children:"价格"}),i.jsx(ke,{className:"text-gray-400",children:"数据库匹配"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsx(pr,{children:t.matchTypes.map(C=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsx("span",{className:"text-2xl",children:C.icon})}),i.jsx(ve,{className:"font-mono text-gray-300",children:C.id}),i.jsx(ve,{className:"text-white font-medium",children:C.label}),i.jsx(ve,{className:"text-gray-300",children:C.matchLabel}),i.jsx(ve,{children:i.jsxs(Fe,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),i.jsx(ve,{children:C.matchFromDB?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):i.jsx(Fe,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),i.jsx(ve,{children:i.jsx(vt,{checked:C.enabled,onCheckedChange:()=>E(C.id)})}),i.jsx(ve,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>v(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>k(C.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(vn,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),i.jsx(Qt,{open:o,onOpenChange:c,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[u?i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(Lt,{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:rV.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(vt,{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(vt,{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(vt,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsxs(re,{onClick:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const dN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function iV(){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 Be(`/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(dN).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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{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(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"发起人"}),i.jsx(ke,{className:"text-gray-400",children:"匹配到"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"联系方式"}),i.jsx(ke,{className:"text-gray-400",children:"匹配时间"})]})}),i.jsxs(pr,{children:[t.map(w=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{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(ve,{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(ve,{children:i.jsx(Fe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:dN[w.matchType]||w.matchType})}),i.jsxs(ve,{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(ve,{className:"text-gray-400",children:w.createdAt?new Date(w.createdAt).toLocaleString():"-"})]},w.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),i.jsx(Zr,{page:s,totalPages:j,total:n,pageSize:o,onPageChange:a,onPageSizeChange:w=>{c(w),a(1)}})]})})})]})}function aV(){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 Be("/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()){alert("角色名称不能为空");return}y(!0);try{if(o){const C=await Rt("/api/db/vip-roles",{id:o.id,name:u.trim(),sort:f});C!=null&&C.success?(a(!1),v()):alert("更新失败: "+(C==null?void 0:C.error))}else{const C=await ht("/api/db/vip-roles",{name:u.trim(),sort:f});C!=null&&C.success?(a(!1),v()):alert("新增失败: "+(C==null?void 0:C.error))}}catch(C){console.error("Save error:",C),alert("保存失败")}finally{y(!1)}},E=async C=>{if(confirm("确定删除该角色?已设置该角色的 VIP 用户将保留角色名称。"))try{const M=await Yr(`/api/db/vip-roles?id=${C}`);M!=null&&M.success?v():alert("删除失败: "+(M==null?void 0:M.error))}catch(M){console.error("Delete error:",M),alert("删除失败")}};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(Fi,{className:"w-5 h-5 text-amber-400"}),"VIP 角色管理"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"超级个体固定角色,在「设置 VIP」时可选择或手动填写"})]}),i.jsxs(re,{onClick:j,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"新增角色"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"角色名称"}),i.jsx(ke,{className:"text-gray-400",children:"排序"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[t.map(C=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:C.id}),i.jsx(ve,{className:"text-white",children:C.name}),i.jsx(ve,{className:"text-gray-400",children:C.sort}),i.jsxs(ve,{className:"text-right",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>w(C),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>E(C.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(vn,{className:"w-4 h-4"})})]})]},C.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无角色,点击「新增角色」添加"})})]})]})})}),i.jsx(Qt,{open:s,onOpenChange:a,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[i.jsx(Xt,{children:i.jsx(Zt,{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(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>a(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:k,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存"]})]})]})})]})}function CE(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 I=>{var O;const A=(O=I.target.files)==null?void 0:O[0];if(A){v(!0);try{const W=new FormData;W.append("file",A),W.append("folder","mentors");const X=Sx(),q={};X&&(q.Authorization=`Bearer ${X}`);const _=await(await fetch(Qo("/api/upload"),{method:"POST",body:W,credentials:"include",headers:q})).json();_!=null&&_.success&&(_!=null&&_.url)?f($=>({...$,avatar:_.url})):alert("上传失败: "+((_==null?void 0:_.error)||"未知错误"))}catch(W){console.error(W),alert("上传失败")}finally{v(!1),j.current&&(j.current.value="")}}};async function k(){s(!0);try{const I=await Be("/api/db/mentors");I!=null&&I.success&&I.data&&n(I.data)}catch(I){console.error("Load mentors error:",I)}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(I=>I.sort))+1:0,enabled:!0})},C=()=>{u(null),E(),o(!0)},M=I=>{u(I),f({name:I.name,avatar:I.avatar||"",intro:I.intro||"",tags:I.tags||"",priceSingle:I.priceSingle!=null?String(I.priceSingle):"",priceHalfYear:I.priceHalfYear!=null?String(I.priceHalfYear):"",priceYear:I.priceYear!=null?String(I.priceYear):"",quote:I.quote||"",whyFind:I.whyFind||"",offering:I.offering||"",judgmentStyle:I.judgmentStyle||"",sort:I.sort,enabled:I.enabled??!0}),o(!0)},D=async()=>{if(!h.name.trim()){alert("导师姓名不能为空");return}g(!0);try{const I=O=>O===""?void 0:parseFloat(O),A={name:h.name.trim(),avatar:h.avatar.trim()||void 0,intro:h.intro.trim()||void 0,tags:h.tags.trim()||void 0,priceSingle:I(h.priceSingle),priceHalfYear:I(h.priceHalfYear),priceYear:I(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 O=await Rt("/api/db/mentors",{id:c.id,...A});O!=null&&O.success?(o(!1),k()):alert("更新失败: "+(O==null?void 0:O.error))}else{const O=await ht("/api/db/mentors",A);O!=null&&O.success?(o(!1),k()):alert("新增失败: "+(O==null?void 0:O.error))}}catch(I){console.error("Save error:",I),alert("保存失败")}finally{g(!1)}},F=async I=>{if(confirm("确定删除该导师?"))try{const A=await Yr(`/api/db/mentors?id=${I}`);A!=null&&A.success?k():alert("删除失败: "+(A==null?void 0:A.error))}catch(A){console.error("Delete error:",A),alert("删除失败")}},R=I=>I!=null?`¥${I}`:"-";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(Pn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),i.jsxs(re,{onClick:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:r?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"姓名"}),i.jsx(ke,{className:"text-gray-400",children:"简介"}),i.jsx(ke,{className:"text-gray-400",children:"单次"}),i.jsx(ke,{className:"text-gray-400",children:"半年"}),i.jsx(ke,{className:"text-gray-400",children:"年度"}),i.jsx(ke,{className:"text-gray-400",children:"排序"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsxs(pr,{children:[e.map(I=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:I.id}),i.jsx(ve,{className:"text-white",children:I.name}),i.jsx(ve,{className:"text-gray-400 max-w-[200px] truncate",children:I.intro||"-"}),i.jsx(ve,{className:"text-gray-400",children:R(I.priceSingle)}),i.jsx(ve,{className:"text-gray-400",children:R(I.priceHalfYear)}),i.jsx(ve,{className:"text-gray-400",children:R(I.priceYear)}),i.jsx(ve,{className:"text-gray-400",children:I.sort}),i.jsxs(ve,{className:"text-right",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>M(I),className:"text-gray-400 hover:text-[#38bdac]",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>F(I.id),className:"text-gray-400 hover:text-red-400",children:i.jsx(vn,{className:"w-4 h-4"})})]})]},I.id)),e.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),i.jsx(Qt,{open:a,onOpenChange:o,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[i.jsx(Xt,{children:i.jsx(Zt,{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:I=>f(A=>({...A,name:I.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:I=>f(A=>({...A,sort:parseInt(I.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:I=>f(A=>({...A,avatar:I.target.value})),placeholder:"点击上传或粘贴图片地址"}),i.jsx("input",{ref:j,type:"file",accept:"image/*",className:"hidden",onChange:w}),i.jsxs(re,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:y,onClick:()=>{var I;return(I=j.current)==null?void 0:I.click()},children:[i.jsx(Uu,{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:Qo(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:I=>f(A=>({...A,intro: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:h.tags,onChange:I=>f(A=>({...A,tags:I.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:I=>f(A=>({...A,priceSingle:I.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:I=>f(A=>({...A,priceHalfYear:I.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:I=>f(A=>({...A,priceYear: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:h.quote,onChange:I=>f(A=>({...A,quote: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:h.whyFind,onChange:I=>f(A=>({...A,whyFind: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:h.offering,onChange:I=>f(A=>({...A,offering: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:h.judgmentStyle,onChange:I=>f(A=>({...A,judgmentStyle:I.target.value}))})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"checkbox",id:"enabled",checked:h.enabled,onChange:I=>f(A=>({...A,enabled:I.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),i.jsx(te,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),i.jsxs(bn,{children:[i.jsxs(re,{variant:"outline",onClick:()=>o(!1),className:"border-gray-600 text-gray-300",children:[i.jsx(er,{className:"w-4 h-4 mr-2"}),"取消"]}),i.jsxs(re,{onClick:D,disabled:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"}),m?"保存中...":"保存"]})]})]})})]})}function oV(){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 Be(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(kc,{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(re,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"用户ID"}),i.jsx(ke,{className:"text-gray-400",children:"导师ID"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"金额"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-gray-400",children:"创建时间"})]})}),i.jsxs(pr,{children:[t.map(h=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:h.id}),i.jsx(ve,{className:"text-gray-400",children:h.userId}),i.jsx(ve,{className:"text-gray-400",children:h.mentorId}),i.jsx(ve,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),i.jsxs(ve,{className:"text-white",children:["¥",h.amount]}),i.jsx(ve,{className:"text-gray-400",children:c[h.status]||h.status}),i.jsx(ve,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const cc={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},uN={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:cc},lV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function cV(){const t=ia(),[e,n]=b.useState(uN),[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 A=await Be("/api/db/match-pool-counts");A!=null&&A.success&&A.data&&v(A.data)}catch(A){console.error("加载池子人数失败:",A)}finally{w(!1)}},E=async()=>{s(!0);try{const A=await Be("/api/db/config/full?key=match_config"),O=(A==null?void 0:A.data)??(A==null?void 0:A.config);if(O){let W=O.poolSettings??cc;W.poolSource&&!Array.isArray(W.poolSource)&&(W={...W,poolSource:[W.poolSource]}),n({...uN,...O,poolSettings:W})}}catch(A){console.error("加载匹配配置失败:",A)}finally{s(!1)}};b.useEffect(()=>{E(),k()},[]);const C=async()=>{o(!0);try{const A=await ht("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});alert((A==null?void 0:A.success)!==!1?"配置保存成功!":"保存失败: "+((A==null?void 0:A.error)||"未知错误"))}catch(A){console.error(A),alert("保存失败")}finally{o(!1)}},M=A=>{f(A),g({...A}),u(!0)},D=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},F=()=>{if(!m.id||!m.label){alert("请填写类型ID和名称");return}const A=[...e.matchTypes];if(h){const O=A.findIndex(W=>W.id===h.id);O!==-1&&(A[O]={...m})}else{if(A.some(O=>O.id===m.id)){alert("类型ID已存在");return}A.push({...m})}n({...e,matchTypes:A}),u(!1)},R=A=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(O=>O.id!==A)})},I=A=>{n({...e,matchTypes:e.matchTypes.map(O=>O.id===A?{...O,enabled:!O.enabled}:O)})};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex justify-end gap-3",children:[i.jsxs(re,{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(re,{onClick:C,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"})," ",a?"保存中...":"保存配置"]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(DN,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),i.jsx(It,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),i.jsxs(Te,{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(A=>{const O=e.poolSettings??cc,X=(Array.isArray(O.poolSource)?O.poolSource:[O.poolSource]).includes(A.value),q=y==null?void 0:y[A.countKey],Z=()=>{const _=Array.isArray(O.poolSource)?[...O.poolSource]:[O.poolSource],$=X?_.filter(oe=>oe!==A.value):[..._,A.value];$.length===0&&$.push(A.value),n({...e,poolSettings:{...O,poolSource:$}})};return i.jsxs("button",{type:"button",onClick:Z,className:`p-4 rounded-lg border text-left transition-all ${X?"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 ${X?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:X&&"✓"}),i.jsx("span",{className:"text-xl",children:A.icon}),i.jsx("span",{className:`text-sm font-medium ${X?"text-[#38bdac]":"text-gray-300"}`,children:A.label})]}),i.jsxs("span",{className:"text-lg font-bold text-white",children:[j?"...":q??"-",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:A.desc}),i.jsx("span",{role:"link",tabIndex:0,onClick:_=>{_.stopPropagation(),t(`/users?pool=${A.value}`)},onKeyDown:_=>{_.key==="Enter"&&(_.stopPropagation(),t(`/users?pool=${A.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},A.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(A=>{const W=(e.poolSettings??cc)[A.key];return i.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[i.jsx(vt,{checked:W,onCheckedChange:X=>n({...e,poolSettings:{...e.poolSettings??cc,[A.key]:X}})}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{children:A.icon}),i.jsx(te,{className:"text-gray-300 text-sm",children:A.label})]})]},A.key)})})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Bi,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),i.jsx(It,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),i.jsxs(Te,{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:A=>n({...e,freeMatchLimit:parseInt(A.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:A=>n({...e,matchPrice:parseFloat(A.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:A=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(A.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(vt,{checked:e.settings.enableFreeMatches,onCheckedChange:A=>n({...e,settings:{...e.settings,enableFreeMatches:A}})}),i.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:e.settings.enablePaidMatches,onCheckedChange:A=>n({...e,settings:{...e.settings,enablePaidMatches:A}})}),i.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),i.jsxs(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:[i.jsxs(et,{className:"flex flex-row items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs(tt,{className:"text-white flex items-center gap-2",children:[i.jsx(Pn,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),i.jsx(It,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),i.jsxs(re,{onClick:D,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(Lt,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),i.jsx(Te,{children:i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"图标"}),i.jsx(ke,{className:"text-gray-400",children:"类型ID"}),i.jsx(ke,{className:"text-gray-400",children:"显示名称"}),i.jsx(ke,{className:"text-gray-400",children:"匹配标签"}),i.jsx(ke,{className:"text-gray-400",children:"价格"}),i.jsx(ke,{className:"text-gray-400",children:"数据库匹配"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),i.jsx(pr,{children:e.matchTypes.map(A=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsx("span",{className:"text-2xl",children:A.icon})}),i.jsx(ve,{className:"font-mono text-gray-300",children:A.id}),i.jsx(ve,{className:"text-white font-medium",children:A.label}),i.jsx(ve,{className:"text-gray-300",children:A.matchLabel}),i.jsx(ve,{children:i.jsxs(Fe,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",A.price]})}),i.jsx(ve,{children:A.matchFromDB?i.jsx(Fe,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):i.jsx(Fe,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),i.jsx(ve,{children:i.jsx(vt,{checked:A.enabled,onCheckedChange:()=>I(A.id)})}),i.jsx(ve,{className:"text-right",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>M(A),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:i.jsx(wt,{className:"w-4 h-4"})}),i.jsx(re,{variant:"ghost",size:"sm",onClick:()=>R(A.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:i.jsx(vn,{className:"w-4 h-4"})})]})})]},A.id))})]})})]}),i.jsx(Qt,{open:c,onOpenChange:u,children:i.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[i.jsx(Xt,{children:i.jsxs(Zt,{className:"text-white flex items-center gap-2",children:[h?i.jsx(wt,{className:"w-5 h-5 text-[#38bdac]"}):i.jsx(Lt,{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:A=>g({...m,id:A.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:lV.map(A=>i.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===A?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:A}),children:A},A))})]})]}),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:A=>g({...m,label:A.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:A=>g({...m,matchLabel:A.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:A=>g({...m,price:parseFloat(A.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(vt,{checked:m.matchFromDB,onCheckedChange:A=>g({...m,matchFromDB:A})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:m.showJoinAfterMatch,onCheckedChange:A=>g({...m,showJoinAfterMatch:A})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(vt,{checked:m.enabled,onCheckedChange:A=>g({...m,enabled:A})}),i.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),i.jsxs(bn,{children:[i.jsx(re,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),i.jsxs(re,{onClick:F,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const hN={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),[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 M=await Be(`/api/db/match-records?${C}`);M!=null&&M.success?(e(M.records||[]),r(M.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{w()},[s,u]);const k=Math.ceil(n/o)||1,E=({userId:C,nickname:M,avatar:D})=>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:[D?i.jsx("img",{src:D,alt:"",className:"w-full h-full object-cover",onError:F=>{F.currentTarget.style.display="none"}}):null,i.jsx("span",{className:D?"hidden":"",children:(M||C||"?").charAt(0)})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:M||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(hN).map(([C,M])=>i.jsx("option",{value:C,children:M},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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{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(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"发起人"}),i.jsx(ke,{className:"text-gray-400",children:"匹配到"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"联系方式"}),i.jsx(ke,{className:"text-gray-400",children:"匹配时间"})]})}),i.jsxs(pr,{children:[t.map(C=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{children:i.jsx(E,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),i.jsx(ve,{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(ve,{children:i.jsx(Fe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:hN[C.matchType]||C.matchType})}),i.jsxs(ve,{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(ve,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),i.jsx(Zr,{page:s,totalPages:k,total:n,pageSize:o,onPageChange:a,onPageSizeChange:C=>{c(C),a(1)}})]})})}),i.jsx($x,{open:!!v,onClose:()=>j(null),userId:v,onUserUpdated:w})]})}function uV(){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(dV,{}),t==="pool"&&i.jsx(cV,{})]})}const fN={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function hV(){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 Be(`/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){alert("该记录无联系方式,无法推送到存客宝");return}y(E.id);try{const C=await ht("/api/ckb/join",{type:E.matchType||"investor",phone:E.phone||"",wechat:E.wechatId||"",userId:E.userId,name:E.userNickname||""});alert((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){alert("推送失败: "+(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(fN).map(([E,C])=>i.jsx("option",{value:E,children:C},E))}),i.jsxs(re,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{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(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"发起人"}),i.jsx(ke,{className:"text-gray-400",children:"匹配到"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"联系方式"}),i.jsx(ke,{className:"text-gray-400",children:"时间"}),i.jsx(ke,{className:"text-gray-400 text-right",children:"操作"})]})}),i.jsxs(pr,{children:[t.map(E=>{var C,M;return i.jsxs(ct,{className:`border-gray-700/50 ${k(E)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[i.jsx(ve,{className:"text-white",children:E.userNickname||((C=E.userId)==null?void 0:C.slice(0,12))}),i.jsx(ve,{className:"text-white",children:E.matchedNickname||((M=E.matchedUserId)==null?void 0:M.slice(0,12))}),i.jsx(ve,{children:i.jsx(Fe,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:fN[E.matchType]||E.matchType})}),i.jsxs(ve,{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(ve,{className:"text-gray-400 text-sm",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"}),i.jsx(ve,{className:"text-right",children:k(E)?i.jsxs(re,{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(yA,{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(ve,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),i.jsx(Zr,{page:s,totalPages:w,total:n,pageSize:o,onPageChange:a,onPageSizeChange:E=>{c(E),a(1)}})]})})})]})}const pN={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},fV={single:"单次",half_year:"半年",year:"年度"};function pV(){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 Be(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(pN).map(([c,u])=>i.jsx("option",{value:c,children:u},c))]}),i.jsxs(re,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50",children:i.jsx(Te,{className:"p-0",children:n?i.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):i.jsxs(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"ID"}),i.jsx(ke,{className:"text-gray-400",children:"用户ID"}),i.jsx(ke,{className:"text-gray-400",children:"导师ID"}),i.jsx(ke,{className:"text-gray-400",children:"类型"}),i.jsx(ke,{className:"text-gray-400",children:"金额"}),i.jsx(ke,{className:"text-gray-400",children:"状态"}),i.jsx(ke,{className:"text-gray-400",children:"创建时间"})]})}),i.jsxs(pr,{children:[t.map(c=>i.jsxs(ct,{className:"border-gray-700/50",children:[i.jsx(ve,{className:"text-gray-300",children:c.id}),i.jsx(ve,{className:"text-gray-400",children:c.userId}),i.jsx(ve,{className:"text-gray-400",children:c.mentorId}),i.jsx(ve,{className:"text-gray-400",children:fV[c.consultationType]||c.consultationType}),i.jsxs(ve,{className:"text-white",children:["¥",c.amount]}),i.jsx(ve,{className:"text-gray-400",children:pN[c.status]||c.status}),i.jsx(ve,{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(ve,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function mV(){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(pV,{}),t==="manage"&&i.jsx("div",{className:"-mx-8",children:i.jsx(CE,{embedded:!0})})]})}function gV(){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 Be(`/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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:i.jsx(Te,{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(hr,{children:[i.jsx(fr,{children:i.jsxs(ct,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[i.jsx(ke,{className:"text-gray-400",children:"发起人"}),i.jsx(ke,{className:"text-gray-400",children:"匹配到"}),i.jsx(ke,{className:"text-gray-400",children:"联系方式"}),i.jsx(ke,{className:"text-gray-400",children:"时间"})]})}),i.jsxs(pr,{children:[t.map(g=>i.jsxs(ct,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[i.jsx(ve,{className:"text-white",children:g.userNickname||g.userId}),i.jsx(ve,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),i.jsxs(ve,{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(ve,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&i.jsx(ct,{children:i.jsx(ve,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),i.jsx(Zr,{page:s,totalPages:m,total:n,pageSize:o,onPageChange:a,onPageSizeChange:g=>{c(g),a(1)}})]})})})]})}const mN={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"},gN={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮"};function xV({onSwitchTab:t,onOpenCKB:e}={}){const n=ia(),[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([Be("/api/db/match-records?stats=true"),Be("/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 Be("/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(Pn,{className:"w-5 h-5 text-[#38bdac]"})," 找伙伴数据"]}),i.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",children:[i.jsx(Ee,{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(Te,{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(Xs,{className:"w-3 h-3"})," 查看匹配记录"]})]})}),i.jsx(Ee,{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(Te,{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(Bi,{className:"w-3 h-3"})," 今日实时"]})]})}),i.jsx(Ee,{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(Te,{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(Xs,{className:"w-3 h-3"})," 查看用户管理"]})]})}),i.jsx(Ee,{className:"bg-[#0f2137] border-gray-700/40",children:i.jsxs(Te,{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(Ee,{className:"bg-[#0f2137] border-gray-700/40",children:i.jsxs(Te,{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:gN[m.matchType]||"📊"}),i.jsx("span",{className:"text-gray-300 font-medium",children:mN[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(Ns,{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(Ee,{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(Te,{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(Ee,{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(Te,{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(Ee,{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(Te,{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:gN[m.matchType]||"📋"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-gray-400 text-xs",children:mN[m.matchType]||m.matchType}),i.jsx("p",{className:"text-xl font-bold text-white",children:m.total})]})]},m.matchType))})]})]})}const yV=["partner","investor","mentor","team"],og=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],xN=`# 场景获客接口摘要 +- 地址:POST /v1/api/scenarios +- 必填:apiKey、sign、timestamp +- 主标识:phone 或 wechatId 至少一项 +- 可选:name、source、remark、tags、siteTags、portrait +- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 +- 成功:code=200,message=新增成功 或 已存在`;function vV({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(xN),[m,g]=b.useState(!1),[y,v]=b.useState(!1),[j,w]=b.useState([]),[k,E]=b.useState([]),[C,M]=b.useState({}),[D,F]=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 _={};return og.forEach($=>{_[$.key]=C[$.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),_},[C]),I=_=>{const $=r.trim(),oe=a.trim();return _<=3?{type:yV[_],phone:$||void 0,wechat:oe||void 0,userId:"admin_test",name:"后台测试"}:_===4?{matchType:"partner",phone:$||void 0,wechat:oe||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:_===5?{phone:$||void 0,wechatId:oe||void 0,userId:"admin_test",name:"后台测试"}:{}};async function A(){v(!0);try{const[_,$,oe]=await Promise.all([Be("/api/db/config/full?key=ckb_config"),Be("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Be("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),V=_==null?void 0:_.data;V!=null&&V.routes&&M(V.routes),V!=null&&V.docNotes&&u(V.docNotes),V!=null&&V.docContent&&f(V.docContent),$!=null&&$.success&&w($.records||[]),oe!=null&&oe.success&&E(oe.records||[])}finally{v(!1)}}b.useEffect(()=>{n(t)},[t]),b.useEffect(()=>{A()},[]);async function O(){g(!0);try{const _=await ht("/api/db/config",{key:"ckb_config",value:{routes:R,docNotes:c,docContent:h},description:"存客宝接口配置"});alert((_==null?void 0:_.success)!==!1?"存客宝配置已保存":`保存失败: ${(_==null?void 0:_.error)||"未知错误"}`)}catch(_){alert(`保存失败: ${_ instanceof Error?_.message:"网络错误"}`)}finally{g(!1)}}const W=(_,$)=>{M(oe=>({...oe,[_]:{...R[_],...$}}))},X=async _=>{const $=D[_];if($.method==="POST"&&!r.trim()&&!a.trim()){alert("请填写测试手机号");return}const oe=[...D];oe[_]={...$,status:"testing",message:void 0,responseTime:void 0},F(oe);const V=performance.now();try{const ae=$.method==="GET"?await Be($.endpoint):await ht($.endpoint,I(_)),Y=Math.round(performance.now()-V),L=(ae==null?void 0:ae.message)||"",H=(ae==null?void 0:ae.success)===!0||L.includes("已存在")||L.includes("已加入")||L.includes("已提交"),ue=[...D];ue[_]={...$,status:H?"success":"error",message:L||(H?"正常":"异常"),responseTime:Y},F(ue),await A()}catch(ae){const Y=Math.round(performance.now()-V),L=[...D];L[_]={...$,status:"error",message:ae instanceof Error?ae.message:"失败",responseTime:Y},F(L)}},q=async()=>{if(!r.trim()&&!a.trim()){alert("请填写测试手机号");return}for(let _=0;_i.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:_.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:$})}):_.map(oe=>i.jsxs("tr",{className:"border-t border-gray-700/30",children:[i.jsx("td",{className:"px-4 py-3 text-white",children:oe.userNickname||oe.userId}),i.jsx("td",{className:"px-4 py-3 text-gray-300",children:oe.matchType}),i.jsx("td",{className:"px-4 py-3 text-green-400",children:oe.phone||"—"}),i.jsx("td",{className:"px-4 py-3 text-blue-400",children:oe.wechatId||"—"}),i.jsx("td",{className:"px-4 py-3 text-gray-400",children:oe.createdAt?new Date(oe.createdAt).toLocaleString():"—"})]},oe.id))})]})});return i.jsx(Ee,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:i.jsxs(Te,{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(Fe,{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(Xs,{className:"w-3 h-3"})," API 文档"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(re,{onClick:()=>A(),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(re,{onClick:O,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[i.jsx(rn,{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(([_,$])=>i.jsx("button",{type:"button",onClick:()=>n(_),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===_?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:$},_))}),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:og.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"&&Z(j,"暂无已提交线索"),e==="contact"&&Z(k,"暂无有联系方式线索"),e==="config"&&i.jsx("div",{className:"space-y-4",children:og.map(_=>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:_.label}),i.jsx(Fe,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:_.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[_.key].apiUrl,onChange:$=>W(_.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[_.key].apiKey,onChange:$=>W(_.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[_.key].source,onChange:$=>W(_.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[_.key].tags,onChange:$=>W(_.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[_.key].siteTags,onChange:$=>W(_.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[_.key].notes,onChange:$=>W(_.key,{notes:$.target.value})})]})]})]},_.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(Sc,{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:_=>s(_.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:_=>o(_.target.value)})]})]}),i.jsx("div",{className:"flex items-end",children:i.jsxs(re,{onClick:q,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[i.jsx(Bi,{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:D.map((_,$)=>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:[_.status==="idle"&&i.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),_.status==="testing"&&i.jsx(qe,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),_.status==="success"&&i.jsx(hg,{className:"w-3 h-3 text-green-400 shrink-0"}),_.status==="error"&&i.jsx(PN,{className:"w-3 h-3 text-red-400 shrink-0"}),i.jsx("span",{className:"text-white text-xs truncate",children:_.label})]}),i.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[_.responseTime!==void 0&&i.jsxs("span",{className:"text-gray-600 text-[10px]",children:[_.responseTime,"ms"]}),i.jsx("button",{type:"button",onClick:()=>X($),disabled:_.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${_.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(Xs,{className:"w-3 h-3"})," 打开外链"]})]}),i.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||xN})]}),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:_=>u(_.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const bV=[{id:"stats",label:"数据统计",icon:DT},{id:"partner",label:"找伙伴",icon:Pn},{id:"resource",label:"资源对接",icon:_N},{id:"mentor",label:"导师预约",icon:LN},{id:"team",label:"团队招募",icon:vg}];function wV(){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(Pn,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),i.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),i.jsxs(re,{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(Ns,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),n&&i.jsx(vV,{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:bV.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(xV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{a(o||"overview"),r(!0)}}),t==="partner"&&i.jsx(uV,{}),t==="resource"&&i.jsx(hV,{}),t==="mentor"&&i.jsx(mV,{}),t==="team"&&i.jsx(gV,{})]})}function NV(){return i.jsxs("div",{className:"p-8 w-full",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[i.jsx(Ns,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"1. 接口总览"})}),i.jsxs(Te,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"2. 书籍内容"})}),i.jsxs(Te,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"3. 支付"})}),i.jsxs(Te,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"4. 分销与用户"})}),i.jsxs(Te,{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(Ee,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[i.jsx(et,{children:i.jsx(tt,{className:"text-white",children:"5. 管理后台"})}),i.jsxs(Te,{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 jV(){const t=sa();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(HT,{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(re,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:i.jsxs(Iu,{to:"/",children:[i.jsx(CM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function kV(){return i.jsxs(dT,{children:[i.jsx(Mt,{path:"/login",element:i.jsx(UR,{})}),i.jsxs(Mt,{path:"/",element:i.jsx(GA,{}),children:[i.jsx(Mt,{index:!0,element:i.jsx(oT,{to:"/dashboard",replace:!0})}),i.jsx(Mt,{path:"dashboard",element:i.jsx(tP,{})}),i.jsx(Mt,{path:"orders",element:i.jsx(nP,{})}),i.jsx(Mt,{path:"users",element:i.jsx(rP,{})}),i.jsx(Mt,{path:"distribution",element:i.jsx(SP,{})}),i.jsx(Mt,{path:"withdrawals",element:i.jsx(CP,{})}),i.jsx(Mt,{path:"content",element:i.jsx(WB,{})}),i.jsx(Mt,{path:"referral-settings",element:i.jsx(wk,{})}),i.jsx(Mt,{path:"author-settings",element:i.jsx(kE,{})}),i.jsx(Mt,{path:"vip-roles",element:i.jsx(aV,{})}),i.jsx(Mt,{path:"mentors",element:i.jsx(CE,{})}),i.jsx(Mt,{path:"mentor-consultations",element:i.jsx(oV,{})}),i.jsx(Mt,{path:"admin-users",element:i.jsx(SE,{})}),i.jsx(Mt,{path:"settings",element:i.jsx(YB,{})}),i.jsx(Mt,{path:"payment",element:i.jsx(QB,{})}),i.jsx(Mt,{path:"site",element:i.jsx(tV,{})}),i.jsx(Mt,{path:"qrcodes",element:i.jsx(nV,{})}),i.jsx(Mt,{path:"find-partner",element:i.jsx(wV,{})}),i.jsx(Mt,{path:"match",element:i.jsx(sV,{})}),i.jsx(Mt,{path:"match-records",element:i.jsx(iV,{})}),i.jsx(Mt,{path:"api-doc",element:i.jsx(NV,{})})]}),i.jsx(Mt,{path:"*",element:i.jsx(jV,{})})]})}p3.createRoot(document.getElementById("root")).render(i.jsx(b.StrictMode,{children:i.jsx(yT,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:i.jsx(kV,{})})})); 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 eec90623..7a62eec2 100644 --- a/soul-admin/dist/index.html +++ b/soul-admin/dist/index.html @@ -4,8 +4,8 @@ 管理后台 - Soul创业派对 - - + +
    diff --git a/soul-admin/package.json b/soul-admin/package.json index 7663dec2..fd81792a 100644 --- a/soul-admin/package.json +++ b/soul-admin/package.json @@ -18,6 +18,17 @@ "@radix-ui/react-slot": "1.2.4", "@radix-ui/react-switch": "1.2.6", "@radix-ui/react-tabs": "1.1.13", + "@tiptap/extension-image": "^3.20.1", + "@tiptap/extension-link": "^3.20.1", + "@tiptap/extension-mention": "^3.20.1", + "@tiptap/extension-placeholder": "^3.20.1", + "@tiptap/extension-table": "^3.20.1", + "@tiptap/extension-table-cell": "^3.20.1", + "@tiptap/extension-table-header": "^3.20.1", + "@tiptap/extension-table-row": "^3.20.1", + "@tiptap/pm": "^3.20.1", + "@tiptap/react": "^3.20.1", + "@tiptap/starter-kit": "^3.20.1", "class-variance-authority": "0.7.1", "clsx": "2.1.1", "lucide-react": "0.562.0", diff --git a/soul-admin/pnpm-lock.yaml b/soul-admin/pnpm-lock.yaml index 2a94fdc0..d7afaefa 100644 --- a/soul-admin/pnpm-lock.yaml +++ b/soul-admin/pnpm-lock.yaml @@ -32,6 +32,39 @@ importers: '@radix-ui/react-tabs': specifier: 1.1.13 version: 1.1.13(@types/react-dom@18.3.7(@types/react@18.3.28))(@types/react@18.3.28)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@tiptap/extension-image': + specifier: ^3.20.1 + version: 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1)) + '@tiptap/extension-link': + specifier: ^3.20.1 + version: 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + '@tiptap/extension-mention': + specifier: ^3.20.1 + version: 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)(@tiptap/suggestion@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)) + '@tiptap/extension-placeholder': + specifier: ^3.20.1 + version: 3.20.1(@tiptap/extensions@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)) + '@tiptap/extension-table': + specifier: ^3.20.1 + version: 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + '@tiptap/extension-table-cell': + specifier: ^3.20.1 + version: 3.20.1(@tiptap/extension-table@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)) + '@tiptap/extension-table-header': + specifier: ^3.20.1 + version: 3.20.1(@tiptap/extension-table@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)) + '@tiptap/extension-table-row': + specifier: ^3.20.1 + version: 3.20.1(@tiptap/extension-table@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)) + '@tiptap/pm': + specifier: ^3.20.1 + version: 3.20.1 + '@tiptap/react': + specifier: ^3.20.1 + version: 3.20.1(@floating-ui/dom@1.7.5)(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)(@types/react-dom@18.3.7(@types/react@18.3.28))(@types/react@18.3.28)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@tiptap/starter-kit': + specifier: ^3.20.1 + version: 3.20.1 class-variance-authority: specifier: 0.7.1 version: 0.7.1 @@ -55,7 +88,7 @@ importers: version: 3.4.0 zustand: specifier: 5.0.9 - version: 5.0.9(@types/react@18.3.28)(react@18.3.1) + version: 5.0.9(@types/react@18.3.28)(react@18.3.1)(use-sync-external-store@1.6.0(react@18.3.1)) devDependencies: '@eslint/js': specifier: ^9.15.0 @@ -814,6 +847,9 @@ packages: '@radix-ui/rect@1.1.1': resolution: {integrity: sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==} + '@remirror/core-constants@3.0.0': + resolution: {integrity: sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg==} + '@remix-run/router@1.23.2': resolution: {integrity: sha512-Ic6m2U/rMjTkhERIa/0ZtXJP17QUi2CbWE7cqx4J58M8aA3QTfW+2UlQ4psvTX9IO1RfNVhK3pcpdjej7L+t2w==} engines: {node: '>=14.0.0'} @@ -1051,6 +1087,199 @@ packages: '@tailwindcss/postcss@4.1.18': resolution: {integrity: sha512-Ce0GFnzAOuPyfV5SxjXGn0CubwGcuDB0zcdaPuCSzAa/2vII24JTkH+I6jcbXLb1ctjZMZZI6OjDaLPJQL1S0g==} + '@tiptap/core@3.20.1': + resolution: {integrity: sha512-SwkPEWIfaDEZjC8SEIi4kZjqIYUbRgLUHUuQezo5GbphUNC8kM1pi3C3EtoOPtxXrEbY6e4pWEzW54Pcrd+rVA==} + peerDependencies: + '@tiptap/pm': ^3.20.1 + + '@tiptap/extension-blockquote@3.20.1': + resolution: {integrity: sha512-WzNXk/63PQI2fav4Ta6P0GmYRyu8Gap1pV3VUqaVK829iJ6Zt1T21xayATHEHWMK27VT1GLPJkx9Ycr2jfDyQw==} + peerDependencies: + '@tiptap/core': ^3.20.1 + + '@tiptap/extension-bold@3.20.1': + resolution: {integrity: sha512-fz++Qv6Rk/Hov0IYG/r7TJ1Y4zWkuGONe0UN5g0KY32NIMg3HeOHicbi4xsNWTm9uAOl3eawWDkezEMrleObMw==} + peerDependencies: + '@tiptap/core': ^3.20.1 + + '@tiptap/extension-bubble-menu@3.20.1': + resolution: {integrity: sha512-XaPvO6aCoWdFnCBus0s88lnj17NR/OopV79i8Qhgz3WMR0vrsL5zsd45l0lZuu9pSvm5VW47SoxakkJiZC1suw==} + peerDependencies: + '@tiptap/core': ^3.20.1 + '@tiptap/pm': ^3.20.1 + + '@tiptap/extension-bullet-list@3.20.1': + resolution: {integrity: sha512-mbrlvOZo5OF3vLhp+3fk9KuL/6J/wsN0QxF6ZFRAHzQ9NkJdtdfARcBeBnkWXGN8inB6YxbTGY1/E4lmBkOpOw==} + peerDependencies: + '@tiptap/extension-list': ^3.20.1 + + '@tiptap/extension-code-block@3.20.1': + resolution: {integrity: sha512-vKejwBq+Nlj4Ybd3qOyDxIQKzYymdNH+8eXkKwGShk2nfLJIxq69DCyGvmuHgipIO1qcYPJ149UNpGN+YGcdmA==} + peerDependencies: + '@tiptap/core': ^3.20.1 + '@tiptap/pm': ^3.20.1 + + '@tiptap/extension-code@3.20.1': + resolution: {integrity: sha512-509DHINIA/Gg+eTG7TEkfsS8RUiPLH5xZNyLRT0A1oaoaJmECKfrV6aAm05IdfTyqDqz6LW5pbnX6DdUC4keug==} + peerDependencies: + '@tiptap/core': ^3.20.1 + + '@tiptap/extension-document@3.20.1': + resolution: {integrity: sha512-9vrqdGmRV7bQCSY3NLgu7UhIwgOCDp4sKqMNsoNRX0aZ021QQMTvBQDPkiRkCf7MNsnWrNNnr52PVnULEn3vFQ==} + peerDependencies: + '@tiptap/core': ^3.20.1 + + '@tiptap/extension-dropcursor@3.20.1': + resolution: {integrity: sha512-K18L9FX4znn+ViPSIbTLOGcIaXMx/gLNwAPE8wPLwswbHhQqdiY1zzdBw6drgOc1Hicvebo2dIoUlSXOZsOEcw==} + peerDependencies: + '@tiptap/extensions': ^3.20.1 + + '@tiptap/extension-floating-menu@3.20.1': + resolution: {integrity: sha512-BeDC6nfOesIMn5pFuUnkEjOxGv80sOJ8uk1mdt9/3Fkvra8cB9NIYYCVtd6PU8oQFmJ8vFqPrRkUWrG5tbqnOg==} + peerDependencies: + '@floating-ui/dom': ^1.0.0 + '@tiptap/core': ^3.20.1 + '@tiptap/pm': ^3.20.1 + + '@tiptap/extension-gapcursor@3.20.1': + resolution: {integrity: sha512-kZOtttV6Ai8VUAgEng3h4WKFbtdSNJ6ps7r0cRPY+FctWhVmgNb/JJwwyC+vSilR7nRENAhrA/Cv/RxVlvLw+g==} + peerDependencies: + '@tiptap/extensions': ^3.20.1 + + '@tiptap/extension-hard-break@3.20.1': + resolution: {integrity: sha512-9sKpmg/IIdlLXimYWUZ3PplIRcehv4Oc7V1miTqlnAthMzjMqigDkjjgte4JZV67RdnDJTQkRw8TklCAU28Emg==} + peerDependencies: + '@tiptap/core': ^3.20.1 + + '@tiptap/extension-heading@3.20.1': + resolution: {integrity: sha512-unudyfQP6FxnyWinxvPqe/51DG91J6AaJm666RnAubgYMCgym+33kBftx4j4A6qf+ddWYbD00thMNKOnVLjAEQ==} + peerDependencies: + '@tiptap/core': ^3.20.1 + + '@tiptap/extension-horizontal-rule@3.20.1': + resolution: {integrity: sha512-rjFKFXNntdl0jay8oIGFvvykHlpyQTLmrH3Ag2fj3i8yh6MVvqhtaDomYQbw5sxECd5hBkL+T4n2d2DRuVw/QQ==} + peerDependencies: + '@tiptap/core': ^3.20.1 + '@tiptap/pm': ^3.20.1 + + '@tiptap/extension-image@3.20.1': + resolution: {integrity: sha512-/GPFSLNdYSZQ0E6VBXSAk0UFtDdn98HT1Aa2tO+STELqc5jAdFB42dfFnTC6KQzTvcUOUYkE2S1Q22YC5H2XNQ==} + peerDependencies: + '@tiptap/core': ^3.20.1 + + '@tiptap/extension-italic@3.20.1': + resolution: {integrity: sha512-ZYRX13Kt8tR8JOzSXirH3pRpi8x30o7LHxZY58uXBdUvr3tFzOkh03qbN523+diidSVeHP/aMd/+IrplHRkQug==} + peerDependencies: + '@tiptap/core': ^3.20.1 + + '@tiptap/extension-link@3.20.1': + resolution: {integrity: sha512-oYTTIgsQMqpkSnJAuAc+UtIKMuI4lv9e1y4LfI1iYm6NkEUHhONppU59smhxHLzb3Ww7YpDffbp5IgDTAiJztA==} + peerDependencies: + '@tiptap/core': ^3.20.1 + '@tiptap/pm': ^3.20.1 + + '@tiptap/extension-list-item@3.20.1': + resolution: {integrity: sha512-tzgnyTW82lYJkUnadYbatwkI9dLz/OWRSWuFpQPRje/ItmFMWuQ9c9NDD8qLbXPdEYnvrgSAA+ipCD/1G0qA0Q==} + peerDependencies: + '@tiptap/extension-list': ^3.20.1 + + '@tiptap/extension-list-keymap@3.20.1': + resolution: {integrity: sha512-Dr0xsQKx0XPOgDg7xqoWwfv7FFwZ3WeF3eOjqh3rDXlNHMj1v+UW5cj1HLphrsAZHTrVTn2C+VWPJkMZrSbpvQ==} + peerDependencies: + '@tiptap/extension-list': ^3.20.1 + + '@tiptap/extension-list@3.20.1': + resolution: {integrity: sha512-euBRAn0mkV7R2VEE+AuOt3R0j9RHEMFXamPFmtvTo8IInxDClusrm6mJoDjS8gCGAXsQCRiAe1SCQBPgGbOOwg==} + peerDependencies: + '@tiptap/core': ^3.20.1 + '@tiptap/pm': ^3.20.1 + + '@tiptap/extension-mention@3.20.1': + resolution: {integrity: sha512-KOGokj7oH1QpcM8P02V+o6wHsVE0g7XEtdIy2vtq2vlFE3npNNNFkMa8F8VWX6qyC+VeVrNU6SIzS5MFY2TORA==} + peerDependencies: + '@tiptap/core': ^3.20.1 + '@tiptap/pm': ^3.20.1 + '@tiptap/suggestion': ^3.20.1 + + '@tiptap/extension-ordered-list@3.20.1': + resolution: {integrity: sha512-Y+3Ad7OwAdagqdYwCnbqf7/to5ypD4NnUNHA0TXRCs7cAHRA8AdgPoIcGFpaaSpV86oosNU3yfeJouYeroffog==} + peerDependencies: + '@tiptap/extension-list': ^3.20.1 + + '@tiptap/extension-paragraph@3.20.1': + resolution: {integrity: sha512-QFrAtXNyv7JSnomMQc1nx5AnG9mMznfbYJAbdOQYVdbLtAzTfiTuNPNbQrufy5ZGtGaHxDCoaygu2QEfzaKG+Q==} + peerDependencies: + '@tiptap/core': ^3.20.1 + + '@tiptap/extension-placeholder@3.20.1': + resolution: {integrity: sha512-k+jfbCugYGuIFBdojukgEopGazIMOgHrw46FnyN2X/6ICOIjQP2rh2ObslrsUOsJYoEevxCsNF9hZl1HvWX66g==} + peerDependencies: + '@tiptap/extensions': ^3.20.1 + + '@tiptap/extension-strike@3.20.1': + resolution: {integrity: sha512-EYgyma10lpsY+rwbVQL9u+gA7hBlKLSMFH7Zgd37FSxukOjr+HE8iKPQQ+SwbGejyDsPlLT8Z5Jnuxo5Ng90Pg==} + peerDependencies: + '@tiptap/core': ^3.20.1 + + '@tiptap/extension-table-cell@3.20.1': + resolution: {integrity: sha512-nSeboFey+MJqZuCQSbVUajQVaGiypeoUPiGd0CJdyfc0oPsBGGqp7XFJtw5HHEbDqEvSHvGNDoZDFsUTAxUyIg==} + peerDependencies: + '@tiptap/extension-table': ^3.20.1 + + '@tiptap/extension-table-header@3.20.1': + resolution: {integrity: sha512-Xsdgik3Bh5xWSkLaPR/6NDLZR5lgUDIN/yiZ7bLtfTsyGxqEvuW2Y9/j/XP3AfsZzGy2/SuA9bM9zxPcFQxwFA==} + peerDependencies: + '@tiptap/extension-table': ^3.20.1 + + '@tiptap/extension-table-row@3.20.1': + resolution: {integrity: sha512-uYE0SdY4J81wn/fg8Gum0TVSTTBekQhRGeSwDnRfBBd9JILBsLotBTt4ucM7JOUjrP9BjS+QFCT9EstAchPHfQ==} + peerDependencies: + '@tiptap/extension-table': ^3.20.1 + + '@tiptap/extension-table@3.20.1': + resolution: {integrity: sha512-y2o1De3P/FH80nst1D9pYSwtRvxF87WkNAYGurqCkZ6SjwFq1Ifeh9eY+o79R6SCwcfpvQRytCYd+Yw9o5XAtA==} + peerDependencies: + '@tiptap/core': ^3.20.1 + '@tiptap/pm': ^3.20.1 + + '@tiptap/extension-text@3.20.1': + resolution: {integrity: sha512-7PlIbYW8UenV6NPOXHmv8IcmPGlGx6HFq66RmkJAOJRPXPkTLAiX0N8rQtzUJ6jDEHqoJpaHFEHJw0xzW1yF+A==} + peerDependencies: + '@tiptap/core': ^3.20.1 + + '@tiptap/extension-underline@3.20.1': + resolution: {integrity: sha512-fmHvDKzwCgnZUwRreq8tYkb1YyEwgzZ6QQkAQ0CsCRtvRMqzerr3Duz0Als4i8voZTuGDEL3VR6nAJbLAb/wPg==} + peerDependencies: + '@tiptap/core': ^3.20.1 + + '@tiptap/extensions@3.20.1': + resolution: {integrity: sha512-JRc/v+OBH0qLTdvQ7HvHWTxGJH73QOf1MC0R8NhOX2QnAbg2mPFv1h+FjGa2gfLGuCXBdWQomjekWkUKbC4e5A==} + peerDependencies: + '@tiptap/core': ^3.20.1 + '@tiptap/pm': ^3.20.1 + + '@tiptap/pm@3.20.1': + resolution: {integrity: sha512-6kCiGLvpES4AxcEuOhb7HR7/xIeJWMjZlb6J7e8zpiIh5BoQc7NoRdctsnmFEjZvC19bIasccshHQ7H2zchWqw==} + + '@tiptap/react@3.20.1': + resolution: {integrity: sha512-UH1NpVpCaZBGB3Yr5N6aTS+rsCMDl9wHfrt/w+6+Gz4KHFZ2OILA82hELxZzhNc1Lmjz8vgCArKcsYql9gbzJA==} + peerDependencies: + '@tiptap/core': ^3.20.1 + '@tiptap/pm': ^3.20.1 + '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0 + '@types/react-dom': ^17.0.0 || ^18.0.0 || ^19.0.0 + react: ^17.0.0 || ^18.0.0 || ^19.0.0 + react-dom: ^17.0.0 || ^18.0.0 || ^19.0.0 + + '@tiptap/starter-kit@3.20.1': + resolution: {integrity: sha512-opqWxL/4OTEiqmVC0wsU4o3JhAf6LycJ2G/gRIZVAIFLljI9uHfpPMTFGxZ5w9IVVJaP5PJysfwW/635kKqkrw==} + + '@tiptap/suggestion@3.20.1': + resolution: {integrity: sha512-ng7olbzgZhWvPJVJygNQK5153CjquR2eJXpkLq7bRjHlahvt4TH4tGFYvGdYZcXuzbe2g9RoqT7NaPGL9CUq9w==} + peerDependencies: + '@tiptap/core': ^3.20.1 + '@tiptap/pm': ^3.20.1 + '@types/babel__core@7.20.5': resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} @@ -1069,6 +1298,15 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + '@types/linkify-it@5.0.0': + resolution: {integrity: sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==} + + '@types/markdown-it@14.1.2': + resolution: {integrity: sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==} + + '@types/mdurl@2.0.0': + resolution: {integrity: sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==} + '@types/prop-types@15.7.15': resolution: {integrity: sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==} @@ -1080,6 +1318,9 @@ packages: '@types/react@18.3.28': resolution: {integrity: sha512-z9VXpC7MWrhfWipitjNdgCauoMLRdIILQsAEV+ZesIzBq/oUlxk0m3ApZuMFCXdnS4U7KrI+l3WRUEGQ8K1QKw==} + '@types/use-sync-external-store@0.0.6': + resolution: {integrity: sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==} + '@typescript-eslint/eslint-plugin@8.54.0': resolution: {integrity: sha512-hAAP5io/7csFStuOmR782YmTthKBJ9ND3WVL60hcOjvtGFb+HJxH4O5huAcmcZ9v9G8P+JETiZ/G1B8MALnWZQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1225,6 +1466,9 @@ packages: convert-source-map@2.0.0: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + crelt@1.0.6: + resolution: {integrity: sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==} + cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -1258,6 +1502,10 @@ packages: resolution: {integrity: sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg==} engines: {node: '>=10.13.0'} + entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} + esbuild@0.25.12: resolution: {integrity: sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==} engines: {node: '>=18'} @@ -1327,6 +1575,10 @@ packages: fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + fast-equals@5.4.0: + resolution: {integrity: sha512-jt2DW/aNFNwke7AUd+Z+e6pz39KO5rzdbbFCg2sGafS4mk13MI7Z8O5z9cADNn5lhGODIgLwug6TZO2ctf7kcw==} + engines: {node: '>=6.0.0'} + fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} @@ -1530,6 +1782,12 @@ packages: resolution: {integrity: sha512-utfs7Pr5uJyyvDETitgsaqSyjCb2qNRAtuqUeWIAKztsOYdcACf2KtARYXg2pSvhkt+9NfoaNY7fxjl6nuMjIQ==} engines: {node: '>= 12.0.0'} + linkify-it@5.0.0: + resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==} + + linkifyjs@4.3.2: + resolution: {integrity: sha512-NT1CJtq3hHIreOianA8aSXn6Cw0JzYOuDQbOrSPe7gqFnCpKP++MQe3ODgO3oh2GJFORkAAdqredOa60z63GbA==} + locate-path@6.0.0: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} @@ -1552,6 +1810,13 @@ packages: magic-string@0.30.21: resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} + markdown-it@14.1.1: + resolution: {integrity: sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==} + hasBin: true + + mdurl@2.0.0: + resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} + minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} @@ -1577,6 +1842,9 @@ packages: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} + orderedmap@2.1.1: + resolution: {integrity: sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==} + p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -1619,6 +1887,68 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prosemirror-changeset@2.4.0: + resolution: {integrity: sha512-LvqH2v7Q2SF6yxatuPP2e8vSUKS/L+xAU7dPDC4RMyHMhZoGDfBC74mYuyYF4gLqOEG758wajtyhNnsTkuhvng==} + + prosemirror-collab@1.3.1: + resolution: {integrity: sha512-4SnynYR9TTYaQVXd/ieUvsVV4PDMBzrq2xPUWutHivDuOshZXqQ5rGbZM84HEaXKbLdItse7weMGOUdDVcLKEQ==} + + prosemirror-commands@1.7.1: + resolution: {integrity: sha512-rT7qZnQtx5c0/y/KlYaGvtG411S97UaL6gdp6RIZ23DLHanMYLyfGBV5DtSnZdthQql7W+lEVbpSfwtO8T+L2w==} + + prosemirror-dropcursor@1.8.2: + resolution: {integrity: sha512-CCk6Gyx9+Tt2sbYk5NK0nB1ukHi2ryaRgadV/LvyNuO3ena1payM2z6Cg0vO1ebK8cxbzo41ku2DE5Axj1Zuiw==} + + prosemirror-gapcursor@1.4.0: + resolution: {integrity: sha512-z00qvurSdCEWUIulij/isHaqu4uLS8r/Fi61IbjdIPJEonQgggbJsLnstW7Lgdk4zQ68/yr6B6bf7sJXowIgdQ==} + + prosemirror-history@1.5.0: + resolution: {integrity: sha512-zlzTiH01eKA55UAf1MEjtssJeHnGxO0j4K4Dpx+gnmX9n+SHNlDqI2oO1Kv1iPN5B1dm5fsljCfqKF9nFL6HRg==} + + prosemirror-inputrules@1.5.1: + resolution: {integrity: sha512-7wj4uMjKaXWAQ1CDgxNzNtR9AlsuwzHfdFH1ygEHA2KHF2DOEaXl1CJfNPAKCg9qNEh4rum975QLaCiQPyY6Fw==} + + prosemirror-keymap@1.2.3: + resolution: {integrity: sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw==} + + prosemirror-markdown@1.13.4: + resolution: {integrity: sha512-D98dm4cQ3Hs6EmjK500TdAOew4Z03EV71ajEFiWra3Upr7diytJsjF4mPV2dW+eK5uNectiRj0xFxYI9NLXDbw==} + + prosemirror-menu@1.3.0: + resolution: {integrity: sha512-TImyPXCHPcDsSka2/lwJ6WjTASr4re/qWq1yoTTuLOqfXucwF6VcRa2LWCkM/EyTD1UO3CUwiH8qURJoWJRxwg==} + + prosemirror-model@1.25.4: + resolution: {integrity: sha512-PIM7E43PBxKce8OQeezAs9j4TP+5yDpZVbuurd1h5phUxEKIu+G2a+EUZzIC5nS1mJktDJWzbqS23n1tsAf5QA==} + + prosemirror-schema-basic@1.2.4: + resolution: {integrity: sha512-ELxP4TlX3yr2v5rM7Sb70SqStq5NvI15c0j9j/gjsrO5vaw+fnnpovCLEGIcpeGfifkuqJwl4fon6b+KdrODYQ==} + + prosemirror-schema-list@1.5.1: + resolution: {integrity: sha512-927lFx/uwyQaGwJxLWCZRkjXG0p48KpMj6ueoYiu4JX05GGuGcgzAy62dfiV8eFZftgyBUvLx76RsMe20fJl+Q==} + + prosemirror-state@1.4.4: + resolution: {integrity: sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw==} + + prosemirror-tables@1.8.5: + resolution: {integrity: sha512-V/0cDCsHKHe/tfWkeCmthNUcEp1IVO3p6vwN8XtwE9PZQLAZJigbw3QoraAdfJPir4NKJtNvOB8oYGKRl+t0Dw==} + + prosemirror-trailing-node@3.0.0: + resolution: {integrity: sha512-xiun5/3q0w5eRnGYfNlW1uU9W6x5MoFKWwq/0TIRgt09lv7Hcser2QYV8t4muXbEr+Fwo0geYn79Xs4GKywrRQ==} + peerDependencies: + prosemirror-model: ^1.22.1 + prosemirror-state: ^1.4.2 + prosemirror-view: ^1.33.8 + + prosemirror-transform@1.11.0: + resolution: {integrity: sha512-4I7Ce4KpygXb9bkiPS3hTEk4dSHorfRw8uI0pE8IhxlK2GXsqv5tIA7JUSxtSu7u8APVOTtbUBxTmnHIxVkIJw==} + + prosemirror-view@1.41.6: + resolution: {integrity: sha512-mxpcDG4hNQa/CPtzxjdlir5bJFDlm0/x5nGBbStB2BWX+XOQ9M8ekEG+ojqB5BcVu2Rc80/jssCMZzSstJuSYg==} + + punycode.js@2.3.1: + resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==} + engines: {node: '>=6'} + punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} @@ -1688,6 +2018,9 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + rope-sequence@1.3.4: + resolution: {integrity: sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==} + scheduler@0.23.2: resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==} @@ -1759,6 +2092,9 @@ packages: engines: {node: '>=14.17'} hasBin: true + uc.micro@2.1.0: + resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==} + update-browserslist-db@1.2.3: resolution: {integrity: sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==} hasBin: true @@ -1788,6 +2124,11 @@ packages: '@types/react': optional: true + use-sync-external-store@1.6.0: + resolution: {integrity: sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==} + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + vite@6.4.1: resolution: {integrity: sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} @@ -1828,6 +2169,9 @@ packages: yaml: optional: true + w3c-keyname@2.2.8: + resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==} + which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -2500,6 +2844,8 @@ snapshots: '@radix-ui/rect@1.1.1': {} + '@remirror/core-constants@3.0.0': {} + '@remix-run/router@1.23.2': {} '@rolldown/pluginutils@1.0.0-beta.27': {} @@ -2648,6 +2994,219 @@ snapshots: postcss: 8.5.6 tailwindcss: 4.1.18 + '@tiptap/core@3.20.1(@tiptap/pm@3.20.1)': + dependencies: + '@tiptap/pm': 3.20.1 + + '@tiptap/extension-blockquote@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + + '@tiptap/extension-bold@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + + '@tiptap/extension-bubble-menu@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)': + dependencies: + '@floating-ui/dom': 1.7.5 + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + '@tiptap/pm': 3.20.1 + optional: true + + '@tiptap/extension-bullet-list@3.20.1(@tiptap/extension-list@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/extension-list': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + + '@tiptap/extension-code-block@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + '@tiptap/pm': 3.20.1 + + '@tiptap/extension-code@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + + '@tiptap/extension-document@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + + '@tiptap/extension-dropcursor@3.20.1(@tiptap/extensions@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/extensions': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + + '@tiptap/extension-floating-menu@3.20.1(@floating-ui/dom@1.7.5)(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)': + dependencies: + '@floating-ui/dom': 1.7.5 + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + '@tiptap/pm': 3.20.1 + optional: true + + '@tiptap/extension-gapcursor@3.20.1(@tiptap/extensions@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/extensions': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + + '@tiptap/extension-hard-break@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + + '@tiptap/extension-heading@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + + '@tiptap/extension-horizontal-rule@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + '@tiptap/pm': 3.20.1 + + '@tiptap/extension-image@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + + '@tiptap/extension-italic@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + + '@tiptap/extension-link@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + '@tiptap/pm': 3.20.1 + linkifyjs: 4.3.2 + + '@tiptap/extension-list-item@3.20.1(@tiptap/extension-list@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/extension-list': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + + '@tiptap/extension-list-keymap@3.20.1(@tiptap/extension-list@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/extension-list': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + + '@tiptap/extension-list@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + '@tiptap/pm': 3.20.1 + + '@tiptap/extension-mention@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)(@tiptap/suggestion@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + '@tiptap/pm': 3.20.1 + '@tiptap/suggestion': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + + '@tiptap/extension-ordered-list@3.20.1(@tiptap/extension-list@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/extension-list': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + + '@tiptap/extension-paragraph@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + + '@tiptap/extension-placeholder@3.20.1(@tiptap/extensions@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/extensions': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + + '@tiptap/extension-strike@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + + '@tiptap/extension-table-cell@3.20.1(@tiptap/extension-table@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/extension-table': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + + '@tiptap/extension-table-header@3.20.1(@tiptap/extension-table@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/extension-table': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + + '@tiptap/extension-table-row@3.20.1(@tiptap/extension-table@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/extension-table': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + + '@tiptap/extension-table@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + '@tiptap/pm': 3.20.1 + + '@tiptap/extension-text@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + + '@tiptap/extension-underline@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + + '@tiptap/extensions@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + '@tiptap/pm': 3.20.1 + + '@tiptap/pm@3.20.1': + dependencies: + prosemirror-changeset: 2.4.0 + prosemirror-collab: 1.3.1 + prosemirror-commands: 1.7.1 + prosemirror-dropcursor: 1.8.2 + prosemirror-gapcursor: 1.4.0 + prosemirror-history: 1.5.0 + prosemirror-inputrules: 1.5.1 + prosemirror-keymap: 1.2.3 + prosemirror-markdown: 1.13.4 + prosemirror-menu: 1.3.0 + prosemirror-model: 1.25.4 + prosemirror-schema-basic: 1.2.4 + prosemirror-schema-list: 1.5.1 + prosemirror-state: 1.4.4 + prosemirror-tables: 1.8.5 + prosemirror-trailing-node: 3.0.0(prosemirror-model@1.25.4)(prosemirror-state@1.4.4)(prosemirror-view@1.41.6) + prosemirror-transform: 1.11.0 + prosemirror-view: 1.41.6 + + '@tiptap/react@3.20.1(@floating-ui/dom@1.7.5)(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)(@types/react-dom@18.3.7(@types/react@18.3.28))(@types/react@18.3.28)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + '@tiptap/pm': 3.20.1 + '@types/react': 18.3.28 + '@types/react-dom': 18.3.7(@types/react@18.3.28) + '@types/use-sync-external-store': 0.0.6 + fast-equals: 5.4.0 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + use-sync-external-store: 1.6.0(react@18.3.1) + optionalDependencies: + '@tiptap/extension-bubble-menu': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + '@tiptap/extension-floating-menu': 3.20.1(@floating-ui/dom@1.7.5)(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + transitivePeerDependencies: + - '@floating-ui/dom' + + '@tiptap/starter-kit@3.20.1': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + '@tiptap/extension-blockquote': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1)) + '@tiptap/extension-bold': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1)) + '@tiptap/extension-bullet-list': 3.20.1(@tiptap/extension-list@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)) + '@tiptap/extension-code': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1)) + '@tiptap/extension-code-block': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + '@tiptap/extension-document': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1)) + '@tiptap/extension-dropcursor': 3.20.1(@tiptap/extensions@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)) + '@tiptap/extension-gapcursor': 3.20.1(@tiptap/extensions@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)) + '@tiptap/extension-hard-break': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1)) + '@tiptap/extension-heading': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1)) + '@tiptap/extension-horizontal-rule': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + '@tiptap/extension-italic': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1)) + '@tiptap/extension-link': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + '@tiptap/extension-list': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + '@tiptap/extension-list-item': 3.20.1(@tiptap/extension-list@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)) + '@tiptap/extension-list-keymap': 3.20.1(@tiptap/extension-list@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)) + '@tiptap/extension-ordered-list': 3.20.1(@tiptap/extension-list@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)) + '@tiptap/extension-paragraph': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1)) + '@tiptap/extension-strike': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1)) + '@tiptap/extension-text': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1)) + '@tiptap/extension-underline': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1)) + '@tiptap/extensions': 3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1) + '@tiptap/pm': 3.20.1 + + '@tiptap/suggestion@3.20.1(@tiptap/core@3.20.1(@tiptap/pm@3.20.1))(@tiptap/pm@3.20.1)': + dependencies: + '@tiptap/core': 3.20.1(@tiptap/pm@3.20.1) + '@tiptap/pm': 3.20.1 + '@types/babel__core@7.20.5': dependencies: '@babel/parser': 7.29.0 @@ -2673,6 +3232,15 @@ snapshots: '@types/json-schema@7.0.15': {} + '@types/linkify-it@5.0.0': {} + + '@types/markdown-it@14.1.2': + dependencies: + '@types/linkify-it': 5.0.0 + '@types/mdurl': 2.0.0 + + '@types/mdurl@2.0.0': {} + '@types/prop-types@15.7.15': {} '@types/react-dom@18.3.7(@types/react@18.3.28)': @@ -2684,6 +3252,8 @@ snapshots: '@types/prop-types': 15.7.15 csstype: 3.2.3 + '@types/use-sync-external-store@0.0.6': {} + '@typescript-eslint/eslint-plugin@8.54.0(@typescript-eslint/parser@8.54.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.6.3))(eslint@9.39.2(jiti@2.6.1))(typescript@5.6.3)': dependencies: '@eslint-community/regexpp': 4.12.2 @@ -2865,6 +3435,8 @@ snapshots: convert-source-map@2.0.0: {} + crelt@1.0.6: {} + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 @@ -2890,6 +3462,8 @@ snapshots: graceful-fs: 4.2.11 tapable: 2.3.0 + entities@4.5.0: {} + esbuild@0.25.12: optionalDependencies: '@esbuild/aix-ppc64': 0.25.12 @@ -3001,6 +3575,8 @@ snapshots: fast-deep-equal@3.1.3: {} + fast-equals@5.4.0: {} + fast-json-stable-stringify@2.1.0: {} fast-levenshtein@2.0.6: {} @@ -3145,6 +3721,12 @@ snapshots: lightningcss-win32-arm64-msvc: 1.30.2 lightningcss-win32-x64-msvc: 1.30.2 + linkify-it@5.0.0: + dependencies: + uc.micro: 2.1.0 + + linkifyjs@4.3.2: {} + locate-path@6.0.0: dependencies: p-locate: 5.0.0 @@ -3167,6 +3749,17 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.5 + markdown-it@14.1.1: + dependencies: + argparse: 2.0.1 + entities: 4.5.0 + linkify-it: 5.0.0 + mdurl: 2.0.0 + punycode.js: 2.3.1 + uc.micro: 2.1.0 + + mdurl@2.0.0: {} + minimatch@3.1.2: dependencies: brace-expansion: 1.1.12 @@ -3192,6 +3785,8 @@ snapshots: type-check: 0.4.0 word-wrap: 1.2.5 + orderedmap@2.1.1: {} + p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 @@ -3224,6 +3819,111 @@ snapshots: prelude-ls@1.2.1: {} + prosemirror-changeset@2.4.0: + dependencies: + prosemirror-transform: 1.11.0 + + prosemirror-collab@1.3.1: + dependencies: + prosemirror-state: 1.4.4 + + prosemirror-commands@1.7.1: + dependencies: + prosemirror-model: 1.25.4 + prosemirror-state: 1.4.4 + prosemirror-transform: 1.11.0 + + prosemirror-dropcursor@1.8.2: + dependencies: + prosemirror-state: 1.4.4 + prosemirror-transform: 1.11.0 + prosemirror-view: 1.41.6 + + prosemirror-gapcursor@1.4.0: + dependencies: + prosemirror-keymap: 1.2.3 + prosemirror-model: 1.25.4 + prosemirror-state: 1.4.4 + prosemirror-view: 1.41.6 + + prosemirror-history@1.5.0: + dependencies: + prosemirror-state: 1.4.4 + prosemirror-transform: 1.11.0 + prosemirror-view: 1.41.6 + rope-sequence: 1.3.4 + + prosemirror-inputrules@1.5.1: + dependencies: + prosemirror-state: 1.4.4 + prosemirror-transform: 1.11.0 + + prosemirror-keymap@1.2.3: + dependencies: + prosemirror-state: 1.4.4 + w3c-keyname: 2.2.8 + + prosemirror-markdown@1.13.4: + dependencies: + '@types/markdown-it': 14.1.2 + markdown-it: 14.1.1 + prosemirror-model: 1.25.4 + + prosemirror-menu@1.3.0: + dependencies: + crelt: 1.0.6 + prosemirror-commands: 1.7.1 + prosemirror-history: 1.5.0 + prosemirror-state: 1.4.4 + + prosemirror-model@1.25.4: + dependencies: + orderedmap: 2.1.1 + + prosemirror-schema-basic@1.2.4: + dependencies: + prosemirror-model: 1.25.4 + + prosemirror-schema-list@1.5.1: + dependencies: + prosemirror-model: 1.25.4 + prosemirror-state: 1.4.4 + prosemirror-transform: 1.11.0 + + prosemirror-state@1.4.4: + dependencies: + prosemirror-model: 1.25.4 + prosemirror-transform: 1.11.0 + prosemirror-view: 1.41.6 + + prosemirror-tables@1.8.5: + dependencies: + prosemirror-keymap: 1.2.3 + prosemirror-model: 1.25.4 + prosemirror-state: 1.4.4 + prosemirror-transform: 1.11.0 + prosemirror-view: 1.41.6 + + prosemirror-trailing-node@3.0.0(prosemirror-model@1.25.4)(prosemirror-state@1.4.4)(prosemirror-view@1.41.6): + dependencies: + '@remirror/core-constants': 3.0.0 + escape-string-regexp: 4.0.0 + prosemirror-model: 1.25.4 + prosemirror-state: 1.4.4 + prosemirror-view: 1.41.6 + + prosemirror-transform@1.11.0: + dependencies: + prosemirror-model: 1.25.4 + + prosemirror-view@1.41.6: + dependencies: + prosemirror-model: 1.25.4 + prosemirror-state: 1.4.4 + prosemirror-transform: 1.11.0 + + punycode.js@2.3.1: {} + punycode@2.3.1: {} react-dom@18.3.1(react@18.3.1): @@ -3310,6 +4010,8 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.57.1 fsevents: 2.3.3 + rope-sequence@1.3.4: {} + scheduler@0.23.2: dependencies: loose-envify: 1.4.0 @@ -3366,6 +4068,8 @@ snapshots: typescript@5.6.3: {} + uc.micro@2.1.0: {} + update-browserslist-db@1.2.3(browserslist@4.28.1): dependencies: browserslist: 4.28.1 @@ -3391,6 +4095,10 @@ snapshots: optionalDependencies: '@types/react': 18.3.28 + use-sync-external-store@1.6.0(react@18.3.1): + dependencies: + react: 18.3.1 + vite@6.4.1(jiti@2.6.1)(lightningcss@1.30.2): dependencies: esbuild: 0.25.12 @@ -3404,6 +4112,8 @@ snapshots: jiti: 2.6.1 lightningcss: 1.30.2 + w3c-keyname@2.2.8: {} + which@2.0.2: dependencies: isexe: 2.0.0 @@ -3414,7 +4124,8 @@ snapshots: yocto-queue@0.1.0: {} - zustand@5.0.9(@types/react@18.3.28)(react@18.3.1): + zustand@5.0.9(@types/react@18.3.28)(react@18.3.1)(use-sync-external-store@1.6.0(react@18.3.1)): optionalDependencies: '@types/react': 18.3.28 react: 18.3.1 + use-sync-external-store: 1.6.0(react@18.3.1) diff --git a/soul-admin/src/App.tsx b/soul-admin/src/App.tsx index 7562bb5a..78e12296 100644 --- a/soul-admin/src/App.tsx +++ b/soul-admin/src/App.tsx @@ -19,6 +19,7 @@ import { VipRolesPage } from './pages/vip-roles/VipRolesPage' import { MentorsPage } from './pages/mentors/MentorsPage' import { MentorConsultationsPage } from './pages/mentor-consultations/MentorConsultationsPage' import { AdminUsersPage } from './pages/admin-users/AdminUsersPage' +import { FindPartnerPage } from './pages/find-partner/FindPartnerPage' import { ApiDocPage } from './pages/api-doc/ApiDocPage' import { NotFoundPage } from './pages/not-found/NotFoundPage' @@ -44,6 +45,7 @@ function App() { } /> } /> } /> + } /> } /> } /> } /> diff --git a/soul-admin/src/components/RichEditor.css b/soul-admin/src/components/RichEditor.css new file mode 100644 index 00000000..f761457d --- /dev/null +++ b/soul-admin/src/components/RichEditor.css @@ -0,0 +1,196 @@ +.rich-editor-wrapper { + border: 1px solid #374151; + border-radius: 0.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 0.15s; +} +.rich-editor-toolbar button:hover { background: #1f2937; color: #d1d5db; } +.rich-editor-toolbar button.is-active { background: rgba(56, 189, 172, 0.2); color: #38bdac; } +.rich-editor-toolbar button:disabled { opacity: 0.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: white; + 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: white; } +.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: 0.8em 0 0.4em; color: white; } +.rich-editor-content h2 { font-size: 1.3em; font-weight: 600; margin: 0.7em 0 0.3em; color: white; } +.rich-editor-content h3 { font-size: 1.15em; font-weight: 600; margin: 0.6em 0 0.3em; color: white; } +.rich-editor-content p { margin: 0.4em 0; } +.rich-editor-content strong { color: white; } +.rich-editor-content code { background: #1f2937; padding: 2px 6px; border-radius: 3px; font-size: 0.9em; color: #38bdac; } +.rich-editor-content pre { background: #1f2937; padding: 12px; border-radius: 6px; overflow-x: auto; margin: 0.6em 0; } +.rich-editor-content blockquote { + border-left: 3px solid #38bdac; + padding-left: 12px; + margin: 0.6em 0; + color: #9ca3af; +} +.rich-editor-content ul, .rich-editor-content ol { padding-left: 1.5em; margin: 0.4em 0; } +.rich-editor-content li { margin: 0.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: 0.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: 0.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: rgba(56, 189, 172, 0.15); + color: #38bdac; + border-radius: 4px; + padding: 1px 4px; + font-weight: 500; +} + +.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 rgba(0,0,0,0.4); +} +.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: rgba(56, 189, 172, 0.15); + 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 rgba(0,0,0,0.3); +} +.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; } diff --git a/soul-admin/src/components/RichEditor.tsx b/soul-admin/src/components/RichEditor.tsx new file mode 100644 index 00000000..87c3ecc0 --- /dev/null +++ b/soul-admin/src/components/RichEditor.tsx @@ -0,0 +1,335 @@ +import { useEditor, EditorContent, type Editor } from '@tiptap/react' +import StarterKit from '@tiptap/starter-kit' +import Image from '@tiptap/extension-image' +import Link from '@tiptap/extension-link' +import Mention from '@tiptap/extension-mention' +import Placeholder from '@tiptap/extension-placeholder' +import { Table, TableRow, TableCell, TableHeader } from '@tiptap/extension-table' +import { useCallback, useEffect, useRef, useState, forwardRef, useImperativeHandle } from 'react' +import { + Bold, Italic, Strikethrough, Code, List, ListOrdered, Quote, + Heading1, Heading2, Heading3, Image as ImageIcon, Link as LinkIcon, + Table as TableIcon, Undo, Redo, Minus, +} from 'lucide-react' + +export interface PersonItem { + id: string + name: string + label?: string +} + +export interface LinkTagItem { + id: string + label: string + url: string + type: 'url' | 'miniprogram' | 'ckb' + appId?: string + pagePath?: string +} + +export interface RichEditorRef { + getHTML: () => string + getMarkdown: () => string +} + +interface RichEditorProps { + content: string + onChange: (html: string) => void + onImageUpload?: (file: File) => Promise + persons?: PersonItem[] + linkTags?: LinkTagItem[] + placeholder?: string + className?: string +} + +function htmlToMarkdown(html: string): string { + if (!html) return '' + let md = html + md = md.replace(/]*>(.*?)<\/h1>/gi, '# $1\n\n') + md = md.replace(/]*>(.*?)<\/h2>/gi, '## $1\n\n') + md = md.replace(/]*>(.*?)<\/h3>/gi, '### $1\n\n') + md = md.replace(/]*>(.*?)<\/strong>/gi, '**$1**') + md = md.replace(/]*>(.*?)<\/b>/gi, '**$1**') + md = md.replace(/]*>(.*?)<\/em>/gi, '*$1*') + md = md.replace(/]*>(.*?)<\/i>/gi, '*$1*') + md = md.replace(/]*>(.*?)<\/s>/gi, '~~$1~~') + md = md.replace(/]*>(.*?)<\/del>/gi, '~~$1~~') + md = md.replace(/]*>(.*?)<\/code>/gi, '`$1`') + md = md.replace(/]*>(.*?)<\/blockquote>/gi, '> $1\n\n') + md = md.replace(/]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi, '![$2]($1)') + md = md.replace(/]*src="([^"]*)"[^>]*>/gi, '![]($1)') + md = md.replace(/]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi, '[$2]($1)') + md = md.replace(/]*>(.*?)<\/li>/gi, '- $1\n') + md = md.replace(/<\/?[uo]l[^>]*>/gi, '\n') + md = md.replace(//gi, '\n') + md = md.replace(/]*>(.*?)<\/p>/gi, '$1\n\n') + md = md.replace(//gi, '---\n\n') + md = md.replace(/]*data-type="mention"[^>]*data-id="([^"]*)"[^>]*>@([^<]*)<\/span>/gi, '@$2') + md = md.replace(/]*data-type="linkTag"[^>]*data-url="([^"]*)"[^>]*>#([^<]*)<\/span>/gi, '#[$2]($1)') + md = md.replace(/<[^>]+>/g, '') + md = md.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'") + md = md.replace(/\n{3,}/g, '\n\n') + return md.trim() +} + +function markdownToHtml(md: string): string { + if (!md) return '' + if (md.startsWith('<') && md.includes('$1') + html = html.replace(/^## (.+)$/gm, '

    $1

    ') + html = html.replace(/^# (.+)$/gm, '

    $1

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

    $1

    ') + html = html.replace(/^---$/gm, '
    ') + html = html.replace(/^- (.+)$/gm, '
  • $1
  • ') + const lines = html.split('\n') + const result: string[] = [] + for (const line of lines) { + const trimmed = line.trim() + if (!trimmed) continue + if (/^<(?:h[1-6]|blockquote|hr|li|ul|ol|table|img)/.test(trimmed)) { + result.push(trimmed) + } else { + result.push(`

    ${trimmed}

    `) + } + } + return result.join('') +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const MentionSuggestion = (persons: PersonItem[]): any => ({ + items: ({ query }: { query: string }) => + persons.filter(p => p.name.toLowerCase().includes(query.toLowerCase()) || p.id.includes(query)).slice(0, 8), + render: () => { + let popup: HTMLDivElement | null = null + let selectedIndex = 0 + let items: PersonItem[] = [] + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let command: ((p: { id: string; label: string }) => void) | null = null + + const update = () => { + if (!popup) return + popup.innerHTML = items.map((item, i) => + `
    + @${item.name} + ${item.label || item.id} +
    ` + ).join('') + popup.querySelectorAll('.mention-item').forEach(el => { + el.addEventListener('click', () => { + const idx = parseInt(el.getAttribute('data-index') || '0') + if (command && items[idx]) command({ id: items[idx].id, label: items[idx].name }) + }) + }) + } + + return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onStart: (props: any) => { + popup = document.createElement('div') + popup.className = 'mention-popup' + document.body.appendChild(popup) + items = props.items + command = props.command + selectedIndex = 0 + update() + if (props.clientRect) { + const rect = props.clientRect() + if (rect) { + popup.style.top = `${rect.bottom + 4}px` + popup.style.left = `${rect.left}px` + } + } + }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onUpdate: (props: any) => { + items = props.items + command = props.command + selectedIndex = 0 + update() + if (props.clientRect && popup) { + const rect = props.clientRect() + if (rect) { + popup.style.top = `${rect.bottom + 4}px` + popup.style.left = `${rect.left}px` + } + } + }, + onKeyDown: (props: { event: KeyboardEvent }) => { + if (props.event.key === 'ArrowUp') { selectedIndex = Math.max(0, selectedIndex - 1); update(); return true } + if (props.event.key === 'ArrowDown') { selectedIndex = Math.min(items.length - 1, selectedIndex + 1); update(); return true } + if (props.event.key === 'Enter') { if (command && items[selectedIndex]) command({ id: items[selectedIndex].id, label: items[selectedIndex].name }); return true } + if (props.event.key === 'Escape') { popup?.remove(); popup = null; return true } + return false + }, + onExit: () => { popup?.remove(); popup = null }, + } + }, +}) + +const RichEditor = forwardRef(({ + content, + onChange, + onImageUpload, + persons = [], + linkTags = [], + placeholder = '开始编辑内容...', + className, +}, ref) => { + const fileInputRef = useRef(null) + const [linkUrl, setLinkUrl] = useState('') + const [showLinkInput, setShowLinkInput] = useState(false) + const initialContent = useRef(markdownToHtml(content)) + + const editor = useEditor({ + extensions: [ + StarterKit, + Image.configure({ inline: true, allowBase64: true }), + Link.configure({ openOnClick: false, HTMLAttributes: { class: 'rich-link' } }), + Mention.configure({ + HTMLAttributes: { class: 'mention-tag' }, + suggestion: MentionSuggestion(persons), + }), + Placeholder.configure({ placeholder }), + Table.configure({ resizable: true }), + TableRow, TableCell, TableHeader, + ], + content: initialContent.current, + onUpdate: ({ editor: ed }: { editor: Editor }) => { + onChange(ed.getHTML()) + }, + editorProps: { + attributes: { class: 'rich-editor-content' }, + }, + }) + + useImperativeHandle(ref, () => ({ + getHTML: () => editor?.getHTML() || '', + getMarkdown: () => htmlToMarkdown(editor?.getHTML() || ''), + })) + + useEffect(() => { + if (editor && content !== editor.getHTML()) { + const html = markdownToHtml(content) + if (html !== editor.getHTML()) { + editor.commands.setContent(html) + } + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [content]) + + const handleImageUpload = useCallback(async (e: React.ChangeEvent) => { + const file = e.target.files?.[0] + if (!file || !editor) return + if (onImageUpload) { + const url = await onImageUpload(file) + if (url) editor.chain().focus().setImage({ src: url }).run() + } else { + const reader = new FileReader() + reader.onload = () => { + if (typeof reader.result === 'string') editor.chain().focus().setImage({ src: reader.result }).run() + } + reader.readAsDataURL(file) + } + e.target.value = '' + }, [editor, onImageUpload]) + + const insertLinkTag = useCallback((tag: LinkTagItem) => { + if (!editor) return + editor.chain().focus().insertContent({ + type: 'text', + marks: [{ type: 'link', attrs: { href: tag.url, target: '_blank' } }], + text: `#${tag.label}`, + }).run() + }, [editor]) + + const addLink = useCallback(() => { + if (!editor || !linkUrl) return + editor.chain().focus().setLink({ href: linkUrl }).run() + setLinkUrl('') + setShowLinkInput(false) + }, [editor, linkUrl]) + + if (!editor) return null + + return ( +
    +
    +
    + + + + +
    +
    +
    + + + +
    +
    +
    + + + + +
    +
    +
    + + + + +
    +
    +
    + + +
    + {linkTags.length > 0 && ( + <> +
    +
    + +
    + + )} +
    + {showLinkInput && ( +
    + setLinkUrl(e.target.value)} + onKeyDown={e => e.key === 'Enter' && addLink()} + className="link-input" + /> + + +
    + )} + +
    + ) +}) + +RichEditor.displayName = 'RichEditor' +export default RichEditor diff --git a/soul-admin/src/components/modules/user/UserDetailModal.tsx b/soul-admin/src/components/modules/user/UserDetailModal.tsx index bff93ab1..c2e95e30 100644 --- a/soul-admin/src/components/modules/user/UserDetailModal.tsx +++ b/soul-admin/src/components/modules/user/UserDetailModal.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react' +import { useState, useEffect } from 'react' import { Dialog, DialogContent, @@ -10,10 +10,11 @@ import { Badge } from '@/components/ui/badge' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' +import { Switch } from '@/components/ui/switch' import { User, Phone, - History, + MapPin, RefreshCw, Link2, BookOpen, @@ -24,6 +25,13 @@ import { Save, X, Tag, + Zap, + Search, + CheckCircle2, + Crown, + Key, + Navigation, + Smartphone, } from 'lucide-react' import { get, put, post } from '@/api/client' @@ -60,6 +68,12 @@ interface UserDetail { vipProject?: string | null vipContact?: string | null vipBio?: string | null + vipRole?: string | null + // 扩展字段 + mbti?: string + region?: string + industry?: string + position?: string } interface UserTrack { @@ -72,6 +86,14 @@ interface UserTrack { timeAgo: string } +interface ShensheShouData { + rfm_score?: number + user_level?: string + tags?: string[] + last_active?: string + phone?: string +} + export function UserDetailModal({ open, onClose, @@ -90,8 +112,41 @@ export function UserDetailModal({ const [editTags, setEditTags] = useState([]) const [newTag, setNewTag] = useState('') + // 修改密码 + const [newPassword, setNewPassword] = useState('') + const [confirmPassword, setConfirmPassword] = useState('') + const [passwordSaving, setPasswordSaving] = useState(false) + + // 设成超级个体(VIP) + const [vipForm, setVipForm] = useState({ isVip: false, vipExpireDate: '', vipRole: '', vipName: '', vipProject: '', vipContact: '', vipBio: '' }) + const [vipRoles, setVipRoles] = useState<{ id: number; name: string }[]>([]) + const [vipSaving, setVipSaving] = useState(false) + + // 用户资料完善(神射手) + const [sssLoading, setSssLoading] = useState(false) + const [sssData, setSssData] = useState(null) + const [sssError, setSssError] = useState(null) + const [sssQueryPhone, setSssQueryPhone] = useState('') + const [sssQueryWechatId, setSssQueryWechatId] = useState('') + const [sssQueryOpenId, setSssQueryOpenId] = useState('') + const [batchIngestLoading, setBatchIngestLoading] = useState(false) + const [batchIngestResult, setBatchIngestResult] = useState | null>(null) + const [ckbWechatOwner, setCkbWechatOwner] = useState('') + useEffect(() => { - if (open && userId) loadUserDetail() + if (open && userId) { + setActiveTab('info') + setSssData(null) + setSssError(null) + setBatchIngestResult(null) + setCkbWechatOwner('') + setNewPassword('') + setConfirmPassword('') + loadUserDetail() + get<{ success?: boolean; data?: { id: number; name: string }[] }>('/api/db/vip-roles').then((r) => { + if (r?.success && (r as { data?: { id: number; name: string }[] }).data) setVipRoles((r as { data: { id: number; name: string }[] }).data) + }).catch(() => {}) + } }, [open, userId]) async function loadUserDetail() { @@ -106,24 +161,38 @@ export function UserDetailModal({ setUser(u) setEditPhone(u.phone || '') setEditNickname(u.nickname || '') - setEditTags(typeof u.tags === 'string' ? (JSON.parse(u.tags || '[]') as string[]) : []) + setSssQueryPhone(u.phone || '') + setSssQueryWechatId(u.wechatId || '') + setSssQueryOpenId(u.openId || '') + try { + setEditTags(typeof u.tags === 'string' ? (JSON.parse(u.tags || '[]') as string[]) : []) + } catch { + setEditTags([]) + } + setVipForm({ + isVip: !!(u.isVip ?? false), + vipExpireDate: u.vipExpireDate ? String(u.vipExpireDate).slice(0, 10) : '', + vipRole: String(u.vipRole ?? ''), + vipName: String(u.vipName ?? ''), + vipProject: String(u.vipProject ?? ''), + vipContact: String(u.vipContact ?? ''), + vipBio: String(u.vipBio ?? ''), + }) } + // 行为轨迹(用户旅程) try { const trackData = await get<{ success?: boolean; tracks?: UserTrack[] }>( `/api/user/track?userId=${encodeURIComponent(userId)}&limit=50`, ) if (trackData?.success && trackData.tracks) setTracks(trackData.tracks) - } catch { - setTracks([]) - } + } catch { setTracks([]) } + // 关系链路 try { const refData = await get<{ success?: boolean; referrals?: unknown[] }>( `/api/db/users/referrals?userId=${encodeURIComponent(userId)}`, ) if (refData?.success && refData.referrals) setReferrals(refData.referrals) - } catch { - setReferrals([]) - } + } catch { setReferrals([]) } } catch (e) { console.error('Load user detail error:', e) } finally { @@ -132,10 +201,7 @@ export function UserDetailModal({ } async function handleSyncCKB() { - if (!user?.phone) { - alert('用户未绑定手机号,无法同步') - return - } + if (!user?.phone) { alert('用户未绑定手机号,无法同步'); return } setSyncing(true) try { const data = await post<{ success?: boolean; error?: string }>('/api/ckb/sync', { @@ -143,12 +209,8 @@ export function UserDetailModal({ phone: user.phone, userId: user.id, }) - if (data?.success) { - alert('同步成功') - loadUserDetail() - } else { - alert('同步失败: ' + (data as { error?: string })?.error) - } + if (data?.success) { alert('同步成功'); loadUserDetail() } + else alert('同步失败: ' + (data as { error?: string })?.error) } catch (e) { console.error('Sync CKB error:', e) alert('同步失败') @@ -190,8 +252,115 @@ export function UserDetailModal({ } } - const removeTag = (tag: string) => { - setEditTags(editTags.filter((t) => t !== tag)) + const removeTag = (tag: string) => setEditTags(editTags.filter((t) => t !== tag)) + + async function handleSavePassword() { + if (!user) return + if (!newPassword) { alert('请输入新密码'); return } + if (newPassword !== confirmPassword) { alert('两次密码不一致'); return } + if (newPassword.length < 6) { alert('密码至少 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) } + } + + async function handleSaveVip() { + if (!user) return + if (vipForm.isVip && !vipForm.vipExpireDate.trim()) { alert('开启 VIP 请填写有效到期日'); return } + setVipSaving(true) + try { + const payload = { + id: user.id, + isVip: vipForm.isVip, + vipExpireDate: vipForm.isVip ? vipForm.vipExpireDate : undefined, + vipRole: vipForm.vipRole || undefined, + vipName: vipForm.vipName || undefined, + vipProject: vipForm.vipProject || undefined, + vipContact: vipForm.vipContact || undefined, + 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) } + } + + // 用户资料完善查询(支持多维度) + async function handleSSSQuery() { + if (!sssQueryPhone && !sssQueryOpenId && !sssQueryWechatId) { + setSssError('请至少输入手机号、微信号或 OpenID 中的一项') + return + } + setSssLoading(true) + setSssError(null) + setSssData(null) + try { + const params = new URLSearchParams() + if (sssQueryPhone) params.set('phone', sssQueryPhone) + if (sssQueryOpenId) params.set('openId', sssQueryOpenId) + if (sssQueryWechatId) params.set('wechatId', sssQueryWechatId) + const data = await get<{ success?: boolean; data?: ShensheShouData; error?: string }>( + `/api/admin/shensheshou/query?${params}`, + ) + if (data?.success && data.data) { + setSssData(data.data) + // 自动回填到用户信息 + if (user) await handleSSSEnrich(data.data) + } + else setSssError(data?.error || '未查询到数据,该用户可能未在神射手收录') + } catch (e) { + console.error('SSS query error:', e) + setSssError('请求失败,请检查神射手接口配置') + } finally { + setSssLoading(false) + } + } + + // 查询后自动回填用户基础信息 + async function handleSSSEnrich(_sssResult?: ShensheShouData) { + if (!user) return + try { + await post('/api/admin/shensheshou/enrich', { + userId: user.id, + phone: sssQueryPhone || user.phone || '', + openId: sssQueryOpenId || user.openId || '', + wechatId: sssQueryWechatId || user.wechatId || '', + }) + loadUserDetail() + } catch (e) { + console.error('SSS enrich error:', e) + } + } + + // 神射手 - 将当前用户信息推送/同步到神射手 + async function handleSSSIngest() { + if (!user) return + setBatchIngestLoading(true) + setBatchIngestResult(null) + try { + const payload = { + users: [{ + phone: user.phone || '', + name: user.nickname || '', + openId: user.openId || '', + tags: editTags, + }] + } + const data = await post<{ success?: boolean; data?: Record; error?: string }>( + '/api/admin/shensheshou/ingest', + payload, + ) + if (data?.success && data.data) setBatchIngestResult(data.data) + else setBatchIngestResult({ error: data?.error || '推送失败' }) + } catch (e) { + console.error('SSS ingest error:', e) + setBatchIngestResult({ error: '请求失败' }) + } finally { + setBatchIngestLoading(false) + } } const getActionIcon = (action: string) => { @@ -204,8 +373,10 @@ export function UserDetailModal({ share: Link2, bind_phone: Phone, bind_wechat: MessageCircle, + fill_profile: Tag, + visit_page: Navigation, } - const Icon = icons[action] || History + const Icon = icons[action] || Clock return } @@ -218,9 +389,8 @@ export function UserDetailModal({ 用户详情 - {user?.phone && ( - 已绑定手机 - )} + {user?.phone && 已绑定手机} + {user?.isVip && VIP} @@ -230,55 +400,66 @@ export function UserDetailModal({ 加载中...
    ) : user ? ( -
    -
    -
    +
    + {/* 用户头部信息 */} +
    +
    {user.avatar ? ( ) : ( user.nickname?.charAt(0) || '?' )}
    -
    -
    +
    +

    {user.nickname}

    - {user.isAdmin && ( - 管理员 - )} - {user.hasFullBook && ( - 全书已购 - )} + {user.isAdmin && 管理员} + {user.hasFullBook && 全书已购} + {user.vipRole && {user.vipRole}}

    {user.phone ? `📱 ${user.phone}` : '未绑定手机'} {user.wechatId && ` · 💬 ${user.wechatId}`} + {user.mbti && ` · ${user.mbti}`}

    -

    - ID: {user.id} · 推广码: {user.referralCode ?? '-'} -

    +
    +

    ID: {user.id.slice(0, 16)}…

    + {user.referralCode && ( +

    + 推广码: + {user.referralCode} +

    + )} +
    -
    -

    ¥{(user.earnings || 0).toFixed(2)}

    +
    +

    ¥{(user.earnings || 0).toFixed(2)}

    累计收益

    - - + + 基础信息 - + 标签体系 - - 行为轨迹 + + + 用户旅程 - + 关系链路 + + + 用户资料完善 + + {/* ===== 基础信息 ===== */}
    @@ -300,6 +481,36 @@ export function UserDetailModal({ />
    + {/* 详细信息展示 */} +
    + {user.openId && ( +
    +

    微信 OpenID

    +

    {user.openId}

    +
    + )} + {user.region && ( +
    + +
    +

    地区

    +

    {user.region}

    +
    +
    + )} + {user.industry && ( +
    +

    行业

    +

    {user.industry}

    +
    + )} + {user.position && ( +
    +

    职位

    +

    {user.position}

    +
    + )} +

    推荐人数

    @@ -318,6 +529,149 @@ export function UserDetailModal({

    + + {/* 快捷操作:修改密码 & 设成超级个体 */} +
    +
    +
    + + 修改密码 +
    +
    + setNewPassword(e.target.value)} + /> + setConfirmPassword(e.target.value)} + /> + +
    +
    +
    +
    + + 设成超级个体 +
    +
    +
    + + setVipForm((f) => ({ ...f, isVip: c }))} + /> +
    + {vipForm.isVip && ( +
    + + setVipForm((f) => ({ ...f, vipExpireDate: e.target.value }))} + /> +
    + )} +
    + + +
    +
    + + setVipForm((f) => ({ ...f, vipName: e.target.value }))} + /> +
    + +
    +
    +
    + + {/* VIP 信息(只读展示) */} + {user.isVip && ( +
    +
    + + VIP 信息 + {user.vipRole || 'VIP'} +
    +
    + {user.vipName &&
    展示名:{user.vipName}
    } + {user.vipProject &&
    项目:{user.vipProject}
    } + {user.vipContact &&
    联系方式:{user.vipContact}
    } + {user.vipExpireDate &&
    到期时间:{new Date(user.vipExpireDate).toLocaleDateString()}
    } +
    + {user.vipBio &&

    {user.vipBio}

    } +
    + )} + {/* 微信归属(存客宝) */} +
    +
    + + 微信归属 + 该用户归属在哪个微信号下 +
    +
    + setCkbWechatOwner(e.target.value)} + /> + +
    + {user.wechatId && ( +

    当前归属:{user.wechatId}

    + )} +
    + + {/* 存客宝同步 */}
    @@ -331,13 +685,9 @@ export function UserDetailModal({ className="bg-[#38bdac] hover:bg-[#2da396] text-white" > {syncing ? ( - <> - 同步中... - + <> 同步中... ) : ( - <> - 同步数据 - + <> 同步数据 )}
    @@ -360,54 +710,134 @@ export function UserDetailModal({
    + {/* ===== 标签体系 ===== */}
    - 系统标签 + 用户标签 + 基于《一场 Soul 的创业实验》维度打标
    -
    - {editTags.map((tag, i) => ( - - {tag} - - + {/* 自动打标说明 */} +
    + + 命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消 +
    + {/* 预设标签分类 */} +
    + {[ + { + category: '身份类型', + tags: ['创业者', '打工人', '自由职业', '学生', '投资人', '合伙人'], + }, + { + category: '行业背景', + tags: ['电商', '内容', '传统行业', '科技/AI', '金融', '教育', '餐饮'], + }, + { + category: '痛点标签', + tags: ['找资源', '找方向', '找合伙人', '想赚钱', '想学习', '找情感出口'], + }, + { + category: '付费意愿', + tags: ['高意向', '已付费', '观望中', '薅羊毛'], + }, + { + category: 'MBTI', + tags: ['ENTJ', 'INTJ', 'ENFP', 'INFP', 'ENTP', 'INTP', 'ESTJ', 'ISFJ'], + }, + ].map((group) => ( +
    +

    {group.category}

    +
    + {group.tags.map((tag) => ( + + ))} +
    +
    ))} - {editTags.length === 0 && 暂无标签}
    -
    - setNewTag(e.target.value)} - onKeyDown={(e) => e.key === 'Enter' && addTag()} - /> - +
    +

    已选标签

    +
    + {editTags.map((tag, i) => ( + + {tag} + + + ))} + {editTags.length === 0 && 暂未选择标签} +
    +
    + setNewTag(e.target.value)} + onKeyDown={(e) => e.key === 'Enter' && addTag()} + /> + +
    + {/* 存客宝标签 */} + {user.ckbTags && ( +
    +
    + + 存客宝标签 +
    +
    + {(typeof user.ckbTags === 'string' ? user.ckbTags.split(',') : []).map((tag, i) => ( + {tag.trim()} + ))} +
    +
    + )} - + {/* ===== 用户旅程(原行为轨迹)===== */} + +
    + + 记录用户从注册到付费的完整行动路径,共 {tracks.length} 条记录 +
    {tracks.length > 0 ? ( - tracks.map((track) => ( + tracks.map((track, idx) => (
    -
    - {getActionIcon(track.action)} +
    +
    + {getActionIcon(track.action)} +
    + {idx < tracks.length - 1 && ( +
    + )}
    -
    +
    {track.actionLabel} {track.chapterTitle && ( - {track.chapterTitle} )}
    -

    +

    {track.timeAgo} · {new Date(track.createdAt).toLocaleString()}

    @@ -416,13 +846,15 @@ export function UserDetailModal({ )) ) : (
    - -

    暂无行为轨迹

    + +

    暂无用户旅程记录

    +

    当用户浏览章节、购买或完善信息时会自动记录

    )}
    + {/* ===== 关系链路 ===== */}
    @@ -432,7 +864,7 @@ export function UserDetailModal({
    共 {referrals.length} 人
    -
    +
    {referrals.length > 0 ? ( referrals.map((ref: unknown, i: number) => { const r = ref as { id?: string; nickname?: string; status?: string; createdAt?: string } @@ -461,9 +893,142 @@ export function UserDetailModal({
    + + {/* ===== 用户资料完善 ===== */} + +
    +
    + + 用户资料完善 + 通过多维度查询神射手数据,自动回填用户基础信息 +
    + {/* 多维度查询输入 */} +
    +
    + + setSssQueryPhone(e.target.value)} + /> +
    +
    + + setSssQueryWechatId(e.target.value)} + /> +
    +
    + + setSssQueryOpenId(e.target.value)} + /> +
    +
    + +

    查询成功后,神射手返回的标签将自动同步到该用户

    + {sssError && ( +
    + {sssError} +
    + )} + {sssData && ( +
    +
    +
    +

    神射手 RFM 分

    +

    {sssData.rfm_score ?? '-'}

    +
    +
    +

    用户等级

    +

    {sssData.user_level ?? '-'}

    +
    +
    + {sssData.tags && sssData.tags.length > 0 && ( +
    +

    神射手标签

    +
    + {sssData.tags.map((tag, i) => ( + + {tag} + + ))} +
    +
    + )} + {sssData.last_active && ( +
    + 最近活跃:{sssData.last_active} +
    + )} +
    + )} +
    + + {/* 推送到神射手 */} +
    +
    +
    +
    + + 推送用户数据到神射手 +
    +

    将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像

    +
    + +
    + {!user.phone && ( +

    ⚠ 用户未绑定手机号,无法推送

    + )} + {batchIngestResult && ( +
    + {batchIngestResult.error ? ( +

    {String(batchIngestResult.error)}

    + ) : ( +
    +

    + 推送成功 +

    + {batchIngestResult.enriched !== undefined && ( +

    自动补全标签数:{String(batchIngestResult.new_tags_added ?? 0)}

    + )} +
    + )} +
    + )} +
    +
    -
    +
    + + +
    +
    +
    + +
    + {error && ( +
    + {error} + +
    + )} + {/* 统计卡片 */} + {stats && ( +
    +
    +
    {stats.totalSections}
    +
    总章节数
    +
    +
    +
    {stats.freeSections}
    +
    免费章节
    +
    +
    +
    {stats.paidSections}
    +
    付费章节
    +
    +
    +
    {stats.totalParts}
    +
    篇章数
    +
    +
    + )} + + {/* 章节列表 */} +
    + {structure.map((part) => ( +
    +
    togglePart(part.id)} + onKeyDown={(e) => e.key === 'Enter' && togglePart(part.id)} + role="button" + tabIndex={0} + > +
    + + {part.type === 'preface' + ? '📖' + : part.type === 'epilogue' + ? '🎬' + : part.type === 'appendix' + ? '📎' + : '📚'} + + {part.title} + + ({part.chapters.reduce((acc, ch) => acc + (ch.sections?.length || 1), 0)} 节) + +
    + {expandedParts.includes(part.id) ? '▲' : '▼'} +
    + + {expandedParts.includes(part.id) && ( +
    + {part.chapters.map((chapter) => ( +
    + {chapter.sections ? ( + <> +
    + {chapter.title} +
    +
    + {chapter.sections.map((section) => ( +
    +
    + + {section.isFree ? '🔓' : '🔒'} + + {section.id} + {section.title} +
    +
    + {editingSection === section.id ? ( +
    + setEditPrice(Number(e.target.value))} + className="w-20 px-2 py-1 bg-white/10 border border-white/20 rounded text-white" + min={0} + step={0.1} + /> + + +
    + ) : ( + <> + + {section.isFree ? '免费' : `¥${section.price}`} + + + + + )} +
    +
    + ))} +
    + + ) : ( +
    +
    + + {chapter.isFree ? '🔓' : '🔒'} + + {chapter.title} +
    + + {chapter.isFree ? '免费' : `¥${chapter.price ?? 1}`} + +
    + )} +
    + ))} +
    + )} +
    + ))} +
    +
    +
    + ) +} diff --git a/soul-admin/src/pages/content/ChapterTree.tsx b/soul-admin/src/pages/content/ChapterTree.tsx index 8f3d167f..5b6709d2 100644 --- a/soul-admin/src/pages/content/ChapterTree.tsx +++ b/soul-admin/src/pages/content/ChapterTree.tsx @@ -1,26 +1,23 @@ -/** +/** * 章节树 - 仿照 catalog 设计,支持篇、章、节拖拽排序 * 整行可拖拽;节和章可跨篇 */ import { useCallback, useState } from 'react' -import { ChevronRight, ChevronDown, BookOpen, Eye, Edit3, Trash2, GripVertical, Plus } from 'lucide-react' +import { ChevronRight, ChevronDown, BookOpen, Edit3, Trash2, GripVertical, Plus, Star } from 'lucide-react' import { Button } from '@/components/ui/button' const PART_LABELS = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十'] -// 固定模块:序言首位、附录/尾声末位,不可拖拽 -const FIXED_PART_KEYS = ['序言', '尾声', '附录'] -function isFixedPart(title: string): boolean { - if (!title) return false - return FIXED_PART_KEYS.some((k) => title.includes(k)) -} - export interface SectionItem { id: string title: string price: number isFree?: boolean isNew?: boolean + clickCount?: number + payCount?: number + hotScore?: number + hotRank?: number } export interface ChapterItem { @@ -52,8 +49,18 @@ interface ChapterTreeProps { onReadSection: (s: SectionItem) => void onDeleteSection: (s: SectionItem) => void onAddSectionInPart?: (part: PartItem) => void + onAddChapterInPart?: (part: PartItem) => void + onDeleteChapter?: (part: PartItem, chapter: ChapterItem) => void onEditPart?: (part: PartItem) => void onDeletePart?: (part: PartItem) => void + onEditChapter?: (part: PartItem, chapter: ChapterItem) => void + /** 批量移动:勾选章节 */ + selectedSectionIds?: string[] + onToggleSectionSelect?: (sectionId: string) => void + /** 查看某节的付款记录 */ + onShowSectionOrders?: (s: SectionItem) => void + /** 置顶章节ID列表 */ + pinnedSectionIds?: string[] } export function ChapterTree({ @@ -64,8 +71,15 @@ export function ChapterTree({ onReadSection, onDeleteSection, onAddSectionInPart, + onAddChapterInPart, + onDeleteChapter, onEditPart, onDeletePart, + onEditChapter, + selectedSectionIds = [], + onToggleSectionSelect, + onShowSectionOrders, + pinnedSectionIds = [], }: ChapterTreeProps) { const [draggingItem, setDraggingItem] = useState<{ type: DragType; id: string } | null>(null) const [dragOverTarget, setDragOverTarget] = useState<{ type: DragType; id: string } | null>(null) @@ -106,20 +120,7 @@ export function ChapterTree({ const sections = buildSectionsList() const sectionMap = new Map(sections.map((x) => [x.id, x])) - // 固定模块(序言、附录、尾声)不可拖拽,也不可作为落点 - if (from.type === 'section') { - const sec = sectionMap.get(from.id) - if (sec && isFixedPart(sec.partTitle)) return - } else { - const part = from.type === 'part' ? parts.find((p) => p.id === from.id) : parts.find((p) => p.chapters.some((c) => c.id === from.id)) - if (part && isFixedPart(part.title)) return - } - if (toContext && isFixedPart(toContext.partTitle)) return - if (toType === 'part') { - const toPart = parts.find((p) => p.id === toId) - if (toPart && isFixedPart(toPart.title)) return - } - + // 所有篇/章/节均可拖拽与作为落点(与后台顺序一致) if (from.type === 'part' && toType === 'part') { const partOrder = parts.map((p) => p.id) const fromIdx = partOrder.indexOf(from.id) @@ -272,25 +273,49 @@ export function ChapterTree({ const isXuYan = part.title === '序言' || part.title.includes('序言') const isWeiSheng = part.title === '尾声' || part.title.includes('尾声') const isFuLu = part.title === '附录' || part.title.includes('附录') + const partDragOver = isDragOver('part', part.id) const isExpanded = expandedParts.includes(part.id) const chapterCount = part.chapters.length const sectionCount = part.chapters.reduce((s, ch) => s + ch.sections.length, 0) - // 序言:单行卡片样式,固定首位不可拖拽 + // 序言:单行卡片,带六点拖拽、可拖可放 if (isXuYan && part.chapters.length === 1 && part.chapters[0].sections.length === 1) { const sec = part.chapters[0].sections[0] + const secDragOver = isDragOver('section', sec.id) + const ctx = { partId: part.id, partTitle: part.title, chapterId: part.chapters[0].id, chapterTitle: part.chapters[0].title } return (
    { + e.stopPropagation() + e.dataTransfer.setData('text/plain', 'section:' + sec.id) + e.dataTransfer.effectAllowed = 'move' + setDraggingItem({ type: 'section', id: sec.id }) + }} + onDragEnd={() => { setDraggingItem(null); setDragOverTarget(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] ${secDragOver ? 'bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50' : ''} ${isDragging('section', sec.id) ? 'opacity-60 scale-[0.98] ring-2 ring-[#38bdac]' : ''}`} + {...droppableHandlers('section', sec.id, ctx)} >
    + + {onToggleSectionSelect && ( + + )}
    {part.chapters[0].title} | {sec.title} + {pinnedSectionIds.includes(sec.id) && }
    ¥{sec.price} )} -
    - -
    -
    ) } - // 附录:平铺章节列表,固定末位不可拖拽 + // 2026每日派对干货:独立篇章,带六点拖拽、可拖可放 + const is2026Daily = part.title === '2026每日派对干货' || part.title.includes('2026每日派对干货') + if (is2026Daily) { + const partDragOver = isDragOver('part', part.id) + return ( +
    +
    { + e.stopPropagation() + e.dataTransfer.setData('text/plain', 'part:' + part.id) + e.dataTransfer.effectAllowed = 'move' + setDraggingItem({ type: 'part', id: part.id }) + }} + onDragEnd={() => { setDraggingItem(null); setDragOverTarget(null) }} + className={`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${isDragging('part', part.id) ? 'opacity-60 scale-[0.98] ring-2 ring-[#38bdac]' : 'hover:bg-[#162840]/50'}`} + onClick={() => onTogglePart(part.id)} + > +
    + +
    + 派 +
    +
    +

    {part.title}

    +

    共 {sectionCount} 节

    +
    +
    +
    e.stopPropagation()} + onClick={(e) => e.stopPropagation()} + > + {onAddSectionInPart && ( + + )} + {onEditPart && ( + + )} + {onDeletePart && ( + + )} + {chapterCount}章 + {isExpanded ? ( + + ) : ( + + )} +
    +
    + {isExpanded && part.chapters.length > 0 && ( +
    + {part.chapters.map((chapter) => ( +
    +
    +

    {chapter.title}

    +
    e.stopPropagation()}> + {onEditChapter && ( + + )} + {onAddChapterInPart && ( + + )} + {onDeleteChapter && ( + + )} +
    +
    +
    + {chapter.sections.map((section) => { + const secDragOver = isDragOver('section', section.id) + return ( +
    { + e.stopPropagation() + e.dataTransfer.setData('text/plain', 'section:' + section.id) + e.dataTransfer.effectAllowed = 'move' + setDraggingItem({ type: 'section', id: section.id }) + }} + onDragEnd={() => { setDraggingItem(null); setDragOverTarget(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 ${secDragOver ? 'bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50' : 'hover:bg-[#162840]/50'} ${isDragging('section', section.id) ? 'opacity-60 scale-[0.98] ring-2 ring-[#38bdac]' : ''}`} + {...droppableHandlers('section', section.id, { + partId: part.id, + partTitle: part.title, + chapterId: chapter.id, + chapterTitle: chapter.title, + })} + > +
    + + {onToggleSectionSelect && ( + + )} + {section.id} {section.title} + {pinnedSectionIds.includes(section.id) && } +
    +
    + 点击 {(section.clickCount ?? 0)} · 付款 {(section.payCount ?? 0)} + 热度 {(section.hotScore ?? 0).toFixed(1)} · 第{(section.hotRank && section.hotRank > 0 ? section.hotRank : '-')}名 + {onShowSectionOrders && ( + + )} + + +
    +
    + ) + })} +
    +
    + ))} +
    + )} +
    + ) + } + + // 附录:平铺章节列表,每节带六点拖拽、可拖可放 if (isFuLu) { return (

    附录

    - {part.chapters.map((ch, chIdx) => ( -
    - 附录{chIdx + 1} | {ch.title} - -
    - ))} + {part.chapters.map((ch, chIdx) => + ch.sections.length > 0 + ? ch.sections.map((sec) => { + const secDragOver = isDragOver('section', sec.id) + return ( +
    { + e.stopPropagation() + e.dataTransfer.setData('text/plain', 'section:' + sec.id) + e.dataTransfer.effectAllowed = 'move' + setDraggingItem({ type: 'section', id: sec.id }) + }} + onDragEnd={() => { setDraggingItem(null); setDragOverTarget(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 ${secDragOver ? 'bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50' : 'hover:bg-[#162840]/50'} ${isDragging('section', sec.id) ? 'opacity-60 scale-[0.98] ring-2 ring-[#38bdac]' : ''}`} + {...droppableHandlers('section', sec.id, { + partId: part.id, + partTitle: part.title, + chapterId: ch.id, + chapterTitle: ch.title, + })} + > +
    + + {onToggleSectionSelect && ( + + )} + 附录{chIdx + 1} | {ch.title} | {sec.title} + {pinnedSectionIds.includes(sec.id) && } +
    +
    + 点击 {(sec.clickCount ?? 0)} · 付款 {(sec.payCount ?? 0)} + 热度 {(sec.hotScore ?? 0).toFixed(1)} · 第{(sec.hotRank && sec.hotRank > 0 ? sec.hotRank : '-')}名 + {onShowSectionOrders && ( + + )} +
    + + +
    +
    + +
    + ) + }) + : ( +
    + 附录{chIdx + 1} | {ch.title}(空) + +
    + ), + )}
    ) } - // 尾声:固定末位不可拖拽 + // 尾声:单节,带六点拖拽、可拖可放 if (isWeiSheng && part.chapters.length === 1 && part.chapters[0].sections.length === 1) { const sec = part.chapters[0].sections[0] + const secDragOver = isDragOver('section', sec.id) + const ctx = { partId: part.id, partTitle: part.title, chapterId: part.chapters[0].id, chapterTitle: part.chapters[0].title } return (
    { + e.stopPropagation() + e.dataTransfer.setData('text/plain', 'section:' + sec.id) + e.dataTransfer.effectAllowed = 'move' + setDraggingItem({ type: 'section', id: sec.id }) + }} + onDragEnd={() => { setDraggingItem(null); setDragOverTarget(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] ${secDragOver ? 'bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50' : ''} ${isDragging('section', sec.id) ? 'opacity-60 scale-[0.98] ring-2 ring-[#38bdac]' : ''}`} + {...droppableHandlers('section', sec.id, ctx)} >
    + + {onToggleSectionSelect && ( + + )}
    @@ -365,45 +625,87 @@ export function ChapterTree({ ) : ( ¥{sec.price} )} -
    - -
    -
    ) } if (isWeiSheng) { - // 尾声多章节:平铺展示,不可拖拽 + // 尾声多章节:平铺展示,每节带六点拖拽、可拖可放 return (

    尾声

    {part.chapters.map((ch) => - ch.sections.map((sec) => ( -
    - {ch.title} | {sec.title} -
    - - - + ch.sections.map((sec) => { + const secDragOver = isDragOver('section', sec.id) + return ( +
    { + e.stopPropagation() + e.dataTransfer.setData('text/plain', 'section:' + sec.id) + e.dataTransfer.effectAllowed = 'move' + setDraggingItem({ type: 'section', id: sec.id }) + }} + onDragEnd={() => { setDraggingItem(null); setDragOverTarget(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 ${secDragOver ? 'bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50' : 'hover:bg-[#162840]/50'} ${isDragging('section', sec.id) ? 'opacity-60 scale-[0.98] ring-2 ring-[#38bdac]' : ''}`} + {...droppableHandlers('section', sec.id, { + partId: part.id, + partTitle: part.title, + chapterId: ch.id, + chapterTitle: ch.title, + })} + > +
    + + {onToggleSectionSelect && ( + + )} + {ch.title} | {sec.title} +
    +
    + 点击 {(sec.clickCount ?? 0)} · 付款 {(sec.payCount ?? 0)} + 热度 {(sec.hotScore ?? 0).toFixed(1)} · 第{(sec.hotRank && sec.hotRank > 0 ? sec.hotRank : '-')}名 + {onShowSectionOrders && ( + + )} +
    + + +
    +
    -
    - )), + ) + }), )}
    @@ -411,7 +713,6 @@ export function ChapterTree({ } // 普通篇:卡片 + 章/节 - const partDragOver = isDragOver('part', part.id) return (
    - {part.chapters.map((chapter, chIndex) => { + {part.chapters.map((chapter) => { const chDragOver = isDragOver('chapter', chapter.id) return (
    +
    { @@ -510,10 +812,28 @@ export function ChapterTree({ if (from.type === 'section') handleDrop(e, 'chapter', chapter.id, ctx) else if (from.type === 'chapter') handleDrop(e, 'chapter', chapter.id, ctx) }} - className={`py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${chDragOver ? 'bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50' : ''} ${isDragging('chapter', chapter.id) ? 'opacity-60 scale-[0.98] ring-2 ring-[#38bdac]' : 'hover:bg-[#162840]/30'}`} + 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 ${chDragOver ? 'bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50' : ''} ${isDragging('chapter', chapter.id) ? 'opacity-60 scale-[0.98] ring-2 ring-[#38bdac]' : 'hover:bg-[#162840]/30'}`} > -

    第{chIndex + 1}章 | {chapter.title}

    +

    {chapter.title}

    +
    +
    e.stopPropagation()}> + {onEditChapter && ( + + )} + {onAddChapterInPart && ( + + )} + {onDeleteChapter && ( + + )} +
    {chapter.sections.map((section) => { @@ -538,6 +858,16 @@ export function ChapterTree({ })} >
    + {onToggleSectionSelect && ( + + )}
    {section.id} {section.title} + {pinnedSectionIds.includes(section.id) && }
    ¥{section.price} )} -
    - -
    -
    ) diff --git a/soul-admin/src/pages/content/ContentPage.tsx b/soul-admin/src/pages/content/ContentPage.tsx index a32ba9b4..7debcb6d 100644 --- a/soul-admin/src/pages/content/ContentPage.tsx +++ b/soul-admin/src/pages/content/ContentPage.tsx @@ -10,6 +10,8 @@ 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 { Select, SelectContent, @@ -34,11 +36,16 @@ import { RefreshCw, Link2, Plus, - Image as ImageIcon, Search, - AtSign, + Trophy, + ChevronLeft, + ChevronRight as ChevronRightIcon, + Pin, + Star, + Hash, + ExternalLink, } from 'lucide-react' -import { get, put, del } from '@/api/client' +import { get, put, post, del } from '@/api/client' import { ChapterTree } from './ChapterTree' import { apiUrl } from '@/api/client' @@ -53,6 +60,10 @@ interface SectionListItem { chapterId?: string chapterTitle?: string filePath?: string + clickCount?: number + payCount?: number + hotScore?: number + hotRank?: number } interface Section { @@ -62,6 +73,10 @@ interface Section { filePath?: string isFree?: boolean isNew?: boolean + clickCount?: number + payCount?: number + hotScore?: number + hotRank?: number } interface Chapter { @@ -76,14 +91,30 @@ interface Part { chapters: Chapter[] } +interface SectionOrder { + id?: string + orderSn?: string + userId?: string + openId?: string + amount?: number + status?: string + createdAt?: string + payTime?: string +} + interface EditingSection { id: string + originalId?: string title: string price: number content?: string filePath?: string isFree?: boolean isNew?: boolean + isPinned?: boolean + hotScore?: number + editionStandard?: boolean + editionPremium?: boolean } function buildTree(sections: SectionListItem[]): Part[] { @@ -110,15 +141,31 @@ function buildTree(sections: SectionListItem[]): Part[] { filePath: s.filePath, isFree: s.isFree, isNew: s.isNew, + clickCount: s.clickCount ?? 0, + payCount: s.payCount ?? 0, + hotScore: s.hotScore ?? 0, + hotRank: s.hotRank ?? 0, + }) + } + // 确保「2026每日派对干货」篇章存在(不在第六篇编号体系内) + const DAILY_PART_ID = 'part-2026-daily' + const DAILY_PART_TITLE = '2026每日派对干货' + const hasDailyPart = Array.from(partMap.values()).some((p) => p.title === DAILY_PART_TITLE || p.title.includes(DAILY_PART_TITLE)) + if (!hasDailyPart) { + partMap.set(DAILY_PART_ID, { + id: DAILY_PART_ID, + title: DAILY_PART_TITLE, + chapters: new Map([['chapter-2026-daily', { id: 'chapter-2026-daily', title: DAILY_PART_TITLE, sections: [] }]]), }) } const parts = Array.from(partMap.values()).map((p) => ({ ...p, chapters: Array.from(p.chapters.values()), })) - // 固定顺序:序言首位,附录/尾声末位 + // 固定顺序:序言首位,2026每日派对干货(附录前),附录/尾声末位 const orderKey = (t: string) => { if (t.includes('序言')) return 0 + if (t.includes(DAILY_PART_TITLE)) return 1.5 if (t.includes('附录')) return 2 if (t.includes('尾声')) return 3 return 1 @@ -142,8 +189,6 @@ export function ContentPage() { const [searchQuery, setSearchQuery] = useState('') const [searchResults, setSearchResults] = useState<{ id: string; title: string; price?: number; snippet?: string; partTitle?: string; chapterTitle?: string; matchType?: string }[]>([]) const [isSearching, setIsSearching] = useState(false) - const [uploadingImage, setUploadingImage] = useState(false) - const imageInputRef = useRef(null) const [newSection, setNewSection] = useState({ id: '', @@ -152,25 +197,55 @@ export function ContentPage() { partId: 'part-1', chapterId: 'chapter-1', content: '', + editionStandard: true, + editionPremium: false, }) const [editingPart, setEditingPart] = useState<{ id: string; title: string } | null>(null) const [isSavingPartTitle, setIsSavingPartTitle] = useState(false) - - const [showMentionUserDialog, setShowMentionUserDialog] = useState(false) - const [mentionTarget, setMentionTarget] = useState<'new' | 'edit'>('new') - const [mentionUserList, setMentionUserList] = useState<{ id: string; nickname: string }[]>([]) - const [mentionUserSearch, setMentionUserSearch] = useState('') - const [mentionUserLoading, setMentionUserLoading] = useState(false) + const [showNewPartModal, setShowNewPartModal] = useState(false) + const [editingChapter, setEditingChapter] = useState<{ part: Part; chapter: Chapter; title: string } | null>(null) + const [isSavingChapterTitle, setIsSavingChapterTitle] = useState(false) + const [selectedSectionIds, setSelectedSectionIds] = useState([]) + const [showBatchMoveModal, setShowBatchMoveModal] = useState(false) + const [batchMoveTargetPartId, setBatchMoveTargetPartId] = useState('') + const [batchMoveTargetChapterId, setBatchMoveTargetChapterId] = useState('') + const [isMoving, setIsMoving] = useState(false) + const [newPartTitle, setNewPartTitle] = useState('') + const [isSavingPart, setIsSavingPart] = useState(false) + const [sectionOrdersModal, setSectionOrdersModal] = useState<{ section: Section; orders: SectionOrder[] } | null>(null) + const [sectionOrdersLoading, setSectionOrdersLoading] = useState(false) + const [showRankingAlgorithmModal, setShowRankingAlgorithmModal] = useState(false) + const [rankingWeights, setRankingWeights] = useState({ readWeight: 0.5, recencyWeight: 0.3, payWeight: 0.2 }) + const [rankingWeightsLoading, setRankingWeightsLoading] = useState(false) + const [rankingWeightsSaving, setRankingWeightsSaving] = useState(false) + const [rankingPage, setRankingPage] = useState(1) + const [pinnedSectionIds, setPinnedSectionIds] = useState([]) + const [pinnedLoading, setPinnedLoading] = useState(false) + const [previewPercent, setPreviewPercent] = useState(20) + const [previewPercentLoading, setPreviewPercentLoading] = useState(false) + const [previewPercentSaving, setPreviewPercentSaving] = useState(false) + const [persons, setPersons] = useState([]) + const [linkTags, setLinkTags] = useState([]) + const [newPerson, setNewPerson] = useState({ personId: '', name: '', label: '' }) + const [newLinkTag, setNewLinkTag] = useState({ tagId: '', label: '', url: '', type: 'url' as 'url' | 'miniprogram' | 'ckb', appId: '', pagePath: '' }) + const richEditorRef = useRef(null) const tree = buildTree(sectionsList) const totalSections = sectionsList.length + const rankedSections = [...sectionsList].sort((a, b) => (b.hotScore ?? 0) - (a.hotScore ?? 0)) + const RANKING_PAGE_SIZE = 10 + const rankingTotalPages = Math.max(1, Math.ceil(rankedSections.length / RANKING_PAGE_SIZE)) + const rankingPageSections = rankedSections.slice((rankingPage - 1) * RANKING_PAGE_SIZE, rankingPage * RANKING_PAGE_SIZE) + const loadList = async () => { setLoading(true) try { + // 每次请求均从服务端拉取最新数据,确保点击量/付款数与 reading_progress、orders 表直接捆绑 const data = await get<{ success?: boolean; sections?: SectionListItem[] }>( '/api/db/book?action=list', + { cache: 'no-store' as RequestCache }, ) setSectionsList(Array.isArray(data?.sections) ? data.sections : []) } catch (e) { @@ -185,43 +260,6 @@ export function ContentPage() { loadList() }, []) - const loadMentionUsers = useCallback(async () => { - setMentionUserLoading(true) - try { - const params = new URLSearchParams({ pageSize: '200' }) - if (mentionUserSearch.trim()) params.set('search', mentionUserSearch.trim()) - const data = await get<{ success?: boolean; users?: { id: string; nickname?: string }[] }>( - `/api/db/users?${params}`, - ) - const users = Array.isArray(data?.users) ? data.users : [] - setMentionUserList(users.map((u) => ({ id: String(u.id), nickname: u.nickname || '用户' }))) - } catch (e) { - console.error(e) - setMentionUserList([]) - } finally { - setMentionUserLoading(false) - } - }, [mentionUserSearch]) - - useEffect(() => { - if (showMentionUserDialog) loadMentionUsers() - }, [showMentionUserDialog, loadMentionUsers]) - - const openMentionUserDialog = (target: 'new' | 'edit') => { - setMentionTarget(target) - setMentionUserSearch('') - setShowMentionUserDialog(true) - } - - const insertMentionUser = (user: { id: string; nickname: string }) => { - const snippet = `{{@${user.id}:${user.nickname}}}` - if (mentionTarget === 'new') { - setNewSection((prev) => ({ ...prev, content: (prev.content || '') + snippet })) - } else if (editingSection) { - setEditingSection({ ...editingSection, content: (editingSection.content || '') + snippet }) - } - setShowMentionUserDialog(false) - } const togglePart = (partId: string) => { setExpandedParts((prev) => @@ -273,32 +311,182 @@ export function ContentPage() { } } + const loadRankingWeights = useCallback(async () => { + setRankingWeightsLoading(true) + try { + const data = await get<{ success?: boolean; data?: { readWeight?: number; recencyWeight?: number; payWeight?: number } }>( + '/api/db/config/full?key=article_ranking_weights', + { cache: 'no-store' as RequestCache }, + ) + const d = data && (data as { success?: boolean; data?: { readWeight?: number; recencyWeight?: number; payWeight?: number } }).data + if (d && typeof d.readWeight === 'number' && typeof d.recencyWeight === 'number' && typeof d.payWeight === 'number') { + setRankingWeights({ + readWeight: Math.max(0, Math.min(1, d.readWeight)), + recencyWeight: Math.max(0, Math.min(1, d.recencyWeight)), + payWeight: Math.max(0, Math.min(1, d.payWeight)), + }) + } + } catch { + // 使用默认值 + } finally { + setRankingWeightsLoading(false) + } + }, []) + + useEffect(() => { + if (showRankingAlgorithmModal) loadRankingWeights() + }, [showRankingAlgorithmModal, loadRankingWeights]) + + const handleSaveRankingWeights = async () => { + const { readWeight, recencyWeight, payWeight } = rankingWeights + const sum = readWeight + recencyWeight + payWeight + if (Math.abs(sum - 1) > 0.001) { + alert('三个权重之和必须等于 1') + return + } + setRankingWeightsSaving(true) + try { + const res = await post<{ success?: boolean; error?: string }>('/api/db/config', { + key: 'article_ranking_weights', + value: { readWeight, recencyWeight, payWeight }, + description: '文章排名算法权重', + }) + if (res && (res as { success?: boolean }).success !== false) { + alert('已保存') + loadList() + } else { + alert('保存失败: ' + ((res && typeof res === 'object' && 'error' in res) ? (res as { error?: string }).error : '')) + } + } catch (e) { + console.error(e) + alert('保存失败') + } finally { + setRankingWeightsSaving(false) + } + } + + const loadPinnedSections = useCallback(async () => { + setPinnedLoading(true) + try { + const data = await get<{ success?: boolean; data?: string[] }>( + '/api/db/config/full?key=pinned_section_ids', + { cache: 'no-store' as RequestCache }, + ) + const d = data && (data as { data?: string[] }).data + if (Array.isArray(d)) setPinnedSectionIds(d) + } catch { /* keep default */ } finally { setPinnedLoading(false) } + }, []) + + 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 }))) + } catch { /* ignore */ } + }, []) + + const loadLinkTags = useCallback(async () => { + try { + const data = await get<{ success?: boolean; linkTags?: { tagId: string; label: string; url: string; type: string; appId?: string; pagePath?: string }[] }>('/api/db/link-tags') + if (data?.success && data.linkTags) setLinkTags(data.linkTags.map(t => ({ id: t.tagId, label: t.label, url: t.url, type: t.type as 'url' | 'miniprogram', appId: t.appId, pagePath: t.pagePath }))) + } catch { /* ignore */ } + }, []) + + const handleTogglePin = async (sectionId: string) => { + const next = pinnedSectionIds.includes(sectionId) + ? pinnedSectionIds.filter((id) => id !== sectionId) + : [...pinnedSectionIds, sectionId] + setPinnedSectionIds(next) + try { + await post<{ success?: boolean }>('/api/db/config', { + key: 'pinned_section_ids', + value: next, + description: '强制置顶章节ID列表(精选推荐/首页最新更新)', + }) + } catch { setPinnedSectionIds(pinnedSectionIds) } + } + + const loadPreviewPercent = useCallback(async () => { + setPreviewPercentLoading(true) + try { + const data = await get<{ success?: boolean; data?: number }>( + '/api/db/config/full?key=unpaid_preview_percent', + { cache: 'no-store' as RequestCache }, + ) + const d = data && (data as { data?: number }).data + if (typeof d === 'number' && d > 0 && d <= 100) setPreviewPercent(d) + } catch { /* keep default */ } finally { setPreviewPercentLoading(false) } + }, []) + + const handleSavePreviewPercent = async () => { + if (previewPercent < 1 || previewPercent > 100) { alert('预览比例需在 1~100 之间'); return } + setPreviewPercentSaving(true) + try { + const res = await post<{ success?: boolean; error?: string }>('/api/db/config', { + key: 'unpaid_preview_percent', + value: previewPercent, + description: '小程序未付费内容默认预览比例(%)', + }) + if (res && (res as { success?: boolean }).success !== false) alert('已保存') + else alert('保存失败: ' + ((res as { error?: string }).error || '')) + } catch { alert('保存失败') } finally { setPreviewPercentSaving(false) } + } + + useEffect(() => { loadPinnedSections(); loadPreviewPercent(); loadPersons(); loadLinkTags() }, [loadPinnedSections, loadPreviewPercent, loadPersons, loadLinkTags]) + + const handleShowSectionOrders = async (section: Section & { filePath?: string }) => { + setSectionOrdersModal({ section, orders: [] }) + setSectionOrdersLoading(true) + try { + const data = await get<{ success?: boolean; orders?: SectionOrder[] }>( + `/api/db/book?action=section-orders&id=${encodeURIComponent(section.id)}`, + ) + const orders = data?.success && Array.isArray(data.orders) ? data.orders : [] + setSectionOrdersModal((prev) => (prev ? { ...prev, orders } : null)) + } catch (e) { + console.error(e) + setSectionOrdersModal((prev) => (prev ? { ...prev, orders: [] } : null)) + } finally { + setSectionOrdersLoading(false) + } + } + 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, title: data.section.title ?? section.title, price: data.section.price ?? section.price, content: data.section.content ?? '', filePath: section.filePath, isFree: section.isFree || section.price === 0, isNew: sec.isNew ?? section.isNew, + isPinned: pinnedSectionIds.includes(section.id), + hotScore: section.hotScore ?? 0, + editionStandard: isPremium ? false : (sec.editionStandard ?? true), + editionPremium: isPremium, }) } else { setEditingSection({ id: section.id, + originalId: section.id, title: section.title, price: section.price, content: '', filePath: section.filePath, isFree: section.isFree, 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 || '未知错误')) @@ -332,15 +520,25 @@ export function ContentPage() { for (const pattern of titlePatterns) content = content.replace(pattern, '') content = content.replace(/^\s*\n+/, '').trim() + const originalId = editingSection.originalId || editingSection.id + const idChanged = editingSection.id !== originalId const res = await put<{ success?: boolean; error?: string }>('/api/db/book', { - id: editingSection.id, + id: originalId, + ...(idChanged ? { newId: editingSection.id } : {}), title: editingSection.title, price: editingSection.isFree ? 0 : editingSection.price, content, 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 + if (editingSection.isPinned !== pinnedSectionIds.includes(effectiveId)) { + await handleTogglePin(effectiveId) + } if (res && (res as { success?: boolean }).success !== false) { alert(`已保存章节: ${editingSection.title}`) setEditingSection(null) @@ -370,12 +568,14 @@ export function ContentPage() { content: newSection.content, partId: newSection.partId, chapterId: newSection.chapterId, + editionStandard: newSection.editionPremium ? false : (newSection.editionStandard ?? true), + editionPremium: newSection.editionPremium ?? false, saveToFile: false, }) if (res && (res as { success?: boolean }).success !== false) { alert(`章节创建成功: ${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 }) loadList() } else { alert('创建失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) @@ -430,10 +630,62 @@ 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) return - if (!confirm(`确定要删除「${part.title}」整篇吗?将删除共 ${sectionIds.length} 节内容,此操作不可恢复。`)) return + const handleAddChapterInPart = (part: Part) => { + const nextChNum = part.chapters.length + 1 + const newChapterId = `chapter-${part.id}-${nextChNum}-${Date.now()}` + setNewSection({ + id: `${nextChNum}.1`, + title: '新章节', + price: 1, + partId: part.id, + chapterId: newChapterId, + content: '', + editionStandard: true, + editionPremium: false, + }) + setShowNewSectionModal(true) + } + + const handleEditChapter = (part: Part, chapter: Chapter) => { + setEditingChapter({ part, chapter, title: chapter.title }) + } + + const handleSaveChapterTitle = async () => { + if (!editingChapter?.title?.trim()) return + setIsSavingChapterTitle(true) + try { + const items = sectionsList.map((s) => ({ + id: s.id, + partId: s.partId || editingChapter.part.id, + partTitle: s.partId === editingChapter.part.id ? editingChapter.part.title : (s.partTitle || ''), + chapterId: s.chapterId || editingChapter.chapter.id, + chapterTitle: + s.partId === editingChapter.part.id && s.chapterId === editingChapter.chapter.id + ? editingChapter.title.trim() + : (s.chapterTitle || ''), + })) + const res = await put<{ success?: boolean; error?: string }>('/api/db/book', { action: 'reorder', items }) + if (res && (res as { success?: boolean }).success !== false) { + setEditingChapter(null) + loadList() + } else { + alert('保存失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) + } + } catch (e) { + console.error(e) + alert('保存失败') + } finally { + setIsSavingChapterTitle(false) + } + } + + const handleDeleteChapter = async (part: Part, chapter: Chapter) => { + const sectionIds = chapter.sections.map((s) => s.id) + if (sectionIds.length === 0) { + alert('该章下无小节,无需删除') + return + } + if (!confirm(`确定要删除「第${part.chapters.indexOf(chapter) + 1}章 | ${chapter.title}」吗?将删除共 ${sectionIds.length} 节,此操作不可恢复。`)) return try { for (const id of sectionIds) { await del<{ success?: boolean; error?: string }>(`/api/db/book?id=${encodeURIComponent(id)}`) @@ -445,34 +697,157 @@ export function ContentPage() { } } - const handleImageUpload = async (e: React.ChangeEvent) => { - const file = e.target.files?.[0] - if (!file) return - setUploadingImage(true) + const handleCreatePart = async () => { + if (!newPartTitle.trim()) { + alert('请输入篇名') + return + } + setIsSavingPart(true) try { - const formData = new FormData() - formData.append('file', file) - formData.append('folder', 'book-images') - const res = await fetch(apiUrl('/api/upload'), { method: 'POST', body: formData, credentials: 'include' }) - const data = await res.json() - if (data?.success && data?.data?.url) { - const imageMarkdown = `![${file.name}](${data.data.url})` - if (editingSection) { - setEditingSection({ - ...editingSection, - content: (editingSection.content || '') + '\n\n' + imageMarkdown, - }) - } - alert(`图片上传成功: ${data.data.url}`) + const partId = `part-new-${Date.now()}` + const chapterId = `chapter-1` + const sectionId = `part-placeholder-${Date.now()}` + const res = await put<{ success?: boolean; error?: string }>('/api/db/book', { + id: sectionId, + title: '占位节(可编辑)', + price: 0, + content: '', + partId, + partTitle: newPartTitle.trim(), + chapterId, + chapterTitle: '第1章 | 待编辑', + saveToFile: false, + }) + if (res && (res as { success?: boolean }).success !== false) { + alert(`篇「${newPartTitle}」创建成功,请编辑占位节`) + setShowNewPartModal(false) + setNewPartTitle('') + loadList() } else { - alert('上传失败: ' + (data?.error || '未知错误')) + alert('创建失败: ' + (res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error : '未知错误')) } - } catch (err) { - console.error(err) - alert('上传失败') + } catch (e) { + console.error(e) + alert('创建失败') } finally { - setUploadingImage(false) - if (imageInputRef.current) imageInputRef.current.value = '' + setIsSavingPart(false) + } + } + + const handleBatchMoveToTarget = async () => { + if (selectedSectionIds.length === 0) { + alert('请先勾选要移动的章节') + return + } + const targetPart = tree.find((p) => p.id === batchMoveTargetPartId) + const targetChapter = targetPart?.chapters.find((c) => c.id === batchMoveTargetChapterId) + if (!targetPart || !targetChapter || !batchMoveTargetPartId || !batchMoveTargetChapterId) { + alert('请选择目标篇和章') + return + } + setIsMoving(true) + try { + const buildFallbackReorderItems = () => { + const selectedSet = new Set(selectedSectionIds) + const baseItems = sectionsList.map((s) => ({ + id: s.id, + partId: s.partId || '', + partTitle: s.partTitle || '', + chapterId: s.chapterId || '', + chapterTitle: s.chapterTitle || '', + })) + const movingItems = baseItems + .filter((item) => selectedSet.has(item.id)) + .map((item) => ({ + ...item, + partId: batchMoveTargetPartId, + partTitle: targetPart.title || batchMoveTargetPartId, + chapterId: batchMoveTargetChapterId, + chapterTitle: targetChapter.title || batchMoveTargetChapterId, + })) + const remainingItems = baseItems.filter((item) => !selectedSet.has(item.id)) + let insertIndex = remainingItems.length + for (let i = remainingItems.length - 1; i >= 0; i -= 1) { + const item = remainingItems[i] + if (item.partId === batchMoveTargetPartId && item.chapterId === batchMoveTargetChapterId) { + insertIndex = i + 1 + break + } + } + return [ + ...remainingItems.slice(0, insertIndex), + ...movingItems, + ...remainingItems.slice(insertIndex), + ] + } + + const tryFallbackReorder = async () => { + const reorderItems = buildFallbackReorderItems() + const reorderRes = await put<{ success?: boolean; error?: string }>( + '/api/db/book', + { action: 'reorder', items: reorderItems }, + ) + if (reorderRes && (reorderRes as { success?: boolean }).success !== false) { + alert(`已移动 ${selectedSectionIds.length} 节到「${targetPart.title}」-「${targetChapter.title}」`) + setShowBatchMoveModal(false) + setSelectedSectionIds([]) + await loadList() + return true + } + return false + } + + const payload = { + action: 'move-sections', + sectionIds: selectedSectionIds, + targetPartId: batchMoveTargetPartId, + targetChapterId: batchMoveTargetChapterId, + targetPartTitle: targetPart.title || batchMoveTargetPartId, + targetChapterTitle: targetChapter.title || batchMoveTargetChapterId, + } + 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}」`) + setShowBatchMoveModal(false) + setSelectedSectionIds([]) + await loadList() + } else { + const errorMessage = res && typeof res === 'object' && 'error' in res ? (res as { error?: string }).error || '' : '未知错误' + if (errorMessage.includes('缺少 id') || errorMessage.includes('无效的 action')) { + const fallbackOk = await tryFallbackReorder() + if (fallbackOk) return + } + alert('移动失败: ' + errorMessage) + } + } catch (e) { + console.error(e) + alert('移动失败: ' + (e instanceof Error ? e.message : '网络或服务异常')) + } finally { + setIsMoving(false) + } + } + + const toggleSectionSelect = (sectionId: string) => { + setSelectedSectionIds((prev) => + prev.includes(sectionId) ? prev.filter((id) => id !== sectionId) : [...prev, sectionId], + ) + } + + const handleDeletePart = async (part: Part) => { + const sectionIds = sectionsList.filter((s) => s.partId === part.id).map((s) => s.id) + if (sectionIds.length === 0) { + alert('该篇下暂无小节可删除') + return + } + if (!confirm(`确定要删除「${part.title}」整篇吗?将删除共 ${sectionIds.length} 节内容,此操作不可恢复。`)) return + try { + for (const id of sectionIds) { + await del<{ success?: boolean; error?: string }>(`/api/db/book?id=${encodeURIComponent(id)}`) + } + loadList() + } catch (e) { + console.error(e) + alert('删除失败') } } @@ -511,6 +886,14 @@ export function ContentPage() {

    共 {tree.length} 篇 · {totalSections} 节内容

    +
    +
    + +
    + + +
    +
    @@ -607,22 +1015,10 @@ export function ContentPage() {
    -
    - - -
    +