diff --git a/.cursor/agent/产品经理/evolution/2026-02-28.md b/.cursor/agent/产品经理/evolution/2026-02-28.md index 508df1f8..33efc5e3 100644 --- a/.cursor/agent/产品经理/evolution/2026-02-28.md +++ b/.cursor/agent/产品经理/evolution/2026-02-28.md @@ -10,3 +10,10 @@ - **展示/编辑页一致性**:展示页(enhanced_professional_profile)与编辑页(comprehensive_profile_editor_v1_1)需字段一一对应、配色统一。 - **skills「我擅长」**:展示页已有,编辑页必须补充;验收时确认两页数据一致。 + +## 文章类型(普通版/增值版)需求分析会议 + +- **普通版**:9.9 元买断,与现有 fullbook 一致。 +- **增值版**:基础价 + 后 N 章(N 可配置)按章额外付费;每购一章价格累加该章单价。 +- **已确认**:普通版与增值版**分开、互斥**,用户购买其一,非叠加。 +- **待输出**:增值版基础价是否固定 9.9;N 默认值。 diff --git a/.cursor/agent/后端工程师/evolution/2026-02-28.md b/.cursor/agent/后端工程师/evolution/2026-02-28.md index 5c45b471..c428db18 100644 --- a/.cursor/agent/后端工程师/evolution/2026-02-28.md +++ b/.cursor/agent/后端工程师/evolution/2026-02-28.md @@ -15,3 +15,9 @@ ## 个人资料页实现评估会议 - **profile API**:`GET/POST /api/miniprogram/user/profile` 已覆盖 skills 等全部扩展字段;无需新增接口。 + +## 文章类型(普通版/增值版)需求分析会议 + +- **premium_config**:system_config 新增 premium_base_price、premium_chapter_count(后 N 个 section)。 +- **增值章节购买**:沿用 product_type=section、product_id=section_id,金额为 chapters.price。 +- **purchase-status 扩展**:需返回 editionType、premiumPurchasedSections 等。 diff --git a/.cursor/agent/团队/evolution/2026-02-28.md b/.cursor/agent/团队/evolution/2026-02-28.md index ecefa6f3..264bcb82 100644 --- a/.cursor/agent/团队/evolution/2026-02-28.md +++ b/.cursor/agent/团队/evolution/2026-02-28.md @@ -13,3 +13,9 @@ ## 个人资料页实现评估会议 - **展示/编辑页协同**:profile-show 与 profile-edit 共用同一 API,skills 等扩展字段需双向同步;配色统一为 enhanced(#5EEAD4)强化品牌一致。 + +## 文章类型(普通版/增值版)需求分析会议 + +- **增值版计价**:基础价 + Σ(增值章节单价),按章购买、按章累加。 +- **后 N 章**:指全书最后 N 个 section;N 可配置。 +- **普通版与增值版**:分开、互斥的两套产品,用户购买其一。 diff --git a/.cursor/agent/小程序开发工程师/evolution/2026-02-28.md b/.cursor/agent/小程序开发工程师/evolution/2026-02-28.md index 5b2b6a03..d0508581 100644 --- a/.cursor/agent/小程序开发工程师/evolution/2026-02-28.md +++ b/.cursor/agent/小程序开发工程师/evolution/2026-02-28.md @@ -23,3 +23,9 @@ - **问题**:弹窗内 input 文字贴边,padding 直接写在 input 上导致布局异常。 - **正确做法**:按 Skill §6,用 view 包裹,padding 写 view,内部 input 设 `width: 100%`。 - **修改**:match 页资源对接两个输入框 + 联系方式输入框,统一改为 `form-input-wrap` + `form-input-inner` / `input-field-wrap` + `input-field-inner` 结构。 + +## 文章类型(普通版/增值版)需求分析会议 + +- **选购**:目录/书籍页区分普通版 9.9 与增值版(基础价 + 增值章按章付费)。 +- **解锁**:进入增值章节未购时展示「该章需额外 ¥X.X 解锁」,点击发起支付。 +- **依赖**:purchase-status 需返回 editionType、premiumPurchasedSections。 diff --git a/.cursor/agent/管理端开发工程师/evolution/2026-02-28.md b/.cursor/agent/管理端开发工程师/evolution/2026-02-28.md index 17e8781a..c8abafde 100644 --- a/.cursor/agent/管理端开发工程师/evolution/2026-02-28.md +++ b/.cursor/agent/管理端开发工程师/evolution/2026-02-28.md @@ -9,3 +9,8 @@ ## 个人资料页实现评估会议 - **无新增任务**:个人资料展示/编辑为 C 端能力,管理端沿用现有能力即可。 + +## 文章类型(普通版/增值版)需求分析会议 + +- **书籍版本配置**:支持选择普通版/增值版;配置「后 N 章」的 N。 +- **章节标注**:章节列表需标注是否为增值章节;单价取自 chapters.price。 diff --git a/.cursor/agent/软件测试/evolution/2026-02-28.md b/.cursor/agent/软件测试/evolution/2026-02-28.md index ba1b33a2..f75f4526 100644 --- a/.cursor/agent/软件测试/evolution/2026-02-28.md +++ b/.cursor/agent/软件测试/evolution/2026-02-28.md @@ -9,3 +9,8 @@ ## 个人资料页实现评估会议 - **验证点**:profile-show 与 profile-edit 字段一一对应;保存后两页及「我的」数据一致;手机/微信号脱敏与复制;头像上传、昵称、MBTI 选择。 + +## 文章类型(普通版/增值版)需求分析会议 + +- **用例**:普通版 9.9 买断全书;增值版基础价+逐章购买、价格累加正确。 +- **边界**:N=0、N=全书、章节无单价时的降级逻辑。 diff --git a/.cursor/meeting/2026-02-28_文章类型普通版增值版需求分析.md b/.cursor/meeting/2026-02-28_文章类型普通版增值版需求分析.md new file mode 100644 index 00000000..78aa6040 --- /dev/null +++ b/.cursor/meeting/2026-02-28_文章类型普通版增值版需求分析.md @@ -0,0 +1,153 @@ +# 会议纪要 - 2026-02-28 | 文章增加类型(普通版 / 增值版)需求分析 + +> 本文件由**助理橙子**在会议结束后自动生成。 + +--- + +## 基本信息 + +- **时间**:2026-02-28 +- **议题**:文章增加类型(普通版 / 增值版),增值版后 N 章额外付费、按章累加计价 +- **触发方式**:开个会议分析需求 +- **参与角色**:产品经理、后端开发、管理端开发工程师、小程序开发工程师、测试人员 + +--- + +## 各角色发言 + +### 【产品经理】 + +**需求理解**: +1. **普通版**:全书 9.9 元,一次性买断,与现有 fullbook 逻辑一致。 +2. **增值版**:基础价 + 「后 N 章」(N 可配置,如 10)需额外付费;每多看一章,价格 = 已付金额 + 该章单价,按章累加。 +3. **两者关系**:普通版与增值版是**分开的、互斥的两套产品**,用户购买其一,非叠加关系。 + +**待澄清**: +- 「后 N 章」是指全书最后 N 个 section,还是最后 N 个 chapter? +- 增值版基础价是否仍为 9.9,还是单独定价? + +**用户价值**:用阶梯付费降低首购门槛,提升付费转化;增值版满足深度阅读用户需求。 + +--- + +### 【后端开发】 + +**现状**: +- `chapters` 表:`id`、`part_id`、`chapter_id`、`section_title`、`price` 等;现有按 section 购买、fullbook 9.9。 +- `orders` 表:`product_type` 含 `section`、`fullbook`、`vip`;`product_id` 存 section id 或 `fullbook`。 + +**技术方案建议**: +1. **书/产品类型**:增加 `book_edition` 或 `product_edition` 概念: + - `standard`:普通版,9.9 买断 + - `premium`:增值版,基础价 + 增值章节按章付费 +2. **配置**:`system_config` 增加 `premium_config`: + - `premium_base_price`:增值版基础价 + - `premium_chapter_count`:后 N 章(section 数量或 chapter 数量需与产品约定) + - `premium_section_ids`:或直接配置增值章节 id 列表(灵活) +3. **接口**: + - `GET /api/miniprogram/user/purchase-status`:需区分普通版 / 增值版购买态,返回 `editionType`、`premiumPurchasedSections` 等 + - 支付:`product_type` 扩展 `section_premium` 或沿用 `section`,`product_id` 为 section id,金额按章节 price 累加 +4. **权限**:普通版权限独立;增值版权限 = 增值版基础价已购 + 该 section 已单独付费;两者互斥。 + +--- + +### 【管理端开发工程师】 + +**管理端需求**: +1. **书籍/版本配置**:支持选择「普通版 / 增值版」或为同一本书配置两种版本。 +2. **增值章节配置**:配置「后 N 章」的 N,或勾选具体 section 作为增值章节。 +3. **章节单价**:增值章节的单价在章节编辑中维护(现有 `chapters.price`)。 +4. **价格展示**:在书籍/章节管理列表中区分普通版、增值版及增值章节。 + +**接口依赖**:需 `GET/POST /api/db/chapters` 支持 `is_premium` 或类似标记;`/api/db/config` 或 `/api/admin/settings` 支持 premium_config。 + +--- + +### 【小程序开发工程师】 + +**C 端体验**: +1. **选购**:目录/书籍页区分「普通版 9.9」与「增值版 基础价 + 增值章节按章付费」。 +2. **阅读**:进入增值章节时,未购则展示「该章需额外 ¥X.X 解锁」或类似提示,点击发起支付。 +3. **支付流程**:与现有一致,`product_type`、`product_id`、`amount` 由后端计算并返回。 +4. **权限**:依赖 `purchase-status` 返回的 `editionType`、`premiumPurchasedSections` 等判断是否可读。 + +**接口**:需 `miniprogram` 组下的 `purchase-status`、`pay` 支持增值版逻辑。 + +--- + +### 【测试人员】 + +**测试重点**: +1. 普通版 9.9 买断,全书可读。 +2. 增值版:基础价购买后,后 N 章仍锁定;逐章购买,价格累加正确。 +3. 边界:N=0、N=全书、章节无单价时的降级逻辑。 +4. 三端:管理端配置 → API 返回 → 小程序展示、支付、阅读权限。 + +--- + +## 讨论过程 + +**产品经理**:建议「后 N 章」先按 section 数量实现,便于与现有 `chapters` 结构对齐;后续可扩展为按 chapter。 + +**后端开发**:同意;建议 `premium_chapter_count` 表示「最后 N 个 section」,section 顺序按 `sort_order` 或 `id` 排序。 + +**管理端开发工程师**:需在章节列表中标注「是否增值章节」,并在书籍级配置中设置 N。 + +--- + +## 会议决议 + +1. **版本类型**:支持「普通版」(9.9 买断)与「增值版」(基础价 + 后 N 章按章付费);**两者分开、互斥**,用户只能购买其一。 +2. **增值章节**:「后 N 章」指全书最后 N 个 **section**(与 chapters 表结构一致);N 为可配置参数。 +3. **计价规则**:增值版基础价可配置(默认建议 9.9);增值章节单价取自 `chapters.price`;每购一章,实付 = 该章 price。 +4. **订单**:`product_type` 保留 `section`、`fullbook`;普通版用 `fullbook`;增值版用 `fullbook_premium`(基础价)和 `section`(增值章);增值章节购买用 `product_type=section`、`product_id=section_id`。 +5. **待确认项**:增值版基础价是否固定 9.9;N 默认值。 + +--- + +## 待办事项 + +| 责任角色 | 任务 | 优先级 | 截止建议 | +|---------|------|--------|---------| +| 产品经理 | 输出增值版 MRD:基础价、N 默认值、与普通版关系 | 高 | 需求定稿前 | +| 后端开发 | 设计 premium_config、扩展 purchase-status / pay | 高 | 方案评审后 | +| 管理端开发工程师 | 增值章节配置 UI、书籍版本选择 | 中 | 接口就绪后 | +| 小程序开发工程师 | 增值版选购与章节解锁流程、支付衔接 | 中 | 接口就绪后 | +| 测试人员 | 编写增值版测试用例、边界场景 | 中 | 开发完成前 | + +--- + +## 问题与作答区 + +| # | 问题 | 责任角色 | 作答 | +|---|------|---------|------| +| 1 | 「后 N 章」按 section 还是 chapter 计数? | 产品经理 | 决议:按 section | +| 2 | 增值版基础价是否固定 9.9? | 产品经理 | (待补充) | +| 3 | 普通版与增值版是否互斥?用户能否同时拥有? | 产品经理 | **已确认:分开、互斥**,用户购买其一 | +| 4 | N 的默认值建议?(如 10) | 产品经理 | (待补充) | + +--- + +## 各角色经验与业务理解更新 + +### 产品经理 +- 文章/书籍可区分为普通版与增值版,增值版采用「基础价 + 增值章节按章付费」模式。 + +### 后端开发 +- 增值版需新增 `premium_config`,含 `premium_chapter_count`(后 N 个 section)、`premium_base_price`;增值章节购买沿用 `section` 订单。 + +### 管理端开发工程师 +- 需支持「增值版配置」与「增值章节」的 N、单价维护。 + +### 小程序开发工程师 +- 增值版需在目录与阅读页区分普通/增值,未购增值章节时展示解锁与支付入口。 + +### 测试人员 +- 增值版需覆盖:基础价购买、逐章购买、价格累加、权限边界、配置 N=0/全书的异常场景。 + +### 团队共享 +- 增值版计价规则:基础价 + Σ(增值章节单价),按章购买、按章累加。 + +--- + +*会议纪要由助理橙子生成 | 各角色经验已同步至 `agent/{角色}/evolution/2026-02-28.md`* diff --git a/.cursor/meeting/README.md b/.cursor/meeting/README.md index bd568982..d3f674f5 100644 --- a/.cursor/meeting/README.md +++ b/.cursor/meeting/README.md @@ -61,3 +61,4 @@ YYYY-MM-DD_会议主题.md | 2026-02-27 | 开发进度同步会议 | 产品、后端、管理端、小程序 | [2026-02-27_开发进度同步会议.md](2026-02-27_开发进度同步会议.md) | | 2026-02-28 | 临时需求池 stitch_soul 需求评审(含页面重构专项·10 张图全覆盖) | 产品、后端、管理端、小程序、测试 | [2026-02-28_临时需求池stitch_soul需求评审.md](2026-02-28_临时需求池stitch_soul需求评审.md) | | 2026-02-28 | 个人资料页实现评估(profile-show / profile-edit) | 产品、后端、管理端、小程序、测试 | [2026-02-28_个人资料页实现评估.md](2026-02-28_个人资料页实现评估.md) | +| 2026-02-28 | 文章类型(普通版/增值版)需求分析 | 产品、后端、管理端、小程序、测试 | [2026-02-28_文章类型普通版增值版需求分析.md](2026-02-28_文章类型普通版增值版需求分析.md) | diff --git a/miniprogram/pages/match/match.js b/miniprogram/pages/match/match.js index 72841a2f..eeac9224 100644 --- a/miniprogram/pages/match/match.js +++ b/miniprogram/pages/match/match.js @@ -201,12 +201,7 @@ Page({ async handleMatchClick() { const currentType = MATCH_TYPES.find(t => t.id === this.data.selectedType) - // stitch_soul:导师顾问 → 跳转选择导师页 - if (currentType && currentType.id === 'mentor') { - wx.navigateTo({ url: '/pages/mentors/mentors' }) - return - } - + // 导师顾问:先播匹配动画,动画完成后再跳转(不在此处直接跳) // 找伙伴/资源对接:需先完善联系方式 if (this.data.isLoggedIn && currentType?.matchFromDB) { await this.ensureContactInfo(() => this._handleMatchClickInner(currentType)) @@ -346,7 +341,7 @@ Page({ this.startMatch() }, - // 匹配动画后弹出加入确认 + // 匹配动画后弹出加入确认(导师顾问:动画完成后直接跳转导师页) startMatchingAnimation(currentType) { // 显示匹配中状态 this.setData({ @@ -360,19 +355,23 @@ Page({ this.setData({ matchAttempts: this.data.matchAttempts + 1 }) }, 500) - // 1-3秒随机延迟后显示弹窗 - const delay = Math.random() * 2000 + 1000 + // 1.5-3秒后:导师顾问→跳转;其他类型→弹窗 + const delay = Math.random() * 1500 + 1500 setTimeout(() => { clearInterval(timer) - this.setData({ - isMatching: false, - showJoinModal: true, - joinType: currentType.id, - joinTypeLabel: currentType.matchLabel || currentType.label, - joinSuccess: false, - joinError: '', - needBindFirst: false - }) + this.setData({ isMatching: false }) + if (currentType && currentType.id === 'mentor') { + wx.navigateTo({ url: '/pages/mentors/mentors' }) + } else { + this.setData({ + showJoinModal: true, + joinType: currentType.id, + joinTypeLabel: currentType.matchLabel || currentType.label, + joinSuccess: false, + joinError: '', + needBindFirst: false + }) + } }, delay) }, diff --git a/miniprogram/pages/member-detail/member-detail.js b/miniprogram/pages/member-detail/member-detail.js index 7af4e8e7..a9009d62 100644 --- a/miniprogram/pages/member-detail/member-detail.js +++ b/miniprogram/pages/member-detail/member-detail.js @@ -1,10 +1,10 @@ const app = getApp() const MOCK_ENRICHMENT = [ - { mbti: 'ENTJ', region: '深圳', skills: '电商运营、供应链管理、团队搭建', contactRaw: '13800138001', bestMonth: '做跨境电商独立站,单月GMV突破200万,净利润35万', achievement: '从0到1搭建了30人的电商团队,年营收破3000万', turningPoint: '2019年从传统外贸转型跨境电商,放弃稳定薪资All in创业', canHelp: '电商选品、供应链对接、团队管理SOP', needHelp: '寻找品牌合作方和内容营销人才', project: '跨境电商独立站+亚马逊多店铺运营,主营家居类目' }, - { mbti: 'INFP', region: '杭州', skills: '短视频制作、IP打造、私域运营', contactRaw: '13900139002', bestMonth: '旅游账号30天涨粉10万,带货佣金收入12万', achievement: '帮助3个素人打造个人IP,每个月稳定变现5万+', turningPoint: '辞去互联网大厂工作开始做自媒体,第三个月就超过原薪资', canHelp: '短视频脚本、账号冷启动、私域转化设计', needHelp: '寻找供应链资源和线下活动合作', project: '旅游+生活方式自媒体矩阵,全网粉丝50万+' }, - { mbti: 'INTP', region: '厦门', skills: 'AI开发、小程序开发、系统架构', contactRaw: '13700137003', bestMonth: 'AI客服系统外包项目,单月收入18万', achievement: '独立开发的SaaS产品获得天使轮200万融资', turningPoint: '从程序员转型技术创业者,学会用技术解决商业问题', canHelp: '技术方案设计、AI应用落地、小程序开发', needHelp: '需要商业化运营和市场推广合伙人', project: 'AI+私域运营工具SaaS平台' }, - { mbti: 'ESTP', region: '成都', skills: '资源对接、商务BD、活动策划', contactRaw: '13600136004', bestMonth: '撮合景区合作,居间费收入25万', achievement: '组建覆盖全国50+城市创业者社群,活跃成员3000+', turningPoint: '在Soul派对房认识第一个合伙人,打开了社交创业的大门', canHelp: '各行业资源对接、活动策划、社群引荐', needHelp: '寻找技术合伙人和内容创作者', project: '创业者资源对接平台+线下创业者沙龙' } + { mbti: 'ENTJ', region: '深圳', industry: '跨境电商', position: '创始人', businessScale: '年GMV 3000万+', skills: '电商运营、供应链管理、团队搭建', contactRaw: '13800138001', wechatRaw: 'wxid_entj001', bestMonth: '做跨境电商独立站,单月GMV突破200万,净利润35万', achievement: '从0到1搭建了30人的电商团队,年营收破3000万', turningPoint: '2019年从传统外贸转型跨境电商,放弃稳定薪资All in创业', canHelp: '电商选品、供应链对接、团队管理SOP', needHelp: '寻找品牌合作方和内容营销人才', project: '跨境电商独立站+亚马逊多店铺运营,主营家居类目' }, + { mbti: 'INFP', region: '杭州', industry: '新媒体/电商', position: '创始人', businessScale: '年GMV 5000万+', skills: '短视频制作、IP打造、私域运营', contactRaw: '13900139002', wechatRaw: 'wxid_****abc', bestMonth: '旅游账号30天涨粉10万,带货佣金收入12万', achievement: '帮助3个素人打造个人IP,每个月稳定变现5万+', turningPoint: '辞去互联网大厂工作开始做自媒体,第三个月就超过原薪资', canHelp: '短视频脚本、账号冷启动、私域转化设计', needHelp: '寻找供应链资源和线下活动合作', project: '旅游+生活方式自媒体矩阵,全网粉丝50万+' }, + { mbti: 'INTP', region: '厦门', industry: 'SaaS/技术', position: '技术合伙人', businessScale: '天使轮200万', skills: 'AI开发、小程序开发、系统架构', contactRaw: '13700137003', wechatRaw: 'wxid_intp003', bestMonth: 'AI客服系统外包项目,单月收入18万', achievement: '独立开发的SaaS产品获得天使轮200万融资', turningPoint: '从程序员转型技术创业者,学会用技术解决商业问题', canHelp: '技术方案设计、AI应用落地、小程序开发', needHelp: '需要商业化运营和市场推广合伙人', project: 'AI+私域运营工具SaaS平台' }, + { mbti: 'ESTP', region: '成都', industry: '资源对接', position: '联合创始人', businessScale: '50+城市', skills: '资源对接、商务BD、活动策划', contactRaw: '13600136004', wechatRaw: 'wxid_estp004', bestMonth: '撮合景区合作,居间费收入25万', achievement: '组建覆盖全国50+城市创业者社群,活跃成员3000+', turningPoint: '在Soul派对房认识第一个合伙人,打开了社交创业的大门', canHelp: '各行业资源对接、活动策划、社群引荐', needHelp: '寻找技术合伙人和内容创作者', project: '创业者资源对接平台+线下创业者沙龙' } ] Page({ @@ -33,8 +33,16 @@ Page({ this.setData({ member: this.enrichAndFormat({ id: u.id, name: u.vipName || u.vip_name || u.nickname || '创业者', avatar: u.vipAvatar || u.vip_avatar || u.avatar || '', isVip: u.is_vip === 1, - contactRaw: u.vipContact || u.vip_contact || u.phone || '', project: u.vipProject || u.vip_project || '', - bio: u.vipBio || u.vip_bio || '', mbti: '', region: '', skills: '', + contactRaw: u.vipContact || u.vip_contact || u.phone || '', + wechatId: u.wechatId || u.wechat_id, + project: u.vipProject || u.vip_project || u.projectIntro || u.project_intro || '', + industry: u.industry, position: u.position, businessScale: u.businessScale || u.business_scale, + skills: u.skills, mbti: u.mbti, region: u.region, + storyBestMonth: u.storyBestMonth || u.story_best_month, + storyAchievement: u.storyAchievement || u.story_achievement, + storyTurning: u.storyTurning || u.story_turning, + helpOffer: u.helpOffer || u.help_offer, + helpNeed: u.helpNeed || u.help_need, }), loading: false }) return } @@ -54,21 +62,29 @@ Page({ isVip: raw.isVip || raw.is_vip === 1, mbti: raw.mbti || mock.mbti, region: raw.region || mock.region, + industry: raw.industry || mock.industry, + position: raw.position || mock.position, + businessScale: raw.businessScale || raw.business_scale || mock.businessScale, skills: raw.skills || mock.skills, - contactRaw: raw.contactRaw || raw.vipContact || raw.vip_contact || mock.contactRaw, - bestMonth: raw.bestMonth || mock.bestMonth, - achievement: raw.achievement || mock.achievement, - turningPoint: raw.turningPoint || mock.turningPoint, - canHelp: raw.canHelp || mock.canHelp, - needHelp: raw.needHelp || mock.needHelp, - project: raw.project || raw.vipProject || raw.vip_project || mock.project + contactRaw: raw.contactRaw || raw.vipContact || raw.vip_contact || raw.phone || mock.contactRaw, + wechatRaw: raw.wechatRaw || raw.wechatId || raw.wechat_id || mock.wechatRaw, + bestMonth: raw.bestMonth || raw.storyBestMonth || raw.story_best_month || mock.bestMonth, + achievement: raw.achievement || raw.storyAchievement || raw.story_achievement || mock.achievement, + turningPoint: raw.turningPoint || raw.storyTurning || raw.story_turning || mock.turningPoint, + canHelp: raw.canHelp || raw.helpOffer || raw.help_offer || mock.canHelp, + needHelp: raw.needHelp || raw.helpNeed || raw.help_need || mock.needHelp, + project: raw.project || raw.vipProject || raw.vip_project || raw.projectIntro || raw.project_intro || mock.project } const contact = merged.contactRaw || '' + const wechat = merged.wechatRaw || '' const isMatched = (app.globalData.matchedUsers || []).includes(merged.id) merged.contactDisplay = contact ? (contact.slice(0, 3) + '****' + (contact.length > 7 ? contact.slice(-2) : '')) : '' merged.contactUnlocked = isMatched merged.contactFull = contact + merged.wechatDisplay = wechat ? (wechat.slice(0, 4) + '****' + (wechat.length > 8 ? wechat.slice(-3) : '')) : '' + merged.wechatUnlocked = isMatched + merged.wechatFull = wechat return merged }, @@ -86,6 +102,12 @@ Page({ wx.setClipboardData({ data: c, success: () => wx.showToast({ title: '已复制', icon: 'success' }) }) }, + copyWechat() { + const w = this.data.member?.wechatFull + if (!w) return + wx.setClipboardData({ data: w, success: () => wx.showToast({ title: '已复制', icon: 'success' }) }) + }, + goToMatch() { wx.switchTab({ url: '/pages/match/match' }) }, goToVip() { wx.navigateTo({ url: '/pages/vip/vip' }) }, goBack() { wx.navigateBack() }, diff --git a/miniprogram/pages/member-detail/member-detail.wxml b/miniprogram/pages/member-detail/member-detail.wxml index ca8b155f..553c52bb 100644 --- a/miniprogram/pages/member-detail/member-detail.wxml +++ b/miniprogram/pages/member-detail/member-detail.wxml @@ -1,101 +1,147 @@ + + - - 超级个体 - + + + + 个人资料 + + + + - - - - - - + + + + + {{member.name[0] || '创'}} VIP - {{member.name}} - - {{member.mbti}} - 📍{{member.region}} + {{member.name}} + + {{member.mbti}} + 📍{{member.region}} - + - 👤基本信息 - - 我擅长 - {{member.skills}} + + 👤 + 基本信息 - - 联系方式 - - {{member.contactDisplay}} - - 🔒匹配解锁 + + + 行业 + {{member.industry}} + + + 职位 + {{member.position}} + + + 业务体量 + {{member.businessScale}} + + + + 我擅长 + {{member.skills}} + + + 联系方式 + + {{member.contactDisplay || '未填写'}} + 🔒 + 📋 + + + + 微信号 + + {{member.wechatDisplay || '未填写'}} + 🔒 + 📋 - 复制 - + - 💡个人故事 - - 🏆 最赚钱的一个月做的是什么 - {{member.bestMonth}} + + 💡 + 个人故事 - - - ⭐ 最有成就感的一件事 - {{member.achievement}} - - - - 🔄 人生的转折点 - {{member.turningPoint}} + + + 🏆最赚钱的一个月做的是什么 + {{member.bestMonth}} + + + + 最有成就感的一件事 + {{member.achievement}} + + + + 🔄人生的转折点 + {{member.turningPoint}} + - + - 🤝互助需求 - - 我能帮到你 - {{member.canHelp}} + + 🤝 + 互助需求 - - 我需要帮助 - {{member.needHelp}} + + + 我能帮你 + {{member.canHelp}} + + + 我需要帮助 + {{member.needHelp}} + - + - 🚀项目介绍 + + 🚀 + 项目介绍 + {{member.project}} - - - 开始匹配 · 解锁联系方式 - 成为超级个体 → + + + + 成为超级个体 + + - - + - 加载中... + + 加载中... - 👤暂无该超级个体信息 + 👤 + 暂无该超级个体信息 diff --git a/miniprogram/pages/member-detail/member-detail.wxss b/miniprogram/pages/member-detail/member-detail.wxss index 7afe12e4..1151f00f 100644 --- a/miniprogram/pages/member-detail/member-detail.wxss +++ b/miniprogram/pages/member-detail/member-detail.wxss @@ -1,75 +1,164 @@ -.page { background: #050a10; min-height: 100vh; color: #fff; } +/* Soul创业派对 - 个人资料页(enhanced_professional_profile 1:1 还原) */ +.page { background: #050B14; min-height: 100vh; color: #fff; } -/* 导航 */ -.nav-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 999; display: flex; align-items: center; justify-content: space-between; padding: 0 24rpx; height: 44px; background: rgba(5,10,16,.92); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border-bottom: 1rpx solid rgba(56,189,172,.08); } -.back-arrow { font-size: 48rpx; color: #38bdac; font-weight: 300; } -.nav-title { font-size: 32rpx; font-weight: 600; letter-spacing: 2rpx; } -.nav-ph { width: 48rpx; } -.nav-back { width: 48rpx; height: 48rpx; display: flex; align-items: center; justify-content: center; } +/* 导航栏 */ +.nav-bar { + position: fixed; top: 0; left: 0; right: 0; z-index: 999; + display: flex; align-items: center; justify-content: space-between; + padding: 0 32rpx; height: 44px; + background: rgba(5, 11, 20, 0.9); + backdrop-filter: blur(24rpx); + -webkit-backdrop-filter: blur(24rpx); + border-bottom: 1rpx solid rgba(255, 255, 255, 0.05); +} +.nav-back { width: 80rpx; height: 80rpx; display: flex; align-items: center; justify-content: flex-start; } +.nav-icon { font-size: 44rpx; color: #5EEAD4; font-weight: 300; } +.nav-title { font-size: 34rpx; font-weight: 700; color: #fff; letter-spacing: 2rpx; } +.nav-right { display: flex; align-items: center; gap: 16rpx; } +.nav-icon-wrap { padding: 8rpx; } +.nav-icon-dot { font-size: 28rpx; color: rgba(255,255,255,0.8); } .scroll-wrap { height: calc(100vh - 88px); } -/* ===== 顶部名片 ===== */ -.card-hero { position: relative; margin: 24rpx 24rpx 0; padding: 56rpx 0 40rpx; border-radius: 28rpx; overflow: hidden; background: linear-gradient(160deg, #0d1f2d 0%, #0a1620 40%, #101828 100%); border: 1rpx solid rgba(56,189,172,.15); } -.hero-deco { position: absolute; top: -60rpx; right: -60rpx; width: 240rpx; height: 240rpx; border-radius: 50%; background: radial-gradient(circle, rgba(56,189,172,.12) 0%, transparent 70%); } -.hero-deco2 { position: absolute; bottom: -40rpx; left: -40rpx; width: 180rpx; height: 180rpx; border-radius: 50%; background: radial-gradient(circle, rgba(245,166,35,.06) 0%, transparent 70%); } -.hero-body { position: relative; display: flex; flex-direction: column; align-items: center; z-index: 1; } - -.avatar-ring { position: relative; width: 168rpx; height: 168rpx; border-radius: 50%; padding: 6rpx; background: linear-gradient(135deg, #1a3a3a, #0d1f2d); margin-bottom: 20rpx; } -.avatar-ring.vip-ring { background: linear-gradient(135deg, #f5a623, #38bdac, #f5a623); background-size: 300% 300%; animation: vipGlow 4s ease infinite; } -@keyframes vipGlow { 0%,100%{background-position:0% 50%} 50%{background-position:100% 50%} } -.avatar-img { width: 100%; height: 100%; border-radius: 50%; border: 4rpx solid #0a1620; } -.avatar-ph { width: 100%; height: 100%; border-radius: 50%; border: 4rpx solid #0a1620; background: #152030; display: flex; align-items: center; justify-content: center; font-size: 52rpx; color: #38bdac; font-weight: 700; } -.vip-tag { position: absolute; bottom: 4rpx; right: 4rpx; background: linear-gradient(135deg, #f5a623, #e8920d); color: #000; font-size: 18rpx; font-weight: 800; padding: 4rpx 14rpx; border-radius: 16rpx; letter-spacing: 1rpx; box-shadow: 0 4rpx 12rpx rgba(245,166,35,.4); } - -.hero-name { font-size: 38rpx; font-weight: 700; letter-spacing: 2rpx; margin-bottom: 12rpx; text-shadow: 0 2rpx 8rpx rgba(0,0,0,.5); } -.hero-tags { display: flex; gap: 12rpx; flex-wrap: wrap; justify-content: center; } -.tag-item { font-size: 22rpx; padding: 6rpx 18rpx; border-radius: 24rpx; } -.tag-mbti { color: #38bdac; background: rgba(56,189,172,.12); border: 1rpx solid rgba(56,189,172,.2); } -.tag-region { color: #ccc; background: rgba(255,255,255,.06); border: 1rpx solid rgba(255,255,255,.08); } +/* ===== 顶部 Profile 卡片 ===== */ +.card-profile { + position: relative; margin: 32rpx 32rpx 0; + padding: 64rpx 40rpx 48rpx; + border-radius: 32rpx; + background: #0F1720; + border: 1rpx solid rgba(255, 255, 255, 0.08); + overflow: hidden; +} +.profile-deco { + position: absolute; top: 0; left: 0; right: 0; height: 128rpx; + background: linear-gradient(180deg, rgba(30, 58, 69, 0.3) 0%, transparent 100%); + pointer-events: none; +} +.profile-body { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; } +.avatar-wrap { + position: relative; + width: 176rpx; height: 176rpx; + border-radius: 50%; + overflow: hidden; + margin-bottom: 32rpx; + border: 2rpx solid rgba(255, 255, 255, 0.1); + box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.4); +} +.avatar-wrap.vip-ring { + border: 4rpx solid transparent; + background: linear-gradient(135deg, #F59E0B, #5EEAD4, #F59E0B); + background-size: 200% 200%; + animation: vipGlow 4s ease infinite; +} +@keyframes vipGlow { + 0%, 100% { background-position: 0% 50%; } + 50% { background-position: 100% 50%; } +} +.avatar-img { width: 100%; height: 100%; object-fit: cover; } +.avatar-ph { + width: 100%; height: 100%; + background: #17212F; + display: flex; align-items: center; justify-content: center; + font-size: 56rpx; color: #5EEAD4; font-weight: 700; +} +.vip-tag { + position: absolute; bottom: 4rpx; right: 4rpx; + background: linear-gradient(135deg, #F59E0B, #e8920d); + color: #000; font-size: 20rpx; font-weight: 800; + padding: 6rpx 16rpx; border-radius: 20rpx; +} +.profile-name { font-size: 40rpx; font-weight: 700; color: #fff; margin-bottom: 24rpx; letter-spacing: 2rpx; } +.profile-tags { display: flex; align-items: center; justify-content: center; gap: 24rpx; flex-wrap: wrap; } +.tag { font-size: 24rpx; font-weight: 500; padding: 8rpx 24rpx; border-radius: 999rpx; } +.tag-mbti { background: #134E4A; color: #5EEAD4; border: 1rpx solid rgba(94, 234, 212, 0.2); } +.tag-region { background: #1F2937; color: #D1D5DB; border: 1rpx solid rgba(255, 255, 255, 0.1); display: flex; align-items: center; gap: 8rpx; } +.pin-icon { color: #EF4444; font-size: 22rpx; } /* ===== 通用卡片 ===== */ -.card { margin: 20rpx 24rpx; padding: 28rpx 28rpx; border-radius: 24rpx; background: rgba(15,25,40,.8); border: 1rpx solid rgba(255,255,255,.06); backdrop-filter: blur(10px); } -.card-head { display: flex; align-items: center; gap: 10rpx; margin-bottom: 24rpx; } -.card-icon { font-size: 28rpx; } -.card-label { font-size: 28rpx; font-weight: 600; color: #fff; letter-spacing: 1rpx; } +.card { + margin: 32rpx; + padding: 40rpx 40rpx; + border-radius: 32rpx; + background: #0F1720; + border: 1rpx solid rgba(255, 255, 255, 0.08); +} +.card-head { display: flex; align-items: center; gap: 20rpx; margin-bottom: 40rpx; } +.card-icon { font-size: 40rpx; } +.card-icon.bulb { filter: sepia(1) saturate(3) hue-rotate(15deg); } +.card-icon.rocket { opacity: 0.9; } +.card-label { font-size: 30rpx; font-weight: 700; color: #fff; letter-spacing: 1rpx; } -.field { margin-bottom: 20rpx; } +.card-body { } +.field { margin-bottom: 32rpx; } .field:last-child { margin-bottom: 0; } -.f-key { display: block; font-size: 22rpx; color: #6b7b8e; margin-bottom: 8rpx; text-transform: uppercase; letter-spacing: 2rpx; } -.f-val { font-size: 28rpx; color: #e0e8f0; line-height: 1.7; } -.f-contact { display: flex; align-items: center; gap: 16rpx; } -.masked { letter-spacing: 3rpx; font-family: 'Courier New', monospace; } -.lock-chip { display: flex; align-items: center; gap: 6rpx; font-size: 20rpx; color: #f5a623; background: rgba(245,166,35,.1); border: 1rpx solid rgba(245,166,35,.2); padding: 6rpx 16rpx; border-radius: 20rpx; white-space: nowrap; } -.lock-icon { font-size: 18rpx; } -.copy-chip { font-size: 20rpx; color: #38bdac; background: rgba(56,189,172,.1); border: 1rpx solid rgba(56,189,172,.2); padding: 6rpx 16rpx; border-radius: 20rpx; white-space: nowrap; } +.f-key { display: block; font-size: 26rpx; color: #94A3B8; margin-bottom: 12rpx; } +.f-val { font-size: 30rpx; font-weight: 500; color: #fff; line-height: 1.6; } +.f-val.mono { font-family: ui-monospace, monospace; letter-spacing: 2rpx; } +.f-row { display: flex; align-items: center; gap: 16rpx; } +.icon-copy { font-size: 36rpx; color: #94A3B8; opacity: 0.6; padding: 8rpx; } -/* ===== 故事 ===== */ -.story { padding: 4rpx 0; } -.story-q { display: block; font-size: 24rpx; color: #7a8fa3; margin-bottom: 10rpx; } -.story-a { display: block; font-size: 28rpx; color: #e0e8f0; line-height: 1.8; } -.divider { height: 1rpx; background: rgba(255,255,255,.04); margin: 20rpx 0; } +.divider { height: 1rpx; background: rgba(255, 255, 255, 0.05); margin: 32rpx 0; } -/* ===== 互助 ===== */ -.help-box { padding: 20rpx; border-radius: 16rpx; margin-bottom: 16rpx; } +/* ===== 个人故事 ===== */ +.story { margin-bottom: 32rpx; } +.story:last-child { margin-bottom: 0; } +.story-head { display: flex; align-items: center; gap: 12rpx; margin-bottom: 12rpx; } +.story-icon { font-size: 32rpx; } +.story-icon.turn { opacity: 0.9; } +.story-q { font-size: 26rpx; font-weight: 500; color: #94A3B8; } +.story-a { display: block; font-size: 28rpx; color: #E5E7EB; line-height: 1.7; } + +/* ===== 互助需求 ===== */ +.help-box { + padding: 32rpx; + border-radius: 24rpx; + margin-bottom: 24rpx; + background: #17212F; + border: 1rpx solid rgba(255, 255, 255, 0.05); +} .help-box:last-child { margin-bottom: 0; } -.help-give { background: rgba(56,189,172,.06); border: 1rpx solid rgba(56,189,172,.1); } -.help-need { background: rgba(245,166,35,.06); border: 1rpx solid rgba(245,166,35,.1); } -.help-tag { display: inline-block; font-size: 22rpx; font-weight: 600; color: #38bdac; margin-bottom: 10rpx; padding: 4rpx 14rpx; border-radius: 12rpx; background: rgba(56,189,172,.12); } -.help-tag.need { color: #f5a623; background: rgba(245,166,35,.12); } -.help-txt { display: block; font-size: 26rpx; color: #ccd4de; line-height: 1.7; } +.help-tag { + display: inline-block; + font-size: 22rpx; font-weight: 600; + padding: 6rpx 16rpx; border-radius: 12rpx; + margin-bottom: 16rpx; +} +.help-give .help-tag { color: #5EEAD4; background: #112D2A; } +.help-need .help-tag { color: #F59E0B; background: #2D1F0D; } +.help-txt { display: block; font-size: 26rpx; color: #fff; line-height: 1.6; letter-spacing: 1rpx; } -/* ===== 项目 ===== */ -.proj-txt { font-size: 26rpx; color: #ccd4de; line-height: 1.8; } +/* ===== 项目介绍 ===== */ +.proj-txt { font-size: 28rpx; color: #E5E7EB; line-height: 1.7; } /* ===== 底部按钮 ===== */ -.bottom-actions { padding: 32rpx 24rpx 0; display: flex; flex-direction: column; gap: 16rpx; } -.btn-match { text-align: center; padding: 26rpx 0; border-radius: 48rpx; font-size: 30rpx; font-weight: 700; letter-spacing: 2rpx; background: linear-gradient(135deg, #38bdac 0%, #2ca898 50%, #249e8c 100%); color: #fff; box-shadow: 0 8rpx 24rpx rgba(56,189,172,.3); } -.btn-vip { text-align: center; padding: 22rpx 0; border-radius: 48rpx; font-size: 26rpx; color: #f5a623; background: transparent; border: 1rpx solid rgba(245,166,35,.3); } +.bottom-wrap { + padding: 48rpx 32rpx 0; +} +.btn-super { + display: flex; + align-items: center; + justify-content: center; + gap: 12rpx; + width: 100%; + padding: 32rpx 0; + border-radius: 999rpx; + background: transparent; + border: 1rpx solid rgba(245, 158, 11, 0.3); + color: #F59E0B; + font-size: 30rpx; font-weight: 500; + letter-spacing: 2rpx; +} +.btn-arrow { font-size: 36rpx; font-weight: 300; } /* ===== 状态 ===== */ -.state-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; gap: 16rpx; } -.state-txt { font-size: 28rpx; color: #4a5a6e; } -.state-emoji { font-size: 80rpx; } -.loading-dot { width: 48rpx; height: 48rpx; border-radius: 50%; border: 4rpx solid rgba(56,189,172,.2); border-top-color: #38bdac; animation: spin 1s linear infinite; } +.state-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; gap: 24rpx; } +.state-txt { font-size: 28rpx; color: #64748B; } +.state-emoji { font-size: 96rpx; } +.loading-dot { + width: 56rpx; height: 56rpx; + border-radius: 50%; + border: 4rpx solid rgba(94, 234, 212, 0.2); + border-top-color: #5EEAD4; + animation: spin 1s linear infinite; +} @keyframes spin { to { transform: rotate(360deg); } } diff --git a/soul-admin/dist/assets/index-C0uzGclW.js b/soul-admin/dist/assets/index-C0uzGclW.js deleted file mode 100644 index 6b328dab..00000000 --- a/soul-admin/dist/assets/index-C0uzGclW.js +++ /dev/null @@ -1,460 +0,0 @@ -function Hv(r,a){for(var l=0;li[c]})}}}return Object.freeze(Object.defineProperty(r,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"]'))i(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"&&i(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 i(c){if(c.ep)return;c.ep=!0;const u=l(c);fetch(c.href,u)}})();function qm(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Tc={exports:{}},Pa={},Ic={exports:{}},Fe={};/** - * @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 Vh;function Kv(){if(Vh)return Fe;Vh=1;var r=Symbol.for("react.element"),a=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),f=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.iterator;function E(S){return S===null||typeof S!="object"?null:(S=v&&S[v]||S["@@iterator"],typeof S=="function"?S:null)}var P={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,j={};function N(S,O,se){this.props=S,this.context=O,this.refs=j,this.updater=se||P}N.prototype.isReactComponent={},N.prototype.setState=function(S,O){if(typeof S!="object"&&typeof S!="function"&&S!=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,S,O,"setState")},N.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function k(){}k.prototype=N.prototype;function R(S,O,se){this.props=S,this.context=O,this.refs=j,this.updater=se||P}var b=R.prototype=new k;b.constructor=R,C(b,N.prototype),b.isPureReactComponent=!0;var T=Array.isArray,B=Object.prototype.hasOwnProperty,G={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function V(S,O,se){var oe,be={},me=null,Y=null;if(O!=null)for(oe in O.ref!==void 0&&(Y=O.ref),O.key!==void 0&&(me=""+O.key),O)B.call(O,oe)&&!M.hasOwnProperty(oe)&&(be[oe]=O[oe]);var xe=arguments.length-2;if(xe===1)be.children=se;else if(1>>1,O=A[S];if(0>>1;Sc(be,$))mec(Y,be)?(A[S]=Y,A[me]=$,S=me):(A[S]=be,A[oe]=$,S=oe);else if(mec(Y,$))A[S]=Y,A[me]=$,S=me;else break e}}return X}function c(A,X){var $=A.sortIndex-X.sortIndex;return $!==0?$:A.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;r.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();r.unstable_now=function(){return f.now()-m}}var x=[],y=[],g=1,v=null,E=3,P=!1,C=!1,j=!1,N=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(A){for(var X=l(y);X!==null;){if(X.callback===null)i(y);else if(X.startTime<=A)i(y),X.sortIndex=X.expirationTime,a(x,X);else break;X=l(y)}}function T(A){if(j=!1,b(A),!C)if(l(x)!==null)C=!0,Q(B);else{var X=l(y);X!==null&&K(T,X.startTime-A)}}function B(A,X){C=!1,j&&(j=!1,k(V),V=-1),P=!0;var $=E;try{for(b(X),v=l(x);v!==null&&(!(v.expirationTime>X)||A&&!ce());){var S=v.callback;if(typeof S=="function"){v.callback=null,E=v.priorityLevel;var O=S(v.expirationTime<=X);X=r.unstable_now(),typeof O=="function"?v.callback=O:v===l(x)&&i(x),b(X)}else i(x);v=l(x)}if(v!==null)var se=!0;else{var oe=l(y);oe!==null&&K(T,oe.startTime-X),se=!1}return se}finally{v=null,E=$,P=!1}}var G=!1,M=null,V=-1,ee=5,de=-1;function ce(){return!(r.unstable_now()-deA||125S?(A.sortIndex=$,a(y,A),l(x)===null&&A===l(y)&&(j?(k(V),V=-1):j=!0,K(T,$-S))):(A.sortIndex=O,a(x,A),C||P||(C=!0,Q(B))),A},r.unstable_shouldYield=ce,r.unstable_wrapCallback=function(A){var X=E;return function(){var $=E;E=X;try{return A.apply(this,arguments)}finally{E=$}}}})(Lc)),Lc}var Gh;function qv(){return Gh||(Gh=1,Mc.exports=Yv()),Mc.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 Qh;function Xv(){if(Qh)return Ft;Qh=1;var r=Nd(),a=qv();function l(e){for(var n="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,y=/^[: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]*$/,g={},v={};function E(e){return x.call(v,e)?!0:x.call(g,e)?!1:y.test(e)?v[e]=!0:(g[e]=!0,!1)}function P(e,n,s,o){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return o?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function C(e,n,s,o){if(n===null||typeof n>"u"||P(e,n,s,o))return!0;if(o)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function j(e,n,s,o,d,h,w){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=o,this.attributeNamespace=d,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=w}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){N[e]=new j(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];N[n]=new j(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){N[e]=new j(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){N[e]=new j(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){N[e]=new j(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){N[e]=new j(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){N[e]=new j(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){N[e]=new j(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){N[e]=new j(e,5,!1,e.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function R(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 n=e.replace(k,R);N[n]=new j(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(k,R);N[n]=new j(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(k,R);N[n]=new j(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){N[e]=new j(e,1,!1,e.toLowerCase(),null,!1,!1)}),N.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){N[e]=new j(e,1,!1,e.toLowerCase(),null,!0,!0)});function b(e,n,s,o){var d=N.hasOwnProperty(n)?N[n]:null;(d!==null?d.type!==0:o||!(2_||d[w]!==h[_]){var L=` -`+d[w].replace(" at new "," at ");return e.displayName&&L.includes("")&&(L=L.replace("",e.displayName)),L}while(1<=w&&0<=_);break}}}finally{se=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?O(e):""}function be(e){switch(e.tag){case 5:return O(e.type);case 16:return O("Lazy");case 13:return O("Suspense");case 19:return O("SuspenseList");case 0:case 2:case 15:return e=oe(e.type,!1),e;case 11:return e=oe(e.type.render,!1),e;case 1:return e=oe(e.type,!0),e;default:return""}}function me(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 M:return"Fragment";case G:return"Portal";case ee:return"Profiler";case V:return"StrictMode";case ue:return"Suspense";case H:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ce:return(e.displayName||"Context")+".Consumer";case de:return(e._context.displayName||"Context")+".Provider";case le:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case W:return n=e.displayName||null,n!==null?n:me(e.type)||"Memo";case Q:n=e._payload,e=e._init;try{return me(e(n))}catch{}}return null}function Y(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return me(n);case 8:return n===V?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function xe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function I(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function re(e){var n=I(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),o=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var d=s.get,h=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(w){o=""+w,h.call(this,w)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return o},setValue:function(w){o=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function fe(e){e._valueTracker||(e._valueTracker=re(e))}function Ee(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),o="";return e&&(o=I(e)?e.checked?"true":"false":e.value),e=o,e!==s?(n.setValue(e),!0):!1}function Ie(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 De(e,n){var s=n.checked;return $({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Ye(e,n){var s=n.defaultValue==null?"":n.defaultValue,o=n.checked!=null?n.checked:n.defaultChecked;s=xe(n.value!=null?n.value:s),e._wrapperState={initialChecked:o,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function tt(e,n){n=n.checked,n!=null&&b(e,"checked",n,!1)}function Ze(e,n){tt(e,n);var s=xe(n.value),o=n.type;if(s!=null)o==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(o==="submit"||o==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?It(e,n.type,s):n.hasOwnProperty("defaultValue")&&It(e,n.type,xe(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Tt(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var o=n.type;if(!(o!=="submit"&&o!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,s||n===e.value||(e.value=n),e.defaultValue=n}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function It(e,n,s){(n!=="number"||Ie(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Nr=Array.isArray;function Un(e,n,s,o){if(e=e.options,n){n={};for(var d=0;d"+n.valueOf().toString()+"",n=ze.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function sn(e,n){if(n){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=n;return}}e.textContent=n}var Sr={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},Yg=["Webkit","ms","Moz","O"];Object.keys(Sr).forEach(function(e){Yg.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Sr[n]=Sr[e]})});function nu(e,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Sr.hasOwnProperty(e)&&Sr[e]?(""+n).trim():n+"px"}function ru(e,n){e=e.style;for(var s in n)if(n.hasOwnProperty(s)){var o=s.indexOf("--")===0,d=nu(s,n[s],o);s==="float"&&(s="cssFloat"),o?e.setProperty(s,d):e[s]=d}}var qg=$({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 Uo(e,n){if(n){if(qg[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(l(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(l(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(l(61))}if(n.style!=null&&typeof n.style!="object")throw Error(l(62))}}function Wo(e,n){if(e.indexOf("-")===-1)return typeof n.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 Ho=null;function Ko(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Go=null,Xr=null,Jr=null;function su(e){if(e=ha(e)){if(typeof Go!="function")throw Error(l(280));var n=e.stateNode;n&&(n=il(n),Go(e.stateNode,e.type,n))}}function au(e){Xr?Jr?Jr.push(e):Jr=[e]:Xr=e}function lu(){if(Xr){var e=Xr,n=Jr;if(Jr=Xr=null,su(e),n)for(e=0;e>>=0,e===0?32:31-(o0(e)/i0|0)|0}var Wa=64,Ha=4194304;function Ys(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 Ka(e,n){var s=e.pendingLanes;if(s===0)return 0;var o=0,d=e.suspendedLanes,h=e.pingedLanes,w=s&268435455;if(w!==0){var _=w&~d;_!==0?o=Ys(_):(h&=w,h!==0&&(o=Ys(h)))}else w=s&~d,w!==0?o=Ys(w):h!==0&&(o=Ys(h));if(o===0)return 0;if(n!==0&&n!==o&&(n&d)===0&&(d=o&-o,h=n&-n,d>=h||d===16&&(h&4194240)!==0))return n;if((o&4)!==0&&(o|=s&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=o;0s;s++)n.push(e);return n}function qs(e,n,s){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-an(n),e[n]=s}function f0(e,n){var s=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var o=e.eventTimes;for(e=e.expirationTimes;0=sa),Mu=" ",Lu=!1;function Ou(e,n){switch(e){case"keyup":return $0.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Du(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ts=!1;function V0(e,n){switch(e){case"compositionend":return Du(n);case"keypress":return n.which!==32?null:(Lu=!0,Mu);case"textInput":return e=n.data,e===Mu&&Lu?null:e;default:return null}}function U0(e,n){if(ts)return e==="compositionend"||!ui&&Ou(e,n)?(e=Pu(),Xa=ai=Qn=null,ts=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:s,offset:n-e};e=o}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Wu(s)}}function Ku(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Ku(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Gu(){for(var e=window,n=Ie();n instanceof e.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)e=n.contentWindow;else break;n=Ie(e.document)}return n}function mi(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function J0(e){var n=Gu(),s=e.focusedElem,o=e.selectionRange;if(n!==s&&s&&s.ownerDocument&&Ku(s.ownerDocument.documentElement,s)){if(o!==null&&mi(s)){if(n=o.start,e=o.end,e===void 0&&(e=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(e,s.value.length);else if(e=(n=s.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var d=s.textContent.length,h=Math.min(o.start,d);o=o.end===void 0?h:Math.min(o.end,d),!e.extend&&h>o&&(d=o,o=h,h=d),d=Hu(s,h);var w=Hu(s,o);d&&w&&(e.rangeCount!==1||e.anchorNode!==d.node||e.anchorOffset!==d.offset||e.focusNode!==w.node||e.focusOffset!==w.offset)&&(n=n.createRange(),n.setStart(d.node,d.offset),e.removeAllRanges(),h>o?(e.addRange(n),e.extend(w.node,w.offset)):(n.setEnd(w.node,w.offset),e.addRange(n)))}}for(n=[],e=s;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,ns=null,pi=null,ia=null,xi=!1;function Qu(e,n,s){var o=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;xi||ns==null||ns!==Ie(o)||(o=ns,"selectionStart"in o&&mi(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),ia&&oa(ia,o)||(ia=o,o=al(pi,"onSelect"),0os||(e.current=Pi[os],Pi[os]=null,os--)}function qe(e,n){os++,Pi[os]=e.current,e.current=n}var Jn={},Nt=Xn(Jn),At=Xn(!1),Er=Jn;function is(e,n){var s=e.type.contextTypes;if(!s)return Jn;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===n)return o.__reactInternalMemoizedMaskedChildContext;var d={},h;for(h in s)d[h]=n[h];return o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=d),d}function Mt(e){return e=e.childContextTypes,e!=null}function cl(){Je(At),Je(Nt)}function df(e,n,s){if(Nt.current!==Jn)throw Error(l(168));qe(Nt,n),qe(At,s)}function uf(e,n,s){var o=e.stateNode;if(n=n.childContextTypes,typeof o.getChildContext!="function")return s;o=o.getChildContext();for(var d in o)if(!(d in n))throw Error(l(108,Y(e)||"Unknown",d));return $({},s,o)}function dl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Jn,Er=Nt.current,qe(Nt,e),qe(At,At.current),!0}function ff(e,n,s){var o=e.stateNode;if(!o)throw Error(l(169));s?(e=uf(e,n,Er),o.__reactInternalMemoizedMergedChildContext=e,Je(At),Je(Nt),qe(Nt,e)):Je(At),qe(At,s)}var Tn=null,ul=!1,Ri=!1;function hf(e){Tn===null?Tn=[e]:Tn.push(e)}function dv(e){ul=!0,hf(e)}function Zn(){if(!Ri&&Tn!==null){Ri=!0;var e=0,n=Qe;try{var s=Tn;for(Qe=1;e>=w,d-=w,In=1<<32-an(n)+d|s<_e?(vt=Re,Re=null):vt=Re.sibling;var We=J(F,Re,z[_e],ae);if(We===null){Re===null&&(Re=vt);break}e&&Re&&We.alternate===null&&n(F,Re),D=h(We,D,_e),Pe===null?Se=We:Pe.sibling=We,Pe=We,Re=vt}if(_e===z.length)return s(F,Re),et&&Rr(F,_e),Se;if(Re===null){for(;_e_e?(vt=Re,Re=null):vt=Re.sibling;var ir=J(F,Re,We.value,ae);if(ir===null){Re===null&&(Re=vt);break}e&&Re&&ir.alternate===null&&n(F,Re),D=h(ir,D,_e),Pe===null?Se=ir:Pe.sibling=ir,Pe=ir,Re=vt}if(We.done)return s(F,Re),et&&Rr(F,_e),Se;if(Re===null){for(;!We.done;_e++,We=z.next())We=te(F,We.value,ae),We!==null&&(D=h(We,D,_e),Pe===null?Se=We:Pe.sibling=We,Pe=We);return et&&Rr(F,_e),Se}for(Re=o(F,Re);!We.done;_e++,We=z.next())We=pe(Re,F,_e,We.value,ae),We!==null&&(e&&We.alternate!==null&&Re.delete(We.key===null?_e:We.key),D=h(We,D,_e),Pe===null?Se=We:Pe.sibling=We,Pe=We);return e&&Re.forEach(function(Wv){return n(F,Wv)}),et&&Rr(F,_e),Se}function ot(F,D,z,ae){if(typeof z=="object"&&z!==null&&z.type===M&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case B:e:{for(var Se=z.key,Pe=D;Pe!==null;){if(Pe.key===Se){if(Se=z.type,Se===M){if(Pe.tag===7){s(F,Pe.sibling),D=d(Pe,z.props.children),D.return=F,F=D;break e}}else if(Pe.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===Q&&yf(Se)===Pe.type){s(F,Pe.sibling),D=d(Pe,z.props),D.ref=ma(F,Pe,z),D.return=F,F=D;break e}s(F,Pe);break}else n(F,Pe);Pe=Pe.sibling}z.type===M?(D=Dr(z.props.children,F.mode,ae,z.key),D.return=F,F=D):(ae=zl(z.type,z.key,z.props,null,F.mode,ae),ae.ref=ma(F,D,z),ae.return=F,F=ae)}return w(F);case G:e:{for(Pe=z.key;D!==null;){if(D.key===Pe)if(D.tag===4&&D.stateNode.containerInfo===z.containerInfo&&D.stateNode.implementation===z.implementation){s(F,D.sibling),D=d(D,z.children||[]),D.return=F,F=D;break e}else{s(F,D);break}else n(F,D);D=D.sibling}D=kc(z,F.mode,ae),D.return=F,F=D}return w(F);case Q:return Pe=z._init,ot(F,D,Pe(z._payload),ae)}if(Nr(z))return ve(F,D,z,ae);if(X(z))return Ne(F,D,z,ae);pl(F,z)}return typeof z=="string"&&z!==""||typeof z=="number"?(z=""+z,D!==null&&D.tag===6?(s(F,D.sibling),D=d(D,z),D.return=F,F=D):(s(F,D),D=Cc(z,F.mode,ae),D.return=F,F=D),w(F)):s(F,D)}return ot}var fs=wf(!0),jf=wf(!1),xl=Xn(null),gl=null,hs=null,Li=null;function Oi(){Li=hs=gl=null}function Di(e){var n=xl.current;Je(xl),e._currentValue=n}function Fi(e,n,s){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===s)break;e=e.return}}function ms(e,n){gl=e,Li=hs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(Lt=!0),e.firstContext=null)}function Yt(e){var n=e._currentValue;if(Li!==e)if(e={context:e,memoizedValue:n,next:null},hs===null){if(gl===null)throw Error(l(308));hs=e,gl.dependencies={lanes:0,firstContext:e}}else hs=hs.next=e;return n}var _r=null;function zi(e){_r===null?_r=[e]:_r.push(e)}function bf(e,n,s,o){var d=n.interleaved;return d===null?(s.next=s,zi(n)):(s.next=d.next,d.next=s),n.interleaved=s,Mn(e,o)}function Mn(e,n){e.lanes|=n;var s=e.alternate;for(s!==null&&(s.lanes|=n),s=e,e=e.return;e!==null;)e.childLanes|=n,s=e.alternate,s!==null&&(s.childLanes|=n),s=e,e=e.return;return s.tag===3?s.stateNode:null}var er=!1;function $i(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ln(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function tr(e,n,s){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(Ue&2)!==0){var d=o.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),o.pending=n,Mn(e,s)}return d=o.interleaved,d===null?(n.next=n,zi(o)):(n.next=d.next,d.next=n),o.interleaved=n,Mn(e,s)}function vl(e,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var o=n.lanes;o&=e.pendingLanes,s|=o,n.lanes=s,ei(e,s)}}function Sf(e,n){var s=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,s===o)){var d=null,h=null;if(s=s.firstBaseUpdate,s!==null){do{var w={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};h===null?d=h=w:h=h.next=w,s=s.next}while(s!==null);h===null?d=h=n:h=h.next=n}else d=h=n;s={baseState:o.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:o.shared,effects:o.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=n:e.next=n,s.lastBaseUpdate=n}function yl(e,n,s,o){var d=e.updateQueue;er=!1;var h=d.firstBaseUpdate,w=d.lastBaseUpdate,_=d.shared.pending;if(_!==null){d.shared.pending=null;var L=_,U=L.next;L.next=null,w===null?h=U:w.next=U,w=L;var Z=e.alternate;Z!==null&&(Z=Z.updateQueue,_=Z.lastBaseUpdate,_!==w&&(_===null?Z.firstBaseUpdate=U:_.next=U,Z.lastBaseUpdate=L))}if(h!==null){var te=d.baseState;w=0,Z=U=L=null,_=h;do{var J=_.lane,pe=_.eventTime;if((o&J)===J){Z!==null&&(Z=Z.next={eventTime:pe,lane:0,tag:_.tag,payload:_.payload,callback:_.callback,next:null});e:{var ve=e,Ne=_;switch(J=n,pe=s,Ne.tag){case 1:if(ve=Ne.payload,typeof ve=="function"){te=ve.call(pe,te,J);break e}te=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=Ne.payload,J=typeof ve=="function"?ve.call(pe,te,J):ve,J==null)break e;te=$({},te,J);break e;case 2:er=!0}}_.callback!==null&&_.lane!==0&&(e.flags|=64,J=d.effects,J===null?d.effects=[_]:J.push(_))}else pe={eventTime:pe,lane:J,tag:_.tag,payload:_.payload,callback:_.callback,next:null},Z===null?(U=Z=pe,L=te):Z=Z.next=pe,w|=J;if(_=_.next,_===null){if(_=d.shared.pending,_===null)break;J=_,_=J.next,J.next=null,d.lastBaseUpdate=J,d.shared.pending=null}}while(!0);if(Z===null&&(L=te),d.baseState=L,d.firstBaseUpdate=U,d.lastBaseUpdate=Z,n=d.shared.interleaved,n!==null){d=n;do w|=d.lane,d=d.next;while(d!==n)}else h===null&&(d.shared.lanes=0);Ar|=w,e.lanes=w,e.memoizedState=te}}function Cf(e,n,s){if(e=n.effects,n.effects=null,e!==null)for(n=0;ns?s:4,e(!0);var o=Hi.transition;Hi.transition={};try{e(!1),n()}finally{Qe=s,Hi.transition=o}}function Wf(){return qt().memoizedState}function mv(e,n,s){var o=ar(e);if(s={lane:o,action:s,hasEagerState:!1,eagerState:null,next:null},Hf(e))Kf(n,s);else if(s=bf(e,n,s,o),s!==null){var d=Rt();fn(s,e,o,d),Gf(s,n,o)}}function pv(e,n,s){var o=ar(e),d={lane:o,action:s,hasEagerState:!1,eagerState:null,next:null};if(Hf(e))Kf(n,d);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var w=n.lastRenderedState,_=h(w,s);if(d.hasEagerState=!0,d.eagerState=_,ln(_,w)){var L=n.interleaved;L===null?(d.next=d,zi(n)):(d.next=L.next,L.next=d),n.interleaved=d;return}}catch{}finally{}s=bf(e,n,d,o),s!==null&&(d=Rt(),fn(s,e,o,d),Gf(s,n,o))}}function Hf(e){var n=e.alternate;return e===rt||n!==null&&n===rt}function Kf(e,n){va=bl=!0;var s=e.pending;s===null?n.next=n:(n.next=s.next,s.next=n),e.pending=n}function Gf(e,n,s){if((s&4194240)!==0){var o=n.lanes;o&=e.pendingLanes,s|=o,n.lanes=s,ei(e,s)}}var Cl={readContext:Yt,useCallback:St,useContext:St,useEffect:St,useImperativeHandle:St,useInsertionEffect:St,useLayoutEffect:St,useMemo:St,useReducer:St,useRef:St,useState:St,useDebugValue:St,useDeferredValue:St,useTransition:St,useMutableSource:St,useSyncExternalStore:St,useId:St,unstable_isNewReconciler:!1},xv={readContext:Yt,useCallback:function(e,n){return bn().memoizedState=[e,n===void 0?null:n],e},useContext:Yt,useEffect:Of,useImperativeHandle:function(e,n,s){return s=s!=null?s.concat([e]):null,Nl(4194308,4,zf.bind(null,n,e),s)},useLayoutEffect:function(e,n){return Nl(4194308,4,e,n)},useInsertionEffect:function(e,n){return Nl(4,2,e,n)},useMemo:function(e,n){var s=bn();return n=n===void 0?null:n,e=e(),s.memoizedState=[e,n],e},useReducer:function(e,n,s){var o=bn();return n=s!==void 0?s(n):n,o.memoizedState=o.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},o.queue=e,e=e.dispatch=mv.bind(null,rt,e),[o.memoizedState,e]},useRef:function(e){var n=bn();return e={current:e},n.memoizedState=e},useState:Mf,useDebugValue:Ji,useDeferredValue:function(e){return bn().memoizedState=e},useTransition:function(){var e=Mf(!1),n=e[0];return e=hv.bind(null,e[1]),bn().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,s){var o=rt,d=bn();if(et){if(s===void 0)throw Error(l(407));s=s()}else{if(s=n(),gt===null)throw Error(l(349));(Ir&30)!==0||Rf(o,n,s)}d.memoizedState=s;var h={value:s,getSnapshot:n};return d.queue=h,Of(Tf.bind(null,o,h,e),[e]),o.flags|=2048,ja(9,_f.bind(null,o,h,s,n),void 0,null),s},useId:function(){var e=bn(),n=gt.identifierPrefix;if(et){var s=An,o=In;s=(o&~(1<<32-an(o)-1)).toString(32)+s,n=":"+n+"R"+s,s=ya++,0<\/script>",e=e.removeChild(e.firstChild)):typeof o.is=="string"?e=w.createElement(s,{is:o.is}):(e=w.createElement(s),s==="select"&&(w=e,o.multiple?w.multiple=!0:o.size&&(w.size=o.size))):e=w.createElementNS(e,s),e[wn]=n,e[fa]=o,hh(e,n,!1,!1),n.stateNode=e;e:{switch(w=Wo(s,o),s){case"dialog":Xe("cancel",e),Xe("close",e),d=o;break;case"iframe":case"object":case"embed":Xe("load",e),d=o;break;case"video":case"audio":for(d=0;dys&&(n.flags|=128,o=!0,ba(h,!1),n.lanes=4194304)}else{if(!o)if(e=wl(w),e!==null){if(n.flags|=128,o=!0,s=e.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),ba(h,!0),h.tail===null&&h.tailMode==="hidden"&&!w.alternate&&!et)return Ct(n),null}else 2*lt()-h.renderingStartTime>ys&&s!==1073741824&&(n.flags|=128,o=!0,ba(h,!1),n.lanes=4194304);h.isBackwards?(w.sibling=n.child,n.child=w):(s=h.last,s!==null?s.sibling=w:n.child=w,h.last=w)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=lt(),n.sibling=null,s=nt.current,qe(nt,o?s&1|2:s&1),n):(Ct(n),null);case 22:case 23:return bc(),o=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==o&&(n.flags|=8192),o&&(n.mode&1)!==0?(Vt&1073741824)!==0&&(Ct(n),n.subtreeFlags&6&&(n.flags|=8192)):Ct(n),null;case 24:return null;case 25:return null}throw Error(l(156,n.tag))}function Sv(e,n){switch(Ti(n),n.tag){case 1:return Mt(n.type)&&cl(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ps(),Je(At),Je(Nt),Wi(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return Vi(n),null;case 13:if(Je(nt),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(l(340));us()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Je(nt),null;case 4:return ps(),null;case 10:return Di(n.type._context),null;case 22:case 23:return bc(),null;case 24:return null;default:return null}}var Rl=!1,kt=!1,Cv=typeof WeakSet=="function"?WeakSet:Set,ge=null;function gs(e,n){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(o){at(e,n,o)}else s.current=null}function dc(e,n,s){try{s()}catch(o){at(e,n,o)}}var xh=!1;function kv(e,n){if(bi=Ya,e=Gu(),mi(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var o=s.getSelection&&s.getSelection();if(o&&o.rangeCount!==0){s=o.anchorNode;var d=o.anchorOffset,h=o.focusNode;o=o.focusOffset;try{s.nodeType,h.nodeType}catch{s=null;break e}var w=0,_=-1,L=-1,U=0,Z=0,te=e,J=null;t:for(;;){for(var pe;te!==s||d!==0&&te.nodeType!==3||(_=w+d),te!==h||o!==0&&te.nodeType!==3||(L=w+o),te.nodeType===3&&(w+=te.nodeValue.length),(pe=te.firstChild)!==null;)J=te,te=pe;for(;;){if(te===e)break t;if(J===s&&++U===d&&(_=w),J===h&&++Z===o&&(L=w),(pe=te.nextSibling)!==null)break;te=J,J=te.parentNode}te=pe}s=_===-1||L===-1?null:{start:_,end:L}}else s=null}s=s||{start:0,end:0}}else s=null;for(Ni={focusedElem:e,selectionRange:s},Ya=!1,ge=n;ge!==null;)if(n=ge,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,ge=e;else for(;ge!==null;){n=ge;try{var ve=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(ve!==null){var Ne=ve.memoizedProps,ot=ve.memoizedState,F=n.stateNode,D=F.getSnapshotBeforeUpdate(n.elementType===n.type?Ne:cn(n.type,Ne),ot);F.__reactInternalSnapshotBeforeUpdate=D}break;case 3:var z=n.stateNode.containerInfo;z.nodeType===1?z.textContent="":z.nodeType===9&&z.documentElement&&z.removeChild(z.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(l(163))}}catch(ae){at(n,n.return,ae)}if(e=n.sibling,e!==null){e.return=n.return,ge=e;break}ge=n.return}return ve=xh,xh=!1,ve}function Na(e,n,s){var o=n.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var d=o=o.next;do{if((d.tag&e)===e){var h=d.destroy;d.destroy=void 0,h!==void 0&&dc(n,s,h)}d=d.next}while(d!==o)}}function _l(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var o=s.create;s.destroy=o()}s=s.next}while(s!==n)}}function uc(e){var n=e.ref;if(n!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof n=="function"?n(e):n.current=e}}function gh(e){var n=e.alternate;n!==null&&(e.alternate=null,gh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[wn],delete n[fa],delete n[Ei],delete n[iv],delete n[cv])),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 vh(e){return e.tag===5||e.tag===3||e.tag===4}function yh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vh(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 fc(e,n,s){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(e,n):s.insertBefore(e,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(e,s)):(n=s,n.appendChild(e)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=ol));else if(o!==4&&(e=e.child,e!==null))for(fc(e,n,s),e=e.sibling;e!==null;)fc(e,n,s),e=e.sibling}function hc(e,n,s){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?s.insertBefore(e,n):s.appendChild(e);else if(o!==4&&(e=e.child,e!==null))for(hc(e,n,s),e=e.sibling;e!==null;)hc(e,n,s),e=e.sibling}var wt=null,dn=!1;function nr(e,n,s){for(s=s.child;s!==null;)wh(e,n,s),s=s.sibling}function wh(e,n,s){if(yn&&typeof yn.onCommitFiberUnmount=="function")try{yn.onCommitFiberUnmount(Ua,s)}catch{}switch(s.tag){case 5:kt||gs(s,n);case 6:var o=wt,d=dn;wt=null,nr(e,n,s),wt=o,dn=d,wt!==null&&(dn?(e=wt,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):wt.removeChild(s.stateNode));break;case 18:wt!==null&&(dn?(e=wt,s=s.stateNode,e.nodeType===8?ki(e.parentNode,s):e.nodeType===1&&ki(e,s),ta(e)):ki(wt,s.stateNode));break;case 4:o=wt,d=dn,wt=s.stateNode.containerInfo,dn=!0,nr(e,n,s),wt=o,dn=d;break;case 0:case 11:case 14:case 15:if(!kt&&(o=s.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){d=o=o.next;do{var h=d,w=h.destroy;h=h.tag,w!==void 0&&((h&2)!==0||(h&4)!==0)&&dc(s,n,w),d=d.next}while(d!==o)}nr(e,n,s);break;case 1:if(!kt&&(gs(s,n),o=s.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=s.memoizedProps,o.state=s.memoizedState,o.componentWillUnmount()}catch(_){at(s,n,_)}nr(e,n,s);break;case 21:nr(e,n,s);break;case 22:s.mode&1?(kt=(o=kt)||s.memoizedState!==null,nr(e,n,s),kt=o):nr(e,n,s);break;default:nr(e,n,s)}}function jh(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Cv),n.forEach(function(o){var d=Lv.bind(null,e,o);s.has(o)||(s.add(o),o.then(d,d))})}}function un(e,n){var s=n.deletions;if(s!==null)for(var o=0;od&&(d=w),o&=~h}if(o=d,o=lt()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*Pv(o/1960))-o,10e?16:e,sr===null)var o=!1;else{if(e=sr,sr=null,Ll=0,(Ue&6)!==0)throw Error(l(331));var d=Ue;for(Ue|=4,ge=e.current;ge!==null;){var h=ge,w=h.child;if((ge.flags&16)!==0){var _=h.deletions;if(_!==null){for(var L=0;L<_.length;L++){var U=_[L];for(ge=U;ge!==null;){var Z=ge;switch(Z.tag){case 0:case 11:case 15:Na(8,Z,h)}var te=Z.child;if(te!==null)te.return=Z,ge=te;else for(;ge!==null;){Z=ge;var J=Z.sibling,pe=Z.return;if(gh(Z),Z===U){ge=null;break}if(J!==null){J.return=pe,ge=J;break}ge=pe}}}var ve=h.alternate;if(ve!==null){var Ne=ve.child;if(Ne!==null){ve.child=null;do{var ot=Ne.sibling;Ne.sibling=null,Ne=ot}while(Ne!==null)}}ge=h}}if((h.subtreeFlags&2064)!==0&&w!==null)w.return=h,ge=w;else e:for(;ge!==null;){if(h=ge,(h.flags&2048)!==0)switch(h.tag){case 0:case 11:case 15:Na(9,h,h.return)}var F=h.sibling;if(F!==null){F.return=h.return,ge=F;break e}ge=h.return}}var D=e.current;for(ge=D;ge!==null;){w=ge;var z=w.child;if((w.subtreeFlags&2064)!==0&&z!==null)z.return=w,ge=z;else e:for(w=D;ge!==null;){if(_=ge,(_.flags&2048)!==0)try{switch(_.tag){case 0:case 11:case 15:_l(9,_)}}catch(Se){at(_,_.return,Se)}if(_===w){ge=null;break e}var ae=_.sibling;if(ae!==null){ae.return=_.return,ge=ae;break e}ge=_.return}}if(Ue=d,Zn(),yn&&typeof yn.onPostCommitFiberRoot=="function")try{yn.onPostCommitFiberRoot(Ua,e)}catch{}o=!0}return o}finally{Qe=s,Xt.transition=n}}return!1}function Ah(e,n,s){n=xs(s,n),n=Xf(e,n,1),e=tr(e,n,1),n=Rt(),e!==null&&(qs(e,1,n),Dt(e,n))}function at(e,n,s){if(e.tag===3)Ah(e,e,s);else for(;n!==null;){if(n.tag===3){Ah(n,e,s);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(rr===null||!rr.has(o))){e=xs(s,e),e=Jf(n,e,1),n=tr(n,e,1),e=Rt(),n!==null&&(qs(n,1,e),Dt(n,e));break}}n=n.return}}function Av(e,n,s){var o=e.pingCache;o!==null&&o.delete(n),n=Rt(),e.pingedLanes|=e.suspendedLanes&s,gt===e&&(jt&s)===s&&(mt===4||mt===3&&(jt&130023424)===jt&&500>lt()-xc?Lr(e,0):pc|=s),Dt(e,n)}function Mh(e,n){n===0&&((e.mode&1)===0?n=1:(n=Ha,Ha<<=1,(Ha&130023424)===0&&(Ha=4194304)));var s=Rt();e=Mn(e,n),e!==null&&(qs(e,n,s),Dt(e,s))}function Mv(e){var n=e.memoizedState,s=0;n!==null&&(s=n.retryLane),Mh(e,s)}function Lv(e,n){var s=0;switch(e.tag){case 13:var o=e.stateNode,d=e.memoizedState;d!==null&&(s=d.retryLane);break;case 19:o=e.stateNode;break;default:throw Error(l(314))}o!==null&&o.delete(n),Mh(e,s)}var Lh;Lh=function(e,n,s){if(e!==null)if(e.memoizedProps!==n.pendingProps||At.current)Lt=!0;else{if((e.lanes&s)===0&&(n.flags&128)===0)return Lt=!1,bv(e,n,s);Lt=(e.flags&131072)!==0}else Lt=!1,et&&(n.flags&1048576)!==0&&mf(n,hl,n.index);switch(n.lanes=0,n.tag){case 2:var o=n.type;Pl(e,n),e=n.pendingProps;var d=is(n,Nt.current);ms(n,s),d=Gi(null,n,o,e,d,s);var h=Qi();return n.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Mt(o)?(h=!0,dl(n)):h=!1,n.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,$i(n),d.updater=kl,n.stateNode=d,d._reactInternals=n,ec(n,o,e,s),n=sc(null,n,o,!0,h,s)):(n.tag=0,et&&h&&_i(n),Pt(null,n,d,s),n=n.child),n;case 16:o=n.elementType;e:{switch(Pl(e,n),e=n.pendingProps,d=o._init,o=d(o._payload),n.type=o,d=n.tag=Dv(o),e=cn(o,e),d){case 0:n=rc(null,n,o,e,s);break e;case 1:n=oh(null,n,o,e,s);break e;case 11:n=nh(null,n,o,e,s);break e;case 14:n=rh(null,n,o,cn(o.type,e),s);break e}throw Error(l(306,o,""))}return n;case 0:return o=n.type,d=n.pendingProps,d=n.elementType===o?d:cn(o,d),rc(e,n,o,d,s);case 1:return o=n.type,d=n.pendingProps,d=n.elementType===o?d:cn(o,d),oh(e,n,o,d,s);case 3:e:{if(ih(n),e===null)throw Error(l(387));o=n.pendingProps,h=n.memoizedState,d=h.element,Nf(e,n),yl(n,o,null,s);var w=n.memoizedState;if(o=w.element,h.isDehydrated)if(h={element:o,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){d=xs(Error(l(423)),n),n=ch(e,n,o,s,d);break e}else if(o!==d){d=xs(Error(l(424)),n),n=ch(e,n,o,s,d);break e}else for(Bt=qn(n.stateNode.containerInfo.firstChild),$t=n,et=!0,on=null,s=jf(n,null,o,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(us(),o===d){n=On(e,n,s);break e}Pt(e,n,o,s)}n=n.child}return n;case 5:return kf(n),e===null&&Ai(n),o=n.type,d=n.pendingProps,h=e!==null?e.memoizedProps:null,w=d.children,Si(o,d)?w=null:h!==null&&Si(o,h)&&(n.flags|=32),lh(e,n),Pt(e,n,w,s),n.child;case 6:return e===null&&Ai(n),null;case 13:return dh(e,n,s);case 4:return Bi(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=fs(n,null,o,s):Pt(e,n,o,s),n.child;case 11:return o=n.type,d=n.pendingProps,d=n.elementType===o?d:cn(o,d),nh(e,n,o,d,s);case 7:return Pt(e,n,n.pendingProps,s),n.child;case 8:return Pt(e,n,n.pendingProps.children,s),n.child;case 12:return Pt(e,n,n.pendingProps.children,s),n.child;case 10:e:{if(o=n.type._context,d=n.pendingProps,h=n.memoizedProps,w=d.value,qe(xl,o._currentValue),o._currentValue=w,h!==null)if(ln(h.value,w)){if(h.children===d.children&&!At.current){n=On(e,n,s);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var _=h.dependencies;if(_!==null){w=h.child;for(var L=_.firstContext;L!==null;){if(L.context===o){if(h.tag===1){L=Ln(-1,s&-s),L.tag=2;var U=h.updateQueue;if(U!==null){U=U.shared;var Z=U.pending;Z===null?L.next=L:(L.next=Z.next,Z.next=L),U.pending=L}}h.lanes|=s,L=h.alternate,L!==null&&(L.lanes|=s),Fi(h.return,s,n),_.lanes|=s;break}L=L.next}}else if(h.tag===10)w=h.type===n.type?null:h.child;else if(h.tag===18){if(w=h.return,w===null)throw Error(l(341));w.lanes|=s,_=w.alternate,_!==null&&(_.lanes|=s),Fi(w,s,n),w=h.sibling}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===n){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}Pt(e,n,d.children,s),n=n.child}return n;case 9:return d=n.type,o=n.pendingProps.children,ms(n,s),d=Yt(d),o=o(d),n.flags|=1,Pt(e,n,o,s),n.child;case 14:return o=n.type,d=cn(o,n.pendingProps),d=cn(o.type,d),rh(e,n,o,d,s);case 15:return sh(e,n,n.type,n.pendingProps,s);case 17:return o=n.type,d=n.pendingProps,d=n.elementType===o?d:cn(o,d),Pl(e,n),n.tag=1,Mt(o)?(e=!0,dl(n)):e=!1,ms(n,s),Yf(n,o,d),ec(n,o,d,s),sc(null,n,o,!0,e,s);case 19:return fh(e,n,s);case 22:return ah(e,n,s)}throw Error(l(156,n.tag))};function Oh(e,n){return mu(e,n)}function Ov(e,n,s,o){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=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Jt(e,n,s,o){return new Ov(e,n,s,o)}function Sc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Dv(e){if(typeof e=="function")return Sc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===le)return 11;if(e===W)return 14}return 2}function or(e,n){var s=e.alternate;return s===null?(s=Jt(e.tag,n,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=n,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,n=e.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function zl(e,n,s,o,d,h){var w=2;if(o=e,typeof e=="function")Sc(e)&&(w=1);else if(typeof e=="string")w=5;else e:switch(e){case M:return Dr(s.children,d,h,n);case V:w=8,d|=8;break;case ee:return e=Jt(12,s,n,d|2),e.elementType=ee,e.lanes=h,e;case ue:return e=Jt(13,s,n,d),e.elementType=ue,e.lanes=h,e;case H:return e=Jt(19,s,n,d),e.elementType=H,e.lanes=h,e;case K:return $l(s,d,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case de:w=10;break e;case ce:w=9;break e;case le:w=11;break e;case W:w=14;break e;case Q:w=16,o=null;break e}throw Error(l(130,e==null?e:typeof e,""))}return n=Jt(w,s,n,d),n.elementType=e,n.type=o,n.lanes=h,n}function Dr(e,n,s,o){return e=Jt(7,e,o,n),e.lanes=s,e}function $l(e,n,s,o){return e=Jt(22,e,o,n),e.elementType=K,e.lanes=s,e.stateNode={isHidden:!1},e}function Cc(e,n,s){return e=Jt(6,e,null,n),e.lanes=s,e}function kc(e,n,s){return n=Jt(4,e.children!==null?e.children:[],e.key,n),n.lanes=s,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Fv(e,n,s,o,d){this.tag=n,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=Zo(0),this.expirationTimes=Zo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zo(0),this.identifierPrefix=o,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function Ec(e,n,s,o,d,h,w,_,L){return e=new Fv(e,n,s,_,L),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Jt(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:o,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},$i(h),e}function zv(e,n,s){var o=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(a){console.error(a)}}return r(),Ac.exports=Xv(),Ac.exports}var qh;function Jv(){if(qh)return Gl;qh=1;var r=Xm();return Gl.createRoot=r.createRoot,Gl.hydrateRoot=r.hydrateRoot,Gl}var Zv=Jv(),La=Xm();const ey=qm(La);/** - * @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 Ta(){return Ta=Object.assign?Object.assign.bind():function(r){for(var a=1;a"u")throw new Error(a)}function Sd(r,a){if(!r){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function ny(){return Math.random().toString(36).substr(2,8)}function Jh(r,a){return{usr:r.state,key:r.key,idx:a}}function Jc(r,a,l,i){return l===void 0&&(l=null),Ta({pathname:typeof r=="string"?r:r.pathname,search:"",hash:""},typeof a=="string"?Ts(a):a,{state:l,key:a&&a.key||i||ny()})}function co(r){let{pathname:a="/",search:l="",hash:i=""}=r;return l&&l!=="?"&&(a+=l.charAt(0)==="?"?l:"?"+l),i&&i!=="#"&&(a+=i.charAt(0)==="#"?i:"#"+i),a}function Ts(r){let a={};if(r){let l=r.indexOf("#");l>=0&&(a.hash=r.substr(l),r=r.substr(0,l));let i=r.indexOf("?");i>=0&&(a.search=r.substr(i),r=r.substr(0,i)),r&&(a.pathname=r)}return a}function ry(r,a,l,i){i===void 0&&(i={});let{window:c=document.defaultView,v5Compat:u=!1}=i,f=c.history,m=hr.Pop,x=null,y=g();y==null&&(y=0,f.replaceState(Ta({},f.state,{idx:y}),""));function g(){return(f.state||{idx:null}).idx}function v(){m=hr.Pop;let N=g(),k=N==null?null:N-y;y=N,x&&x({action:m,location:j.location,delta:k})}function E(N,k){m=hr.Push;let R=Jc(j.location,N,k);y=g()+1;let b=Jh(R,y),T=j.createHref(R);try{f.pushState(b,"",T)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;c.location.assign(T)}u&&x&&x({action:m,location:j.location,delta:1})}function P(N,k){m=hr.Replace;let R=Jc(j.location,N,k);y=g();let b=Jh(R,y),T=j.createHref(R);f.replaceState(b,"",T),u&&x&&x({action:m,location:j.location,delta:0})}function C(N){let k=c.location.origin!=="null"?c.location.origin:c.location.href,R=typeof N=="string"?N:co(N);return R=R.replace(/ $/,"%20"),ct(k,"No window.location.(origin|href) available to create URL for href: "+R),new URL(R,k)}let j={get action(){return m},get location(){return r(c,f)},listen(N){if(x)throw new Error("A history only accepts one active listener");return c.addEventListener(Xh,v),x=N,()=>{c.removeEventListener(Xh,v),x=null}},createHref(N){return a(c,N)},createURL:C,encodeLocation(N){let k=C(N);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:E,replace:P,go(N){return f.go(N)}};return j}var Zh;(function(r){r.data="data",r.deferred="deferred",r.redirect="redirect",r.error="error"})(Zh||(Zh={}));function sy(r,a,l){return l===void 0&&(l="/"),ay(r,a,l)}function ay(r,a,l,i){let c=typeof a=="string"?Ts(a):a,u=Cd(c.pathname||"/",l);if(u==null)return null;let f=Jm(r);ly(f);let m=null;for(let x=0;m==null&&x{let x={relativePath:m===void 0?u.path||"":m,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};x.relativePath.startsWith("/")&&(ct(x.relativePath.startsWith(i),'Absolute route path "'+x.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),x.relativePath=x.relativePath.slice(i.length));let y=mr([i,x.relativePath]),g=l.concat(x);u.children&&u.children.length>0&&(ct(u.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+y+'".')),Jm(u.children,a,g,y)),!(u.path==null&&!u.index)&&a.push({path:y,score:hy(y,u.index),routesMeta:g})};return r.forEach((u,f)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))c(u,f);else for(let x of Zm(u.path))c(u,f,x)}),a}function Zm(r){let a=r.split("/");if(a.length===0)return[];let[l,...i]=a,c=l.endsWith("?"),u=l.replace(/\?$/,"");if(i.length===0)return c?[u,""]:[u];let f=Zm(i.join("/")),m=[];return m.push(...f.map(x=>x===""?u:[u,x].join("/"))),c&&m.push(...f),m.map(x=>r.startsWith("/")&&x===""?"/":x)}function ly(r){r.sort((a,l)=>a.score!==l.score?l.score-a.score:my(a.routesMeta.map(i=>i.childrenIndex),l.routesMeta.map(i=>i.childrenIndex)))}const oy=/^:[\w-]+$/,iy=3,cy=2,dy=1,uy=10,fy=-2,em=r=>r==="*";function hy(r,a){let l=r.split("/"),i=l.length;return l.some(em)&&(i+=fy),a&&(i+=cy),l.filter(c=>!em(c)).reduce((c,u)=>c+(oy.test(u)?iy:u===""?dy:uy),i)}function my(r,a){return r.length===a.length&&r.slice(0,-1).every((i,c)=>i===a[c])?r[r.length-1]-a[a.length-1]:0}function py(r,a,l){let{routesMeta:i}=r,c={},u="/",f=[];for(let m=0;m{let{paramName:E,isOptional:P}=g;if(E==="*"){let j=m[v]||"";f=u.slice(0,u.length-j.length).replace(/(.)\/+$/,"$1")}const C=m[v];return P&&!C?y[E]=void 0:y[E]=(C||"").replace(/%2F/g,"/"),y},{}),pathname:u,pathnameBase:f,pattern:r}}function gy(r,a,l){a===void 0&&(a=!1),l===void 0&&(l=!0),Sd(r==="*"||!r.endsWith("*")||r.endsWith("/*"),'Route path "'+r+'" will be treated as if it were '+('"'+r.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+r.replace(/\*$/,"/*")+'".'));let i=[],c="^"+r.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,m,x)=>(i.push({paramName:m,isOptional:x!=null}),x?"/?([^\\/]+)?":"/([^\\/]+)"));return r.endsWith("*")?(i.push({paramName:"*"}),c+=r==="*"||r==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):l?c+="\\/*$":r!==""&&r!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,a?void 0:"i"),i]}function vy(r){try{return r.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return Sd(!1,'The URL path "'+r+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),r}}function Cd(r,a){if(a==="/")return r;if(!r.toLowerCase().startsWith(a.toLowerCase()))return null;let l=a.endsWith("/")?a.length-1:a.length,i=r.charAt(l);return i&&i!=="/"?null:r.slice(l)||"/"}const yy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,wy=r=>yy.test(r);function jy(r,a){a===void 0&&(a="/");let{pathname:l,search:i="",hash:c=""}=typeof r=="string"?Ts(r):r,u;if(l)if(wy(l))u=l;else{if(l.includes("//")){let f=l;l=l.replace(/\/\/+/g,"/"),Sd(!1,"Pathnames cannot have embedded double slashes - normalizing "+(f+" -> "+l))}l.startsWith("/")?u=tm(l.substring(1),"/"):u=tm(l,a)}else u=a;return{pathname:u,search:Sy(i),hash:Cy(c)}}function tm(r,a){let l=a.replace(/\/+$/,"").split("/");return r.split("/").forEach(c=>{c===".."?l.length>1&&l.pop():c!=="."&&l.push(c)}),l.length>1?l.join("/"):"/"}function Oc(r,a,l,i){return"Cannot include a '"+r+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(i)+"]. 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 by(r){return r.filter((a,l)=>l===0||a.route.path&&a.route.path.length>0)}function kd(r,a){let l=by(r);return a?l.map((i,c)=>c===l.length-1?i.pathname:i.pathnameBase):l.map(i=>i.pathnameBase)}function Ed(r,a,l,i){i===void 0&&(i=!1);let c;typeof r=="string"?c=Ts(r):(c=Ta({},r),ct(!c.pathname||!c.pathname.includes("?"),Oc("?","pathname","search",c)),ct(!c.pathname||!c.pathname.includes("#"),Oc("#","pathname","hash",c)),ct(!c.search||!c.search.includes("#"),Oc("#","search","hash",c)));let u=r===""||c.pathname==="",f=u?"/":c.pathname,m;if(f==null)m=l;else{let v=a.length-1;if(!i&&f.startsWith("..")){let E=f.split("/");for(;E[0]==="..";)E.shift(),v-=1;c.pathname=E.join("/")}m=v>=0?a[v]:"/"}let x=jy(c,m),y=f&&f!=="/"&&f.endsWith("/"),g=(u||f===".")&&l.endsWith("/");return!x.pathname.endsWith("/")&&(y||g)&&(x.pathname+="/"),x}const mr=r=>r.join("/").replace(/\/\/+/g,"/"),Ny=r=>r.replace(/\/+$/,"").replace(/^\/*/,"/"),Sy=r=>!r||r==="?"?"":r.startsWith("?")?r:"?"+r,Cy=r=>!r||r==="#"?"":r.startsWith("#")?r:"#"+r;function ky(r){return r!=null&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.internal=="boolean"&&"data"in r}const ep=["post","put","patch","delete"];new Set(ep);const Ey=["get",...ep];new Set(Ey);/** - * 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 Ia(){return Ia=Object.assign?Object.assign.bind():function(r){for(var a=1;a{m.current=!0}),p.useCallback(function(y,g){if(g===void 0&&(g={}),!m.current)return;if(typeof y=="number"){i.go(y);return}let v=Ed(y,JSON.parse(f),u,g.relative==="path");r==null&&a!=="/"&&(v.pathname=v.pathname==="/"?a:mr([a,v.pathname])),(g.replace?i.replace:i.push)(v,g.state,g)},[a,i,f,u,r])}const Ty=p.createContext(null);function Iy(r){let a=p.useContext(Vn).outlet;return a&&p.createElement(Ty.Provider,{value:r},a)}function rp(r,a){let{relative:l}=a===void 0?{}:a,{future:i}=p.useContext(yr),{matches:c}=p.useContext(Vn),{pathname:u}=Yr(),f=JSON.stringify(kd(c,i.v7_relativeSplatPath));return p.useMemo(()=>Ed(r,JSON.parse(f),u,l==="path"),[r,f,u,l])}function Ay(r,a){return My(r,a)}function My(r,a,l,i){Is()||ct(!1);let{navigator:c}=p.useContext(yr),{matches:u}=p.useContext(Vn),f=u[u.length-1],m=f?f.params:{};f&&f.pathname;let x=f?f.pathnameBase:"/";f&&f.route;let y=Yr(),g;if(a){var v;let N=typeof a=="string"?Ts(a):a;x==="/"||(v=N.pathname)!=null&&v.startsWith(x)||ct(!1),g=N}else g=y;let E=g.pathname||"/",P=E;if(x!=="/"){let N=x.replace(/^\//,"").split("/");P="/"+E.replace(/^\//,"").split("/").slice(N.length).join("/")}let C=sy(r,{pathname:P}),j=zy(C&&C.map(N=>Object.assign({},N,{params:Object.assign({},m,N.params),pathname:mr([x,c.encodeLocation?c.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?x:mr([x,c.encodeLocation?c.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),u,l,i);return a&&j?p.createElement(So.Provider,{value:{location:Ia({pathname:"/",search:"",hash:"",state:null,key:"default"},g),navigationType:hr.Pop}},j):j}function Ly(){let r=Uy(),a=ky(r)?r.status+" "+r.statusText:r instanceof Error?r.message:JSON.stringify(r),l=r instanceof Error?r.stack:null,c={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},a),l?p.createElement("pre",{style:c},l):null,null)}const Oy=p.createElement(Ly,null);class Dy extends p.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?p.createElement(Vn.Provider,{value:this.props.routeContext},p.createElement(tp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Fy(r){let{routeContext:a,match:l,children:i}=r,c=p.useContext(Pd);return c&&c.static&&c.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=l.route.id),p.createElement(Vn.Provider,{value:a},i)}function zy(r,a,l,i){var c;if(a===void 0&&(a=[]),l===void 0&&(l=null),i===void 0&&(i=null),r==null){var u;if(!l)return null;if(l.errors)r=l.matches;else if((u=i)!=null&&u.v7_partialHydration&&a.length===0&&!l.initialized&&l.matches.length>0)r=l.matches;else return null}let f=r,m=(c=l)==null?void 0:c.errors;if(m!=null){let g=f.findIndex(v=>v.route.id&&(m==null?void 0:m[v.route.id])!==void 0);g>=0||ct(!1),f=f.slice(0,Math.min(f.length,g+1))}let x=!1,y=-1;if(l&&i&&i.v7_partialHydration)for(let g=0;g=0?f=f.slice(0,y+1):f=[f[0]];break}}}return f.reduceRight((g,v,E)=>{let P,C=!1,j=null,N=null;l&&(P=m&&v.route.id?m[v.route.id]:void 0,j=v.route.errorElement||Oy,x&&(y<0&&E===0?(Hy("route-fallback"),C=!0,N=null):y===E&&(C=!0,N=v.route.hydrateFallbackElement||null)));let k=a.concat(f.slice(0,E+1)),R=()=>{let b;return P?b=j:C?b=N:v.route.Component?b=p.createElement(v.route.Component,null):v.route.element?b=v.route.element:b=g,p.createElement(Fy,{match:v,routeContext:{outlet:g,matches:k,isDataRoute:l!=null},children:b})};return l&&(v.route.ErrorBoundary||v.route.errorElement||E===0)?p.createElement(Dy,{location:l.location,revalidation:l.revalidation,component:j,error:P,children:R(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):R()},null)}var sp=(function(r){return r.UseBlocker="useBlocker",r.UseRevalidator="useRevalidator",r.UseNavigateStable="useNavigate",r})(sp||{}),ap=(function(r){return r.UseBlocker="useBlocker",r.UseLoaderData="useLoaderData",r.UseActionData="useActionData",r.UseRouteError="useRouteError",r.UseNavigation="useNavigation",r.UseRouteLoaderData="useRouteLoaderData",r.UseMatches="useMatches",r.UseRevalidator="useRevalidator",r.UseNavigateStable="useNavigate",r.UseRouteId="useRouteId",r})(ap||{});function $y(r){let a=p.useContext(Pd);return a||ct(!1),a}function By(r){let a=p.useContext(Py);return a||ct(!1),a}function Vy(r){let a=p.useContext(Vn);return a||ct(!1),a}function lp(r){let a=Vy(),l=a.matches[a.matches.length-1];return l.route.id||ct(!1),l.route.id}function Uy(){var r;let a=p.useContext(tp),l=By(),i=lp();return a!==void 0?a:(r=l.errors)==null?void 0:r[i]}function Wy(){let{router:r}=$y(sp.UseNavigateStable),a=lp(ap.UseNavigateStable),l=p.useRef(!1);return np(()=>{l.current=!0}),p.useCallback(function(c,u){u===void 0&&(u={}),l.current&&(typeof c=="number"?r.navigate(c):r.navigate(c,Ia({fromRouteId:a},u)))},[r,a])}const nm={};function Hy(r,a,l){nm[r]||(nm[r]=!0)}function Ky(r,a){r==null||r.v7_startTransition,r==null||r.v7_relativeSplatPath}function Gy(r){let{to:a,replace:l,state:i,relative:c}=r;Is()||ct(!1);let{future:u,static:f}=p.useContext(yr),{matches:m}=p.useContext(Vn),{pathname:x}=Yr(),y=Oa(),g=Ed(a,kd(m,u.v7_relativeSplatPath),x,c==="path"),v=JSON.stringify(g);return p.useEffect(()=>y(JSON.parse(v),{replace:l,state:i,relative:c}),[y,v,c,l,i]),null}function Qy(r){return Iy(r.context)}function it(r){ct(!1)}function Yy(r){let{basename:a="/",children:l=null,location:i,navigationType:c=hr.Pop,navigator:u,static:f=!1,future:m}=r;Is()&&ct(!1);let x=a.replace(/^\/*/,"/"),y=p.useMemo(()=>({basename:x,navigator:u,static:f,future:Ia({v7_relativeSplatPath:!1},m)}),[x,m,u,f]);typeof i=="string"&&(i=Ts(i));let{pathname:g="/",search:v="",hash:E="",state:P=null,key:C="default"}=i,j=p.useMemo(()=>{let N=Cd(g,x);return N==null?null:{location:{pathname:N,search:v,hash:E,state:P,key:C},navigationType:c}},[x,g,v,E,P,C,c]);return j==null?null:p.createElement(yr.Provider,{value:y},p.createElement(So.Provider,{children:l,value:j}))}function qy(r){let{children:a,location:l}=r;return Ay(Zc(a),l)}new Promise(()=>{});function Zc(r,a){a===void 0&&(a=[]);let l=[];return p.Children.forEach(r,(i,c)=>{if(!p.isValidElement(i))return;let u=[...a,c];if(i.type===p.Fragment){l.push.apply(l,Zc(i.props.children,u));return}i.type!==it&&ct(!1),!i.props.index||!i.props.children||ct(!1);let f={id:i.props.id||u.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(f.children=Zc(i.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 ed(){return ed=Object.assign?Object.assign.bind():function(r){for(var a=1;a=0)&&(l[c]=r[c]);return l}function Jy(r){return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}function Zy(r,a){return r.button===0&&(!a||a==="_self")&&!Jy(r)}const ew=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],tw="6";try{window.__reactRouterVersion=tw}catch{}const nw="startTransition",rm=No[nw];function rw(r){let{basename:a,children:l,future:i,window:c}=r,u=p.useRef();u.current==null&&(u.current=ty({window:c,v5Compat:!0}));let f=u.current,[m,x]=p.useState({action:f.action,location:f.location}),{v7_startTransition:y}=i||{},g=p.useCallback(v=>{y&&rm?rm(()=>x(v)):x(v)},[x,y]);return p.useLayoutEffect(()=>f.listen(g),[f,g]),p.useEffect(()=>Ky(i),[i]),p.createElement(Yy,{basename:a,children:l,location:m.location,navigationType:m.action,navigator:f,future:i})}const sw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",aw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,op=p.forwardRef(function(a,l){let{onClick:i,relative:c,reloadDocument:u,replace:f,state:m,target:x,to:y,preventScrollReset:g,viewTransition:v}=a,E=Xy(a,ew),{basename:P}=p.useContext(yr),C,j=!1;if(typeof y=="string"&&aw.test(y)&&(C=y,sw))try{let b=new URL(window.location.href),T=y.startsWith("//")?new URL(b.protocol+y):new URL(y),B=Cd(T.pathname,P);T.origin===b.origin&&B!=null?y=B+T.search+T.hash:j=!0}catch{}let N=Ry(y,{relative:c}),k=lw(y,{replace:f,state:m,target:x,preventScrollReset:g,relative:c,viewTransition:v});function R(b){i&&i(b),b.defaultPrevented||k(b)}return p.createElement("a",ed({},E,{href:C||N,onClick:j||u?i:R,ref:l,target:x}))});var sm;(function(r){r.UseScrollRestoration="useScrollRestoration",r.UseSubmit="useSubmit",r.UseSubmitFetcher="useSubmitFetcher",r.UseFetcher="useFetcher",r.useViewTransitionState="useViewTransitionState"})(sm||(sm={}));var am;(function(r){r.UseFetcher="useFetcher",r.UseFetchers="useFetchers",r.UseScrollRestoration="useScrollRestoration"})(am||(am={}));function lw(r,a){let{target:l,replace:i,state:c,preventScrollReset:u,relative:f,viewTransition:m}=a===void 0?{}:a,x=Oa(),y=Yr(),g=rp(r,{relative:f});return p.useCallback(v=>{if(Zy(v,l)){v.preventDefault();let E=i!==void 0?i:co(y)===co(g);x(r,{replace:E,state:c,preventScrollReset:u,relative:f,viewTransition:m})}},[y,x,g,i,c,l,r,u,f,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 ow=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),iw=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,l,i)=>i?i.toUpperCase():l.toLowerCase()),lm=r=>{const a=iw(r);return a.charAt(0).toUpperCase()+a.slice(1)},ip=(...r)=>r.filter((a,l,i)=>!!a&&a.trim()!==""&&i.indexOf(a)===l).join(" ").trim(),cw=r=>{for(const a in r)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 dw={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 uw=p.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:i,className:c="",children:u,iconNode:f,...m},x)=>p.createElement("svg",{ref:x,...dw,width:a,height:a,stroke:r,strokeWidth:i?Number(l)*24/Number(a):l,className:ip("lucide",c),...!u&&!cw(m)&&{"aria-hidden":"true"},...m},[...f.map(([y,g])=>p.createElement(y,g)),...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 je=(r,a)=>{const l=p.forwardRef(({className:i,...c},u)=>p.createElement(uw,{ref:u,iconNode:a,className:ip(`lucide-${ow(lm(r))}`,`lucide-${r}`,i),...c}));return l.displayName=lm(r),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 fw=[["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"}]],om=je("bitcoin",fw);/** - * @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 hw=[["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"}]],Ps=je("book-open",hw);/** - * @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 mw=[["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"}]],td=je("calendar",mw);/** - * @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 pw=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Co=je("check",pw);/** - * @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 xw=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],cp=je("chevron-down",xw);/** - * @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 gw=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],dp=je("chevron-right",gw);/** - * @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 vw=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],yw=je("chevron-up",vw);/** - * @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 ww=[["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"}]],jw=je("circle-alert",ww);/** - * @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 bw=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],nd=je("circle-check-big",bw);/** - * @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 Nw=[["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"}]],up=je("circle-question-mark",Nw);/** - * @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 Sw=[["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"}]],im=je("circle-user",Sw);/** - * @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 Cw=[["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"}]],kw=je("circle-x",Cw);/** - * @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 Ew=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],fp=je("clock",Ew);/** - * @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 Pw=[["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"}]],hp=je("copy",Pw);/** - * @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 Rw=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],rd=je("credit-card",Rw);/** - * @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 _w=[["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"}]],ko=je("crown",_w);/** - * @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 Tw=[["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"}]],uo=je("dollar-sign",Tw);/** - * @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 Iw=[["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"}]],Aw=je("download",Iw);/** - * @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 Mw=[["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"}]],fo=je("external-link",Mw);/** - * @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 Lw=[["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"}]],Rd=je("eye",Lw);/** - * @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 Ow=[["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"}]],Dw=je("file-text",Ow);/** - * @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 Fw=[["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"}]],zw=je("funnel",Fw);/** - * @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 $w=[["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"}]],cm=je("gift",$w);/** - * @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 Bw=[["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"}]],Vw=je("git-merge",Bw);/** - * @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 Uw=[["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"}]],sd=je("globe",Uw);/** - * @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 Ww=[["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"}]],dm=je("history",Ww);/** - * @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 Hw=[["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"}]],Kw=je("house",Hw);/** - * @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 Gw=[["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"}]],Qw=je("image",Gw);/** - * @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 Yw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Ql=je("info",Yw);/** - * @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 qw=[["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"}]],um=je("key",qw);/** - * @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 Xw=[["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"}]],Jw=je("layout-dashboard",Xw);/** - * @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 Zw=[["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"}]],zr=je("link-2",Zw);/** - * @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:"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"}]],fm=je("link",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 tj=[["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"}]],nj=je("lock",tj);/** - * @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=[["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"}]],sj=je("log-out",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 aj=[["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"}]],lj=je("map-pin",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 oj=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],ij=je("menu",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 cj=[["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"}]],dj=je("message-circle",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 uj=[["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"}]],fj=je("palette",uj);/** - * @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:"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"}]],Ur=je("pen-line",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 mj=[["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"}]],pj=je("percent",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 xj=[["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"}]],gj=je("phone",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 vj=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],$r=je("plus",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 yj=[["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"}]],hm=je("qr-code",yj);/** - * @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:"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"}]],st=je("refresh-cw",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 jj=[["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"}]],pn=je("save",jj);/** - * @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:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Br=je("search",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 Nj=[["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"}]],ho=je("settings",Nj);/** - * @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:"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"}]],Cj=je("settings-2",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 kj=[["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"}]],Ej=je("shield-check",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 Pj=[["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"}]],ad=je("shopping-bag",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=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],ld=je("smartphone",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:"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"}]],Tj=je("tag",_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=[["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"}]],Eo=je("trash-2",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=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],od=je("trending-up",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=[["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"}]],mp=je("undo-2",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 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"}]],mm=je("upload",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=[["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"}]],pm=je("user-plus",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 Dj=[["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"}]],ro=je("user",Dj);/** - * @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=[["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"}]],En=je("users",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:"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"}]],Rs=je("wallet",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=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],zn=je("x",$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:"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"}]],Vj=je("zap",Bj),_d="admin_token";function Uj(){try{return localStorage.getItem(_d)}catch{return null}}function Wj(r){try{localStorage.setItem(_d,r)}catch{}}function Hj(){try{localStorage.removeItem(_d)}catch{}}const Kj="https://soulapi.quwanzhi.com",Gj=()=>{const r="https://soulapi.quwanzhi.com";return r.length>0?r.replace(/\/$/,""):Kj};function pp(r){const a=Gj(),l=r.startsWith("/")?r:`/${r}`;return a?`${a}${l}`:l}async function Po(r,a={}){const{data:l,...i}=a,c=pp(r),u=new Headers(i.headers),f=Uj();f&&u.set("Authorization",`Bearer ${f}`),l!=null&&!u.has("Content-Type")&&u.set("Content-Type","application/json");const m=l!=null?JSON.stringify(l):i.body,x=await fetch(c,{...i,headers:u,body:m,credentials:"include"}),g=(x.headers.get("Content-Type")||"").includes("application/json")?await x.json():x;if(!x.ok){const v=new Error((g==null?void 0:g.error)||`HTTP ${x.status}`);throw v.status=x.status,v.data=g,v}return g}function He(r,a){return Po(r,{...a,method:"GET"})}function bt(r,a,l){return Po(r,{...l,method:"POST",data:a})}function Wt(r,a,l){return Po(r,{...l,method:"PUT",data:a})}function Td(r,a){return Po(r,{...a,method:"DELETE"})}const Qj=[{icon:Jw,label:"数据概览",href:"/dashboard"},{icon:Ps,label:"内容管理",href:"/content"},{icon:En,label:"用户管理",href:"/users"},{icon:ko,label:"VIP 角色",href:"/vip-roles"},{icon:Rs,label:"交易中心",href:"/distribution"},{icon:Vw,label:"匹配记录",href:"/match-records"},{icon:rd,label:"推广设置",href:"/referral-settings"},{icon:ho,label:"系统设置",href:"/settings"}];function Yj(){const r=Yr(),a=Oa(),[l,i]=p.useState(!1),[c,u]=p.useState(!1);p.useEffect(()=>{i(!0)},[]),p.useEffect(()=>{if(!l)return;u(!1);let m=!1;return He("/api/admin").then(x=>{m||(x&&x.success!==!1?u(!0):a("/login",{replace:!0}))}).catch(()=>{m||a("/login",{replace:!0})}),()=>{m=!0}},[l,a]);const f=async()=>{Hj();try{await bt("/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.jsx("nav",{className:"flex-1 p-4 space-y-1",children:Qj.map(m=>{const x=r.pathname===m.href;return t.jsxs(op,{to:m.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${x?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[t.jsx(m.icon,{className:"w-5 h-5"}),t.jsx("span",{className:"text-sm",children:m.label})]},m.href)})}),t.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:t.jsxs("button",{type:"button",onClick:f,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(sj,{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(Qy,{})})})]})}function xm(r,a){if(typeof r=="function")return r(a);r!=null&&(r.current=a)}function Id(...r){return a=>{let l=!1;const i=r.map(c=>{const u=xm(c,a);return!l&&typeof u=="function"&&(l=!0),u});if(l)return()=>{for(let c=0;c{let{children:u,...f}=i;xp(u)&&typeof mo=="function"&&(u=mo(u._payload));const m=p.Children.toArray(u),x=m.find(e1);if(x){const y=x.props.children,g=m.map(v=>v===x?p.Children.count(y)>1?p.Children.only(null):p.isValidElement(y)?y.props.children:null:v);return t.jsx(a,{...f,ref:c,children:p.isValidElement(y)?p.cloneElement(y,void 0,g):null})}return t.jsx(a,{...f,ref:c,children:u})});return l.displayName=`${r}.Slot`,l}var vp=gp("Slot");function Jj(r){const a=p.forwardRef((l,i)=>{let{children:c,...u}=l;if(xp(c)&&typeof mo=="function"&&(c=mo(c._payload)),p.isValidElement(c)){const f=n1(c),m=t1(u,c.props);return c.type!==p.Fragment&&(m.ref=i?Id(i,f):f),p.cloneElement(c,m)}return p.Children.count(c)>1?p.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var Zj=Symbol("radix.slottable");function e1(r){return p.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===Zj}function t1(r,a){const l={...a};for(const i in a){const c=r[i],u=a[i];/^on[A-Z]/.test(i)?c&&u?l[i]=(...m)=>{const x=u(...m);return c(...m),x}:c&&(l[i]=c):i==="style"?l[i]={...c,...u}:i==="className"&&(l[i]=[c,u].filter(Boolean).join(" "))}return{...r,...l}}function n1(r){var i,c;let a=(i=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:i.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?r.ref:(a=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?r.props.ref:r.props.ref||r.ref)}function yp(r){var a,l,i="";if(typeof r=="string"||typeof r=="number")i+=r;else if(typeof r=="object")if(Array.isArray(r)){var c=r.length;for(a=0;atypeof r=="boolean"?`${r}`:r===0?"0":r,vm=wp,jp=(r,a)=>l=>{var i;if((a==null?void 0:a.variants)==null)return vm(r,l==null?void 0:l.class,l==null?void 0:l.className);const{variants:c,defaultVariants:u}=a,f=Object.keys(c).map(y=>{const g=l==null?void 0:l[y],v=u==null?void 0:u[y];if(g===null)return null;const E=gm(g)||gm(v);return c[y][E]}),m=l&&Object.entries(l).reduce((y,g)=>{let[v,E]=g;return E===void 0||(y[v]=E),y},{}),x=a==null||(i=a.compoundVariants)===null||i===void 0?void 0:i.reduce((y,g)=>{let{class:v,className:E,...P}=g;return Object.entries(P).every(C=>{let[j,N]=C;return Array.isArray(N)?N.includes({...u,...m}[j]):{...u,...m}[j]===N})?[...y,v,E]:y},[]);return vm(r,f,x,l==null?void 0:l.class,l==null?void 0:l.className)},r1=(r,a)=>{const l=new Array(r.length+a.length);for(let i=0;i({classGroupId:r,validator:a}),bp=(r=new Map,a=null,l)=>({nextPart:r,validators:a,classGroupId:l}),po="-",ym=[],a1="arbitrary..",l1=r=>{const a=i1(r),{conflictingClassGroups:l,conflictingClassGroupModifiers:i}=r;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return o1(f);const m=f.split(po),x=m[0]===""&&m.length>1?1:0;return Np(m,x,a)},getConflictingClassGroupIds:(f,m)=>{if(m){const x=i[f],y=l[f];return x?y?r1(y,x):x:y||ym}return l[f]||ym}}},Np=(r,a,l)=>{if(r.length-a===0)return l.classGroupId;const c=r[a],u=l.nextPart.get(c);if(u){const y=Np(r,a+1,u);if(y)return y}const f=l.validators;if(f===null)return;const m=a===0?r.join(po):r.slice(a).join(po),x=f.length;for(let y=0;yr.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=r.slice(1,-1),l=a.indexOf(":"),i=a.slice(0,l);return i?a1+i:void 0})(),i1=r=>{const{theme:a,classGroups:l}=r;return c1(l,a)},c1=(r,a)=>{const l=bp();for(const i in r){const c=r[i];Ad(c,l,i,a)}return l},Ad=(r,a,l,i)=>{const c=r.length;for(let u=0;u{if(typeof r=="string"){u1(r,a,l);return}if(typeof r=="function"){f1(r,a,l,i);return}h1(r,a,l,i)},u1=(r,a,l)=>{const i=r===""?a:Sp(a,r);i.classGroupId=l},f1=(r,a,l,i)=>{if(m1(r)){Ad(r(i),a,l,i);return}a.validators===null&&(a.validators=[]),a.validators.push(s1(l,r))},h1=(r,a,l,i)=>{const c=Object.entries(r),u=c.length;for(let f=0;f{let l=r;const i=a.split(po),c=i.length;for(let u=0;u"isThemeGetter"in r&&r.isThemeGetter===!0,p1=r=>{if(r<1)return{get:()=>{},set:()=>{}};let a=0,l=Object.create(null),i=Object.create(null);const c=(u,f)=>{l[u]=f,a++,a>r&&(a=0,i=l,l=Object.create(null))};return{get(u){let f=l[u];if(f!==void 0)return f;if((f=i[u])!==void 0)return c(u,f),f},set(u,f){u in l?l[u]=f:c(u,f)}}},id="!",wm=":",x1=[],jm=(r,a,l,i,c)=>({modifiers:r,hasImportantModifier:a,baseClassName:l,maybePostfixModifierPosition:i,isExternal:c}),g1=r=>{const{prefix:a,experimentalParseClassName:l}=r;let i=c=>{const u=[];let f=0,m=0,x=0,y;const g=c.length;for(let j=0;jx?y-x:void 0;return jm(u,P,E,C)};if(a){const c=a+wm,u=i;i=f=>f.startsWith(c)?u(f.slice(c.length)):jm(x1,!1,f,void 0,!0)}if(l){const c=i;i=u=>l({className:u,parseClassName:c})}return i},v1=r=>{const a=new Map;return r.orderSensitiveModifiers.forEach((l,i)=>{a.set(l,1e6+i)}),l=>{const i=[];let c=[];for(let u=0;u0&&(c.sort(),i.push(...c),c=[]),i.push(f)):c.push(f)}return c.length>0&&(c.sort(),i.push(...c)),i}},y1=r=>({cache:p1(r.cacheSize),parseClassName:g1(r),sortModifiers:v1(r),...l1(r)}),w1=/\s+/,j1=(r,a)=>{const{parseClassName:l,getClassGroupId:i,getConflictingClassGroupIds:c,sortModifiers:u}=a,f=[],m=r.trim().split(w1);let x="";for(let y=m.length-1;y>=0;y-=1){const g=m[y],{isExternal:v,modifiers:E,hasImportantModifier:P,baseClassName:C,maybePostfixModifierPosition:j}=l(g);if(v){x=g+(x.length>0?" "+x:x);continue}let N=!!j,k=i(N?C.substring(0,j):C);if(!k){if(!N){x=g+(x.length>0?" "+x:x);continue}if(k=i(C),!k){x=g+(x.length>0?" "+x:x);continue}N=!1}const R=E.length===0?"":E.length===1?E[0]:u(E).join(":"),b=P?R+id:R,T=b+k;if(f.indexOf(T)>-1)continue;f.push(T);const B=c(k,N);for(let G=0;G0?" "+x:x)}return x},b1=(...r)=>{let a=0,l,i,c="";for(;a{if(typeof r=="string")return r;let a,l="";for(let i=0;i{let l,i,c,u;const f=x=>{const y=a.reduce((g,v)=>v(g),r());return l=y1(y),i=l.cache.get,c=l.cache.set,u=m,m(x)},m=x=>{const y=i(x);if(y)return y;const g=j1(x,l);return c(x,g),g};return u=f,(...x)=>u(b1(...x))},S1=[],pt=r=>{const a=l=>l[r]||S1;return a.isThemeGetter=!0,a},kp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ep=/^\((?:(\w[\w-]*):)?(.+)\)$/i,C1=/^\d+\/\d+$/,k1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,E1=/\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$/,P1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,R1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,js=r=>C1.test(r),Ae=r=>!!r&&!Number.isNaN(Number(r)),cr=r=>!!r&&Number.isInteger(Number(r)),Dc=r=>r.endsWith("%")&&Ae(r.slice(0,-1)),Fn=r=>k1.test(r),T1=()=>!0,I1=r=>E1.test(r)&&!P1.test(r),Pp=()=>!1,A1=r=>R1.test(r),M1=r=>_1.test(r),L1=r=>!ye(r)&&!we(r),O1=r=>As(r,Tp,Pp),ye=r=>kp.test(r),Fr=r=>As(r,Ip,I1),Fc=r=>As(r,B1,Ae),bm=r=>As(r,Rp,Pp),D1=r=>As(r,_p,M1),Yl=r=>As(r,Ap,A1),we=r=>Ep.test(r),Ra=r=>Ms(r,Ip),F1=r=>Ms(r,V1),Nm=r=>Ms(r,Rp),z1=r=>Ms(r,Tp),$1=r=>Ms(r,_p),ql=r=>Ms(r,Ap,!0),As=(r,a,l)=>{const i=kp.exec(r);return i?i[1]?a(i[1]):l(i[2]):!1},Ms=(r,a,l=!1)=>{const i=Ep.exec(r);return i?i[1]?a(i[1]):l:!1},Rp=r=>r==="position"||r==="percentage",_p=r=>r==="image"||r==="url",Tp=r=>r==="length"||r==="size"||r==="bg-size",Ip=r=>r==="length",B1=r=>r==="number",V1=r=>r==="family-name",Ap=r=>r==="shadow",U1=()=>{const r=pt("color"),a=pt("font"),l=pt("text"),i=pt("font-weight"),c=pt("tracking"),u=pt("leading"),f=pt("breakpoint"),m=pt("container"),x=pt("spacing"),y=pt("radius"),g=pt("shadow"),v=pt("inset-shadow"),E=pt("text-shadow"),P=pt("drop-shadow"),C=pt("blur"),j=pt("perspective"),N=pt("aspect"),k=pt("ease"),R=pt("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],B=()=>[...T(),we,ye],G=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],V=()=>[we,ye,x],ee=()=>[js,"full","auto",...V()],de=()=>[cr,"none","subgrid",we,ye],ce=()=>["auto",{span:["full",cr,we,ye]},cr,we,ye],le=()=>[cr,"auto",we,ye],ue=()=>["auto","min","max","fr",we,ye],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...V()],K=()=>[js,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],A=()=>[r,we,ye],X=()=>[...T(),Nm,bm,{position:[we,ye]}],$=()=>["no-repeat",{repeat:["","x","y","space","round"]}],S=()=>["auto","cover","contain",z1,O1,{size:[we,ye]}],O=()=>[Dc,Ra,Fr],se=()=>["","none","full",y,we,ye],oe=()=>["",Ae,Ra,Fr],be=()=>["solid","dashed","dotted","double"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>[Ae,Dc,Nm,bm],xe=()=>["","none",C,we,ye],I=()=>["none",Ae,we,ye],re=()=>["none",Ae,we,ye],fe=()=>[Ae,we,ye],Ee=()=>[js,"full",...V()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fn],breakpoint:[Fn],color:[T1],container:[Fn],"drop-shadow":[Fn],ease:["in","out","in-out"],font:[L1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fn],shadow:[Fn],spacing:["px",Ae],text:[Fn],"text-shadow":[Fn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",js,ye,we,N]}],container:["container"],columns:[{columns:[Ae,ye,we,m]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ee()}],"inset-x":[{"inset-x":ee()}],"inset-y":[{"inset-y":ee()}],start:[{start:ee()}],end:[{end:ee()}],top:[{top:ee()}],right:[{right:ee()}],bottom:[{bottom:ee()}],left:[{left:ee()}],visibility:["visible","invisible","collapse"],z:[{z:[cr,"auto",we,ye]}],basis:[{basis:[js,"full","auto",m,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ae,js,"auto","initial","none",ye]}],grow:[{grow:["",Ae,we,ye]}],shrink:[{shrink:["",Ae,we,ye]}],order:[{order:[cr,"first","last","none",we,ye]}],"grid-cols":[{"grid-cols":de()}],"col-start-end":[{col:ce()}],"col-start":[{"col-start":le()}],"col-end":[{"col-end":le()}],"grid-rows":[{"grid-rows":de()}],"row-start-end":[{row:ce()}],"row-start":[{"row-start":le()}],"row-end":[{"row-end":le()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ue()}],"auto-rows":[{"auto-rows":ue()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[m,"screen",...K()]}],"min-w":[{"min-w":[m,"screen","none",...K()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[f]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",l,Ra,Fr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,we,Fc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Dc,ye]}],"font-family":[{font:[F1,ye,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,we,ye]}],"line-clamp":[{"line-clamp":[Ae,"none",we,Fc]}],leading:[{leading:[u,...V()]}],"list-image":[{"list-image":["none",we,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...be(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ae,"from-font","auto",we,Fr]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[Ae,"auto",we,ye]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,ye]}],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",we,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:$()}],"bg-size":[{bg:S()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},cr,we,ye],radial:["",we,ye],conic:[cr,we,ye]},$1,D1]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:O()}],"gradient-via-pos":[{via:O()}],"gradient-to-pos":[{to:O()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...be(),"hidden","none"]}],"divide-style":[{divide:[...be(),"hidden","none"]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:[...be(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ae,we,ye]}],"outline-w":[{outline:["",Ae,Ra,Fr]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",g,ql,Yl]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",v,ql,Yl]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[Ae,Fr]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",E,ql,Yl]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[Ae,we,ye]}],"mix-blend":[{"mix-blend":[...me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":me()}],"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":[Ae]}],"mask-image-linear-from-pos":[{"mask-linear-from":Y()}],"mask-image-linear-to-pos":[{"mask-linear-to":Y()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":Y()}],"mask-image-t-to-pos":[{"mask-t-to":Y()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":Y()}],"mask-image-r-to-pos":[{"mask-r-to":Y()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":Y()}],"mask-image-b-to-pos":[{"mask-b-to":Y()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":Y()}],"mask-image-l-to-pos":[{"mask-l-to":Y()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":Y()}],"mask-image-x-to-pos":[{"mask-x-to":Y()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":Y()}],"mask-image-y-to-pos":[{"mask-y-to":Y()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[we,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":Y()}],"mask-image-radial-to-pos":[{"mask-radial-to":Y()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"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":T()}],"mask-image-conic-pos":[{"mask-conic":[Ae]}],"mask-image-conic-from-pos":[{"mask-conic-from":Y()}],"mask-image-conic-to-pos":[{"mask-conic-to":Y()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:$()}],"mask-size":[{mask:S()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,ye]}],filter:[{filter:["","none",we,ye]}],blur:[{blur:xe()}],brightness:[{brightness:[Ae,we,ye]}],contrast:[{contrast:[Ae,we,ye]}],"drop-shadow":[{"drop-shadow":["","none",P,ql,Yl]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",Ae,we,ye]}],"hue-rotate":[{"hue-rotate":[Ae,we,ye]}],invert:[{invert:["",Ae,we,ye]}],saturate:[{saturate:[Ae,we,ye]}],sepia:[{sepia:["",Ae,we,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",we,ye]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[Ae,we,ye]}],"backdrop-contrast":[{"backdrop-contrast":[Ae,we,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ae,we,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ae,we,ye]}],"backdrop-invert":[{"backdrop-invert":["",Ae,we,ye]}],"backdrop-opacity":[{"backdrop-opacity":[Ae,we,ye]}],"backdrop-saturate":[{"backdrop-saturate":[Ae,we,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",Ae,we,ye]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ae,"initial",we,ye]}],ease:[{ease:["linear","initial",k,we,ye]}],delay:[{delay:[Ae,we,ye]}],animate:[{animate:["none",R,we,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,we,ye]}],"perspective-origin":[{"perspective-origin":B()}],rotate:[{rotate:I()}],"rotate-x":[{"rotate-x":I()}],"rotate-y":[{"rotate-y":I()}],"rotate-z":[{"rotate-z":I()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[we,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:B()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ee()}],"translate-x":[{"translate-x":Ee()}],"translate-y":[{"translate-y":Ee()}],"translate-z":[{"translate-z":Ee()}],"translate-none":["translate-none"],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"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",we,ye]}],"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":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"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",we,ye]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[Ae,Ra,Fr,Fc]}],stroke:[{stroke:["none",...A()]}],"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"]}},W1=N1(U1);function Ge(...r){return W1(wp(r))}const H1=jp("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 he({className:r,variant:a,size:l,asChild:i=!1,...c}){const u=i?vp:"button";return t.jsx(u,{"data-slot":"button",className:Ge(H1({variant:a,size:l,className:r})),...c})}function ie({className:r,type:a,...l}){return t.jsx("input",{type:a,"data-slot":"input",className:Ge("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",r),...l})}function K1(){const r=Oa(),[a,l]=p.useState(""),[i,c]=p.useState(""),[u,f]=p.useState(""),[m,x]=p.useState(!1),y=async()=>{f(""),x(!0);try{const g=await bt("/api/admin",{username:a.trim(),password:i});if((g==null?void 0:g.success)!==!1&&(g!=null&&g.token)){Wj(g.token),r("/dashboard",{replace:!0});return}f(g.error||"用户名或密码错误")}catch(g){const v=g;f(v.status===401?"用户名或密码错误":(v==null?void 0:v.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(Ej,{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(ro,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx(ie,{type:"text",value:a,onChange:g=>l(g.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(nj,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx(ie,{type:"password",value:i,onChange:g=>c(g.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:g=>g.key==="Enter"&&y()})]})]}),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(he,{onClick:y,disabled:m,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:m?"登录中...":"登录"})]})]}),t.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Ce=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("rounded-xl border bg-card text-card-foreground shadow",r),...a}));Ce.displayName="Card";const Be=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("flex flex-col space-y-1.5 p-6",r),...a}));Be.displayName="CardHeader";const Ve=p.forwardRef(({className:r,...a},l)=>t.jsx("h3",{ref:l,className:Ge("font-semibold leading-none tracking-tight",r),...a}));Ve.displayName="CardTitle";const ft=p.forwardRef(({className:r,...a},l)=>t.jsx("p",{ref:l,className:Ge("text-sm text-muted-foreground",r),...a}));ft.displayName="CardDescription";const ke=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("p-6 pt-0",r),...a}));ke.displayName="CardContent";const G1=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("flex items-center p-6 pt-0",r),...a}));G1.displayName="CardFooter";function Q1(){const r=Oa(),[a,l]=p.useState(!0),[i,c]=p.useState([]),[u,f]=p.useState([]);async function m(){l(!0);try{const[C,j]=await Promise.all([He("/api/db/users"),He("/api/orders")]);C!=null&&C.success&&C.users&&c(C.users),j!=null&&j.success&&j.orders&&f(j.orders)}catch(C){console.error("加载数据失败",C)}finally{l(!1)}}if(p.useEffect(()=>{m()},[]),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(st,{className:"w-12 h-12 text-[#38bdac] animate-spin mb-4"}),t.jsx("span",{className:"text-gray-400",children:"加载中..."})]})]});const y=u.filter(C=>C.status==="paid"||C.status==="completed"||C.status==="success").reduce((C,j)=>C+Number(j.amount||0),0),g=i.length,v=u.length,E=C=>{const j=C.productType||"",N=C.description||"";if(N){if(j==="section"&&N.includes("章节")){if(N.includes("-")){const k=N.split("-");if(k.length>=3)return{title:`第${k[1]}章 第${k[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:N,subtitle:"章节购买"}}return j==="fullbook"||N.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:j==="match"||N.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:N,subtitle:j==="section"?"单章":j==="fullbook"?"全书":"其他"}}return j==="section"?{title:`章节 ${C.productId||""}`,subtitle:"单章购买"}:j==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:j==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:j||"其他"}},P=[{title:"总用户数",value:g,icon:En,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:`¥${Number(y).toFixed(2)}`,icon:od,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:v,icon:ad,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:`${g>0?(v/g*100).toFixed(1):0}%`,icon:Ps,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:P.map((C,j)=>t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>C.link&&r(C.link),children:[t.jsxs(Be,{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(ke,{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(dp,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},j))}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"最近订单"})}),t.jsx(ke,{children:t.jsxs("div",{className:"space-y-3",children:[u.slice(-5).reverse().map(C=>{var b;const j=C.referrerId?i.find(T=>T.id===C.referrerId):void 0,N=C.referralCode||(j==null?void 0:j.referralCode)||(j==null?void 0:j.nickname)||(C.referrerId?String(C.referrerId).slice(0,8):""),k=E(C),R=C.userNickname||((b=i.find(T=>T.id===C.userId))==null?void 0:b.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:R,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:T=>{T.currentTarget.style.display="none";const B=T.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:R.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:R}),t.jsx("span",{className:"text-gray-600",children:"·"}),t.jsx("span",{className:"text-sm font-medium text-white truncate",children:k.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:k.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"})})]}),N&&t.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",N]})]})]}),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(ad,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),t.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"新注册用户"})}),t.jsx(ke,{children:t.jsxs("div",{className:"space-y-3",children:[i.slice(-5).reverse().map(C=>{var j;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:((j=C.nickname)==null?void 0:j.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)}),i.length===0&&t.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})]})]})]})}const Ls=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{className:"relative w-full overflow-auto",children:t.jsx("table",{ref:l,className:Ge("w-full caption-bottom text-sm",r),...a})}));Ls.displayName="Table";const Os=p.forwardRef(({className:r,...a},l)=>t.jsx("thead",{ref:l,className:Ge("[&_tr]:border-b",r),...a}));Os.displayName="TableHeader";const Ds=p.forwardRef(({className:r,...a},l)=>t.jsx("tbody",{ref:l,className:Ge("[&_tr:last-child]:border-0",r),...a}));Ds.displayName="TableBody";const _t=p.forwardRef(({className:r,...a},l)=>t.jsx("tr",{ref:l,className:Ge("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r),...a}));_t.displayName="TableRow";const $e=p.forwardRef(({className:r,...a},l)=>t.jsx("th",{ref:l,className:Ge("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",r),...a}));$e.displayName="TableHead";const Me=p.forwardRef(({className:r,...a},l)=>t.jsx("td",{ref:l,className:Ge("p-4 align-middle [&:has([role=checkbox])]:pr-0",r),...a}));Me.displayName="TableCell";const Y1=jp("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:r,variant:a,asChild:l=!1,...i}){const c=l?vp:"span";return t.jsx(c,{className:Ge(Y1({variant:a}),r),...i})}function Te(r,a,{checkForDefaultPrevented:l=!0}={}){return function(c){if(r==null||r(c),l===!1||!c.defaultPrevented)return a==null?void 0:a(c)}}function q1(r,a){const l=p.createContext(a),i=u=>{const{children:f,...m}=u,x=p.useMemo(()=>m,Object.values(m));return t.jsx(l.Provider,{value:x,children:f})};i.displayName=r+"Provider";function c(u){const f=p.useContext(l);if(f)return f;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${r}\``)}return[i,c]}function wr(r,a=[]){let l=[];function i(u,f){const m=p.createContext(f),x=l.length;l=[...l,f];const y=v=>{var k;const{scope:E,children:P,...C}=v,j=((k=E==null?void 0:E[r])==null?void 0:k[x])||m,N=p.useMemo(()=>C,Object.values(C));return t.jsx(j.Provider,{value:N,children:P})};y.displayName=u+"Provider";function g(v,E){var j;const P=((j=E==null?void 0:E[r])==null?void 0:j[x])||m,C=p.useContext(P);if(C)return C;if(f!==void 0)return f;throw new Error(`\`${v}\` must be used within \`${u}\``)}return[y,g]}const c=()=>{const u=l.map(f=>p.createContext(f));return function(m){const x=(m==null?void 0:m[r])||u;return p.useMemo(()=>({[`__scope${r}`]:{...m,[r]:x}}),[m,x])}};return c.scopeName=r,[i,X1(c,...a)]}function X1(...r){const a=r[0];if(r.length===1)return a;const l=()=>{const i=r.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(u){const f=i.reduce((m,{useScope:x,scopeName:y})=>{const v=x(u)[`__scope${y}`];return{...m,...v}},{});return p.useMemo(()=>({[`__scope${a.scopeName}`]:f}),[f])}};return l.scopeName=a.scopeName,l}var Et=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},J1=No[" useId ".trim().toString()]||(()=>{}),Z1=0;function pr(r){const[a,l]=p.useState(J1());return Et(()=>{l(i=>i??String(Z1++))},[r]),a?`radix-${a}`:""}var eb=No[" useInsertionEffect ".trim().toString()]||Et;function Wr({prop:r,defaultProp:a,onChange:l=()=>{},caller:i}){const[c,u,f]=tb({defaultProp:a,onChange:l}),m=r!==void 0,x=m?r:c;{const g=p.useRef(r!==void 0);p.useEffect(()=>{const v=g.current;v!==m&&console.warn(`${i} is changing from ${v?"controlled":"uncontrolled"} to ${m?"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.`),g.current=m},[m,i])}const y=p.useCallback(g=>{var v;if(m){const E=nb(g)?g(r):g;E!==r&&((v=f.current)==null||v.call(f,E))}else u(g)},[m,r,u,f]);return[x,y]}function tb({defaultProp:r,onChange:a}){const[l,i]=p.useState(r),c=p.useRef(l),u=p.useRef(a);return eb(()=>{u.current=a},[a]),p.useEffect(()=>{var f;c.current!==l&&((f=u.current)==null||f.call(u,l),c.current=l)},[l,c]),[l,i,u]}function nb(r){return typeof r=="function"}function Aa(r){const a=rb(r),l=p.forwardRef((i,c)=>{const{children:u,...f}=i,m=p.Children.toArray(u),x=m.find(ab);if(x){const y=x.props.children,g=m.map(v=>v===x?p.Children.count(y)>1?p.Children.only(null):p.isValidElement(y)?y.props.children:null:v);return t.jsx(a,{...f,ref:c,children:p.isValidElement(y)?p.cloneElement(y,void 0,g):null})}return t.jsx(a,{...f,ref:c,children:u})});return l.displayName=`${r}.Slot`,l}function rb(r){const a=p.forwardRef((l,i)=>{const{children:c,...u}=l;if(p.isValidElement(c)){const f=ob(c),m=lb(u,c.props);return c.type!==p.Fragment&&(m.ref=i?Id(i,f):f),p.cloneElement(c,m)}return p.Children.count(c)>1?p.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var sb=Symbol("radix.slottable");function ab(r){return p.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===sb}function lb(r,a){const l={...a};for(const i in a){const c=r[i],u=a[i];/^on[A-Z]/.test(i)?c&&u?l[i]=(...m)=>{const x=u(...m);return c(...m),x}:c&&(l[i]=c):i==="style"?l[i]={...c,...u}:i==="className"&&(l[i]=[c,u].filter(Boolean).join(" "))}return{...r,...l}}function ob(r){var i,c;let a=(i=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:i.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?r.ref:(a=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?r.props.ref:r.props.ref||r.ref)}var ib=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oe=ib.reduce((r,a)=>{const l=Aa(`Primitive.${a}`),i=p.forwardRef((c,u)=>{const{asChild:f,...m}=c,x=f?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(x,{...m,ref:u})});return i.displayName=`Primitive.${a}`,{...r,[a]:i}},{});function cb(r,a){r&&La.flushSync(()=>r.dispatchEvent(a))}function xr(r){const a=p.useRef(r);return p.useEffect(()=>{a.current=r}),p.useMemo(()=>(...l)=>{var i;return(i=a.current)==null?void 0:i.call(a,...l)},[])}function db(r,a=globalThis==null?void 0:globalThis.document){const l=xr(r);p.useEffect(()=>{const i=c=>{c.key==="Escape"&&l(c)};return a.addEventListener("keydown",i,{capture:!0}),()=>a.removeEventListener("keydown",i,{capture:!0})},[l,a])}var ub="DismissableLayer",cd="dismissableLayer.update",fb="dismissableLayer.pointerDownOutside",hb="dismissableLayer.focusOutside",Sm,Mp=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Md=p.forwardRef((r,a)=>{const{disableOutsidePointerEvents:l=!1,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:f,onDismiss:m,...x}=r,y=p.useContext(Mp),[g,v]=p.useState(null),E=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,P]=p.useState({}),C=Ke(a,M=>v(M)),j=Array.from(y.layers),[N]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(N),R=g?j.indexOf(g):-1,b=y.layersWithOutsidePointerEventsDisabled.size>0,T=R>=k,B=xb(M=>{const V=M.target,ee=[...y.branches].some(de=>de.contains(V));!T||ee||(c==null||c(M),f==null||f(M),M.defaultPrevented||m==null||m())},E),G=gb(M=>{const V=M.target;[...y.branches].some(de=>de.contains(V))||(u==null||u(M),f==null||f(M),M.defaultPrevented||m==null||m())},E);return db(M=>{R===y.layers.size-1&&(i==null||i(M),!M.defaultPrevented&&m&&(M.preventDefault(),m()))},E),p.useEffect(()=>{if(g)return l&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(Sm=E.body.style.pointerEvents,E.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(g)),y.layers.add(g),Cm(),()=>{l&&y.layersWithOutsidePointerEventsDisabled.size===1&&(E.body.style.pointerEvents=Sm)}},[g,E,l,y]),p.useEffect(()=>()=>{g&&(y.layers.delete(g),y.layersWithOutsidePointerEventsDisabled.delete(g),Cm())},[g,y]),p.useEffect(()=>{const M=()=>P({});return document.addEventListener(cd,M),()=>document.removeEventListener(cd,M)},[]),t.jsx(Oe.div,{...x,ref:C,style:{pointerEvents:b?T?"auto":"none":void 0,...r.style},onFocusCapture:Te(r.onFocusCapture,G.onFocusCapture),onBlurCapture:Te(r.onBlurCapture,G.onBlurCapture),onPointerDownCapture:Te(r.onPointerDownCapture,B.onPointerDownCapture)})});Md.displayName=ub;var mb="DismissableLayerBranch",pb=p.forwardRef((r,a)=>{const l=p.useContext(Mp),i=p.useRef(null),c=Ke(a,i);return p.useEffect(()=>{const u=i.current;if(u)return l.branches.add(u),()=>{l.branches.delete(u)}},[l.branches]),t.jsx(Oe.div,{...r,ref:c})});pb.displayName=mb;function xb(r,a=globalThis==null?void 0:globalThis.document){const l=xr(r),i=p.useRef(!1),c=p.useRef(()=>{});return p.useEffect(()=>{const u=m=>{if(m.target&&!i.current){let x=function(){Lp(fb,l,y,{discrete:!0})};const y={originalEvent:m};m.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=x,a.addEventListener("click",c.current,{once:!0})):x()}else a.removeEventListener("click",c.current);i.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:()=>i.current=!0}}function gb(r,a=globalThis==null?void 0:globalThis.document){const l=xr(r),i=p.useRef(!1);return p.useEffect(()=>{const c=u=>{u.target&&!i.current&&Lp(hb,l,{originalEvent:u},{discrete:!1})};return a.addEventListener("focusin",c),()=>a.removeEventListener("focusin",c)},[a,l]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function Cm(){const r=new CustomEvent(cd);document.dispatchEvent(r)}function Lp(r,a,l,{discrete:i}){const c=l.originalEvent.target,u=new CustomEvent(r,{bubbles:!1,cancelable:!0,detail:l});a&&c.addEventListener(r,a,{once:!0}),i?cb(c,u):c.dispatchEvent(u)}var zc="focusScope.autoFocusOnMount",$c="focusScope.autoFocusOnUnmount",km={bubbles:!1,cancelable:!0},vb="FocusScope",Ld=p.forwardRef((r,a)=>{const{loop:l=!1,trapped:i=!1,onMountAutoFocus:c,onUnmountAutoFocus:u,...f}=r,[m,x]=p.useState(null),y=xr(c),g=xr(u),v=p.useRef(null),E=Ke(a,j=>x(j)),P=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(i){let j=function(b){if(P.paused||!m)return;const T=b.target;m.contains(T)?v.current=T:ur(v.current,{select:!0})},N=function(b){if(P.paused||!m)return;const T=b.relatedTarget;T!==null&&(m.contains(T)||ur(v.current,{select:!0}))},k=function(b){if(document.activeElement===document.body)for(const B of b)B.removedNodes.length>0&&ur(m)};document.addEventListener("focusin",j),document.addEventListener("focusout",N);const R=new MutationObserver(k);return m&&R.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",N),R.disconnect()}}},[i,m,P.paused]),p.useEffect(()=>{if(m){Pm.add(P);const j=document.activeElement;if(!m.contains(j)){const k=new CustomEvent(zc,km);m.addEventListener(zc,y),m.dispatchEvent(k),k.defaultPrevented||(yb(Sb(Op(m)),{select:!0}),document.activeElement===j&&ur(m))}return()=>{m.removeEventListener(zc,y),setTimeout(()=>{const k=new CustomEvent($c,km);m.addEventListener($c,g),m.dispatchEvent(k),k.defaultPrevented||ur(j??document.body,{select:!0}),m.removeEventListener($c,g),Pm.remove(P)},0)}}},[m,y,g,P]);const C=p.useCallback(j=>{if(!l&&!i||P.paused)return;const N=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(N&&k){const R=j.currentTarget,[b,T]=wb(R);b&&T?!j.shiftKey&&k===T?(j.preventDefault(),l&&ur(b,{select:!0})):j.shiftKey&&k===b&&(j.preventDefault(),l&&ur(T,{select:!0})):k===R&&j.preventDefault()}},[l,i,P.paused]);return t.jsx(Oe.div,{tabIndex:-1,...f,ref:E,onKeyDown:C})});Ld.displayName=vb;function yb(r,{select:a=!1}={}){const l=document.activeElement;for(const i of r)if(ur(i,{select:a}),document.activeElement!==l)return}function wb(r){const a=Op(r),l=Em(a,r),i=Em(a.reverse(),r);return[l,i]}function Op(r){const a=[],l=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const c=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||c?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;l.nextNode();)a.push(l.currentNode);return a}function Em(r,a){for(const l of r)if(!jb(l,{upTo:a}))return l}function jb(r,{upTo:a}){if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(a!==void 0&&r===a)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1}function bb(r){return r instanceof HTMLInputElement&&"select"in r}function ur(r,{select:a=!1}={}){if(r&&r.focus){const l=document.activeElement;r.focus({preventScroll:!0}),r!==l&&bb(r)&&a&&r.select()}}var Pm=Nb();function Nb(){let r=[];return{add(a){const l=r[0];a!==l&&(l==null||l.pause()),r=Rm(r,a),r.unshift(a)},remove(a){var l;r=Rm(r,a),(l=r[0])==null||l.resume()}}}function Rm(r,a){const l=[...r],i=l.indexOf(a);return i!==-1&&l.splice(i,1),l}function Sb(r){return r.filter(a=>a.tagName!=="A")}var Cb="Portal",Od=p.forwardRef((r,a)=>{var m;const{container:l,...i}=r,[c,u]=p.useState(!1);Et(()=>u(!0),[]);const f=l||c&&((m=globalThis==null?void 0:globalThis.document)==null?void 0:m.body);return f?ey.createPortal(t.jsx(Oe.div,{...i,ref:a}),f):null});Od.displayName=Cb;function kb(r,a){return p.useReducer((l,i)=>a[l][i]??l,r)}var Da=r=>{const{present:a,children:l}=r,i=Eb(a),c=typeof l=="function"?l({present:i.isPresent}):p.Children.only(l),u=Ke(i.ref,Pb(c));return typeof l=="function"||i.isPresent?p.cloneElement(c,{ref:u}):null};Da.displayName="Presence";function Eb(r){const[a,l]=p.useState(),i=p.useRef(null),c=p.useRef(r),u=p.useRef("none"),f=r?"mounted":"unmounted",[m,x]=kb(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const y=Xl(i.current);u.current=m==="mounted"?y:"none"},[m]),Et(()=>{const y=i.current,g=c.current;if(g!==r){const E=u.current,P=Xl(y);r?x("MOUNT"):P==="none"||(y==null?void 0:y.display)==="none"?x("UNMOUNT"):x(g&&E!==P?"ANIMATION_OUT":"UNMOUNT"),c.current=r}},[r,x]),Et(()=>{if(a){let y;const g=a.ownerDocument.defaultView??window,v=P=>{const j=Xl(i.current).includes(CSS.escape(P.animationName));if(P.target===a&&j&&(x("ANIMATION_END"),!c.current)){const N=a.style.animationFillMode;a.style.animationFillMode="forwards",y=g.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=N)})}},E=P=>{P.target===a&&(u.current=Xl(i.current))};return a.addEventListener("animationstart",E),a.addEventListener("animationcancel",v),a.addEventListener("animationend",v),()=>{g.clearTimeout(y),a.removeEventListener("animationstart",E),a.removeEventListener("animationcancel",v),a.removeEventListener("animationend",v)}}else x("ANIMATION_END")},[a,x]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:p.useCallback(y=>{i.current=y?getComputedStyle(y):null,l(y)},[])}}function Xl(r){return(r==null?void 0:r.animationName)||"none"}function Pb(r){var i,c;let a=(i=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:i.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?r.ref:(a=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?r.props.ref:r.props.ref||r.ref)}var Bc=0;function Dp(){p.useEffect(()=>{const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",r[0]??_m()),document.body.insertAdjacentElement("beforeend",r[1]??_m()),Bc++,()=>{Bc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Bc--}},[])}function _m(){const r=document.createElement("span");return r.setAttribute("data-radix-focus-guard",""),r.tabIndex=0,r.style.outline="none",r.style.opacity="0",r.style.position="fixed",r.style.pointerEvents="none",r}var Sn=function(){return Sn=Object.assign||function(a){for(var l,i=1,c=arguments.length;i"u")return Hb;var a=Kb(r),l=document.documentElement.clientWidth,i=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,i-l+a[2]-a[0])}},Qb=Bp(),Cs="data-scroll-locked",Yb=function(r,a,l,i){var c=r.left,u=r.top,f=r.right,m=r.gap;return l===void 0&&(l="margin"),` - .`.concat(_b,` { - overflow: hidden `).concat(i,`; - padding-right: `).concat(m,"px ").concat(i,`; - } - body[`).concat(Cs,`] { - overflow: hidden `).concat(i,`; - overscroll-behavior: contain; - `).concat([a&&"position: relative ".concat(i,";"),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(m,"px ").concat(i,`; - `),l==="padding"&&"padding-right: ".concat(m,"px ").concat(i,";")].filter(Boolean).join(""),` - } - - .`).concat(so,` { - right: `).concat(m,"px ").concat(i,`; - } - - .`).concat(ao,` { - margin-right: `).concat(m,"px ").concat(i,`; - } - - .`).concat(so," .").concat(so,` { - right: 0 `).concat(i,`; - } - - .`).concat(ao," .").concat(ao,` { - margin-right: 0 `).concat(i,`; - } - - body[`).concat(Cs,`] { - `).concat(Tb,": ").concat(m,`px; - } -`)},Im=function(){var r=parseInt(document.body.getAttribute(Cs)||"0",10);return isFinite(r)?r:0},qb=function(){p.useEffect(function(){return document.body.setAttribute(Cs,(Im()+1).toString()),function(){var r=Im()-1;r<=0?document.body.removeAttribute(Cs):document.body.setAttribute(Cs,r.toString())}},[])},Xb=function(r){var a=r.noRelative,l=r.noImportant,i=r.gapMode,c=i===void 0?"margin":i;qb();var u=p.useMemo(function(){return Gb(c)},[c]);return p.createElement(Qb,{styles:Yb(u,!a,c,l?"":"!important")})},dd=!1;if(typeof window<"u")try{var Jl=Object.defineProperty({},"passive",{get:function(){return dd=!0,!0}});window.addEventListener("test",Jl,Jl),window.removeEventListener("test",Jl,Jl)}catch{dd=!1}var bs=dd?{passive:!1}:!1,Jb=function(r){return r.tagName==="TEXTAREA"},Vp=function(r,a){if(!(r instanceof Element))return!1;var l=window.getComputedStyle(r);return l[a]!=="hidden"&&!(l.overflowY===l.overflowX&&!Jb(r)&&l[a]==="visible")},Zb=function(r){return Vp(r,"overflowY")},eN=function(r){return Vp(r,"overflowX")},Am=function(r,a){var l=a.ownerDocument,i=a;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var c=Up(r,i);if(c){var u=Wp(r,i),f=u[1],m=u[2];if(f>m)return!0}i=i.parentNode}while(i&&i!==l.body);return!1},tN=function(r){var a=r.scrollTop,l=r.scrollHeight,i=r.clientHeight;return[a,l,i]},nN=function(r){var a=r.scrollLeft,l=r.scrollWidth,i=r.clientWidth;return[a,l,i]},Up=function(r,a){return r==="v"?Zb(a):eN(a)},Wp=function(r,a){return r==="v"?tN(a):nN(a)},rN=function(r,a){return r==="h"&&a==="rtl"?-1:1},sN=function(r,a,l,i,c){var u=rN(r,window.getComputedStyle(a).direction),f=u*i,m=l.target,x=a.contains(m),y=!1,g=f>0,v=0,E=0;do{if(!m)break;var P=Wp(r,m),C=P[0],j=P[1],N=P[2],k=j-N-u*C;(C||k)&&Up(r,m)&&(v+=k,E+=C);var R=m.parentNode;m=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!x&&m!==document.body||x&&(a.contains(m)||a===m));return(g&&Math.abs(v)<1||!g&&Math.abs(E)<1)&&(y=!0),y},Zl=function(r){return"changedTouches"in r?[r.changedTouches[0].clientX,r.changedTouches[0].clientY]:[0,0]},Mm=function(r){return[r.deltaX,r.deltaY]},Lm=function(r){return r&&"current"in r?r.current:r},aN=function(r,a){return r[0]===a[0]&&r[1]===a[1]},lN=function(r){return` - .block-interactivity-`.concat(r,` {pointer-events: none;} - .allow-interactivity-`).concat(r,` {pointer-events: all;} -`)},oN=0,Ns=[];function iN(r){var a=p.useRef([]),l=p.useRef([0,0]),i=p.useRef(),c=p.useState(oN++)[0],u=p.useState(Bp)[0],f=p.useRef(r);p.useEffect(function(){f.current=r},[r]),p.useEffect(function(){if(r.inert){document.body.classList.add("block-interactivity-".concat(c));var j=Rb([r.lockRef.current],(r.shards||[]).map(Lm),!0).filter(Boolean);return j.forEach(function(N){return N.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),j.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(c))})}}},[r.inert,r.lockRef.current,r.shards]);var m=p.useCallback(function(j,N){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!f.current.allowPinchZoom;var k=Zl(j),R=l.current,b="deltaX"in j?j.deltaX:R[0]-k[0],T="deltaY"in j?j.deltaY:R[1]-k[1],B,G=j.target,M=Math.abs(b)>Math.abs(T)?"h":"v";if("touches"in j&&M==="h"&&G.type==="range")return!1;var V=window.getSelection(),ee=V&&V.anchorNode,de=ee?ee===G||ee.contains(G):!1;if(de)return!1;var ce=Am(M,G);if(!ce)return!0;if(ce?B=M:(B=M==="v"?"h":"v",ce=Am(M,G)),!ce)return!1;if(!i.current&&"changedTouches"in j&&(b||T)&&(i.current=B),!B)return!0;var le=i.current||B;return sN(le,N,j,le==="h"?b:T)},[]),x=p.useCallback(function(j){var N=j;if(!(!Ns.length||Ns[Ns.length-1]!==u)){var k="deltaY"in N?Mm(N):Zl(N),R=a.current.filter(function(B){return B.name===N.type&&(B.target===N.target||N.target===B.shadowParent)&&aN(B.delta,k)})[0];if(R&&R.should){N.cancelable&&N.preventDefault();return}if(!R){var b=(f.current.shards||[]).map(Lm).filter(Boolean).filter(function(B){return B.contains(N.target)}),T=b.length>0?m(N,b[0]):!f.current.noIsolation;T&&N.cancelable&&N.preventDefault()}}},[]),y=p.useCallback(function(j,N,k,R){var b={name:j,delta:N,target:k,should:R,shadowParent:cN(k)};a.current.push(b),setTimeout(function(){a.current=a.current.filter(function(T){return T!==b})},1)},[]),g=p.useCallback(function(j){l.current=Zl(j),i.current=void 0},[]),v=p.useCallback(function(j){y(j.type,Mm(j),j.target,m(j,r.lockRef.current))},[]),E=p.useCallback(function(j){y(j.type,Zl(j),j.target,m(j,r.lockRef.current))},[]);p.useEffect(function(){return Ns.push(u),r.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:E}),document.addEventListener("wheel",x,bs),document.addEventListener("touchmove",x,bs),document.addEventListener("touchstart",g,bs),function(){Ns=Ns.filter(function(j){return j!==u}),document.removeEventListener("wheel",x,bs),document.removeEventListener("touchmove",x,bs),document.removeEventListener("touchstart",g,bs)}},[]);var P=r.removeScrollBar,C=r.inert;return p.createElement(p.Fragment,null,C?p.createElement(u,{styles:lN(c)}):null,P?p.createElement(Xb,{noRelative:r.noRelative,gapMode:r.gapMode}):null)}function cN(r){for(var a=null;r!==null;)r instanceof ShadowRoot&&(a=r.host,r=r.host),r=r.parentNode;return a}const dN=Fb($p,iN);var Dd=p.forwardRef(function(r,a){return p.createElement(Ro,Sn({},r,{ref:a,sideCar:dN}))});Dd.classNames=Ro.classNames;var uN=function(r){if(typeof document>"u")return null;var a=Array.isArray(r)?r[0]:r;return a.ownerDocument.body},Ss=new WeakMap,eo=new WeakMap,to={},Hc=0,Hp=function(r){return r&&(r.host||Hp(r.parentNode))},fN=function(r,a){return a.map(function(l){if(r.contains(l))return l;var i=Hp(l);return i&&r.contains(i)?i:(console.error("aria-hidden",l,"in not contained inside",r,". Doing nothing"),null)}).filter(function(l){return!!l})},hN=function(r,a,l,i){var c=fN(a,Array.isArray(r)?r:[r]);to[l]||(to[l]=new WeakMap);var u=to[l],f=[],m=new Set,x=new Set(c),y=function(v){!v||m.has(v)||(m.add(v),y(v.parentNode))};c.forEach(y);var g=function(v){!v||x.has(v)||Array.prototype.forEach.call(v.children,function(E){if(m.has(E))g(E);else try{var P=E.getAttribute(i),C=P!==null&&P!=="false",j=(Ss.get(E)||0)+1,N=(u.get(E)||0)+1;Ss.set(E,j),u.set(E,N),f.push(E),j===1&&C&&eo.set(E,!0),N===1&&E.setAttribute(l,"true"),C||E.setAttribute(i,"true")}catch(k){console.error("aria-hidden: cannot operate on ",E,k)}})};return g(a),m.clear(),Hc++,function(){f.forEach(function(v){var E=Ss.get(v)-1,P=u.get(v)-1;Ss.set(v,E),u.set(v,P),E||(eo.has(v)||v.removeAttribute(i),eo.delete(v)),P||v.removeAttribute(l)}),Hc--,Hc||(Ss=new WeakMap,Ss=new WeakMap,eo=new WeakMap,to={})}},Kp=function(r,a,l){l===void 0&&(l="data-aria-hidden");var i=Array.from(Array.isArray(r)?r:[r]),c=uN(r);return c?(i.push.apply(i,Array.from(c.querySelectorAll("[aria-live], script"))),hN(i,c,l,"aria-hidden")):function(){return null}},_o="Dialog",[Gp]=wr(_o),[mN,vn]=Gp(_o),Qp=r=>{const{__scopeDialog:a,children:l,open:i,defaultOpen:c,onOpenChange:u,modal:f=!0}=r,m=p.useRef(null),x=p.useRef(null),[y,g]=Wr({prop:i,defaultProp:c??!1,onChange:u,caller:_o});return t.jsx(mN,{scope:a,triggerRef:m,contentRef:x,contentId:pr(),titleId:pr(),descriptionId:pr(),open:y,onOpenChange:g,onOpenToggle:p.useCallback(()=>g(v=>!v),[g]),modal:f,children:l})};Qp.displayName=_o;var Yp="DialogTrigger",pN=p.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=vn(Yp,l),u=Ke(a,c.triggerRef);return t.jsx(Oe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":$d(c.open),...i,ref:u,onClick:Te(r.onClick,c.onOpenToggle)})});pN.displayName=Yp;var Fd="DialogPortal",[xN,qp]=Gp(Fd,{forceMount:void 0}),Xp=r=>{const{__scopeDialog:a,forceMount:l,children:i,container:c}=r,u=vn(Fd,a);return t.jsx(xN,{scope:a,forceMount:l,children:p.Children.map(i,f=>t.jsx(Da,{present:l||u.open,children:t.jsx(Od,{asChild:!0,container:c,children:f})}))})};Xp.displayName=Fd;var xo="DialogOverlay",Jp=p.forwardRef((r,a)=>{const l=qp(xo,r.__scopeDialog),{forceMount:i=l.forceMount,...c}=r,u=vn(xo,r.__scopeDialog);return u.modal?t.jsx(Da,{present:i||u.open,children:t.jsx(vN,{...c,ref:a})}):null});Jp.displayName=xo;var gN=Aa("DialogOverlay.RemoveScroll"),vN=p.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=vn(xo,l);return t.jsx(Dd,{as:gN,allowPinchZoom:!0,shards:[c.contentRef],children:t.jsx(Oe.div,{"data-state":$d(c.open),...i,ref:a,style:{pointerEvents:"auto",...i.style}})})}),Hr="DialogContent",Zp=p.forwardRef((r,a)=>{const l=qp(Hr,r.__scopeDialog),{forceMount:i=l.forceMount,...c}=r,u=vn(Hr,r.__scopeDialog);return t.jsx(Da,{present:i||u.open,children:u.modal?t.jsx(yN,{...c,ref:a}):t.jsx(wN,{...c,ref:a})})});Zp.displayName=Hr;var yN=p.forwardRef((r,a)=>{const l=vn(Hr,r.__scopeDialog),i=p.useRef(null),c=Ke(a,l.contentRef,i);return p.useEffect(()=>{const u=i.current;if(u)return Kp(u)},[]),t.jsx(ex,{...r,ref:c,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Te(r.onCloseAutoFocus,u=>{var f;u.preventDefault(),(f=l.triggerRef.current)==null||f.focus()}),onPointerDownOutside:Te(r.onPointerDownOutside,u=>{const f=u.detail.originalEvent,m=f.button===0&&f.ctrlKey===!0;(f.button===2||m)&&u.preventDefault()}),onFocusOutside:Te(r.onFocusOutside,u=>u.preventDefault())})}),wN=p.forwardRef((r,a)=>{const l=vn(Hr,r.__scopeDialog),i=p.useRef(!1),c=p.useRef(!1);return t.jsx(ex,{...r,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{var f,m;(f=r.onCloseAutoFocus)==null||f.call(r,u),u.defaultPrevented||(i.current||(m=l.triggerRef.current)==null||m.focus(),u.preventDefault()),i.current=!1,c.current=!1},onInteractOutside:u=>{var x,y;(x=r.onInteractOutside)==null||x.call(r,u),u.defaultPrevented||(i.current=!0,u.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const f=u.target;((y=l.triggerRef.current)==null?void 0:y.contains(f))&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&c.current&&u.preventDefault()}})}),ex=p.forwardRef((r,a)=>{const{__scopeDialog:l,trapFocus:i,onOpenAutoFocus:c,onCloseAutoFocus:u,...f}=r,m=vn(Hr,l),x=p.useRef(null),y=Ke(a,x);return Dp(),t.jsxs(t.Fragment,{children:[t.jsx(Ld,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:c,onUnmountAutoFocus:u,children:t.jsx(Md,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":$d(m.open),...f,ref:y,onDismiss:()=>m.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(jN,{titleId:m.titleId}),t.jsx(NN,{contentRef:x,descriptionId:m.descriptionId})]})]})}),zd="DialogTitle",tx=p.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=vn(zd,l);return t.jsx(Oe.h2,{id:c.titleId,...i,ref:a})});tx.displayName=zd;var nx="DialogDescription",rx=p.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=vn(nx,l);return t.jsx(Oe.p,{id:c.descriptionId,...i,ref:a})});rx.displayName=nx;var sx="DialogClose",ax=p.forwardRef((r,a)=>{const{__scopeDialog:l,...i}=r,c=vn(sx,l);return t.jsx(Oe.button,{type:"button",...i,ref:a,onClick:Te(r.onClick,()=>c.onOpenChange(!1))})});ax.displayName=sx;function $d(r){return r?"open":"closed"}var lx="DialogTitleWarning",[tk,ox]=q1(lx,{contentName:Hr,titleName:zd,docsSlug:"dialog"}),jN=({titleId:r})=>{const a=ox(lx),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 p.useEffect(()=>{r&&(document.getElementById(r)||console.error(l))},[l,r]),null},bN="DialogDescriptionWarning",NN=({contentRef:r,descriptionId:a})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ox(bN).contentName}}.`;return p.useEffect(()=>{var u;const c=(u=r.current)==null?void 0:u.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(i))},[i,r,a]),null},SN=Qp,CN=Xp,kN=Jp,EN=Zp,PN=tx,RN=rx,_N=ax;function tn(r){return t.jsx(SN,{"data-slot":"dialog",...r})}function TN(r){return t.jsx(CN,{...r})}const ix=p.forwardRef(({className:r,...a},l)=>t.jsx(kN,{ref:l,className:Ge("fixed inset-0 z-50 bg-black/50",r),...a}));ix.displayName="DialogOverlay";const Ht=p.forwardRef(({className:r,children:a,showCloseButton:l=!0,...i},c)=>t.jsxs(TN,{children:[t.jsx(ix,{}),t.jsxs(EN,{ref:c,className:Ge("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",r),...i,children:[a,l&&t.jsxs(_N,{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(zn,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ht.displayName="DialogContent";function nn({className:r,...a}){return t.jsx("div",{className:Ge("flex flex-col gap-2 text-center sm:text-left",r),...a})}function mn({className:r,...a}){return t.jsx("div",{className:Ge("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",r),...a})}function rn(r){return t.jsx(PN,{className:"text-lg font-semibold leading-none",...r})}function IN(r){return t.jsx(RN,{className:"text-sm text-muted-foreground",...r})}function cx(r,a){const[l,i]=p.useState(r);return p.useEffect(()=>{const c=setTimeout(()=>i(r),a);return()=>clearTimeout(c)},[r,a]),l}function Vr({page:r,totalPages:a,total:l,pageSize:i,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:i,onChange:m=>u(Number(m.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:f.map(m=>t.jsxs("option",{value:m,children:[m," 条/页"]},m))})]}),a>1&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>c(1),disabled:r<=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(r-1),disabled:r<=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:[r," / ",a]}),t.jsx("button",{type:"button",onClick:()=>c(r+1),disabled:r>=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:r>=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 AN(){const[r,a]=p.useState([]),[l,i]=p.useState([]),[c,u]=p.useState(0),[f,m]=p.useState(0),[x,y]=p.useState(0),[g,v]=p.useState(1),[E,P]=p.useState(10),[C,j]=p.useState(""),N=cx(C,300),[k,R]=p.useState("all"),[b,T]=p.useState(!0),[B,G]=p.useState(null),[M,V]=p.useState(null),[ee,de]=p.useState(""),[ce,le]=p.useState(!1);async function ue(){T(!0),G(null);try{const $=k==="all"?"":k==="completed"?"completed":k,S=new URLSearchParams({page:String(g),pageSize:String(E),...$&&{status:$},...N&&{search:N}}),[O,se]=await Promise.all([He(`/api/orders?${S}`),He("/api/db/users?page=1&pageSize=500")]);O!=null&&O.success&&(a(O.orders||[]),u(O.total??0),m(O.totalRevenue??0),y(O.todayRevenue??0)),se!=null&&se.success&&se.users&&i(se.users)}catch($){console.error("加载订单失败",$),G("加载订单失败,请检查网络后重试")}finally{T(!1)}}p.useEffect(()=>{v(1)},[N,k]),p.useEffect(()=>{ue()},[g,E,N,k]);const H=$=>{var S;return $.userNickname||((S=l.find(O=>O.id===$.userId))==null?void 0:S.nickname)||"匿名用户"},W=$=>{var S;return((S=l.find(O=>O.id===$))==null?void 0:S.phone)||"-"},Q=$=>{const S=$.productType||$.type||"",O=$.description||"";if(O){if(S==="section"&&O.includes("章节")){if(O.includes("-")){const se=O.split("-");if(se.length>=3)return{name:`第${se[1]}章 第${se[2]}节`,type:"《一场Soul的创业实验》"}}return{name:O,type:"章节购买"}}return S==="fullbook"||O.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:S==="vip"||O.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:S==="match"||O.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:O,type:"其他"}}return S==="section"?{name:`章节 ${$.productId||$.sectionId||""}`,type:"单章"}:S==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:S==="vip"?{name:"VIP年度会员",type:"VIP"}:S==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:S||"其他"}},K=Math.ceil(c/E)||1;async function A(){var $;if(!(!(M!=null&&M.orderSn)&&!(M!=null&&M.id))){le(!0),G(null);try{const S=await Wt("/api/admin/orders/refund",{orderSn:M.orderSn||M.id,reason:ee||void 0});S!=null&&S.success?(V(null),de(""),ue()):G((S==null?void 0:S.error)||"退款失败")}catch(S){const O=S;G((($=O==null?void 0:O.data)==null?void 0:$.error)||"退款失败,请检查网络后重试")}finally{le(!1)}}}function X(){if(r.length===0){alert("暂无数据可导出");return}const $=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],S=r.map(me=>{const Y=Q(me);return[me.orderSn||me.id||"",H(me),W(me.userId),Y.name,Number(me.amount||0).toFixed(2),me.paymentMethod==="wechat"?"微信支付":me.paymentMethod==="alipay"?"支付宝":me.paymentMethod||"微信支付",me.status==="refunded"?"已退款":me.status==="paid"||me.status==="completed"?"已完成":me.status==="pending"||me.status==="created"?"待支付":"已失败",me.status==="refunded"&&me.refundReason?me.refundReason:"-",me.referrerEarnings?Number(me.referrerEarnings).toFixed(2):"-",me.createdAt?new Date(me.createdAt).toLocaleString("zh-CN"):""].join(",")}),O="\uFEFF"+[$.join(","),...S].join(` -`),se=new Blob([O],{type:"text/csv;charset=utf-8"}),oe=URL.createObjectURL(se),be=document.createElement("a");be.href=oe,be.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,be.click(),URL.revokeObjectURL(oe)}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:()=>G(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:["共 ",r.length," 笔订单"]})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(he,{variant:"outline",onClick:ue,disabled:b,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(st,{className:`w-4 h-4 mr-2 ${b?"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(Br,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),t.jsx(ie,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:C,onChange:$=>j($.target.value)})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(zw,{className:"w-4 h-4 text-gray-400"}),t.jsxs("select",{value:k,onChange:$=>R($.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(he,{variant:"outline",onClick:X,disabled:r.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Aw,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(ke,{className:"p-0",children:b?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(st,{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(Ls,{children:[t.jsx(Os,{children:t.jsxs(_t,{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(Ds,{children:[r.map($=>{const S=Q($);return t.jsxs(_t,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsxs(Me,{className:"font-mono text-xs text-gray-400",children:[($.orderSn||$.id||"").slice(0,12),"..."]}),t.jsx(Me,{children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:H($)}),t.jsx("p",{className:"text-gray-500 text-xs",children:W($.userId)})]})}),t.jsx(Me,{children:t.jsxs("div",{children:[t.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[S.name,($.productType||$.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:S.type})]})}),t.jsxs(Me,{className:"text-[#38bdac] font-bold",children:["¥",Number($.amount||0).toFixed(2)]}),t.jsx(Me,{className:"text-gray-300",children:$.paymentMethod==="wechat"?"微信支付":$.paymentMethod==="alipay"?"支付宝":$.paymentMethod||"微信支付"}),t.jsx(Me,{children:$.status==="refunded"?t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):$.status==="paid"||$.status==="completed"?t.jsx(Le,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):$.status==="pending"||$.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(Me,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:$.refundReason,children:$.status==="refunded"&&$.refundReason?$.refundReason:"-"}),t.jsx(Me,{className:"text-[#FFD700]",children:$.referrerEarnings?`¥${Number($.referrerEarnings).toFixed(2)}`:"-"}),t.jsx(Me,{className:"text-gray-400 text-sm",children:new Date($.createdAt).toLocaleString("zh-CN")}),t.jsx(Me,{children:($.status==="paid"||$.status==="completed")&&t.jsxs(he,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{V($),de("")},children:[t.jsx(mp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},$.id)}),r.length===0&&t.jsx(_t,{children:t.jsx(Me,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),t.jsx(Vr,{page:g,totalPages:K,total:c,pageSize:E,onPageChange:v,onPageSizeChange:$=>{P($),v(1)}})]})})}),t.jsx(tn,{open:!!M,onOpenChange:$=>!$&&V(null),children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(nn,{children:t.jsx(rn,{className:"text-white",children:"订单退款"})}),M&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",M.orderSn||M.id]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(M.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(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:ee,onChange:$=>de($.target.value)})})]}),t.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),t.jsxs(mn,{children:[t.jsx(he,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>V(null),disabled:ce,children:"取消"}),t.jsx(he,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:A,disabled:ce,children:ce?"退款中...":"确认退款"})]})]})})]})}var MN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],LN=MN.reduce((r,a)=>{const l=gp(`Primitive.${a}`),i=p.forwardRef((c,u)=>{const{asChild:f,...m}=c,x=f?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(x,{...m,ref:u})});return i.displayName=`Primitive.${a}`,{...r,[a]:i}},{}),ON="Label",dx=p.forwardRef((r,a)=>t.jsx(LN.label,{...r,ref:a,onMouseDown:l=>{var c;l.target.closest("button, input, select, textarea")||((c=r.onMouseDown)==null||c.call(r,l),!l.defaultPrevented&&l.detail>1&&l.preventDefault())}}));dx.displayName=ON;var ux=dx;const ne=p.forwardRef(({className:r,...a},l)=>t.jsx(ux,{ref:l,className:Ge("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",r),...a}));ne.displayName=ux.displayName;function Bd(r){const a=p.useRef({value:r,previous:r});return p.useMemo(()=>(a.current.value!==r&&(a.current.previous=a.current.value,a.current.value=r),a.current.previous),[r])}function Vd(r){const[a,l]=p.useState(void 0);return Et(()=>{if(r){l({width:r.offsetWidth,height:r.offsetHeight});const i=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const u=c[0];let f,m;if("borderBoxSize"in u){const x=u.borderBoxSize,y=Array.isArray(x)?x[0]:x;f=y.inlineSize,m=y.blockSize}else f=r.offsetWidth,m=r.offsetHeight;l({width:f,height:m})});return i.observe(r,{box:"border-box"}),()=>i.unobserve(r)}else l(void 0)},[r]),a}var To="Switch",[DN]=wr(To),[FN,zN]=DN(To),fx=p.forwardRef((r,a)=>{const{__scopeSwitch:l,name:i,checked:c,defaultChecked:u,required:f,disabled:m,value:x="on",onCheckedChange:y,form:g,...v}=r,[E,P]=p.useState(null),C=Ke(a,b=>P(b)),j=p.useRef(!1),N=E?g||!!E.closest("form"):!0,[k,R]=Wr({prop:c,defaultProp:u??!1,onChange:y,caller:To});return t.jsxs(FN,{scope:l,checked:k,disabled:m,children:[t.jsx(Oe.button,{type:"button",role:"switch","aria-checked":k,"aria-required":f,"data-state":xx(k),"data-disabled":m?"":void 0,disabled:m,value:x,...v,ref:C,onClick:Te(r.onClick,b=>{R(T=>!T),N&&(j.current=b.isPropagationStopped(),j.current||b.stopPropagation())})}),N&&t.jsx(px,{control:E,bubbles:!j.current,name:i,value:x,checked:k,required:f,disabled:m,form:g,style:{transform:"translateX(-100%)"}})]})});fx.displayName=To;var hx="SwitchThumb",mx=p.forwardRef((r,a)=>{const{__scopeSwitch:l,...i}=r,c=zN(hx,l);return t.jsx(Oe.span,{"data-state":xx(c.checked),"data-disabled":c.disabled?"":void 0,...i,ref:a})});mx.displayName=hx;var $N="SwitchBubbleInput",px=p.forwardRef(({__scopeSwitch:r,control:a,checked:l,bubbles:i=!0,...c},u)=>{const f=p.useRef(null),m=Ke(f,u),x=Bd(l),y=Vd(a);return p.useEffect(()=>{const g=f.current;if(!g)return;const v=window.HTMLInputElement.prototype,P=Object.getOwnPropertyDescriptor(v,"checked").set;if(x!==l&&P){const C=new Event("click",{bubbles:i});P.call(g,l),g.dispatchEvent(C)}},[x,l,i]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:l,...c,tabIndex:-1,ref:m,style:{...c.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});px.displayName=$N;function xx(r){return r?"checked":"unchecked"}var gx=fx,BN=mx;const ut=p.forwardRef(({className:r,...a},l)=>t.jsx(gx,{className:Ge("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]",r),...a,ref:l,children:t.jsx(BN,{className:Ge("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")})}));ut.displayName=gx.displayName;function Ud(r){const a=r+"CollectionProvider",[l,i]=wr(a),[c,u]=l(a,{collectionRef:{current:null},itemMap:new Map}),f=j=>{const{scope:N,children:k}=j,R=dr.useRef(null),b=dr.useRef(new Map).current;return t.jsx(c,{scope:N,itemMap:b,collectionRef:R,children:k})};f.displayName=a;const m=r+"CollectionSlot",x=Aa(m),y=dr.forwardRef((j,N)=>{const{scope:k,children:R}=j,b=u(m,k),T=Ke(N,b.collectionRef);return t.jsx(x,{ref:T,children:R})});y.displayName=m;const g=r+"CollectionItemSlot",v="data-radix-collection-item",E=Aa(g),P=dr.forwardRef((j,N)=>{const{scope:k,children:R,...b}=j,T=dr.useRef(null),B=Ke(N,T),G=u(g,k);return dr.useEffect(()=>(G.itemMap.set(T,{ref:T,...b}),()=>void G.itemMap.delete(T))),t.jsx(E,{[v]:"",ref:B,children:R})});P.displayName=g;function C(j){const N=u(r+"CollectionConsumer",j);return dr.useCallback(()=>{const R=N.collectionRef.current;if(!R)return[];const b=Array.from(R.querySelectorAll(`[${v}]`));return Array.from(N.itemMap.values()).sort((G,M)=>b.indexOf(G.ref.current)-b.indexOf(M.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:f,Slot:y,ItemSlot:P},C,i]}var VN=p.createContext(void 0);function Io(r){const a=p.useContext(VN);return r||a||"ltr"}var Kc="rovingFocusGroup.onEntryFocus",UN={bubbles:!1,cancelable:!0},Fa="RovingFocusGroup",[ud,vx,WN]=Ud(Fa),[HN,yx]=wr(Fa,[WN]),[KN,GN]=HN(Fa),wx=p.forwardRef((r,a)=>t.jsx(ud.Provider,{scope:r.__scopeRovingFocusGroup,children:t.jsx(ud.Slot,{scope:r.__scopeRovingFocusGroup,children:t.jsx(QN,{...r,ref:a})})}));wx.displayName=Fa;var QN=p.forwardRef((r,a)=>{const{__scopeRovingFocusGroup:l,orientation:i,loop:c=!1,dir:u,currentTabStopId:f,defaultCurrentTabStopId:m,onCurrentTabStopIdChange:x,onEntryFocus:y,preventScrollOnEntryFocus:g=!1,...v}=r,E=p.useRef(null),P=Ke(a,E),C=Io(u),[j,N]=Wr({prop:f,defaultProp:m??null,onChange:x,caller:Fa}),[k,R]=p.useState(!1),b=xr(y),T=vx(l),B=p.useRef(!1),[G,M]=p.useState(0);return p.useEffect(()=>{const V=E.current;if(V)return V.addEventListener(Kc,b),()=>V.removeEventListener(Kc,b)},[b]),t.jsx(KN,{scope:l,orientation:i,dir:C,loop:c,currentTabStopId:j,onItemFocus:p.useCallback(V=>N(V),[N]),onItemShiftTab:p.useCallback(()=>R(!0),[]),onFocusableItemAdd:p.useCallback(()=>M(V=>V+1),[]),onFocusableItemRemove:p.useCallback(()=>M(V=>V-1),[]),children:t.jsx(Oe.div,{tabIndex:k||G===0?-1:0,"data-orientation":i,...v,ref:P,style:{outline:"none",...r.style},onMouseDown:Te(r.onMouseDown,()=>{B.current=!0}),onFocus:Te(r.onFocus,V=>{const ee=!B.current;if(V.target===V.currentTarget&&ee&&!k){const de=new CustomEvent(Kc,UN);if(V.currentTarget.dispatchEvent(de),!de.defaultPrevented){const ce=T().filter(Q=>Q.focusable),le=ce.find(Q=>Q.active),ue=ce.find(Q=>Q.id===j),W=[le,ue,...ce].filter(Boolean).map(Q=>Q.ref.current);Nx(W,g)}}B.current=!1}),onBlur:Te(r.onBlur,()=>R(!1))})})}),jx="RovingFocusGroupItem",bx=p.forwardRef((r,a)=>{const{__scopeRovingFocusGroup:l,focusable:i=!0,active:c=!1,tabStopId:u,children:f,...m}=r,x=pr(),y=u||x,g=GN(jx,l),v=g.currentTabStopId===y,E=vx(l),{onFocusableItemAdd:P,onFocusableItemRemove:C,currentTabStopId:j}=g;return p.useEffect(()=>{if(i)return P(),()=>C()},[i,P,C]),t.jsx(ud.ItemSlot,{scope:l,id:y,focusable:i,active:c,children:t.jsx(Oe.span,{tabIndex:v?0:-1,"data-orientation":g.orientation,...m,ref:a,onMouseDown:Te(r.onMouseDown,N=>{i?g.onItemFocus(y):N.preventDefault()}),onFocus:Te(r.onFocus,()=>g.onItemFocus(y)),onKeyDown:Te(r.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){g.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const k=XN(N,g.orientation,g.dir);if(k!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let b=E().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")b.reverse();else if(k==="prev"||k==="next"){k==="prev"&&b.reverse();const T=b.indexOf(N.currentTarget);b=g.loop?JN(b,T+1):b.slice(T+1)}setTimeout(()=>Nx(b))}}),children:typeof f=="function"?f({isCurrentTabStop:v,hasTabStop:j!=null}):f})})});bx.displayName=jx;var YN={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qN(r,a){return a!=="rtl"?r:r==="ArrowLeft"?"ArrowRight":r==="ArrowRight"?"ArrowLeft":r}function XN(r,a,l){const i=qN(r.key,l);if(!(a==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(a==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return YN[i]}function Nx(r,a=!1){const l=document.activeElement;for(const i of r)if(i===l||(i.focus({preventScroll:a}),document.activeElement!==l))return}function JN(r,a){return r.map((l,i)=>r[(a+i)%r.length])}var ZN=wx,e2=bx,Ao="Tabs",[t2]=wr(Ao,[yx]),Sx=yx(),[n2,Wd]=t2(Ao),Cx=p.forwardRef((r,a)=>{const{__scopeTabs:l,value:i,onValueChange:c,defaultValue:u,orientation:f="horizontal",dir:m,activationMode:x="automatic",...y}=r,g=Io(m),[v,E]=Wr({prop:i,onChange:c,defaultProp:u??"",caller:Ao});return t.jsx(n2,{scope:l,baseId:pr(),value:v,onValueChange:E,orientation:f,dir:g,activationMode:x,children:t.jsx(Oe.div,{dir:g,"data-orientation":f,...y,ref:a})})});Cx.displayName=Ao;var kx="TabsList",Ex=p.forwardRef((r,a)=>{const{__scopeTabs:l,loop:i=!0,...c}=r,u=Wd(kx,l),f=Sx(l);return t.jsx(ZN,{asChild:!0,...f,orientation:u.orientation,dir:u.dir,loop:i,children:t.jsx(Oe.div,{role:"tablist","aria-orientation":u.orientation,...c,ref:a})})});Ex.displayName=kx;var Px="TabsTrigger",Rx=p.forwardRef((r,a)=>{const{__scopeTabs:l,value:i,disabled:c=!1,...u}=r,f=Wd(Px,l),m=Sx(l),x=Ix(f.baseId,i),y=Ax(f.baseId,i),g=i===f.value;return t.jsx(e2,{asChild:!0,...m,focusable:!c,active:g,children:t.jsx(Oe.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":y,"data-state":g?"active":"inactive","data-disabled":c?"":void 0,disabled:c,id:x,...u,ref:a,onMouseDown:Te(r.onMouseDown,v=>{!c&&v.button===0&&v.ctrlKey===!1?f.onValueChange(i):v.preventDefault()}),onKeyDown:Te(r.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&f.onValueChange(i)}),onFocus:Te(r.onFocus,()=>{const v=f.activationMode!=="manual";!g&&!c&&v&&f.onValueChange(i)})})})});Rx.displayName=Px;var _x="TabsContent",Tx=p.forwardRef((r,a)=>{const{__scopeTabs:l,value:i,forceMount:c,children:u,...f}=r,m=Wd(_x,l),x=Ix(m.baseId,i),y=Ax(m.baseId,i),g=i===m.value,v=p.useRef(g);return p.useEffect(()=>{const E=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(E)},[]),t.jsx(Da,{present:c||g,children:({present:E})=>t.jsx(Oe.div,{"data-state":g?"active":"inactive","data-orientation":m.orientation,role:"tabpanel","aria-labelledby":x,hidden:!E,id:y,tabIndex:0,...f,ref:a,style:{...r.style,animationDuration:v.current?"0s":void 0},children:E&&u})})});Tx.displayName=_x;function Ix(r,a){return`${r}-trigger-${a}`}function Ax(r,a){return`${r}-content-${a}`}var r2=Cx,Mx=Ex,Lx=Rx,Ox=Tx;const Hd=r2,Mo=p.forwardRef(({className:r,...a},l)=>t.jsx(Mx,{ref:l,className:Ge("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",r),...a}));Mo.displayName=Mx.displayName;const Zt=p.forwardRef(({className:r,...a},l)=>t.jsx(Lx,{ref:l,className:Ge("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",r),...a}));Zt.displayName=Lx.displayName;const en=p.forwardRef(({className:r,...a},l)=>t.jsx(Ox,{ref:l,className:Ge("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",r),...a}));en.displayName=Ox.displayName;function s2({open:r,onClose:a,userId:l,onUserUpdated:i}){var Q;const[c,u]=p.useState(null),[f,m]=p.useState([]),[x,y]=p.useState([]),[g,v]=p.useState(!1),[E,P]=p.useState(!1),[C,j]=p.useState(!1),[N,k]=p.useState("info"),[R,b]=p.useState(""),[T,B]=p.useState(""),[G,M]=p.useState([]),[V,ee]=p.useState("");p.useEffect(()=>{r&&l&&de()},[r,l]);async function de(){if(l){v(!0);try{const K=await He(`/api/db/users?id=${encodeURIComponent(l)}`);if(K!=null&&K.success&&K.user){const A=K.user;u(A),b(A.phone||""),B(A.nickname||""),M(typeof A.tags=="string"?JSON.parse(A.tags||"[]"):[])}try{const A=await He(`/api/user/track?userId=${encodeURIComponent(l)}&limit=50`);A!=null&&A.success&&A.tracks&&m(A.tracks)}catch{m([])}try{const A=await He(`/api/db/users/referrals?userId=${encodeURIComponent(l)}`);A!=null&&A.success&&A.referrals&&y(A.referrals)}catch{y([])}}catch(K){console.error("Load user detail error:",K)}finally{v(!1)}}}async function ce(){if(!(c!=null&&c.phone)){alert("用户未绑定手机号,无法同步");return}P(!0);try{const K=await bt("/api/ckb/sync",{action:"full_sync",phone:c.phone,userId:c.id});K!=null&&K.success?(alert("同步成功"),de()):alert("同步失败: "+(K==null?void 0:K.error))}catch(K){console.error("Sync CKB error:",K),alert("同步失败")}finally{P(!1)}}async function le(){if(c){j(!0);try{const K={id:c.id,phone:R||void 0,nickname:T||void 0,tags:JSON.stringify(G)},A=await Wt("/api/db/users",K);A!=null&&A.success?(alert("保存成功"),de(),i==null||i()):alert("保存失败: "+(A==null?void 0:A.error))}catch(K){console.error("Save user error:",K),alert("保存失败")}finally{j(!1)}}}const ue=()=>{V&&!G.includes(V)&&(M([...G,V]),ee(""))},H=K=>{M(G.filter(A=>A!==K))},W=K=>{const X={view_chapter:Ps,purchase:ad,match:En,login:ro,register:ro,share:zr,bind_phone:gj,bind_wechat:dj}[K]||dm;return t.jsx(X,{className:"w-4 h-4"})};return r?t.jsx(tn,{open:r,onOpenChange:()=>a(),children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[t.jsx(ro,{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:"已绑定手机"})]})}),g?t.jsxs("div",{className:"flex items-center justify-center py-20",children:[t.jsx(st,{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:""}):((Q=c.nickname)==null?void 0:Q.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(Hd,{value:N,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[t.jsxs(Mo,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-4",children:[t.jsx(Zt,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"基础信息"}),t.jsx(Zt,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"标签体系"}),t.jsx(Zt,{value:"tracks",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"行为轨迹"}),t.jsx(Zt,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"关系链路"})]}),t.jsxs(en,{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(ne,{className:"text-gray-300",children:"手机号"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:R,onChange:K=>b(K.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"昵称"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:T,onChange:K=>B(K.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(zr,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),t.jsx(he,{size:"sm",onClick:ce,disabled:E||!c.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?t.jsxs(t.Fragment,{children:[t.jsx(st,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(st,{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(en,{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(Tj,{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:[G.map((K,A)=>t.jsxs(Le,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[K,t.jsx("button",{type:"button",onClick:()=>H(K),className:"ml-1 hover:text-red-400",children:t.jsx(zn,{className:"w-3 h-3"})})]},A)),G.length===0&&t.jsx("span",{className:"text-gray-500 text-sm",children:"暂无标签"})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"添加新标签",value:V,onChange:K=>ee(K.target.value),onKeyDown:K=>K.key==="Enter"&&ue()}),t.jsx(he,{onClick:ue,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})}),t.jsx(en,{value:"tracks",className:"flex-1 overflow-auto",children:t.jsx("div",{className:"space-y-2",children:f.length>0?f.map(K=>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:W(K.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:K.actionLabel}),K.chapterTitle&&t.jsxs("span",{className:"text-gray-400 text-sm",children:["- ",K.chapterTitle]})]}),t.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:[t.jsx(fp,{className:"w-3 h-3 inline mr-1"}),K.timeAgo," · ",new Date(K.createdAt).toLocaleString()]})]})]},K.id)):t.jsxs("div",{className:"text-center py-12",children:[t.jsx(dm,{className:"w-10 h-10 text-[#38bdac]/40 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-400",children:"暂无行为轨迹"})]})})}),t.jsx(en,{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(zr,{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((K,A)=>{var $;const X=K;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:(($=X.nickname)==null?void 0:$.charAt(0))||"?"}),t.jsx("span",{className:"text-white text-sm",children:X.nickname})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[X.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:X.createdAt?new Date(X.createdAt).toLocaleDateString():""})]})]},X.id||A)}):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(he,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(zn,{className:"w-4 h-4 mr-2"}),"关闭"]}),t.jsxs(he,{onClick:le,disabled:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),C?"保存中...":"保存修改"]})]})]}):t.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}const Gc={isVip:!1,vipExpireDate:"",vipSort:"",vipRole:"",vipRoleCustom:"",vipName:"",vipProject:"",vipContact:"",vipBio:""};function a2({open:r,onClose:a,userId:l,userNickname:i="",onSaved:c}){const[u,f]=p.useState(Gc),[m,x]=p.useState([]),[y,g]=p.useState(!1),[v,E]=p.useState(!1);p.useEffect(()=>{if(!r){f(Gc);return}let C=!1;return g(!0),Promise.all([He("/api/db/vip-roles"),l?He(`/api/db/users?id=${encodeURIComponent(l)}`):Promise.resolve(null)]).then(([j,N])=>{if(C)return;const k=j!=null&&j.success&&j.data?j.data:[];x(k);const R=N&&N.user?N.user:null;if(R){const b=String(R.vipRole??""),T=k.some(B=>B.name===b);f({isVip:!!(R.isVip??!1),vipExpireDate:R.vipExpireDate?String(R.vipExpireDate).slice(0,10):"",vipSort:typeof R.vipSort=="number"?R.vipSort:"",vipRole:T?b:b?"__custom__":"",vipRoleCustom:T?"":b,vipName:String(R.vipName??""),vipProject:String(R.vipProject??""),vipContact:String(R.vipContact??""),vipBio:String(R.vipBio??"")})}else f(Gc)}).catch(j=>{C||console.error("Load error:",j)}).finally(()=>{C||g(!1)}),()=>{C=!0}},[r,l]);async function P(){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}}E(!0);try{const C=u.vipRole==="__custom__"?u.vipRoleCustom.trim():u.vipRole,j={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},N=await Wt("/api/db/users",j);N!=null&&N.success?(alert("VIP 设置已保存"),c==null||c(),a()):alert("保存失败: "+(N==null?void 0:N.error))}catch(C){console.error("Save VIP error:",C),alert("保存失败")}finally{E(!1)}}}return r?t.jsx(tn,{open:r,onOpenChange:()=>a(),children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[t.jsx(ko,{className:"w-5 h-5 text-amber-400"}),"设置 VIP - ",i||l]})}),y?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(ne,{className:"text-gray-300",children:"VIP 会员"}),t.jsx(ut,{checked:u.isVip,onCheckedChange:C=>f(j=>({...j,isVip:C}))})]}),u.isVip&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300",children:["到期日 (YYYY-MM-DD) ",t.jsx("span",{className:"text-amber-400",children:"*"})]}),t.jsx(ie,{type:"date",className:"bg-[#0a1628] border-gray-700 text-white",value:u.vipExpireDate,onChange:C=>f(j=>({...j,vipExpireDate:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"排序"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"数字越小越靠前,留空按时间",value:u.vipSort===""?"":u.vipSort,onChange:C=>{const j=C.target.value;f(N=>({...N,vipSort:j===""?"":parseInt(j,10)||0}))}})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{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(j=>({...j,vipRole:C.target.value})),children:[t.jsx("option",{value:"",children:"请选择或下方手动填写"}),m.map(C=>t.jsx("option",{value:C.name,children:C.name},C.id)),t.jsx("option",{value:"__custom__",children:"其他(手动填写)"})]}),u.vipRole==="__custom__"&&t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"输入自定义角色",value:u.vipRoleCustom,onChange:C=>f(j=>({...j,vipRoleCustom:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"VIP 展示名"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"创业老板排行展示名",value:u.vipName,onChange:C=>f(j=>({...j,vipName:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"项目/公司"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"项目名称",value:u.vipProject,onChange:C=>f(j=>({...j,vipProject:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"联系方式"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"微信号或手机",value:u.vipContact,onChange:C=>f(j=>({...j,vipContact:C.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"一句话简介"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"简要描述业务",value:u.vipBio,onChange:C=>f(j=>({...j,vipBio:C.target.value}))})]})]}),t.jsxs(mn,{children:[t.jsxs(he,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(zn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(he,{onClick:P,disabled:v||y,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存"]})]})]})}):null}function l2(){var qr,Vs,Us,Ws,Hs;const[r,a]=p.useState([]),[l,i]=p.useState(0),[c,u]=p.useState(1),[f,m]=p.useState(10),[x,y]=p.useState(""),g=cx(x,300),[v,E]=p.useState("all"),[P,C]=p.useState(!0),[j,N]=p.useState(null),[k,R]=p.useState(!1),[b,T]=p.useState(!1),[B,G]=p.useState(null),[M,V]=p.useState(""),[ee,de]=p.useState(""),[ce,le]=p.useState(!1),[ue,H]=p.useState(!1),[W,Q]=p.useState({referrals:[],stats:{}}),[K,A]=p.useState(!1),[X,$]=p.useState(null),[S,O]=p.useState(!1),[se,oe]=p.useState(null),[be,me]=p.useState(!1),[Y,xe]=p.useState(null),[I,re]=p.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1});async function fe(){C(!0),N(null);try{const q=new URLSearchParams({page:String(c),pageSize:String(f),search:g,...v==="vip"&&{vip:"true"}}),ze=await He(`/api/db/users?${q}`);ze!=null&&ze.success?(a(ze.users||[]),i(ze.total??0)):N((ze==null?void 0:ze.error)||"加载失败")}catch(q){console.error("Load users error:",q),N("网络错误,请检查连接")}finally{C(!1)}}p.useEffect(()=>{u(1)},[g,v]),p.useEffect(()=>{fe()},[c,f,g,v]);const Ee=Math.ceil(l/f)||1;async function Ie(q){if(confirm("确定要删除这个用户吗?"))try{const ze=await Td(`/api/db/users?id=${encodeURIComponent(q)}`);ze!=null&&ze.success?fe():alert("删除失败: "+((ze==null?void 0:ze.error)||"未知错误"))}catch(ze){console.error("Delete user error:",ze),alert("删除失败")}}const De=q=>{G(q),re({phone:q.phone||"",nickname:q.nickname||"",password:"",isAdmin:!!(q.isAdmin??!1),hasFullBook:!!(q.hasFullBook??!1)}),R(!0)},Ye=()=>{G(null),re({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),R(!0)};async function tt(){if(!I.phone||!I.nickname){alert("请填写手机号和昵称");return}le(!0);try{if(B){const q=await Wt("/api/db/users",{id:B.id,nickname:I.nickname,isAdmin:I.isAdmin,hasFullBook:I.hasFullBook,...I.password&&{password:I.password}});if(!(q!=null&&q.success)){alert("更新失败: "+((q==null?void 0:q.error)||"未知错误"));return}}else{const q=await bt("/api/db/users",{phone:I.phone,nickname:I.nickname,password:I.password,isAdmin:I.isAdmin});if(!(q!=null&&q.success)){alert("创建失败: "+((q==null?void 0:q.error)||"未知错误"));return}}R(!1),fe()}catch(q){console.error("Save user error:",q),alert("保存失败")}finally{le(!1)}}const Ze=q=>{G(q),V(""),de(""),T(!0)};async function Tt(q){$(q),H(!0),A(!0);try{const ze=await He(`/api/db/users/referrals?userId=${encodeURIComponent(q.id)}`);ze!=null&&ze.success?Q({referrals:ze.referrals||[],stats:ze.stats||{}}):Q({referrals:[],stats:{}})}catch(ze){console.error("Load referrals error:",ze),Q({referrals:[],stats:{}})}finally{A(!1)}}const It=q=>{oe(q.id),O(!0)},Nr=q=>{xe(q),me(!0)};async function Un(){if(!M){alert("请输入新密码");return}if(M!==ee){alert("两次输入的密码不一致");return}if(M.length<6){alert("密码长度不能少于6位");return}le(!0);try{const q=await Wt("/api/db/users",{id:B==null?void 0:B.id,password:M});q!=null&&q.success?(alert("密码修改成功"),T(!1)):alert("密码修改失败: "+((q==null?void 0:q.error)||"未知错误"))}catch(q){console.error("Change password error:",q),alert("密码修改失败")}finally{le(!1)}}return t.jsxs("div",{className:"p-8 w-full",children:[j&&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:j}),t.jsx("button",{type:"button",onClick:()=>N(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," 位注册用户",v==="vip"&&",当前筛选 VIP"]})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(he,{variant:"outline",onClick:fe,disabled:P,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(st,{className:`w-4 h-4 mr-2 ${P?"animate-spin":""}`}),"刷新"]}),t.jsxs("select",{value:v,onChange:q=>{E(q.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(Br,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),t.jsx(ie,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-64",value:x,onChange:q=>y(q.target.value)})]}),t.jsxs(he,{onClick:Ye,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pm,{className:"w-4 h-4 mr-2"}),"添加用户"]})]})]}),t.jsx(tn,{open:k,onOpenChange:R,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[B?t.jsx(Ur,{className:"w-5 h-5 text-[#38bdac]"}):t.jsx(pm,{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(ne,{className:"text-gray-300",children:"手机号"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:I.phone,onChange:q=>re({...I,phone:q.target.value}),disabled:!!B})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"昵称"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:I.nickname,onChange:q=>re({...I,nickname:q.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:B?"新密码 (留空则不修改)":"密码"}),t.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:B?"留空则不修改":"请输入密码",value:I.password,onChange:q=>re({...I,password:q.target.value})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(ne,{className:"text-gray-300",children:"管理员权限"}),t.jsx(ut,{checked:I.isAdmin,onCheckedChange:q=>re({...I,isAdmin:q})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(ne,{className:"text-gray-300",children:"已购全书"}),t.jsx(ut,{checked:I.hasFullBook,onCheckedChange:q=>re({...I,hasFullBook:q})})]})]}),t.jsxs(mn,{children:[t.jsxs(he,{variant:"outline",onClick:()=>R(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(zn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(he,{onClick:tt,disabled:ce,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),ce?"保存中...":"保存"]})]})]})}),t.jsx(tn,{open:b,onOpenChange:T,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[t.jsx(um,{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(ne,{className:"text-gray-300",children:"新密码"}),t.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入新密码 (至少6位)",value:M,onChange:q=>V(q.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"确认密码"}),t.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请再次输入新密码",value:ee,onChange:q=>de(q.target.value)})]})]}),t.jsxs(mn,{children:[t.jsx(he,{variant:"outline",onClick:()=>T(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(he,{onClick:Un,disabled:ce,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ce?"保存中...":"确认修改"})]})]})}),t.jsx(s2,{open:S,onClose:()=>O(!1),userId:se,onUserUpdated:fe}),t.jsx(a2,{open:be,onClose:()=>{me(!1),xe(null)},userId:(Y==null?void 0:Y.id)??null,userNickname:Y==null?void 0:Y.nickname,onSaved:fe}),t.jsx(tn,{open:ue,onOpenChange:H,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[t.jsx(En,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系详情 - ",X==null?void 0:X.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:((qr=W.stats)==null?void 0:qr.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:((Vs=W.stats)==null?void 0:Vs.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:["¥",(((Us=W.stats)==null?void 0:Us.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:["¥",(((Ws=W.stats)==null?void 0:Ws.pendingEarnings)||0).toFixed(2)]}),t.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),K?t.jsxs("div",{className:"flex items-center justify-center py-8",children:[t.jsx(st,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Hs=W.referrals)==null?void 0:Hs.length)??0)>0?t.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(W.referrals??[]).map((q,ze)=>{var sn;const yt=q;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:((sn=yt.nickname)==null?void 0:sn.charAt(0))||"?"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white text-sm",children:yt.nickname}),t.jsx("div",{className:"text-xs text-gray-500",children:yt.phone||(yt.hasOpenId?"微信用户":"未绑定")})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[yt.status==="vip"&&t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),yt.status==="paid"&&t.jsxs(Le,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",yt.purchasedSections,"章"]}),yt.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:yt.createdAt?new Date(yt.createdAt).toLocaleDateString():""})]})]},yt.id||ze)})}):t.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),t.jsx(mn,{children:t.jsx(he,{variant:"outline",onClick:()=>H(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(ke,{className:"p-0",children:P?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(st,{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(Ls,{children:[t.jsx(Os,{children:t.jsxs(_t,{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(Ds,{children:[r.map(q=>{var ze,yt,sn;return t.jsxs(_t,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(Me,{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:q.avatar?t.jsx("img",{src:q.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):((ze=q.nickname)==null?void 0:ze.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:q.nickname}),q.isAdmin&&t.jsx(Le,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),q.openId&&!((yt=q.id)!=null&&yt.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:q.openId?q.openId.slice(0,12)+"...":(sn=q.id)==null?void 0:sn.slice(0,12)})]})]})}),t.jsx(Me,{children:t.jsxs("div",{className:"space-y-1",children:[q.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:q.phone})]}),q.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:q.wechatId})]}),q.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:q.openId,children:[q.openId.slice(0,12),"..."]})]}),!q.phone&&!q.wechatId&&!q.openId&&t.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),t.jsx(Me,{children:q.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(Me,{children:t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(q.earnings||0)).toFixed(2)]}),parseFloat(String(q.pendingEarnings||0))>0&&t.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(q.pendingEarnings||0)).toFixed(2)]}),t.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>Tt(q),onKeyDown:Sr=>Sr.key==="Enter"&&Tt(q),role:"button",tabIndex:0,children:[t.jsx(En,{className:"w-3 h-3"}),"绑定",q.referralCount||0,"人"]})]})}),t.jsx(Me,{children:t.jsx("code",{className:"text-[#38bdac] text-xs bg-[#38bdac]/10 px-2 py-0.5 rounded",children:q.referralCode||"-"})}),t.jsx(Me,{className:"text-gray-400",children:q.createdAt?new Date(q.createdAt).toLocaleDateString():"-"}),t.jsx(Me,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>Nr(q),className:"text-gray-400 hover:text-amber-400 hover:bg-amber-400/10",title:"设置 VIP",children:t.jsx(ko,{className:"w-4 h-4"})}),t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>It(q),className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"查看详情",children:t.jsx(Rd,{className:"w-4 h-4"})}),t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>De(q),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑",children:t.jsx(Ur,{className:"w-4 h-4"})}),t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>Ze(q),className:"text-gray-400 hover:text-yellow-400 hover:bg-yellow-400/10",title:"修改密码",children:t.jsx(um,{className:"w-4 h-4"})}),t.jsx(he,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Ie(q.id),title:"删除",children:t.jsx(Eo,{className:"w-4 h-4"})})]})})]},q.id)}),r.length===0&&t.jsx(_t,{children:t.jsx(Me,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),t.jsx(Vr,{page:c,totalPages:Ee,total:l,pageSize:f,onPageChange:u,onPageSizeChange:q=>{m(q),u(1)}})]})})})]})}function o2(){const[r,a]=p.useState("overview"),[l,i]=p.useState([]),[c,u]=p.useState(null),[f,m]=p.useState([]),[x,y]=p.useState([]),[g,v]=p.useState([]),[E,P]=p.useState(!0),[C,j]=p.useState(null),[N,k]=p.useState(""),[R,b]=p.useState("all"),[T,B]=p.useState(1),[G,M]=p.useState(10),[V,ee]=p.useState(0),[de,ce]=p.useState(new Set),[le,ue]=p.useState(null),[H,W]=p.useState(""),[Q,K]=p.useState(!1);p.useEffect(()=>{A()},[]),p.useEffect(()=>{B(1)},[r,R]),p.useEffect(()=>{X(r)},[r]),p.useEffect(()=>{["orders","bindings","withdrawals"].includes(r)&&X(r,!0)},[T,G,R,N]);async function A(){j(null);try{const I=await He("/api/admin/distribution/overview");I!=null&&I.success&&I.overview&&u(I.overview)}catch(I){console.error("[Admin] 概览接口异常:",I),j("加载概览失败")}try{const I=await He("/api/db/users");v((I==null?void 0:I.users)||[])}catch(I){console.error("[Admin] 用户数据加载失败:",I)}}async function X(I,re=!1){var fe;if(!(!re&&de.has(I))){P(!0);try{const Ee=g;switch(I){case"overview":break;case"orders":{try{const Ie=new URLSearchParams({page:String(T),pageSize:String(G),...R!=="all"&&{status:R},...N&&{search:N}}),De=await He(`/api/orders?${Ie}`);if(De!=null&&De.success&&De.orders){const Ye=De.orders.map(tt=>{const Ze=Ee.find(It=>It.id===tt.userId),Tt=tt.referrerId?Ee.find(It=>It.id===tt.referrerId):null;return{...tt,amount:parseFloat(String(tt.amount))||0,userNickname:(Ze==null?void 0:Ze.nickname)||tt.userNickname||"未知用户",userPhone:(Ze==null?void 0:Ze.phone)||tt.userPhone||"-",referrerNickname:(Tt==null?void 0:Tt.nickname)||null,referrerCode:(Tt==null?void 0:Tt.referralCode)??null,type:tt.productType||tt.type}});i(Ye),ee(De.total??Ye.length)}else i([]),ee(0)}catch(Ie){console.error(Ie),j("加载订单失败"),i([])}break}case"bindings":{try{const Ie=new URLSearchParams({page:String(T),pageSize:String(G),...R!=="all"&&{status:R}}),De=await He(`/api/db/distribution?${Ie}`);m((De==null?void 0:De.bindings)||[]),ee((De==null?void 0:De.total)??((fe=De==null?void 0:De.bindings)==null?void 0:fe.length)??0)}catch(Ie){console.error(Ie),j("加载绑定数据失败"),m([])}break}case"withdrawals":{try{const Ie=R==="completed"?"success":R==="rejected"?"failed":R,De=new URLSearchParams({...Ie&&Ie!=="all"&&{status:Ie},page:String(T),pageSize:String(G)}),Ye=await He(`/api/admin/withdrawals?${De}`);if(Ye!=null&&Ye.success&&Ye.withdrawals){const tt=Ye.withdrawals.map(Ze=>({...Ze,account:Ze.account??"未绑定微信号",status:Ze.status==="success"?"completed":Ze.status==="failed"?"rejected":Ze.status}));y(tt),ee((Ye==null?void 0:Ye.total)??tt.length)}else Ye!=null&&Ye.success||j(`获取提现记录失败: ${(Ye==null?void 0:Ye.error)||"未知错误"}`),y([])}catch(Ie){console.error(Ie),j("加载提现数据失败"),y([])}break}}ce(Ie=>new Set(Ie).add(I))}catch(Ee){console.error(Ee)}finally{P(!1)}}}async function $(){j(null),ce(I=>{const re=new Set(I);return re.delete(r),re}),r==="overview"&&A(),await X(r,!0)}async function S(I){if(confirm("确认审核通过并打款?"))try{const re=await Wt("/api/admin/withdrawals",{id:I,action:"approve"});if(!(re!=null&&re.success)){const fe=(re==null?void 0:re.message)||(re==null?void 0:re.error)||"操作失败";alert(fe);return}await $()}catch(re){console.error(re),alert("操作失败")}}async function O(I){const re=prompt("请输入拒绝原因:");if(re)try{const fe=await Wt("/api/admin/withdrawals",{id:I,action:"reject",errorMessage:re});if(!(fe!=null&&fe.success)){alert((fe==null?void 0:fe.error)||"操作失败");return}await $()}catch(fe){console.error(fe),alert("操作失败")}}async function se(){var I;if(!(!(le!=null&&le.orderSn)&&!(le!=null&&le.id))){K(!0),j(null);try{const re=await Wt("/api/admin/orders/refund",{orderSn:le.orderSn||le.id,reason:H||void 0});re!=null&&re.success?(ue(null),W(""),await X("orders",!0)):j((re==null?void 0:re.error)||"退款失败")}catch(re){const fe=re;j(((I=fe==null?void 0:fe.data)==null?void 0:I.error)||"退款失败,请检查网络后重试")}finally{K(!1)}}}function oe(I){const re={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"},fe={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return t.jsx(Le,{className:`${re[I]||"bg-gray-500/20 text-gray-400"} border-0`,children:fe[I]||I})}const be=Math.ceil(V/G)||1,me=l,Y=f.filter(I=>{var fe,Ee,Ie,De;if(!N)return!0;const re=N.toLowerCase();return((fe=I.refereeNickname)==null?void 0:fe.toLowerCase().includes(re))||((Ee=I.refereePhone)==null?void 0:Ee.includes(re))||((Ie=I.referrerName)==null?void 0:Ie.toLowerCase().includes(re))||((De=I.referrerCode)==null?void 0:De.toLowerCase().includes(re))}),xe=x.filter(I=>{var fe;if(!N)return!0;const re=N.toLowerCase();return((fe=I.userName)==null?void 0:fe.toLowerCase().includes(re))||I.account&&I.account.toLowerCase().includes(re)});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:()=>j(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(he,{onClick:$,disabled:E,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[t.jsx(st,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`}),"刷新数据"]})]}),t.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4",children:[{key:"overview",label:"数据概览",icon:od},{key:"orders",label:"订单管理",icon:uo},{key:"bindings",label:"绑定管理",icon:zr},{key:"withdrawals",label:"提现审核",icon:Rs}].map(I=>t.jsxs("button",{type:"button",onClick:()=>{a(I.key),b("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${r===I.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[t.jsx(I.icon,{className:"w-4 h-4"}),I.label]},I.key))}),E?t.jsxs("div",{className:"flex items-center justify-center py-20",children:[t.jsx(st,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsxs(t.Fragment,{children:[r==="overview"&&c&&t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{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(Rd,{className:"w-6 h-6 text-blue-400"})})]})})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{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(zr,{className:"w-6 h-6 text-green-400"})})]})})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{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(nd,{className:"w-6 h-6 text-purple-400"})})]})})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{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(uo,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(Ce,{className:"bg-orange-500/10 border-orange-500/30",children:t.jsx(ke,{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(fp,{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(Ce,{className:"bg-blue-500/10 border-blue-500/30",children:t.jsx(ke,{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(Rs,{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(he,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Be,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(td,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),t.jsx(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Be,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(od,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Be,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(En,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),t.jsx(ke,{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:"绑定有效期"})]})]})})]})]}),r==="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(Br,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(ie,{value:N,onChange:I=>k(I.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:R,onChange:I=>b(I.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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{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:me.map(I=>{var re,fe;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:[(re=I.id)==null?void 0:re.slice(0,12),"..."]}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:I.userNickname}),t.jsx("p",{className:"text-gray-500 text-xs",children:I.userPhone})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:(()=>{const Ee=I.productType||I.type;return Ee==="fullbook"?`${I.bookName||"《底层逻辑》"} - 全本`:Ee==="match"?"匹配次数购买":`${I.bookName||"《底层逻辑》"} - ${I.sectionTitle||I.chapterTitle||`章节${I.productId||I.sectionId||""}`}`})()}),t.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Ee=I.productType||I.type;return Ee==="fullbook"?"全书解锁":Ee==="match"?"功能权益":I.chapterTitle||"单章购买"})()})]})}),t.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof I.amount=="number"?I.amount.toFixed(2):parseFloat(String(I.amount||"0")).toFixed(2)]}),t.jsx("td",{className:"p-4 text-gray-300",children:I.paymentMethod==="wechat"?"微信支付":I.paymentMethod==="alipay"?"支付宝":I.paymentMethod||"微信支付"}),t.jsx("td",{className:"p-4",children:I.status==="refunded"?t.jsx(Le,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):I.status==="completed"||I.status==="paid"?t.jsx(Le,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):I.status==="pending"||I.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:I.refundReason,children:I.status==="refunded"&&I.refundReason?I.refundReason:"-"}),t.jsx("td",{className:"p-4 text-gray-300 text-sm",children:I.referrerId||I.referralCode?t.jsxs("span",{title:I.referralCode||I.referrerCode||I.referrerId||"",children:[I.referrerNickname||I.referralCode||I.referrerCode||((fe=I.referrerId)==null?void 0:fe.slice(0,8)),(I.referralCode||I.referrerCode)&&` (${I.referralCode||I.referrerCode})`]}):"-"}),t.jsx("td",{className:"p-4 text-[#FFD700]",children:I.referrerEarnings?`¥${(typeof I.referrerEarnings=="number"?I.referrerEarnings:parseFloat(String(I.referrerEarnings))).toFixed(2)}`:"-"}),t.jsx("td",{className:"p-4 text-gray-400 text-sm",children:I.createdAt?new Date(I.createdAt).toLocaleString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:(I.status==="paid"||I.status==="completed")&&t.jsxs(he,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{ue(I),W("")},children:[t.jsx(mp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},I.id)})})]})}),r==="orders"&&t.jsx(Vr,{page:T,totalPages:be,total:V,pageSize:G,onPageChange:B,onPageSizeChange:I=>{M(I),B(1)}})]})})]}),r==="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(Br,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(ie,{value:N,onChange:I=>k(I.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:R,onChange:I=>b(I.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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{className:"p-0",children:[Y.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:Y.map(I=>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:I.refereeNickname||"匿名用户"}),t.jsx("p",{className:"text-gray-500 text-xs",children:I.refereePhone})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white",children:I.referrerName||"-"}),t.jsx("p",{className:"text-gray-500 text-xs font-mono",children:I.referrerCode})]})}),t.jsx("td",{className:"p-4 text-gray-400",children:I.boundAt?new Date(I.boundAt).toLocaleDateString("zh-CN"):"-"}),t.jsx("td",{className:"p-4 text-gray-400",children:I.expiresAt?new Date(I.expiresAt).toLocaleDateString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:oe(I.status)}),t.jsx("td",{className:"p-4",children:I.commission?t.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",I.commission.toFixed(2)]}):t.jsx("span",{className:"text-gray-500",children:"-"})})]},I.id))})]})}),r==="bindings"&&t.jsx(Vr,{page:T,totalPages:be,total:V,pageSize:G,onPageChange:B,onPageSizeChange:I=>{M(I),B(1)}})]})})]}),r==="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(Br,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(ie,{value:N,onChange:I=>k(I.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:R,onChange:I=>b(I.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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{className:"p-0",children:[xe.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:xe.map(I=>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:[I.userAvatar?t.jsx("img",{src:I.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:(I.userName||I.name||"?").slice(0,1)}),t.jsx("p",{className:"text-white font-medium",children:I.userName||I.name})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",I.amount.toFixed(2)]})}),t.jsx("td",{className:"p-4",children:t.jsx(Le,{className:I.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:I.method==="wechat"?"微信":"支付宝"})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-mono text-xs",children:I.account}),t.jsx("p",{className:"text-gray-500 text-xs",children:I.name})]})}),t.jsx("td",{className:"p-4 text-gray-400",children:I.createdAt?new Date(I.createdAt).toLocaleString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:oe(I.status)}),t.jsx("td",{className:"p-4 text-right",children:I.status==="pending"&&t.jsxs("div",{className:"flex gap-2 justify-end",children:[t.jsxs(he,{size:"sm",onClick:()=>S(I.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(nd,{className:"w-4 h-4 mr-1"}),"通过"]}),t.jsxs(he,{size:"sm",variant:"outline",onClick:()=>O(I.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[t.jsx(kw,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},I.id))})]})}),r==="withdrawals"&&t.jsx(Vr,{page:T,totalPages:be,total:V,pageSize:G,onPageChange:B,onPageSizeChange:I=>{M(I),B(1)}})]})})]})]}),t.jsx(tn,{open:!!le,onOpenChange:I=>!I&&ue(null),children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(nn,{children:t.jsx(rn,{className:"text-white",children:"订单退款"})}),le&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",le.orderSn||le.id]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof le.amount=="number"?le.amount.toFixed(2):parseFloat(String(le.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(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:H,onChange:I=>W(I.target.value)})})]}),t.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),t.jsxs(mn,{children:[t.jsx(he,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>ue(null),disabled:Q,children:"取消"}),t.jsx(he,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:se,disabled:Q,children:Q?"退款中...":"确认退款"})]})]})})]})}function i2(){const[r,a]=p.useState([]),[l,i]=p.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[c,u]=p.useState(!0),[f,m]=p.useState(null),[x,y]=p.useState("all"),[g,v]=p.useState(1),[E,P]=p.useState(10),[C,j]=p.useState(0),[N,k]=p.useState(null);async function R(){var M,V,ee,de,ce,le,ue;u(!0),m(null);try{const H=new URLSearchParams({status:x,page:String(g),pageSize:String(E)}),W=await He(`/api/admin/withdrawals?${H}`);if(W!=null&&W.success){const Q=W.withdrawals||[];a(Q),j(W.total??((M=W.stats)==null?void 0:M.total)??Q.length),i({total:((V=W.stats)==null?void 0:V.total)??W.total??Q.length,pendingCount:((ee=W.stats)==null?void 0:ee.pendingCount)??0,pendingAmount:((de=W.stats)==null?void 0:de.pendingAmount)??0,successCount:((ce=W.stats)==null?void 0:ce.successCount)??0,successAmount:((le=W.stats)==null?void 0:le.successAmount)??0,failedCount:((ue=W.stats)==null?void 0:ue.failedCount)??0})}else m("加载提现记录失败")}catch(H){console.error("Load withdrawals error:",H),m("加载失败,请检查网络后重试")}finally{u(!1)}}p.useEffect(()=>{v(1)},[x]),p.useEffect(()=>{R()},[x,g,E]);const b=Math.ceil(C/E)||1;async function T(M){const V=r.find(ee=>ee.id===M);if(V!=null&&V.userCommissionInfo&&V.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${V.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 - -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(M);try{const ee=await Wt("/api/admin/withdrawals",{id:M,action:"approve"});ee!=null&&ee.success?R():alert("操作失败: "+((ee==null?void 0:ee.error)??""))}catch{alert("操作失败")}finally{k(null)}}async function B(M){const V=prompt("请输入拒绝原因(将返还用户余额):");if(V){k(M);try{const ee=await Wt("/api/admin/withdrawals",{id:M,action:"reject",errorMessage:V});ee!=null&&ee.success?R():alert("操作失败: "+((ee==null?void 0:ee.error)??""))}catch{alert("操作失败")}finally{k(null)}}}function G(M){switch(M){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:M})}}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:()=>m(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(he,{variant:"outline",onClick:R,disabled:c,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(st,{className:`w-4 h-4 mr-2 ${c?"animate-spin":""}`}),"刷新"]})]}),t.jsx(Ce,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:t.jsx(ke,{className:"p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(uo,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{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(M=>t.jsx(he,{variant:x===M?"default":"outline",size:"sm",onClick:()=>y(M),className:x===M?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:M==="all"?"全部":M==="pending"?"待处理":M==="success"?"已完成":"已拒绝"},M))}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(ke,{className:"p-0",children:c?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(st,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):r.length===0?t.jsxs("div",{className:"text-center py-12",children:[t.jsx(Rs,{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:r.map(M=>t.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[t.jsx("td",{className:"p-4 text-gray-400",children:new Date(M.createdAt??"").toLocaleString()}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{className:"flex items-center gap-2",children:[M.userAvatar?t.jsx("img",{src:M.userAvatar,alt:M.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:(M.userName??"?").charAt(0)}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-white",children:M.userName??"未知"}),t.jsx("p",{className:"text-xs text-gray-500",children:M.userPhone??M.referralCode??(M.userId??"").slice(0,10)})]})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(M.amount).toFixed(2)]})}),t.jsx("td",{className:"p-4",children:M.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:["¥",M.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:["¥",M.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:["¥",M.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:M.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",M.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):t.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),t.jsxs("td",{className:"p-4",children:[G(M.status),M.errorMessage&&t.jsx("p",{className:"text-xs text-red-400 mt-1",children:M.errorMessage})]}),t.jsx("td",{className:"p-4 text-gray-400",children:M.processedAt?new Date(M.processedAt).toLocaleString():"-"}),t.jsx("td",{className:"p-4 text-gray-400",children:M.userConfirmedAt?t.jsxs("span",{className:"text-green-400",title:M.userConfirmedAt,children:["已确认 ",new Date(M.userConfirmedAt).toLocaleString()]}):"-"}),t.jsxs("td",{className:"p-4 text-right",children:[(M.status==="pending"||M.status==="pending_confirm")&&t.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t.jsxs(he,{size:"sm",onClick:()=>T(M.id),disabled:N===M.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[t.jsx(Co,{className:"w-4 h-4 mr-1"}),"批准"]}),t.jsxs(he,{size:"sm",variant:"outline",onClick:()=>B(M.id),disabled:N===M.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[t.jsx(zn,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(M.status==="success"||M.status==="completed")&&M.transactionId&&t.jsx("span",{className:"text-xs text-gray-500 font-mono",children:M.transactionId})]})]},M.id))})]})}),t.jsx(Vr,{page:g,totalPages:b,total:C,pageSize:E,onPageChange:v,onPageSizeChange:M=>{P(M),v(1)}})]})})})]})}const ks=p.forwardRef(({className:r,...a},l)=>t.jsx("textarea",{className:Ge("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",r),ref:l,...a}));ks.displayName="Textarea";function go(r,[a,l]){return Math.min(l,Math.max(a,r))}const c2=["top","right","bottom","left"],gr=Math.min,Ut=Math.max,vo=Math.round,no=Math.floor,kn=r=>({x:r,y:r}),d2={left:"right",right:"left",bottom:"top",top:"bottom"},u2={start:"end",end:"start"};function fd(r,a,l){return Ut(r,gr(a,l))}function $n(r,a){return typeof r=="function"?r(a):r}function Bn(r){return r.split("-")[0]}function Fs(r){return r.split("-")[1]}function Kd(r){return r==="x"?"y":"x"}function Gd(r){return r==="y"?"height":"width"}const f2=new Set(["top","bottom"]);function Cn(r){return f2.has(Bn(r))?"y":"x"}function Qd(r){return Kd(Cn(r))}function h2(r,a,l){l===void 0&&(l=!1);const i=Fs(r),c=Qd(r),u=Gd(c);let f=c==="x"?i===(l?"end":"start")?"right":"left":i==="start"?"bottom":"top";return a.reference[u]>a.floating[u]&&(f=yo(f)),[f,yo(f)]}function m2(r){const a=yo(r);return[hd(r),a,hd(a)]}function hd(r){return r.replace(/start|end/g,a=>u2[a])}const Om=["left","right"],Dm=["right","left"],p2=["top","bottom"],x2=["bottom","top"];function g2(r,a,l){switch(r){case"top":case"bottom":return l?a?Dm:Om:a?Om:Dm;case"left":case"right":return a?p2:x2;default:return[]}}function v2(r,a,l,i){const c=Fs(r);let u=g2(Bn(r),l==="start",i);return c&&(u=u.map(f=>f+"-"+c),a&&(u=u.concat(u.map(hd)))),u}function yo(r){return r.replace(/left|right|bottom|top/g,a=>d2[a])}function y2(r){return{top:0,right:0,bottom:0,left:0,...r}}function Dx(r){return typeof r!="number"?y2(r):{top:r,right:r,bottom:r,left:r}}function wo(r){const{x:a,y:l,width:i,height:c}=r;return{width:i,height:c,top:l,left:a,right:a+i,bottom:l+c,x:a,y:l}}function Fm(r,a,l){let{reference:i,floating:c}=r;const u=Cn(a),f=Qd(a),m=Gd(f),x=Bn(a),y=u==="y",g=i.x+i.width/2-c.width/2,v=i.y+i.height/2-c.height/2,E=i[m]/2-c[m]/2;let P;switch(x){case"top":P={x:g,y:i.y-c.height};break;case"bottom":P={x:g,y:i.y+i.height};break;case"right":P={x:i.x+i.width,y:v};break;case"left":P={x:i.x-c.width,y:v};break;default:P={x:i.x,y:i.y}}switch(Fs(a)){case"start":P[f]-=E*(l&&y?-1:1);break;case"end":P[f]+=E*(l&&y?-1:1);break}return P}async function w2(r,a){var l;a===void 0&&(a={});const{x:i,y:c,platform:u,rects:f,elements:m,strategy:x}=r,{boundary:y="clippingAncestors",rootBoundary:g="viewport",elementContext:v="floating",altBoundary:E=!1,padding:P=0}=$n(a,r),C=Dx(P),N=m[E?v==="floating"?"reference":"floating":v],k=wo(await u.getClippingRect({element:(l=await(u.isElement==null?void 0:u.isElement(N)))==null||l?N:N.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(m.floating)),boundary:y,rootBoundary:g,strategy:x})),R=v==="floating"?{x:i,y:c,width:f.floating.width,height:f.floating.height}:f.reference,b=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m.floating)),T=await(u.isElement==null?void 0:u.isElement(b))?await(u.getScale==null?void 0:u.getScale(b))||{x:1,y:1}:{x:1,y:1},B=wo(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:m,rect:R,offsetParent:b,strategy:x}):R);return{top:(k.top-B.top+C.top)/T.y,bottom:(B.bottom-k.bottom+C.bottom)/T.y,left:(k.left-B.left+C.left)/T.x,right:(B.right-k.right+C.right)/T.x}}const j2=async(r,a,l)=>{const{placement:i="bottom",strategy:c="absolute",middleware:u=[],platform:f}=l,m=u.filter(Boolean),x=await(f.isRTL==null?void 0:f.isRTL(a));let y=await f.getElementRects({reference:r,floating:a,strategy:c}),{x:g,y:v}=Fm(y,i,x),E=i,P={},C=0;for(let N=0;N({name:"arrow",options:r,async fn(a){const{x:l,y:i,placement:c,rects:u,platform:f,elements:m,middlewareData:x}=a,{element:y,padding:g=0}=$n(r,a)||{};if(y==null)return{};const v=Dx(g),E={x:l,y:i},P=Qd(c),C=Gd(P),j=await f.getDimensions(y),N=P==="y",k=N?"top":"left",R=N?"bottom":"right",b=N?"clientHeight":"clientWidth",T=u.reference[C]+u.reference[P]-E[P]-u.floating[C],B=E[P]-u.reference[P],G=await(f.getOffsetParent==null?void 0:f.getOffsetParent(y));let M=G?G[b]:0;(!M||!await(f.isElement==null?void 0:f.isElement(G)))&&(M=m.floating[b]||u.floating[C]);const V=T/2-B/2,ee=M/2-j[C]/2-1,de=gr(v[k],ee),ce=gr(v[R],ee),le=de,ue=M-j[C]-ce,H=M/2-j[C]/2+V,W=fd(le,H,ue),Q=!x.arrow&&Fs(c)!=null&&H!==W&&u.reference[C]/2-(HH<=0)){var ce,le;const H=(((ce=u.flip)==null?void 0:ce.index)||0)+1,W=M[H];if(W&&(!(v==="alignment"?R!==Cn(W):!1)||de.every(A=>Cn(A.placement)===R?A.overflows[0]>0:!0)))return{data:{index:H,overflows:de},reset:{placement:W}};let Q=(le=de.filter(K=>K.overflows[0]<=0).sort((K,A)=>K.overflows[1]-A.overflows[1])[0])==null?void 0:le.placement;if(!Q)switch(P){case"bestFit":{var ue;const K=(ue=de.filter(A=>{if(G){const X=Cn(A.placement);return X===R||X==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(X=>X>0).reduce((X,$)=>X+$,0)]).sort((A,X)=>A[1]-X[1])[0])==null?void 0:ue[0];K&&(Q=K);break}case"initialPlacement":Q=m;break}if(c!==Q)return{reset:{placement:Q}}}return{}}}};function zm(r,a){return{top:r.top-a.height,right:r.right-a.width,bottom:r.bottom-a.height,left:r.left-a.width}}function $m(r){return c2.some(a=>r[a]>=0)}const S2=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(a){const{rects:l,platform:i}=a,{strategy:c="referenceHidden",...u}=$n(r,a);switch(c){case"referenceHidden":{const f=await i.detectOverflow(a,{...u,elementContext:"reference"}),m=zm(f,l.reference);return{data:{referenceHiddenOffsets:m,referenceHidden:$m(m)}}}case"escaped":{const f=await i.detectOverflow(a,{...u,altBoundary:!0}),m=zm(f,l.floating);return{data:{escapedOffsets:m,escaped:$m(m)}}}default:return{}}}}},Fx=new Set(["left","top"]);async function C2(r,a){const{placement:l,platform:i,elements:c}=r,u=await(i.isRTL==null?void 0:i.isRTL(c.floating)),f=Bn(l),m=Fs(l),x=Cn(l)==="y",y=Fx.has(f)?-1:1,g=u&&x?-1:1,v=$n(a,r);let{mainAxis:E,crossAxis:P,alignmentAxis:C}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return m&&typeof C=="number"&&(P=m==="end"?C*-1:C),x?{x:P*g,y:E*y}:{x:E*y,y:P*g}}const k2=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(a){var l,i;const{x:c,y:u,placement:f,middlewareData:m}=a,x=await C2(a,r);return f===((l=m.offset)==null?void 0:l.placement)&&(i=m.arrow)!=null&&i.alignmentOffset?{}:{x:c+x.x,y:u+x.y,data:{...x,placement:f}}}}},E2=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(a){const{x:l,y:i,placement:c,platform:u}=a,{mainAxis:f=!0,crossAxis:m=!1,limiter:x={fn:k=>{let{x:R,y:b}=k;return{x:R,y:b}}},...y}=$n(r,a),g={x:l,y:i},v=await u.detectOverflow(a,y),E=Cn(Bn(c)),P=Kd(E);let C=g[P],j=g[E];if(f){const k=P==="y"?"top":"left",R=P==="y"?"bottom":"right",b=C+v[k],T=C-v[R];C=fd(b,C,T)}if(m){const k=E==="y"?"top":"left",R=E==="y"?"bottom":"right",b=j+v[k],T=j-v[R];j=fd(b,j,T)}const N=x.fn({...a,[P]:C,[E]:j});return{...N,data:{x:N.x-l,y:N.y-i,enabled:{[P]:f,[E]:m}}}}}},P2=function(r){return r===void 0&&(r={}),{options:r,fn(a){const{x:l,y:i,placement:c,rects:u,middlewareData:f}=a,{offset:m=0,mainAxis:x=!0,crossAxis:y=!0}=$n(r,a),g={x:l,y:i},v=Cn(c),E=Kd(v);let P=g[E],C=g[v];const j=$n(m,a),N=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(x){const b=E==="y"?"height":"width",T=u.reference[E]-u.floating[b]+N.mainAxis,B=u.reference[E]+u.reference[b]-N.mainAxis;PB&&(P=B)}if(y){var k,R;const b=E==="y"?"width":"height",T=Fx.has(Bn(c)),B=u.reference[v]-u.floating[b]+(T&&((k=f.offset)==null?void 0:k[v])||0)+(T?0:N.crossAxis),G=u.reference[v]+u.reference[b]+(T?0:((R=f.offset)==null?void 0:R[v])||0)-(T?N.crossAxis:0);CG&&(C=G)}return{[E]:P,[v]:C}}}},R2=function(r){return r===void 0&&(r={}),{name:"size",options:r,async fn(a){var l,i;const{placement:c,rects:u,platform:f,elements:m}=a,{apply:x=()=>{},...y}=$n(r,a),g=await f.detectOverflow(a,y),v=Bn(c),E=Fs(c),P=Cn(c)==="y",{width:C,height:j}=u.floating;let N,k;v==="top"||v==="bottom"?(N=v,k=E===(await(f.isRTL==null?void 0:f.isRTL(m.floating))?"start":"end")?"left":"right"):(k=v,N=E==="end"?"top":"bottom");const R=j-g.top-g.bottom,b=C-g.left-g.right,T=gr(j-g[N],R),B=gr(C-g[k],b),G=!a.middlewareData.shift;let M=T,V=B;if((l=a.middlewareData.shift)!=null&&l.enabled.x&&(V=b),(i=a.middlewareData.shift)!=null&&i.enabled.y&&(M=R),G&&!E){const de=Ut(g.left,0),ce=Ut(g.right,0),le=Ut(g.top,0),ue=Ut(g.bottom,0);P?V=C-2*(de!==0||ce!==0?de+ce:Ut(g.left,g.right)):M=j-2*(le!==0||ue!==0?le+ue:Ut(g.top,g.bottom))}await x({...a,availableWidth:V,availableHeight:M});const ee=await f.getDimensions(m.floating);return C!==ee.width||j!==ee.height?{reset:{rects:!0}}:{}}}};function Lo(){return typeof window<"u"}function zs(r){return zx(r)?(r.nodeName||"").toLowerCase():"#document"}function Kt(r){var a;return(r==null||(a=r.ownerDocument)==null?void 0:a.defaultView)||window}function Rn(r){var a;return(a=(zx(r)?r.ownerDocument:r.document)||window.document)==null?void 0:a.documentElement}function zx(r){return Lo()?r instanceof Node||r instanceof Kt(r).Node:!1}function xn(r){return Lo()?r instanceof Element||r instanceof Kt(r).Element:!1}function Pn(r){return Lo()?r instanceof HTMLElement||r instanceof Kt(r).HTMLElement:!1}function Bm(r){return!Lo()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof Kt(r).ShadowRoot}const _2=new Set(["inline","contents"]);function za(r){const{overflow:a,overflowX:l,overflowY:i,display:c}=gn(r);return/auto|scroll|overlay|hidden|clip/.test(a+i+l)&&!_2.has(c)}const T2=new Set(["table","td","th"]);function I2(r){return T2.has(zs(r))}const A2=[":popover-open",":modal"];function Oo(r){return A2.some(a=>{try{return r.matches(a)}catch{return!1}})}const M2=["transform","translate","scale","rotate","perspective"],L2=["transform","translate","scale","rotate","perspective","filter"],O2=["paint","layout","strict","content"];function Yd(r){const a=qd(),l=xn(r)?gn(r):r;return M2.some(i=>l[i]?l[i]!=="none":!1)||(l.containerType?l.containerType!=="normal":!1)||!a&&(l.backdropFilter?l.backdropFilter!=="none":!1)||!a&&(l.filter?l.filter!=="none":!1)||L2.some(i=>(l.willChange||"").includes(i))||O2.some(i=>(l.contain||"").includes(i))}function D2(r){let a=vr(r);for(;Pn(a)&&!_s(a);){if(Yd(a))return a;if(Oo(a))return null;a=vr(a)}return null}function qd(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const F2=new Set(["html","body","#document"]);function _s(r){return F2.has(zs(r))}function gn(r){return Kt(r).getComputedStyle(r)}function Do(r){return xn(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function vr(r){if(zs(r)==="html")return r;const a=r.assignedSlot||r.parentNode||Bm(r)&&r.host||Rn(r);return Bm(a)?a.host:a}function $x(r){const a=vr(r);return _s(a)?r.ownerDocument?r.ownerDocument.body:r.body:Pn(a)&&za(a)?a:$x(a)}function Ma(r,a,l){var i;a===void 0&&(a=[]),l===void 0&&(l=!0);const c=$x(r),u=c===((i=r.ownerDocument)==null?void 0:i.body),f=Kt(c);if(u){const m=md(f);return a.concat(f,f.visualViewport||[],za(c)?c:[],m&&l?Ma(m):[])}return a.concat(c,Ma(c,[],l))}function md(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function Bx(r){const a=gn(r);let l=parseFloat(a.width)||0,i=parseFloat(a.height)||0;const c=Pn(r),u=c?r.offsetWidth:l,f=c?r.offsetHeight:i,m=vo(l)!==u||vo(i)!==f;return m&&(l=u,i=f),{width:l,height:i,$:m}}function Xd(r){return xn(r)?r:r.contextElement}function Es(r){const a=Xd(r);if(!Pn(a))return kn(1);const l=a.getBoundingClientRect(),{width:i,height:c,$:u}=Bx(a);let f=(u?vo(l.width):l.width)/i,m=(u?vo(l.height):l.height)/c;return(!f||!Number.isFinite(f))&&(f=1),(!m||!Number.isFinite(m))&&(m=1),{x:f,y:m}}const z2=kn(0);function Vx(r){const a=Kt(r);return!qd()||!a.visualViewport?z2:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function $2(r,a,l){return a===void 0&&(a=!1),!l||a&&l!==Kt(r)?!1:a}function Kr(r,a,l,i){a===void 0&&(a=!1),l===void 0&&(l=!1);const c=r.getBoundingClientRect(),u=Xd(r);let f=kn(1);a&&(i?xn(i)&&(f=Es(i)):f=Es(r));const m=$2(u,l,i)?Vx(u):kn(0);let x=(c.left+m.x)/f.x,y=(c.top+m.y)/f.y,g=c.width/f.x,v=c.height/f.y;if(u){const E=Kt(u),P=i&&xn(i)?Kt(i):i;let C=E,j=md(C);for(;j&&i&&P!==C;){const N=Es(j),k=j.getBoundingClientRect(),R=gn(j),b=k.left+(j.clientLeft+parseFloat(R.paddingLeft))*N.x,T=k.top+(j.clientTop+parseFloat(R.paddingTop))*N.y;x*=N.x,y*=N.y,g*=N.x,v*=N.y,x+=b,y+=T,C=Kt(j),j=md(C)}}return wo({width:g,height:v,x,y})}function Fo(r,a){const l=Do(r).scrollLeft;return a?a.left+l:Kr(Rn(r)).left+l}function Ux(r,a){const l=r.getBoundingClientRect(),i=l.left+a.scrollLeft-Fo(r,l),c=l.top+a.scrollTop;return{x:i,y:c}}function B2(r){let{elements:a,rect:l,offsetParent:i,strategy:c}=r;const u=c==="fixed",f=Rn(i),m=a?Oo(a.floating):!1;if(i===f||m&&u)return l;let x={scrollLeft:0,scrollTop:0},y=kn(1);const g=kn(0),v=Pn(i);if((v||!v&&!u)&&((zs(i)!=="body"||za(f))&&(x=Do(i)),Pn(i))){const P=Kr(i);y=Es(i),g.x=P.x+i.clientLeft,g.y=P.y+i.clientTop}const E=f&&!v&&!u?Ux(f,x):kn(0);return{width:l.width*y.x,height:l.height*y.y,x:l.x*y.x-x.scrollLeft*y.x+g.x+E.x,y:l.y*y.y-x.scrollTop*y.y+g.y+E.y}}function V2(r){return Array.from(r.getClientRects())}function U2(r){const a=Rn(r),l=Do(r),i=r.ownerDocument.body,c=Ut(a.scrollWidth,a.clientWidth,i.scrollWidth,i.clientWidth),u=Ut(a.scrollHeight,a.clientHeight,i.scrollHeight,i.clientHeight);let f=-l.scrollLeft+Fo(r);const m=-l.scrollTop;return gn(i).direction==="rtl"&&(f+=Ut(a.clientWidth,i.clientWidth)-c),{width:c,height:u,x:f,y:m}}const Vm=25;function W2(r,a){const l=Kt(r),i=Rn(r),c=l.visualViewport;let u=i.clientWidth,f=i.clientHeight,m=0,x=0;if(c){u=c.width,f=c.height;const g=qd();(!g||g&&a==="fixed")&&(m=c.offsetLeft,x=c.offsetTop)}const y=Fo(i);if(y<=0){const g=i.ownerDocument,v=g.body,E=getComputedStyle(v),P=g.compatMode==="CSS1Compat"&&parseFloat(E.marginLeft)+parseFloat(E.marginRight)||0,C=Math.abs(i.clientWidth-v.clientWidth-P);C<=Vm&&(u-=C)}else y<=Vm&&(u+=y);return{width:u,height:f,x:m,y:x}}const H2=new Set(["absolute","fixed"]);function K2(r,a){const l=Kr(r,!0,a==="fixed"),i=l.top+r.clientTop,c=l.left+r.clientLeft,u=Pn(r)?Es(r):kn(1),f=r.clientWidth*u.x,m=r.clientHeight*u.y,x=c*u.x,y=i*u.y;return{width:f,height:m,x,y}}function Um(r,a,l){let i;if(a==="viewport")i=W2(r,l);else if(a==="document")i=U2(Rn(r));else if(xn(a))i=K2(a,l);else{const c=Vx(r);i={x:a.x-c.x,y:a.y-c.y,width:a.width,height:a.height}}return wo(i)}function Wx(r,a){const l=vr(r);return l===a||!xn(l)||_s(l)?!1:gn(l).position==="fixed"||Wx(l,a)}function G2(r,a){const l=a.get(r);if(l)return l;let i=Ma(r,[],!1).filter(m=>xn(m)&&zs(m)!=="body"),c=null;const u=gn(r).position==="fixed";let f=u?vr(r):r;for(;xn(f)&&!_s(f);){const m=gn(f),x=Yd(f);!x&&m.position==="fixed"&&(c=null),(u?!x&&!c:!x&&m.position==="static"&&!!c&&H2.has(c.position)||za(f)&&!x&&Wx(r,f))?i=i.filter(g=>g!==f):c=m,f=vr(f)}return a.set(r,i),i}function Q2(r){let{element:a,boundary:l,rootBoundary:i,strategy:c}=r;const f=[...l==="clippingAncestors"?Oo(a)?[]:G2(a,this._c):[].concat(l),i],m=f[0],x=f.reduce((y,g)=>{const v=Um(a,g,c);return y.top=Ut(v.top,y.top),y.right=gr(v.right,y.right),y.bottom=gr(v.bottom,y.bottom),y.left=Ut(v.left,y.left),y},Um(a,m,c));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}}function Y2(r){const{width:a,height:l}=Bx(r);return{width:a,height:l}}function q2(r,a,l){const i=Pn(a),c=Rn(a),u=l==="fixed",f=Kr(r,!0,u,a);let m={scrollLeft:0,scrollTop:0};const x=kn(0);function y(){x.x=Fo(c)}if(i||!i&&!u)if((zs(a)!=="body"||za(c))&&(m=Do(a)),i){const P=Kr(a,!0,u,a);x.x=P.x+a.clientLeft,x.y=P.y+a.clientTop}else c&&y();u&&!i&&c&&y();const g=c&&!i&&!u?Ux(c,m):kn(0),v=f.left+m.scrollLeft-x.x-g.x,E=f.top+m.scrollTop-x.y-g.y;return{x:v,y:E,width:f.width,height:f.height}}function Qc(r){return gn(r).position==="static"}function Wm(r,a){if(!Pn(r)||gn(r).position==="fixed")return null;if(a)return a(r);let l=r.offsetParent;return Rn(r)===l&&(l=l.ownerDocument.body),l}function Hx(r,a){const l=Kt(r);if(Oo(r))return l;if(!Pn(r)){let c=vr(r);for(;c&&!_s(c);){if(xn(c)&&!Qc(c))return c;c=vr(c)}return l}let i=Wm(r,a);for(;i&&I2(i)&&Qc(i);)i=Wm(i,a);return i&&_s(i)&&Qc(i)&&!Yd(i)?l:i||D2(r)||l}const X2=async function(r){const a=this.getOffsetParent||Hx,l=this.getDimensions,i=await l(r.floating);return{reference:q2(r.reference,await a(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function J2(r){return gn(r).direction==="rtl"}const Z2={convertOffsetParentRelativeRectToViewportRelativeRect:B2,getDocumentElement:Rn,getClippingRect:Q2,getOffsetParent:Hx,getElementRects:X2,getClientRects:V2,getDimensions:Y2,getScale:Es,isElement:xn,isRTL:J2};function Kx(r,a){return r.x===a.x&&r.y===a.y&&r.width===a.width&&r.height===a.height}function eS(r,a){let l=null,i;const c=Rn(r);function u(){var m;clearTimeout(i),(m=l)==null||m.disconnect(),l=null}function f(m,x){m===void 0&&(m=!1),x===void 0&&(x=1),u();const y=r.getBoundingClientRect(),{left:g,top:v,width:E,height:P}=y;if(m||a(),!E||!P)return;const C=no(v),j=no(c.clientWidth-(g+E)),N=no(c.clientHeight-(v+P)),k=no(g),b={rootMargin:-C+"px "+-j+"px "+-N+"px "+-k+"px",threshold:Ut(0,gr(1,x))||1};let T=!0;function B(G){const M=G[0].intersectionRatio;if(M!==x){if(!T)return f();M?f(!1,M):i=setTimeout(()=>{f(!1,1e-7)},1e3)}M===1&&!Kx(y,r.getBoundingClientRect())&&f(),T=!1}try{l=new IntersectionObserver(B,{...b,root:c.ownerDocument})}catch{l=new IntersectionObserver(B,b)}l.observe(r)}return f(!0),u}function tS(r,a,l,i){i===void 0&&(i={});const{ancestorScroll:c=!0,ancestorResize:u=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:m=typeof IntersectionObserver=="function",animationFrame:x=!1}=i,y=Xd(r),g=c||u?[...y?Ma(y):[],...Ma(a)]:[];g.forEach(k=>{c&&k.addEventListener("scroll",l,{passive:!0}),u&&k.addEventListener("resize",l)});const v=y&&m?eS(y,l):null;let E=-1,P=null;f&&(P=new ResizeObserver(k=>{let[R]=k;R&&R.target===y&&P&&(P.unobserve(a),cancelAnimationFrame(E),E=requestAnimationFrame(()=>{var b;(b=P)==null||b.observe(a)})),l()}),y&&!x&&P.observe(y),P.observe(a));let C,j=x?Kr(r):null;x&&N();function N(){const k=Kr(r);j&&!Kx(j,k)&&l(),j=k,C=requestAnimationFrame(N)}return l(),()=>{var k;g.forEach(R=>{c&&R.removeEventListener("scroll",l),u&&R.removeEventListener("resize",l)}),v==null||v(),(k=P)==null||k.disconnect(),P=null,x&&cancelAnimationFrame(C)}}const nS=k2,rS=E2,sS=N2,aS=R2,lS=S2,Hm=b2,oS=P2,iS=(r,a,l)=>{const i=new Map,c={platform:Z2,...l},u={...c.platform,_c:i};return j2(r,a,{...c,platform:u})};var cS=typeof document<"u",dS=function(){},lo=cS?p.useLayoutEffect:dS;function jo(r,a){if(r===a)return!0;if(typeof r!=typeof a)return!1;if(typeof r=="function"&&r.toString()===a.toString())return!0;let l,i,c;if(r&&a&&typeof r=="object"){if(Array.isArray(r)){if(l=r.length,l!==a.length)return!1;for(i=l;i--!==0;)if(!jo(r[i],a[i]))return!1;return!0}if(c=Object.keys(r),l=c.length,l!==Object.keys(a).length)return!1;for(i=l;i--!==0;)if(!{}.hasOwnProperty.call(a,c[i]))return!1;for(i=l;i--!==0;){const u=c[i];if(!(u==="_owner"&&r.$$typeof)&&!jo(r[u],a[u]))return!1}return!0}return r!==r&&a!==a}function Gx(r){return typeof window>"u"?1:(r.ownerDocument.defaultView||window).devicePixelRatio||1}function Km(r,a){const l=Gx(r);return Math.round(a*l)/l}function Yc(r){const a=p.useRef(r);return lo(()=>{a.current=r}),a}function uS(r){r===void 0&&(r={});const{placement:a="bottom",strategy:l="absolute",middleware:i=[],platform:c,elements:{reference:u,floating:f}={},transform:m=!0,whileElementsMounted:x,open:y}=r,[g,v]=p.useState({x:0,y:0,strategy:l,placement:a,middlewareData:{},isPositioned:!1}),[E,P]=p.useState(i);jo(E,i)||P(i);const[C,j]=p.useState(null),[N,k]=p.useState(null),R=p.useCallback(A=>{A!==G.current&&(G.current=A,j(A))},[]),b=p.useCallback(A=>{A!==M.current&&(M.current=A,k(A))},[]),T=u||C,B=f||N,G=p.useRef(null),M=p.useRef(null),V=p.useRef(g),ee=x!=null,de=Yc(x),ce=Yc(c),le=Yc(y),ue=p.useCallback(()=>{if(!G.current||!M.current)return;const A={placement:a,strategy:l,middleware:E};ce.current&&(A.platform=ce.current),iS(G.current,M.current,A).then(X=>{const $={...X,isPositioned:le.current!==!1};H.current&&!jo(V.current,$)&&(V.current=$,La.flushSync(()=>{v($)}))})},[E,a,l,ce,le]);lo(()=>{y===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,v(A=>({...A,isPositioned:!1})))},[y]);const H=p.useRef(!1);lo(()=>(H.current=!0,()=>{H.current=!1}),[]),lo(()=>{if(T&&(G.current=T),B&&(M.current=B),T&&B){if(de.current)return de.current(T,B,ue);ue()}},[T,B,ue,de,ee]);const W=p.useMemo(()=>({reference:G,floating:M,setReference:R,setFloating:b}),[R,b]),Q=p.useMemo(()=>({reference:T,floating:B}),[T,B]),K=p.useMemo(()=>{const A={position:l,left:0,top:0};if(!Q.floating)return A;const X=Km(Q.floating,g.x),$=Km(Q.floating,g.y);return m?{...A,transform:"translate("+X+"px, "+$+"px)",...Gx(Q.floating)>=1.5&&{willChange:"transform"}}:{position:l,left:X,top:$}},[l,m,Q.floating,g.x,g.y]);return p.useMemo(()=>({...g,update:ue,refs:W,elements:Q,floatingStyles:K}),[g,ue,W,Q,K])}const fS=r=>{function a(l){return{}.hasOwnProperty.call(l,"current")}return{name:"arrow",options:r,fn(l){const{element:i,padding:c}=typeof r=="function"?r(l):r;return i&&a(i)?i.current!=null?Hm({element:i.current,padding:c}).fn(l):{}:i?Hm({element:i,padding:c}).fn(l):{}}}},hS=(r,a)=>({...nS(r),options:[r,a]}),mS=(r,a)=>({...rS(r),options:[r,a]}),pS=(r,a)=>({...oS(r),options:[r,a]}),xS=(r,a)=>({...sS(r),options:[r,a]}),gS=(r,a)=>({...aS(r),options:[r,a]}),vS=(r,a)=>({...lS(r),options:[r,a]}),yS=(r,a)=>({...fS(r),options:[r,a]});var wS="Arrow",Qx=p.forwardRef((r,a)=>{const{children:l,width:i=10,height:c=5,...u}=r;return t.jsx(Oe.svg,{...u,ref:a,width:i,height:c,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:r.asChild?l:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});Qx.displayName=wS;var jS=Qx,Jd="Popper",[Yx,qx]=wr(Jd),[bS,Xx]=Yx(Jd),Jx=r=>{const{__scopePopper:a,children:l}=r,[i,c]=p.useState(null);return t.jsx(bS,{scope:a,anchor:i,onAnchorChange:c,children:l})};Jx.displayName=Jd;var Zx="PopperAnchor",eg=p.forwardRef((r,a)=>{const{__scopePopper:l,virtualRef:i,...c}=r,u=Xx(Zx,l),f=p.useRef(null),m=Ke(a,f),x=p.useRef(null);return p.useEffect(()=>{const y=x.current;x.current=(i==null?void 0:i.current)||f.current,y!==x.current&&u.onAnchorChange(x.current)}),i?null:t.jsx(Oe.div,{...c,ref:m})});eg.displayName=Zx;var Zd="PopperContent",[NS,SS]=Yx(Zd),tg=p.forwardRef((r,a)=>{var Y,xe,I,re,fe,Ee;const{__scopePopper:l,side:i="bottom",sideOffset:c=0,align:u="center",alignOffset:f=0,arrowPadding:m=0,avoidCollisions:x=!0,collisionBoundary:y=[],collisionPadding:g=0,sticky:v="partial",hideWhenDetached:E=!1,updatePositionStrategy:P="optimized",onPlaced:C,...j}=r,N=Xx(Zd,l),[k,R]=p.useState(null),b=Ke(a,Ie=>R(Ie)),[T,B]=p.useState(null),G=Vd(T),M=(G==null?void 0:G.width)??0,V=(G==null?void 0:G.height)??0,ee=i+(u!=="center"?"-"+u:""),de=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},ce=Array.isArray(y)?y:[y],le=ce.length>0,ue={padding:de,boundary:ce.filter(kS),altBoundary:le},{refs:H,floatingStyles:W,placement:Q,isPositioned:K,middlewareData:A}=uS({strategy:"fixed",placement:ee,whileElementsMounted:(...Ie)=>tS(...Ie,{animationFrame:P==="always"}),elements:{reference:N.anchor},middleware:[hS({mainAxis:c+V,alignmentAxis:f}),x&&mS({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?pS():void 0,...ue}),x&&xS({...ue}),gS({...ue,apply:({elements:Ie,rects:De,availableWidth:Ye,availableHeight:tt})=>{const{width:Ze,height:Tt}=De.reference,It=Ie.floating.style;It.setProperty("--radix-popper-available-width",`${Ye}px`),It.setProperty("--radix-popper-available-height",`${tt}px`),It.setProperty("--radix-popper-anchor-width",`${Ze}px`),It.setProperty("--radix-popper-anchor-height",`${Tt}px`)}}),T&&yS({element:T,padding:m}),ES({arrowWidth:M,arrowHeight:V}),E&&vS({strategy:"referenceHidden",...ue})]}),[X,$]=sg(Q),S=xr(C);Et(()=>{K&&(S==null||S())},[K,S]);const O=(Y=A.arrow)==null?void 0:Y.x,se=(xe=A.arrow)==null?void 0:xe.y,oe=((I=A.arrow)==null?void 0:I.centerOffset)!==0,[be,me]=p.useState();return Et(()=>{k&&me(window.getComputedStyle(k).zIndex)},[k]),t.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...W,transform:K?W.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(re=A.transformOrigin)==null?void 0:re.x,(fe=A.transformOrigin)==null?void 0:fe.y].join(" "),...((Ee=A.hide)==null?void 0:Ee.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:r.dir,children:t.jsx(NS,{scope:l,placedSide:X,onArrowChange:B,arrowX:O,arrowY:se,shouldHideArrow:oe,children:t.jsx(Oe.div,{"data-side":X,"data-align":$,...j,ref:b,style:{...j.style,animation:K?void 0:"none"}})})})});tg.displayName=Zd;var ng="PopperArrow",CS={top:"bottom",right:"left",bottom:"top",left:"right"},rg=p.forwardRef(function(a,l){const{__scopePopper:i,...c}=a,u=SS(ng,i),f=CS[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(jS,{...c,ref:l,style:{...c.style,display:"block"}})})});rg.displayName=ng;function kS(r){return r!==null}var ES=r=>({name:"transformOrigin",options:r,fn(a){var N,k,R;const{placement:l,rects:i,middlewareData:c}=a,f=((N=c.arrow)==null?void 0:N.centerOffset)!==0,m=f?0:r.arrowWidth,x=f?0:r.arrowHeight,[y,g]=sg(l),v={start:"0%",center:"50%",end:"100%"}[g],E=(((k=c.arrow)==null?void 0:k.x)??0)+m/2,P=(((R=c.arrow)==null?void 0:R.y)??0)+x/2;let C="",j="";return y==="bottom"?(C=f?v:`${E}px`,j=`${-x}px`):y==="top"?(C=f?v:`${E}px`,j=`${i.floating.height+x}px`):y==="right"?(C=`${-x}px`,j=f?v:`${P}px`):y==="left"&&(C=`${i.floating.width+x}px`,j=f?v:`${P}px`),{data:{x:C,y:j}}}});function sg(r){const[a,l="center"]=r.split("-");return[a,l]}var PS=Jx,RS=eg,_S=tg,TS=rg,ag=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"}),IS="VisuallyHidden",AS=p.forwardRef((r,a)=>t.jsx(Oe.span,{...r,ref:a,style:{...ag,...r.style}}));AS.displayName=IS;var MS=[" ","Enter","ArrowUp","ArrowDown"],LS=[" ","Enter"],Gr="Select",[zo,$o,OS]=Ud(Gr),[$s]=wr(Gr,[OS,qx]),Bo=qx(),[DS,jr]=$s(Gr),[FS,zS]=$s(Gr),lg=r=>{const{__scopeSelect:a,children:l,open:i,defaultOpen:c,onOpenChange:u,value:f,defaultValue:m,onValueChange:x,dir:y,name:g,autoComplete:v,disabled:E,required:P,form:C}=r,j=Bo(a),[N,k]=p.useState(null),[R,b]=p.useState(null),[T,B]=p.useState(!1),G=Io(y),[M,V]=Wr({prop:i,defaultProp:c??!1,onChange:u,caller:Gr}),[ee,de]=Wr({prop:f,defaultProp:m,onChange:x,caller:Gr}),ce=p.useRef(null),le=N?C||!!N.closest("form"):!0,[ue,H]=p.useState(new Set),W=Array.from(ue).map(Q=>Q.props.value).join(";");return t.jsx(PS,{...j,children:t.jsxs(DS,{required:P,scope:a,trigger:N,onTriggerChange:k,valueNode:R,onValueNodeChange:b,valueNodeHasChildren:T,onValueNodeHasChildrenChange:B,contentId:pr(),value:ee,onValueChange:de,open:M,onOpenChange:V,dir:G,triggerPointerDownPosRef:ce,disabled:E,children:[t.jsx(zo.Provider,{scope:a,children:t.jsx(FS,{scope:r.__scopeSelect,onNativeOptionAdd:p.useCallback(Q=>{H(K=>new Set(K).add(Q))},[]),onNativeOptionRemove:p.useCallback(Q=>{H(K=>{const A=new Set(K);return A.delete(Q),A})},[]),children:l})}),le?t.jsxs(Pg,{"aria-hidden":!0,required:P,tabIndex:-1,name:g,autoComplete:v,value:ee,onChange:Q=>de(Q.target.value),disabled:E,form:C,children:[ee===void 0?t.jsx("option",{value:""}):null,Array.from(ue)]},W):null]})})};lg.displayName=Gr;var og="SelectTrigger",ig=p.forwardRef((r,a)=>{const{__scopeSelect:l,disabled:i=!1,...c}=r,u=Bo(l),f=jr(og,l),m=f.disabled||i,x=Ke(a,f.onTriggerChange),y=$o(l),g=p.useRef("touch"),[v,E,P]=_g(j=>{const N=y().filter(b=>!b.disabled),k=N.find(b=>b.value===f.value),R=Tg(N,j,k);R!==void 0&&f.onValueChange(R.value)}),C=j=>{m||(f.onOpenChange(!0),P()),j&&(f.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return t.jsx(RS,{asChild:!0,...u,children:t.jsx(Oe.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:m,"data-disabled":m?"":void 0,"data-placeholder":Rg(f.value)?"":void 0,...c,ref:x,onClick:Te(c.onClick,j=>{j.currentTarget.focus(),g.current!=="mouse"&&C(j)}),onPointerDown:Te(c.onPointerDown,j=>{g.current=j.pointerType;const N=j.target;N.hasPointerCapture(j.pointerId)&&N.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(C(j),j.preventDefault())}),onKeyDown:Te(c.onKeyDown,j=>{const N=v.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&E(j.key),!(N&&j.key===" ")&&MS.includes(j.key)&&(C(),j.preventDefault())})})})});ig.displayName=og;var cg="SelectValue",dg=p.forwardRef((r,a)=>{const{__scopeSelect:l,className:i,style:c,children:u,placeholder:f="",...m}=r,x=jr(cg,l),{onValueNodeHasChildrenChange:y}=x,g=u!==void 0,v=Ke(a,x.onValueNodeChange);return Et(()=>{y(g)},[y,g]),t.jsx(Oe.span,{...m,ref:v,style:{pointerEvents:"none"},children:Rg(x.value)?t.jsx(t.Fragment,{children:f}):u})});dg.displayName=cg;var $S="SelectIcon",ug=p.forwardRef((r,a)=>{const{__scopeSelect:l,children:i,...c}=r;return t.jsx(Oe.span,{"aria-hidden":!0,...c,ref:a,children:i||"▼"})});ug.displayName=$S;var BS="SelectPortal",fg=r=>t.jsx(Od,{asChild:!0,...r});fg.displayName=BS;var Qr="SelectContent",hg=p.forwardRef((r,a)=>{const l=jr(Qr,r.__scopeSelect),[i,c]=p.useState();if(Et(()=>{c(new DocumentFragment)},[]),!l.open){const u=i;return u?La.createPortal(t.jsx(mg,{scope:r.__scopeSelect,children:t.jsx(zo.Slot,{scope:r.__scopeSelect,children:t.jsx("div",{children:r.children})})}),u):null}return t.jsx(pg,{...r,ref:a})});hg.displayName=Qr;var hn=10,[mg,br]=$s(Qr),VS="SelectContentImpl",US=Aa("SelectContent.RemoveScroll"),pg=p.forwardRef((r,a)=>{const{__scopeSelect:l,position:i="item-aligned",onCloseAutoFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,side:m,sideOffset:x,align:y,alignOffset:g,arrowPadding:v,collisionBoundary:E,collisionPadding:P,sticky:C,hideWhenDetached:j,avoidCollisions:N,...k}=r,R=jr(Qr,l),[b,T]=p.useState(null),[B,G]=p.useState(null),M=Ke(a,Y=>T(Y)),[V,ee]=p.useState(null),[de,ce]=p.useState(null),le=$o(l),[ue,H]=p.useState(!1),W=p.useRef(!1);p.useEffect(()=>{if(b)return Kp(b)},[b]),Dp();const Q=p.useCallback(Y=>{const[xe,...I]=le().map(Ee=>Ee.ref.current),[re]=I.slice(-1),fe=document.activeElement;for(const Ee of Y)if(Ee===fe||(Ee==null||Ee.scrollIntoView({block:"nearest"}),Ee===xe&&B&&(B.scrollTop=0),Ee===re&&B&&(B.scrollTop=B.scrollHeight),Ee==null||Ee.focus(),document.activeElement!==fe))return},[le,B]),K=p.useCallback(()=>Q([V,b]),[Q,V,b]);p.useEffect(()=>{ue&&K()},[ue,K]);const{onOpenChange:A,triggerPointerDownPosRef:X}=R;p.useEffect(()=>{if(b){let Y={x:0,y:0};const xe=re=>{var fe,Ee;Y={x:Math.abs(Math.round(re.pageX)-(((fe=X.current)==null?void 0:fe.x)??0)),y:Math.abs(Math.round(re.pageY)-(((Ee=X.current)==null?void 0:Ee.y)??0))}},I=re=>{Y.x<=10&&Y.y<=10?re.preventDefault():b.contains(re.target)||A(!1),document.removeEventListener("pointermove",xe),X.current=null};return X.current!==null&&(document.addEventListener("pointermove",xe),document.addEventListener("pointerup",I,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",I,{capture:!0})}}},[b,A,X]),p.useEffect(()=>{const Y=()=>A(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[A]);const[$,S]=_g(Y=>{const xe=le().filter(fe=>!fe.disabled),I=xe.find(fe=>fe.ref.current===document.activeElement),re=Tg(xe,Y,I);re&&setTimeout(()=>re.ref.current.focus())}),O=p.useCallback((Y,xe,I)=>{const re=!W.current&&!I;(R.value!==void 0&&R.value===xe||re)&&(ee(Y),re&&(W.current=!0))},[R.value]),se=p.useCallback(()=>b==null?void 0:b.focus(),[b]),oe=p.useCallback((Y,xe,I)=>{const re=!W.current&&!I;(R.value!==void 0&&R.value===xe||re)&&ce(Y)},[R.value]),be=i==="popper"?pd:xg,me=be===pd?{side:m,sideOffset:x,align:y,alignOffset:g,arrowPadding:v,collisionBoundary:E,collisionPadding:P,sticky:C,hideWhenDetached:j,avoidCollisions:N}:{};return t.jsx(mg,{scope:l,content:b,viewport:B,onViewportChange:G,itemRefCallback:O,selectedItem:V,onItemLeave:se,itemTextRefCallback:oe,focusSelectedItem:K,selectedItemText:de,position:i,isPositioned:ue,searchRef:$,children:t.jsx(Dd,{as:US,allowPinchZoom:!0,children:t.jsx(Ld,{asChild:!0,trapped:R.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:Te(c,Y=>{var xe;(xe=R.trigger)==null||xe.focus({preventScroll:!0}),Y.preventDefault()}),children:t.jsx(Md,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:t.jsx(be,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:Y=>Y.preventDefault(),...k,...me,onPlaced:()=>H(!0),ref:M,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Te(k.onKeyDown,Y=>{const xe=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!xe&&Y.key.length===1&&S(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let re=le().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){const fe=Y.target,Ee=re.indexOf(fe);re=re.slice(Ee+1)}setTimeout(()=>Q(re)),Y.preventDefault()}})})})})})})});pg.displayName=VS;var WS="SelectItemAlignedPosition",xg=p.forwardRef((r,a)=>{const{__scopeSelect:l,onPlaced:i,...c}=r,u=jr(Qr,l),f=br(Qr,l),[m,x]=p.useState(null),[y,g]=p.useState(null),v=Ke(a,M=>g(M)),E=$o(l),P=p.useRef(!1),C=p.useRef(!0),{viewport:j,selectedItem:N,selectedItemText:k,focusSelectedItem:R}=f,b=p.useCallback(()=>{if(u.trigger&&u.valueNode&&m&&y&&j&&N&&k){const M=u.trigger.getBoundingClientRect(),V=y.getBoundingClientRect(),ee=u.valueNode.getBoundingClientRect(),de=k.getBoundingClientRect();if(u.dir!=="rtl"){const fe=de.left-V.left,Ee=ee.left-fe,Ie=M.left-Ee,De=M.width+Ie,Ye=Math.max(De,V.width),tt=window.innerWidth-hn,Ze=go(Ee,[hn,Math.max(hn,tt-Ye)]);m.style.minWidth=De+"px",m.style.left=Ze+"px"}else{const fe=V.right-de.right,Ee=window.innerWidth-ee.right-fe,Ie=window.innerWidth-M.right-Ee,De=M.width+Ie,Ye=Math.max(De,V.width),tt=window.innerWidth-hn,Ze=go(Ee,[hn,Math.max(hn,tt-Ye)]);m.style.minWidth=De+"px",m.style.right=Ze+"px"}const ce=E(),le=window.innerHeight-hn*2,ue=j.scrollHeight,H=window.getComputedStyle(y),W=parseInt(H.borderTopWidth,10),Q=parseInt(H.paddingTop,10),K=parseInt(H.borderBottomWidth,10),A=parseInt(H.paddingBottom,10),X=W+Q+ue+A+K,$=Math.min(N.offsetHeight*5,X),S=window.getComputedStyle(j),O=parseInt(S.paddingTop,10),se=parseInt(S.paddingBottom,10),oe=M.top+M.height/2-hn,be=le-oe,me=N.offsetHeight/2,Y=N.offsetTop+me,xe=W+Q+Y,I=X-xe;if(xe<=oe){const fe=ce.length>0&&N===ce[ce.length-1].ref.current;m.style.bottom="0px";const Ee=y.clientHeight-j.offsetTop-j.offsetHeight,Ie=Math.max(be,me+(fe?se:0)+Ee+K),De=xe+Ie;m.style.height=De+"px"}else{const fe=ce.length>0&&N===ce[0].ref.current;m.style.top="0px";const Ie=Math.max(oe,W+j.offsetTop+(fe?O:0)+me)+I;m.style.height=Ie+"px",j.scrollTop=xe-oe+j.offsetTop}m.style.margin=`${hn}px 0`,m.style.minHeight=$+"px",m.style.maxHeight=le+"px",i==null||i(),requestAnimationFrame(()=>P.current=!0)}},[E,u.trigger,u.valueNode,m,y,j,N,k,u.dir,i]);Et(()=>b(),[b]);const[T,B]=p.useState();Et(()=>{y&&B(window.getComputedStyle(y).zIndex)},[y]);const G=p.useCallback(M=>{M&&C.current===!0&&(b(),R==null||R(),C.current=!1)},[b,R]);return t.jsx(KS,{scope:l,contentWrapper:m,shouldExpandOnScrollRef:P,onScrollButtonChange:G,children:t.jsx("div",{ref:x,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:t.jsx(Oe.div,{...c,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});xg.displayName=WS;var HS="SelectPopperPosition",pd=p.forwardRef((r,a)=>{const{__scopeSelect:l,align:i="start",collisionPadding:c=hn,...u}=r,f=Bo(l);return t.jsx(_S,{...f,...u,ref:a,align:i,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)"}})});pd.displayName=HS;var[KS,eu]=$s(Qr,{}),xd="SelectViewport",gg=p.forwardRef((r,a)=>{const{__scopeSelect:l,nonce:i,...c}=r,u=br(xd,l),f=eu(xd,l),m=Ke(a,u.onViewportChange),x=p.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:i}),t.jsx(zo.Slot,{scope:l,children:t.jsx(Oe.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:m,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:Te(c.onScroll,y=>{const g=y.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:E}=f;if(E!=null&&E.current&&v){const P=Math.abs(x.current-g.scrollTop);if(P>0){const C=window.innerHeight-hn*2,j=parseFloat(v.style.minHeight),N=parseFloat(v.style.height),k=Math.max(j,N);if(k0?T:0,v.style.justifyContent="flex-end")}}}x.current=g.scrollTop})})})]})});gg.displayName=xd;var vg="SelectGroup",[GS,QS]=$s(vg),YS=p.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r,c=pr();return t.jsx(GS,{scope:l,id:c,children:t.jsx(Oe.div,{role:"group","aria-labelledby":c,...i,ref:a})})});YS.displayName=vg;var yg="SelectLabel",qS=p.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r,c=QS(yg,l);return t.jsx(Oe.div,{id:c.id,...i,ref:a})});qS.displayName=yg;var bo="SelectItem",[XS,wg]=$s(bo),jg=p.forwardRef((r,a)=>{const{__scopeSelect:l,value:i,disabled:c=!1,textValue:u,...f}=r,m=jr(bo,l),x=br(bo,l),y=m.value===i,[g,v]=p.useState(u??""),[E,P]=p.useState(!1),C=Ke(a,R=>{var b;return(b=x.itemRefCallback)==null?void 0:b.call(x,R,i,c)}),j=pr(),N=p.useRef("touch"),k=()=>{c||(m.onValueChange(i),m.onOpenChange(!1))};if(i==="")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(XS,{scope:l,value:i,disabled:c,textId:j,isSelected:y,onItemTextChange:p.useCallback(R=>{v(b=>b||((R==null?void 0:R.textContent)??"").trim())},[]),children:t.jsx(zo.ItemSlot,{scope:l,value:i,disabled:c,textValue:g,children:t.jsx(Oe.div,{role:"option","aria-labelledby":j,"data-highlighted":E?"":void 0,"aria-selected":y&&E,"data-state":y?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...f,ref:C,onFocus:Te(f.onFocus,()=>P(!0)),onBlur:Te(f.onBlur,()=>P(!1)),onClick:Te(f.onClick,()=>{N.current!=="mouse"&&k()}),onPointerUp:Te(f.onPointerUp,()=>{N.current==="mouse"&&k()}),onPointerDown:Te(f.onPointerDown,R=>{N.current=R.pointerType}),onPointerMove:Te(f.onPointerMove,R=>{var b;N.current=R.pointerType,c?(b=x.onItemLeave)==null||b.call(x):N.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(f.onPointerLeave,R=>{var b;R.currentTarget===document.activeElement&&((b=x.onItemLeave)==null||b.call(x))}),onKeyDown:Te(f.onKeyDown,R=>{var T;((T=x.searchRef)==null?void 0:T.current)!==""&&R.key===" "||(LS.includes(R.key)&&k(),R.key===" "&&R.preventDefault())})})})})});jg.displayName=bo;var _a="SelectItemText",bg=p.forwardRef((r,a)=>{const{__scopeSelect:l,className:i,style:c,...u}=r,f=jr(_a,l),m=br(_a,l),x=wg(_a,l),y=zS(_a,l),[g,v]=p.useState(null),E=Ke(a,k=>v(k),x.onItemTextChange,k=>{var R;return(R=m.itemTextRefCallback)==null?void 0:R.call(m,k,x.value,x.disabled)}),P=g==null?void 0:g.textContent,C=p.useMemo(()=>t.jsx("option",{value:x.value,disabled:x.disabled,children:P},x.value),[x.disabled,x.value,P]),{onNativeOptionAdd:j,onNativeOptionRemove:N}=y;return Et(()=>(j(C),()=>N(C)),[j,N,C]),t.jsxs(t.Fragment,{children:[t.jsx(Oe.span,{id:x.textId,...u,ref:E}),x.isSelected&&f.valueNode&&!f.valueNodeHasChildren?La.createPortal(u.children,f.valueNode):null]})});bg.displayName=_a;var Ng="SelectItemIndicator",Sg=p.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r;return wg(Ng,l).isSelected?t.jsx(Oe.span,{"aria-hidden":!0,...i,ref:a}):null});Sg.displayName=Ng;var gd="SelectScrollUpButton",Cg=p.forwardRef((r,a)=>{const l=br(gd,r.__scopeSelect),i=eu(gd,r.__scopeSelect),[c,u]=p.useState(!1),f=Ke(a,i.onScrollButtonChange);return Et(()=>{if(l.viewport&&l.isPositioned){let m=function(){const y=x.scrollTop>0;u(y)};const x=l.viewport;return m(),x.addEventListener("scroll",m),()=>x.removeEventListener("scroll",m)}},[l.viewport,l.isPositioned]),c?t.jsx(Eg,{...r,ref:f,onAutoScroll:()=>{const{viewport:m,selectedItem:x}=l;m&&x&&(m.scrollTop=m.scrollTop-x.offsetHeight)}}):null});Cg.displayName=gd;var vd="SelectScrollDownButton",kg=p.forwardRef((r,a)=>{const l=br(vd,r.__scopeSelect),i=eu(vd,r.__scopeSelect),[c,u]=p.useState(!1),f=Ke(a,i.onScrollButtonChange);return Et(()=>{if(l.viewport&&l.isPositioned){let m=function(){const y=x.scrollHeight-x.clientHeight,g=Math.ceil(x.scrollTop)x.removeEventListener("scroll",m)}},[l.viewport,l.isPositioned]),c?t.jsx(Eg,{...r,ref:f,onAutoScroll:()=>{const{viewport:m,selectedItem:x}=l;m&&x&&(m.scrollTop=m.scrollTop+x.offsetHeight)}}):null});kg.displayName=vd;var Eg=p.forwardRef((r,a)=>{const{__scopeSelect:l,onAutoScroll:i,...c}=r,u=br("SelectScrollButton",l),f=p.useRef(null),m=$o(l),x=p.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return p.useEffect(()=>()=>x(),[x]),Et(()=>{var g;const y=m().find(v=>v.ref.current===document.activeElement);(g=y==null?void 0:y.ref.current)==null||g.scrollIntoView({block:"nearest"})},[m]),t.jsx(Oe.div,{"aria-hidden":!0,...c,ref:a,style:{flexShrink:0,...c.style},onPointerDown:Te(c.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(i,50))}),onPointerMove:Te(c.onPointerMove,()=>{var y;(y=u.onItemLeave)==null||y.call(u),f.current===null&&(f.current=window.setInterval(i,50))}),onPointerLeave:Te(c.onPointerLeave,()=>{x()})})}),JS="SelectSeparator",ZS=p.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r;return t.jsx(Oe.div,{"aria-hidden":!0,...i,ref:a})});ZS.displayName=JS;var yd="SelectArrow",eC=p.forwardRef((r,a)=>{const{__scopeSelect:l,...i}=r,c=Bo(l),u=jr(yd,l),f=br(yd,l);return u.open&&f.position==="popper"?t.jsx(TS,{...c,...i,ref:a}):null});eC.displayName=yd;var tC="SelectBubbleInput",Pg=p.forwardRef(({__scopeSelect:r,value:a,...l},i)=>{const c=p.useRef(null),u=Ke(i,c),f=Bd(a);return p.useEffect(()=>{const m=c.current;if(!m)return;const x=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(x,"value").set;if(f!==a&&g){const v=new Event("change",{bubbles:!0});g.call(m,a),m.dispatchEvent(v)}},[f,a]),t.jsx(Oe.select,{...l,style:{...ag,...l.style},ref:u,defaultValue:a})});Pg.displayName=tC;function Rg(r){return r===""||r===void 0}function _g(r){const a=xr(r),l=p.useRef(""),i=p.useRef(0),c=p.useCallback(f=>{const m=l.current+f;a(m),(function x(y){l.current=y,window.clearTimeout(i.current),y!==""&&(i.current=window.setTimeout(()=>x(""),1e3))})(m)},[a]),u=p.useCallback(()=>{l.current="",window.clearTimeout(i.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(i.current),[]),[l,c,u]}function Tg(r,a,l){const c=a.length>1&&Array.from(a).every(y=>y===a[0])?a[0]:a,u=l?r.indexOf(l):-1;let f=nC(r,Math.max(u,0));c.length===1&&(f=f.filter(y=>y!==l));const x=f.find(y=>y.textValue.toLowerCase().startsWith(c.toLowerCase()));return x!==l?x:void 0}function nC(r,a){return r.map((l,i)=>r[(a+i)%r.length])}var rC=lg,Ig=ig,sC=dg,aC=ug,lC=fg,Ag=hg,oC=gg,Mg=jg,iC=bg,cC=Sg,dC=Cg,uC=kg;const qc=rC,Xc=sC,oo=p.forwardRef(({className:r,children:a,...l},i)=>t.jsxs(Ig,{ref:i,className:Ge("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",r),...l,children:[a,t.jsx(aC,{asChild:!0,children:t.jsx(cp,{className:"h-4 w-4 opacity-50"})})]}));oo.displayName=Ig.displayName;const io=p.forwardRef(({className:r,children:a,position:l="popper",...i},c)=>t.jsx(lC,{children:t.jsxs(Ag,{ref:c,className:Ge("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",r),position:l,...i,children:[t.jsx(dC,{className:"flex cursor-default items-center justify-center py-1",children:t.jsx(yw,{className:"h-4 w-4"})}),t.jsx(oC,{className:"p-1",children:a}),t.jsx(uC,{className:"flex cursor-default items-center justify-center py-1",children:t.jsx(cp,{className:"h-4 w-4"})})]})}));io.displayName=Ag.displayName;const fr=p.forwardRef(({className:r,children:a,...l},i)=>t.jsxs(Mg,{ref:i,className:Ge("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",r),...l,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(cC,{children:t.jsx(Co,{className:"h-4 w-4"})})}),t.jsx(iC,{children:a})]}));fr.displayName=Mg.displayName;function fC(r){const a=new Map;for(const l of r){const i=l.partId||"part-1",c=l.partTitle||"未分类",u=l.chapterId||"chapter-1",f=l.chapterTitle||"未分类";a.has(i)||a.set(i,{id:i,title:c,chapters:new Map});const m=a.get(i);m.chapters.has(u)||m.chapters.set(u,{id:u,title:f,sections:[]}),m.chapters.get(u).sections.push({id:l.id,title:l.title,price:l.price??1,filePath:l.filePath,isFree:l.isFree})}return Array.from(a.values()).map(l=>({...l,chapters:Array.from(l.chapters.values())}))}function hC(){const[r,a]=p.useState([]),[l,i]=p.useState(!0),[c,u]=p.useState([]),[f,m]=p.useState(null),[x,y]=p.useState(!1),[g,v]=p.useState(!1),[E,P]=p.useState(!1),[C,j]=p.useState(""),[N,k]=p.useState([]),[R,b]=p.useState(!1),[T,B]=p.useState(!1),G=p.useRef(null),[M,V]=p.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),ee=fC(r),de=r.length,ce=async()=>{i(!0);try{const S=await He("/api/db/book?action=list");a(Array.isArray(S==null?void 0:S.sections)?S.sections:[]),c.length===0&&ee.length>0&&u([ee[0].id])}catch(S){console.error(S),a([])}finally{i(!1)}};p.useEffect(()=>{ce()},[]),p.useEffect(()=>{!l&&ee.length>0&&c.length===0&&u([ee[0].id])},[l,ee.length,c.length]);const le=S=>{u(O=>O.includes(S)?O.filter(se=>se!==S):[...O,S])},ue=async S=>{if(confirm(`确定要删除章节「${S.title}」吗?此操作不可恢复。`))try{const O=await Td(`/api/db/book?id=${encodeURIComponent(S.id)}`);O&&O.success!==!1?(alert("已删除"),ce()):alert("删除失败: "+(O&&typeof O=="object"&&"error"in O?O.error:"未知错误"))}catch(O){console.error(O),alert("删除失败")}},H=async S=>{v(!0);try{const O=await He(`/api/db/book?action=read&id=${encodeURIComponent(S.id)}`);O!=null&&O.success&&O.section?m({id:S.id,title:O.section.title??S.title,price:O.section.price??S.price,content:O.section.content??"",filePath:S.filePath,isFree:S.isFree||S.price===0}):(m({id:S.id,title:S.title,price:S.price,content:"",filePath:S.filePath,isFree:S.isFree}),O&&!O.success&&alert("无法读取文件内容: "+(O.error||"未知错误")))}catch(O){console.error(O),m({id:S.id,title:S.title,price:S.price,content:"",filePath:S.filePath,isFree:S.isFree})}finally{v(!1)}},W=async()=>{var S;if(f){P(!0);try{let O=f.content||"";const se=[new RegExp(`^#+\\s*${f.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${f.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(S=f.title)==null?void 0:S.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const be of se)O=O.replace(be,"");O=O.replace(/^\s*\n+/,"").trim();const oe=await Wt("/api/db/book",{id:f.id,title:f.title,price:f.isFree?0:f.price,content:O,isFree:f.isFree||f.price===0,saveToFile:!0});oe&&oe.success!==!1?(alert(`已保存章节: ${f.title}`),m(null),ce()):alert("保存失败: "+(oe&&typeof oe=="object"&&"error"in oe?oe.error:"未知错误"))}catch(O){console.error(O),alert("保存失败")}finally{P(!1)}}},Q=async()=>{if(!M.id||!M.title){alert("请填写章节ID和标题");return}P(!0);try{const S=await Wt("/api/db/book",{id:M.id,title:M.title,price:M.price,content:M.content,partId:M.partId,chapterId:M.chapterId,saveToFile:!1});S&&S.success!==!1?(alert(`章节创建成功: ${M.title}`),y(!1),V({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),ce()):alert("创建失败: "+(S&&typeof S=="object"&&"error"in S?S.error:"未知错误"))}catch(S){console.error(S),alert("创建失败")}finally{P(!1)}},K=async S=>{var se,oe;const O=(se=S.target.files)==null?void 0:se[0];if(O){B(!0);try{const be=new FormData;be.append("file",O),be.append("folder","book-images");const Y=await(await fetch(pp("/api/upload"),{method:"POST",body:be,credentials:"include"})).json();if(Y!=null&&Y.success&&((oe=Y==null?void 0:Y.data)!=null&&oe.url)){const xe=`![${O.name}](${Y.data.url})`;f&&m({...f,content:(f.content||"")+` - -`+xe}),alert(`图片上传成功: ${Y.data.url}`)}else alert("上传失败: "+((Y==null?void 0:Y.error)||"未知错误"))}catch(be){console.error(be),alert("上传失败")}finally{B(!1),G.current&&(G.current.value="")}}},A=async()=>{var S;if(C.trim()){b(!0);try{const O=await He(`/api/search?q=${encodeURIComponent(C)}`);O!=null&&O.success&&((S=O.data)!=null&&S.results)?k(O.data.results):(k([]),O&&!O.success&&alert("搜索失败: "+O.error))}catch(O){console.error(O),k([]),alert("搜索失败")}finally{b(!1)}}},X=ee.find(S=>S.id===M.partId),$=(X==null?void 0:X.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:["共 ",ee.length," 篇 · ",de," 节内容"]})]}),t.jsx("div",{className:"flex gap-2",children:t.jsxs(he,{onClick:()=>{const S=typeof window<"u"?`${window.location.origin}/api-doc`:"";S&&window.open(S,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(zr,{className:"w-4 h-4 mr-2"}),"API 接口"]})})]}),t.jsx(tn,{open:x,onOpenChange:y,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[t.jsx($r,{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(ne,{className:"text-gray-300",children:"章节ID *"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:M.id,onChange:S=>V({...M,id:S.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"价格 (元)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:M.price,onChange:S=>V({...M,price:Number(S.target.value)})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"章节标题 *"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:M.title,onChange:S=>V({...M,title:S.target.value})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"所属篇"}),t.jsxs(qc,{value:M.partId,onValueChange:S=>V({...M,partId:S,chapterId:"chapter-1"}),children:[t.jsx(oo,{className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(Xc,{})}),t.jsxs(io,{className:"bg-[#0f2137] border-gray-700",children:[ee.map(S=>t.jsx(fr,{value:S.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:S.title},S.id)),ee.length===0&&t.jsx(fr,{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(ne,{className:"text-gray-300",children:"所属章"}),t.jsxs(qc,{value:M.chapterId,onValueChange:S=>V({...M,chapterId:S}),children:[t.jsx(oo,{className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(Xc,{})}),t.jsxs(io,{className:"bg-[#0f2137] border-gray-700",children:[$.map(S=>t.jsx(fr,{value:S.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:S.title},S.id)),$.length===0&&t.jsx(fr,{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(ne,{className:"text-gray-300",children:"内容 (Markdown格式)"}),t.jsx(ks,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[300px] font-mono text-sm placeholder:text-gray-500",placeholder:"输入章节内容...",value:M.content,onChange:S=>V({...M,content:S.target.value})})]})]}),t.jsxs(mn,{children:[t.jsx(he,{variant:"outline",onClick:()=>y(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(he,{onClick:Q,disabled:E||!M.id||!M.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?t.jsxs(t.Fragment,{children:[t.jsx(st,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):t.jsxs(t.Fragment,{children:[t.jsx($r,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),t.jsx(tn,{open:!!f,onOpenChange:()=>m(null),children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[t.jsx(Ur,{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(ne,{className:"text-gray-300",children:"章节ID"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:f.id,disabled:!0})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"价格 (元)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.isFree?0:f.price,onChange:S=>m({...f,price:Number(S.target.value),isFree:Number(S.target.value)===0}),disabled:f.isFree})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{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.isFree||f.price===0,onChange:S=>m({...f,isFree:S.target.checked,price:S.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(ne,{className:"text-gray-300",children:"章节标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:f.title,onChange:S=>m({...f,title:S.target.value})})]}),f.filePath&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"文件路径"}),t.jsx(ie,{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(ne,{className:"text-gray-300",children:"内容 (Markdown格式)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:G,type:"file",accept:"image/*",onChange:K,className:"hidden"}),t.jsxs(he,{variant:"outline",size:"sm",onClick:()=>{var S;return(S=G.current)==null?void 0:S.click()},disabled:T,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[T?t.jsx(st,{className:"w-4 h-4 mr-1 animate-spin"}):t.jsx(Qw,{className:"w-4 h-4 mr-1"}),"上传图片"]})]})]}),g?t.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[t.jsx(st,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsx(ks,{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:S=>m({...f,content:S.target.value})})]})]}),t.jsxs(mn,{children:[t.jsxs(he,{variant:"outline",onClick:()=>m(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(zn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsx(he,{onClick:W,disabled:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?t.jsxs(t.Fragment,{children:[t.jsx(st,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),t.jsxs(Hd,{defaultValue:"chapters",className:"space-y-6",children:[t.jsxs(Mo,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[t.jsxs(Zt,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Ps,{className:"w-4 h-4 mr-2"}),"章节管理"]}),t.jsxs(Zt,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Br,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),t.jsxs(Zt,{value:"hooks",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Cj,{className:"w-4 h-4 mr-2"}),"钩子配置"]})]}),t.jsxs(en,{value:"chapters",className:"space-y-4",children:[t.jsxs(he,{onClick:()=>y(!0),className:"w-full bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[t.jsx($r,{className:"w-4 h-4 mr-2"}),"新建章节"]}),l?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(st,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):ee.map((S,O)=>t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl overflow-hidden",children:[t.jsx(Be,{className:"cursor-pointer hover:bg-[#162840] transition-colors",onClick:()=>le(S.id),children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("span",{className:"text-[#38bdac] font-mono text-sm",children:["0",O+1]}),t.jsx(Ve,{className:"text-white",children:S.title}),t.jsxs(Le,{variant:"outline",className:"text-gray-400 border-gray-600",children:[S.chapters.reduce((se,oe)=>se+oe.sections.length,0)," 节"]})]}),t.jsx(dp,{className:`w-5 h-5 text-gray-400 transition-transform ${c.includes(S.id)?"rotate-90":""}`})]})}),c.includes(S.id)&&t.jsx(ke,{className:"pt-0 pb-4",children:t.jsx("div",{className:"space-y-3 pl-8 border-l-2 border-gray-700",children:S.chapters.map(se=>t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"font-medium text-gray-300",children:se.title}),t.jsx("div",{className:"space-y-1",children:se.sections.map(oe=>t.jsxs("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg hover:bg-[#162840] text-sm group transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(nd,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-gray-400",children:oe.title})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-[#38bdac] font-medium",children:oe.price===0?"免费":`¥${oe.price}`}),t.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>H(oe),className:"text-gray-500 hover:text-[#38bdac] hover:bg-[#38bdac]/10 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(Rd,{className:"w-4 h-4 mr-1"}),"读取"]}),t.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>H(oe),className:"text-gray-500 hover:text-[#38bdac] hover:bg-[#38bdac]/10 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(Ur,{className:"w-4 h-4 mr-1"}),"编辑"]}),t.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>ue(oe),className:"text-gray-500 hover:text-red-400 hover:bg-red-500/10 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(Eo,{className:"w-4 h-4 mr-1"}),"删除"]})]})]},oe.id))})]},se.id))})})]},S.id))]}),t.jsx(en,{value:"search",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"内容搜索"})}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:C,onChange:S=>j(S.target.value),onKeyDown:S=>S.key==="Enter"&&A()}),t.jsx(he,{onClick:A,disabled:R||!C.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:R?t.jsx(st,{className:"w-4 h-4 animate-spin"}):t.jsx(Br,{className:"w-4 h-4"})})]}),N.length>0&&t.jsxs("div",{className:"space-y-2 mt-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",N.length," 个结果"]}),N.map(S=>t.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>H({id:S.id,title:S.title,price:S.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:S.id}),t.jsx("span",{className:"text-white",children:S.title})]}),t.jsx(Le,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:S.matchType==="title"?"标题匹配":"内容匹配"})]}),S.snippet&&t.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:S.snippet}),(S.partTitle||S.chapterTitle)&&t.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[S.partTitle," · ",S.chapterTitle]})]},S.id))]})]})]})}),t.jsx(en,{value:"hooks",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"引流钩子配置"})}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"grid w-full max-w-sm items-center gap-1.5",children:[t.jsx(ne,{htmlFor:"hook-chapter",className:"text-gray-300",children:"触发章节"}),t.jsxs(qc,{defaultValue:"3",children:[t.jsx(oo,{id:"hook-chapter",className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(Xc,{placeholder:"选择章节"})}),t.jsxs(io,{className:"bg-[#0f2137] border-gray-700",children:[t.jsx(fr,{value:"1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第一章"}),t.jsx(fr,{value:"2",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第二章"}),t.jsx(fr,{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(ne,{htmlFor:"message",className:"text-gray-300",children:"引流文案"}),t.jsx(ks,{placeholder:"输入引导用户加群的文案...",id:"message",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",defaultValue:"阅读更多精彩内容,请加入Soul创业实验派对群..."})]}),t.jsx(he,{className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:"保存配置"})]})]})})]})]})}function mC(){const[r,a]=p.useState([]),[l,i]=p.useState(null),[c,u]=p.useState(!0),[f,m]=p.useState(null),[x,y]=p.useState([]),[g,v]=p.useState(null),[E,P]=p.useState(1);async function C(){u(!0),m(null);try{const R=await He("/api/admin/chapters");R!=null&&R.success&&R.data?(a(R.data.structure??[]),i(R.data.stats??null)):m("加载章节失败")}catch(R){console.error("加载章节失败:",R),m("加载失败,请检查网络后重试")}finally{u(!1)}}p.useEffect(()=>{C()},[]);const j=R=>{y(b=>b.includes(R)?b.filter(T=>T!==R):[...b,R])},N=async R=>{try{const b=await bt("/api/admin/chapters",{action:"updatePrice",chapterId:R,data:{price:E}});b!=null&&b.success&&(alert("价格更新成功"),v(null),C())}catch(b){console.error("更新价格失败:",b)}},k=async(R,b)=>{try{const T=await bt("/api/admin/chapters",{action:"toggleFree",chapterId:R,data:{isFree:!b}});T!=null&&T.success&&(alert("状态更新成功"),C())}catch(T){console.error("更新状态失败:",T)}};return c?t.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:t.jsx("div",{className:"text-xl text-gray-400",children:"加载中..."})}):t.jsxs("div",{className:"min-h-screen bg-black text-white",children:[t.jsx("div",{className:"sticky top-0 bg-black/90 backdrop-blur border-b border-white/10 z-50",children:t.jsxs("div",{className:"w-full min-w-[1024px] px-4 py-4 flex items-center justify-between",children:[t.jsx("h1",{className:"text-xl font-bold",children:"章节管理"}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("button",{type:"button",onClick:C,disabled:c,className:"px-4 py-2 bg-white/10 rounded-lg hover:bg-white/20 text-white disabled:opacity-50",children:"刷新"}),t.jsx("button",{type:"button",onClick:()=>y(r.map(R=>R.id)),className:"px-4 py-2 bg-white/10 rounded-lg hover:bg-white/20 text-white",children:"展开全部"}),t.jsx("button",{type:"button",onClick:()=>y([]),className:"px-4 py-2 bg-white/10 rounded-lg hover:bg-white/20 text-white",children:"收起全部"})]})]})}),t.jsxs("div",{className:"w-full min-w-[1024px] px-4 py-8",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:()=>m(null),className:"hover:text-red-300",children:"×"})]}),l&&t.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-8",children:[t.jsxs("div",{className:"bg-gradient-to-br from-cyan-500/20 to-cyan-500/5 border border-cyan-500/30 rounded-xl p-4",children:[t.jsx("div",{className:"text-3xl font-bold text-cyan-400",children:l.totalSections}),t.jsx("div",{className:"text-white/60 text-sm mt-1",children:"总章节数"})]}),t.jsxs("div",{className:"bg-gradient-to-br from-green-500/20 to-green-500/5 border border-green-500/30 rounded-xl p-4",children:[t.jsx("div",{className:"text-3xl font-bold text-green-400",children:l.freeSections}),t.jsx("div",{className:"text-white/60 text-sm mt-1",children:"免费章节"})]}),t.jsxs("div",{className:"bg-gradient-to-br from-yellow-500/20 to-yellow-500/5 border border-yellow-500/30 rounded-xl p-4",children:[t.jsx("div",{className:"text-3xl font-bold text-yellow-400",children:l.paidSections}),t.jsx("div",{className:"text-white/60 text-sm mt-1",children:"付费章节"})]}),t.jsxs("div",{className:"bg-gradient-to-br from-purple-500/20 to-purple-500/5 border border-purple-500/30 rounded-xl p-4",children:[t.jsx("div",{className:"text-3xl font-bold text-purple-400",children:l.totalParts}),t.jsx("div",{className:"text-white/60 text-sm mt-1",children:"篇章数"})]})]}),t.jsx("div",{className:"space-y-4",children:r.map(R=>t.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer hover:bg-white/5",onClick:()=>j(R.id),onKeyDown:b=>b.key==="Enter"&&j(R.id),role:"button",tabIndex:0,children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-2xl",children:R.type==="preface"?"📖":R.type==="epilogue"?"🎬":R.type==="appendix"?"📎":"📚"}),t.jsx("span",{className:"font-semibold text-white",children:R.title}),t.jsxs("span",{className:"text-white/40 text-sm",children:["(",R.chapters.reduce((b,T)=>{var B;return b+(((B=T.sections)==null?void 0:B.length)||1)},0)," 节)"]})]}),t.jsx("span",{className:"text-white/40",children:x.includes(R.id)?"▲":"▼"})]}),x.includes(R.id)&&t.jsx("div",{className:"border-t border-white/10",children:R.chapters.map(b=>t.jsx("div",{className:"border-b border-white/5 last:border-b-0",children:b.sections?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-6 py-3 bg-white/5 text-white/70 font-medium",children:b.title}),t.jsx("div",{className:"divide-y divide-white/5",children:b.sections.map(T=>t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 hover:bg-white/5",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:T.isFree?"text-green-400":"text-yellow-400",children:T.isFree?"🔓":"🔒"}),t.jsx("span",{className:"text-white/80",children:T.id}),t.jsx("span",{className:"text-white/60",children:T.title})]}),t.jsx("div",{className:"flex items-center gap-3",children:g===T.id?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"number",value:E,onChange:B=>P(Number(B.target.value)),className:"w-20 px-2 py-1 bg-white/10 border border-white/20 rounded text-white",min:0,step:.1}),t.jsx("button",{type:"button",onClick:()=>N(T.id),className:"px-3 py-1 bg-cyan-500 text-black rounded text-sm",children:"保存"}),t.jsx("button",{type:"button",onClick:()=>v(null),className:"px-3 py-1 bg-white/20 rounded text-sm text-white",children:"取消"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:`px-2 py-1 rounded text-xs ${T.isFree?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:T.isFree?"免费":`¥${T.price}`}),t.jsx("button",{type:"button",onClick:()=>{v(T.id),P(T.price)},className:"px-2 py-1 text-xs bg-white/10 rounded hover:bg-white/20 text-white",children:"编辑价格"}),t.jsx("button",{type:"button",onClick:()=>k(T.id,T.isFree),className:"px-2 py-1 text-xs bg-white/10 rounded hover:bg-white/20 text-white",children:T.isFree?"设为付费":"设为免费"})]})})]},T.id))})]}):t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 hover:bg-white/5",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:b.isFree?"text-green-400":"text-yellow-400",children:b.isFree?"🔓":"🔒"}),t.jsx("span",{className:"text-white/80",children:b.title})]}),t.jsx("span",{className:`px-2 py-1 rounded text-xs ${b.isFree?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:b.isFree?"免费":`¥${b.price??1}`})]})},b.id))})]},R.id))})]})]})}var Lg=["PageUp","PageDown"],Og=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Dg={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Bs="Slider",[wd,pC,xC]=Ud(Bs),[Fg]=wr(Bs,[xC]),[gC,Vo]=Fg(Bs),zg=p.forwardRef((r,a)=>{const{name:l,min:i=0,max:c=100,step:u=1,orientation:f="horizontal",disabled:m=!1,minStepsBetweenThumbs:x=0,defaultValue:y=[i],value:g,onValueChange:v=()=>{},onValueCommit:E=()=>{},inverted:P=!1,form:C,...j}=r,N=p.useRef(new Set),k=p.useRef(0),b=f==="horizontal"?vC:yC,[T=[],B]=Wr({prop:g,defaultProp:y,onChange:ce=>{var ue;(ue=[...N.current][k.current])==null||ue.focus(),v(ce)}}),G=p.useRef(T);function M(ce){const le=SC(T,ce);de(ce,le)}function V(ce){de(ce,k.current)}function ee(){const ce=G.current[k.current];T[k.current]!==ce&&E(T)}function de(ce,le,{commit:ue}={commit:!1}){const H=PC(u),W=RC(Math.round((ce-i)/u)*u+i,H),Q=go(W,[i,c]);B((K=[])=>{const A=bC(K,Q,le);if(EC(A,x*u)){k.current=A.indexOf(Q);const X=String(A)!==String(K);return X&&ue&&E(A),X?A:K}else return K})}return t.jsx(gC,{scope:r.__scopeSlider,name:l,disabled:m,min:i,max:c,valueIndexToChangeRef:k,thumbs:N.current,values:T,orientation:f,form:C,children:t.jsx(wd.Provider,{scope:r.__scopeSlider,children:t.jsx(wd.Slot,{scope:r.__scopeSlider,children:t.jsx(b,{"aria-disabled":m,"data-disabled":m?"":void 0,...j,ref:a,onPointerDown:Te(j.onPointerDown,()=>{m||(G.current=T)}),min:i,max:c,inverted:P,onSlideStart:m?void 0:M,onSlideMove:m?void 0:V,onSlideEnd:m?void 0:ee,onHomeKeyDown:()=>!m&&de(i,0,{commit:!0}),onEndKeyDown:()=>!m&&de(c,T.length-1,{commit:!0}),onStepKeyDown:({event:ce,direction:le})=>{if(!m){const W=Lg.includes(ce.key)||ce.shiftKey&&Og.includes(ce.key)?10:1,Q=k.current,K=T[Q],A=u*W*le;de(K+A,Q,{commit:!0})}}})})})})});zg.displayName=Bs;var[$g,Bg]=Fg(Bs,{startEdge:"left",endEdge:"right",size:"width",direction:1}),vC=p.forwardRef((r,a)=>{const{min:l,max:i,dir:c,inverted:u,onSlideStart:f,onSlideMove:m,onSlideEnd:x,onStepKeyDown:y,...g}=r,[v,E]=p.useState(null),P=Ke(a,b=>E(b)),C=p.useRef(void 0),j=Io(c),N=j==="ltr",k=N&&!u||!N&&u;function R(b){const T=C.current||v.getBoundingClientRect(),B=[0,T.width],M=tu(B,k?[l,i]:[i,l]);return C.current=T,M(b-T.left)}return t.jsx($g,{scope:r.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:t.jsx(Vg,{dir:j,"data-orientation":"horizontal",...g,ref:P,style:{...g.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const T=R(b.clientX);f==null||f(T)},onSlideMove:b=>{const T=R(b.clientX);m==null||m(T)},onSlideEnd:()=>{C.current=void 0,x==null||x()},onStepKeyDown:b=>{const B=Dg[k?"from-left":"from-right"].includes(b.key);y==null||y({event:b,direction:B?-1:1})}})})}),yC=p.forwardRef((r,a)=>{const{min:l,max:i,inverted:c,onSlideStart:u,onSlideMove:f,onSlideEnd:m,onStepKeyDown:x,...y}=r,g=p.useRef(null),v=Ke(a,g),E=p.useRef(void 0),P=!c;function C(j){const N=E.current||g.current.getBoundingClientRect(),k=[0,N.height],b=tu(k,P?[i,l]:[l,i]);return E.current=N,b(j-N.top)}return t.jsx($g,{scope:r.__scopeSlider,startEdge:P?"bottom":"top",endEdge:P?"top":"bottom",size:"height",direction:P?1:-1,children:t.jsx(Vg,{"data-orientation":"vertical",...y,ref:v,style:{...y.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:j=>{const N=C(j.clientY);u==null||u(N)},onSlideMove:j=>{const N=C(j.clientY);f==null||f(N)},onSlideEnd:()=>{E.current=void 0,m==null||m()},onStepKeyDown:j=>{const k=Dg[P?"from-bottom":"from-top"].includes(j.key);x==null||x({event:j,direction:k?-1:1})}})})}),Vg=p.forwardRef((r,a)=>{const{__scopeSlider:l,onSlideStart:i,onSlideMove:c,onSlideEnd:u,onHomeKeyDown:f,onEndKeyDown:m,onStepKeyDown:x,...y}=r,g=Vo(Bs,l);return t.jsx(Oe.span,{...y,ref:a,onKeyDown:Te(r.onKeyDown,v=>{v.key==="Home"?(f(v),v.preventDefault()):v.key==="End"?(m(v),v.preventDefault()):Lg.concat(Og).includes(v.key)&&(x(v),v.preventDefault())}),onPointerDown:Te(r.onPointerDown,v=>{const E=v.target;E.setPointerCapture(v.pointerId),v.preventDefault(),g.thumbs.has(E)?E.focus():i(v)}),onPointerMove:Te(r.onPointerMove,v=>{v.target.hasPointerCapture(v.pointerId)&&c(v)}),onPointerUp:Te(r.onPointerUp,v=>{const E=v.target;E.hasPointerCapture(v.pointerId)&&(E.releasePointerCapture(v.pointerId),u(v))})})}),Ug="SliderTrack",Wg=p.forwardRef((r,a)=>{const{__scopeSlider:l,...i}=r,c=Vo(Ug,l);return t.jsx(Oe.span,{"data-disabled":c.disabled?"":void 0,"data-orientation":c.orientation,...i,ref:a})});Wg.displayName=Ug;var jd="SliderRange",Hg=p.forwardRef((r,a)=>{const{__scopeSlider:l,...i}=r,c=Vo(jd,l),u=Bg(jd,l),f=p.useRef(null),m=Ke(a,f),x=c.values.length,y=c.values.map(E=>Qg(E,c.min,c.max)),g=x>1?Math.min(...y):0,v=100-Math.max(...y);return t.jsx(Oe.span,{"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,...i,ref:m,style:{...r.style,[u.startEdge]:g+"%",[u.endEdge]:v+"%"}})});Hg.displayName=jd;var bd="SliderThumb",Kg=p.forwardRef((r,a)=>{const l=pC(r.__scopeSlider),[i,c]=p.useState(null),u=Ke(a,m=>c(m)),f=p.useMemo(()=>i?l().findIndex(m=>m.ref.current===i):-1,[l,i]);return t.jsx(wC,{...r,ref:u,index:f})}),wC=p.forwardRef((r,a)=>{const{__scopeSlider:l,index:i,name:c,...u}=r,f=Vo(bd,l),m=Bg(bd,l),[x,y]=p.useState(null),g=Ke(a,R=>y(R)),v=x?f.form||!!x.closest("form"):!0,E=Vd(x),P=f.values[i],C=P===void 0?0:Qg(P,f.min,f.max),j=NC(i,f.values.length),N=E==null?void 0:E[m.size],k=N?CC(N,C,m.direction):0;return p.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",[m.startEdge]:`calc(${C}% + ${k}px)`},children:[t.jsx(wd.ItemSlot,{scope:r.__scopeSlider,children:t.jsx(Oe.span,{role:"slider","aria-label":r["aria-label"]||j,"aria-valuemin":f.min,"aria-valuenow":P,"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:g,style:P===void 0?{display:"none"}:r.style,onFocus:Te(r.onFocus,()=>{f.valueIndexToChangeRef.current=i})})}),v&&t.jsx(Gg,{name:c??(f.name?f.name+(f.values.length>1?"[]":""):void 0),form:f.form,value:P},i)]})});Kg.displayName=bd;var jC="RadioBubbleInput",Gg=p.forwardRef(({__scopeSlider:r,value:a,...l},i)=>{const c=p.useRef(null),u=Ke(c,i),f=Bd(a);return p.useEffect(()=>{const m=c.current;if(!m)return;const x=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(x,"value").set;if(f!==a&&g){const v=new Event("input",{bubbles:!0});g.call(m,a),m.dispatchEvent(v)}},[f,a]),t.jsx(Oe.input,{style:{display:"none"},...l,ref:u,defaultValue:a})});Gg.displayName=jC;function bC(r=[],a,l){const i=[...r];return i[l]=a,i.sort((c,u)=>c-u)}function Qg(r,a,l){const u=100/(l-a)*(r-a);return go(u,[0,100])}function NC(r,a){return a>2?`Value ${r+1} of ${a}`:a===2?["Minimum","Maximum"][r]:void 0}function SC(r,a){if(r.length===1)return 0;const l=r.map(c=>Math.abs(c-a)),i=Math.min(...l);return l.indexOf(i)}function CC(r,a,l){const i=r/2,u=tu([0,50],[0,i]);return(i-u(a)*l)*l}function kC(r){return r.slice(0,-1).map((a,l)=>r[l+1]-a)}function EC(r,a){if(a>0){const l=kC(r);return Math.min(...l)>=a}return!0}function tu(r,a){return l=>{if(r[0]===r[1]||a[0]===a[1])return a[0];const i=(a[1]-a[0])/(r[1]-r[0]);return a[0]+i*(l-r[0])}}function PC(r){return(String(r).split(".")[1]||"").length}function RC(r,a){const l=Math.pow(10,a);return Math.round(r*l)/l}var _C=zg,TC=Wg,IC=Hg,AC=Kg;function MC({className:r,defaultValue:a,value:l,min:i=0,max:c=100,...u}){const f=p.useMemo(()=>Array.isArray(l)?l:Array.isArray(a)?a:[i,c],[l,a,i,c]);return t.jsxs(_C,{defaultValue:a,value:l,min:i,max:c,className:Ge("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",r),...u,children:[t.jsx(TC,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:t.jsx(IC,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:f.length},(m,x)=>t.jsx(AC,{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 LC={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function OC(){const[r,a]=p.useState(LC),[l,i]=p.useState(!0),[c,u]=p.useState(!1);p.useEffect(()=>{He("/api/admin/referral-settings").then(x=>{const y=x==null?void 0:x.data;y&&typeof y=="object"&&a({distributorShare:y.distributorShare??90,minWithdrawAmount:y.minWithdrawAmount??10,bindingDays:y.bindingDays??30,userDiscount:y.userDiscount??5,enableAutoWithdraw:y.enableAutoWithdraw??!1,vipOrderShareVip:y.vipOrderShareVip??20,vipOrderShareNonVip:y.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>i(!1))},[]);const f=async()=>{u(!0);try{const x={distributorShare:Number(r.distributorShare)||0,minWithdrawAmount:Number(r.minWithdrawAmount)||0,bindingDays:Number(r.bindingDays)||0,userDiscount:Number(r.userDiscount)||0,enableAutoWithdraw:!!r.enableAutoWithdraw,vipOrderShareVip:Number(r.vipOrderShareVip)||20,vipOrderShareNonVip:Number(r.vipOrderShareNonVip)||10},y=await bt("/api/admin/referral-settings",x);if(!y||y.success===!1){alert("保存失败: "+(y&&typeof y=="object"&&"error"in y?y.error:""));return}alert(`✅ 分销配置已保存成功! - -• 小程序与网站的推广规则会一起生效 -• 绑定关系会使用新的天数配置 -• 佣金比例会立即应用到新订单 - -如有缓存,请刷新前台/小程序页面。`)}catch(x){console.error(x),alert("保存失败: "+(x instanceof Error?x.message:String(x)))}finally{u(!1)}},m=x=>y=>{const g=parseFloat(y.target.value||"0");a(v=>({...v,[x]:isNaN(g)?0:g}))};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(Rs,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),t.jsxs(he,{onClick:f,disabled:c||l,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"flex items-center gap-2 text-white",children:[t.jsx(pj,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),t.jsx(ft,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),t.jsx(ke,{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(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(Ql,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),t.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.userDiscount,onChange:m("userDiscount")}),t.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(En,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(MC,{className:"flex-1",min:10,max:100,step:1,value:[r.distributorShare],onValueChange:([x])=>a(y=>({...y,distributorShare:x}))}),t.jsx(ie,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:r.distributorShare,onChange:m("distributorShare")})]}),t.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",t.jsxs("span",{className:"text-[#38bdac] font-mono",children:[r.distributorShare,"%"]}),";会员订单见下方。"]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(Ql,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),t.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.vipOrderShareVip,onChange:m("vipOrderShareVip")}),t.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(Ql,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),t.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.vipOrderShareNonVip,onChange:m("vipOrderShareNonVip")}),t.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(En,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),t.jsx(ie,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:r.bindingDays,onChange:m("bindingDays")}),t.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"flex items-center gap-2 text-white",children:[t.jsx(Rs,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),t.jsx(ft,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),t.jsx(ke,{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(ne,{className:"text-gray-300",children:"最低提现金额(元)"}),t.jsx(ie,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:r.minWithdrawAmount,onChange:m("minWithdrawAmount")}),t.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{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(ut,{checked:r.enableAutoWithdraw,onCheckedChange:x=>a(y=>({...y,enableAutoWithdraw:x}))}),t.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Be,{children:t.jsxs(Ve,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[t.jsx(Ql,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),t.jsxs(ke,{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 DC={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},FC={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},zC={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...FC}},$C={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0};function BC(){const[r,a]=p.useState(zC),[l,i]=p.useState(["preface","epilogue","1.1","appendix-1","appendix-2","appendix-3"]),[c,u]=p.useState(""),[f,m]=p.useState($C),[x,y]=p.useState(DC),[g,v]=p.useState(!1),[E,P]=p.useState(!0),[C,j]=p.useState(!1),[N,k]=p.useState(""),[R,b]=p.useState(""),[T,B]=p.useState(!1),[G,M]=p.useState(!1),V=(H,W,Q=!1)=>{k(H),b(W),B(Q),j(!0)};p.useEffect(()=>{(async()=>{try{const W=await He("/api/admin/settings");if(!W||W.success===!1)return;if(Array.isArray(W.freeChapters)&&W.freeChapters.length&&i(W.freeChapters),W.featureConfig&&Object.keys(W.featureConfig).length&&m(Q=>({...Q,...W.featureConfig})),W.mpConfig&&typeof W.mpConfig=="object"&&y(Q=>({...Q,...W.mpConfig})),W.siteSettings&&typeof W.siteSettings=="object"){const Q=W.siteSettings;a(K=>({...K,...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:{...K.authorInfo,...Q.authorInfo}}}))}}catch(W){console.error("Load settings error:",W)}finally{P(!1)}})()},[]);const ee=async(H,W)=>{M(!0);try{const Q=await bt("/api/admin/settings",{featureConfig:H});if(!Q||Q.success===!1){W(),V("保存失败",(Q==null?void 0:Q.error)??"未知错误",!0);return}V("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(Q){console.error("Save feature config error:",Q),W(),V("保存失败",Q instanceof Error?Q.message:String(Q),!0)}finally{M(!1)}},de=(H,W)=>{const Q=f,K={...Q,[H]:W};m(K),ee(K,()=>m(Q))},ce=async()=>{v(!0);try{const H=await bt("/api/admin/settings",{freeChapters:l,featureConfig:f,siteSettings:{sectionPrice:r.sectionPrice,baseBookPrice:r.baseBookPrice,distributorShare:r.distributorShare,authorInfo:r.authorInfo},mpConfig:{...x,appId:x.appId||"",withdrawSubscribeTmplId:x.withdrawSubscribeTmplId||"",mchId:x.mchId||"",minWithdraw:typeof x.minWithdraw=="number"?x.minWithdraw:10}});if(!H||H.success===!1){V("保存失败",(H==null?void 0:H.error)??"未知错误",!0);return}V("已保存","设置已保存成功。")}catch(H){console.error("Save settings error:",H),V("保存失败",H instanceof Error?H.message:String(H),!0)}finally{v(!1)}},le=()=>{c&&!l.includes(c)&&(i([...l,c]),u(""))},ue=H=>{i(l.filter(W=>W!==H))};return E?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(he,{onClick:ce,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存设置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(im,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),t.jsx(ft,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),t.jsxs(ke,{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(ne,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(im,{className:"w-3 h-3"}),"主理人名称"]}),t.jsx(ie,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:r.authorInfo.name??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,name:H.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(td,{className:"w-3 h-3"}),"开播日期"]}),t.jsx(ie,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:r.authorInfo.startDate??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,startDate:H.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(td,{className:"w-3 h-3"}),"直播时间"]}),t.jsx(ie,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:r.authorInfo.liveTime??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,liveTime:H.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(lj,{className:"w-3 h-3"}),"直播平台"]}),t.jsx(ie,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:r.authorInfo.platform??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,platform:H.target.value}}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(Ps,{className:"w-3 h-3"}),"简介描述"]}),t.jsx(ie,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:r.authorInfo.description??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,description:H.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),t.jsx(ks,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:r.authorInfo.bio??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,bio:H.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:(r.authorInfo.name??"K").charAt(0)}),t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-semibold",children:r.authorInfo.name}),t.jsx("p",{className:"text-gray-400 text-xs",children:r.authorInfo.description}),t.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",r.authorInfo.liveTime," · ",r.authorInfo.platform]})]})]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(uo,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),t.jsx(ft,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),t.jsx(ke,{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(ne,{className:"text-gray-300",children:"单节价格 (元)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:r.sectionPrice,onChange:H=>a(W=>({...W,sectionPrice:Number.parseFloat(H.target.value)||1}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"整本价格 (元)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:r.baseBookPrice,onChange:H=>a(W=>({...W,baseBookPrice:Number.parseFloat(H.target.value)||9.9}))})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(ld,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),t.jsx(ft,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),t.jsx(ke,{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(ne,{className:"text-gray-300",children:"小程序 AppID"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:x.appId??"",onChange:H=>y(W=>({...W,appId:H.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"提现订阅模板 ID"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:x.withdrawSubscribeTmplId??"",onChange:H=>y(W=>({...W,withdrawSubscribeTmplId:H.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"微信支付商户号"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:x.mchId??"",onChange:H=>y(W=>({...W,mchId:H.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"最低提现金额 (元)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:x.minWithdraw??10,onChange:H=>y(W=>({...W,minWithdraw:Number.parseFloat(H.target.value)||10}))})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(cm,{className:"w-5 h-5 text-[#38bdac]"}),"免费章节"]}),t.jsx(ft,{className:"text-gray-400",children:"设置哪些章节对所有用户免费开放"})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(H=>t.jsxs("span",{className:"inline-flex items-center gap-1 bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30 px-3 py-1 rounded-md text-sm",children:[H,t.jsx("button",{type:"button",onClick:()=>ue(H),className:"ml-1 hover:text-red-400",children:t.jsx(zn,{className:"w-3 h-3"})})]},H))}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",placeholder:"输入章节ID,如 1.2、2.1、preface",value:c,onChange:H=>u(H.target.value),onKeyDown:H=>H.key==="Enter"&&le()}),t.jsxs(he,{onClick:le,className:"bg-[#38bdac] hover:bg-[#2da396]",children:[t.jsx($r,{className:"w-4 h-4 mr-1"}),"添加"]})]}),t.jsx("p",{className:"text-xs text-gray-500",children:"常用ID: preface(序言), epilogue(尾声), appendix-1/2/3(附录), 1.1/1.2等(章节)"})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(ho,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),t.jsx(ft,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),t.jsxs(ke,{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(En,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(ne,{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(ut,{id:"match-enabled",checked:f.matchEnabled,disabled:G,onCheckedChange:H=>de("matchEnabled",H)})]}),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(cm,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(ne,{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(ut,{id:"referral-enabled",checked:f.referralEnabled,disabled:G,onCheckedChange:H=>de("referralEnabled",H)})]}),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(Ps,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(ne,{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(ut,{id:"search-enabled",checked:f.searchEnabled,disabled:G,onCheckedChange:H=>de("searchEnabled",H)})]}),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(ho,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(ne,{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(ut,{id:"about-enabled",checked:f.aboutEnabled,disabled:G,onCheckedChange:H=>de("aboutEnabled",H)})]})]}),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(tn,{open:C,onOpenChange:j,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[t.jsxs(nn,{children:[t.jsx(rn,{className:T?"text-red-400":"text-[#38bdac]",children:N}),t.jsx(IN,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:R})]}),t.jsx(mn,{className:"mt-4",children:t.jsx(he,{onClick:()=>j(!1),className:T?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const Gm={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 VC(){const[r,a]=p.useState(!1),[l,i]=p.useState(Gm),[c,u]=p.useState(""),f=async()=>{a(!0);try{const k=await He("/api/config");k!=null&&k.paymentMethods&&i({...Gm,...k.paymentMethods})}catch(k){console.error(k)}finally{a(!1)}};p.useEffect(()=>{f()},[]);const m=async()=>{a(!0);try{await bt("/api/db/config",{key:"payment_methods",value:l,description:"支付方式配置"}),alert("配置已保存!")}catch(k){console.error("保存失败:",k),alert("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{a(!1)}},x=(k,R)=>{navigator.clipboard.writeText(k),u(R),setTimeout(()=>u(""),2e3)},y=(k,R)=>{i(b=>({...b,wechat:{...b.wechat,[k]:R}}))},g=(k,R)=>{i(b=>({...b,alipay:{...b.alipay,[k]:R}}))},v=(k,R)=>{i(b=>({...b,usdt:{...b.usdt,[k]:R}}))},E=(k,R)=>{i(b=>({...b,paypal:{...b.paypal,[k]:R}}))},P=l.wechat,C=l.alipay,j=l.usdt,N=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(he,{variant:"outline",onClick:f,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(st,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`}),"同步配置"]}),t.jsxs(he,{onClick:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{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(up,{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(Hd,{defaultValue:"wechat",className:"space-y-6",children:[t.jsxs(Mo,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[t.jsxs(Zt,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[t.jsx(ld,{className:"w-4 h-4 mr-2"}),"微信"]}),t.jsxs(Zt,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[t.jsx(rd,{className:"w-4 h-4 mr-2"}),"支付宝"]}),t.jsxs(Zt,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[t.jsx(om,{className:"w-4 h-4 mr-2"}),"USDT"]}),t.jsxs(Zt,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[t.jsx(sd,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),t.jsx(en,{value:"wechat",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{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(ld,{className:"w-5 h-5"}),"微信支付配置"]}),t.jsx(ft,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),t.jsx(ut,{checked:!!P.enabled,onCheckedChange:k=>y("enabled",k)})]}),t.jsxs(ke,{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(ne,{className:"text-gray-300",children:"网站AppID"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(P.websiteAppId??""),onChange:k=>y("websiteAppId",k.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"商户号"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(P.merchantId??""),onChange:k=>y("merchantId",k.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(fo,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"微信收款码/支付链接"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(P.qrCode??""),onChange:k=>y("qrCode",k.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(ne,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),t.jsx(ie,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(P.groupQrCode??""),onChange:k=>y("groupQrCode",k.target.value)}),t.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),t.jsx(en,{value:"alipay",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{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(rd,{className:"w-5 h-5"}),"支付宝配置"]}),t.jsx(ft,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),t.jsx(ut,{checked:!!C.enabled,onCheckedChange:k=>g("enabled",k)})]}),t.jsxs(ke,{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(ne,{className:"text-gray-300",children:"合作者身份 (PID)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(C.partnerId??""),onChange:k=>g("partnerId",k.target.value)}),t.jsx(he,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>x(String(C.partnerId??""),"pid"),children:c==="pid"?t.jsx(Co,{className:"w-4 h-4 text-green-500"}):t.jsx(hp,{className:"w-4 h-4 text-gray-400"})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"安全校验码 (Key)"}),t.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(C.securityKey??""),onChange:k=>g("securityKey",k.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(fo,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(C.qrCode??""),onChange:k=>g("qrCode",k.target.value)}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),t.jsx(en,{value:"usdt",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{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(om,{className:"w-5 h-5"}),"USDT配置"]}),t.jsx(ft,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),t.jsx(ut,{checked:!!j.enabled,onCheckedChange:k=>v("enabled",k)})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{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(j.network??"TRC20"),onChange:k=>v("network",k.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(ne,{className:"text-gray-300",children:"收款地址"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(j.address??""),onChange:k=>v("address",k.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:k=>v("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),t.jsx(en,{value:"paypal",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{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(sd,{className:"w-5 h-5"}),"PayPal配置"]}),t.jsx(ft,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),t.jsx(ut,{checked:!!N.enabled,onCheckedChange:k=>E("enabled",k)})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"PayPal邮箱"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(N.email??""),onChange:k=>E("email",k.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(N.exchangeRate)??7.2,onChange:k=>E("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const UC={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},WC={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},HC={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function KC(){const[r,a]=p.useState({siteConfig:{...UC},menuConfig:{...WC},pageConfig:{...HC}}),[l,i]=p.useState(!1),[c,u]=p.useState(!1);p.useEffect(()=>{He("/api/config").then(g=>{g!=null&&g.siteConfig&&a(v=>({...v,siteConfig:{...v.siteConfig,...g.siteConfig}})),g!=null&&g.menuConfig&&a(v=>({...v,menuConfig:{...v.menuConfig,...g.menuConfig}})),g!=null&&g.pageConfig&&a(v=>({...v,pageConfig:{...v.pageConfig,...g.pageConfig}}))}).catch(console.error)},[]);const f=async()=>{u(!0);try{await bt("/api/db/config",{key:"site_config",value:r.siteConfig,description:"网站基础配置"}),await bt("/api/db/config",{key:"menu_config",value:r.menuConfig,description:"底部菜单配置"}),await bt("/api/db/config",{key:"page_config",value:r.pageConfig,description:"页面标题配置"}),i(!0),setTimeout(()=>i(!1),2e3),alert("配置已保存")}catch(g){console.error(g),alert("保存失败: "+(g instanceof Error?g.message:String(g)))}finally{u(!1)}},m=r.siteConfig,x=r.menuConfig,y=r.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(he,{onClick:f,disabled:c,className:`${l?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),c?"保存中...":l?"已保存":"保存设置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(sd,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),t.jsx(ft,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),t.jsxs(ke,{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(ne,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),t.jsx(ie,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:m.siteName??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,siteName:g.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),t.jsx(ie,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:m.siteTitle??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,siteTitle:g.target.value}}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),t.jsx(ie,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:m.siteDescription??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,siteDescription:g.target.value}}))})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),t.jsx(ie,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:m.logo??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,logo:g.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),t.jsx(ie,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:m.favicon??"",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,favicon:g.target.value}}))})]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(fj,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),t.jsx(ft,{className:"text-gray-400",children:"配置网站主题色"})]}),t.jsx(ke,{children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"space-y-2 flex-1",children:[t.jsx(ne,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ie,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:m.primaryColor??"#00CED1",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,primaryColor:g.target.value}}))}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:m.primaryColor??"#00CED1",onChange:g=>a(v=>({...v,siteConfig:{...v.siteConfig,primaryColor:g.target.value}}))})]})]}),t.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:m.primaryColor??"#00CED1"},children:"预览"})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(ij,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),t.jsx(ft,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),t.jsx(ke,{className:"space-y-4",children:Object.entries(x).map(([g,v])=>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(ut,{checked:(v==null?void 0:v.enabled)??!0,onCheckedChange:E=>a(P=>({...P,menuConfig:{...P.menuConfig,[g]:{...v,enabled:E}}}))}),t.jsx("span",{className:"text-gray-300 w-16 capitalize",children:g}),t.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(v==null?void 0:v.label)??"",onChange:E=>a(P=>({...P,menuConfig:{...P.menuConfig,[g]:{...v,label:E.target.value}}}))})]}),t.jsx("span",{className:`text-sm ${v!=null&&v.enabled?"text-green-400":"text-gray-500"}`,children:v!=null&&v.enabled?"显示":"隐藏"})]},g))})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Dw,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),t.jsx(ft,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),t.jsxs(ke,{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(ne,{className:"text-gray-300",children:"首页标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.homeTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,homeTitle:g.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"首页副标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.homeSubtitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,homeSubtitle:g.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"目录页标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.chaptersTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,chaptersTitle:g.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"匹配页标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.matchTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,matchTitle:g.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"我的页标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.myTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,myTitle:g.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"关于作者标题"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:y.aboutTitle??"",onChange:g=>a(v=>({...v,pageConfig:{...v.pageConfig,aboutTitle:g.target.value}}))})]})]})]})]})]})]})}function GC(){const[r,a]=p.useState(""),[l,i]=p.useState(""),[c,u]=p.useState(""),[f,m]=p.useState({}),x=async()=>{var P,C,j,N;try{const k=await He("/api/config"),R=(C=(P=k==null?void 0:k.liveQRCodes)==null?void 0:P[0])==null?void 0:C.urls;Array.isArray(R)&&a(R.join(` -`));const b=(N=(j=k==null?void 0:k.paymentMethods)==null?void 0:j.wechat)==null?void 0:N.groupQrCode;b&&i(b),m({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};p.useEffect(()=>{x()},[]);const y=(P,C)=>{navigator.clipboard.writeText(P),u(C),setTimeout(()=>u(""),2e3)},g=async()=>{try{const P=r.split(` -`).map(j=>j.trim()).filter(Boolean),C=[...f.liveQRCodes||[]];C[0]?C[0].urls=P:C.push({id:"live-1",name:"微信群活码",urls:P,clickCount:0}),await bt("/api/db/config",{key:"live_qr_codes",value:C,description:"群活码配置"}),alert("群活码配置已保存!"),await x()}catch(P){console.error(P),alert("保存失败: "+(P instanceof Error?P.message:String(P)))}},v=async()=>{var P;try{await bt("/api/db/config",{key:"payment_methods",value:{...f.paymentMethods||{},wechat:{...((P=f.paymentMethods)==null?void 0:P.wechat)||{},groupQrCode:l}},description:"支付方式配置"}),alert("微信群链接已保存!用户支付成功后将自动跳转"),await x()}catch(C){console.error(C),alert("保存失败: "+(C instanceof Error?C.message:String(C)))}},E=()=>{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(up,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-[#07C160] flex items-center gap-2",children:[t.jsx(hm,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),t.jsx(ft,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(fm,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ie,{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:P=>i(P.target.value)}),t.jsx(he,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>y(l,"group"),children:c==="group"?t.jsx(Co,{className:"w-4 h-4 text-green-500"}):t.jsx(hp,{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(fo,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(he,{onClick:v,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[t.jsx(mm,{className:"w-4 h-4 mr-2"}),"保存配置"]}),t.jsxs(he,{onClick:E,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[t.jsx(fo,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(hm,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),t.jsx(ft,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(fm,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),t.jsx(ks,{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:r,onChange:P=>a(P.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:[r.split(` -`).filter(Boolean).length," 个"]})]}),t.jsxs(he,{onClick:g,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(mm,{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 Qm={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}},QC=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function YC(){const[r,a]=p.useState(Qm),[l,i]=p.useState(!0),[c,u]=p.useState(!1),[f,m]=p.useState(!1),[x,y]=p.useState(null),[g,v]=p.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),E=async()=>{i(!0);try{const b=await He("/api/db/config/full?key=match_config"),T=(b==null?void 0:b.data)??(b==null?void 0:b.config);T&&a({...Qm,...T})}catch(b){console.error("加载匹配配置失败:",b)}finally{i(!1)}};p.useEffect(()=>{E()},[]);const P=async()=>{u(!0);try{const b=await bt("/api/db/config",{key:"match_config",value:r,description:"匹配功能配置"});b&&b.success!==!1?alert("配置保存成功!"):alert("保存失败: "+(b&&typeof b=="object"&&"error"in b?b.error:"未知错误"))}catch(b){console.error("保存配置失败:",b),alert("保存失败")}finally{u(!1)}},C=b=>{y(b),v({id:b.id,label:b.label,matchLabel:b.matchLabel,icon:b.icon,matchFromDB:b.matchFromDB,showJoinAfterMatch:b.showJoinAfterMatch,price:b.price,enabled:b.enabled}),m(!0)},j=()=>{y(null),v({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),m(!0)},N=()=>{if(!g.id||!g.label){alert("请填写类型ID和名称");return}const b=[...r.matchTypes];if(x){const T=b.findIndex(B=>B.id===x.id);T!==-1&&(b[T]={...g})}else{if(b.some(T=>T.id===g.id)){alert("类型ID已存在");return}b.push({...g})}a({...r,matchTypes:b}),m(!1)},k=b=>{confirm("确定要删除这个匹配类型吗?")&&a({...r,matchTypes:r.matchTypes.filter(T=>T.id!==b)})},R=b=>{a({...r,matchTypes:r.matchTypes.map(T=>T.id===b?{...T,enabled:!T.enabled}:T)})};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(ho,{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(he,{variant:"outline",onClick:E,disabled:l,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(st,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]}),t.jsxs(he,{onClick:P,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Vj,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),t.jsx(ft,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),t.jsxs(ke,{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(ne,{className:"text-gray-300",children:"每日免费匹配次数"}),t.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.freeMatchLimit,onChange:b=>a({...r,freeMatchLimit:parseInt(b.target.value,10)||0})}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"付费匹配价格(元)"}),t.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:r.matchPrice,onChange:b=>a({...r,matchPrice:parseFloat(b.target.value)||1})}),t.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"每日最大匹配次数"}),t.jsx(ie,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.settings.maxMatchesPerDay,onChange:b=>a({...r,settings:{...r.settings,maxMatchesPerDay:parseInt(b.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(ut,{checked:r.settings.enableFreeMatches,onCheckedChange:b=>a({...r,settings:{...r.settings,enableFreeMatches:b}})}),t.jsx(ne,{className:"text-gray-300",children:"启用免费匹配"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ut,{checked:r.settings.enablePaidMatches,onCheckedChange:b=>a({...r,settings:{...r.settings,enablePaidMatches:b}})}),t.jsx(ne,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsxs(Be,{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(En,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),t.jsx(ft,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),t.jsxs(he,{onClick:j,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx($r,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),t.jsx(ke,{children:t.jsxs(Ls,{children:[t.jsx(Os,{children:t.jsxs(_t,{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(Ds,{children:r.matchTypes.map(b=>t.jsxs(_t,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(Me,{children:t.jsx("span",{className:"text-2xl",children:b.icon})}),t.jsx(Me,{className:"font-mono text-gray-300",children:b.id}),t.jsx(Me,{className:"text-white font-medium",children:b.label}),t.jsx(Me,{className:"text-gray-300",children:b.matchLabel}),t.jsx(Me,{children:t.jsxs(Le,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",b.price]})}),t.jsx(Me,{children:b.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(Me,{children:t.jsx(ut,{checked:b.enabled,onCheckedChange:()=>R(b.id)})}),t.jsx(Me,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>C(b),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:t.jsx(Ur,{className:"w-4 h-4"})}),t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>k(b.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:t.jsx(Eo,{className:"w-4 h-4"})})]})})]},b.id))})]})})]}),t.jsx(tn,{open:f,onOpenChange:m,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[t.jsx(nn,{children:t.jsxs(rn,{className:"text-white flex items-center gap-2",children:[x?t.jsx(Ur,{className:"w-5 h-5 text-[#38bdac]"}):t.jsx($r,{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(ne,{className:"text-gray-300",children:"类型ID(英文)"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:g.id,onChange:b=>v({...g,id:b.target.value}),disabled:!!x})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"图标"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:QC.map(b=>t.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${g.icon===b?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>v({...g,icon:b}),children:b},b))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"显示名称"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:g.label,onChange:b=>v({...g,label:b.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"匹配标签"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:g.matchLabel,onChange:b=>v({...g,matchLabel:b.target.value})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"单次匹配价格(元)"}),t.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:g.price,onChange:b=>v({...g,price:parseFloat(b.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(ut,{checked:g.matchFromDB,onCheckedChange:b=>v({...g,matchFromDB:b})}),t.jsx(ne,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ut,{checked:g.showJoinAfterMatch,onCheckedChange:b=>v({...g,showJoinAfterMatch:b})}),t.jsx(ne,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ut,{checked:g.enabled,onCheckedChange:b=>v({...g,enabled:b})}),t.jsx(ne,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),t.jsxs(mn,{children:[t.jsx(he,{variant:"outline",onClick:()=>m(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsxs(he,{onClick:N,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const Ym={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function qC(){const[r,a]=p.useState([]),[l,i]=p.useState(0),[c,u]=p.useState(1),[f,m]=p.useState(10),[x,y]=p.useState(""),[g,v]=p.useState(!0),[E,P]=p.useState(null);async function C(){v(!0),P(null);try{const N=new URLSearchParams({page:String(c),pageSize:String(f)});x&&N.set("matchType",x);const k=await He(`/api/db/match-records?${N}`);k!=null&&k.success?(a(k.records||[]),i(k.total??0)):P("加载匹配记录失败")}catch(N){console.error("加载匹配记录失败",N),P("加载失败,请检查网络后重试")}finally{v(!1)}}p.useEffect(()=>{C()},[c,x]);const j=Math.ceil(l/f)||1;return t.jsxs("div",{className:"p-8 w-full",children:[E&&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:E}),t.jsx("button",{type:"button",onClick:()=>P(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:N=>{y(N.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(Ym).map(([N,k])=>t.jsx("option",{value:N,children:k},N))]}),t.jsxs("button",{type:"button",onClick:C,disabled:g,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(st,{className:`w-4 h-4 ${g?"animate-spin":""}`}),"刷新"]})]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(ke,{className:"p-0",children:g?t.jsxs("div",{className:"flex justify-center py-12",children:[t.jsx(st,{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(Ls,{children:[t.jsx(Os,{children:t.jsxs(_t,{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(Ds,{children:[r.map(N=>t.jsxs(_t,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(Me,{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:[N.userAvatar?t.jsx("img",{src:N.userAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const R=k.currentTarget.nextElementSibling;R&&R.classList.remove("hidden")}}):null,t.jsx("span",{className:N.userAvatar?"hidden":"",children:(N.userNickname||N.userId||"?").charAt(0)})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white",children:N.userNickname||N.userId}),t.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[N.userId.slice(0,16),"..."]})]})]})}),t.jsx(Me,{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:[N.matchedUserAvatar?t.jsx("img",{src:N.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const R=k.currentTarget.nextElementSibling;R&&R.classList.remove("hidden")}}):null,t.jsx("span",{className:N.matchedUserAvatar?"hidden":"",children:(N.matchedNickname||N.matchedUserId||"?").charAt(0)})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white",children:N.matchedNickname||N.matchedUserId}),t.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[N.matchedUserId.slice(0,16),"..."]})]})]})}),t.jsx(Me,{children:t.jsx(Le,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Ym[N.matchType]||N.matchType})}),t.jsxs(Me,{className:"text-gray-400 text-sm",children:[N.phone&&t.jsxs("div",{children:["📱 ",N.phone]}),N.wechatId&&t.jsxs("div",{children:["💬 ",N.wechatId]}),!N.phone&&!N.wechatId&&"-"]}),t.jsx(Me,{className:"text-gray-400",children:N.createdAt?new Date(N.createdAt).toLocaleString():"-"})]},N.id)),r.length===0&&t.jsx(_t,{children:t.jsx(Me,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),t.jsx(Vr,{page:c,totalPages:j,total:l,pageSize:f,onPageChange:u,onPageSizeChange:N=>{m(N),u(1)}})]})})})]})}function XC(){const[r,a]=p.useState([]),[l,i]=p.useState(!0),[c,u]=p.useState(!1),[f,m]=p.useState(null),[x,y]=p.useState(""),[g,v]=p.useState(0),[E,P]=p.useState(!1);async function C(){i(!0);try{const b=await He("/api/db/vip-roles");b!=null&&b.success&&b.data&&a(b.data)}catch(b){console.error("Load roles error:",b)}finally{i(!1)}}p.useEffect(()=>{C()},[]);const j=()=>{m(null),y(""),v(r.length>0?Math.max(...r.map(b=>b.sort))+1:0),u(!0)},N=b=>{m(b),y(b.name),v(b.sort),u(!0)},k=async()=>{if(!x.trim()){alert("角色名称不能为空");return}P(!0);try{if(f){const b=await Wt("/api/db/vip-roles",{id:f.id,name:x.trim(),sort:g});b!=null&&b.success?(u(!1),C()):alert("更新失败: "+(b==null?void 0:b.error))}else{const b=await bt("/api/db/vip-roles",{name:x.trim(),sort:g});b!=null&&b.success?(u(!1),C()):alert("新增失败: "+(b==null?void 0:b.error))}}catch(b){console.error("Save error:",b),alert("保存失败")}finally{P(!1)}},R=async b=>{if(confirm("确定删除该角色?已设置该角色的 VIP 用户将保留角色名称。"))try{const T=await Td(`/api/db/vip-roles?id=${b}`);T!=null&&T.success?C():alert("删除失败: "+(T==null?void 0:T.error))}catch(T){console.error("Delete error:",T),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(ko,{className:"w-5 h-5 text-amber-400"}),"VIP 角色管理"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"超级个体固定角色,在「设置 VIP」时可选择或手动填写"})]}),t.jsxs(he,{onClick:j,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx($r,{className:"w-4 h-4 mr-2"}),"新增角色"]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Ls,{children:[t.jsx(Os,{children:t.jsxs(_t,{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(Ds,{children:[r.map(b=>t.jsxs(_t,{className:"border-gray-700/50",children:[t.jsx(Me,{className:"text-gray-300",children:b.id}),t.jsx(Me,{className:"text-white",children:b.name}),t.jsx(Me,{className:"text-gray-400",children:b.sort}),t.jsxs(Me,{className:"text-right",children:[t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>N(b),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(Ur,{className:"w-4 h-4"})}),t.jsx(he,{variant:"ghost",size:"sm",onClick:()=>R(b.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Eo,{className:"w-4 h-4"})})]})]},b.id)),r.length===0&&t.jsx(_t,{children:t.jsx(Me,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无角色,点击「新增角色」添加"})})]})]})})}),t.jsx(tn,{open:c,onOpenChange:u,children:t.jsxs(Ht,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[t.jsx(nn,{children:t.jsx(rn,{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(ne,{className:"text-gray-300",children:"角色名称"}),t.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创始人、投资人",value:x,onChange:b=>y(b.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ne,{className:"text-gray-300",children:"排序(下拉展示顺序,越小越前)"}),t.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:g,onChange:b=>v(parseInt(b.target.value,10)||0)})]})]}),t.jsxs(mn,{children:[t.jsxs(he,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(zn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(he,{onClick:k,disabled:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pn,{className:"w-4 h-4 mr-2"}),E?"保存中...":"保存"]})]})]})})]})}function JC(){return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[t.jsx(zr,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"1. 接口总览"})}),t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"2. 书籍内容"})}),t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"3. 支付"})}),t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"4. 分销与用户"})}),t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"5. 管理后台"})}),t.jsxs(ke,{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 ZC(){const r=Yr();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(jw,{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:r.pathname}),t.jsx(he,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:t.jsxs(op,{to:"/",children:[t.jsx(Kw,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function ek(){return t.jsxs(qy,{children:[t.jsx(it,{path:"/login",element:t.jsx(K1,{})}),t.jsxs(it,{path:"/",element:t.jsx(Yj,{}),children:[t.jsx(it,{index:!0,element:t.jsx(Gy,{to:"/dashboard",replace:!0})}),t.jsx(it,{path:"dashboard",element:t.jsx(Q1,{})}),t.jsx(it,{path:"orders",element:t.jsx(AN,{})}),t.jsx(it,{path:"users",element:t.jsx(l2,{})}),t.jsx(it,{path:"distribution",element:t.jsx(o2,{})}),t.jsx(it,{path:"withdrawals",element:t.jsx(i2,{})}),t.jsx(it,{path:"content",element:t.jsx(hC,{})}),t.jsx(it,{path:"chapters",element:t.jsx(mC,{})}),t.jsx(it,{path:"referral-settings",element:t.jsx(OC,{})}),t.jsx(it,{path:"vip-roles",element:t.jsx(XC,{})}),t.jsx(it,{path:"settings",element:t.jsx(BC,{})}),t.jsx(it,{path:"payment",element:t.jsx(VC,{})}),t.jsx(it,{path:"site",element:t.jsx(KC,{})}),t.jsx(it,{path:"qrcodes",element:t.jsx(GC,{})}),t.jsx(it,{path:"match",element:t.jsx(YC,{})}),t.jsx(it,{path:"match-records",element:t.jsx(qC,{})}),t.jsx(it,{path:"api-doc",element:t.jsx(JC,{})})]}),t.jsx(it,{path:"*",element:t.jsx(ZC,{})})]})}Zv.createRoot(document.getElementById("root")).render(t.jsx(p.StrictMode,{children:t.jsx(rw,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:t.jsx(ek,{})})})); diff --git a/soul-admin/dist/assets/index-CKRjkwdJ.js b/soul-admin/dist/assets/index-CKRjkwdJ.js new file mode 100644 index 00000000..49cad72b --- /dev/null +++ b/soul-admin/dist/assets/index-CKRjkwdJ.js @@ -0,0 +1,465 @@ +function Hv(r,a){for(var l=0;lo[c]})}}}return Object.freeze(Object.defineProperty(r,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 qm(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ac={exports:{}},Pa={},Mc={exports:{}},ze={};/** + * @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 Vh;function Kv(){if(Vh)return ze;Vh=1;var r=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"),m=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.iterator;function E(S){return S===null||typeof S!="object"?null:(S=y&&S[y]||S["@@iterator"],typeof S=="function"?S:null)}var P={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,N={};function b(S,D,ae){this.props=S,this.context=D,this.refs=N,this.updater=ae||P}b.prototype.isReactComponent={},b.prototype.setState=function(S,D){if(typeof S!="object"&&typeof S!="function"&&S!=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,S,D,"setState")},b.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function k(){}k.prototype=b.prototype;function R(S,D,ae){this.props=S,this.context=D,this.refs=N,this.updater=ae||P}var j=R.prototype=new k;j.constructor=R,C(j,b.prototype),j.isPureReactComponent=!0;var _=Array.isArray,F=Object.prototype.hasOwnProperty,G={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function V(S,D,ae){var oe,Ne={},me=null,Q=null;if(D!=null)for(oe in D.ref!==void 0&&(Q=D.ref),D.key!==void 0&&(me=""+D.key),D)F.call(D,oe)&&!M.hasOwnProperty(oe)&&(Ne[oe]=D[oe]);var xe=arguments.length-2;if(xe===1)Ne.children=ae;else if(1>>1,D=A[S];if(0>>1;Sc(Ne,B))mec(Q,Ne)?(A[S]=Q,A[me]=B,S=me):(A[S]=Ne,A[oe]=B,S=oe);else if(mec(Q,B))A[S]=Q,A[me]=B,S=me;else break e}}return J}function c(A,J){var B=A.sortIndex-J.sortIndex;return B!==0?B:A.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;r.unstable_now=function(){return u.now()}}else{var f=Date,m=f.now();r.unstable_now=function(){return f.now()-m}}var x=[],g=[],v=1,y=null,E=3,P=!1,C=!1,N=!1,b=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,R=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(A){for(var J=l(g);J!==null;){if(J.callback===null)o(g);else if(J.startTime<=A)o(g),J.sortIndex=J.expirationTime,a(x,J);else break;J=l(g)}}function _(A){if(N=!1,j(A),!C)if(l(x)!==null)C=!0,Y(F);else{var J=l(g);J!==null&&K(_,J.startTime-A)}}function F(A,J){C=!1,N&&(N=!1,k(V),V=-1),P=!0;var B=E;try{for(j(J),y=l(x);y!==null&&(!(y.expirationTime>J)||A&&!ce());){var S=y.callback;if(typeof S=="function"){y.callback=null,E=y.priorityLevel;var D=S(y.expirationTime<=J);J=r.unstable_now(),typeof D=="function"?y.callback=D:y===l(x)&&o(x),j(J)}else o(x);y=l(x)}if(y!==null)var ae=!0;else{var oe=l(g);oe!==null&&K(_,oe.startTime-J),ae=!1}return ae}finally{y=null,E=B,P=!1}}var G=!1,M=null,V=-1,te=5,ue=-1;function ce(){return!(r.unstable_now()-ueA||125S?(A.sortIndex=B,a(g,A),l(x)===null&&A===l(g)&&(N?(k(V),V=-1):N=!0,K(_,B-S))):(A.sortIndex=D,a(x,A),C||P||(C=!0,Y(F))),A},r.unstable_shouldYield=ce,r.unstable_wrapCallback=function(A){var J=E;return function(){var B=E;E=J;try{return A.apply(this,arguments)}finally{E=B}}}})(Oc)),Oc}var Gh;function qv(){return Gh||(Gh=1,Dc.exports=Qv()),Dc.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 Yh;function Xv(){if(Yh)return Ft;Yh=1;var r=Sd(),a=qv();function l(e){for(var n="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 E(e){return x.call(y,e)?!0:x.call(v,e)?!1:g.test(e)?y[e]=!0:(v[e]=!0,!1)}function P(e,n,s,i){if(s!==null&&s.type===0)return!1;switch(typeof n){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,n,s,i){if(n===null||typeof n>"u"||P(e,n,s,i))return!0;if(i)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function N(e,n,s,i,d,h,w){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=i,this.attributeNamespace=d,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=w}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){b[e]=new N(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];b[n]=new N(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){b[e]=new N(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){b[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){b[e]=new N(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){b[e]=new N(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){b[e]=new N(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){b[e]=new N(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){b[e]=new N(e,5,!1,e.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function R(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 n=e.replace(k,R);b[n]=new N(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(k,R);b[n]=new N(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(k,R);b[n]=new N(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){b[e]=new N(e,1,!1,e.toLowerCase(),null,!1,!1)}),b.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){b[e]=new N(e,1,!1,e.toLowerCase(),null,!0,!0)});function j(e,n,s,i){var d=b.hasOwnProperty(n)?b[n]:null;(d!==null?d.type!==0:i||!(2T||d[w]!==h[T]){var L=` +`+d[w].replace(" at new "," at ");return e.displayName&&L.includes("")&&(L=L.replace("",e.displayName)),L}while(1<=w&&0<=T);break}}}finally{ae=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?D(e):""}function Ne(e){switch(e.tag){case 5:return D(e.type);case 16:return D("Lazy");case 13:return D("Suspense");case 19:return D("SuspenseList");case 0:case 2:case 15:return e=oe(e.type,!1),e;case 11:return e=oe(e.type.render,!1),e;case 1:return e=oe(e.type,!0),e;default:return""}}function me(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 M:return"Fragment";case G:return"Portal";case te:return"Profiler";case V:return"StrictMode";case fe:return"Suspense";case H:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ce:return(e.displayName||"Context")+".Consumer";case ue:return(e._context.displayName||"Context")+".Provider";case ie:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case W:return n=e.displayName||null,n!==null?n:me(e.type)||"Memo";case Y:n=e._payload,e=e._init;try{return me(e(n))}catch{}}return null}function Q(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return me(n);case 8:return n===V?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function xe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function I(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function se(e){var n=I(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),i=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var d=s.get,h=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(w){i=""+w,h.call(this,w)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return i},setValue:function(w){i=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function he(e){e._valueTracker||(e._valueTracker=se(e))}function Pe(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),i="";return e&&(i=I(e)?e.checked?"true":"false":e.value),e=i,e!==s?(n.setValue(e),!0):!1}function Me(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 Fe(e,n){var s=n.checked;return B({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Qe(e,n){var s=n.defaultValue==null?"":n.defaultValue,i=n.checked!=null?n.checked:n.defaultChecked;s=xe(n.value!=null?n.value:s),e._wrapperState={initialChecked:i,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function nt(e,n){n=n.checked,n!=null&&j(e,"checked",n,!1)}function Ze(e,n){nt(e,n);var s=xe(n.value),i=n.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}n.hasOwnProperty("value")?It(e,n.type,s):n.hasOwnProperty("defaultValue")&&It(e,n.type,xe(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Tt(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var i=n.type;if(!(i!=="submit"&&i!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,s||n===e.value||(e.value=n),e.defaultValue=n}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function It(e,n,s){(n!=="number"||Me(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Pr=Array.isArray;function Un(e,n,s,i){if(e=e.options,n){n={};for(var d=0;d"+n.valueOf().toString()+"",n=$e.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function ln(e,n){if(n){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=n;return}}e.textContent=n}var Rr={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},Qg=["Webkit","ms","Moz","O"];Object.keys(Rr).forEach(function(e){Qg.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Rr[n]=Rr[e]})});function nu(e,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Rr.hasOwnProperty(e)&&Rr[e]?(""+n).trim():n+"px"}function ru(e,n){e=e.style;for(var s in n)if(n.hasOwnProperty(s)){var i=s.indexOf("--")===0,d=nu(s,n[s],i);s==="float"&&(s="cssFloat"),i?e.setProperty(s,d):e[s]=d}}var qg=B({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 Wi(e,n){if(n){if(qg[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(l(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(l(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(l(61))}if(n.style!=null&&typeof n.style!="object")throw Error(l(62))}}function Hi(e,n){if(e.indexOf("-")===-1)return typeof n.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 Ki=null;function Gi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yi=null,es=null,ts=null;function su(e){if(e=ha(e)){if(typeof Yi!="function")throw Error(l(280));var n=e.stateNode;n&&(n=dl(n),Yi(e.stateNode,e.type,n))}}function au(e){es?ts?ts.push(e):ts=[e]:es=e}function lu(){if(es){var e=es,n=ts;if(ts=es=null,su(e),n)for(e=0;e>>=0,e===0?32:31-(i0(e)/o0|0)|0}var Ka=64,Ga=4194304;function Qs(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 Ya(e,n){var s=e.pendingLanes;if(s===0)return 0;var i=0,d=e.suspendedLanes,h=e.pingedLanes,w=s&268435455;if(w!==0){var T=w&~d;T!==0?i=Qs(T):(h&=w,h!==0&&(i=Qs(h)))}else w=s&~d,w!==0?i=Qs(w):h!==0&&(i=Qs(h));if(i===0)return 0;if(n!==0&&n!==i&&(n&d)===0&&(d=i&-i,h=n&-n,d>=h||d===16&&(h&4194240)!==0))return n;if((i&4)!==0&&(i|=s&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=i;0s;s++)n.push(e);return n}function qs(e,n,s){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-on(n),e[n]=s}function f0(e,n){var s=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var i=e.eventTimes;for(e=e.expirationTimes;0=sa),Mu=" ",Lu=!1;function Du(e,n){switch(e){case"keyup":return $0.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ou(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ss=!1;function V0(e,n){switch(e){case"compositionend":return Ou(n);case"keypress":return n.which!==32?null:(Lu=!0,Mu);case"textInput":return e=n.data,e===Mu&&Lu?null:e;default:return null}}function U0(e,n){if(ss)return e==="compositionend"||!ho&&Du(e,n)?(e=Pu(),Za=lo=Yn=null,ss=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:s,offset:n-e};e=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Wu(s)}}function Ku(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Ku(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Gu(){for(var e=window,n=Me();n instanceof e.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)e=n.contentWindow;else break;n=Me(e.document)}return n}function xo(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function J0(e){var n=Gu(),s=e.focusedElem,i=e.selectionRange;if(n!==s&&s&&s.ownerDocument&&Ku(s.ownerDocument.documentElement,s)){if(i!==null&&xo(s)){if(n=i.start,e=i.end,e===void 0&&(e=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(e,s.value.length);else if(e=(n=s.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var d=s.textContent.length,h=Math.min(i.start,d);i=i.end===void 0?h:Math.min(i.end,d),!e.extend&&h>i&&(d=i,i=h,h=d),d=Hu(s,h);var w=Hu(s,i);d&&w&&(e.rangeCount!==1||e.anchorNode!==d.node||e.anchorOffset!==d.offset||e.focusNode!==w.node||e.focusOffset!==w.offset)&&(n=n.createRange(),n.setStart(d.node,d.offset),e.removeAllRanges(),h>i?(e.addRange(n),e.extend(w.node,w.offset)):(n.setEnd(w.node,w.offset),e.addRange(n)))}}for(n=[],e=s;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,as=null,go=null,oa=null,vo=!1;function Yu(e,n,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;vo||as==null||as!==Me(i)||(i=as,"selectionStart"in i&&xo(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}),oa&&ia(oa,i)||(oa=i,i=il(go,"onSelect"),0ds||(e.current=_o[ds],_o[ds]=null,ds--)}function qe(e,n){ds++,_o[ds]=e.current,e.current=n}var Jn={},St=Xn(Jn),At=Xn(!1),Ir=Jn;function us(e,n){var s=e.type.contextTypes;if(!s)return Jn;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===n)return i.__reactInternalMemoizedMaskedChildContext;var d={},h;for(h in s)d[h]=n[h];return i&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=d),d}function Mt(e){return e=e.childContextTypes,e!=null}function ul(){Je(At),Je(St)}function df(e,n,s){if(St.current!==Jn)throw Error(l(168));qe(St,n),qe(At,s)}function uf(e,n,s){var i=e.stateNode;if(n=n.childContextTypes,typeof i.getChildContext!="function")return s;i=i.getChildContext();for(var d in i)if(!(d in n))throw Error(l(108,Q(e)||"Unknown",d));return B({},s,i)}function fl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Jn,Ir=St.current,qe(St,e),qe(At,At.current),!0}function ff(e,n,s){var i=e.stateNode;if(!i)throw Error(l(169));s?(e=uf(e,n,Ir),i.__reactInternalMemoizedMergedChildContext=e,Je(At),Je(St),qe(St,e)):Je(At),qe(At,s)}var In=null,hl=!1,To=!1;function hf(e){In===null?In=[e]:In.push(e)}function dv(e){hl=!0,hf(e)}function Zn(){if(!To&&In!==null){To=!0;var e=0,n=Ye;try{var s=In;for(Ye=1;e>=w,d-=w,An=1<<32-on(n)+d|s<Ie?(yt=_e,_e=null):yt=_e.sibling;var We=Z(z,_e,$[Ie],le);if(We===null){_e===null&&(_e=yt);break}e&&_e&&We.alternate===null&&n(z,_e),O=h(We,O,Ie),Re===null?Se=We:Re.sibling=We,Re=We,_e=yt}if(Ie===$.length)return s(z,_e),et&&Mr(z,Ie),Se;if(_e===null){for(;Ie<$.length;Ie++)_e=re(z,$[Ie],le),_e!==null&&(O=h(_e,O,Ie),Re===null?Se=_e:Re.sibling=_e,Re=_e);return et&&Mr(z,Ie),Se}for(_e=i(z,_e);Ie<$.length;Ie++)yt=pe(_e,z,Ie,$[Ie],le),yt!==null&&(e&&yt.alternate!==null&&_e.delete(yt.key===null?Ie:yt.key),O=h(yt,O,Ie),Re===null?Se=yt:Re.sibling=yt,Re=yt);return e&&_e.forEach(function(or){return n(z,or)}),et&&Mr(z,Ie),Se}function be(z,O,$,le){var Se=J($);if(typeof Se!="function")throw Error(l(150));if($=Se.call($),$==null)throw Error(l(151));for(var Re=Se=null,_e=O,Ie=O=0,yt=null,We=$.next();_e!==null&&!We.done;Ie++,We=$.next()){_e.index>Ie?(yt=_e,_e=null):yt=_e.sibling;var or=Z(z,_e,We.value,le);if(or===null){_e===null&&(_e=yt);break}e&&_e&&or.alternate===null&&n(z,_e),O=h(or,O,Ie),Re===null?Se=or:Re.sibling=or,Re=or,_e=yt}if(We.done)return s(z,_e),et&&Mr(z,Ie),Se;if(_e===null){for(;!We.done;Ie++,We=$.next())We=re(z,We.value,le),We!==null&&(O=h(We,O,Ie),Re===null?Se=We:Re.sibling=We,Re=We);return et&&Mr(z,Ie),Se}for(_e=i(z,_e);!We.done;Ie++,We=$.next())We=pe(_e,z,Ie,We.value,le),We!==null&&(e&&We.alternate!==null&&_e.delete(We.key===null?Ie:We.key),O=h(We,O,Ie),Re===null?Se=We:Re.sibling=We,Re=We);return e&&_e.forEach(function(Wv){return n(z,Wv)}),et&&Mr(z,Ie),Se}function ot(z,O,$,le){if(typeof $=="object"&&$!==null&&$.type===M&&$.key===null&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case F:e:{for(var Se=$.key,Re=O;Re!==null;){if(Re.key===Se){if(Se=$.type,Se===M){if(Re.tag===7){s(z,Re.sibling),O=d(Re,$.props.children),O.return=z,z=O;break e}}else if(Re.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===Y&&yf(Se)===Re.type){s(z,Re.sibling),O=d(Re,$.props),O.ref=ma(z,Re,$),O.return=z,z=O;break e}s(z,Re);break}else n(z,Re);Re=Re.sibling}$.type===M?(O=Vr($.props.children,z.mode,le,$.key),O.return=z,z=O):(le=Bl($.type,$.key,$.props,null,z.mode,le),le.ref=ma(z,O,$),le.return=z,z=le)}return w(z);case G:e:{for(Re=$.key;O!==null;){if(O.key===Re)if(O.tag===4&&O.stateNode.containerInfo===$.containerInfo&&O.stateNode.implementation===$.implementation){s(z,O.sibling),O=d(O,$.children||[]),O.return=z,z=O;break e}else{s(z,O);break}else n(z,O);O=O.sibling}O=Pc($,z.mode,le),O.return=z,z=O}return w(z);case Y:return Re=$._init,ot(z,O,Re($._payload),le)}if(Pr($))return ve(z,O,$,le);if(J($))return be(z,O,$,le);gl(z,$)}return typeof $=="string"&&$!==""||typeof $=="number"?($=""+$,O!==null&&O.tag===6?(s(z,O.sibling),O=d(O,$),O.return=z,z=O):(s(z,O),O=Ec($,z.mode,le),O.return=z,z=O),w(z)):s(z,O)}return ot}var ps=jf(!0),wf=jf(!1),vl=Xn(null),yl=null,xs=null,Oo=null;function Fo(){Oo=xs=yl=null}function zo(e){var n=vl.current;Je(vl),e._currentValue=n}function $o(e,n,s){for(;e!==null;){var i=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,i!==null&&(i.childLanes|=n)):i!==null&&(i.childLanes&n)!==n&&(i.childLanes|=n),e===s)break;e=e.return}}function gs(e,n){yl=e,Oo=xs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(Lt=!0),e.firstContext=null)}function Jt(e){var n=e._currentValue;if(Oo!==e)if(e={context:e,memoizedValue:n,next:null},xs===null){if(yl===null)throw Error(l(308));xs=e,yl.dependencies={lanes:0,firstContext:e}}else xs=xs.next=e;return n}var Lr=null;function Bo(e){Lr===null?Lr=[e]:Lr.push(e)}function Nf(e,n,s,i){var d=n.interleaved;return d===null?(s.next=s,Bo(n)):(s.next=d.next,d.next=s),n.interleaved=s,Ln(e,i)}function Ln(e,n){e.lanes|=n;var s=e.alternate;for(s!==null&&(s.lanes|=n),s=e,e=e.return;e!==null;)e.childLanes|=n,s=e.alternate,s!==null&&(s.childLanes|=n),s=e,e=e.return;return s.tag===3?s.stateNode:null}var er=!1;function Vo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function bf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Dn(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function tr(e,n,s){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(Ue&2)!==0){var d=i.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),i.pending=n,Ln(e,s)}return d=i.interleaved,d===null?(n.next=n,Bo(i)):(n.next=d.next,d.next=n),i.interleaved=n,Ln(e,s)}function jl(e,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var i=n.lanes;i&=e.pendingLanes,s|=i,n.lanes=s,to(e,s)}}function Sf(e,n){var s=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,s===i)){var d=null,h=null;if(s=s.firstBaseUpdate,s!==null){do{var w={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};h===null?d=h=w:h=h.next=w,s=s.next}while(s!==null);h===null?d=h=n:h=h.next=n}else d=h=n;s={baseState:i.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:i.shared,effects:i.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=n:e.next=n,s.lastBaseUpdate=n}function wl(e,n,s,i){var d=e.updateQueue;er=!1;var h=d.firstBaseUpdate,w=d.lastBaseUpdate,T=d.shared.pending;if(T!==null){d.shared.pending=null;var L=T,U=L.next;L.next=null,w===null?h=U:w.next=U,w=L;var ee=e.alternate;ee!==null&&(ee=ee.updateQueue,T=ee.lastBaseUpdate,T!==w&&(T===null?ee.firstBaseUpdate=U:T.next=U,ee.lastBaseUpdate=L))}if(h!==null){var re=d.baseState;w=0,ee=U=L=null,T=h;do{var Z=T.lane,pe=T.eventTime;if((i&Z)===Z){ee!==null&&(ee=ee.next={eventTime:pe,lane:0,tag:T.tag,payload:T.payload,callback:T.callback,next:null});e:{var ve=e,be=T;switch(Z=n,pe=s,be.tag){case 1:if(ve=be.payload,typeof ve=="function"){re=ve.call(pe,re,Z);break e}re=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=be.payload,Z=typeof ve=="function"?ve.call(pe,re,Z):ve,Z==null)break e;re=B({},re,Z);break e;case 2:er=!0}}T.callback!==null&&T.lane!==0&&(e.flags|=64,Z=d.effects,Z===null?d.effects=[T]:Z.push(T))}else pe={eventTime:pe,lane:Z,tag:T.tag,payload:T.payload,callback:T.callback,next:null},ee===null?(U=ee=pe,L=re):ee=ee.next=pe,w|=Z;if(T=T.next,T===null){if(T=d.shared.pending,T===null)break;Z=T,T=Z.next,Z.next=null,d.lastBaseUpdate=Z,d.shared.pending=null}}while(!0);if(ee===null&&(L=re),d.baseState=L,d.firstBaseUpdate=U,d.lastBaseUpdate=ee,n=d.shared.interleaved,n!==null){d=n;do w|=d.lane,d=d.next;while(d!==n)}else h===null&&(d.shared.lanes=0);Fr|=w,e.lanes=w,e.memoizedState=re}}function Cf(e,n,s){if(e=n.effects,n.effects=null,e!==null)for(n=0;ns?s:4,e(!0);var i=Go.transition;Go.transition={};try{e(!1),n()}finally{Ye=s,Go.transition=i}}function Wf(){return Zt().memoizedState}function mv(e,n,s){var i=ar(e);if(s={lane:i,action:s,hasEagerState:!1,eagerState:null,next:null},Hf(e))Kf(n,s);else if(s=Nf(e,n,s,i),s!==null){var d=_t();mn(s,e,i,d),Gf(s,n,i)}}function pv(e,n,s){var i=ar(e),d={lane:i,action:s,hasEagerState:!1,eagerState:null,next:null};if(Hf(e))Kf(n,d);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var w=n.lastRenderedState,T=h(w,s);if(d.hasEagerState=!0,d.eagerState=T,cn(T,w)){var L=n.interleaved;L===null?(d.next=d,Bo(n)):(d.next=L.next,L.next=d),n.interleaved=d;return}}catch{}finally{}s=Nf(e,n,d,i),s!==null&&(d=_t(),mn(s,e,i,d),Gf(s,n,i))}}function Hf(e){var n=e.alternate;return e===st||n!==null&&n===st}function Kf(e,n){va=Sl=!0;var s=e.pending;s===null?n.next=n:(n.next=s.next,s.next=n),e.pending=n}function Gf(e,n,s){if((s&4194240)!==0){var i=n.lanes;i&=e.pendingLanes,s|=i,n.lanes=s,to(e,s)}}var El={readContext:Jt,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useInsertionEffect:Ct,useLayoutEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useMutableSource:Ct,useSyncExternalStore:Ct,useId:Ct,unstable_isNewReconciler:!1},xv={readContext:Jt,useCallback:function(e,n){return bn().memoizedState=[e,n===void 0?null:n],e},useContext:Jt,useEffect:Df,useImperativeHandle:function(e,n,s){return s=s!=null?s.concat([e]):null,Cl(4194308,4,zf.bind(null,n,e),s)},useLayoutEffect:function(e,n){return Cl(4194308,4,e,n)},useInsertionEffect:function(e,n){return Cl(4,2,e,n)},useMemo:function(e,n){var s=bn();return n=n===void 0?null:n,e=e(),s.memoizedState=[e,n],e},useReducer:function(e,n,s){var i=bn();return n=s!==void 0?s(n):n,i.memoizedState=i.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},i.queue=e,e=e.dispatch=mv.bind(null,st,e),[i.memoizedState,e]},useRef:function(e){var n=bn();return e={current:e},n.memoizedState=e},useState:Mf,useDebugValue:ec,useDeferredValue:function(e){return bn().memoizedState=e},useTransition:function(){var e=Mf(!1),n=e[0];return e=hv.bind(null,e[1]),bn().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,s){var i=st,d=bn();if(et){if(s===void 0)throw Error(l(407));s=s()}else{if(s=n(),vt===null)throw Error(l(349));(Or&30)!==0||Rf(i,n,s)}d.memoizedState=s;var h={value:s,getSnapshot:n};return d.queue=h,Df(Tf.bind(null,i,h,e),[e]),i.flags|=2048,wa(9,_f.bind(null,i,h,s,n),void 0,null),s},useId:function(){var e=bn(),n=vt.identifierPrefix;if(et){var s=Mn,i=An;s=(i&~(1<<32-on(i)-1)).toString(32)+s,n=":"+n+"R"+s,s=ya++,0<\/script>",e=e.removeChild(e.firstChild)):typeof i.is=="string"?e=w.createElement(s,{is:i.is}):(e=w.createElement(s),s==="select"&&(w=e,i.multiple?w.multiple=!0:i.size&&(w.size=i.size))):e=w.createElementNS(e,s),e[wn]=n,e[fa]=i,hh(e,n,!1,!1),n.stateNode=e;e:{switch(w=Hi(s,i),s){case"dialog":Xe("cancel",e),Xe("close",e),d=i;break;case"iframe":case"object":case"embed":Xe("load",e),d=i;break;case"video":case"audio":for(d=0;dNs&&(n.flags|=128,i=!0,Na(h,!1),n.lanes=4194304)}else{if(!i)if(e=Nl(w),e!==null){if(n.flags|=128,i=!0,s=e.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),Na(h,!0),h.tail===null&&h.tailMode==="hidden"&&!w.alternate&&!et)return kt(n),null}else 2*it()-h.renderingStartTime>Ns&&s!==1073741824&&(n.flags|=128,i=!0,Na(h,!1),n.lanes=4194304);h.isBackwards?(w.sibling=n.child,n.child=w):(s=h.last,s!==null?s.sibling=w:n.child=w,h.last=w)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=it(),n.sibling=null,s=rt.current,qe(rt,i?s&1|2:s&1),n):(kt(n),null);case 22:case 23:return Sc(),i=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(n.flags|=8192),i&&(n.mode&1)!==0?(Wt&1073741824)!==0&&(kt(n),n.subtreeFlags&6&&(n.flags|=8192)):kt(n),null;case 24:return null;case 25:return null}throw Error(l(156,n.tag))}function Sv(e,n){switch(Ao(n),n.tag){case 1:return Mt(n.type)&&ul(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return vs(),Je(At),Je(St),Ko(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return Wo(n),null;case 13:if(Je(rt),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(l(340));ms()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Je(rt),null;case 4:return vs(),null;case 10:return zo(n.type._context),null;case 22:case 23:return Sc(),null;case 24:return null;default:return null}}var Tl=!1,Et=!1,Cv=typeof WeakSet=="function"?WeakSet:Set,ge=null;function js(e,n){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(i){lt(e,n,i)}else s.current=null}function fc(e,n,s){try{s()}catch(i){lt(e,n,i)}}var xh=!1;function kv(e,n){if(So=Xa,e=Gu(),xo(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,h=i.focusNode;i=i.focusOffset;try{s.nodeType,h.nodeType}catch{s=null;break e}var w=0,T=-1,L=-1,U=0,ee=0,re=e,Z=null;t:for(;;){for(var pe;re!==s||d!==0&&re.nodeType!==3||(T=w+d),re!==h||i!==0&&re.nodeType!==3||(L=w+i),re.nodeType===3&&(w+=re.nodeValue.length),(pe=re.firstChild)!==null;)Z=re,re=pe;for(;;){if(re===e)break t;if(Z===s&&++U===d&&(T=w),Z===h&&++ee===i&&(L=w),(pe=re.nextSibling)!==null)break;re=Z,Z=re.parentNode}re=pe}s=T===-1||L===-1?null:{start:T,end:L}}else s=null}s=s||{start:0,end:0}}else s=null;for(Co={focusedElem:e,selectionRange:s},Xa=!1,ge=n;ge!==null;)if(n=ge,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,ge=e;else for(;ge!==null;){n=ge;try{var ve=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(ve!==null){var be=ve.memoizedProps,ot=ve.memoizedState,z=n.stateNode,O=z.getSnapshotBeforeUpdate(n.elementType===n.type?be:un(n.type,be),ot);z.__reactInternalSnapshotBeforeUpdate=O}break;case 3:var $=n.stateNode.containerInfo;$.nodeType===1?$.textContent="":$.nodeType===9&&$.documentElement&&$.removeChild($.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(l(163))}}catch(le){lt(n,n.return,le)}if(e=n.sibling,e!==null){e.return=n.return,ge=e;break}ge=n.return}return ve=xh,xh=!1,ve}function ba(e,n,s){var i=n.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var d=i=i.next;do{if((d.tag&e)===e){var h=d.destroy;d.destroy=void 0,h!==void 0&&fc(n,s,h)}d=d.next}while(d!==i)}}function Il(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var i=s.create;s.destroy=i()}s=s.next}while(s!==n)}}function hc(e){var n=e.ref;if(n!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof n=="function"?n(e):n.current=e}}function gh(e){var n=e.alternate;n!==null&&(e.alternate=null,gh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[wn],delete n[fa],delete n[Ro],delete n[ov],delete n[cv])),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 vh(e){return e.tag===5||e.tag===3||e.tag===4}function yh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vh(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 mc(e,n,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(e,n):s.insertBefore(e,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(e,s)):(n=s,n.appendChild(e)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=cl));else if(i!==4&&(e=e.child,e!==null))for(mc(e,n,s),e=e.sibling;e!==null;)mc(e,n,s),e=e.sibling}function pc(e,n,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,n?s.insertBefore(e,n):s.appendChild(e);else if(i!==4&&(e=e.child,e!==null))for(pc(e,n,s),e=e.sibling;e!==null;)pc(e,n,s),e=e.sibling}var Nt=null,fn=!1;function nr(e,n,s){for(s=s.child;s!==null;)jh(e,n,s),s=s.sibling}function jh(e,n,s){if(jn&&typeof jn.onCommitFiberUnmount=="function")try{jn.onCommitFiberUnmount(Ha,s)}catch{}switch(s.tag){case 5:Et||js(s,n);case 6:var i=Nt,d=fn;Nt=null,nr(e,n,s),Nt=i,fn=d,Nt!==null&&(fn?(e=Nt,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):Nt.removeChild(s.stateNode));break;case 18:Nt!==null&&(fn?(e=Nt,s=s.stateNode,e.nodeType===8?Po(e.parentNode,s):e.nodeType===1&&Po(e,s),ta(e)):Po(Nt,s.stateNode));break;case 4:i=Nt,d=fn,Nt=s.stateNode.containerInfo,fn=!0,nr(e,n,s),Nt=i,fn=d;break;case 0:case 11:case 14:case 15:if(!Et&&(i=s.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){d=i=i.next;do{var h=d,w=h.destroy;h=h.tag,w!==void 0&&((h&2)!==0||(h&4)!==0)&&fc(s,n,w),d=d.next}while(d!==i)}nr(e,n,s);break;case 1:if(!Et&&(js(s,n),i=s.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=s.memoizedProps,i.state=s.memoizedState,i.componentWillUnmount()}catch(T){lt(s,n,T)}nr(e,n,s);break;case 21:nr(e,n,s);break;case 22:s.mode&1?(Et=(i=Et)||s.memoizedState!==null,nr(e,n,s),Et=i):nr(e,n,s);break;default:nr(e,n,s)}}function wh(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new Cv),n.forEach(function(i){var d=Lv.bind(null,e,i);s.has(i)||(s.add(i),i.then(d,d))})}}function hn(e,n){var s=n.deletions;if(s!==null)for(var i=0;id&&(d=w),i&=~h}if(i=d,i=it()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Pv(i/1960))-i,10e?16:e,sr===null)var i=!1;else{if(e=sr,sr=null,Ol=0,(Ue&6)!==0)throw Error(l(331));var d=Ue;for(Ue|=4,ge=e.current;ge!==null;){var h=ge,w=h.child;if((ge.flags&16)!==0){var T=h.deletions;if(T!==null){for(var L=0;Lit()-vc?$r(e,0):gc|=s),Ot(e,n)}function Mh(e,n){n===0&&((e.mode&1)===0?n=1:(n=Ga,Ga<<=1,(Ga&130023424)===0&&(Ga=4194304)));var s=_t();e=Ln(e,n),e!==null&&(qs(e,n,s),Ot(e,s))}function Mv(e){var n=e.memoizedState,s=0;n!==null&&(s=n.retryLane),Mh(e,s)}function Lv(e,n){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(n),Mh(e,s)}var Lh;Lh=function(e,n,s){if(e!==null)if(e.memoizedProps!==n.pendingProps||At.current)Lt=!0;else{if((e.lanes&s)===0&&(n.flags&128)===0)return Lt=!1,Nv(e,n,s);Lt=(e.flags&131072)!==0}else Lt=!1,et&&(n.flags&1048576)!==0&&mf(n,pl,n.index);switch(n.lanes=0,n.tag){case 2:var i=n.type;_l(e,n),e=n.pendingProps;var d=us(n,St.current);gs(n,s),d=Qo(null,n,i,e,d,s);var h=qo();return n.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Mt(i)?(h=!0,fl(n)):h=!1,n.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,Vo(n),d.updater=Pl,n.stateNode=d,d._reactInternals=n,nc(n,i,e,s),n=lc(null,n,i,!0,h,s)):(n.tag=0,et&&h&&Io(n),Rt(null,n,d,s),n=n.child),n;case 16:i=n.elementType;e:{switch(_l(e,n),e=n.pendingProps,d=i._init,i=d(i._payload),n.type=i,d=n.tag=Ov(i),e=un(i,e),d){case 0:n=ac(null,n,i,e,s);break e;case 1:n=ih(null,n,i,e,s);break e;case 11:n=nh(null,n,i,e,s);break e;case 14:n=rh(null,n,i,un(i.type,e),s);break e}throw Error(l(306,i,""))}return n;case 0:return i=n.type,d=n.pendingProps,d=n.elementType===i?d:un(i,d),ac(e,n,i,d,s);case 1:return i=n.type,d=n.pendingProps,d=n.elementType===i?d:un(i,d),ih(e,n,i,d,s);case 3:e:{if(oh(n),e===null)throw Error(l(387));i=n.pendingProps,h=n.memoizedState,d=h.element,bf(e,n),wl(n,i,null,s);var w=n.memoizedState;if(i=w.element,h.isDehydrated)if(h={element:i,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){d=ys(Error(l(423)),n),n=ch(e,n,i,s,d);break e}else if(i!==d){d=ys(Error(l(424)),n),n=ch(e,n,i,s,d);break e}else for(Ut=qn(n.stateNode.containerInfo.firstChild),Vt=n,et=!0,dn=null,s=wf(n,null,i,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(ms(),i===d){n=On(e,n,s);break e}Rt(e,n,i,s)}n=n.child}return n;case 5:return kf(n),e===null&&Lo(n),i=n.type,d=n.pendingProps,h=e!==null?e.memoizedProps:null,w=d.children,ko(i,d)?w=null:h!==null&&ko(i,h)&&(n.flags|=32),lh(e,n),Rt(e,n,w,s),n.child;case 6:return e===null&&Lo(n),null;case 13:return dh(e,n,s);case 4:return Uo(n,n.stateNode.containerInfo),i=n.pendingProps,e===null?n.child=ps(n,null,i,s):Rt(e,n,i,s),n.child;case 11:return i=n.type,d=n.pendingProps,d=n.elementType===i?d:un(i,d),nh(e,n,i,d,s);case 7:return Rt(e,n,n.pendingProps,s),n.child;case 8:return Rt(e,n,n.pendingProps.children,s),n.child;case 12:return Rt(e,n,n.pendingProps.children,s),n.child;case 10:e:{if(i=n.type._context,d=n.pendingProps,h=n.memoizedProps,w=d.value,qe(vl,i._currentValue),i._currentValue=w,h!==null)if(cn(h.value,w)){if(h.children===d.children&&!At.current){n=On(e,n,s);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var T=h.dependencies;if(T!==null){w=h.child;for(var L=T.firstContext;L!==null;){if(L.context===i){if(h.tag===1){L=Dn(-1,s&-s),L.tag=2;var U=h.updateQueue;if(U!==null){U=U.shared;var ee=U.pending;ee===null?L.next=L:(L.next=ee.next,ee.next=L),U.pending=L}}h.lanes|=s,L=h.alternate,L!==null&&(L.lanes|=s),$o(h.return,s,n),T.lanes|=s;break}L=L.next}}else if(h.tag===10)w=h.type===n.type?null:h.child;else if(h.tag===18){if(w=h.return,w===null)throw Error(l(341));w.lanes|=s,T=w.alternate,T!==null&&(T.lanes|=s),$o(w,s,n),w=h.sibling}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===n){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}Rt(e,n,d.children,s),n=n.child}return n;case 9:return d=n.type,i=n.pendingProps.children,gs(n,s),d=Jt(d),i=i(d),n.flags|=1,Rt(e,n,i,s),n.child;case 14:return i=n.type,d=un(i,n.pendingProps),d=un(i.type,d),rh(e,n,i,d,s);case 15:return sh(e,n,n.type,n.pendingProps,s);case 17:return i=n.type,d=n.pendingProps,d=n.elementType===i?d:un(i,d),_l(e,n),n.tag=1,Mt(i)?(e=!0,fl(n)):e=!1,gs(n,s),Qf(n,i,d),nc(n,i,d,s),lc(null,n,i,!0,e,s);case 19:return fh(e,n,s);case 22:return ah(e,n,s)}throw Error(l(156,n.tag))};function Dh(e,n){return mu(e,n)}function Dv(e,n,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=n,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 tn(e,n,s,i){return new Dv(e,n,s,i)}function kc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ov(e){if(typeof e=="function")return kc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ie)return 11;if(e===W)return 14}return 2}function ir(e,n){var s=e.alternate;return s===null?(s=tn(e.tag,n,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=n,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,n=e.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Bl(e,n,s,i,d,h){var w=2;if(i=e,typeof e=="function")kc(e)&&(w=1);else if(typeof e=="string")w=5;else e:switch(e){case M:return Vr(s.children,d,h,n);case V:w=8,d|=8;break;case te:return e=tn(12,s,n,d|2),e.elementType=te,e.lanes=h,e;case fe:return e=tn(13,s,n,d),e.elementType=fe,e.lanes=h,e;case H:return e=tn(19,s,n,d),e.elementType=H,e.lanes=h,e;case K:return Vl(s,d,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ue:w=10;break e;case ce:w=9;break e;case ie:w=11;break e;case W:w=14;break e;case Y:w=16,i=null;break e}throw Error(l(130,e==null?e:typeof e,""))}return n=tn(w,s,n,d),n.elementType=e,n.type=i,n.lanes=h,n}function Vr(e,n,s,i){return e=tn(7,e,i,n),e.lanes=s,e}function Vl(e,n,s,i){return e=tn(22,e,i,n),e.elementType=K,e.lanes=s,e.stateNode={isHidden:!1},e}function Ec(e,n,s){return e=tn(6,e,null,n),e.lanes=s,e}function Pc(e,n,s){return n=tn(4,e.children!==null?e.children:[],e.key,n),n.lanes=s,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Fv(e,n,s,i,d){this.tag=n,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=eo(0),this.expirationTimes=eo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=eo(0),this.identifierPrefix=i,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function Rc(e,n,s,i,d,h,w,T,L){return e=new Fv(e,n,s,T,L),n===1?(n=1,h===!0&&(n|=8)):n=0,h=tn(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:i,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},Vo(h),e}function zv(e,n,s){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(a){console.error(a)}}return r(),Lc.exports=Xv(),Lc.exports}var qh;function Jv(){if(qh)return Ql;qh=1;var r=Xm();return Ql.createRoot=r.createRoot,Ql.hydrateRoot=r.hydrateRoot,Ql}var Zv=Jv(),Da=Xm();const ey=qm(Da);/** + * @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 Ta(){return Ta=Object.assign?Object.assign.bind():function(r){for(var a=1;a"u")throw new Error(a)}function Cd(r,a){if(!r){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function ny(){return Math.random().toString(36).substr(2,8)}function Jh(r,a){return{usr:r.state,key:r.key,idx:a}}function ed(r,a,l,o){return l===void 0&&(l=null),Ta({pathname:typeof r=="string"?r:r.pathname,search:"",hash:""},typeof a=="string"?Ms(a):a,{state:l,key:a&&a.key||o||ny()})}function ui(r){let{pathname:a="/",search:l="",hash:o=""}=r;return l&&l!=="?"&&(a+=l.charAt(0)==="?"?l:"?"+l),o&&o!=="#"&&(a+=o.charAt(0)==="#"?o:"#"+o),a}function Ms(r){let a={};if(r){let l=r.indexOf("#");l>=0&&(a.hash=r.substr(l),r=r.substr(0,l));let o=r.indexOf("?");o>=0&&(a.search=r.substr(o),r=r.substr(0,o)),r&&(a.pathname=r)}return a}function ry(r,a,l,o){o===void 0&&(o={});let{window:c=document.defaultView,v5Compat:u=!1}=o,f=c.history,m=hr.Pop,x=null,g=v();g==null&&(g=0,f.replaceState(Ta({},f.state,{idx:g}),""));function v(){return(f.state||{idx:null}).idx}function y(){m=hr.Pop;let b=v(),k=b==null?null:b-g;g=b,x&&x({action:m,location:N.location,delta:k})}function E(b,k){m=hr.Push;let R=ed(N.location,b,k);g=v()+1;let j=Jh(R,g),_=N.createHref(R);try{f.pushState(j,"",_)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;c.location.assign(_)}u&&x&&x({action:m,location:N.location,delta:1})}function P(b,k){m=hr.Replace;let R=ed(N.location,b,k);g=v();let j=Jh(R,g),_=N.createHref(R);f.replaceState(j,"",_),u&&x&&x({action:m,location:N.location,delta:0})}function C(b){let k=c.location.origin!=="null"?c.location.origin:c.location.href,R=typeof b=="string"?b:ui(b);return R=R.replace(/ $/,"%20"),ct(k,"No window.location.(origin|href) available to create URL for href: "+R),new URL(R,k)}let N={get action(){return m},get location(){return r(c,f)},listen(b){if(x)throw new Error("A history only accepts one active listener");return c.addEventListener(Xh,y),x=b,()=>{c.removeEventListener(Xh,y),x=null}},createHref(b){return a(c,b)},createURL:C,encodeLocation(b){let k=C(b);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:E,replace:P,go(b){return f.go(b)}};return N}var Zh;(function(r){r.data="data",r.deferred="deferred",r.redirect="redirect",r.error="error"})(Zh||(Zh={}));function sy(r,a,l){return l===void 0&&(l="/"),ay(r,a,l)}function ay(r,a,l,o){let c=typeof a=="string"?Ms(a):a,u=kd(c.pathname||"/",l);if(u==null)return null;let f=Jm(r);ly(f);let m=null;for(let x=0;m==null&&x{let x={relativePath:m===void 0?u.path||"":m,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};x.relativePath.startsWith("/")&&(ct(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=mr([o,x.relativePath]),v=l.concat(x);u.children&&u.children.length>0&&(ct(u.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+g+'".')),Jm(u.children,a,v,g)),!(u.path==null&&!u.index)&&a.push({path:g,score:hy(g,u.index),routesMeta:v})};return r.forEach((u,f)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))c(u,f);else for(let x of Zm(u.path))c(u,f,x)}),a}function Zm(r){let a=r.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=Zm(o.join("/")),m=[];return m.push(...f.map(x=>x===""?u:[u,x].join("/"))),c&&m.push(...f),m.map(x=>r.startsWith("/")&&x===""?"/":x)}function ly(r){r.sort((a,l)=>a.score!==l.score?l.score-a.score:my(a.routesMeta.map(o=>o.childrenIndex),l.routesMeta.map(o=>o.childrenIndex)))}const iy=/^:[\w-]+$/,oy=3,cy=2,dy=1,uy=10,fy=-2,em=r=>r==="*";function hy(r,a){let l=r.split("/"),o=l.length;return l.some(em)&&(o+=fy),a&&(o+=cy),l.filter(c=>!em(c)).reduce((c,u)=>c+(iy.test(u)?oy:u===""?dy:uy),o)}function my(r,a){return r.length===a.length&&r.slice(0,-1).every((o,c)=>o===a[c])?r[r.length-1]-a[a.length-1]:0}function py(r,a,l){let{routesMeta:o}=r,c={},u="/",f=[];for(let m=0;m{let{paramName:E,isOptional:P}=v;if(E==="*"){let N=m[y]||"";f=u.slice(0,u.length-N.length).replace(/(.)\/+$/,"$1")}const C=m[y];return P&&!C?g[E]=void 0:g[E]=(C||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:f,pattern:r}}function gy(r,a,l){a===void 0&&(a=!1),l===void 0&&(l=!0),Cd(r==="*"||!r.endsWith("*")||r.endsWith("/*"),'Route path "'+r+'" will be treated as if it were '+('"'+r.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+r.replace(/\*$/,"/*")+'".'));let o=[],c="^"+r.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,m,x)=>(o.push({paramName:m,isOptional:x!=null}),x?"/?([^\\/]+)?":"/([^\\/]+)"));return r.endsWith("*")?(o.push({paramName:"*"}),c+=r==="*"||r==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):l?c+="\\/*$":r!==""&&r!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,a?void 0:"i"),o]}function vy(r){try{return r.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return Cd(!1,'The URL path "'+r+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),r}}function kd(r,a){if(a==="/")return r;if(!r.toLowerCase().startsWith(a.toLowerCase()))return null;let l=a.endsWith("/")?a.length-1:a.length,o=r.charAt(l);return o&&o!=="/"?null:r.slice(l)||"/"}const yy=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,jy=r=>yy.test(r);function wy(r,a){a===void 0&&(a="/");let{pathname:l,search:o="",hash:c=""}=typeof r=="string"?Ms(r):r,u;if(l)if(jy(l))u=l;else{if(l.includes("//")){let f=l;l=l.replace(/\/\/+/g,"/"),Cd(!1,"Pathnames cannot have embedded double slashes - normalizing "+(f+" -> "+l))}l.startsWith("/")?u=tm(l.substring(1),"/"):u=tm(l,a)}else u=a;return{pathname:u,search:Sy(o),hash:Cy(c)}}function tm(r,a){let l=a.replace(/\/+$/,"").split("/");return r.split("/").forEach(c=>{c===".."?l.length>1&&l.pop():c!=="."&&l.push(c)}),l.length>1?l.join("/"):"/"}function Fc(r,a,l,o){return"Cannot include a '"+r+"' 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 Ny(r){return r.filter((a,l)=>l===0||a.route.path&&a.route.path.length>0)}function Ed(r,a){let l=Ny(r);return a?l.map((o,c)=>c===l.length-1?o.pathname:o.pathnameBase):l.map(o=>o.pathnameBase)}function Pd(r,a,l,o){o===void 0&&(o=!1);let c;typeof r=="string"?c=Ms(r):(c=Ta({},r),ct(!c.pathname||!c.pathname.includes("?"),Fc("?","pathname","search",c)),ct(!c.pathname||!c.pathname.includes("#"),Fc("#","pathname","hash",c)),ct(!c.search||!c.search.includes("#"),Fc("#","search","hash",c)));let u=r===""||c.pathname==="",f=u?"/":c.pathname,m;if(f==null)m=l;else{let y=a.length-1;if(!o&&f.startsWith("..")){let E=f.split("/");for(;E[0]==="..";)E.shift(),y-=1;c.pathname=E.join("/")}m=y>=0?a[y]:"/"}let x=wy(c,m),g=f&&f!=="/"&&f.endsWith("/"),v=(u||f===".")&&l.endsWith("/");return!x.pathname.endsWith("/")&&(g||v)&&(x.pathname+="/"),x}const mr=r=>r.join("/").replace(/\/\/+/g,"/"),by=r=>r.replace(/\/+$/,"").replace(/^\/*/,"/"),Sy=r=>!r||r==="?"?"":r.startsWith("?")?r:"?"+r,Cy=r=>!r||r==="#"?"":r.startsWith("#")?r:"#"+r;function ky(r){return r!=null&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.internal=="boolean"&&"data"in r}const ep=["post","put","patch","delete"];new Set(ep);const Ey=["get",...ep];new Set(Ey);/** + * 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 Ia(){return Ia=Object.assign?Object.assign.bind():function(r){for(var a=1;a{m.current=!0}),p.useCallback(function(g,v){if(v===void 0&&(v={}),!m.current)return;if(typeof g=="number"){o.go(g);return}let y=Pd(g,JSON.parse(f),u,v.relative==="path");r==null&&a!=="/"&&(y.pathname=y.pathname==="/"?a:mr([a,y.pathname])),(v.replace?o.replace:o.push)(y,v.state,v)},[a,o,f,u,r])}const Ty=p.createContext(null);function Iy(r){let a=p.useContext(Vn).outlet;return a&&p.createElement(Ty.Provider,{value:r},a)}function rp(r,a){let{relative:l}=a===void 0?{}:a,{future:o}=p.useContext(wr),{matches:c}=p.useContext(Vn),{pathname:u}=Jr(),f=JSON.stringify(Ed(c,o.v7_relativeSplatPath));return p.useMemo(()=>Pd(r,JSON.parse(f),u,l==="path"),[r,f,u,l])}function Ay(r,a){return My(r,a)}function My(r,a,l,o){Ls()||ct(!1);let{navigator:c}=p.useContext(wr),{matches:u}=p.useContext(Vn),f=u[u.length-1],m=f?f.params:{};f&&f.pathname;let x=f?f.pathnameBase:"/";f&&f.route;let g=Jr(),v;if(a){var y;let b=typeof a=="string"?Ms(a):a;x==="/"||(y=b.pathname)!=null&&y.startsWith(x)||ct(!1),v=b}else v=g;let E=v.pathname||"/",P=E;if(x!=="/"){let b=x.replace(/^\//,"").split("/");P="/"+E.replace(/^\//,"").split("/").slice(b.length).join("/")}let C=sy(r,{pathname:P}),N=zy(C&&C.map(b=>Object.assign({},b,{params:Object.assign({},m,b.params),pathname:mr([x,c.encodeLocation?c.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?x:mr([x,c.encodeLocation?c.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),u,l,o);return a&&N?p.createElement(Ci.Provider,{value:{location:Ia({pathname:"/",search:"",hash:"",state:null,key:"default"},v),navigationType:hr.Pop}},N):N}function Ly(){let r=Uy(),a=ky(r)?r.status+" "+r.statusText:r instanceof Error?r.message:JSON.stringify(r),l=r instanceof Error?r.stack:null,c={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},a),l?p.createElement("pre",{style:c},l):null,null)}const Dy=p.createElement(Ly,null);class Oy extends p.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?p.createElement(Vn.Provider,{value:this.props.routeContext},p.createElement(tp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Fy(r){let{routeContext:a,match:l,children:o}=r,c=p.useContext(Rd);return c&&c.static&&c.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=l.route.id),p.createElement(Vn.Provider,{value:a},o)}function zy(r,a,l,o){var c;if(a===void 0&&(a=[]),l===void 0&&(l=null),o===void 0&&(o=null),r==null){var u;if(!l)return null;if(l.errors)r=l.matches;else if((u=o)!=null&&u.v7_partialHydration&&a.length===0&&!l.initialized&&l.matches.length>0)r=l.matches;else return null}let f=r,m=(c=l)==null?void 0:c.errors;if(m!=null){let v=f.findIndex(y=>y.route.id&&(m==null?void 0:m[y.route.id])!==void 0);v>=0||ct(!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,E)=>{let P,C=!1,N=null,b=null;l&&(P=m&&y.route.id?m[y.route.id]:void 0,N=y.route.errorElement||Dy,x&&(g<0&&E===0?(Hy("route-fallback"),C=!0,b=null):g===E&&(C=!0,b=y.route.hydrateFallbackElement||null)));let k=a.concat(f.slice(0,E+1)),R=()=>{let j;return P?j=N:C?j=b:y.route.Component?j=p.createElement(y.route.Component,null):y.route.element?j=y.route.element:j=v,p.createElement(Fy,{match:y,routeContext:{outlet:v,matches:k,isDataRoute:l!=null},children:j})};return l&&(y.route.ErrorBoundary||y.route.errorElement||E===0)?p.createElement(Oy,{location:l.location,revalidation:l.revalidation,component:N,error:P,children:R(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):R()},null)}var sp=(function(r){return r.UseBlocker="useBlocker",r.UseRevalidator="useRevalidator",r.UseNavigateStable="useNavigate",r})(sp||{}),ap=(function(r){return r.UseBlocker="useBlocker",r.UseLoaderData="useLoaderData",r.UseActionData="useActionData",r.UseRouteError="useRouteError",r.UseNavigation="useNavigation",r.UseRouteLoaderData="useRouteLoaderData",r.UseMatches="useMatches",r.UseRevalidator="useRevalidator",r.UseNavigateStable="useNavigate",r.UseRouteId="useRouteId",r})(ap||{});function $y(r){let a=p.useContext(Rd);return a||ct(!1),a}function By(r){let a=p.useContext(Py);return a||ct(!1),a}function Vy(r){let a=p.useContext(Vn);return a||ct(!1),a}function lp(r){let a=Vy(),l=a.matches[a.matches.length-1];return l.route.id||ct(!1),l.route.id}function Uy(){var r;let a=p.useContext(tp),l=By(),o=lp();return a!==void 0?a:(r=l.errors)==null?void 0:r[o]}function Wy(){let{router:r}=$y(sp.UseNavigateStable),a=lp(ap.UseNavigateStable),l=p.useRef(!1);return np(()=>{l.current=!0}),p.useCallback(function(c,u){u===void 0&&(u={}),l.current&&(typeof c=="number"?r.navigate(c):r.navigate(c,Ia({fromRouteId:a},u)))},[r,a])}const nm={};function Hy(r,a,l){nm[r]||(nm[r]=!0)}function Ky(r,a){r==null||r.v7_startTransition,r==null||r.v7_relativeSplatPath}function Gy(r){let{to:a,replace:l,state:o,relative:c}=r;Ls()||ct(!1);let{future:u,static:f}=p.useContext(wr),{matches:m}=p.useContext(Vn),{pathname:x}=Jr(),g=Oa(),v=Pd(a,Ed(m,u.v7_relativeSplatPath),x,c==="path"),y=JSON.stringify(v);return p.useEffect(()=>g(JSON.parse(y),{replace:l,state:o,relative:c}),[g,y,c,l,o]),null}function Yy(r){return Iy(r.context)}function at(r){ct(!1)}function Qy(r){let{basename:a="/",children:l=null,location:o,navigationType:c=hr.Pop,navigator:u,static:f=!1,future:m}=r;Ls()&&ct(!1);let x=a.replace(/^\/*/,"/"),g=p.useMemo(()=>({basename:x,navigator:u,static:f,future:Ia({v7_relativeSplatPath:!1},m)}),[x,m,u,f]);typeof o=="string"&&(o=Ms(o));let{pathname:v="/",search:y="",hash:E="",state:P=null,key:C="default"}=o,N=p.useMemo(()=>{let b=kd(v,x);return b==null?null:{location:{pathname:b,search:y,hash:E,state:P,key:C},navigationType:c}},[x,v,y,E,P,C,c]);return N==null?null:p.createElement(wr.Provider,{value:g},p.createElement(Ci.Provider,{children:l,value:N}))}function qy(r){let{children:a,location:l}=r;return Ay(td(a),l)}new Promise(()=>{});function td(r,a){a===void 0&&(a=[]);let l=[];return p.Children.forEach(r,(o,c)=>{if(!p.isValidElement(o))return;let u=[...a,c];if(o.type===p.Fragment){l.push.apply(l,td(o.props.children,u));return}o.type!==at&&ct(!1),!o.props.index||!o.props.children||ct(!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=td(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 nd(){return nd=Object.assign?Object.assign.bind():function(r){for(var a=1;a=0)&&(l[c]=r[c]);return l}function Jy(r){return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}function Zy(r,a){return r.button===0&&(!a||a==="_self")&&!Jy(r)}const ej=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],tj="6";try{window.__reactRouterVersion=tj}catch{}const nj="startTransition",rm=Si[nj];function rj(r){let{basename:a,children:l,future:o,window:c}=r,u=p.useRef();u.current==null&&(u.current=ty({window:c,v5Compat:!0}));let f=u.current,[m,x]=p.useState({action:f.action,location:f.location}),{v7_startTransition:g}=o||{},v=p.useCallback(y=>{g&&rm?rm(()=>x(y)):x(y)},[x,g]);return p.useLayoutEffect(()=>f.listen(v),[f,v]),p.useEffect(()=>Ky(o),[o]),p.createElement(Qy,{basename:a,children:l,location:m.location,navigationType:m.action,navigator:f,future:o})}const sj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",aj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ip=p.forwardRef(function(a,l){let{onClick:o,relative:c,reloadDocument:u,replace:f,state:m,target:x,to:g,preventScrollReset:v,viewTransition:y}=a,E=Xy(a,ej),{basename:P}=p.useContext(wr),C,N=!1;if(typeof g=="string"&&aj.test(g)&&(C=g,sj))try{let j=new URL(window.location.href),_=g.startsWith("//")?new URL(j.protocol+g):new URL(g),F=kd(_.pathname,P);_.origin===j.origin&&F!=null?g=F+_.search+_.hash:N=!0}catch{}let b=Ry(g,{relative:c}),k=lj(g,{replace:f,state:m,target:x,preventScrollReset:v,relative:c,viewTransition:y});function R(j){o&&o(j),j.defaultPrevented||k(j)}return p.createElement("a",nd({},E,{href:C||b,onClick:N||u?o:R,ref:l,target:x}))});var sm;(function(r){r.UseScrollRestoration="useScrollRestoration",r.UseSubmit="useSubmit",r.UseSubmitFetcher="useSubmitFetcher",r.UseFetcher="useFetcher",r.useViewTransitionState="useViewTransitionState"})(sm||(sm={}));var am;(function(r){r.UseFetcher="useFetcher",r.UseFetchers="useFetchers",r.UseScrollRestoration="useScrollRestoration"})(am||(am={}));function lj(r,a){let{target:l,replace:o,state:c,preventScrollReset:u,relative:f,viewTransition:m}=a===void 0?{}:a,x=Oa(),g=Jr(),v=rp(r,{relative:f});return p.useCallback(y=>{if(Zy(y,l)){y.preventDefault();let E=o!==void 0?o:ui(g)===ui(v);x(r,{replace:E,state:c,preventScrollReset:u,relative:f,viewTransition:m})}},[g,x,v,o,c,l,r,u,f,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 ij=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),oj=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,l,o)=>o?o.toUpperCase():l.toLowerCase()),lm=r=>{const a=oj(r);return a.charAt(0).toUpperCase()+a.slice(1)},op=(...r)=>r.filter((a,l,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===l).join(" ").trim(),cj=r=>{for(const a in r)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 dj={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 uj=p.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:f,...m},x)=>p.createElement("svg",{ref:x,...dj,width:a,height:a,stroke:r,strokeWidth:o?Number(l)*24/Number(a):l,className:op("lucide",c),...!u&&!cj(m)&&{"aria-hidden":"true"},...m},[...f.map(([g,v])=>p.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 we=(r,a)=>{const l=p.forwardRef(({className:o,...c},u)=>p.createElement(uj,{ref:u,iconNode:a,className:op(`lucide-${ij(lm(r))}`,`lucide-${r}`,o),...c}));return l.displayName=lm(r),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 fj=[["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"}]],im=we("bitcoin",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 hj=[["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"}]],Ts=we("book-open",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 mj=[["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"}]],Aa=we("calendar",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 pj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ki=we("check",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 xj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],cp=we("chevron-down",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 gj=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],dp=we("chevron-right",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 vj=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],yj=we("chevron-up",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 jj=[["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"}]],wj=we("circle-alert",jj);/** + * @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=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],rd=we("circle-check-big",Nj);/** + * @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=[["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"}]],up=we("circle-question-mark",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 Sj=[["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"}]],om=we("circle-user",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=[["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"}]],kj=we("circle-x",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 Ej=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],fp=we("clock",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=[["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"}]],hp=we("copy",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=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],sd=we("credit-card",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:"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"}]],Ei=we("crown",_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 Tj=[["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"}]],fi=we("dollar-sign",Tj);/** + * @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=[["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"}]],Aj=we("download",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 Mj=[["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"}]],hi=we("external-link",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:"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"}]],_d=we("eye",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 Dj=[["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"}]],Oj=we("file-text",Dj);/** + * @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=[["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"}]],zj=we("funnel",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 $j=[["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"}]],cm=we("gift",$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=[["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"}]],Vj=we("git-merge",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 Uj=[["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"}]],ad=we("globe",Uj);/** + * @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:"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"}]],Hj=we("graduation-cap",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 Kj=[["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"}]],dm=we("history",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 Gj=[["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"}]],Yj=we("house",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",{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"}]],qj=we("image",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:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ql=we("info",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 Jj=[["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"}]],um=we("key",Jj);/** + * @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=[["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"}]],ew=we("layout-dashboard",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 tw=[["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"}]],Wr=we("link-2",tw);/** + * @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 nw=[["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"}]],fm=we("link",nw);/** + * @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 rw=[["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"}]],sw=we("lock",rw);/** + * @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 aw=[["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"}]],lw=we("log-out",aw);/** + * @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 iw=[["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"}]],ow=we("map-pin",iw);/** + * @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 cw=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],dw=we("menu",cw);/** + * @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 uw=[["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"}]],fw=we("message-circle",uw);/** + * @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 hw=[["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"}]],mw=we("palette",hw);/** + * @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 pw=[["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"}]],gr=we("pen-line",pw);/** + * @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 xw=[["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"}]],gw=we("percent",xw);/** + * @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 vw=[["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"}]],yw=we("phone",vw);/** + * @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 jw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],pr=we("plus",jw);/** + * @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 ww=[["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"}]],hm=we("qr-code",ww);/** + * @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 Nw=[["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"}]],tt=we("refresh-cw",Nw);/** + * @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 bw=[["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"}]],an=we("save",bw);/** + * @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 Sw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Hr=we("search",Sw);/** + * @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 Cw=[["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"}]],mi=we("settings",Cw);/** + * @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 kw=[["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"}]],Ew=we("settings-2",kw);/** + * @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 Pw=[["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"}]],Rw=we("shield-check",Pw);/** + * @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 _w=[["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"}]],ld=we("shopping-bag",_w);/** + * @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 Tw=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],id=we("smartphone",Tw);/** + * @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 Iw=[["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"}]],Aw=we("tag",Iw);/** + * @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 Mw=[["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"}]],Fa=we("trash-2",Mw);/** + * @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 Lw=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],od=we("trending-up",Lw);/** + * @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 Dw=[["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"}]],mp=we("undo-2",Dw);/** + * @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 Ow=[["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"}]],mm=we("upload",Ow);/** + * @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 Fw=[["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"}]],pm=we("user-plus",Fw);/** + * @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 zw=[["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"}]],ai=we("user",zw);/** + * @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 $w=[["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"}]],xn=we("users",$w);/** + * @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 Bw=[["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"}]],Is=we("wallet",Bw);/** + * @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 Vw=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Pn=we("x",Vw);/** + * @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 Uw=[["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"}]],Ww=we("zap",Uw),Td="admin_token";function Hw(){try{return localStorage.getItem(Td)}catch{return null}}function Kw(r){try{localStorage.setItem(Td,r)}catch{}}function Gw(){try{localStorage.removeItem(Td)}catch{}}const Yw="https://soulapi.quwanzhi.com",Qw=()=>{const r="https://soulapi.quwanzhi.com";return r.length>0?r.replace(/\/$/,""):Yw};function pp(r){const a=Qw(),l=r.startsWith("/")?r:`/${r}`;return a?`${a}${l}`:l}async function Pi(r,a={}){const{data:l,...o}=a,c=pp(r),u=new Headers(o.headers),f=Hw();f&&u.set("Authorization",`Bearer ${f}`),l!=null&&!u.has("Content-Type")&&u.set("Content-Type","application/json");const m=l!=null?JSON.stringify(l):o.body,x=await fetch(c,{...o,headers:u,body:m,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 He(r,a){return Pi(r,{...a,method:"GET"})}function jt(r,a,l){return Pi(r,{...l,method:"POST",data:a})}function zt(r,a,l){return Pi(r,{...l,method:"PUT",data:a})}function Ri(r,a){return Pi(r,{...a,method:"DELETE"})}const qw=[{icon:ew,label:"数据概览",href:"/dashboard"},{icon:Ts,label:"内容管理",href:"/content"},{icon:xn,label:"用户管理",href:"/users"},{icon:Ei,label:"VIP 角色",href:"/vip-roles"},{icon:Hj,label:"导师管理",href:"/mentors"},{icon:Aa,label:"导师预约",href:"/mentor-consultations"},{icon:Is,label:"交易中心",href:"/distribution"},{icon:Vj,label:"匹配记录",href:"/match-records"},{icon:sd,label:"推广设置",href:"/referral-settings"},{icon:mi,label:"系统设置",href:"/settings"}];function Xw(){const r=Jr(),a=Oa(),[l,o]=p.useState(!1),[c,u]=p.useState(!1);p.useEffect(()=>{o(!0)},[]),p.useEffect(()=>{if(!l)return;u(!1);let m=!1;return He("/api/admin").then(x=>{m||(x&&x.success!==!1?u(!0):a("/login",{replace:!0}))}).catch(()=>{m||a("/login",{replace:!0})}),()=>{m=!0}},[l,a]);const f=async()=>{Gw();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.jsx("nav",{className:"flex-1 p-4 space-y-1",children:qw.map(m=>{const x=r.pathname===m.href;return t.jsxs(ip,{to:m.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${x?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[t.jsx(m.icon,{className:"w-5 h-5"}),t.jsx("span",{className:"text-sm",children:m.label})]},m.href)})}),t.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:t.jsxs("button",{type:"button",onClick:f,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(lw,{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(Yy,{})})})]})}function xm(r,a){if(typeof r=="function")return r(a);r!=null&&(r.current=a)}function Id(...r){return a=>{let l=!1;const o=r.map(c=>{const u=xm(c,a);return!l&&typeof u=="function"&&(l=!0),u});if(l)return()=>{for(let c=0;c{let{children:u,...f}=o;xp(u)&&typeof pi=="function"&&(u=pi(u._payload));const m=p.Children.toArray(u),x=m.find(nN);if(x){const g=x.props.children,v=m.map(y=>y===x?p.Children.count(g)>1?p.Children.only(null):p.isValidElement(g)?g.props.children:null:y);return t.jsx(a,{...f,ref:c,children:p.isValidElement(g)?p.cloneElement(g,void 0,v):null})}return t.jsx(a,{...f,ref:c,children:u})});return l.displayName=`${r}.Slot`,l}var vp=gp("Slot");function eN(r){const a=p.forwardRef((l,o)=>{let{children:c,...u}=l;if(xp(c)&&typeof pi=="function"&&(c=pi(c._payload)),p.isValidElement(c)){const f=sN(c),m=rN(u,c.props);return c.type!==p.Fragment&&(m.ref=o?Id(o,f):f),p.cloneElement(c,m)}return p.Children.count(c)>1?p.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var tN=Symbol("radix.slottable");function nN(r){return p.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===tN}function rN(r,a){const l={...a};for(const o in a){const c=r[o],u=a[o];/^on[A-Z]/.test(o)?c&&u?l[o]=(...m)=>{const x=u(...m);return c(...m),x}:c&&(l[o]=c):o==="style"?l[o]={...c,...u}:o==="className"&&(l[o]=[c,u].filter(Boolean).join(" "))}return{...r,...l}}function sN(r){var o,c;let a=(o=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:o.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?r.ref:(a=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?r.props.ref:r.props.ref||r.ref)}function yp(r){var a,l,o="";if(typeof r=="string"||typeof r=="number")o+=r;else if(typeof r=="object")if(Array.isArray(r)){var c=r.length;for(a=0;atypeof r=="boolean"?`${r}`:r===0?"0":r,vm=jp,wp=(r,a)=>l=>{var o;if((a==null?void 0:a.variants)==null)return vm(r,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 E=gm(v)||gm(y);return c[g][E]}),m=l&&Object.entries(l).reduce((g,v)=>{let[y,E]=v;return E===void 0||(g[y]=E),g},{}),x=a==null||(o=a.compoundVariants)===null||o===void 0?void 0:o.reduce((g,v)=>{let{class:y,className:E,...P}=v;return Object.entries(P).every(C=>{let[N,b]=C;return Array.isArray(b)?b.includes({...u,...m}[N]):{...u,...m}[N]===b})?[...g,y,E]:g},[]);return vm(r,f,x,l==null?void 0:l.class,l==null?void 0:l.className)},aN=(r,a)=>{const l=new Array(r.length+a.length);for(let o=0;o({classGroupId:r,validator:a}),Np=(r=new Map,a=null,l)=>({nextPart:r,validators:a,classGroupId:l}),xi="-",ym=[],iN="arbitrary..",oN=r=>{const a=dN(r),{conflictingClassGroups:l,conflictingClassGroupModifiers:o}=r;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return cN(f);const m=f.split(xi),x=m[0]===""&&m.length>1?1:0;return bp(m,x,a)},getConflictingClassGroupIds:(f,m)=>{if(m){const x=o[f],g=l[f];return x?g?aN(g,x):x:g||ym}return l[f]||ym}}},bp=(r,a,l)=>{if(r.length-a===0)return l.classGroupId;const c=r[a],u=l.nextPart.get(c);if(u){const g=bp(r,a+1,u);if(g)return g}const f=l.validators;if(f===null)return;const m=a===0?r.join(xi):r.slice(a).join(xi),x=f.length;for(let g=0;gr.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=r.slice(1,-1),l=a.indexOf(":"),o=a.slice(0,l);return o?iN+o:void 0})(),dN=r=>{const{theme:a,classGroups:l}=r;return uN(l,a)},uN=(r,a)=>{const l=Np();for(const o in r){const c=r[o];Ad(c,l,o,a)}return l},Ad=(r,a,l,o)=>{const c=r.length;for(let u=0;u{if(typeof r=="string"){hN(r,a,l);return}if(typeof r=="function"){mN(r,a,l,o);return}pN(r,a,l,o)},hN=(r,a,l)=>{const o=r===""?a:Sp(a,r);o.classGroupId=l},mN=(r,a,l,o)=>{if(xN(r)){Ad(r(o),a,l,o);return}a.validators===null&&(a.validators=[]),a.validators.push(lN(l,r))},pN=(r,a,l,o)=>{const c=Object.entries(r),u=c.length;for(let f=0;f{let l=r;const o=a.split(xi),c=o.length;for(let u=0;u"isThemeGetter"in r&&r.isThemeGetter===!0,gN=r=>{if(r<1)return{get:()=>{},set:()=>{}};let a=0,l=Object.create(null),o=Object.create(null);const c=(u,f)=>{l[u]=f,a++,a>r&&(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)}}},cd="!",jm=":",vN=[],wm=(r,a,l,o,c)=>({modifiers:r,hasImportantModifier:a,baseClassName:l,maybePostfixModifierPosition:o,isExternal:c}),yN=r=>{const{prefix:a,experimentalParseClassName:l}=r;let o=c=>{const u=[];let f=0,m=0,x=0,g;const v=c.length;for(let N=0;Nx?g-x:void 0;return wm(u,P,E,C)};if(a){const c=a+jm,u=o;o=f=>f.startsWith(c)?u(f.slice(c.length)):wm(vN,!1,f,void 0,!0)}if(l){const c=o;o=u=>l({className:u,parseClassName:c})}return o},jN=r=>{const a=new Map;return r.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}},wN=r=>({cache:gN(r.cacheSize),parseClassName:yN(r),sortModifiers:jN(r),...oN(r)}),NN=/\s+/,bN=(r,a)=>{const{parseClassName:l,getClassGroupId:o,getConflictingClassGroupIds:c,sortModifiers:u}=a,f=[],m=r.trim().split(NN);let x="";for(let g=m.length-1;g>=0;g-=1){const v=m[g],{isExternal:y,modifiers:E,hasImportantModifier:P,baseClassName:C,maybePostfixModifierPosition:N}=l(v);if(y){x=v+(x.length>0?" "+x:x);continue}let b=!!N,k=o(b?C.substring(0,N):C);if(!k){if(!b){x=v+(x.length>0?" "+x:x);continue}if(k=o(C),!k){x=v+(x.length>0?" "+x:x);continue}b=!1}const R=E.length===0?"":E.length===1?E[0]:u(E).join(":"),j=P?R+cd:R,_=j+k;if(f.indexOf(_)>-1)continue;f.push(_);const F=c(k,b);for(let G=0;G0?" "+x:x)}return x},SN=(...r)=>{let a=0,l,o,c="";for(;a{if(typeof r=="string")return r;let a,l="";for(let o=0;o{let l,o,c,u;const f=x=>{const g=a.reduce((v,y)=>y(v),r());return l=wN(g),o=l.cache.get,c=l.cache.set,u=m,m(x)},m=x=>{const g=o(x);if(g)return g;const v=bN(x,l);return c(x,v),v};return u=f,(...x)=>u(SN(...x))},kN=[],xt=r=>{const a=l=>l[r]||kN;return a.isThemeGetter=!0,a},kp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ep=/^\((?:(\w[\w-]*):)?(.+)\)$/i,EN=/^\d+\/\d+$/,PN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,RN=/\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$/,_N=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,TN=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,IN=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ss=r=>EN.test(r),Le=r=>!!r&&!Number.isNaN(Number(r)),cr=r=>!!r&&Number.isInteger(Number(r)),zc=r=>r.endsWith("%")&&Le(r.slice(0,-1)),zn=r=>PN.test(r),AN=()=>!0,MN=r=>RN.test(r)&&!_N.test(r),Pp=()=>!1,LN=r=>TN.test(r),DN=r=>IN.test(r),ON=r=>!ye(r)&&!je(r),FN=r=>Ds(r,Tp,Pp),ye=r=>kp.test(r),Ur=r=>Ds(r,Ip,MN),$c=r=>Ds(r,UN,Le),Nm=r=>Ds(r,Rp,Pp),zN=r=>Ds(r,_p,DN),Xl=r=>Ds(r,Ap,LN),je=r=>Ep.test(r),Ra=r=>Os(r,Ip),$N=r=>Os(r,WN),bm=r=>Os(r,Rp),BN=r=>Os(r,Tp),VN=r=>Os(r,_p),Jl=r=>Os(r,Ap,!0),Ds=(r,a,l)=>{const o=kp.exec(r);return o?o[1]?a(o[1]):l(o[2]):!1},Os=(r,a,l=!1)=>{const o=Ep.exec(r);return o?o[1]?a(o[1]):l:!1},Rp=r=>r==="position"||r==="percentage",_p=r=>r==="image"||r==="url",Tp=r=>r==="length"||r==="size"||r==="bg-size",Ip=r=>r==="length",UN=r=>r==="number",WN=r=>r==="family-name",Ap=r=>r==="shadow",HN=()=>{const r=xt("color"),a=xt("font"),l=xt("text"),o=xt("font-weight"),c=xt("tracking"),u=xt("leading"),f=xt("breakpoint"),m=xt("container"),x=xt("spacing"),g=xt("radius"),v=xt("shadow"),y=xt("inset-shadow"),E=xt("text-shadow"),P=xt("drop-shadow"),C=xt("blur"),N=xt("perspective"),b=xt("aspect"),k=xt("ease"),R=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"],F=()=>[..._(),je,ye],G=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],V=()=>[je,ye,x],te=()=>[Ss,"full","auto",...V()],ue=()=>[cr,"none","subgrid",je,ye],ce=()=>["auto",{span:["full",cr,je,ye]},cr,je,ye],ie=()=>[cr,"auto",je,ye],fe=()=>["auto","min","max","fr",je,ye],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...V()],K=()=>[Ss,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],A=()=>[r,je,ye],J=()=>[..._(),bm,Nm,{position:[je,ye]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],S=()=>["auto","cover","contain",BN,FN,{size:[je,ye]}],D=()=>[zc,Ra,Ur],ae=()=>["","none","full",g,je,ye],oe=()=>["",Le,Ra,Ur],Ne=()=>["solid","dashed","dotted","double"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>[Le,zc,bm,Nm],xe=()=>["","none",C,je,ye],I=()=>["none",Le,je,ye],se=()=>["none",Le,je,ye],he=()=>[Le,je,ye],Pe=()=>[Ss,"full",...V()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[zn],breakpoint:[zn],color:[AN],container:[zn],"drop-shadow":[zn],ease:["in","out","in-out"],font:[ON],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[zn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[zn],shadow:[zn],spacing:["px",Le],text:[zn],"text-shadow":[zn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ss,ye,je,b]}],container:["container"],columns:[{columns:[Le,ye,je,m]}],"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:F()}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:te()}],"inset-x":[{"inset-x":te()}],"inset-y":[{"inset-y":te()}],start:[{start:te()}],end:[{end:te()}],top:[{top:te()}],right:[{right:te()}],bottom:[{bottom:te()}],left:[{left:te()}],visibility:["visible","invisible","collapse"],z:[{z:[cr,"auto",je,ye]}],basis:[{basis:[Ss,"full","auto",m,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Le,Ss,"auto","initial","none",ye]}],grow:[{grow:["",Le,je,ye]}],shrink:[{shrink:["",Le,je,ye]}],order:[{order:[cr,"first","last","none",je,ye]}],"grid-cols":[{"grid-cols":ue()}],"col-start-end":[{col:ce()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":ue()}],"row-start-end":[{row:ce()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":fe()}],"auto-rows":[{"auto-rows":fe()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[m,"screen",...K()]}],"min-w":[{"min-w":[m,"screen","none",...K()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[f]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",l,Ra,Ur]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,je,$c]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",zc,ye]}],"font-family":[{font:[$N,ye,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,je,ye]}],"line-clamp":[{"line-clamp":[Le,"none",je,$c]}],leading:[{leading:[u,...V()]}],"list-image":[{"list-image":["none",je,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",je,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ne(),"wavy"]}],"text-decoration-thickness":[{decoration:[Le,"from-font","auto",je,Ur]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[Le,"auto",je,ye]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",je,ye]}],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",je,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:S()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},cr,je,ye],radial:["",je,ye],conic:[cr,je,ye]},VN,zN]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:D()}],"gradient-via-pos":[{via:D()}],"gradient-to-pos":[{to:D()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ne(),"hidden","none"]}],"divide-style":[{divide:[...Ne(),"hidden","none"]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:[...Ne(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Le,je,ye]}],"outline-w":[{outline:["",Le,Ra,Ur]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",v,Jl,Xl]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",y,Jl,Xl]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[Le,Ur]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",E,Jl,Xl]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[Le,je,ye]}],"mix-blend":[{"mix-blend":[...me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":me()}],"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":[Le]}],"mask-image-linear-from-pos":[{"mask-linear-from":Q()}],"mask-image-linear-to-pos":[{"mask-linear-to":Q()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":Q()}],"mask-image-t-to-pos":[{"mask-t-to":Q()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":Q()}],"mask-image-r-to-pos":[{"mask-r-to":Q()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":Q()}],"mask-image-b-to-pos":[{"mask-b-to":Q()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":Q()}],"mask-image-l-to-pos":[{"mask-l-to":Q()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":Q()}],"mask-image-x-to-pos":[{"mask-x-to":Q()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":Q()}],"mask-image-y-to-pos":[{"mask-y-to":Q()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[je,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":Q()}],"mask-image-radial-to-pos":[{"mask-radial-to":Q()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"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":[Le]}],"mask-image-conic-from-pos":[{"mask-conic-from":Q()}],"mask-image-conic-to-pos":[{"mask-conic-to":Q()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:J()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:S()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",je,ye]}],filter:[{filter:["","none",je,ye]}],blur:[{blur:xe()}],brightness:[{brightness:[Le,je,ye]}],contrast:[{contrast:[Le,je,ye]}],"drop-shadow":[{"drop-shadow":["","none",P,Jl,Xl]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",Le,je,ye]}],"hue-rotate":[{"hue-rotate":[Le,je,ye]}],invert:[{invert:["",Le,je,ye]}],saturate:[{saturate:[Le,je,ye]}],sepia:[{sepia:["",Le,je,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",je,ye]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[Le,je,ye]}],"backdrop-contrast":[{"backdrop-contrast":[Le,je,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Le,je,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Le,je,ye]}],"backdrop-invert":[{"backdrop-invert":["",Le,je,ye]}],"backdrop-opacity":[{"backdrop-opacity":[Le,je,ye]}],"backdrop-saturate":[{"backdrop-saturate":[Le,je,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",Le,je,ye]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",je,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Le,"initial",je,ye]}],ease:[{ease:["linear","initial",k,je,ye]}],delay:[{delay:[Le,je,ye]}],animate:[{animate:["none",R,je,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,je,ye]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:I()}],"rotate-x":[{"rotate-x":I()}],"rotate-y":[{"rotate-y":I()}],"rotate-z":[{"rotate-z":I()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":["scale-3d"],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[je,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pe()}],"translate-x":[{"translate-x":Pe()}],"translate-y":[{"translate-y":Pe()}],"translate-z":[{"translate-z":Pe()}],"translate-none":["translate-none"],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"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",je,ye]}],"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":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"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",je,ye]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[Le,Ra,Ur,$c]}],stroke:[{stroke:["none",...A()]}],"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"]}},KN=CN(HN);function Ge(...r){return KN(jp(r))}const GN=wp("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 de({className:r,variant:a,size:l,asChild:o=!1,...c}){const u=o?vp:"button";return t.jsx(u,{"data-slot":"button",className:Ge(GN({variant:a,size:l,className:r})),...c})}function ne({className:r,type:a,...l}){return t.jsx("input",{type:a,"data-slot":"input",className:Ge("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",r),...l})}function YN(){const r=Oa(),[a,l]=p.useState(""),[o,c]=p.useState(""),[u,f]=p.useState(""),[m,x]=p.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)){Kw(v.token),r("/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(Rw,{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(ai,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx(ne,{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(sw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),t.jsx(ne,{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(de,{onClick:g,disabled:m,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:m?"登录中...":"登录"})]})]}),t.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Ce=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("rounded-xl border bg-card text-card-foreground shadow",r),...a}));Ce.displayName="Card";const Be=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("flex flex-col space-y-1.5 p-6",r),...a}));Be.displayName="CardHeader";const Ve=p.forwardRef(({className:r,...a},l)=>t.jsx("h3",{ref:l,className:Ge("font-semibold leading-none tracking-tight",r),...a}));Ve.displayName="CardTitle";const ht=p.forwardRef(({className:r,...a},l)=>t.jsx("p",{ref:l,className:Ge("text-sm text-muted-foreground",r),...a}));ht.displayName="CardDescription";const ke=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("p-6 pt-0",r),...a}));ke.displayName="CardContent";const QN=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{ref:l,className:Ge("flex items-center p-6 pt-0",r),...a}));QN.displayName="CardFooter";function qN(){const r=Oa(),[a,l]=p.useState(!0),[o,c]=p.useState([]),[u,f]=p.useState([]);async function m(){l(!0);try{const[C,N]=await Promise.all([He("/api/db/users"),He("/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(p.useEffect(()=>{m()},[]),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(tt,{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,E=C=>{const N=C.productType||"",b=C.description||"";if(b){if(N==="section"&&b.includes("章节")){if(b.includes("-")){const k=b.split("-");if(k.length>=3)return{title:`第${k[1]}章 第${k[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:b,subtitle:"章节购买"}}return N==="fullbook"||b.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:N==="match"||b.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:b,subtitle:N==="section"?"单章":N==="fullbook"?"全书":"其他"}}return N==="section"?{title:`章节 ${C.productId||""}`,subtitle:"单章购买"}:N==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:N==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:N||"其他"}},P=[{title:"总用户数",value:v,icon:xn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:`¥${Number(g).toFixed(2)}`,icon:od,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:y,icon:ld,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:`${v>0?(y/v*100).toFixed(1):0}%`,icon:Ts,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:P.map((C,N)=>t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>C.link&&r(C.link),children:[t.jsxs(Be,{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(ke,{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(dp,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"最近订单"})}),t.jsx(ke,{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,b=C.referralCode||(N==null?void 0:N.referralCode)||(N==null?void 0:N.nickname)||(C.referrerId?String(C.referrerId).slice(0,8):""),k=E(C),R=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:R,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:_=>{_.currentTarget.style.display="none";const F=_.currentTarget.nextElementSibling;F&&F.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:R.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:R}),t.jsx("span",{className:"text-gray-600",children:"·"}),t.jsx("span",{className:"text-sm font-medium text-white truncate",children:k.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:k.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"})})]}),b&&t.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",b]})]})]}),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(ld,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),t.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"新注册用户"})}),t.jsx(ke,{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 Nr=p.forwardRef(({className:r,...a},l)=>t.jsx("div",{className:"relative w-full overflow-auto",children:t.jsx("table",{ref:l,className:Ge("w-full caption-bottom text-sm",r),...a})}));Nr.displayName="Table";const br=p.forwardRef(({className:r,...a},l)=>t.jsx("thead",{ref:l,className:Ge("[&_tr]:border-b",r),...a}));br.displayName="TableHeader";const Sr=p.forwardRef(({className:r,...a},l)=>t.jsx("tbody",{ref:l,className:Ge("[&_tr:last-child]:border-0",r),...a}));Sr.displayName="TableBody";const dt=p.forwardRef(({className:r,...a},l)=>t.jsx("tr",{ref:l,className:Ge("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r),...a}));dt.displayName="TableRow";const Te=p.forwardRef(({className:r,...a},l)=>t.jsx("th",{ref:l,className:Ge("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",r),...a}));Te.displayName="TableHead";const Ee=p.forwardRef(({className:r,...a},l)=>t.jsx("td",{ref:l,className:Ge("p-4 align-middle [&:has([role=checkbox])]:pr-0",r),...a}));Ee.displayName="TableCell";const XN=wp("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 De({className:r,variant:a,asChild:l=!1,...o}){const c=l?vp:"span";return t.jsx(c,{className:Ge(XN({variant:a}),r),...o})}function Ae(r,a,{checkForDefaultPrevented:l=!0}={}){return function(c){if(r==null||r(c),l===!1||!c.defaultPrevented)return a==null?void 0:a(c)}}function JN(r,a){const l=p.createContext(a),o=u=>{const{children:f,...m}=u,x=p.useMemo(()=>m,Object.values(m));return t.jsx(l.Provider,{value:x,children:f})};o.displayName=r+"Provider";function c(u){const f=p.useContext(l);if(f)return f;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${r}\``)}return[o,c]}function Cr(r,a=[]){let l=[];function o(u,f){const m=p.createContext(f),x=l.length;l=[...l,f];const g=y=>{var k;const{scope:E,children:P,...C}=y,N=((k=E==null?void 0:E[r])==null?void 0:k[x])||m,b=p.useMemo(()=>C,Object.values(C));return t.jsx(N.Provider,{value:b,children:P})};g.displayName=u+"Provider";function v(y,E){var N;const P=((N=E==null?void 0:E[r])==null?void 0:N[x])||m,C=p.useContext(P);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=>p.createContext(f));return function(m){const x=(m==null?void 0:m[r])||u;return p.useMemo(()=>({[`__scope${r}`]:{...m,[r]:x}}),[m,x])}};return c.scopeName=r,[o,ZN(c,...a)]}function ZN(...r){const a=r[0];if(r.length===1)return a;const l=()=>{const o=r.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(u){const f=o.reduce((m,{useScope:x,scopeName:g})=>{const y=x(u)[`__scope${g}`];return{...m,...y}},{});return p.useMemo(()=>({[`__scope${a.scopeName}`]:f}),[f])}};return l.scopeName=a.scopeName,l}var Pt=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},eb=Si[" useId ".trim().toString()]||(()=>{}),tb=0;function xr(r){const[a,l]=p.useState(eb());return Pt(()=>{l(o=>o??String(tb++))},[r]),a?`radix-${a}`:""}var nb=Si[" useInsertionEffect ".trim().toString()]||Pt;function Gr({prop:r,defaultProp:a,onChange:l=()=>{},caller:o}){const[c,u,f]=rb({defaultProp:a,onChange:l}),m=r!==void 0,x=m?r:c;{const v=p.useRef(r!==void 0);p.useEffect(()=>{const y=v.current;y!==m&&console.warn(`${o} is changing from ${y?"controlled":"uncontrolled"} to ${m?"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=m},[m,o])}const g=p.useCallback(v=>{var y;if(m){const E=sb(v)?v(r):v;E!==r&&((y=f.current)==null||y.call(f,E))}else u(v)},[m,r,u,f]);return[x,g]}function rb({defaultProp:r,onChange:a}){const[l,o]=p.useState(r),c=p.useRef(l),u=p.useRef(a);return nb(()=>{u.current=a},[a]),p.useEffect(()=>{var f;c.current!==l&&((f=u.current)==null||f.call(u,l),c.current=l)},[l,c]),[l,o,u]}function sb(r){return typeof r=="function"}function Ma(r){const a=ab(r),l=p.forwardRef((o,c)=>{const{children:u,...f}=o,m=p.Children.toArray(u),x=m.find(ib);if(x){const g=x.props.children,v=m.map(y=>y===x?p.Children.count(g)>1?p.Children.only(null):p.isValidElement(g)?g.props.children:null:y);return t.jsx(a,{...f,ref:c,children:p.isValidElement(g)?p.cloneElement(g,void 0,v):null})}return t.jsx(a,{...f,ref:c,children:u})});return l.displayName=`${r}.Slot`,l}function ab(r){const a=p.forwardRef((l,o)=>{const{children:c,...u}=l;if(p.isValidElement(c)){const f=cb(c),m=ob(u,c.props);return c.type!==p.Fragment&&(m.ref=o?Id(o,f):f),p.cloneElement(c,m)}return p.Children.count(c)>1?p.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var lb=Symbol("radix.slottable");function ib(r){return p.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===lb}function ob(r,a){const l={...a};for(const o in a){const c=r[o],u=a[o];/^on[A-Z]/.test(o)?c&&u?l[o]=(...m)=>{const x=u(...m);return c(...m),x}:c&&(l[o]=c):o==="style"?l[o]={...c,...u}:o==="className"&&(l[o]=[c,u].filter(Boolean).join(" "))}return{...r,...l}}function cb(r){var o,c;let a=(o=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:o.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?r.ref:(a=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?r.props.ref:r.props.ref||r.ref)}var db=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oe=db.reduce((r,a)=>{const l=Ma(`Primitive.${a}`),o=p.forwardRef((c,u)=>{const{asChild:f,...m}=c,x=f?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(x,{...m,ref:u})});return o.displayName=`Primitive.${a}`,{...r,[a]:o}},{});function ub(r,a){r&&Da.flushSync(()=>r.dispatchEvent(a))}function vr(r){const a=p.useRef(r);return p.useEffect(()=>{a.current=r}),p.useMemo(()=>(...l)=>{var o;return(o=a.current)==null?void 0:o.call(a,...l)},[])}function fb(r,a=globalThis==null?void 0:globalThis.document){const l=vr(r);p.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 hb="DismissableLayer",dd="dismissableLayer.update",mb="dismissableLayer.pointerDownOutside",pb="dismissableLayer.focusOutside",Sm,Mp=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Md=p.forwardRef((r,a)=>{const{disableOutsidePointerEvents:l=!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:f,onDismiss:m,...x}=r,g=p.useContext(Mp),[v,y]=p.useState(null),E=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,P]=p.useState({}),C=Ke(a,M=>y(M)),N=Array.from(g.layers),[b]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),k=N.indexOf(b),R=v?N.indexOf(v):-1,j=g.layersWithOutsidePointerEventsDisabled.size>0,_=R>=k,F=vb(M=>{const V=M.target,te=[...g.branches].some(ue=>ue.contains(V));!_||te||(c==null||c(M),f==null||f(M),M.defaultPrevented||m==null||m())},E),G=yb(M=>{const V=M.target;[...g.branches].some(ue=>ue.contains(V))||(u==null||u(M),f==null||f(M),M.defaultPrevented||m==null||m())},E);return fb(M=>{R===g.layers.size-1&&(o==null||o(M),!M.defaultPrevented&&m&&(M.preventDefault(),m()))},E),p.useEffect(()=>{if(v)return l&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(Sm=E.body.style.pointerEvents,E.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(v)),g.layers.add(v),Cm(),()=>{l&&g.layersWithOutsidePointerEventsDisabled.size===1&&(E.body.style.pointerEvents=Sm)}},[v,E,l,g]),p.useEffect(()=>()=>{v&&(g.layers.delete(v),g.layersWithOutsidePointerEventsDisabled.delete(v),Cm())},[v,g]),p.useEffect(()=>{const M=()=>P({});return document.addEventListener(dd,M),()=>document.removeEventListener(dd,M)},[]),t.jsx(Oe.div,{...x,ref:C,style:{pointerEvents:j?_?"auto":"none":void 0,...r.style},onFocusCapture:Ae(r.onFocusCapture,G.onFocusCapture),onBlurCapture:Ae(r.onBlurCapture,G.onBlurCapture),onPointerDownCapture:Ae(r.onPointerDownCapture,F.onPointerDownCapture)})});Md.displayName=hb;var xb="DismissableLayerBranch",gb=p.forwardRef((r,a)=>{const l=p.useContext(Mp),o=p.useRef(null),c=Ke(a,o);return p.useEffect(()=>{const u=o.current;if(u)return l.branches.add(u),()=>{l.branches.delete(u)}},[l.branches]),t.jsx(Oe.div,{...r,ref:c})});gb.displayName=xb;function vb(r,a=globalThis==null?void 0:globalThis.document){const l=vr(r),o=p.useRef(!1),c=p.useRef(()=>{});return p.useEffect(()=>{const u=m=>{if(m.target&&!o.current){let x=function(){Lp(mb,l,g,{discrete:!0})};const g={originalEvent:m};m.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 yb(r,a=globalThis==null?void 0:globalThis.document){const l=vr(r),o=p.useRef(!1);return p.useEffect(()=>{const c=u=>{u.target&&!o.current&&Lp(pb,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 Cm(){const r=new CustomEvent(dd);document.dispatchEvent(r)}function Lp(r,a,l,{discrete:o}){const c=l.originalEvent.target,u=new CustomEvent(r,{bubbles:!1,cancelable:!0,detail:l});a&&c.addEventListener(r,a,{once:!0}),o?ub(c,u):c.dispatchEvent(u)}var Bc="focusScope.autoFocusOnMount",Vc="focusScope.autoFocusOnUnmount",km={bubbles:!1,cancelable:!0},jb="FocusScope",Ld=p.forwardRef((r,a)=>{const{loop:l=!1,trapped:o=!1,onMountAutoFocus:c,onUnmountAutoFocus:u,...f}=r,[m,x]=p.useState(null),g=vr(c),v=vr(u),y=p.useRef(null),E=Ke(a,N=>x(N)),P=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(o){let N=function(j){if(P.paused||!m)return;const _=j.target;m.contains(_)?y.current=_:ur(y.current,{select:!0})},b=function(j){if(P.paused||!m)return;const _=j.relatedTarget;_!==null&&(m.contains(_)||ur(y.current,{select:!0}))},k=function(j){if(document.activeElement===document.body)for(const F of j)F.removedNodes.length>0&&ur(m)};document.addEventListener("focusin",N),document.addEventListener("focusout",b);const R=new MutationObserver(k);return m&&R.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",b),R.disconnect()}}},[o,m,P.paused]),p.useEffect(()=>{if(m){Pm.add(P);const N=document.activeElement;if(!m.contains(N)){const k=new CustomEvent(Bc,km);m.addEventListener(Bc,g),m.dispatchEvent(k),k.defaultPrevented||(wb(kb(Dp(m)),{select:!0}),document.activeElement===N&&ur(m))}return()=>{m.removeEventListener(Bc,g),setTimeout(()=>{const k=new CustomEvent(Vc,km);m.addEventListener(Vc,v),m.dispatchEvent(k),k.defaultPrevented||ur(N??document.body,{select:!0}),m.removeEventListener(Vc,v),Pm.remove(P)},0)}}},[m,g,v,P]);const C=p.useCallback(N=>{if(!l&&!o||P.paused)return;const b=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,k=document.activeElement;if(b&&k){const R=N.currentTarget,[j,_]=Nb(R);j&&_?!N.shiftKey&&k===_?(N.preventDefault(),l&&ur(j,{select:!0})):N.shiftKey&&k===j&&(N.preventDefault(),l&&ur(_,{select:!0})):k===R&&N.preventDefault()}},[l,o,P.paused]);return t.jsx(Oe.div,{tabIndex:-1,...f,ref:E,onKeyDown:C})});Ld.displayName=jb;function wb(r,{select:a=!1}={}){const l=document.activeElement;for(const o of r)if(ur(o,{select:a}),document.activeElement!==l)return}function Nb(r){const a=Dp(r),l=Em(a,r),o=Em(a.reverse(),r);return[l,o]}function Dp(r){const a=[],l=document.createTreeWalker(r,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 Em(r,a){for(const l of r)if(!bb(l,{upTo:a}))return l}function bb(r,{upTo:a}){if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(a!==void 0&&r===a)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1}function Sb(r){return r instanceof HTMLInputElement&&"select"in r}function ur(r,{select:a=!1}={}){if(r&&r.focus){const l=document.activeElement;r.focus({preventScroll:!0}),r!==l&&Sb(r)&&a&&r.select()}}var Pm=Cb();function Cb(){let r=[];return{add(a){const l=r[0];a!==l&&(l==null||l.pause()),r=Rm(r,a),r.unshift(a)},remove(a){var l;r=Rm(r,a),(l=r[0])==null||l.resume()}}}function Rm(r,a){const l=[...r],o=l.indexOf(a);return o!==-1&&l.splice(o,1),l}function kb(r){return r.filter(a=>a.tagName!=="A")}var Eb="Portal",Dd=p.forwardRef((r,a)=>{var m;const{container:l,...o}=r,[c,u]=p.useState(!1);Pt(()=>u(!0),[]);const f=l||c&&((m=globalThis==null?void 0:globalThis.document)==null?void 0:m.body);return f?ey.createPortal(t.jsx(Oe.div,{...o,ref:a}),f):null});Dd.displayName=Eb;function Pb(r,a){return p.useReducer((l,o)=>a[l][o]??l,r)}var za=r=>{const{present:a,children:l}=r,o=Rb(a),c=typeof l=="function"?l({present:o.isPresent}):p.Children.only(l),u=Ke(o.ref,_b(c));return typeof l=="function"||o.isPresent?p.cloneElement(c,{ref:u}):null};za.displayName="Presence";function Rb(r){const[a,l]=p.useState(),o=p.useRef(null),c=p.useRef(r),u=p.useRef("none"),f=r?"mounted":"unmounted",[m,x]=Pb(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const g=Zl(o.current);u.current=m==="mounted"?g:"none"},[m]),Pt(()=>{const g=o.current,v=c.current;if(v!==r){const E=u.current,P=Zl(g);r?x("MOUNT"):P==="none"||(g==null?void 0:g.display)==="none"?x("UNMOUNT"):x(v&&E!==P?"ANIMATION_OUT":"UNMOUNT"),c.current=r}},[r,x]),Pt(()=>{if(a){let g;const v=a.ownerDocument.defaultView??window,y=P=>{const N=Zl(o.current).includes(CSS.escape(P.animationName));if(P.target===a&&N&&(x("ANIMATION_END"),!c.current)){const b=a.style.animationFillMode;a.style.animationFillMode="forwards",g=v.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=b)})}},E=P=>{P.target===a&&(u.current=Zl(o.current))};return a.addEventListener("animationstart",E),a.addEventListener("animationcancel",y),a.addEventListener("animationend",y),()=>{v.clearTimeout(g),a.removeEventListener("animationstart",E),a.removeEventListener("animationcancel",y),a.removeEventListener("animationend",y)}}else x("ANIMATION_END")},[a,x]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:p.useCallback(g=>{o.current=g?getComputedStyle(g):null,l(g)},[])}}function Zl(r){return(r==null?void 0:r.animationName)||"none"}function _b(r){var o,c;let a=(o=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:o.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?r.ref:(a=(c=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:c.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?r.props.ref:r.props.ref||r.ref)}var Uc=0;function Op(){p.useEffect(()=>{const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",r[0]??_m()),document.body.insertAdjacentElement("beforeend",r[1]??_m()),Uc++,()=>{Uc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Uc--}},[])}function _m(){const r=document.createElement("span");return r.setAttribute("data-radix-focus-guard",""),r.tabIndex=0,r.style.outline="none",r.style.opacity="0",r.style.position="fixed",r.style.pointerEvents="none",r}var Cn=function(){return Cn=Object.assign||function(a){for(var l,o=1,c=arguments.length;o"u")return Gb;var a=Yb(r),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])}},qb=Bp(),Ps="data-scroll-locked",Xb=function(r,a,l,o){var c=r.left,u=r.top,f=r.right,m=r.gap;return l===void 0&&(l="margin"),` + .`.concat(Ib,` { + overflow: hidden `).concat(o,`; + padding-right: `).concat(m,"px ").concat(o,`; + } + body[`).concat(Ps,`] { + 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(m,"px ").concat(o,`; + `),l==="padding"&&"padding-right: ".concat(m,"px ").concat(o,";")].filter(Boolean).join(""),` + } + + .`).concat(li,` { + right: `).concat(m,"px ").concat(o,`; + } + + .`).concat(ii,` { + margin-right: `).concat(m,"px ").concat(o,`; + } + + .`).concat(li," .").concat(li,` { + right: 0 `).concat(o,`; + } + + .`).concat(ii," .").concat(ii,` { + margin-right: 0 `).concat(o,`; + } + + body[`).concat(Ps,`] { + `).concat(Ab,": ").concat(m,`px; + } +`)},Im=function(){var r=parseInt(document.body.getAttribute(Ps)||"0",10);return isFinite(r)?r:0},Jb=function(){p.useEffect(function(){return document.body.setAttribute(Ps,(Im()+1).toString()),function(){var r=Im()-1;r<=0?document.body.removeAttribute(Ps):document.body.setAttribute(Ps,r.toString())}},[])},Zb=function(r){var a=r.noRelative,l=r.noImportant,o=r.gapMode,c=o===void 0?"margin":o;Jb();var u=p.useMemo(function(){return Qb(c)},[c]);return p.createElement(qb,{styles:Xb(u,!a,c,l?"":"!important")})},ud=!1;if(typeof window<"u")try{var ei=Object.defineProperty({},"passive",{get:function(){return ud=!0,!0}});window.addEventListener("test",ei,ei),window.removeEventListener("test",ei,ei)}catch{ud=!1}var Cs=ud?{passive:!1}:!1,e1=function(r){return r.tagName==="TEXTAREA"},Vp=function(r,a){if(!(r instanceof Element))return!1;var l=window.getComputedStyle(r);return l[a]!=="hidden"&&!(l.overflowY===l.overflowX&&!e1(r)&&l[a]==="visible")},t1=function(r){return Vp(r,"overflowY")},n1=function(r){return Vp(r,"overflowX")},Am=function(r,a){var l=a.ownerDocument,o=a;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var c=Up(r,o);if(c){var u=Wp(r,o),f=u[1],m=u[2];if(f>m)return!0}o=o.parentNode}while(o&&o!==l.body);return!1},r1=function(r){var a=r.scrollTop,l=r.scrollHeight,o=r.clientHeight;return[a,l,o]},s1=function(r){var a=r.scrollLeft,l=r.scrollWidth,o=r.clientWidth;return[a,l,o]},Up=function(r,a){return r==="v"?t1(a):n1(a)},Wp=function(r,a){return r==="v"?r1(a):s1(a)},a1=function(r,a){return r==="h"&&a==="rtl"?-1:1},l1=function(r,a,l,o,c){var u=a1(r,window.getComputedStyle(a).direction),f=u*o,m=l.target,x=a.contains(m),g=!1,v=f>0,y=0,E=0;do{if(!m)break;var P=Wp(r,m),C=P[0],N=P[1],b=P[2],k=N-b-u*C;(C||k)&&Up(r,m)&&(y+=k,E+=C);var R=m.parentNode;m=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!x&&m!==document.body||x&&(a.contains(m)||a===m));return(v&&Math.abs(y)<1||!v&&Math.abs(E)<1)&&(g=!0),g},ti=function(r){return"changedTouches"in r?[r.changedTouches[0].clientX,r.changedTouches[0].clientY]:[0,0]},Mm=function(r){return[r.deltaX,r.deltaY]},Lm=function(r){return r&&"current"in r?r.current:r},i1=function(r,a){return r[0]===a[0]&&r[1]===a[1]},o1=function(r){return` + .block-interactivity-`.concat(r,` {pointer-events: none;} + .allow-interactivity-`).concat(r,` {pointer-events: all;} +`)},c1=0,ks=[];function d1(r){var a=p.useRef([]),l=p.useRef([0,0]),o=p.useRef(),c=p.useState(c1++)[0],u=p.useState(Bp)[0],f=p.useRef(r);p.useEffect(function(){f.current=r},[r]),p.useEffect(function(){if(r.inert){document.body.classList.add("block-interactivity-".concat(c));var N=Tb([r.lockRef.current],(r.shards||[]).map(Lm),!0).filter(Boolean);return N.forEach(function(b){return b.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),N.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(c))})}}},[r.inert,r.lockRef.current,r.shards]);var m=p.useCallback(function(N,b){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!f.current.allowPinchZoom;var k=ti(N),R=l.current,j="deltaX"in N?N.deltaX:R[0]-k[0],_="deltaY"in N?N.deltaY:R[1]-k[1],F,G=N.target,M=Math.abs(j)>Math.abs(_)?"h":"v";if("touches"in N&&M==="h"&&G.type==="range")return!1;var V=window.getSelection(),te=V&&V.anchorNode,ue=te?te===G||te.contains(G):!1;if(ue)return!1;var ce=Am(M,G);if(!ce)return!0;if(ce?F=M:(F=M==="v"?"h":"v",ce=Am(M,G)),!ce)return!1;if(!o.current&&"changedTouches"in N&&(j||_)&&(o.current=F),!F)return!0;var ie=o.current||F;return l1(ie,b,N,ie==="h"?j:_)},[]),x=p.useCallback(function(N){var b=N;if(!(!ks.length||ks[ks.length-1]!==u)){var k="deltaY"in b?Mm(b):ti(b),R=a.current.filter(function(F){return F.name===b.type&&(F.target===b.target||b.target===F.shadowParent)&&i1(F.delta,k)})[0];if(R&&R.should){b.cancelable&&b.preventDefault();return}if(!R){var j=(f.current.shards||[]).map(Lm).filter(Boolean).filter(function(F){return F.contains(b.target)}),_=j.length>0?m(b,j[0]):!f.current.noIsolation;_&&b.cancelable&&b.preventDefault()}}},[]),g=p.useCallback(function(N,b,k,R){var j={name:N,delta:b,target:k,should:R,shadowParent:u1(k)};a.current.push(j),setTimeout(function(){a.current=a.current.filter(function(_){return _!==j})},1)},[]),v=p.useCallback(function(N){l.current=ti(N),o.current=void 0},[]),y=p.useCallback(function(N){g(N.type,Mm(N),N.target,m(N,r.lockRef.current))},[]),E=p.useCallback(function(N){g(N.type,ti(N),N.target,m(N,r.lockRef.current))},[]);p.useEffect(function(){return ks.push(u),r.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:E}),document.addEventListener("wheel",x,Cs),document.addEventListener("touchmove",x,Cs),document.addEventListener("touchstart",v,Cs),function(){ks=ks.filter(function(N){return N!==u}),document.removeEventListener("wheel",x,Cs),document.removeEventListener("touchmove",x,Cs),document.removeEventListener("touchstart",v,Cs)}},[]);var P=r.removeScrollBar,C=r.inert;return p.createElement(p.Fragment,null,C?p.createElement(u,{styles:o1(c)}):null,P?p.createElement(Zb,{noRelative:r.noRelative,gapMode:r.gapMode}):null)}function u1(r){for(var a=null;r!==null;)r instanceof ShadowRoot&&(a=r.host,r=r.host),r=r.parentNode;return a}const f1=$b($p,d1);var Od=p.forwardRef(function(r,a){return p.createElement(_i,Cn({},r,{ref:a,sideCar:f1}))});Od.classNames=_i.classNames;var h1=function(r){if(typeof document>"u")return null;var a=Array.isArray(r)?r[0]:r;return a.ownerDocument.body},Es=new WeakMap,ni=new WeakMap,ri={},Gc=0,Hp=function(r){return r&&(r.host||Hp(r.parentNode))},m1=function(r,a){return a.map(function(l){if(r.contains(l))return l;var o=Hp(l);return o&&r.contains(o)?o:(console.error("aria-hidden",l,"in not contained inside",r,". Doing nothing"),null)}).filter(function(l){return!!l})},p1=function(r,a,l,o){var c=m1(a,Array.isArray(r)?r:[r]);ri[l]||(ri[l]=new WeakMap);var u=ri[l],f=[],m=new Set,x=new Set(c),g=function(y){!y||m.has(y)||(m.add(y),g(y.parentNode))};c.forEach(g);var v=function(y){!y||x.has(y)||Array.prototype.forEach.call(y.children,function(E){if(m.has(E))v(E);else try{var P=E.getAttribute(o),C=P!==null&&P!=="false",N=(Es.get(E)||0)+1,b=(u.get(E)||0)+1;Es.set(E,N),u.set(E,b),f.push(E),N===1&&C&&ni.set(E,!0),b===1&&E.setAttribute(l,"true"),C||E.setAttribute(o,"true")}catch(k){console.error("aria-hidden: cannot operate on ",E,k)}})};return v(a),m.clear(),Gc++,function(){f.forEach(function(y){var E=Es.get(y)-1,P=u.get(y)-1;Es.set(y,E),u.set(y,P),E||(ni.has(y)||y.removeAttribute(o),ni.delete(y)),P||y.removeAttribute(l)}),Gc--,Gc||(Es=new WeakMap,Es=new WeakMap,ni=new WeakMap,ri={})}},Kp=function(r,a,l){l===void 0&&(l="data-aria-hidden");var o=Array.from(Array.isArray(r)?r:[r]),c=h1(r);return c?(o.push.apply(o,Array.from(c.querySelectorAll("[aria-live], script"))),p1(o,c,l,"aria-hidden")):function(){return null}},Ti="Dialog",[Gp]=Cr(Ti),[x1,yn]=Gp(Ti),Yp=r=>{const{__scopeDialog:a,children:l,open:o,defaultOpen:c,onOpenChange:u,modal:f=!0}=r,m=p.useRef(null),x=p.useRef(null),[g,v]=Gr({prop:o,defaultProp:c??!1,onChange:u,caller:Ti});return t.jsx(x1,{scope:a,triggerRef:m,contentRef:x,contentId:xr(),titleId:xr(),descriptionId:xr(),open:g,onOpenChange:v,onOpenToggle:p.useCallback(()=>v(y=>!y),[v]),modal:f,children:l})};Yp.displayName=Ti;var Qp="DialogTrigger",g1=p.forwardRef((r,a)=>{const{__scopeDialog:l,...o}=r,c=yn(Qp,l),u=Ke(a,c.triggerRef);return t.jsx(Oe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":$d(c.open),...o,ref:u,onClick:Ae(r.onClick,c.onOpenToggle)})});g1.displayName=Qp;var Fd="DialogPortal",[v1,qp]=Gp(Fd,{forceMount:void 0}),Xp=r=>{const{__scopeDialog:a,forceMount:l,children:o,container:c}=r,u=yn(Fd,a);return t.jsx(v1,{scope:a,forceMount:l,children:p.Children.map(o,f=>t.jsx(za,{present:l||u.open,children:t.jsx(Dd,{asChild:!0,container:c,children:f})}))})};Xp.displayName=Fd;var gi="DialogOverlay",Jp=p.forwardRef((r,a)=>{const l=qp(gi,r.__scopeDialog),{forceMount:o=l.forceMount,...c}=r,u=yn(gi,r.__scopeDialog);return u.modal?t.jsx(za,{present:o||u.open,children:t.jsx(j1,{...c,ref:a})}):null});Jp.displayName=gi;var y1=Ma("DialogOverlay.RemoveScroll"),j1=p.forwardRef((r,a)=>{const{__scopeDialog:l,...o}=r,c=yn(gi,l);return t.jsx(Od,{as:y1,allowPinchZoom:!0,shards:[c.contentRef],children:t.jsx(Oe.div,{"data-state":$d(c.open),...o,ref:a,style:{pointerEvents:"auto",...o.style}})})}),Yr="DialogContent",Zp=p.forwardRef((r,a)=>{const l=qp(Yr,r.__scopeDialog),{forceMount:o=l.forceMount,...c}=r,u=yn(Yr,r.__scopeDialog);return t.jsx(za,{present:o||u.open,children:u.modal?t.jsx(w1,{...c,ref:a}):t.jsx(N1,{...c,ref:a})})});Zp.displayName=Yr;var w1=p.forwardRef((r,a)=>{const l=yn(Yr,r.__scopeDialog),o=p.useRef(null),c=Ke(a,l.contentRef,o);return p.useEffect(()=>{const u=o.current;if(u)return Kp(u)},[]),t.jsx(ex,{...r,ref:c,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ae(r.onCloseAutoFocus,u=>{var f;u.preventDefault(),(f=l.triggerRef.current)==null||f.focus()}),onPointerDownOutside:Ae(r.onPointerDownOutside,u=>{const f=u.detail.originalEvent,m=f.button===0&&f.ctrlKey===!0;(f.button===2||m)&&u.preventDefault()}),onFocusOutside:Ae(r.onFocusOutside,u=>u.preventDefault())})}),N1=p.forwardRef((r,a)=>{const l=yn(Yr,r.__scopeDialog),o=p.useRef(!1),c=p.useRef(!1);return t.jsx(ex,{...r,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{var f,m;(f=r.onCloseAutoFocus)==null||f.call(r,u),u.defaultPrevented||(o.current||(m=l.triggerRef.current)==null||m.focus(),u.preventDefault()),o.current=!1,c.current=!1},onInteractOutside:u=>{var x,g;(x=r.onInteractOutside)==null||x.call(r,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()}})}),ex=p.forwardRef((r,a)=>{const{__scopeDialog:l,trapFocus:o,onOpenAutoFocus:c,onCloseAutoFocus:u,...f}=r,m=yn(Yr,l),x=p.useRef(null),g=Ke(a,x);return Op(),t.jsxs(t.Fragment,{children:[t.jsx(Ld,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:c,onUnmountAutoFocus:u,children:t.jsx(Md,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":$d(m.open),...f,ref:g,onDismiss:()=>m.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(b1,{titleId:m.titleId}),t.jsx(C1,{contentRef:x,descriptionId:m.descriptionId})]})]})}),zd="DialogTitle",tx=p.forwardRef((r,a)=>{const{__scopeDialog:l,...o}=r,c=yn(zd,l);return t.jsx(Oe.h2,{id:c.titleId,...o,ref:a})});tx.displayName=zd;var nx="DialogDescription",rx=p.forwardRef((r,a)=>{const{__scopeDialog:l,...o}=r,c=yn(nx,l);return t.jsx(Oe.p,{id:c.descriptionId,...o,ref:a})});rx.displayName=nx;var sx="DialogClose",ax=p.forwardRef((r,a)=>{const{__scopeDialog:l,...o}=r,c=yn(sx,l);return t.jsx(Oe.button,{type:"button",...o,ref:a,onClick:Ae(r.onClick,()=>c.onOpenChange(!1))})});ax.displayName=sx;function $d(r){return r?"open":"closed"}var lx="DialogTitleWarning",[a4,ix]=JN(lx,{contentName:Yr,titleName:zd,docsSlug:"dialog"}),b1=({titleId:r})=>{const a=ix(lx),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 p.useEffect(()=>{r&&(document.getElementById(r)||console.error(l))},[l,r]),null},S1="DialogDescriptionWarning",C1=({contentRef:r,descriptionId:a})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ix(S1).contentName}}.`;return p.useEffect(()=>{var u;const c=(u=r.current)==null?void 0:u.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(o))},[o,r,a]),null},k1=Yp,E1=Xp,P1=Jp,R1=Zp,_1=tx,T1=rx,I1=ax;function Kt(r){return t.jsx(k1,{"data-slot":"dialog",...r})}function A1(r){return t.jsx(E1,{...r})}const ox=p.forwardRef(({className:r,...a},l)=>t.jsx(P1,{ref:l,className:Ge("fixed inset-0 z-50 bg-black/50",r),...a}));ox.displayName="DialogOverlay";const $t=p.forwardRef(({className:r,children:a,showCloseButton:l=!0,...o},c)=>t.jsxs(A1,{children:[t.jsx(ox,{}),t.jsxs(R1,{ref:c,className:Ge("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",r),...o,children:[a,l&&t.jsxs(I1,{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(Pn,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$t.displayName="DialogContent";function Gt({className:r,...a}){return t.jsx("div",{className:Ge("flex flex-col gap-2 text-center sm:text-left",r),...a})}function sn({className:r,...a}){return t.jsx("div",{className:Ge("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",r),...a})}function Yt(r){return t.jsx(_1,{className:"text-lg font-semibold leading-none",...r})}function M1(r){return t.jsx(T1,{className:"text-sm text-muted-foreground",...r})}function cx(r,a){const[l,o]=p.useState(r);return p.useEffect(()=>{const c=setTimeout(()=>o(r),a);return()=>clearTimeout(c)},[r,a]),l}function Kr({page:r,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:m=>u(Number(m.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:f.map(m=>t.jsxs("option",{value:m,children:[m," 条/页"]},m))})]}),a>1&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>c(1),disabled:r<=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(r-1),disabled:r<=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:[r," / ",a]}),t.jsx("button",{type:"button",onClick:()=>c(r+1),disabled:r>=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:r>=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 L1(){const[r,a]=p.useState([]),[l,o]=p.useState([]),[c,u]=p.useState(0),[f,m]=p.useState(0),[x,g]=p.useState(0),[v,y]=p.useState(1),[E,P]=p.useState(10),[C,N]=p.useState(""),b=cx(C,300),[k,R]=p.useState("all"),[j,_]=p.useState(!0),[F,G]=p.useState(null),[M,V]=p.useState(null),[te,ue]=p.useState(""),[ce,ie]=p.useState(!1);async function fe(){_(!0),G(null);try{const B=k==="all"?"":k==="completed"?"completed":k,S=new URLSearchParams({page:String(v),pageSize:String(E),...B&&{status:B},...b&&{search:b}}),[D,ae]=await Promise.all([He(`/api/orders?${S}`),He("/api/db/users?page=1&pageSize=500")]);D!=null&&D.success&&(a(D.orders||[]),u(D.total??0),m(D.totalRevenue??0),g(D.todayRevenue??0)),ae!=null&&ae.success&&ae.users&&o(ae.users)}catch(B){console.error("加载订单失败",B),G("加载订单失败,请检查网络后重试")}finally{_(!1)}}p.useEffect(()=>{y(1)},[b,k]),p.useEffect(()=>{fe()},[v,E,b,k]);const H=B=>{var S;return B.userNickname||((S=l.find(D=>D.id===B.userId))==null?void 0:S.nickname)||"匿名用户"},W=B=>{var S;return((S=l.find(D=>D.id===B))==null?void 0:S.phone)||"-"},Y=B=>{const S=B.productType||B.type||"",D=B.description||"";if(D){if(S==="section"&&D.includes("章节")){if(D.includes("-")){const ae=D.split("-");if(ae.length>=3)return{name:`第${ae[1]}章 第${ae[2]}节`,type:"《一场Soul的创业实验》"}}return{name:D,type:"章节购买"}}return S==="fullbook"||D.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:S==="vip"||D.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:S==="match"||D.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:D,type:"其他"}}return S==="section"?{name:`章节 ${B.productId||B.sectionId||""}`,type:"单章"}:S==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:S==="vip"?{name:"VIP年度会员",type:"VIP"}:S==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:S||"其他"}},K=Math.ceil(c/E)||1;async function A(){var B;if(!(!(M!=null&&M.orderSn)&&!(M!=null&&M.id))){ie(!0),G(null);try{const S=await zt("/api/admin/orders/refund",{orderSn:M.orderSn||M.id,reason:te||void 0});S!=null&&S.success?(V(null),ue(""),fe()):G((S==null?void 0:S.error)||"退款失败")}catch(S){const D=S;G(((B=D==null?void 0:D.data)==null?void 0:B.error)||"退款失败,请检查网络后重试")}finally{ie(!1)}}}function J(){if(r.length===0){alert("暂无数据可导出");return}const B=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],S=r.map(me=>{const Q=Y(me);return[me.orderSn||me.id||"",H(me),W(me.userId),Q.name,Number(me.amount||0).toFixed(2),me.paymentMethod==="wechat"?"微信支付":me.paymentMethod==="alipay"?"支付宝":me.paymentMethod||"微信支付",me.status==="refunded"?"已退款":me.status==="paid"||me.status==="completed"?"已完成":me.status==="pending"||me.status==="created"?"待支付":"已失败",me.status==="refunded"&&me.refundReason?me.refundReason:"-",me.referrerEarnings?Number(me.referrerEarnings).toFixed(2):"-",me.createdAt?new Date(me.createdAt).toLocaleString("zh-CN"):""].join(",")}),D="\uFEFF"+[B.join(","),...S].join(` +`),ae=new Blob([D],{type:"text/csv;charset=utf-8"}),oe=URL.createObjectURL(ae),Ne=document.createElement("a");Ne.href=oe,Ne.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,Ne.click(),URL.revokeObjectURL(oe)}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:()=>G(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:["共 ",r.length," 笔订单"]})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs(de,{variant:"outline",onClick:fe,disabled:j,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(tt,{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(Hr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),t.jsx(ne,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:C,onChange:B=>N(B.target.value)})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(zj,{className:"w-4 h-4 text-gray-400"}),t.jsxs("select",{value:k,onChange:B=>R(B.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(de,{variant:"outline",onClick:J,disabled:r.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Aj,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(ke,{className:"p-0",children:j?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(tt,{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(Nr,{children:[t.jsx(br,{children:t.jsxs(dt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx(Te,{className:"text-gray-400",children:"订单号"}),t.jsx(Te,{className:"text-gray-400",children:"用户"}),t.jsx(Te,{className:"text-gray-400",children:"商品"}),t.jsx(Te,{className:"text-gray-400",children:"金额"}),t.jsx(Te,{className:"text-gray-400",children:"支付方式"}),t.jsx(Te,{className:"text-gray-400",children:"状态"}),t.jsx(Te,{className:"text-gray-400",children:"退款原因"}),t.jsx(Te,{className:"text-gray-400",children:"分销佣金"}),t.jsx(Te,{className:"text-gray-400",children:"下单时间"}),t.jsx(Te,{className:"text-gray-400",children:"操作"})]})}),t.jsxs(Sr,{children:[r.map(B=>{const S=Y(B);return t.jsxs(dt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsxs(Ee,{className:"font-mono text-xs text-gray-400",children:[(B.orderSn||B.id||"").slice(0,12),"..."]}),t.jsx(Ee,{children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:H(B)}),t.jsx("p",{className:"text-gray-500 text-xs",children:W(B.userId)})]})}),t.jsx(Ee,{children:t.jsxs("div",{children:[t.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[S.name,(B.productType||B.type)==="vip"&&t.jsx(De,{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:S.type})]})}),t.jsxs(Ee,{className:"text-[#38bdac] font-bold",children:["¥",Number(B.amount||0).toFixed(2)]}),t.jsx(Ee,{className:"text-gray-300",children:B.paymentMethod==="wechat"?"微信支付":B.paymentMethod==="alipay"?"支付宝":B.paymentMethod||"微信支付"}),t.jsx(Ee,{children:B.status==="refunded"?t.jsx(De,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):B.status==="paid"||B.status==="completed"?t.jsx(De,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):B.status==="pending"||B.status==="created"?t.jsx(De,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):t.jsx(De,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),t.jsx(Ee,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:B.refundReason,children:B.status==="refunded"&&B.refundReason?B.refundReason:"-"}),t.jsx(Ee,{className:"text-[#FFD700]",children:B.referrerEarnings?`¥${Number(B.referrerEarnings).toFixed(2)}`:"-"}),t.jsx(Ee,{className:"text-gray-400 text-sm",children:new Date(B.createdAt).toLocaleString("zh-CN")}),t.jsx(Ee,{children:(B.status==="paid"||B.status==="completed")&&t.jsxs(de,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{V(B),ue("")},children:[t.jsx(mp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},B.id)}),r.length===0&&t.jsx(dt,{children:t.jsx(Ee,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),t.jsx(Kr,{page:v,totalPages:K,total:c,pageSize:E,onPageChange:y,onPageSizeChange:B=>{P(B),y(1)}})]})})}),t.jsx(Kt,{open:!!M,onOpenChange:B=>!B&&V(null),children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Gt,{children:t.jsx(Yt,{className:"text-white",children:"订单退款"})}),M&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",M.orderSn||M.id]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(M.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(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:te,onChange:B=>ue(B.target.value)})})]}),t.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),t.jsxs(sn,{children:[t.jsx(de,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>V(null),disabled:ce,children:"取消"}),t.jsx(de,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:A,disabled:ce,children:ce?"退款中...":"确认退款"})]})]})})]})}var D1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],O1=D1.reduce((r,a)=>{const l=gp(`Primitive.${a}`),o=p.forwardRef((c,u)=>{const{asChild:f,...m}=c,x=f?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(x,{...m,ref:u})});return o.displayName=`Primitive.${a}`,{...r,[a]:o}},{}),F1="Label",dx=p.forwardRef((r,a)=>t.jsx(O1.label,{...r,ref:a,onMouseDown:l=>{var c;l.target.closest("button, input, select, textarea")||((c=r.onMouseDown)==null||c.call(r,l),!l.defaultPrevented&&l.detail>1&&l.preventDefault())}}));dx.displayName=F1;var ux=dx;const q=p.forwardRef(({className:r,...a},l)=>t.jsx(ux,{ref:l,className:Ge("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",r),...a}));q.displayName=ux.displayName;function Bd(r){const a=p.useRef({value:r,previous:r});return p.useMemo(()=>(a.current.value!==r&&(a.current.previous=a.current.value,a.current.value=r),a.current.previous),[r])}function Vd(r){const[a,l]=p.useState(void 0);return Pt(()=>{if(r){l({width:r.offsetWidth,height:r.offsetHeight});const o=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const u=c[0];let f,m;if("borderBoxSize"in u){const x=u.borderBoxSize,g=Array.isArray(x)?x[0]:x;f=g.inlineSize,m=g.blockSize}else f=r.offsetWidth,m=r.offsetHeight;l({width:f,height:m})});return o.observe(r,{box:"border-box"}),()=>o.unobserve(r)}else l(void 0)},[r]),a}var Ii="Switch",[z1]=Cr(Ii),[$1,B1]=z1(Ii),fx=p.forwardRef((r,a)=>{const{__scopeSwitch:l,name:o,checked:c,defaultChecked:u,required:f,disabled:m,value:x="on",onCheckedChange:g,form:v,...y}=r,[E,P]=p.useState(null),C=Ke(a,j=>P(j)),N=p.useRef(!1),b=E?v||!!E.closest("form"):!0,[k,R]=Gr({prop:c,defaultProp:u??!1,onChange:g,caller:Ii});return t.jsxs($1,{scope:l,checked:k,disabled:m,children:[t.jsx(Oe.button,{type:"button",role:"switch","aria-checked":k,"aria-required":f,"data-state":xx(k),"data-disabled":m?"":void 0,disabled:m,value:x,...y,ref:C,onClick:Ae(r.onClick,j=>{R(_=>!_),b&&(N.current=j.isPropagationStopped(),N.current||j.stopPropagation())})}),b&&t.jsx(px,{control:E,bubbles:!N.current,name:o,value:x,checked:k,required:f,disabled:m,form:v,style:{transform:"translateX(-100%)"}})]})});fx.displayName=Ii;var hx="SwitchThumb",mx=p.forwardRef((r,a)=>{const{__scopeSwitch:l,...o}=r,c=B1(hx,l);return t.jsx(Oe.span,{"data-state":xx(c.checked),"data-disabled":c.disabled?"":void 0,...o,ref:a})});mx.displayName=hx;var V1="SwitchBubbleInput",px=p.forwardRef(({__scopeSwitch:r,control:a,checked:l,bubbles:o=!0,...c},u)=>{const f=p.useRef(null),m=Ke(f,u),x=Bd(l),g=Vd(a);return p.useEffect(()=>{const v=f.current;if(!v)return;const y=window.HTMLInputElement.prototype,P=Object.getOwnPropertyDescriptor(y,"checked").set;if(x!==l&&P){const C=new Event("click",{bubbles:o});P.call(v,l),v.dispatchEvent(C)}},[x,l,o]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:l,...c,tabIndex:-1,ref:m,style:{...c.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});px.displayName=V1;function xx(r){return r?"checked":"unchecked"}var gx=fx,U1=mx;const ft=p.forwardRef(({className:r,...a},l)=>t.jsx(gx,{className:Ge("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]",r),...a,ref:l,children:t.jsx(U1,{className:Ge("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")})}));ft.displayName=gx.displayName;function Ud(r){const a=r+"CollectionProvider",[l,o]=Cr(a),[c,u]=l(a,{collectionRef:{current:null},itemMap:new Map}),f=N=>{const{scope:b,children:k}=N,R=dr.useRef(null),j=dr.useRef(new Map).current;return t.jsx(c,{scope:b,itemMap:j,collectionRef:R,children:k})};f.displayName=a;const m=r+"CollectionSlot",x=Ma(m),g=dr.forwardRef((N,b)=>{const{scope:k,children:R}=N,j=u(m,k),_=Ke(b,j.collectionRef);return t.jsx(x,{ref:_,children:R})});g.displayName=m;const v=r+"CollectionItemSlot",y="data-radix-collection-item",E=Ma(v),P=dr.forwardRef((N,b)=>{const{scope:k,children:R,...j}=N,_=dr.useRef(null),F=Ke(b,_),G=u(v,k);return dr.useEffect(()=>(G.itemMap.set(_,{ref:_,...j}),()=>void G.itemMap.delete(_))),t.jsx(E,{[y]:"",ref:F,children:R})});P.displayName=v;function C(N){const b=u(r+"CollectionConsumer",N);return dr.useCallback(()=>{const R=b.collectionRef.current;if(!R)return[];const j=Array.from(R.querySelectorAll(`[${y}]`));return Array.from(b.itemMap.values()).sort((G,M)=>j.indexOf(G.ref.current)-j.indexOf(M.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:f,Slot:g,ItemSlot:P},C,o]}var W1=p.createContext(void 0);function Ai(r){const a=p.useContext(W1);return r||a||"ltr"}var Yc="rovingFocusGroup.onEntryFocus",H1={bubbles:!1,cancelable:!0},$a="RovingFocusGroup",[fd,vx,K1]=Ud($a),[G1,yx]=Cr($a,[K1]),[Y1,Q1]=G1($a),jx=p.forwardRef((r,a)=>t.jsx(fd.Provider,{scope:r.__scopeRovingFocusGroup,children:t.jsx(fd.Slot,{scope:r.__scopeRovingFocusGroup,children:t.jsx(q1,{...r,ref:a})})}));jx.displayName=$a;var q1=p.forwardRef((r,a)=>{const{__scopeRovingFocusGroup:l,orientation:o,loop:c=!1,dir:u,currentTabStopId:f,defaultCurrentTabStopId:m,onCurrentTabStopIdChange:x,onEntryFocus:g,preventScrollOnEntryFocus:v=!1,...y}=r,E=p.useRef(null),P=Ke(a,E),C=Ai(u),[N,b]=Gr({prop:f,defaultProp:m??null,onChange:x,caller:$a}),[k,R]=p.useState(!1),j=vr(g),_=vx(l),F=p.useRef(!1),[G,M]=p.useState(0);return p.useEffect(()=>{const V=E.current;if(V)return V.addEventListener(Yc,j),()=>V.removeEventListener(Yc,j)},[j]),t.jsx(Y1,{scope:l,orientation:o,dir:C,loop:c,currentTabStopId:N,onItemFocus:p.useCallback(V=>b(V),[b]),onItemShiftTab:p.useCallback(()=>R(!0),[]),onFocusableItemAdd:p.useCallback(()=>M(V=>V+1),[]),onFocusableItemRemove:p.useCallback(()=>M(V=>V-1),[]),children:t.jsx(Oe.div,{tabIndex:k||G===0?-1:0,"data-orientation":o,...y,ref:P,style:{outline:"none",...r.style},onMouseDown:Ae(r.onMouseDown,()=>{F.current=!0}),onFocus:Ae(r.onFocus,V=>{const te=!F.current;if(V.target===V.currentTarget&&te&&!k){const ue=new CustomEvent(Yc,H1);if(V.currentTarget.dispatchEvent(ue),!ue.defaultPrevented){const ce=_().filter(Y=>Y.focusable),ie=ce.find(Y=>Y.active),fe=ce.find(Y=>Y.id===N),W=[ie,fe,...ce].filter(Boolean).map(Y=>Y.ref.current);bx(W,v)}}F.current=!1}),onBlur:Ae(r.onBlur,()=>R(!1))})})}),wx="RovingFocusGroupItem",Nx=p.forwardRef((r,a)=>{const{__scopeRovingFocusGroup:l,focusable:o=!0,active:c=!1,tabStopId:u,children:f,...m}=r,x=xr(),g=u||x,v=Q1(wx,l),y=v.currentTabStopId===g,E=vx(l),{onFocusableItemAdd:P,onFocusableItemRemove:C,currentTabStopId:N}=v;return p.useEffect(()=>{if(o)return P(),()=>C()},[o,P,C]),t.jsx(fd.ItemSlot,{scope:l,id:g,focusable:o,active:c,children:t.jsx(Oe.span,{tabIndex:y?0:-1,"data-orientation":v.orientation,...m,ref:a,onMouseDown:Ae(r.onMouseDown,b=>{o?v.onItemFocus(g):b.preventDefault()}),onFocus:Ae(r.onFocus,()=>v.onItemFocus(g)),onKeyDown:Ae(r.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){v.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const k=Z1(b,v.orientation,v.dir);if(k!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let j=E().filter(_=>_.focusable).map(_=>_.ref.current);if(k==="last")j.reverse();else if(k==="prev"||k==="next"){k==="prev"&&j.reverse();const _=j.indexOf(b.currentTarget);j=v.loop?e2(j,_+1):j.slice(_+1)}setTimeout(()=>bx(j))}}),children:typeof f=="function"?f({isCurrentTabStop:y,hasTabStop:N!=null}):f})})});Nx.displayName=wx;var X1={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function J1(r,a){return a!=="rtl"?r:r==="ArrowLeft"?"ArrowRight":r==="ArrowRight"?"ArrowLeft":r}function Z1(r,a,l){const o=J1(r.key,l);if(!(a==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(a==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return X1[o]}function bx(r,a=!1){const l=document.activeElement;for(const o of r)if(o===l||(o.focus({preventScroll:a}),document.activeElement!==l))return}function e2(r,a){return r.map((l,o)=>r[(a+o)%r.length])}var t2=jx,n2=Nx,Mi="Tabs",[r2]=Cr(Mi,[yx]),Sx=yx(),[s2,Wd]=r2(Mi),Cx=p.forwardRef((r,a)=>{const{__scopeTabs:l,value:o,onValueChange:c,defaultValue:u,orientation:f="horizontal",dir:m,activationMode:x="automatic",...g}=r,v=Ai(m),[y,E]=Gr({prop:o,onChange:c,defaultProp:u??"",caller:Mi});return t.jsx(s2,{scope:l,baseId:xr(),value:y,onValueChange:E,orientation:f,dir:v,activationMode:x,children:t.jsx(Oe.div,{dir:v,"data-orientation":f,...g,ref:a})})});Cx.displayName=Mi;var kx="TabsList",Ex=p.forwardRef((r,a)=>{const{__scopeTabs:l,loop:o=!0,...c}=r,u=Wd(kx,l),f=Sx(l);return t.jsx(t2,{asChild:!0,...f,orientation:u.orientation,dir:u.dir,loop:o,children:t.jsx(Oe.div,{role:"tablist","aria-orientation":u.orientation,...c,ref:a})})});Ex.displayName=kx;var Px="TabsTrigger",Rx=p.forwardRef((r,a)=>{const{__scopeTabs:l,value:o,disabled:c=!1,...u}=r,f=Wd(Px,l),m=Sx(l),x=Ix(f.baseId,o),g=Ax(f.baseId,o),v=o===f.value;return t.jsx(n2,{asChild:!0,...m,focusable:!c,active:v,children:t.jsx(Oe.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:Ae(r.onMouseDown,y=>{!c&&y.button===0&&y.ctrlKey===!1?f.onValueChange(o):y.preventDefault()}),onKeyDown:Ae(r.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&f.onValueChange(o)}),onFocus:Ae(r.onFocus,()=>{const y=f.activationMode!=="manual";!v&&!c&&y&&f.onValueChange(o)})})})});Rx.displayName=Px;var _x="TabsContent",Tx=p.forwardRef((r,a)=>{const{__scopeTabs:l,value:o,forceMount:c,children:u,...f}=r,m=Wd(_x,l),x=Ix(m.baseId,o),g=Ax(m.baseId,o),v=o===m.value,y=p.useRef(v);return p.useEffect(()=>{const E=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(E)},[]),t.jsx(za,{present:c||v,children:({present:E})=>t.jsx(Oe.div,{"data-state":v?"active":"inactive","data-orientation":m.orientation,role:"tabpanel","aria-labelledby":x,hidden:!E,id:g,tabIndex:0,...f,ref:a,style:{...r.style,animationDuration:y.current?"0s":void 0},children:E&&u})})});Tx.displayName=_x;function Ix(r,a){return`${r}-trigger-${a}`}function Ax(r,a){return`${r}-content-${a}`}var a2=Cx,Mx=Ex,Lx=Rx,Dx=Tx;const Hd=a2,Li=p.forwardRef(({className:r,...a},l)=>t.jsx(Mx,{ref:l,className:Ge("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",r),...a}));Li.displayName=Mx.displayName;const nn=p.forwardRef(({className:r,...a},l)=>t.jsx(Lx,{ref:l,className:Ge("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",r),...a}));nn.displayName=Lx.displayName;const rn=p.forwardRef(({className:r,...a},l)=>t.jsx(Dx,{ref:l,className:Ge("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",r),...a}));rn.displayName=Dx.displayName;function l2({open:r,onClose:a,userId:l,onUserUpdated:o}){var Y;const[c,u]=p.useState(null),[f,m]=p.useState([]),[x,g]=p.useState([]),[v,y]=p.useState(!1),[E,P]=p.useState(!1),[C,N]=p.useState(!1),[b,k]=p.useState("info"),[R,j]=p.useState(""),[_,F]=p.useState(""),[G,M]=p.useState([]),[V,te]=p.useState("");p.useEffect(()=>{r&&l&&ue()},[r,l]);async function ue(){if(l){y(!0);try{const K=await He(`/api/db/users?id=${encodeURIComponent(l)}`);if(K!=null&&K.success&&K.user){const A=K.user;u(A),j(A.phone||""),F(A.nickname||""),M(typeof A.tags=="string"?JSON.parse(A.tags||"[]"):[])}try{const A=await He(`/api/user/track?userId=${encodeURIComponent(l)}&limit=50`);A!=null&&A.success&&A.tracks&&m(A.tracks)}catch{m([])}try{const A=await He(`/api/db/users/referrals?userId=${encodeURIComponent(l)}`);A!=null&&A.success&&A.referrals&&g(A.referrals)}catch{g([])}}catch(K){console.error("Load user detail error:",K)}finally{y(!1)}}}async function ce(){if(!(c!=null&&c.phone)){alert("用户未绑定手机号,无法同步");return}P(!0);try{const K=await jt("/api/ckb/sync",{action:"full_sync",phone:c.phone,userId:c.id});K!=null&&K.success?(alert("同步成功"),ue()):alert("同步失败: "+(K==null?void 0:K.error))}catch(K){console.error("Sync CKB error:",K),alert("同步失败")}finally{P(!1)}}async function ie(){if(c){N(!0);try{const K={id:c.id,phone:R||void 0,nickname:_||void 0,tags:JSON.stringify(G)},A=await zt("/api/db/users",K);A!=null&&A.success?(alert("保存成功"),ue(),o==null||o()):alert("保存失败: "+(A==null?void 0:A.error))}catch(K){console.error("Save user error:",K),alert("保存失败")}finally{N(!1)}}}const fe=()=>{V&&!G.includes(V)&&(M([...G,V]),te(""))},H=K=>{M(G.filter(A=>A!==K))},W=K=>{const J={view_chapter:Ts,purchase:ld,match:xn,login:ai,register:ai,share:Wr,bind_phone:yw,bind_wechat:fw}[K]||dm;return t.jsx(J,{className:"w-4 h-4"})};return r?t.jsx(Kt,{open:r,onOpenChange:()=>a(),children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden",children:[t.jsx(Gt,{children:t.jsxs(Yt,{className:"text-white flex items-center gap-2",children:[t.jsx(ai,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(c==null?void 0:c.phone)&&t.jsx(De,{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(tt,{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:""}):((Y=c.nickname)==null?void 0:Y.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(De,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),c.hasFullBook&&t.jsx(De,{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(Hd,{value:b,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[t.jsxs(Li,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-4",children:[t.jsx(nn,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"基础信息"}),t.jsx(nn,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"标签体系"}),t.jsx(nn,{value:"tracks",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"行为轨迹"}),t.jsx(nn,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac]",children:"关系链路"})]}),t.jsxs(rn,{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(q,{className:"text-gray-300",children:"手机号"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:R,onChange:K=>j(K.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"昵称"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:_,onChange:K=>F(K.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(Wr,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),t.jsx(de,{size:"sm",onClick:ce,disabled:E||!c.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?t.jsxs(t.Fragment,{children:[t.jsx(tt,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(tt,{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(De,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):t.jsx(De,{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(rn,{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(Aw,{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:[G.map((K,A)=>t.jsxs(De,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[K,t.jsx("button",{type:"button",onClick:()=>H(K),className:"ml-1 hover:text-red-400",children:t.jsx(Pn,{className:"w-3 h-3"})})]},A)),G.length===0&&t.jsx("span",{className:"text-gray-500 text-sm",children:"暂无标签"})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ne,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"添加新标签",value:V,onChange:K=>te(K.target.value),onKeyDown:K=>K.key==="Enter"&&fe()}),t.jsx(de,{onClick:fe,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})}),t.jsx(rn,{value:"tracks",className:"flex-1 overflow-auto",children:t.jsx("div",{className:"space-y-2",children:f.length>0?f.map(K=>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:W(K.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:K.actionLabel}),K.chapterTitle&&t.jsxs("span",{className:"text-gray-400 text-sm",children:["- ",K.chapterTitle]})]}),t.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:[t.jsx(fp,{className:"w-3 h-3 inline mr-1"}),K.timeAgo," · ",new Date(K.createdAt).toLocaleString()]})]})]},K.id)):t.jsxs("div",{className:"text-center py-12",children:[t.jsx(dm,{className:"w-10 h-10 text-[#38bdac]/40 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-400",children:"暂无行为轨迹"})]})})}),t.jsx(rn,{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(Wr,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-white font-medium",children:"推荐的用户"})]}),t.jsxs(De,{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((K,A)=>{var B;const J=K;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:((B=J.nickname)==null?void 0:B.charAt(0))||"?"}),t.jsx("span",{className:"text-white text-sm",children:J.nickname})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[J.status==="vip"&&t.jsx(De,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),t.jsx("span",{className:"text-gray-500 text-xs",children:J.createdAt?new Date(J.createdAt).toLocaleDateString():""})]})]},J.id||A)}):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(de,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Pn,{className:"w-4 h-4 mr-2"}),"关闭"]}),t.jsxs(de,{onClick:ie,disabled:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(an,{className:"w-4 h-4 mr-2"}),C?"保存中...":"保存修改"]})]})]}):t.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}const Qc={isVip:!1,vipExpireDate:"",vipSort:"",vipRole:"",vipRoleCustom:"",vipName:"",vipProject:"",vipContact:"",vipBio:""};function i2({open:r,onClose:a,userId:l,userNickname:o="",onSaved:c}){const[u,f]=p.useState(Qc),[m,x]=p.useState([]),[g,v]=p.useState(!1),[y,E]=p.useState(!1);p.useEffect(()=>{if(!r){f(Qc);return}let C=!1;return v(!0),Promise.all([He("/api/db/vip-roles"),l?He(`/api/db/users?id=${encodeURIComponent(l)}`):Promise.resolve(null)]).then(([N,b])=>{if(C)return;const k=N!=null&&N.success&&N.data?N.data:[];x(k);const R=b&&b.user?b.user:null;if(R){const j=String(R.vipRole??""),_=k.some(F=>F.name===j);f({isVip:!!(R.isVip??!1),vipExpireDate:R.vipExpireDate?String(R.vipExpireDate).slice(0,10):"",vipSort:typeof R.vipSort=="number"?R.vipSort:"",vipRole:_?j:j?"__custom__":"",vipRoleCustom:_?"":j,vipName:String(R.vipName??""),vipProject:String(R.vipProject??""),vipContact:String(R.vipContact??""),vipBio:String(R.vipBio??"")})}else f(Qc)}).catch(N=>{C||console.error("Load error:",N)}).finally(()=>{C||v(!1)}),()=>{C=!0}},[r,l]);async function P(){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}}E(!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},b=await zt("/api/db/users",N);b!=null&&b.success?(alert("VIP 设置已保存"),c==null||c(),a()):alert("保存失败: "+(b==null?void 0:b.error))}catch(C){console.error("Save VIP error:",C),alert("保存失败")}finally{E(!1)}}}return r?t.jsx(Kt,{open:r,onOpenChange:()=>a(),children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Gt,{children:t.jsxs(Yt,{className:"text-white flex items-center gap-2",children:[t.jsx(Ei,{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(q,{className:"text-gray-300",children:"VIP 会员"}),t.jsx(ft,{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(q,{className:"text-gray-300",children:["到期日 (YYYY-MM-DD) ",t.jsx("span",{className:"text-amber-400",children:"*"})]}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"排序"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"数字越小越靠前,留空按时间",value:u.vipSort===""?"":u.vipSort,onChange:C=>{const N=C.target.value;f(b=>({...b,vipSort:N===""?"":parseInt(N,10)||0}))}})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{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:"请选择或下方手动填写"}),m.map(C=>t.jsx("option",{value:C.name,children:C.name},C.id)),t.jsx("option",{value:"__custom__",children:"其他(手动填写)"})]}),u.vipRole==="__custom__"&&t.jsx(ne,{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(q,{className:"text-gray-300",children:"VIP 展示名"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"项目/公司"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"联系方式"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"一句话简介"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"简要描述业务",value:u.vipBio,onChange:C=>f(N=>({...N,vipBio:C.target.value}))})]})]}),t.jsxs(sn,{children:[t.jsxs(de,{variant:"outline",onClick:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Pn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(de,{onClick:P,disabled:y||g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(an,{className:"w-4 h-4 mr-2"}),y?"保存中...":"保存"]})]})]})}):null}function o2(){var Zr,Vs,Us,Ws,Hs;const[r,a]=p.useState([]),[l,o]=p.useState(0),[c,u]=p.useState(1),[f,m]=p.useState(10),[x,g]=p.useState(""),v=cx(x,300),[y,E]=p.useState("all"),[P,C]=p.useState(!0),[N,b]=p.useState(null),[k,R]=p.useState(!1),[j,_]=p.useState(!1),[F,G]=p.useState(null),[M,V]=p.useState(""),[te,ue]=p.useState(""),[ce,ie]=p.useState(!1),[fe,H]=p.useState(!1),[W,Y]=p.useState({referrals:[],stats:{}}),[K,A]=p.useState(!1),[J,B]=p.useState(null),[S,D]=p.useState(!1),[ae,oe]=p.useState(null),[Ne,me]=p.useState(!1),[Q,xe]=p.useState(null),[I,se]=p.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1});async function he(){C(!0),b(null);try{const X=new URLSearchParams({page:String(c),pageSize:String(f),search:v,...y==="vip"&&{vip:"true"}}),$e=await He(`/api/db/users?${X}`);$e!=null&&$e.success?(a($e.users||[]),o($e.total??0)):b(($e==null?void 0:$e.error)||"加载失败")}catch(X){console.error("Load users error:",X),b("网络错误,请检查连接")}finally{C(!1)}}p.useEffect(()=>{u(1)},[v,y]),p.useEffect(()=>{he()},[c,f,v,y]);const Pe=Math.ceil(l/f)||1;async function Me(X){if(confirm("确定要删除这个用户吗?"))try{const $e=await Ri(`/api/db/users?id=${encodeURIComponent(X)}`);$e!=null&&$e.success?he():alert("删除失败: "+(($e==null?void 0:$e.error)||"未知错误"))}catch($e){console.error("Delete user error:",$e),alert("删除失败")}}const Fe=X=>{G(X),se({phone:X.phone||"",nickname:X.nickname||"",password:"",isAdmin:!!(X.isAdmin??!1),hasFullBook:!!(X.hasFullBook??!1)}),R(!0)},Qe=()=>{G(null),se({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),R(!0)};async function nt(){if(!I.phone||!I.nickname){alert("请填写手机号和昵称");return}ie(!0);try{if(F){const X=await zt("/api/db/users",{id:F.id,nickname:I.nickname,isAdmin:I.isAdmin,hasFullBook:I.hasFullBook,...I.password&&{password:I.password}});if(!(X!=null&&X.success)){alert("更新失败: "+((X==null?void 0:X.error)||"未知错误"));return}}else{const X=await jt("/api/db/users",{phone:I.phone,nickname:I.nickname,password:I.password,isAdmin:I.isAdmin});if(!(X!=null&&X.success)){alert("创建失败: "+((X==null?void 0:X.error)||"未知错误"));return}}R(!1),he()}catch(X){console.error("Save user error:",X),alert("保存失败")}finally{ie(!1)}}const Ze=X=>{G(X),V(""),ue(""),_(!0)};async function Tt(X){B(X),H(!0),A(!0);try{const $e=await He(`/api/db/users/referrals?userId=${encodeURIComponent(X.id)}`);$e!=null&&$e.success?Y({referrals:$e.referrals||[],stats:$e.stats||{}}):Y({referrals:[],stats:{}})}catch($e){console.error("Load referrals error:",$e),Y({referrals:[],stats:{}})}finally{A(!1)}}const It=X=>{oe(X.id),D(!0)},Pr=X=>{xe(X),me(!0)};async function Un(){if(!M){alert("请输入新密码");return}if(M!==te){alert("两次输入的密码不一致");return}if(M.length<6){alert("密码长度不能少于6位");return}ie(!0);try{const X=await zt("/api/db/users",{id:F==null?void 0:F.id,password:M});X!=null&&X.success?(alert("密码修改成功"),_(!1)):alert("密码修改失败: "+((X==null?void 0:X.error)||"未知错误"))}catch(X){console.error("Change password error:",X),alert("密码修改失败")}finally{ie(!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:()=>b(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(de,{variant:"outline",onClick:he,disabled:P,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(tt,{className:`w-4 h-4 mr-2 ${P?"animate-spin":""}`}),"刷新"]}),t.jsxs("select",{value:y,onChange:X=>{E(X.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(Hr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),t.jsx(ne,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-64",value:x,onChange:X=>g(X.target.value)})]}),t.jsxs(de,{onClick:Qe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pm,{className:"w-4 h-4 mr-2"}),"添加用户"]})]})]}),t.jsx(Kt,{open:k,onOpenChange:R,children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[t.jsx(Gt,{children:t.jsxs(Yt,{className:"text-white flex items-center gap-2",children:[F?t.jsx(gr,{className:"w-5 h-5 text-[#38bdac]"}):t.jsx(pm,{className:"w-5 h-5 text-[#38bdac]"}),F?"编辑用户":"添加用户"]})}),t.jsxs("div",{className:"space-y-4 py-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"手机号"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:I.phone,onChange:X=>se({...I,phone:X.target.value}),disabled:!!F})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"昵称"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:I.nickname,onChange:X=>se({...I,nickname:X.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:F?"新密码 (留空则不修改)":"密码"}),t.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:F?"留空则不修改":"请输入密码",value:I.password,onChange:X=>se({...I,password:X.target.value})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(q,{className:"text-gray-300",children:"管理员权限"}),t.jsx(ft,{checked:I.isAdmin,onCheckedChange:X=>se({...I,isAdmin:X})})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(q,{className:"text-gray-300",children:"已购全书"}),t.jsx(ft,{checked:I.hasFullBook,onCheckedChange:X=>se({...I,hasFullBook:X})})]})]}),t.jsxs(sn,{children:[t.jsxs(de,{variant:"outline",onClick:()=>R(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Pn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(de,{onClick:nt,disabled:ce,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(an,{className:"w-4 h-4 mr-2"}),ce?"保存中...":"保存"]})]})]})}),t.jsx(Kt,{open:j,onOpenChange:_,children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Gt,{children:t.jsxs(Yt,{className:"text-white flex items-center gap-2",children:[t.jsx(um,{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:["用户:",F==null?void 0:F.nickname]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["手机号:",F==null?void 0:F.phone]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"新密码"}),t.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入新密码 (至少6位)",value:M,onChange:X=>V(X.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"确认密码"}),t.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请再次输入新密码",value:te,onChange:X=>ue(X.target.value)})]})]}),t.jsxs(sn,{children:[t.jsx(de,{variant:"outline",onClick:()=>_(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(de,{onClick:Un,disabled:ce,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ce?"保存中...":"确认修改"})]})]})}),t.jsx(l2,{open:S,onClose:()=>D(!1),userId:ae,onUserUpdated:he}),t.jsx(i2,{open:Ne,onClose:()=>{me(!1),xe(null)},userId:(Q==null?void 0:Q.id)??null,userNickname:Q==null?void 0:Q.nickname,onSaved:he}),t.jsx(Kt,{open:fe,onOpenChange:H,children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[t.jsx(Gt,{children:t.jsxs(Yt,{className:"text-white flex items-center gap-2",children:[t.jsx(xn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系详情 - ",J==null?void 0:J.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:((Zr=W.stats)==null?void 0:Zr.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:((Vs=W.stats)==null?void 0:Vs.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:["¥",(((Us=W.stats)==null?void 0:Us.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:["¥",(((Ws=W.stats)==null?void 0:Ws.pendingEarnings)||0).toFixed(2)]}),t.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),K?t.jsxs("div",{className:"flex items-center justify-center py-8",children:[t.jsx(tt,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Hs=W.referrals)==null?void 0:Hs.length)??0)>0?t.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(W.referrals??[]).map((X,$e)=>{var ln;const wt=X;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:((ln=wt.nickname)==null?void 0:ln.charAt(0))||"?"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white text-sm",children:wt.nickname}),t.jsx("div",{className:"text-xs text-gray-500",children:wt.phone||(wt.hasOpenId?"微信用户":"未绑定")})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[wt.status==="vip"&&t.jsx(De,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),wt.status==="paid"&&t.jsxs(De,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",wt.purchasedSections,"章"]}),wt.status==="free"&&t.jsx(De,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),t.jsx("span",{className:"text-xs text-gray-500",children:wt.createdAt?new Date(wt.createdAt).toLocaleDateString():""})]})]},wt.id||$e)})}):t.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),t.jsx(sn,{children:t.jsx(de,{variant:"outline",onClick:()=>H(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(ke,{className:"p-0",children:P?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(tt,{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(Nr,{children:[t.jsx(br,{children:t.jsxs(dt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx(Te,{className:"text-gray-400",children:"用户信息"}),t.jsx(Te,{className:"text-gray-400",children:"绑定信息"}),t.jsx(Te,{className:"text-gray-400",children:"购买状态"}),t.jsx(Te,{className:"text-gray-400",children:"分销收益"}),t.jsx(Te,{className:"text-gray-400",children:"推广码"}),t.jsx(Te,{className:"text-gray-400",children:"注册时间"}),t.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(Sr,{children:[r.map(X=>{var $e,wt,ln;return t.jsxs(dt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(Ee,{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:X.avatar?t.jsx("img",{src:X.avatar,className:"w-full h-full rounded-full object-cover",alt:""}):(($e=X.nickname)==null?void 0:$e.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:X.nickname}),X.isAdmin&&t.jsx(De,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),X.openId&&!((wt=X.id)!=null&&wt.startsWith("user_"))&&t.jsx(De,{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:X.openId?X.openId.slice(0,12)+"...":(ln=X.id)==null?void 0:ln.slice(0,12)})]})]})}),t.jsx(Ee,{children:t.jsxs("div",{className:"space-y-1",children:[X.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:X.phone})]}),X.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:X.wechatId})]}),X.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:X.openId,children:[X.openId.slice(0,12),"..."]})]}),!X.phone&&!X.wechatId&&!X.openId&&t.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),t.jsx(Ee,{children:X.hasFullBook?t.jsx(De,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):t.jsx(De,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),t.jsx(Ee,{children:t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(X.earnings||0)).toFixed(2)]}),parseFloat(String(X.pendingEarnings||0))>0&&t.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(X.pendingEarnings||0)).toFixed(2)]}),t.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>Tt(X),onKeyDown:Rr=>Rr.key==="Enter"&&Tt(X),role:"button",tabIndex:0,children:[t.jsx(xn,{className:"w-3 h-3"}),"绑定",X.referralCount||0,"人"]})]})}),t.jsx(Ee,{children:t.jsx("code",{className:"text-[#38bdac] text-xs bg-[#38bdac]/10 px-2 py-0.5 rounded",children:X.referralCode||"-"})}),t.jsx(Ee,{className:"text-gray-400",children:X.createdAt?new Date(X.createdAt).toLocaleDateString():"-"}),t.jsx(Ee,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(de,{variant:"ghost",size:"sm",onClick:()=>Pr(X),className:"text-gray-400 hover:text-amber-400 hover:bg-amber-400/10",title:"设置 VIP",children:t.jsx(Ei,{className:"w-4 h-4"})}),t.jsx(de,{variant:"ghost",size:"sm",onClick:()=>It(X),className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"查看详情",children:t.jsx(_d,{className:"w-4 h-4"})}),t.jsx(de,{variant:"ghost",size:"sm",onClick:()=>Fe(X),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑",children:t.jsx(gr,{className:"w-4 h-4"})}),t.jsx(de,{variant:"ghost",size:"sm",onClick:()=>Ze(X),className:"text-gray-400 hover:text-yellow-400 hover:bg-yellow-400/10",title:"修改密码",children:t.jsx(um,{className:"w-4 h-4"})}),t.jsx(de,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Me(X.id),title:"删除",children:t.jsx(Fa,{className:"w-4 h-4"})})]})})]},X.id)}),r.length===0&&t.jsx(dt,{children:t.jsx(Ee,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),t.jsx(Kr,{page:c,totalPages:Pe,total:l,pageSize:f,onPageChange:u,onPageSizeChange:X=>{m(X),u(1)}})]})})})]})}function c2(){const[r,a]=p.useState("overview"),[l,o]=p.useState([]),[c,u]=p.useState(null),[f,m]=p.useState([]),[x,g]=p.useState([]),[v,y]=p.useState([]),[E,P]=p.useState(!0),[C,N]=p.useState(null),[b,k]=p.useState(""),[R,j]=p.useState("all"),[_,F]=p.useState(1),[G,M]=p.useState(10),[V,te]=p.useState(0),[ue,ce]=p.useState(new Set),[ie,fe]=p.useState(null),[H,W]=p.useState(""),[Y,K]=p.useState(!1);p.useEffect(()=>{A()},[]),p.useEffect(()=>{F(1)},[r,R]),p.useEffect(()=>{J(r)},[r]),p.useEffect(()=>{["orders","bindings","withdrawals"].includes(r)&&J(r,!0)},[_,G,R,b]);async function A(){N(null);try{const I=await He("/api/admin/distribution/overview");I!=null&&I.success&&I.overview&&u(I.overview)}catch(I){console.error("[Admin] 概览接口异常:",I),N("加载概览失败")}try{const I=await He("/api/db/users");y((I==null?void 0:I.users)||[])}catch(I){console.error("[Admin] 用户数据加载失败:",I)}}async function J(I,se=!1){var he;if(!(!se&&ue.has(I))){P(!0);try{const Pe=v;switch(I){case"overview":break;case"orders":{try{const Me=new URLSearchParams({page:String(_),pageSize:String(G),...R!=="all"&&{status:R},...b&&{search:b}}),Fe=await He(`/api/orders?${Me}`);if(Fe!=null&&Fe.success&&Fe.orders){const Qe=Fe.orders.map(nt=>{const Ze=Pe.find(It=>It.id===nt.userId),Tt=nt.referrerId?Pe.find(It=>It.id===nt.referrerId):null;return{...nt,amount:parseFloat(String(nt.amount))||0,userNickname:(Ze==null?void 0:Ze.nickname)||nt.userNickname||"未知用户",userPhone:(Ze==null?void 0:Ze.phone)||nt.userPhone||"-",referrerNickname:(Tt==null?void 0:Tt.nickname)||null,referrerCode:(Tt==null?void 0:Tt.referralCode)??null,type:nt.productType||nt.type}});o(Qe),te(Fe.total??Qe.length)}else o([]),te(0)}catch(Me){console.error(Me),N("加载订单失败"),o([])}break}case"bindings":{try{const Me=new URLSearchParams({page:String(_),pageSize:String(G),...R!=="all"&&{status:R}}),Fe=await He(`/api/db/distribution?${Me}`);m((Fe==null?void 0:Fe.bindings)||[]),te((Fe==null?void 0:Fe.total)??((he=Fe==null?void 0:Fe.bindings)==null?void 0:he.length)??0)}catch(Me){console.error(Me),N("加载绑定数据失败"),m([])}break}case"withdrawals":{try{const Me=R==="completed"?"success":R==="rejected"?"failed":R,Fe=new URLSearchParams({...Me&&Me!=="all"&&{status:Me},page:String(_),pageSize:String(G)}),Qe=await He(`/api/admin/withdrawals?${Fe}`);if(Qe!=null&&Qe.success&&Qe.withdrawals){const nt=Qe.withdrawals.map(Ze=>({...Ze,account:Ze.account??"未绑定微信号",status:Ze.status==="success"?"completed":Ze.status==="failed"?"rejected":Ze.status}));g(nt),te((Qe==null?void 0:Qe.total)??nt.length)}else Qe!=null&&Qe.success||N(`获取提现记录失败: ${(Qe==null?void 0:Qe.error)||"未知错误"}`),g([])}catch(Me){console.error(Me),N("加载提现数据失败"),g([])}break}}ce(Me=>new Set(Me).add(I))}catch(Pe){console.error(Pe)}finally{P(!1)}}}async function B(){N(null),ce(I=>{const se=new Set(I);return se.delete(r),se}),r==="overview"&&A(),await J(r,!0)}async function S(I){if(confirm("确认审核通过并打款?"))try{const se=await zt("/api/admin/withdrawals",{id:I,action:"approve"});if(!(se!=null&&se.success)){const he=(se==null?void 0:se.message)||(se==null?void 0:se.error)||"操作失败";alert(he);return}await B()}catch(se){console.error(se),alert("操作失败")}}async function D(I){const se=prompt("请输入拒绝原因:");if(se)try{const he=await zt("/api/admin/withdrawals",{id:I,action:"reject",errorMessage:se});if(!(he!=null&&he.success)){alert((he==null?void 0:he.error)||"操作失败");return}await B()}catch(he){console.error(he),alert("操作失败")}}async function ae(){var I;if(!(!(ie!=null&&ie.orderSn)&&!(ie!=null&&ie.id))){K(!0),N(null);try{const se=await zt("/api/admin/orders/refund",{orderSn:ie.orderSn||ie.id,reason:H||void 0});se!=null&&se.success?(fe(null),W(""),await J("orders",!0)):N((se==null?void 0:se.error)||"退款失败")}catch(se){const he=se;N(((I=he==null?void 0:he.data)==null?void 0:I.error)||"退款失败,请检查网络后重试")}finally{K(!1)}}}function oe(I){const se={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"},he={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return t.jsx(De,{className:`${se[I]||"bg-gray-500/20 text-gray-400"} border-0`,children:he[I]||I})}const Ne=Math.ceil(V/G)||1,me=l,Q=f.filter(I=>{var he,Pe,Me,Fe;if(!b)return!0;const se=b.toLowerCase();return((he=I.refereeNickname)==null?void 0:he.toLowerCase().includes(se))||((Pe=I.refereePhone)==null?void 0:Pe.includes(se))||((Me=I.referrerName)==null?void 0:Me.toLowerCase().includes(se))||((Fe=I.referrerCode)==null?void 0:Fe.toLowerCase().includes(se))}),xe=x.filter(I=>{var he;if(!b)return!0;const se=b.toLowerCase();return((he=I.userName)==null?void 0:he.toLowerCase().includes(se))||I.account&&I.account.toLowerCase().includes(se)});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(de,{onClick:B,disabled:E,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[t.jsx(tt,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`}),"刷新数据"]})]}),t.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4",children:[{key:"overview",label:"数据概览",icon:od},{key:"orders",label:"订单管理",icon:fi},{key:"bindings",label:"绑定管理",icon:Wr},{key:"withdrawals",label:"提现审核",icon:Is}].map(I=>t.jsxs("button",{type:"button",onClick:()=>{a(I.key),j("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${r===I.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[t.jsx(I.icon,{className:"w-4 h-4"}),I.label]},I.key))}),E?t.jsxs("div",{className:"flex items-center justify-center py-20",children:[t.jsx(tt,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsxs(t.Fragment,{children:[r==="overview"&&c&&t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{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(_d,{className:"w-6 h-6 text-blue-400"})})]})})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{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(Wr,{className:"w-6 h-6 text-green-400"})})]})})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{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(rd,{className:"w-6 h-6 text-purple-400"})})]})})}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{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(fi,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(Ce,{className:"bg-orange-500/10 border-orange-500/30",children:t.jsx(ke,{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(fp,{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(Ce,{className:"bg-blue-500/10 border-blue-500/30",children:t.jsx(ke,{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(Is,{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(de,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Be,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Aa,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),t.jsx(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Be,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(od,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Be,{children:t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(xn,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),t.jsx(ke,{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:"绑定有效期"})]})]})})]})]}),r==="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(Hr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(ne,{value:b,onChange:I=>k(I.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:R,onChange:I=>j(I.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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{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:me.map(I=>{var se,he;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:[(se=I.id)==null?void 0:se.slice(0,12),"..."]}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:I.userNickname}),t.jsx("p",{className:"text-gray-500 text-xs",children:I.userPhone})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white text-sm",children:(()=>{const Pe=I.productType||I.type;return Pe==="fullbook"?`${I.bookName||"《底层逻辑》"} - 全本`:Pe==="match"?"匹配次数购买":`${I.bookName||"《底层逻辑》"} - ${I.sectionTitle||I.chapterTitle||`章节${I.productId||I.sectionId||""}`}`})()}),t.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Pe=I.productType||I.type;return Pe==="fullbook"?"全书解锁":Pe==="match"?"功能权益":I.chapterTitle||"单章购买"})()})]})}),t.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof I.amount=="number"?I.amount.toFixed(2):parseFloat(String(I.amount||"0")).toFixed(2)]}),t.jsx("td",{className:"p-4 text-gray-300",children:I.paymentMethod==="wechat"?"微信支付":I.paymentMethod==="alipay"?"支付宝":I.paymentMethod||"微信支付"}),t.jsx("td",{className:"p-4",children:I.status==="refunded"?t.jsx(De,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):I.status==="completed"||I.status==="paid"?t.jsx(De,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):I.status==="pending"||I.status==="created"?t.jsx(De,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):t.jsx(De,{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:I.refundReason,children:I.status==="refunded"&&I.refundReason?I.refundReason:"-"}),t.jsx("td",{className:"p-4 text-gray-300 text-sm",children:I.referrerId||I.referralCode?t.jsxs("span",{title:I.referralCode||I.referrerCode||I.referrerId||"",children:[I.referrerNickname||I.referralCode||I.referrerCode||((he=I.referrerId)==null?void 0:he.slice(0,8)),(I.referralCode||I.referrerCode)&&` (${I.referralCode||I.referrerCode})`]}):"-"}),t.jsx("td",{className:"p-4 text-[#FFD700]",children:I.referrerEarnings?`¥${(typeof I.referrerEarnings=="number"?I.referrerEarnings:parseFloat(String(I.referrerEarnings))).toFixed(2)}`:"-"}),t.jsx("td",{className:"p-4 text-gray-400 text-sm",children:I.createdAt?new Date(I.createdAt).toLocaleString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:(I.status==="paid"||I.status==="completed")&&t.jsxs(de,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{fe(I),W("")},children:[t.jsx(mp,{className:"w-3 h-3 mr-1"}),"退款"]})})]},I.id)})})]})}),r==="orders"&&t.jsx(Kr,{page:_,totalPages:Ne,total:V,pageSize:G,onPageChange:F,onPageSizeChange:I=>{M(I),F(1)}})]})})]}),r==="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(Hr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(ne,{value:b,onChange:I=>k(I.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:R,onChange:I=>j(I.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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{className:"p-0",children:[Q.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:Q.map(I=>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:I.refereeNickname||"匿名用户"}),t.jsx("p",{className:"text-gray-500 text-xs",children:I.refereePhone})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white",children:I.referrerName||"-"}),t.jsx("p",{className:"text-gray-500 text-xs font-mono",children:I.referrerCode})]})}),t.jsx("td",{className:"p-4 text-gray-400",children:I.boundAt?new Date(I.boundAt).toLocaleDateString("zh-CN"):"-"}),t.jsx("td",{className:"p-4 text-gray-400",children:I.expiresAt?new Date(I.expiresAt).toLocaleDateString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:oe(I.status)}),t.jsx("td",{className:"p-4",children:I.commission?t.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",I.commission.toFixed(2)]}):t.jsx("span",{className:"text-gray-500",children:"-"})})]},I.id))})]})}),r==="bindings"&&t.jsx(Kr,{page:_,totalPages:Ne,total:V,pageSize:G,onPageChange:F,onPageSizeChange:I=>{M(I),F(1)}})]})})]}),r==="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(Hr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx(ne,{value:b,onChange:I=>k(I.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),t.jsxs("select",{value:R,onChange:I=>j(I.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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{className:"p-0",children:[xe.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:xe.map(I=>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:[I.userAvatar?t.jsx("img",{src:I.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:(I.userName||I.name||"?").slice(0,1)}),t.jsx("p",{className:"text-white font-medium",children:I.userName||I.name})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",I.amount.toFixed(2)]})}),t.jsx("td",{className:"p-4",children:t.jsx(De,{className:I.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:I.method==="wechat"?"微信":"支付宝"})}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-mono text-xs",children:I.account}),t.jsx("p",{className:"text-gray-500 text-xs",children:I.name})]})}),t.jsx("td",{className:"p-4 text-gray-400",children:I.createdAt?new Date(I.createdAt).toLocaleString("zh-CN"):"-"}),t.jsx("td",{className:"p-4",children:oe(I.status)}),t.jsx("td",{className:"p-4 text-right",children:I.status==="pending"&&t.jsxs("div",{className:"flex gap-2 justify-end",children:[t.jsxs(de,{size:"sm",onClick:()=>S(I.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(rd,{className:"w-4 h-4 mr-1"}),"通过"]}),t.jsxs(de,{size:"sm",variant:"outline",onClick:()=>D(I.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[t.jsx(kj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},I.id))})]})}),r==="withdrawals"&&t.jsx(Kr,{page:_,totalPages:Ne,total:V,pageSize:G,onPageChange:F,onPageSizeChange:I=>{M(I),F(1)}})]})})]})]}),t.jsx(Kt,{open:!!ie,onOpenChange:I=>!I&&fe(null),children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[t.jsx(Gt,{children:t.jsx(Yt,{className:"text-white",children:"订单退款"})}),ie&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",ie.orderSn||ie.id]}),t.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof ie.amount=="number"?ie.amount.toFixed(2):parseFloat(String(ie.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(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:H,onChange:I=>W(I.target.value)})})]}),t.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),t.jsxs(sn,{children:[t.jsx(de,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>fe(null),disabled:Y,children:"取消"}),t.jsx(de,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:ae,disabled:Y,children:Y?"退款中...":"确认退款"})]})]})})]})}function d2(){const[r,a]=p.useState([]),[l,o]=p.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[c,u]=p.useState(!0),[f,m]=p.useState(null),[x,g]=p.useState("all"),[v,y]=p.useState(1),[E,P]=p.useState(10),[C,N]=p.useState(0),[b,k]=p.useState(null);async function R(){var M,V,te,ue,ce,ie,fe;u(!0),m(null);try{const H=new URLSearchParams({status:x,page:String(v),pageSize:String(E)}),W=await He(`/api/admin/withdrawals?${H}`);if(W!=null&&W.success){const Y=W.withdrawals||[];a(Y),N(W.total??((M=W.stats)==null?void 0:M.total)??Y.length),o({total:((V=W.stats)==null?void 0:V.total)??W.total??Y.length,pendingCount:((te=W.stats)==null?void 0:te.pendingCount)??0,pendingAmount:((ue=W.stats)==null?void 0:ue.pendingAmount)??0,successCount:((ce=W.stats)==null?void 0:ce.successCount)??0,successAmount:((ie=W.stats)==null?void 0:ie.successAmount)??0,failedCount:((fe=W.stats)==null?void 0:fe.failedCount)??0})}else m("加载提现记录失败")}catch(H){console.error("Load withdrawals error:",H),m("加载失败,请检查网络后重试")}finally{u(!1)}}p.useEffect(()=>{y(1)},[x]),p.useEffect(()=>{R()},[x,v,E]);const j=Math.ceil(C/E)||1;async function _(M){const V=r.find(te=>te.id===M);if(V!=null&&V.userCommissionInfo&&V.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${V.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 + +确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(M);try{const te=await zt("/api/admin/withdrawals",{id:M,action:"approve"});te!=null&&te.success?R():alert("操作失败: "+((te==null?void 0:te.error)??""))}catch{alert("操作失败")}finally{k(null)}}async function F(M){const V=prompt("请输入拒绝原因(将返还用户余额):");if(V){k(M);try{const te=await zt("/api/admin/withdrawals",{id:M,action:"reject",errorMessage:V});te!=null&&te.success?R():alert("操作失败: "+((te==null?void 0:te.error)??""))}catch{alert("操作失败")}finally{k(null)}}}function G(M){switch(M){case"pending":return t.jsx(De,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return t.jsx(De,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return t.jsx(De,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return t.jsx(De,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return t.jsx(De,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return t.jsx(De,{className:"bg-gray-500/20 text-gray-400 border-0",children:M})}}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:()=>m(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(de,{variant:"outline",onClick:R,disabled:c,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(tt,{className:`w-4 h-4 mr-2 ${c?"animate-spin":""}`}),"刷新"]})]}),t.jsx(Ce,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:t.jsx(ke,{className:"p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(fi,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsxs(ke,{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(M=>t.jsx(de,{variant:x===M?"default":"outline",size:"sm",onClick:()=>g(M),className:x===M?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:M==="all"?"全部":M==="pending"?"待处理":M==="success"?"已完成":"已拒绝"},M))}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(ke,{className:"p-0",children:c?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(tt,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):r.length===0?t.jsxs("div",{className:"text-center py-12",children:[t.jsx(Is,{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:r.map(M=>t.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[t.jsx("td",{className:"p-4 text-gray-400",children:new Date(M.createdAt??"").toLocaleString()}),t.jsx("td",{className:"p-4",children:t.jsxs("div",{className:"flex items-center gap-2",children:[M.userAvatar?t.jsx("img",{src:M.userAvatar,alt:M.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:(M.userName??"?").charAt(0)}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-white",children:M.userName??"未知"}),t.jsx("p",{className:"text-xs text-gray-500",children:M.userPhone??M.referralCode??(M.userId??"").slice(0,10)})]})]})}),t.jsx("td",{className:"p-4",children:t.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(M.amount).toFixed(2)]})}),t.jsx("td",{className:"p-4",children:M.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:["¥",M.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:["¥",M.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:["¥",M.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:M.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",M.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):t.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),t.jsxs("td",{className:"p-4",children:[G(M.status),M.errorMessage&&t.jsx("p",{className:"text-xs text-red-400 mt-1",children:M.errorMessage})]}),t.jsx("td",{className:"p-4 text-gray-400",children:M.processedAt?new Date(M.processedAt).toLocaleString():"-"}),t.jsx("td",{className:"p-4 text-gray-400",children:M.userConfirmedAt?t.jsxs("span",{className:"text-green-400",title:M.userConfirmedAt,children:["已确认 ",new Date(M.userConfirmedAt).toLocaleString()]}):"-"}),t.jsxs("td",{className:"p-4 text-right",children:[(M.status==="pending"||M.status==="pending_confirm")&&t.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t.jsxs(de,{size:"sm",onClick:()=>_(M.id),disabled:b===M.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[t.jsx(ki,{className:"w-4 h-4 mr-1"}),"批准"]}),t.jsxs(de,{size:"sm",variant:"outline",onClick:()=>F(M.id),disabled:b===M.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[t.jsx(Pn,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(M.status==="success"||M.status==="completed")&&M.transactionId&&t.jsx("span",{className:"text-xs text-gray-500 font-mono",children:M.transactionId})]})]},M.id))})]})}),t.jsx(Kr,{page:v,totalPages:j,total:C,pageSize:E,onPageChange:y,onPageSizeChange:M=>{P(M),y(1)}})]})})})]})}const Rs=p.forwardRef(({className:r,...a},l)=>t.jsx("textarea",{className:Ge("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",r),ref:l,...a}));Rs.displayName="Textarea";function vi(r,[a,l]){return Math.min(l,Math.max(a,r))}const u2=["top","right","bottom","left"],yr=Math.min,Ht=Math.max,yi=Math.round,si=Math.floor,En=r=>({x:r,y:r}),f2={left:"right",right:"left",bottom:"top",top:"bottom"},h2={start:"end",end:"start"};function hd(r,a,l){return Ht(r,yr(a,l))}function $n(r,a){return typeof r=="function"?r(a):r}function Bn(r){return r.split("-")[0]}function Fs(r){return r.split("-")[1]}function Kd(r){return r==="x"?"y":"x"}function Gd(r){return r==="y"?"height":"width"}const m2=new Set(["top","bottom"]);function kn(r){return m2.has(Bn(r))?"y":"x"}function Yd(r){return Kd(kn(r))}function p2(r,a,l){l===void 0&&(l=!1);const o=Fs(r),c=Yd(r),u=Gd(c);let f=c==="x"?o===(l?"end":"start")?"right":"left":o==="start"?"bottom":"top";return a.reference[u]>a.floating[u]&&(f=ji(f)),[f,ji(f)]}function x2(r){const a=ji(r);return[md(r),a,md(a)]}function md(r){return r.replace(/start|end/g,a=>h2[a])}const Dm=["left","right"],Om=["right","left"],g2=["top","bottom"],v2=["bottom","top"];function y2(r,a,l){switch(r){case"top":case"bottom":return l?a?Om:Dm:a?Dm:Om;case"left":case"right":return a?g2:v2;default:return[]}}function j2(r,a,l,o){const c=Fs(r);let u=y2(Bn(r),l==="start",o);return c&&(u=u.map(f=>f+"-"+c),a&&(u=u.concat(u.map(md)))),u}function ji(r){return r.replace(/left|right|bottom|top/g,a=>f2[a])}function w2(r){return{top:0,right:0,bottom:0,left:0,...r}}function Ox(r){return typeof r!="number"?w2(r):{top:r,right:r,bottom:r,left:r}}function wi(r){const{x:a,y:l,width:o,height:c}=r;return{width:o,height:c,top:l,left:a,right:a+o,bottom:l+c,x:a,y:l}}function Fm(r,a,l){let{reference:o,floating:c}=r;const u=kn(a),f=Yd(a),m=Gd(f),x=Bn(a),g=u==="y",v=o.x+o.width/2-c.width/2,y=o.y+o.height/2-c.height/2,E=o[m]/2-c[m]/2;let P;switch(x){case"top":P={x:v,y:o.y-c.height};break;case"bottom":P={x:v,y:o.y+o.height};break;case"right":P={x:o.x+o.width,y};break;case"left":P={x:o.x-c.width,y};break;default:P={x:o.x,y:o.y}}switch(Fs(a)){case"start":P[f]-=E*(l&&g?-1:1);break;case"end":P[f]+=E*(l&&g?-1:1);break}return P}async function N2(r,a){var l;a===void 0&&(a={});const{x:o,y:c,platform:u,rects:f,elements:m,strategy:x}=r,{boundary:g="clippingAncestors",rootBoundary:v="viewport",elementContext:y="floating",altBoundary:E=!1,padding:P=0}=$n(a,r),C=Ox(P),b=m[E?y==="floating"?"reference":"floating":y],k=wi(await u.getClippingRect({element:(l=await(u.isElement==null?void 0:u.isElement(b)))==null||l?b:b.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(m.floating)),boundary:g,rootBoundary:v,strategy:x})),R=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(m.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},F=wi(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:m,rect:R,offsetParent:j,strategy:x}):R);return{top:(k.top-F.top+C.top)/_.y,bottom:(F.bottom-k.bottom+C.bottom)/_.y,left:(k.left-F.left+C.left)/_.x,right:(F.right-k.right+C.right)/_.x}}const b2=async(r,a,l)=>{const{placement:o="bottom",strategy:c="absolute",middleware:u=[],platform:f}=l,m=u.filter(Boolean),x=await(f.isRTL==null?void 0:f.isRTL(a));let g=await f.getElementRects({reference:r,floating:a,strategy:c}),{x:v,y}=Fm(g,o,x),E=o,P={},C=0;for(let b=0;b({name:"arrow",options:r,async fn(a){const{x:l,y:o,placement:c,rects:u,platform:f,elements:m,middlewareData:x}=a,{element:g,padding:v=0}=$n(r,a)||{};if(g==null)return{};const y=Ox(v),E={x:l,y:o},P=Yd(c),C=Gd(P),N=await f.getDimensions(g),b=P==="y",k=b?"top":"left",R=b?"bottom":"right",j=b?"clientHeight":"clientWidth",_=u.reference[C]+u.reference[P]-E[P]-u.floating[C],F=E[P]-u.reference[P],G=await(f.getOffsetParent==null?void 0:f.getOffsetParent(g));let M=G?G[j]:0;(!M||!await(f.isElement==null?void 0:f.isElement(G)))&&(M=m.floating[j]||u.floating[C]);const V=_/2-F/2,te=M/2-N[C]/2-1,ue=yr(y[k],te),ce=yr(y[R],te),ie=ue,fe=M-N[C]-ce,H=M/2-N[C]/2+V,W=hd(ie,H,fe),Y=!x.arrow&&Fs(c)!=null&&H!==W&&u.reference[C]/2-(HH<=0)){var ce,ie;const H=(((ce=u.flip)==null?void 0:ce.index)||0)+1,W=M[H];if(W&&(!(y==="alignment"?R!==kn(W):!1)||ue.every(A=>kn(A.placement)===R?A.overflows[0]>0:!0)))return{data:{index:H,overflows:ue},reset:{placement:W}};let Y=(ie=ue.filter(K=>K.overflows[0]<=0).sort((K,A)=>K.overflows[1]-A.overflows[1])[0])==null?void 0:ie.placement;if(!Y)switch(P){case"bestFit":{var fe;const K=(fe=ue.filter(A=>{if(G){const J=kn(A.placement);return J===R||J==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(J=>J>0).reduce((J,B)=>J+B,0)]).sort((A,J)=>A[1]-J[1])[0])==null?void 0:fe[0];K&&(Y=K);break}case"initialPlacement":Y=m;break}if(c!==Y)return{reset:{placement:Y}}}return{}}}};function zm(r,a){return{top:r.top-a.height,right:r.right-a.width,bottom:r.bottom-a.height,left:r.left-a.width}}function $m(r){return u2.some(a=>r[a]>=0)}const k2=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(a){const{rects:l,platform:o}=a,{strategy:c="referenceHidden",...u}=$n(r,a);switch(c){case"referenceHidden":{const f=await o.detectOverflow(a,{...u,elementContext:"reference"}),m=zm(f,l.reference);return{data:{referenceHiddenOffsets:m,referenceHidden:$m(m)}}}case"escaped":{const f=await o.detectOverflow(a,{...u,altBoundary:!0}),m=zm(f,l.floating);return{data:{escapedOffsets:m,escaped:$m(m)}}}default:return{}}}}},Fx=new Set(["left","top"]);async function E2(r,a){const{placement:l,platform:o,elements:c}=r,u=await(o.isRTL==null?void 0:o.isRTL(c.floating)),f=Bn(l),m=Fs(l),x=kn(l)==="y",g=Fx.has(f)?-1:1,v=u&&x?-1:1,y=$n(a,r);let{mainAxis:E,crossAxis:P,alignmentAxis:C}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return m&&typeof C=="number"&&(P=m==="end"?C*-1:C),x?{x:P*v,y:E*g}:{x:E*g,y:P*v}}const P2=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(a){var l,o;const{x:c,y:u,placement:f,middlewareData:m}=a,x=await E2(a,r);return f===((l=m.offset)==null?void 0:l.placement)&&(o=m.arrow)!=null&&o.alignmentOffset?{}:{x:c+x.x,y:u+x.y,data:{...x,placement:f}}}}},R2=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(a){const{x:l,y:o,placement:c,platform:u}=a,{mainAxis:f=!0,crossAxis:m=!1,limiter:x={fn:k=>{let{x:R,y:j}=k;return{x:R,y:j}}},...g}=$n(r,a),v={x:l,y:o},y=await u.detectOverflow(a,g),E=kn(Bn(c)),P=Kd(E);let C=v[P],N=v[E];if(f){const k=P==="y"?"top":"left",R=P==="y"?"bottom":"right",j=C+y[k],_=C-y[R];C=hd(j,C,_)}if(m){const k=E==="y"?"top":"left",R=E==="y"?"bottom":"right",j=N+y[k],_=N-y[R];N=hd(j,N,_)}const b=x.fn({...a,[P]:C,[E]:N});return{...b,data:{x:b.x-l,y:b.y-o,enabled:{[P]:f,[E]:m}}}}}},_2=function(r){return r===void 0&&(r={}),{options:r,fn(a){const{x:l,y:o,placement:c,rects:u,middlewareData:f}=a,{offset:m=0,mainAxis:x=!0,crossAxis:g=!0}=$n(r,a),v={x:l,y:o},y=kn(c),E=Kd(y);let P=v[E],C=v[y];const N=$n(m,a),b=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(x){const j=E==="y"?"height":"width",_=u.reference[E]-u.floating[j]+b.mainAxis,F=u.reference[E]+u.reference[j]-b.mainAxis;P<_?P=_:P>F&&(P=F)}if(g){var k,R;const j=E==="y"?"width":"height",_=Fx.has(Bn(c)),F=u.reference[y]-u.floating[j]+(_&&((k=f.offset)==null?void 0:k[y])||0)+(_?0:b.crossAxis),G=u.reference[y]+u.reference[j]+(_?0:((R=f.offset)==null?void 0:R[y])||0)-(_?b.crossAxis:0);CG&&(C=G)}return{[E]:P,[y]:C}}}},T2=function(r){return r===void 0&&(r={}),{name:"size",options:r,async fn(a){var l,o;const{placement:c,rects:u,platform:f,elements:m}=a,{apply:x=()=>{},...g}=$n(r,a),v=await f.detectOverflow(a,g),y=Bn(c),E=Fs(c),P=kn(c)==="y",{width:C,height:N}=u.floating;let b,k;y==="top"||y==="bottom"?(b=y,k=E===(await(f.isRTL==null?void 0:f.isRTL(m.floating))?"start":"end")?"left":"right"):(k=y,b=E==="end"?"top":"bottom");const R=N-v.top-v.bottom,j=C-v.left-v.right,_=yr(N-v[b],R),F=yr(C-v[k],j),G=!a.middlewareData.shift;let M=_,V=F;if((l=a.middlewareData.shift)!=null&&l.enabled.x&&(V=j),(o=a.middlewareData.shift)!=null&&o.enabled.y&&(M=R),G&&!E){const ue=Ht(v.left,0),ce=Ht(v.right,0),ie=Ht(v.top,0),fe=Ht(v.bottom,0);P?V=C-2*(ue!==0||ce!==0?ue+ce:Ht(v.left,v.right)):M=N-2*(ie!==0||fe!==0?ie+fe:Ht(v.top,v.bottom))}await x({...a,availableWidth:V,availableHeight:M});const te=await f.getDimensions(m.floating);return C!==te.width||N!==te.height?{reset:{rects:!0}}:{}}}};function Di(){return typeof window<"u"}function zs(r){return zx(r)?(r.nodeName||"").toLowerCase():"#document"}function Qt(r){var a;return(r==null||(a=r.ownerDocument)==null?void 0:a.defaultView)||window}function _n(r){var a;return(a=(zx(r)?r.ownerDocument:r.document)||window.document)==null?void 0:a.documentElement}function zx(r){return Di()?r instanceof Node||r instanceof Qt(r).Node:!1}function gn(r){return Di()?r instanceof Element||r instanceof Qt(r).Element:!1}function Rn(r){return Di()?r instanceof HTMLElement||r instanceof Qt(r).HTMLElement:!1}function Bm(r){return!Di()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof Qt(r).ShadowRoot}const I2=new Set(["inline","contents"]);function Ba(r){const{overflow:a,overflowX:l,overflowY:o,display:c}=vn(r);return/auto|scroll|overlay|hidden|clip/.test(a+o+l)&&!I2.has(c)}const A2=new Set(["table","td","th"]);function M2(r){return A2.has(zs(r))}const L2=[":popover-open",":modal"];function Oi(r){return L2.some(a=>{try{return r.matches(a)}catch{return!1}})}const D2=["transform","translate","scale","rotate","perspective"],O2=["transform","translate","scale","rotate","perspective","filter"],F2=["paint","layout","strict","content"];function Qd(r){const a=qd(),l=gn(r)?vn(r):r;return D2.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)||O2.some(o=>(l.willChange||"").includes(o))||F2.some(o=>(l.contain||"").includes(o))}function z2(r){let a=jr(r);for(;Rn(a)&&!As(a);){if(Qd(a))return a;if(Oi(a))return null;a=jr(a)}return null}function qd(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const $2=new Set(["html","body","#document"]);function As(r){return $2.has(zs(r))}function vn(r){return Qt(r).getComputedStyle(r)}function Fi(r){return gn(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function jr(r){if(zs(r)==="html")return r;const a=r.assignedSlot||r.parentNode||Bm(r)&&r.host||_n(r);return Bm(a)?a.host:a}function $x(r){const a=jr(r);return As(a)?r.ownerDocument?r.ownerDocument.body:r.body:Rn(a)&&Ba(a)?a:$x(a)}function La(r,a,l){var o;a===void 0&&(a=[]),l===void 0&&(l=!0);const c=$x(r),u=c===((o=r.ownerDocument)==null?void 0:o.body),f=Qt(c);if(u){const m=pd(f);return a.concat(f,f.visualViewport||[],Ba(c)?c:[],m&&l?La(m):[])}return a.concat(c,La(c,[],l))}function pd(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function Bx(r){const a=vn(r);let l=parseFloat(a.width)||0,o=parseFloat(a.height)||0;const c=Rn(r),u=c?r.offsetWidth:l,f=c?r.offsetHeight:o,m=yi(l)!==u||yi(o)!==f;return m&&(l=u,o=f),{width:l,height:o,$:m}}function Xd(r){return gn(r)?r:r.contextElement}function _s(r){const a=Xd(r);if(!Rn(a))return En(1);const l=a.getBoundingClientRect(),{width:o,height:c,$:u}=Bx(a);let f=(u?yi(l.width):l.width)/o,m=(u?yi(l.height):l.height)/c;return(!f||!Number.isFinite(f))&&(f=1),(!m||!Number.isFinite(m))&&(m=1),{x:f,y:m}}const B2=En(0);function Vx(r){const a=Qt(r);return!qd()||!a.visualViewport?B2:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function V2(r,a,l){return a===void 0&&(a=!1),!l||a&&l!==Qt(r)?!1:a}function Qr(r,a,l,o){a===void 0&&(a=!1),l===void 0&&(l=!1);const c=r.getBoundingClientRect(),u=Xd(r);let f=En(1);a&&(o?gn(o)&&(f=_s(o)):f=_s(r));const m=V2(u,l,o)?Vx(u):En(0);let x=(c.left+m.x)/f.x,g=(c.top+m.y)/f.y,v=c.width/f.x,y=c.height/f.y;if(u){const E=Qt(u),P=o&&gn(o)?Qt(o):o;let C=E,N=pd(C);for(;N&&o&&P!==C;){const b=_s(N),k=N.getBoundingClientRect(),R=vn(N),j=k.left+(N.clientLeft+parseFloat(R.paddingLeft))*b.x,_=k.top+(N.clientTop+parseFloat(R.paddingTop))*b.y;x*=b.x,g*=b.y,v*=b.x,y*=b.y,x+=j,g+=_,C=Qt(N),N=pd(C)}}return wi({width:v,height:y,x,y:g})}function zi(r,a){const l=Fi(r).scrollLeft;return a?a.left+l:Qr(_n(r)).left+l}function Ux(r,a){const l=r.getBoundingClientRect(),o=l.left+a.scrollLeft-zi(r,l),c=l.top+a.scrollTop;return{x:o,y:c}}function U2(r){let{elements:a,rect:l,offsetParent:o,strategy:c}=r;const u=c==="fixed",f=_n(o),m=a?Oi(a.floating):!1;if(o===f||m&&u)return l;let x={scrollLeft:0,scrollTop:0},g=En(1);const v=En(0),y=Rn(o);if((y||!y&&!u)&&((zs(o)!=="body"||Ba(f))&&(x=Fi(o)),Rn(o))){const P=Qr(o);g=_s(o),v.x=P.x+o.clientLeft,v.y=P.y+o.clientTop}const E=f&&!y&&!u?Ux(f,x):En(0);return{width:l.width*g.x,height:l.height*g.y,x:l.x*g.x-x.scrollLeft*g.x+v.x+E.x,y:l.y*g.y-x.scrollTop*g.y+v.y+E.y}}function W2(r){return Array.from(r.getClientRects())}function H2(r){const a=_n(r),l=Fi(r),o=r.ownerDocument.body,c=Ht(a.scrollWidth,a.clientWidth,o.scrollWidth,o.clientWidth),u=Ht(a.scrollHeight,a.clientHeight,o.scrollHeight,o.clientHeight);let f=-l.scrollLeft+zi(r);const m=-l.scrollTop;return vn(o).direction==="rtl"&&(f+=Ht(a.clientWidth,o.clientWidth)-c),{width:c,height:u,x:f,y:m}}const Vm=25;function K2(r,a){const l=Qt(r),o=_n(r),c=l.visualViewport;let u=o.clientWidth,f=o.clientHeight,m=0,x=0;if(c){u=c.width,f=c.height;const v=qd();(!v||v&&a==="fixed")&&(m=c.offsetLeft,x=c.offsetTop)}const g=zi(o);if(g<=0){const v=o.ownerDocument,y=v.body,E=getComputedStyle(y),P=v.compatMode==="CSS1Compat"&&parseFloat(E.marginLeft)+parseFloat(E.marginRight)||0,C=Math.abs(o.clientWidth-y.clientWidth-P);C<=Vm&&(u-=C)}else g<=Vm&&(u+=g);return{width:u,height:f,x:m,y:x}}const G2=new Set(["absolute","fixed"]);function Y2(r,a){const l=Qr(r,!0,a==="fixed"),o=l.top+r.clientTop,c=l.left+r.clientLeft,u=Rn(r)?_s(r):En(1),f=r.clientWidth*u.x,m=r.clientHeight*u.y,x=c*u.x,g=o*u.y;return{width:f,height:m,x,y:g}}function Um(r,a,l){let o;if(a==="viewport")o=K2(r,l);else if(a==="document")o=H2(_n(r));else if(gn(a))o=Y2(a,l);else{const c=Vx(r);o={x:a.x-c.x,y:a.y-c.y,width:a.width,height:a.height}}return wi(o)}function Wx(r,a){const l=jr(r);return l===a||!gn(l)||As(l)?!1:vn(l).position==="fixed"||Wx(l,a)}function Q2(r,a){const l=a.get(r);if(l)return l;let o=La(r,[],!1).filter(m=>gn(m)&&zs(m)!=="body"),c=null;const u=vn(r).position==="fixed";let f=u?jr(r):r;for(;gn(f)&&!As(f);){const m=vn(f),x=Qd(f);!x&&m.position==="fixed"&&(c=null),(u?!x&&!c:!x&&m.position==="static"&&!!c&&G2.has(c.position)||Ba(f)&&!x&&Wx(r,f))?o=o.filter(v=>v!==f):c=m,f=jr(f)}return a.set(r,o),o}function q2(r){let{element:a,boundary:l,rootBoundary:o,strategy:c}=r;const f=[...l==="clippingAncestors"?Oi(a)?[]:Q2(a,this._c):[].concat(l),o],m=f[0],x=f.reduce((g,v)=>{const y=Um(a,v,c);return g.top=Ht(y.top,g.top),g.right=yr(y.right,g.right),g.bottom=yr(y.bottom,g.bottom),g.left=Ht(y.left,g.left),g},Um(a,m,c));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}}function X2(r){const{width:a,height:l}=Bx(r);return{width:a,height:l}}function J2(r,a,l){const o=Rn(a),c=_n(a),u=l==="fixed",f=Qr(r,!0,u,a);let m={scrollLeft:0,scrollTop:0};const x=En(0);function g(){x.x=zi(c)}if(o||!o&&!u)if((zs(a)!=="body"||Ba(c))&&(m=Fi(a)),o){const P=Qr(a,!0,u,a);x.x=P.x+a.clientLeft,x.y=P.y+a.clientTop}else c&&g();u&&!o&&c&&g();const v=c&&!o&&!u?Ux(c,m):En(0),y=f.left+m.scrollLeft-x.x-v.x,E=f.top+m.scrollTop-x.y-v.y;return{x:y,y:E,width:f.width,height:f.height}}function qc(r){return vn(r).position==="static"}function Wm(r,a){if(!Rn(r)||vn(r).position==="fixed")return null;if(a)return a(r);let l=r.offsetParent;return _n(r)===l&&(l=l.ownerDocument.body),l}function Hx(r,a){const l=Qt(r);if(Oi(r))return l;if(!Rn(r)){let c=jr(r);for(;c&&!As(c);){if(gn(c)&&!qc(c))return c;c=jr(c)}return l}let o=Wm(r,a);for(;o&&M2(o)&&qc(o);)o=Wm(o,a);return o&&As(o)&&qc(o)&&!Qd(o)?l:o||z2(r)||l}const Z2=async function(r){const a=this.getOffsetParent||Hx,l=this.getDimensions,o=await l(r.floating);return{reference:J2(r.reference,await a(r.floating),r.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function eS(r){return vn(r).direction==="rtl"}const tS={convertOffsetParentRelativeRectToViewportRelativeRect:U2,getDocumentElement:_n,getClippingRect:q2,getOffsetParent:Hx,getElementRects:Z2,getClientRects:W2,getDimensions:X2,getScale:_s,isElement:gn,isRTL:eS};function Kx(r,a){return r.x===a.x&&r.y===a.y&&r.width===a.width&&r.height===a.height}function nS(r,a){let l=null,o;const c=_n(r);function u(){var m;clearTimeout(o),(m=l)==null||m.disconnect(),l=null}function f(m,x){m===void 0&&(m=!1),x===void 0&&(x=1),u();const g=r.getBoundingClientRect(),{left:v,top:y,width:E,height:P}=g;if(m||a(),!E||!P)return;const C=si(y),N=si(c.clientWidth-(v+E)),b=si(c.clientHeight-(y+P)),k=si(v),j={rootMargin:-C+"px "+-N+"px "+-b+"px "+-k+"px",threshold:Ht(0,yr(1,x))||1};let _=!0;function F(G){const M=G[0].intersectionRatio;if(M!==x){if(!_)return f();M?f(!1,M):o=setTimeout(()=>{f(!1,1e-7)},1e3)}M===1&&!Kx(g,r.getBoundingClientRect())&&f(),_=!1}try{l=new IntersectionObserver(F,{...j,root:c.ownerDocument})}catch{l=new IntersectionObserver(F,j)}l.observe(r)}return f(!0),u}function rS(r,a,l,o){o===void 0&&(o={});const{ancestorScroll:c=!0,ancestorResize:u=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:m=typeof IntersectionObserver=="function",animationFrame:x=!1}=o,g=Xd(r),v=c||u?[...g?La(g):[],...La(a)]:[];v.forEach(k=>{c&&k.addEventListener("scroll",l,{passive:!0}),u&&k.addEventListener("resize",l)});const y=g&&m?nS(g,l):null;let E=-1,P=null;f&&(P=new ResizeObserver(k=>{let[R]=k;R&&R.target===g&&P&&(P.unobserve(a),cancelAnimationFrame(E),E=requestAnimationFrame(()=>{var j;(j=P)==null||j.observe(a)})),l()}),g&&!x&&P.observe(g),P.observe(a));let C,N=x?Qr(r):null;x&&b();function b(){const k=Qr(r);N&&!Kx(N,k)&&l(),N=k,C=requestAnimationFrame(b)}return l(),()=>{var k;v.forEach(R=>{c&&R.removeEventListener("scroll",l),u&&R.removeEventListener("resize",l)}),y==null||y(),(k=P)==null||k.disconnect(),P=null,x&&cancelAnimationFrame(C)}}const sS=P2,aS=R2,lS=C2,iS=T2,oS=k2,Hm=S2,cS=_2,dS=(r,a,l)=>{const o=new Map,c={platform:tS,...l},u={...c.platform,_c:o};return b2(r,a,{...c,platform:u})};var uS=typeof document<"u",fS=function(){},oi=uS?p.useLayoutEffect:fS;function Ni(r,a){if(r===a)return!0;if(typeof r!=typeof a)return!1;if(typeof r=="function"&&r.toString()===a.toString())return!0;let l,o,c;if(r&&a&&typeof r=="object"){if(Array.isArray(r)){if(l=r.length,l!==a.length)return!1;for(o=l;o--!==0;)if(!Ni(r[o],a[o]))return!1;return!0}if(c=Object.keys(r),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"&&r.$$typeof)&&!Ni(r[u],a[u]))return!1}return!0}return r!==r&&a!==a}function Gx(r){return typeof window>"u"?1:(r.ownerDocument.defaultView||window).devicePixelRatio||1}function Km(r,a){const l=Gx(r);return Math.round(a*l)/l}function Xc(r){const a=p.useRef(r);return oi(()=>{a.current=r}),a}function hS(r){r===void 0&&(r={});const{placement:a="bottom",strategy:l="absolute",middleware:o=[],platform:c,elements:{reference:u,floating:f}={},transform:m=!0,whileElementsMounted:x,open:g}=r,[v,y]=p.useState({x:0,y:0,strategy:l,placement:a,middlewareData:{},isPositioned:!1}),[E,P]=p.useState(o);Ni(E,o)||P(o);const[C,N]=p.useState(null),[b,k]=p.useState(null),R=p.useCallback(A=>{A!==G.current&&(G.current=A,N(A))},[]),j=p.useCallback(A=>{A!==M.current&&(M.current=A,k(A))},[]),_=u||C,F=f||b,G=p.useRef(null),M=p.useRef(null),V=p.useRef(v),te=x!=null,ue=Xc(x),ce=Xc(c),ie=Xc(g),fe=p.useCallback(()=>{if(!G.current||!M.current)return;const A={placement:a,strategy:l,middleware:E};ce.current&&(A.platform=ce.current),dS(G.current,M.current,A).then(J=>{const B={...J,isPositioned:ie.current!==!1};H.current&&!Ni(V.current,B)&&(V.current=B,Da.flushSync(()=>{y(B)}))})},[E,a,l,ce,ie]);oi(()=>{g===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,y(A=>({...A,isPositioned:!1})))},[g]);const H=p.useRef(!1);oi(()=>(H.current=!0,()=>{H.current=!1}),[]),oi(()=>{if(_&&(G.current=_),F&&(M.current=F),_&&F){if(ue.current)return ue.current(_,F,fe);fe()}},[_,F,fe,ue,te]);const W=p.useMemo(()=>({reference:G,floating:M,setReference:R,setFloating:j}),[R,j]),Y=p.useMemo(()=>({reference:_,floating:F}),[_,F]),K=p.useMemo(()=>{const A={position:l,left:0,top:0};if(!Y.floating)return A;const J=Km(Y.floating,v.x),B=Km(Y.floating,v.y);return m?{...A,transform:"translate("+J+"px, "+B+"px)",...Gx(Y.floating)>=1.5&&{willChange:"transform"}}:{position:l,left:J,top:B}},[l,m,Y.floating,v.x,v.y]);return p.useMemo(()=>({...v,update:fe,refs:W,elements:Y,floatingStyles:K}),[v,fe,W,Y,K])}const mS=r=>{function a(l){return{}.hasOwnProperty.call(l,"current")}return{name:"arrow",options:r,fn(l){const{element:o,padding:c}=typeof r=="function"?r(l):r;return o&&a(o)?o.current!=null?Hm({element:o.current,padding:c}).fn(l):{}:o?Hm({element:o,padding:c}).fn(l):{}}}},pS=(r,a)=>({...sS(r),options:[r,a]}),xS=(r,a)=>({...aS(r),options:[r,a]}),gS=(r,a)=>({...cS(r),options:[r,a]}),vS=(r,a)=>({...lS(r),options:[r,a]}),yS=(r,a)=>({...iS(r),options:[r,a]}),jS=(r,a)=>({...oS(r),options:[r,a]}),wS=(r,a)=>({...mS(r),options:[r,a]});var NS="Arrow",Yx=p.forwardRef((r,a)=>{const{children:l,width:o=10,height:c=5,...u}=r;return t.jsx(Oe.svg,{...u,ref:a,width:o,height:c,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:r.asChild?l:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});Yx.displayName=NS;var bS=Yx,Jd="Popper",[Qx,qx]=Cr(Jd),[SS,Xx]=Qx(Jd),Jx=r=>{const{__scopePopper:a,children:l}=r,[o,c]=p.useState(null);return t.jsx(SS,{scope:a,anchor:o,onAnchorChange:c,children:l})};Jx.displayName=Jd;var Zx="PopperAnchor",eg=p.forwardRef((r,a)=>{const{__scopePopper:l,virtualRef:o,...c}=r,u=Xx(Zx,l),f=p.useRef(null),m=Ke(a,f),x=p.useRef(null);return p.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(Oe.div,{...c,ref:m})});eg.displayName=Zx;var Zd="PopperContent",[CS,kS]=Qx(Zd),tg=p.forwardRef((r,a)=>{var Q,xe,I,se,he,Pe;const{__scopePopper:l,side:o="bottom",sideOffset:c=0,align:u="center",alignOffset:f=0,arrowPadding:m=0,avoidCollisions:x=!0,collisionBoundary:g=[],collisionPadding:v=0,sticky:y="partial",hideWhenDetached:E=!1,updatePositionStrategy:P="optimized",onPlaced:C,...N}=r,b=Xx(Zd,l),[k,R]=p.useState(null),j=Ke(a,Me=>R(Me)),[_,F]=p.useState(null),G=Vd(_),M=(G==null?void 0:G.width)??0,V=(G==null?void 0:G.height)??0,te=o+(u!=="center"?"-"+u:""),ue=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},ce=Array.isArray(g)?g:[g],ie=ce.length>0,fe={padding:ue,boundary:ce.filter(PS),altBoundary:ie},{refs:H,floatingStyles:W,placement:Y,isPositioned:K,middlewareData:A}=hS({strategy:"fixed",placement:te,whileElementsMounted:(...Me)=>rS(...Me,{animationFrame:P==="always"}),elements:{reference:b.anchor},middleware:[pS({mainAxis:c+V,alignmentAxis:f}),x&&xS({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?gS():void 0,...fe}),x&&vS({...fe}),yS({...fe,apply:({elements:Me,rects:Fe,availableWidth:Qe,availableHeight:nt})=>{const{width:Ze,height:Tt}=Fe.reference,It=Me.floating.style;It.setProperty("--radix-popper-available-width",`${Qe}px`),It.setProperty("--radix-popper-available-height",`${nt}px`),It.setProperty("--radix-popper-anchor-width",`${Ze}px`),It.setProperty("--radix-popper-anchor-height",`${Tt}px`)}}),_&&wS({element:_,padding:m}),RS({arrowWidth:M,arrowHeight:V}),E&&jS({strategy:"referenceHidden",...fe})]}),[J,B]=sg(Y),S=vr(C);Pt(()=>{K&&(S==null||S())},[K,S]);const D=(Q=A.arrow)==null?void 0:Q.x,ae=(xe=A.arrow)==null?void 0:xe.y,oe=((I=A.arrow)==null?void 0:I.centerOffset)!==0,[Ne,me]=p.useState();return Pt(()=>{k&&me(window.getComputedStyle(k).zIndex)},[k]),t.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...W,transform:K?W.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ne,"--radix-popper-transform-origin":[(se=A.transformOrigin)==null?void 0:se.x,(he=A.transformOrigin)==null?void 0:he.y].join(" "),...((Pe=A.hide)==null?void 0:Pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:r.dir,children:t.jsx(CS,{scope:l,placedSide:J,onArrowChange:F,arrowX:D,arrowY:ae,shouldHideArrow:oe,children:t.jsx(Oe.div,{"data-side":J,"data-align":B,...N,ref:j,style:{...N.style,animation:K?void 0:"none"}})})})});tg.displayName=Zd;var ng="PopperArrow",ES={top:"bottom",right:"left",bottom:"top",left:"right"},rg=p.forwardRef(function(a,l){const{__scopePopper:o,...c}=a,u=kS(ng,o),f=ES[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(bS,{...c,ref:l,style:{...c.style,display:"block"}})})});rg.displayName=ng;function PS(r){return r!==null}var RS=r=>({name:"transformOrigin",options:r,fn(a){var b,k,R;const{placement:l,rects:o,middlewareData:c}=a,f=((b=c.arrow)==null?void 0:b.centerOffset)!==0,m=f?0:r.arrowWidth,x=f?0:r.arrowHeight,[g,v]=sg(l),y={start:"0%",center:"50%",end:"100%"}[v],E=(((k=c.arrow)==null?void 0:k.x)??0)+m/2,P=(((R=c.arrow)==null?void 0:R.y)??0)+x/2;let C="",N="";return g==="bottom"?(C=f?y:`${E}px`,N=`${-x}px`):g==="top"?(C=f?y:`${E}px`,N=`${o.floating.height+x}px`):g==="right"?(C=`${-x}px`,N=f?y:`${P}px`):g==="left"&&(C=`${o.floating.width+x}px`,N=f?y:`${P}px`),{data:{x:C,y:N}}}});function sg(r){const[a,l="center"]=r.split("-");return[a,l]}var _S=Jx,TS=eg,IS=tg,AS=rg,ag=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"}),MS="VisuallyHidden",LS=p.forwardRef((r,a)=>t.jsx(Oe.span,{...r,ref:a,style:{...ag,...r.style}}));LS.displayName=MS;var DS=[" ","Enter","ArrowUp","ArrowDown"],OS=[" ","Enter"],qr="Select",[$i,Bi,FS]=Ud(qr),[$s]=Cr(qr,[FS,qx]),Vi=qx(),[zS,kr]=$s(qr),[$S,BS]=$s(qr),lg=r=>{const{__scopeSelect:a,children:l,open:o,defaultOpen:c,onOpenChange:u,value:f,defaultValue:m,onValueChange:x,dir:g,name:v,autoComplete:y,disabled:E,required:P,form:C}=r,N=Vi(a),[b,k]=p.useState(null),[R,j]=p.useState(null),[_,F]=p.useState(!1),G=Ai(g),[M,V]=Gr({prop:o,defaultProp:c??!1,onChange:u,caller:qr}),[te,ue]=Gr({prop:f,defaultProp:m,onChange:x,caller:qr}),ce=p.useRef(null),ie=b?C||!!b.closest("form"):!0,[fe,H]=p.useState(new Set),W=Array.from(fe).map(Y=>Y.props.value).join(";");return t.jsx(_S,{...N,children:t.jsxs(zS,{required:P,scope:a,trigger:b,onTriggerChange:k,valueNode:R,onValueNodeChange:j,valueNodeHasChildren:_,onValueNodeHasChildrenChange:F,contentId:xr(),value:te,onValueChange:ue,open:M,onOpenChange:V,dir:G,triggerPointerDownPosRef:ce,disabled:E,children:[t.jsx($i.Provider,{scope:a,children:t.jsx($S,{scope:r.__scopeSelect,onNativeOptionAdd:p.useCallback(Y=>{H(K=>new Set(K).add(Y))},[]),onNativeOptionRemove:p.useCallback(Y=>{H(K=>{const A=new Set(K);return A.delete(Y),A})},[]),children:l})}),ie?t.jsxs(Pg,{"aria-hidden":!0,required:P,tabIndex:-1,name:v,autoComplete:y,value:te,onChange:Y=>ue(Y.target.value),disabled:E,form:C,children:[te===void 0?t.jsx("option",{value:""}):null,Array.from(fe)]},W):null]})})};lg.displayName=qr;var ig="SelectTrigger",og=p.forwardRef((r,a)=>{const{__scopeSelect:l,disabled:o=!1,...c}=r,u=Vi(l),f=kr(ig,l),m=f.disabled||o,x=Ke(a,f.onTriggerChange),g=Bi(l),v=p.useRef("touch"),[y,E,P]=_g(N=>{const b=g().filter(j=>!j.disabled),k=b.find(j=>j.value===f.value),R=Tg(b,N,k);R!==void 0&&f.onValueChange(R.value)}),C=N=>{m||(f.onOpenChange(!0),P()),N&&(f.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return t.jsx(TS,{asChild:!0,...u,children:t.jsx(Oe.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:m,"data-disabled":m?"":void 0,"data-placeholder":Rg(f.value)?"":void 0,...c,ref:x,onClick:Ae(c.onClick,N=>{N.currentTarget.focus(),v.current!=="mouse"&&C(N)}),onPointerDown:Ae(c.onPointerDown,N=>{v.current=N.pointerType;const b=N.target;b.hasPointerCapture(N.pointerId)&&b.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(C(N),N.preventDefault())}),onKeyDown:Ae(c.onKeyDown,N=>{const b=y.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&E(N.key),!(b&&N.key===" ")&&DS.includes(N.key)&&(C(),N.preventDefault())})})})});og.displayName=ig;var cg="SelectValue",dg=p.forwardRef((r,a)=>{const{__scopeSelect:l,className:o,style:c,children:u,placeholder:f="",...m}=r,x=kr(cg,l),{onValueNodeHasChildrenChange:g}=x,v=u!==void 0,y=Ke(a,x.onValueNodeChange);return Pt(()=>{g(v)},[g,v]),t.jsx(Oe.span,{...m,ref:y,style:{pointerEvents:"none"},children:Rg(x.value)?t.jsx(t.Fragment,{children:f}):u})});dg.displayName=cg;var VS="SelectIcon",ug=p.forwardRef((r,a)=>{const{__scopeSelect:l,children:o,...c}=r;return t.jsx(Oe.span,{"aria-hidden":!0,...c,ref:a,children:o||"▼"})});ug.displayName=VS;var US="SelectPortal",fg=r=>t.jsx(Dd,{asChild:!0,...r});fg.displayName=US;var Xr="SelectContent",hg=p.forwardRef((r,a)=>{const l=kr(Xr,r.__scopeSelect),[o,c]=p.useState();if(Pt(()=>{c(new DocumentFragment)},[]),!l.open){const u=o;return u?Da.createPortal(t.jsx(mg,{scope:r.__scopeSelect,children:t.jsx($i.Slot,{scope:r.__scopeSelect,children:t.jsx("div",{children:r.children})})}),u):null}return t.jsx(pg,{...r,ref:a})});hg.displayName=Xr;var pn=10,[mg,Er]=$s(Xr),WS="SelectContentImpl",HS=Ma("SelectContent.RemoveScroll"),pg=p.forwardRef((r,a)=>{const{__scopeSelect:l,position:o="item-aligned",onCloseAutoFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,side:m,sideOffset:x,align:g,alignOffset:v,arrowPadding:y,collisionBoundary:E,collisionPadding:P,sticky:C,hideWhenDetached:N,avoidCollisions:b,...k}=r,R=kr(Xr,l),[j,_]=p.useState(null),[F,G]=p.useState(null),M=Ke(a,Q=>_(Q)),[V,te]=p.useState(null),[ue,ce]=p.useState(null),ie=Bi(l),[fe,H]=p.useState(!1),W=p.useRef(!1);p.useEffect(()=>{if(j)return Kp(j)},[j]),Op();const Y=p.useCallback(Q=>{const[xe,...I]=ie().map(Pe=>Pe.ref.current),[se]=I.slice(-1),he=document.activeElement;for(const Pe of Q)if(Pe===he||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===xe&&F&&(F.scrollTop=0),Pe===se&&F&&(F.scrollTop=F.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==he))return},[ie,F]),K=p.useCallback(()=>Y([V,j]),[Y,V,j]);p.useEffect(()=>{fe&&K()},[fe,K]);const{onOpenChange:A,triggerPointerDownPosRef:J}=R;p.useEffect(()=>{if(j){let Q={x:0,y:0};const xe=se=>{var he,Pe;Q={x:Math.abs(Math.round(se.pageX)-(((he=J.current)==null?void 0:he.x)??0)),y:Math.abs(Math.round(se.pageY)-(((Pe=J.current)==null?void 0:Pe.y)??0))}},I=se=>{Q.x<=10&&Q.y<=10?se.preventDefault():j.contains(se.target)||A(!1),document.removeEventListener("pointermove",xe),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",xe),document.addEventListener("pointerup",I,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",I,{capture:!0})}}},[j,A,J]),p.useEffect(()=>{const Q=()=>A(!1);return window.addEventListener("blur",Q),window.addEventListener("resize",Q),()=>{window.removeEventListener("blur",Q),window.removeEventListener("resize",Q)}},[A]);const[B,S]=_g(Q=>{const xe=ie().filter(he=>!he.disabled),I=xe.find(he=>he.ref.current===document.activeElement),se=Tg(xe,Q,I);se&&setTimeout(()=>se.ref.current.focus())}),D=p.useCallback((Q,xe,I)=>{const se=!W.current&&!I;(R.value!==void 0&&R.value===xe||se)&&(te(Q),se&&(W.current=!0))},[R.value]),ae=p.useCallback(()=>j==null?void 0:j.focus(),[j]),oe=p.useCallback((Q,xe,I)=>{const se=!W.current&&!I;(R.value!==void 0&&R.value===xe||se)&&ce(Q)},[R.value]),Ne=o==="popper"?xd:xg,me=Ne===xd?{side:m,sideOffset:x,align:g,alignOffset:v,arrowPadding:y,collisionBoundary:E,collisionPadding:P,sticky:C,hideWhenDetached:N,avoidCollisions:b}:{};return t.jsx(mg,{scope:l,content:j,viewport:F,onViewportChange:G,itemRefCallback:D,selectedItem:V,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:K,selectedItemText:ue,position:o,isPositioned:fe,searchRef:B,children:t.jsx(Od,{as:HS,allowPinchZoom:!0,children:t.jsx(Ld,{asChild:!0,trapped:R.open,onMountAutoFocus:Q=>{Q.preventDefault()},onUnmountAutoFocus:Ae(c,Q=>{var xe;(xe=R.trigger)==null||xe.focus({preventScroll:!0}),Q.preventDefault()}),children:t.jsx(Md,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:Q=>Q.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:t.jsx(Ne,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:Q=>Q.preventDefault(),...k,...me,onPlaced:()=>H(!0),ref:M,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Ae(k.onKeyDown,Q=>{const xe=Q.ctrlKey||Q.altKey||Q.metaKey;if(Q.key==="Tab"&&Q.preventDefault(),!xe&&Q.key.length===1&&S(Q.key),["ArrowUp","ArrowDown","Home","End"].includes(Q.key)){let se=ie().filter(he=>!he.disabled).map(he=>he.ref.current);if(["ArrowUp","End"].includes(Q.key)&&(se=se.slice().reverse()),["ArrowUp","ArrowDown"].includes(Q.key)){const he=Q.target,Pe=se.indexOf(he);se=se.slice(Pe+1)}setTimeout(()=>Y(se)),Q.preventDefault()}})})})})})})});pg.displayName=WS;var KS="SelectItemAlignedPosition",xg=p.forwardRef((r,a)=>{const{__scopeSelect:l,onPlaced:o,...c}=r,u=kr(Xr,l),f=Er(Xr,l),[m,x]=p.useState(null),[g,v]=p.useState(null),y=Ke(a,M=>v(M)),E=Bi(l),P=p.useRef(!1),C=p.useRef(!0),{viewport:N,selectedItem:b,selectedItemText:k,focusSelectedItem:R}=f,j=p.useCallback(()=>{if(u.trigger&&u.valueNode&&m&&g&&N&&b&&k){const M=u.trigger.getBoundingClientRect(),V=g.getBoundingClientRect(),te=u.valueNode.getBoundingClientRect(),ue=k.getBoundingClientRect();if(u.dir!=="rtl"){const he=ue.left-V.left,Pe=te.left-he,Me=M.left-Pe,Fe=M.width+Me,Qe=Math.max(Fe,V.width),nt=window.innerWidth-pn,Ze=vi(Pe,[pn,Math.max(pn,nt-Qe)]);m.style.minWidth=Fe+"px",m.style.left=Ze+"px"}else{const he=V.right-ue.right,Pe=window.innerWidth-te.right-he,Me=window.innerWidth-M.right-Pe,Fe=M.width+Me,Qe=Math.max(Fe,V.width),nt=window.innerWidth-pn,Ze=vi(Pe,[pn,Math.max(pn,nt-Qe)]);m.style.minWidth=Fe+"px",m.style.right=Ze+"px"}const ce=E(),ie=window.innerHeight-pn*2,fe=N.scrollHeight,H=window.getComputedStyle(g),W=parseInt(H.borderTopWidth,10),Y=parseInt(H.paddingTop,10),K=parseInt(H.borderBottomWidth,10),A=parseInt(H.paddingBottom,10),J=W+Y+fe+A+K,B=Math.min(b.offsetHeight*5,J),S=window.getComputedStyle(N),D=parseInt(S.paddingTop,10),ae=parseInt(S.paddingBottom,10),oe=M.top+M.height/2-pn,Ne=ie-oe,me=b.offsetHeight/2,Q=b.offsetTop+me,xe=W+Y+Q,I=J-xe;if(xe<=oe){const he=ce.length>0&&b===ce[ce.length-1].ref.current;m.style.bottom="0px";const Pe=g.clientHeight-N.offsetTop-N.offsetHeight,Me=Math.max(Ne,me+(he?ae:0)+Pe+K),Fe=xe+Me;m.style.height=Fe+"px"}else{const he=ce.length>0&&b===ce[0].ref.current;m.style.top="0px";const Me=Math.max(oe,W+N.offsetTop+(he?D:0)+me)+I;m.style.height=Me+"px",N.scrollTop=xe-oe+N.offsetTop}m.style.margin=`${pn}px 0`,m.style.minHeight=B+"px",m.style.maxHeight=ie+"px",o==null||o(),requestAnimationFrame(()=>P.current=!0)}},[E,u.trigger,u.valueNode,m,g,N,b,k,u.dir,o]);Pt(()=>j(),[j]);const[_,F]=p.useState();Pt(()=>{g&&F(window.getComputedStyle(g).zIndex)},[g]);const G=p.useCallback(M=>{M&&C.current===!0&&(j(),R==null||R(),C.current=!1)},[j,R]);return t.jsx(YS,{scope:l,contentWrapper:m,shouldExpandOnScrollRef:P,onScrollButtonChange:G,children:t.jsx("div",{ref:x,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:t.jsx(Oe.div,{...c,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...c.style}})})})});xg.displayName=KS;var GS="SelectPopperPosition",xd=p.forwardRef((r,a)=>{const{__scopeSelect:l,align:o="start",collisionPadding:c=pn,...u}=r,f=Vi(l);return t.jsx(IS,{...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)"}})});xd.displayName=GS;var[YS,eu]=$s(Xr,{}),gd="SelectViewport",gg=p.forwardRef((r,a)=>{const{__scopeSelect:l,nonce:o,...c}=r,u=Er(gd,l),f=eu(gd,l),m=Ke(a,u.onViewportChange),x=p.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($i.Slot,{scope:l,children:t.jsx(Oe.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:m,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:Ae(c.onScroll,g=>{const v=g.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:E}=f;if(E!=null&&E.current&&y){const P=Math.abs(x.current-v.scrollTop);if(P>0){const C=window.innerHeight-pn*2,N=parseFloat(y.style.minHeight),b=parseFloat(y.style.height),k=Math.max(N,b);if(k0?_:0,y.style.justifyContent="flex-end")}}}x.current=v.scrollTop})})})]})});gg.displayName=gd;var vg="SelectGroup",[QS,qS]=$s(vg),XS=p.forwardRef((r,a)=>{const{__scopeSelect:l,...o}=r,c=xr();return t.jsx(QS,{scope:l,id:c,children:t.jsx(Oe.div,{role:"group","aria-labelledby":c,...o,ref:a})})});XS.displayName=vg;var yg="SelectLabel",JS=p.forwardRef((r,a)=>{const{__scopeSelect:l,...o}=r,c=qS(yg,l);return t.jsx(Oe.div,{id:c.id,...o,ref:a})});JS.displayName=yg;var bi="SelectItem",[ZS,jg]=$s(bi),wg=p.forwardRef((r,a)=>{const{__scopeSelect:l,value:o,disabled:c=!1,textValue:u,...f}=r,m=kr(bi,l),x=Er(bi,l),g=m.value===o,[v,y]=p.useState(u??""),[E,P]=p.useState(!1),C=Ke(a,R=>{var j;return(j=x.itemRefCallback)==null?void 0:j.call(x,R,o,c)}),N=xr(),b=p.useRef("touch"),k=()=>{c||(m.onValueChange(o),m.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(ZS,{scope:l,value:o,disabled:c,textId:N,isSelected:g,onItemTextChange:p.useCallback(R=>{y(j=>j||((R==null?void 0:R.textContent)??"").trim())},[]),children:t.jsx($i.ItemSlot,{scope:l,value:o,disabled:c,textValue:v,children:t.jsx(Oe.div,{role:"option","aria-labelledby":N,"data-highlighted":E?"":void 0,"aria-selected":g&&E,"data-state":g?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...f,ref:C,onFocus:Ae(f.onFocus,()=>P(!0)),onBlur:Ae(f.onBlur,()=>P(!1)),onClick:Ae(f.onClick,()=>{b.current!=="mouse"&&k()}),onPointerUp:Ae(f.onPointerUp,()=>{b.current==="mouse"&&k()}),onPointerDown:Ae(f.onPointerDown,R=>{b.current=R.pointerType}),onPointerMove:Ae(f.onPointerMove,R=>{var j;b.current=R.pointerType,c?(j=x.onItemLeave)==null||j.call(x):b.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ae(f.onPointerLeave,R=>{var j;R.currentTarget===document.activeElement&&((j=x.onItemLeave)==null||j.call(x))}),onKeyDown:Ae(f.onKeyDown,R=>{var _;((_=x.searchRef)==null?void 0:_.current)!==""&&R.key===" "||(OS.includes(R.key)&&k(),R.key===" "&&R.preventDefault())})})})})});wg.displayName=bi;var _a="SelectItemText",Ng=p.forwardRef((r,a)=>{const{__scopeSelect:l,className:o,style:c,...u}=r,f=kr(_a,l),m=Er(_a,l),x=jg(_a,l),g=BS(_a,l),[v,y]=p.useState(null),E=Ke(a,k=>y(k),x.onItemTextChange,k=>{var R;return(R=m.itemTextRefCallback)==null?void 0:R.call(m,k,x.value,x.disabled)}),P=v==null?void 0:v.textContent,C=p.useMemo(()=>t.jsx("option",{value:x.value,disabled:x.disabled,children:P},x.value),[x.disabled,x.value,P]),{onNativeOptionAdd:N,onNativeOptionRemove:b}=g;return Pt(()=>(N(C),()=>b(C)),[N,b,C]),t.jsxs(t.Fragment,{children:[t.jsx(Oe.span,{id:x.textId,...u,ref:E}),x.isSelected&&f.valueNode&&!f.valueNodeHasChildren?Da.createPortal(u.children,f.valueNode):null]})});Ng.displayName=_a;var bg="SelectItemIndicator",Sg=p.forwardRef((r,a)=>{const{__scopeSelect:l,...o}=r;return jg(bg,l).isSelected?t.jsx(Oe.span,{"aria-hidden":!0,...o,ref:a}):null});Sg.displayName=bg;var vd="SelectScrollUpButton",Cg=p.forwardRef((r,a)=>{const l=Er(vd,r.__scopeSelect),o=eu(vd,r.__scopeSelect),[c,u]=p.useState(!1),f=Ke(a,o.onScrollButtonChange);return Pt(()=>{if(l.viewport&&l.isPositioned){let m=function(){const g=x.scrollTop>0;u(g)};const x=l.viewport;return m(),x.addEventListener("scroll",m),()=>x.removeEventListener("scroll",m)}},[l.viewport,l.isPositioned]),c?t.jsx(Eg,{...r,ref:f,onAutoScroll:()=>{const{viewport:m,selectedItem:x}=l;m&&x&&(m.scrollTop=m.scrollTop-x.offsetHeight)}}):null});Cg.displayName=vd;var yd="SelectScrollDownButton",kg=p.forwardRef((r,a)=>{const l=Er(yd,r.__scopeSelect),o=eu(yd,r.__scopeSelect),[c,u]=p.useState(!1),f=Ke(a,o.onScrollButtonChange);return Pt(()=>{if(l.viewport&&l.isPositioned){let m=function(){const g=x.scrollHeight-x.clientHeight,v=Math.ceil(x.scrollTop)x.removeEventListener("scroll",m)}},[l.viewport,l.isPositioned]),c?t.jsx(Eg,{...r,ref:f,onAutoScroll:()=>{const{viewport:m,selectedItem:x}=l;m&&x&&(m.scrollTop=m.scrollTop+x.offsetHeight)}}):null});kg.displayName=yd;var Eg=p.forwardRef((r,a)=>{const{__scopeSelect:l,onAutoScroll:o,...c}=r,u=Er("SelectScrollButton",l),f=p.useRef(null),m=Bi(l),x=p.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return p.useEffect(()=>()=>x(),[x]),Pt(()=>{var v;const g=m().find(y=>y.ref.current===document.activeElement);(v=g==null?void 0:g.ref.current)==null||v.scrollIntoView({block:"nearest"})},[m]),t.jsx(Oe.div,{"aria-hidden":!0,...c,ref:a,style:{flexShrink:0,...c.style},onPointerDown:Ae(c.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(o,50))}),onPointerMove:Ae(c.onPointerMove,()=>{var g;(g=u.onItemLeave)==null||g.call(u),f.current===null&&(f.current=window.setInterval(o,50))}),onPointerLeave:Ae(c.onPointerLeave,()=>{x()})})}),eC="SelectSeparator",tC=p.forwardRef((r,a)=>{const{__scopeSelect:l,...o}=r;return t.jsx(Oe.div,{"aria-hidden":!0,...o,ref:a})});tC.displayName=eC;var jd="SelectArrow",nC=p.forwardRef((r,a)=>{const{__scopeSelect:l,...o}=r,c=Vi(l),u=kr(jd,l),f=Er(jd,l);return u.open&&f.position==="popper"?t.jsx(AS,{...c,...o,ref:a}):null});nC.displayName=jd;var rC="SelectBubbleInput",Pg=p.forwardRef(({__scopeSelect:r,value:a,...l},o)=>{const c=p.useRef(null),u=Ke(o,c),f=Bd(a);return p.useEffect(()=>{const m=c.current;if(!m)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(m,a),m.dispatchEvent(y)}},[f,a]),t.jsx(Oe.select,{...l,style:{...ag,...l.style},ref:u,defaultValue:a})});Pg.displayName=rC;function Rg(r){return r===""||r===void 0}function _g(r){const a=vr(r),l=p.useRef(""),o=p.useRef(0),c=p.useCallback(f=>{const m=l.current+f;a(m),(function x(g){l.current=g,window.clearTimeout(o.current),g!==""&&(o.current=window.setTimeout(()=>x(""),1e3))})(m)},[a]),u=p.useCallback(()=>{l.current="",window.clearTimeout(o.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(o.current),[]),[l,c,u]}function Tg(r,a,l){const c=a.length>1&&Array.from(a).every(g=>g===a[0])?a[0]:a,u=l?r.indexOf(l):-1;let f=sC(r,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 sC(r,a){return r.map((l,o)=>r[(a+o)%r.length])}var aC=lg,Ig=og,lC=dg,iC=ug,oC=fg,Ag=hg,cC=gg,Mg=wg,dC=Ng,uC=Sg,fC=Cg,hC=kg;const Jc=aC,Zc=lC,ci=p.forwardRef(({className:r,children:a,...l},o)=>t.jsxs(Ig,{ref:o,className:Ge("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",r),...l,children:[a,t.jsx(iC,{asChild:!0,children:t.jsx(cp,{className:"h-4 w-4 opacity-50"})})]}));ci.displayName=Ig.displayName;const di=p.forwardRef(({className:r,children:a,position:l="popper",...o},c)=>t.jsx(oC,{children:t.jsxs(Ag,{ref:c,className:Ge("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",r),position:l,...o,children:[t.jsx(fC,{className:"flex cursor-default items-center justify-center py-1",children:t.jsx(yj,{className:"h-4 w-4"})}),t.jsx(cC,{className:"p-1",children:a}),t.jsx(hC,{className:"flex cursor-default items-center justify-center py-1",children:t.jsx(cp,{className:"h-4 w-4"})})]})}));di.displayName=Ag.displayName;const fr=p.forwardRef(({className:r,children:a,...l},o)=>t.jsxs(Mg,{ref:o,className:Ge("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",r),...l,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(uC,{children:t.jsx(ki,{className:"h-4 w-4"})})}),t.jsx(dC,{children:a})]}));fr.displayName=Mg.displayName;function mC(r){const a=new Map;for(const l of r){const o=l.partId||"part-1",c=l.partTitle||"未分类",u=l.chapterId||"chapter-1",f=l.chapterTitle||"未分类";a.has(o)||a.set(o,{id:o,title:c,chapters:new Map});const m=a.get(o);m.chapters.has(u)||m.chapters.set(u,{id:u,title:f,sections:[]}),m.chapters.get(u).sections.push({id:l.id,title:l.title,price:l.price??1,filePath:l.filePath,isFree:l.isFree,isNew:l.isNew})}return Array.from(a.values()).map(l=>({...l,chapters:Array.from(l.chapters.values())}))}function pC(){const[r,a]=p.useState([]),[l,o]=p.useState(!0),[c,u]=p.useState([]),[f,m]=p.useState(null),[x,g]=p.useState(!1),[v,y]=p.useState(!1),[E,P]=p.useState(!1),[C,N]=p.useState(""),[b,k]=p.useState([]),[R,j]=p.useState(!1),[_,F]=p.useState(!1),G=p.useRef(null),[M,V]=p.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),te=mC(r),ue=r.length,ce=async()=>{o(!0);try{const S=await He("/api/db/book?action=list");a(Array.isArray(S==null?void 0:S.sections)?S.sections:[]),c.length===0&&te.length>0&&u([te[0].id])}catch(S){console.error(S),a([])}finally{o(!1)}};p.useEffect(()=>{ce()},[]),p.useEffect(()=>{!l&&te.length>0&&c.length===0&&u([te[0].id])},[l,te.length,c.length]);const ie=S=>{u(D=>D.includes(S)?D.filter(ae=>ae!==S):[...D,S])},fe=async S=>{if(confirm(`确定要删除章节「${S.title}」吗?此操作不可恢复。`))try{const D=await Ri(`/api/db/book?id=${encodeURIComponent(S.id)}`);D&&D.success!==!1?(alert("已删除"),ce()):alert("删除失败: "+(D&&typeof D=="object"&&"error"in D?D.error:"未知错误"))}catch(D){console.error(D),alert("删除失败")}},H=async S=>{y(!0);try{const D=await He(`/api/db/book?action=read&id=${encodeURIComponent(S.id)}`);if(D!=null&&D.success&&D.section){const ae=D.section;m({id:S.id,title:D.section.title??S.title,price:D.section.price??S.price,content:D.section.content??"",filePath:S.filePath,isFree:S.isFree||S.price===0,isNew:ae.isNew??S.isNew})}else m({id:S.id,title:S.title,price:S.price,content:"",filePath:S.filePath,isFree:S.isFree,isNew:S.isNew}),D&&!D.success&&alert("无法读取文件内容: "+(D.error||"未知错误"))}catch(D){console.error(D),m({id:S.id,title:S.title,price:S.price,content:"",filePath:S.filePath,isFree:S.isFree})}finally{y(!1)}},W=async()=>{var S;if(f){P(!0);try{let D=f.content||"";const ae=[new RegExp(`^#+\\s*${f.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${f.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(S=f.title)==null?void 0:S.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const Ne of ae)D=D.replace(Ne,"");D=D.replace(/^\s*\n+/,"").trim();const oe=await zt("/api/db/book",{id:f.id,title:f.title,price:f.isFree?0:f.price,content:D,isFree:f.isFree||f.price===0,isNew:f.isNew,saveToFile:!0});oe&&oe.success!==!1?(alert(`已保存章节: ${f.title}`),m(null),ce()):alert("保存失败: "+(oe&&typeof oe=="object"&&"error"in oe?oe.error:"未知错误"))}catch(D){console.error(D),alert("保存失败")}finally{P(!1)}}},Y=async()=>{if(!M.id||!M.title){alert("请填写章节ID和标题");return}P(!0);try{const S=await zt("/api/db/book",{id:M.id,title:M.title,price:M.price,content:M.content,partId:M.partId,chapterId:M.chapterId,saveToFile:!1});S&&S.success!==!1?(alert(`章节创建成功: ${M.title}`),g(!1),V({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:""}),ce()):alert("创建失败: "+(S&&typeof S=="object"&&"error"in S?S.error:"未知错误"))}catch(S){console.error(S),alert("创建失败")}finally{P(!1)}},K=async S=>{var ae,oe;const D=(ae=S.target.files)==null?void 0:ae[0];if(D){F(!0);try{const Ne=new FormData;Ne.append("file",D),Ne.append("folder","book-images");const Q=await(await fetch(pp("/api/upload"),{method:"POST",body:Ne,credentials:"include"})).json();if(Q!=null&&Q.success&&((oe=Q==null?void 0:Q.data)!=null&&oe.url)){const xe=`![${D.name}](${Q.data.url})`;f&&m({...f,content:(f.content||"")+` + +`+xe}),alert(`图片上传成功: ${Q.data.url}`)}else alert("上传失败: "+((Q==null?void 0:Q.error)||"未知错误"))}catch(Ne){console.error(Ne),alert("上传失败")}finally{F(!1),G.current&&(G.current.value="")}}},A=async()=>{var S;if(C.trim()){j(!0);try{const D=await He(`/api/search?q=${encodeURIComponent(C)}`);D!=null&&D.success&&((S=D.data)!=null&&S.results)?k(D.data.results):(k([]),D&&!D.success&&alert("搜索失败: "+D.error))}catch(D){console.error(D),k([]),alert("搜索失败")}finally{j(!1)}}},J=te.find(S=>S.id===M.partId),B=(J==null?void 0:J.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:["共 ",te.length," 篇 · ",ue," 节内容"]})]}),t.jsx("div",{className:"flex gap-2",children:t.jsxs(de,{onClick:()=>{const S=typeof window<"u"?`${window.location.origin}/api-doc`:"";S&&window.open(S,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Wr,{className:"w-4 h-4 mr-2"}),"API 接口"]})})]}),t.jsx(Kt,{open:x,onOpenChange:g,children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[t.jsx(Gt,{children:t.jsxs(Yt,{className:"text-white flex items-center gap-2",children:[t.jsx(pr,{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(q,{className:"text-gray-300",children:"章节ID *"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:M.id,onChange:S=>V({...M,id:S.target.value})})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"价格 (元)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:M.price,onChange:S=>V({...M,price:Number(S.target.value)})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"章节标题 *"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:M.title,onChange:S=>V({...M,title:S.target.value})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"所属篇"}),t.jsxs(Jc,{value:M.partId,onValueChange:S=>V({...M,partId:S,chapterId:"chapter-1"}),children:[t.jsx(ci,{className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(Zc,{})}),t.jsxs(di,{className:"bg-[#0f2137] border-gray-700",children:[te.map(S=>t.jsx(fr,{value:S.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:S.title},S.id)),te.length===0&&t.jsx(fr,{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(q,{className:"text-gray-300",children:"所属章"}),t.jsxs(Jc,{value:M.chapterId,onValueChange:S=>V({...M,chapterId:S}),children:[t.jsx(ci,{className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(Zc,{})}),t.jsxs(di,{className:"bg-[#0f2137] border-gray-700",children:[B.map(S=>t.jsx(fr,{value:S.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:S.title},S.id)),B.length===0&&t.jsx(fr,{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(q,{className:"text-gray-300",children:"内容 (Markdown格式)"}),t.jsx(Rs,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[300px] font-mono text-sm placeholder:text-gray-500",placeholder:"输入章节内容...",value:M.content,onChange:S=>V({...M,content:S.target.value})})]})]}),t.jsxs(sn,{children:[t.jsx(de,{variant:"outline",onClick:()=>g(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsx(de,{onClick:Y,disabled:E||!M.id||!M.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?t.jsxs(t.Fragment,{children:[t.jsx(tt,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(pr,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),t.jsx(Kt,{open:!!f,onOpenChange:()=>m(null),children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",showCloseButton:!0,children:[t.jsx(Gt,{children:t.jsxs(Yt,{className:"text-white flex items-center gap-2",children:[t.jsx(gr,{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(q,{className:"text-gray-300",children:"章节ID"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:f.id,disabled:!0})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"价格 (元)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.isFree?0:f.price,onChange:S=>m({...f,price:Number(S.target.value),isFree:Number(S.target.value)===0}),disabled:f.isFree})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{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.isFree||f.price===0,onChange:S=>m({...f,isFree:S.target.checked,price:S.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(q,{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:S=>m({...f,isNew:S.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(q,{className:"text-gray-300",children:"章节标题"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:f.title,onChange:S=>m({...f,title:S.target.value})})]}),f.filePath&&t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"文件路径"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"内容 (Markdown格式)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:G,type:"file",accept:"image/*",onChange:K,className:"hidden"}),t.jsxs(de,{variant:"outline",size:"sm",onClick:()=>{var S;return(S=G.current)==null?void 0:S.click()},disabled:_,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[_?t.jsx(tt,{className:"w-4 h-4 mr-1 animate-spin"}):t.jsx(qj,{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(tt,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.jsx(Rs,{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:S=>m({...f,content:S.target.value})})]})]}),t.jsxs(sn,{children:[t.jsxs(de,{variant:"outline",onClick:()=>m(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(Pn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsx(de,{onClick:W,disabled:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:E?t.jsxs(t.Fragment,{children:[t.jsx(tt,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):t.jsxs(t.Fragment,{children:[t.jsx(an,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),t.jsxs(Hd,{defaultValue:"chapters",className:"space-y-6",children:[t.jsxs(Li,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[t.jsxs(nn,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Ts,{className:"w-4 h-4 mr-2"}),"章节管理"]}),t.jsxs(nn,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Hr,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),t.jsxs(nn,{value:"hooks",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[t.jsx(Ew,{className:"w-4 h-4 mr-2"}),"钩子配置"]})]}),t.jsxs(rn,{value:"chapters",className:"space-y-4",children:[t.jsxs(de,{onClick:()=>g(!0),className:"w-full bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[t.jsx(pr,{className:"w-4 h-4 mr-2"}),"新建章节"]}),l?t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx(tt,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),t.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):te.map((S,D)=>t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl overflow-hidden",children:[t.jsx(Be,{className:"cursor-pointer hover:bg-[#162840] transition-colors",onClick:()=>ie(S.id),children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("span",{className:"text-[#38bdac] font-mono text-sm",children:["0",D+1]}),t.jsx(Ve,{className:"text-white",children:S.title}),t.jsxs(De,{variant:"outline",className:"text-gray-400 border-gray-600",children:[S.chapters.reduce((ae,oe)=>ae+oe.sections.length,0)," 节"]})]}),t.jsx(dp,{className:`w-5 h-5 text-gray-400 transition-transform ${c.includes(S.id)?"rotate-90":""}`})]})}),c.includes(S.id)&&t.jsx(ke,{className:"pt-0 pb-4",children:t.jsx("div",{className:"space-y-3 pl-8 border-l-2 border-gray-700",children:S.chapters.map(ae=>t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"font-medium text-gray-300",children:ae.title}),t.jsx("div",{className:"space-y-1",children:ae.sections.map(oe=>t.jsxs("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg hover:bg-[#162840] text-sm group transition-colors",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(rd,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx("span",{className:"text-gray-400",children:oe.title})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-[#38bdac] font-medium",children:oe.price===0?"免费":`¥${oe.price}`}),t.jsxs(de,{variant:"ghost",size:"sm",onClick:()=>H(oe),className:"text-gray-500 hover:text-[#38bdac] hover:bg-[#38bdac]/10 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(_d,{className:"w-4 h-4 mr-1"}),"读取"]}),t.jsxs(de,{variant:"ghost",size:"sm",onClick:()=>H(oe),className:"text-gray-500 hover:text-[#38bdac] hover:bg-[#38bdac]/10 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(gr,{className:"w-4 h-4 mr-1"}),"编辑"]}),t.jsxs(de,{variant:"ghost",size:"sm",onClick:()=>fe(oe),className:"text-gray-500 hover:text-red-400 hover:bg-red-500/10 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(Fa,{className:"w-4 h-4 mr-1"}),"删除"]})]})]},oe.id))})]},ae.id))})})]},S.id))]}),t.jsx(rn,{value:"search",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"内容搜索"})}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:C,onChange:S=>N(S.target.value),onKeyDown:S=>S.key==="Enter"&&A()}),t.jsx(de,{onClick:A,disabled:R||!C.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:R?t.jsx(tt,{className:"w-4 h-4 animate-spin"}):t.jsx(Hr,{className:"w-4 h-4"})})]}),b.length>0&&t.jsxs("div",{className:"space-y-2 mt-4",children:[t.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",b.length," 个结果"]}),b.map(S=>t.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>H({id:S.id,title:S.title,price:S.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:S.id}),t.jsx("span",{className:"text-white",children:S.title})]}),t.jsx(De,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:S.matchType==="title"?"标题匹配":"内容匹配"})]}),S.snippet&&t.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:S.snippet}),(S.partTitle||S.chapterTitle)&&t.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[S.partTitle," · ",S.chapterTitle]})]},S.id))]})]})]})}),t.jsx(rn,{value:"hooks",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"引流钩子配置"})}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"grid w-full max-w-sm items-center gap-1.5",children:[t.jsx(q,{htmlFor:"hook-chapter",className:"text-gray-300",children:"触发章节"}),t.jsxs(Jc,{defaultValue:"3",children:[t.jsx(ci,{id:"hook-chapter",className:"bg-[#0a1628] border-gray-700 text-white",children:t.jsx(Zc,{placeholder:"选择章节"})}),t.jsxs(di,{className:"bg-[#0f2137] border-gray-700",children:[t.jsx(fr,{value:"1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第一章"}),t.jsx(fr,{value:"2",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"第二章"}),t.jsx(fr,{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(q,{htmlFor:"message",className:"text-gray-300",children:"引流文案"}),t.jsx(Rs,{placeholder:"输入引导用户加群的文案...",id:"message",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",defaultValue:"阅读更多精彩内容,请加入Soul创业实验派对群..."})]}),t.jsx(de,{className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:"保存配置"})]})]})})]})]})}function xC(){const[r,a]=p.useState([]),[l,o]=p.useState(null),[c,u]=p.useState(!0),[f,m]=p.useState(null),[x,g]=p.useState([]),[v,y]=p.useState(null),[E,P]=p.useState(1);async function C(){u(!0),m(null);try{const R=await He("/api/admin/chapters");R!=null&&R.success&&R.data?(a(R.data.structure??[]),o(R.data.stats??null)):m("加载章节失败")}catch(R){console.error("加载章节失败:",R),m("加载失败,请检查网络后重试")}finally{u(!1)}}p.useEffect(()=>{C()},[]);const N=R=>{g(j=>j.includes(R)?j.filter(_=>_!==R):[...j,R])},b=async R=>{try{const j=await jt("/api/admin/chapters",{action:"updatePrice",chapterId:R,data:{price:E}});j!=null&&j.success&&(alert("价格更新成功"),y(null),C())}catch(j){console.error("更新价格失败:",j)}},k=async(R,j)=>{try{const _=await jt("/api/admin/chapters",{action:"toggleFree",chapterId:R,data:{isFree:!j}});_!=null&&_.success&&(alert("状态更新成功"),C())}catch(_){console.error("更新状态失败:",_)}};return c?t.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:t.jsx("div",{className:"text-xl text-gray-400",children:"加载中..."})}):t.jsxs("div",{className:"min-h-screen bg-black text-white",children:[t.jsx("div",{className:"sticky top-0 bg-black/90 backdrop-blur border-b border-white/10 z-50",children:t.jsxs("div",{className:"w-full min-w-[1024px] px-4 py-4 flex items-center justify-between",children:[t.jsx("h1",{className:"text-xl font-bold",children:"章节管理"}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("button",{type:"button",onClick:C,disabled:c,className:"px-4 py-2 bg-white/10 rounded-lg hover:bg-white/20 text-white disabled:opacity-50",children:"刷新"}),t.jsx("button",{type:"button",onClick:()=>g(r.map(R=>R.id)),className:"px-4 py-2 bg-white/10 rounded-lg hover:bg-white/20 text-white",children:"展开全部"}),t.jsx("button",{type:"button",onClick:()=>g([]),className:"px-4 py-2 bg-white/10 rounded-lg hover:bg-white/20 text-white",children:"收起全部"})]})]})}),t.jsxs("div",{className:"w-full min-w-[1024px] px-4 py-8",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:()=>m(null),className:"hover:text-red-300",children:"×"})]}),l&&t.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-8",children:[t.jsxs("div",{className:"bg-gradient-to-br from-cyan-500/20 to-cyan-500/5 border border-cyan-500/30 rounded-xl p-4",children:[t.jsx("div",{className:"text-3xl font-bold text-cyan-400",children:l.totalSections}),t.jsx("div",{className:"text-white/60 text-sm mt-1",children:"总章节数"})]}),t.jsxs("div",{className:"bg-gradient-to-br from-green-500/20 to-green-500/5 border border-green-500/30 rounded-xl p-4",children:[t.jsx("div",{className:"text-3xl font-bold text-green-400",children:l.freeSections}),t.jsx("div",{className:"text-white/60 text-sm mt-1",children:"免费章节"})]}),t.jsxs("div",{className:"bg-gradient-to-br from-yellow-500/20 to-yellow-500/5 border border-yellow-500/30 rounded-xl p-4",children:[t.jsx("div",{className:"text-3xl font-bold text-yellow-400",children:l.paidSections}),t.jsx("div",{className:"text-white/60 text-sm mt-1",children:"付费章节"})]}),t.jsxs("div",{className:"bg-gradient-to-br from-purple-500/20 to-purple-500/5 border border-purple-500/30 rounded-xl p-4",children:[t.jsx("div",{className:"text-3xl font-bold text-purple-400",children:l.totalParts}),t.jsx("div",{className:"text-white/60 text-sm mt-1",children:"篇章数"})]})]}),t.jsx("div",{className:"space-y-4",children:r.map(R=>t.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer hover:bg-white/5",onClick:()=>N(R.id),onKeyDown:j=>j.key==="Enter"&&N(R.id),role:"button",tabIndex:0,children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-2xl",children:R.type==="preface"?"📖":R.type==="epilogue"?"🎬":R.type==="appendix"?"📎":"📚"}),t.jsx("span",{className:"font-semibold text-white",children:R.title}),t.jsxs("span",{className:"text-white/40 text-sm",children:["(",R.chapters.reduce((j,_)=>{var F;return j+(((F=_.sections)==null?void 0:F.length)||1)},0)," 节)"]})]}),t.jsx("span",{className:"text-white/40",children:x.includes(R.id)?"▲":"▼"})]}),x.includes(R.id)&&t.jsx("div",{className:"border-t border-white/10",children:R.chapters.map(j=>t.jsx("div",{className:"border-b border-white/5 last:border-b-0",children:j.sections?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-6 py-3 bg-white/5 text-white/70 font-medium",children:j.title}),t.jsx("div",{className:"divide-y divide-white/5",children:j.sections.map(_=>t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 hover:bg-white/5",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:_.isFree?"text-green-400":"text-yellow-400",children:_.isFree?"🔓":"🔒"}),t.jsx("span",{className:"text-white/80",children:_.id}),t.jsx("span",{className:"text-white/60",children:_.title})]}),t.jsx("div",{className:"flex items-center gap-3",children:v===_.id?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"number",value:E,onChange:F=>P(Number(F.target.value)),className:"w-20 px-2 py-1 bg-white/10 border border-white/20 rounded text-white",min:0,step:.1}),t.jsx("button",{type:"button",onClick:()=>b(_.id),className:"px-3 py-1 bg-cyan-500 text-black rounded text-sm",children:"保存"}),t.jsx("button",{type:"button",onClick:()=>y(null),className:"px-3 py-1 bg-white/20 rounded text-sm text-white",children:"取消"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:`px-2 py-1 rounded text-xs ${_.isFree?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:_.isFree?"免费":`¥${_.price}`}),t.jsx("button",{type:"button",onClick:()=>{y(_.id),P(_.price)},className:"px-2 py-1 text-xs bg-white/10 rounded hover:bg-white/20 text-white",children:"编辑价格"}),t.jsx("button",{type:"button",onClick:()=>k(_.id,_.isFree),className:"px-2 py-1 text-xs bg-white/10 rounded hover:bg-white/20 text-white",children:_.isFree?"设为付费":"设为免费"})]})})]},_.id))})]}):t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 hover:bg-white/5",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:j.isFree?"text-green-400":"text-yellow-400",children:j.isFree?"🔓":"🔒"}),t.jsx("span",{className:"text-white/80",children:j.title})]}),t.jsx("span",{className:`px-2 py-1 rounded text-xs ${j.isFree?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:j.isFree?"免费":`¥${j.price??1}`})]})},j.id))})]},R.id))})]})]})}var Lg=["PageUp","PageDown"],Dg=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Og={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Bs="Slider",[wd,gC,vC]=Ud(Bs),[Fg]=Cr(Bs,[vC]),[yC,Ui]=Fg(Bs),zg=p.forwardRef((r,a)=>{const{name:l,min:o=0,max:c=100,step:u=1,orientation:f="horizontal",disabled:m=!1,minStepsBetweenThumbs:x=0,defaultValue:g=[o],value:v,onValueChange:y=()=>{},onValueCommit:E=()=>{},inverted:P=!1,form:C,...N}=r,b=p.useRef(new Set),k=p.useRef(0),j=f==="horizontal"?jC:wC,[_=[],F]=Gr({prop:v,defaultProp:g,onChange:ce=>{var fe;(fe=[...b.current][k.current])==null||fe.focus(),y(ce)}}),G=p.useRef(_);function M(ce){const ie=kC(_,ce);ue(ce,ie)}function V(ce){ue(ce,k.current)}function te(){const ce=G.current[k.current];_[k.current]!==ce&&E(_)}function ue(ce,ie,{commit:fe}={commit:!1}){const H=_C(u),W=TC(Math.round((ce-o)/u)*u+o,H),Y=vi(W,[o,c]);F((K=[])=>{const A=SC(K,Y,ie);if(RC(A,x*u)){k.current=A.indexOf(Y);const J=String(A)!==String(K);return J&&fe&&E(A),J?A:K}else return K})}return t.jsx(yC,{scope:r.__scopeSlider,name:l,disabled:m,min:o,max:c,valueIndexToChangeRef:k,thumbs:b.current,values:_,orientation:f,form:C,children:t.jsx(wd.Provider,{scope:r.__scopeSlider,children:t.jsx(wd.Slot,{scope:r.__scopeSlider,children:t.jsx(j,{"aria-disabled":m,"data-disabled":m?"":void 0,...N,ref:a,onPointerDown:Ae(N.onPointerDown,()=>{m||(G.current=_)}),min:o,max:c,inverted:P,onSlideStart:m?void 0:M,onSlideMove:m?void 0:V,onSlideEnd:m?void 0:te,onHomeKeyDown:()=>!m&&ue(o,0,{commit:!0}),onEndKeyDown:()=>!m&&ue(c,_.length-1,{commit:!0}),onStepKeyDown:({event:ce,direction:ie})=>{if(!m){const W=Lg.includes(ce.key)||ce.shiftKey&&Dg.includes(ce.key)?10:1,Y=k.current,K=_[Y],A=u*W*ie;ue(K+A,Y,{commit:!0})}}})})})})});zg.displayName=Bs;var[$g,Bg]=Fg(Bs,{startEdge:"left",endEdge:"right",size:"width",direction:1}),jC=p.forwardRef((r,a)=>{const{min:l,max:o,dir:c,inverted:u,onSlideStart:f,onSlideMove:m,onSlideEnd:x,onStepKeyDown:g,...v}=r,[y,E]=p.useState(null),P=Ke(a,j=>E(j)),C=p.useRef(void 0),N=Ai(c),b=N==="ltr",k=b&&!u||!b&&u;function R(j){const _=C.current||y.getBoundingClientRect(),F=[0,_.width],M=tu(F,k?[l,o]:[o,l]);return C.current=_,M(j-_.left)}return t.jsx($g,{scope:r.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:t.jsx(Vg,{dir:N,"data-orientation":"horizontal",...v,ref:P,style:{...v.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:j=>{const _=R(j.clientX);f==null||f(_)},onSlideMove:j=>{const _=R(j.clientX);m==null||m(_)},onSlideEnd:()=>{C.current=void 0,x==null||x()},onStepKeyDown:j=>{const F=Og[k?"from-left":"from-right"].includes(j.key);g==null||g({event:j,direction:F?-1:1})}})})}),wC=p.forwardRef((r,a)=>{const{min:l,max:o,inverted:c,onSlideStart:u,onSlideMove:f,onSlideEnd:m,onStepKeyDown:x,...g}=r,v=p.useRef(null),y=Ke(a,v),E=p.useRef(void 0),P=!c;function C(N){const b=E.current||v.current.getBoundingClientRect(),k=[0,b.height],j=tu(k,P?[o,l]:[l,o]);return E.current=b,j(N-b.top)}return t.jsx($g,{scope:r.__scopeSlider,startEdge:P?"bottom":"top",endEdge:P?"top":"bottom",size:"height",direction:P?1:-1,children:t.jsx(Vg,{"data-orientation":"vertical",...g,ref:y,style:{...g.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const b=C(N.clientY);u==null||u(b)},onSlideMove:N=>{const b=C(N.clientY);f==null||f(b)},onSlideEnd:()=>{E.current=void 0,m==null||m()},onStepKeyDown:N=>{const k=Og[P?"from-bottom":"from-top"].includes(N.key);x==null||x({event:N,direction:k?-1:1})}})})}),Vg=p.forwardRef((r,a)=>{const{__scopeSlider:l,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onHomeKeyDown:f,onEndKeyDown:m,onStepKeyDown:x,...g}=r,v=Ui(Bs,l);return t.jsx(Oe.span,{...g,ref:a,onKeyDown:Ae(r.onKeyDown,y=>{y.key==="Home"?(f(y),y.preventDefault()):y.key==="End"?(m(y),y.preventDefault()):Lg.concat(Dg).includes(y.key)&&(x(y),y.preventDefault())}),onPointerDown:Ae(r.onPointerDown,y=>{const E=y.target;E.setPointerCapture(y.pointerId),y.preventDefault(),v.thumbs.has(E)?E.focus():o(y)}),onPointerMove:Ae(r.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&c(y)}),onPointerUp:Ae(r.onPointerUp,y=>{const E=y.target;E.hasPointerCapture(y.pointerId)&&(E.releasePointerCapture(y.pointerId),u(y))})})}),Ug="SliderTrack",Wg=p.forwardRef((r,a)=>{const{__scopeSlider:l,...o}=r,c=Ui(Ug,l);return t.jsx(Oe.span,{"data-disabled":c.disabled?"":void 0,"data-orientation":c.orientation,...o,ref:a})});Wg.displayName=Ug;var Nd="SliderRange",Hg=p.forwardRef((r,a)=>{const{__scopeSlider:l,...o}=r,c=Ui(Nd,l),u=Bg(Nd,l),f=p.useRef(null),m=Ke(a,f),x=c.values.length,g=c.values.map(E=>Yg(E,c.min,c.max)),v=x>1?Math.min(...g):0,y=100-Math.max(...g);return t.jsx(Oe.span,{"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,...o,ref:m,style:{...r.style,[u.startEdge]:v+"%",[u.endEdge]:y+"%"}})});Hg.displayName=Nd;var bd="SliderThumb",Kg=p.forwardRef((r,a)=>{const l=gC(r.__scopeSlider),[o,c]=p.useState(null),u=Ke(a,m=>c(m)),f=p.useMemo(()=>o?l().findIndex(m=>m.ref.current===o):-1,[l,o]);return t.jsx(NC,{...r,ref:u,index:f})}),NC=p.forwardRef((r,a)=>{const{__scopeSlider:l,index:o,name:c,...u}=r,f=Ui(bd,l),m=Bg(bd,l),[x,g]=p.useState(null),v=Ke(a,R=>g(R)),y=x?f.form||!!x.closest("form"):!0,E=Vd(x),P=f.values[o],C=P===void 0?0:Yg(P,f.min,f.max),N=CC(o,f.values.length),b=E==null?void 0:E[m.size],k=b?EC(b,C,m.direction):0;return p.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",[m.startEdge]:`calc(${C}% + ${k}px)`},children:[t.jsx(wd.ItemSlot,{scope:r.__scopeSlider,children:t.jsx(Oe.span,{role:"slider","aria-label":r["aria-label"]||N,"aria-valuemin":f.min,"aria-valuenow":P,"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:P===void 0?{display:"none"}:r.style,onFocus:Ae(r.onFocus,()=>{f.valueIndexToChangeRef.current=o})})}),y&&t.jsx(Gg,{name:c??(f.name?f.name+(f.values.length>1?"[]":""):void 0),form:f.form,value:P},o)]})});Kg.displayName=bd;var bC="RadioBubbleInput",Gg=p.forwardRef(({__scopeSlider:r,value:a,...l},o)=>{const c=p.useRef(null),u=Ke(c,o),f=Bd(a);return p.useEffect(()=>{const m=c.current;if(!m)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(m,a),m.dispatchEvent(y)}},[f,a]),t.jsx(Oe.input,{style:{display:"none"},...l,ref:u,defaultValue:a})});Gg.displayName=bC;function SC(r=[],a,l){const o=[...r];return o[l]=a,o.sort((c,u)=>c-u)}function Yg(r,a,l){const u=100/(l-a)*(r-a);return vi(u,[0,100])}function CC(r,a){return a>2?`Value ${r+1} of ${a}`:a===2?["Minimum","Maximum"][r]:void 0}function kC(r,a){if(r.length===1)return 0;const l=r.map(c=>Math.abs(c-a)),o=Math.min(...l);return l.indexOf(o)}function EC(r,a,l){const o=r/2,u=tu([0,50],[0,o]);return(o-u(a)*l)*l}function PC(r){return r.slice(0,-1).map((a,l)=>r[l+1]-a)}function RC(r,a){if(a>0){const l=PC(r);return Math.min(...l)>=a}return!0}function tu(r,a){return l=>{if(r[0]===r[1]||a[0]===a[1])return a[0];const o=(a[1]-a[0])/(r[1]-r[0]);return a[0]+o*(l-r[0])}}function _C(r){return(String(r).split(".")[1]||"").length}function TC(r,a){const l=Math.pow(10,a);return Math.round(r*l)/l}var IC=zg,AC=Wg,MC=Hg,LC=Kg;function DC({className:r,defaultValue:a,value:l,min:o=0,max:c=100,...u}){const f=p.useMemo(()=>Array.isArray(l)?l:Array.isArray(a)?a:[o,c],[l,a,o,c]);return t.jsxs(IC,{defaultValue:a,value:l,min:o,max:c,className:Ge("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",r),...u,children:[t.jsx(AC,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:t.jsx(MC,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:f.length},(m,x)=>t.jsx(LC,{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 OC={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function FC(){const[r,a]=p.useState(OC),[l,o]=p.useState(!0),[c,u]=p.useState(!1);p.useEffect(()=>{He("/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(r.distributorShare)||0,minWithdrawAmount:Number(r.minWithdrawAmount)||0,bindingDays:Number(r.bindingDays)||0,userDiscount:Number(r.userDiscount)||0,enableAutoWithdraw:!!r.enableAutoWithdraw,vipOrderShareVip:Number(r.vipOrderShareVip)||20,vipOrderShareNonVip:Number(r.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)}},m=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(Is,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),t.jsxs(de,{onClick:f,disabled:c||l,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(an,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"flex items-center gap-2 text-white",children:[t.jsx(gw,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),t.jsx(ht,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),t.jsx(ke,{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(q,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(ql,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),t.jsx(ne,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.userDiscount,onChange:m("userDiscount")}),t.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(q,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(xn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(DC,{className:"flex-1",min:10,max:100,step:1,value:[r.distributorShare],onValueChange:([x])=>a(g=>({...g,distributorShare:x}))}),t.jsx(ne,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:r.distributorShare,onChange:m("distributorShare")})]}),t.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",t.jsxs("span",{className:"text-[#38bdac] font-mono",children:[r.distributorShare,"%"]}),";会员订单见下方。"]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(q,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(ql,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),t.jsx(ne,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.vipOrderShareVip,onChange:m("vipOrderShareVip")}),t.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(q,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(ql,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),t.jsx(ne,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.vipOrderShareNonVip,onChange:m("vipOrderShareNonVip")}),t.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(q,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(xn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),t.jsx(ne,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:r.bindingDays,onChange:m("bindingDays")}),t.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"flex items-center gap-2 text-white",children:[t.jsx(Is,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),t.jsx(ht,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),t.jsx(ke,{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(q,{className:"text-gray-300",children:"最低提现金额(元)"}),t.jsx(ne,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:r.minWithdrawAmount,onChange:m("minWithdrawAmount")}),t.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(q,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",t.jsx(De,{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(ft,{checked:r.enableAutoWithdraw,onCheckedChange:x=>a(g=>({...g,enableAutoWithdraw:x}))}),t.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsx(Be,{children:t.jsxs(Ve,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[t.jsx(ql,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),t.jsxs(ke,{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 zC={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},$C={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},BC={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...$C}},VC={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0};function UC(){const[r,a]=p.useState(BC),[l,o]=p.useState(["preface","epilogue","1.1","appendix-1","appendix-2","appendix-3"]),[c,u]=p.useState(""),[f,m]=p.useState(VC),[x,g]=p.useState(zC),[v,y]=p.useState(!1),[E,P]=p.useState(!0),[C,N]=p.useState(!1),[b,k]=p.useState(""),[R,j]=p.useState(""),[_,F]=p.useState(!1),[G,M]=p.useState(!1),V=(H,W,Y=!1)=>{k(H),j(W),F(Y),N(!0)};p.useEffect(()=>{(async()=>{try{const W=await He("/api/admin/settings");if(!W||W.success===!1)return;if(Array.isArray(W.freeChapters)&&W.freeChapters.length&&o(W.freeChapters),W.featureConfig&&Object.keys(W.featureConfig).length&&m(Y=>({...Y,...W.featureConfig})),W.mpConfig&&typeof W.mpConfig=="object"&&g(Y=>({...Y,...W.mpConfig})),W.siteSettings&&typeof W.siteSettings=="object"){const Y=W.siteSettings;a(K=>({...K,...typeof Y.sectionPrice=="number"&&{sectionPrice:Y.sectionPrice},...typeof Y.baseBookPrice=="number"&&{baseBookPrice:Y.baseBookPrice},...typeof Y.distributorShare=="number"&&{distributorShare:Y.distributorShare},...Y.authorInfo&&typeof Y.authorInfo=="object"&&{authorInfo:{...K.authorInfo,...Y.authorInfo}}}))}}catch(W){console.error("Load settings error:",W)}finally{P(!1)}})()},[]);const te=async(H,W)=>{M(!0);try{const Y=await jt("/api/admin/settings",{featureConfig:H});if(!Y||Y.success===!1){W(),V("保存失败",(Y==null?void 0:Y.error)??"未知错误",!0);return}V("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(Y){console.error("Save feature config error:",Y),W(),V("保存失败",Y instanceof Error?Y.message:String(Y),!0)}finally{M(!1)}},ue=(H,W)=>{const Y=f,K={...Y,[H]:W};m(K),te(K,()=>m(Y))},ce=async()=>{y(!0);try{const H=await jt("/api/admin/settings",{freeChapters:l,featureConfig:f,siteSettings:{sectionPrice:r.sectionPrice,baseBookPrice:r.baseBookPrice,distributorShare:r.distributorShare,authorInfo:r.authorInfo},mpConfig:{...x,appId:x.appId||"",withdrawSubscribeTmplId:x.withdrawSubscribeTmplId||"",mchId:x.mchId||"",minWithdraw:typeof x.minWithdraw=="number"?x.minWithdraw:10}});if(!H||H.success===!1){V("保存失败",(H==null?void 0:H.error)??"未知错误",!0);return}V("已保存","设置已保存成功。")}catch(H){console.error("Save settings error:",H),V("保存失败",H instanceof Error?H.message:String(H),!0)}finally{y(!1)}},ie=()=>{c&&!l.includes(c)&&(o([...l,c]),u(""))},fe=H=>{o(l.filter(W=>W!==H))};return E?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(de,{onClick:ce,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(an,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存设置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(om,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),t.jsx(ht,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),t.jsxs(ke,{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(q,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(om,{className:"w-3 h-3"}),"主理人名称"]}),t.jsx(ne,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:r.authorInfo.name??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,name:H.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(q,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(Aa,{className:"w-3 h-3"}),"开播日期"]}),t.jsx(ne,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:r.authorInfo.startDate??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,startDate:H.target.value}}))})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(q,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(Aa,{className:"w-3 h-3"}),"直播时间"]}),t.jsx(ne,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:r.authorInfo.liveTime??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,liveTime:H.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(q,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(ow,{className:"w-3 h-3"}),"直播平台"]}),t.jsx(ne,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:r.authorInfo.platform??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,platform:H.target.value}}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(q,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[t.jsx(Ts,{className:"w-3 h-3"}),"简介描述"]}),t.jsx(ne,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:r.authorInfo.description??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,description:H.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),t.jsx(Rs,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:r.authorInfo.bio??"",onChange:H=>a(W=>({...W,authorInfo:{...W.authorInfo,bio:H.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:(r.authorInfo.name??"K").charAt(0)}),t.jsxs("div",{children:[t.jsx("p",{className:"text-white font-semibold",children:r.authorInfo.name}),t.jsx("p",{className:"text-gray-400 text-xs",children:r.authorInfo.description}),t.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",r.authorInfo.liveTime," · ",r.authorInfo.platform]})]})]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(fi,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),t.jsx(ht,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),t.jsx(ke,{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(q,{className:"text-gray-300",children:"单节价格 (元)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:r.sectionPrice,onChange:H=>a(W=>({...W,sectionPrice:Number.parseFloat(H.target.value)||1}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"整本价格 (元)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:r.baseBookPrice,onChange:H=>a(W=>({...W,baseBookPrice:Number.parseFloat(H.target.value)||9.9}))})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(id,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),t.jsx(ht,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),t.jsx(ke,{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(q,{className:"text-gray-300",children:"小程序 AppID"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:x.appId??"",onChange:H=>g(W=>({...W,appId:H.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"提现订阅模板 ID"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:x.withdrawSubscribeTmplId??"",onChange:H=>g(W=>({...W,withdrawSubscribeTmplId:H.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"微信支付商户号"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:x.mchId??"",onChange:H=>g(W=>({...W,mchId:H.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"最低提现金额 (元)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:x.minWithdraw??10,onChange:H=>g(W=>({...W,minWithdraw:Number.parseFloat(H.target.value)||10}))})]})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(cm,{className:"w-5 h-5 text-[#38bdac]"}),"免费章节"]}),t.jsx(ht,{className:"text-gray-400",children:"设置哪些章节对所有用户免费开放"})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(H=>t.jsxs("span",{className:"inline-flex items-center gap-1 bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30 px-3 py-1 rounded-md text-sm",children:[H,t.jsx("button",{type:"button",onClick:()=>fe(H),className:"ml-1 hover:text-red-400",children:t.jsx(Pn,{className:"w-3 h-3"})})]},H))}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",placeholder:"输入章节ID,如 1.2、2.1、preface",value:c,onChange:H=>u(H.target.value),onKeyDown:H=>H.key==="Enter"&&ie()}),t.jsxs(de,{onClick:ie,className:"bg-[#38bdac] hover:bg-[#2da396]",children:[t.jsx(pr,{className:"w-4 h-4 mr-1"}),"添加"]})]}),t.jsx("p",{className:"text-xs text-gray-500",children:"常用ID: preface(序言), epilogue(尾声), appendix-1/2/3(附录), 1.1/1.2等(章节)"})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(mi,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),t.jsx(ht,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),t.jsxs(ke,{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(xn,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(q,{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(ft,{id:"match-enabled",checked:f.matchEnabled,disabled:G,onCheckedChange:H=>ue("matchEnabled",H)})]}),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(cm,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(q,{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(ft,{id:"referral-enabled",checked:f.referralEnabled,disabled:G,onCheckedChange:H=>ue("referralEnabled",H)})]}),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(Ts,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(q,{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(ft,{id:"search-enabled",checked:f.searchEnabled,disabled:G,onCheckedChange:H=>ue("searchEnabled",H)})]}),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(mi,{className:"w-4 h-4 text-[#38bdac]"}),t.jsx(q,{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(ft,{id:"about-enabled",checked:f.aboutEnabled,disabled:G,onCheckedChange:H=>ue("aboutEnabled",H)})]})]}),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(Kt,{open:C,onOpenChange:N,children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[t.jsxs(Gt,{children:[t.jsx(Yt,{className:_?"text-red-400":"text-[#38bdac]",children:b}),t.jsx(M1,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:R})]}),t.jsx(sn,{className:"mt-4",children:t.jsx(de,{onClick:()=>N(!1),className:_?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const Gm={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 WC(){const[r,a]=p.useState(!1),[l,o]=p.useState(Gm),[c,u]=p.useState(""),f=async()=>{a(!0);try{const k=await He("/api/config");k!=null&&k.paymentMethods&&o({...Gm,...k.paymentMethods})}catch(k){console.error(k)}finally{a(!1)}};p.useEffect(()=>{f()},[]);const m=async()=>{a(!0);try{await jt("/api/db/config",{key:"payment_methods",value:l,description:"支付方式配置"}),alert("配置已保存!")}catch(k){console.error("保存失败:",k),alert("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{a(!1)}},x=(k,R)=>{navigator.clipboard.writeText(k),u(R),setTimeout(()=>u(""),2e3)},g=(k,R)=>{o(j=>({...j,wechat:{...j.wechat,[k]:R}}))},v=(k,R)=>{o(j=>({...j,alipay:{...j.alipay,[k]:R}}))},y=(k,R)=>{o(j=>({...j,usdt:{...j.usdt,[k]:R}}))},E=(k,R)=>{o(j=>({...j,paypal:{...j.paypal,[k]:R}}))},P=l.wechat,C=l.alipay,N=l.usdt,b=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(de,{variant:"outline",onClick:f,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(tt,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`}),"同步配置"]}),t.jsxs(de,{onClick:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(an,{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(up,{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(Hd,{defaultValue:"wechat",className:"space-y-6",children:[t.jsxs(Li,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[t.jsxs(nn,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[t.jsx(id,{className:"w-4 h-4 mr-2"}),"微信"]}),t.jsxs(nn,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[t.jsx(sd,{className:"w-4 h-4 mr-2"}),"支付宝"]}),t.jsxs(nn,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[t.jsx(im,{className:"w-4 h-4 mr-2"}),"USDT"]}),t.jsxs(nn,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[t.jsx(ad,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),t.jsx(rn,{value:"wechat",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{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(id,{className:"w-5 h-5"}),"微信支付配置"]}),t.jsx(ht,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),t.jsx(ft,{checked:!!P.enabled,onCheckedChange:k=>g("enabled",k)})]}),t.jsxs(ke,{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(q,{className:"text-gray-300",children:"网站AppID"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(P.websiteAppId??""),onChange:k=>g("websiteAppId",k.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"商户号"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(P.merchantId??""),onChange:k=>g("merchantId",k.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(hi,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"微信收款码/支付链接"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(P.qrCode??""),onChange:k=>g("qrCode",k.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(q,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),t.jsx(ne,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(P.groupQrCode??""),onChange:k=>g("groupQrCode",k.target.value)}),t.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),t.jsx(rn,{value:"alipay",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{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(sd,{className:"w-5 h-5"}),"支付宝配置"]}),t.jsx(ht,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),t.jsx(ft,{checked:!!C.enabled,onCheckedChange:k=>v("enabled",k)})]}),t.jsxs(ke,{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(q,{className:"text-gray-300",children:"合作者身份 (PID)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(C.partnerId??""),onChange:k=>v("partnerId",k.target.value)}),t.jsx(de,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>x(String(C.partnerId??""),"pid"),children:c==="pid"?t.jsx(ki,{className:"w-4 h-4 text-green-500"}):t.jsx(hp,{className:"w-4 h-4 text-gray-400"})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"安全校验码 (Key)"}),t.jsx(ne,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(C.securityKey??""),onChange:k=>v("securityKey",k.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(hi,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(C.qrCode??""),onChange:k=>v("qrCode",k.target.value)}),t.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),t.jsx(rn,{value:"usdt",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{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(im,{className:"w-5 h-5"}),"USDT配置"]}),t.jsx(ht,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),t.jsx(ft,{checked:!!N.enabled,onCheckedChange:k=>y("enabled",k)})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{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:k=>y("network",k.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(q,{className:"text-gray-300",children:"收款地址"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(N.address??""),onChange:k=>y("address",k.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(N.exchangeRate)??7.2,onChange:k=>y("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),t.jsx(rn,{value:"paypal",className:"space-y-4",children:t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{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(ad,{className:"w-5 h-5"}),"PayPal配置"]}),t.jsx(ht,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),t.jsx(ft,{checked:!!b.enabled,onCheckedChange:k=>E("enabled",k)})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"PayPal邮箱"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(b.email??""),onChange:k=>E("email",k.target.value)})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(b.exchangeRate)??7.2,onChange:k=>E("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const HC={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},KC={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},GC={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function YC(){const[r,a]=p.useState({siteConfig:{...HC},menuConfig:{...KC},pageConfig:{...GC}}),[l,o]=p.useState(!1),[c,u]=p.useState(!1);p.useEffect(()=>{He("/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:r.siteConfig,description:"网站基础配置"}),await jt("/api/db/config",{key:"menu_config",value:r.menuConfig,description:"底部菜单配置"}),await jt("/api/db/config",{key:"page_config",value:r.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)}},m=r.siteConfig,x=r.menuConfig,g=r.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(de,{onClick:f,disabled:c,className:`${l?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[t.jsx(an,{className:"w-4 h-4 mr-2"}),c?"保存中...":l?"已保存":"保存设置"]})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(ad,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),t.jsx(ht,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),t.jsxs(ke,{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(q,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),t.jsx(ne,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:m.siteName??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,siteName:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),t.jsx(ne,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:m.siteTitle??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,siteTitle:v.target.value}}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),t.jsx(ne,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:m.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(q,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),t.jsx(ne,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:m.logo??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,logo:v.target.value}}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),t.jsx(ne,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:m.favicon??"",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,favicon:v.target.value}}))})]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(mw,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),t.jsx(ht,{className:"text-gray-400",children:"配置网站主题色"})]}),t.jsx(ke,{children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"space-y-2 flex-1",children:[t.jsx(q,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ne,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:m.primaryColor??"#00CED1",onChange:v=>a(y=>({...y,siteConfig:{...y.siteConfig,primaryColor:v.target.value}}))}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:m.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:m.primaryColor??"#00CED1"},children:"预览"})]})})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(dw,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),t.jsx(ht,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),t.jsx(ke,{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(ft,{checked:(y==null?void 0:y.enabled)??!0,onCheckedChange:E=>a(P=>({...P,menuConfig:{...P.menuConfig,[v]:{...y,enabled:E}}}))}),t.jsx("span",{className:"text-gray-300 w-16 capitalize",children:v}),t.jsx(ne,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(y==null?void 0:y.label)??"",onChange:E=>a(P=>({...P,menuConfig:{...P.menuConfig,[v]:{...y,label:E.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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Oj,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),t.jsx(ht,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),t.jsxs(ke,{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(q,{className:"text-gray-300",children:"首页标题"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"首页副标题"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"目录页标题"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"匹配页标题"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"我的页标题"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"关于作者标题"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",value:g.aboutTitle??"",onChange:v=>a(y=>({...y,pageConfig:{...y.pageConfig,aboutTitle:v.target.value}}))})]})]})]})]})]})]})}function QC(){const[r,a]=p.useState(""),[l,o]=p.useState(""),[c,u]=p.useState(""),[f,m]=p.useState({}),x=async()=>{var P,C,N,b;try{const k=await He("/api/config"),R=(C=(P=k==null?void 0:k.liveQRCodes)==null?void 0:P[0])==null?void 0:C.urls;Array.isArray(R)&&a(R.join(` +`));const j=(b=(N=k==null?void 0:k.paymentMethods)==null?void 0:N.wechat)==null?void 0:b.groupQrCode;j&&o(j),m({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};p.useEffect(()=>{x()},[]);const g=(P,C)=>{navigator.clipboard.writeText(P),u(C),setTimeout(()=>u(""),2e3)},v=async()=>{try{const P=r.split(` +`).map(N=>N.trim()).filter(Boolean),C=[...f.liveQRCodes||[]];C[0]?C[0].urls=P:C.push({id:"live-1",name:"微信群活码",urls:P,clickCount:0}),await jt("/api/db/config",{key:"live_qr_codes",value:C,description:"群活码配置"}),alert("群活码配置已保存!"),await x()}catch(P){console.error(P),alert("保存失败: "+(P instanceof Error?P.message:String(P)))}},y=async()=>{var P;try{await jt("/api/db/config",{key:"payment_methods",value:{...f.paymentMethods||{},wechat:{...((P=f.paymentMethods)==null?void 0:P.wechat)||{},groupQrCode:l}},description:"支付方式配置"}),alert("微信群链接已保存!用户支付成功后将自动跳转"),await x()}catch(C){console.error(C),alert("保存失败: "+(C instanceof Error?C.message:String(C)))}},E=()=>{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(up,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-[#07C160] flex items-center gap-2",children:[t.jsx(hm,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),t.jsx(ht,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(q,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(fm,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ne,{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:P=>o(P.target.value)}),t.jsx(de,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>g(l,"group"),children:c==="group"?t.jsx(ki,{className:"w-4 h-4 text-green-500"}):t.jsx(hp,{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(hi,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(de,{onClick:y,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[t.jsx(mm,{className:"w-4 h-4 mr-2"}),"保存配置"]}),t.jsxs(de,{onClick:E,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[t.jsx(hi,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(hm,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),t.jsx(ht,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),t.jsxs(ke,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsxs(q,{className:"text-gray-300 flex items-center gap-2",children:[t.jsx(fm,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),t.jsx(Rs,{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:r,onChange:P=>a(P.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:[r.split(` +`).filter(Boolean).length," 个"]})]}),t.jsxs(de,{onClick:v,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(mm,{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 Ym={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}},qC=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function XC(){const[r,a]=p.useState(Ym),[l,o]=p.useState(!0),[c,u]=p.useState(!1),[f,m]=p.useState(!1),[x,g]=p.useState(null),[v,y]=p.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),E=async()=>{o(!0);try{const j=await He("/api/db/config/full?key=match_config"),_=(j==null?void 0:j.data)??(j==null?void 0:j.config);_&&a({...Ym,..._})}catch(j){console.error("加载匹配配置失败:",j)}finally{o(!1)}};p.useEffect(()=>{E()},[]);const P=async()=>{u(!0);try{const j=await jt("/api/db/config",{key:"match_config",value:r,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}),m(!0)},N=()=>{g(null),y({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),m(!0)},b=()=>{if(!v.id||!v.label){alert("请填写类型ID和名称");return}const j=[...r.matchTypes];if(x){const _=j.findIndex(F=>F.id===x.id);_!==-1&&(j[_]={...v})}else{if(j.some(_=>_.id===v.id)){alert("类型ID已存在");return}j.push({...v})}a({...r,matchTypes:j}),m(!1)},k=j=>{confirm("确定要删除这个匹配类型吗?")&&a({...r,matchTypes:r.matchTypes.filter(_=>_.id!==j)})},R=j=>{a({...r,matchTypes:r.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(mi,{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(de,{variant:"outline",onClick:E,disabled:l,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[t.jsx(tt,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]}),t.jsxs(de,{onClick:P,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(an,{className:"w-4 h-4 mr-2"}),c?"保存中...":"保存配置"]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsxs(Be,{children:[t.jsxs(Ve,{className:"text-white flex items-center gap-2",children:[t.jsx(Ww,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),t.jsx(ht,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),t.jsxs(ke,{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(q,{className:"text-gray-300",children:"每日免费匹配次数"}),t.jsx(ne,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.freeMatchLimit,onChange:j=>a({...r,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(q,{className:"text-gray-300",children:"付费匹配价格(元)"}),t.jsx(ne,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:r.matchPrice,onChange:j=>a({...r,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(q,{className:"text-gray-300",children:"每日最大匹配次数"}),t.jsx(ne,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:r.settings.maxMatchesPerDay,onChange:j=>a({...r,settings:{...r.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(ft,{checked:r.settings.enableFreeMatches,onCheckedChange:j=>a({...r,settings:{...r.settings,enableFreeMatches:j}})}),t.jsx(q,{className:"text-gray-300",children:"启用免费匹配"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ft,{checked:r.settings.enablePaidMatches,onCheckedChange:j=>a({...r,settings:{...r.settings,enablePaidMatches:j}})}),t.jsx(q,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),t.jsxs(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:[t.jsxs(Be,{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(xn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),t.jsx(ht,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),t.jsxs(de,{onClick:N,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pr,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),t.jsx(ke,{children:t.jsxs(Nr,{children:[t.jsx(br,{children:t.jsxs(dt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx(Te,{className:"text-gray-400",children:"图标"}),t.jsx(Te,{className:"text-gray-400",children:"类型ID"}),t.jsx(Te,{className:"text-gray-400",children:"显示名称"}),t.jsx(Te,{className:"text-gray-400",children:"匹配标签"}),t.jsx(Te,{className:"text-gray-400",children:"价格"}),t.jsx(Te,{className:"text-gray-400",children:"数据库匹配"}),t.jsx(Te,{className:"text-gray-400",children:"状态"}),t.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsx(Sr,{children:r.matchTypes.map(j=>t.jsxs(dt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(Ee,{children:t.jsx("span",{className:"text-2xl",children:j.icon})}),t.jsx(Ee,{className:"font-mono text-gray-300",children:j.id}),t.jsx(Ee,{className:"text-white font-medium",children:j.label}),t.jsx(Ee,{className:"text-gray-300",children:j.matchLabel}),t.jsx(Ee,{children:t.jsxs(De,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",j.price]})}),t.jsx(Ee,{children:j.matchFromDB?t.jsx(De,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):t.jsx(De,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),t.jsx(Ee,{children:t.jsx(ft,{checked:j.enabled,onCheckedChange:()=>R(j.id)})}),t.jsx(Ee,{className:"text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(de,{variant:"ghost",size:"sm",onClick:()=>C(j),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:t.jsx(gr,{className:"w-4 h-4"})}),t.jsx(de,{variant:"ghost",size:"sm",onClick:()=>k(j.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:t.jsx(Fa,{className:"w-4 h-4"})})]})})]},j.id))})]})})]}),t.jsx(Kt,{open:f,onOpenChange:m,children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[t.jsx(Gt,{children:t.jsxs(Yt,{className:"text-white flex items-center gap-2",children:[x?t.jsx(gr,{className:"w-5 h-5 text-[#38bdac]"}):t.jsx(pr,{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(q,{className:"text-gray-300",children:"类型ID(英文)"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"图标"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:qC.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(q,{className:"text-gray-300",children:"显示名称"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"匹配标签"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"单次匹配价格(元)"}),t.jsx(ne,{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(ft,{checked:v.matchFromDB,onCheckedChange:j=>y({...v,matchFromDB:j})}),t.jsx(q,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ft,{checked:v.showJoinAfterMatch,onCheckedChange:j=>y({...v,showJoinAfterMatch:j})}),t.jsx(q,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ft,{checked:v.enabled,onCheckedChange:j=>y({...v,enabled:j})}),t.jsx(q,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),t.jsxs(sn,{children:[t.jsx(de,{variant:"outline",onClick:()=>m(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),t.jsxs(de,{onClick:b,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(an,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const Qm={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function JC(){const[r,a]=p.useState([]),[l,o]=p.useState(0),[c,u]=p.useState(1),[f,m]=p.useState(10),[x,g]=p.useState(""),[v,y]=p.useState(!0),[E,P]=p.useState(null);async function C(){y(!0),P(null);try{const b=new URLSearchParams({page:String(c),pageSize:String(f)});x&&b.set("matchType",x);const k=await He(`/api/db/match-records?${b}`);k!=null&&k.success?(a(k.records||[]),o(k.total??0)):P("加载匹配记录失败")}catch(b){console.error("加载匹配记录失败",b),P("加载失败,请检查网络后重试")}finally{y(!1)}}p.useEffect(()=>{C()},[c,x]);const N=Math.ceil(l/f)||1;return t.jsxs("div",{className:"p-8 w-full",children:[E&&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:E}),t.jsx("button",{type:"button",onClick:()=>P(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:b=>{g(b.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(Qm).map(([b,k])=>t.jsx("option",{value:b,children:k},b))]}),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(tt,{className:`w-4 h-4 ${v?"animate-spin":""}`}),"刷新"]})]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:t.jsx(ke,{className:"p-0",children:v?t.jsxs("div",{className:"flex justify-center py-12",children:[t.jsx(tt,{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(Nr,{children:[t.jsx(br,{children:t.jsxs(dt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[t.jsx(Te,{className:"text-gray-400",children:"发起人"}),t.jsx(Te,{className:"text-gray-400",children:"匹配到"}),t.jsx(Te,{className:"text-gray-400",children:"类型"}),t.jsx(Te,{className:"text-gray-400",children:"联系方式"}),t.jsx(Te,{className:"text-gray-400",children:"匹配时间"})]})}),t.jsxs(Sr,{children:[r.map(b=>t.jsxs(dt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[t.jsx(Ee,{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:[b.userAvatar?t.jsx("img",{src:b.userAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const R=k.currentTarget.nextElementSibling;R&&R.classList.remove("hidden")}}):null,t.jsx("span",{className:b.userAvatar?"hidden":"",children:(b.userNickname||b.userId||"?").charAt(0)})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white",children:b.userNickname||b.userId}),t.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[b.userId.slice(0,16),"..."]})]})]})}),t.jsx(Ee,{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:[b.matchedUserAvatar?t.jsx("img",{src:b.matchedUserAvatar,alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const R=k.currentTarget.nextElementSibling;R&&R.classList.remove("hidden")}}):null,t.jsx("span",{className:b.matchedUserAvatar?"hidden":"",children:(b.matchedNickname||b.matchedUserId||"?").charAt(0)})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-white",children:b.matchedNickname||b.matchedUserId}),t.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[b.matchedUserId.slice(0,16),"..."]})]})]})}),t.jsx(Ee,{children:t.jsx(De,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Qm[b.matchType]||b.matchType})}),t.jsxs(Ee,{className:"text-gray-400 text-sm",children:[b.phone&&t.jsxs("div",{children:["📱 ",b.phone]}),b.wechatId&&t.jsxs("div",{children:["💬 ",b.wechatId]}),!b.phone&&!b.wechatId&&"-"]}),t.jsx(Ee,{className:"text-gray-400",children:b.createdAt?new Date(b.createdAt).toLocaleString():"-"})]},b.id)),r.length===0&&t.jsx(dt,{children:t.jsx(Ee,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),t.jsx(Kr,{page:c,totalPages:N,total:l,pageSize:f,onPageChange:u,onPageSizeChange:b=>{m(b),u(1)}})]})})})]})}function ZC(){const[r,a]=p.useState([]),[l,o]=p.useState(!0),[c,u]=p.useState(!1),[f,m]=p.useState(null),[x,g]=p.useState(""),[v,y]=p.useState(0),[E,P]=p.useState(!1);async function C(){o(!0);try{const j=await He("/api/db/vip-roles");j!=null&&j.success&&j.data&&a(j.data)}catch(j){console.error("Load roles error:",j)}finally{o(!1)}}p.useEffect(()=>{C()},[]);const N=()=>{m(null),g(""),y(r.length>0?Math.max(...r.map(j=>j.sort))+1:0),u(!0)},b=j=>{m(j),g(j.name),y(j.sort),u(!0)},k=async()=>{if(!x.trim()){alert("角色名称不能为空");return}P(!0);try{if(f){const j=await zt("/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{P(!1)}},R=async j=>{if(confirm("确定删除该角色?已设置该角色的 VIP 用户将保留角色名称。"))try{const _=await Ri(`/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(Ei,{className:"w-5 h-5 text-amber-400"}),"VIP 角色管理"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"超级个体固定角色,在「设置 VIP」时可选择或手动填写"})]}),t.jsxs(de,{onClick:N,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pr,{className:"w-4 h-4 mr-2"}),"新增角色"]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Nr,{children:[t.jsx(br,{children:t.jsxs(dt,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx(Te,{className:"text-gray-400",children:"ID"}),t.jsx(Te,{className:"text-gray-400",children:"角色名称"}),t.jsx(Te,{className:"text-gray-400",children:"排序"}),t.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(Sr,{children:[r.map(j=>t.jsxs(dt,{className:"border-gray-700/50",children:[t.jsx(Ee,{className:"text-gray-300",children:j.id}),t.jsx(Ee,{className:"text-white",children:j.name}),t.jsx(Ee,{className:"text-gray-400",children:j.sort}),t.jsxs(Ee,{className:"text-right",children:[t.jsx(de,{variant:"ghost",size:"sm",onClick:()=>b(j),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(gr,{className:"w-4 h-4"})}),t.jsx(de,{variant:"ghost",size:"sm",onClick:()=>R(j.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Fa,{className:"w-4 h-4"})})]})]},j.id)),r.length===0&&t.jsx(dt,{children:t.jsx(Ee,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无角色,点击「新增角色」添加"})})]})]})})}),t.jsx(Kt,{open:c,onOpenChange:u,children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[t.jsx(Gt,{children:t.jsx(Yt,{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(q,{className:"text-gray-300",children:"角色名称"}),t.jsx(ne,{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(q,{className:"text-gray-300",children:"排序(下拉展示顺序,越小越前)"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:v,onChange:j=>y(parseInt(j.target.value,10)||0)})]})]}),t.jsxs(sn,{children:[t.jsxs(de,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(Pn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(de,{onClick:k,disabled:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(an,{className:"w-4 h-4 mr-2"}),E?"保存中...":"保存"]})]})]})})]})}function e4(){const[r,a]=p.useState([]),[l,o]=p.useState(!0),[c,u]=p.useState(!1),[f,m]=p.useState(null),[x,g]=p.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[v,y]=p.useState(!1);async function E(){o(!0);try{const j=await He("/api/db/mentors");j!=null&&j.success&&j.data&&a(j.data)}catch(j){console.error("Load mentors error:",j)}finally{o(!1)}}p.useEffect(()=>{E()},[]);const P=()=>{g({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:r.length>0?Math.max(...r.map(j=>j.sort))+1:0,enabled:!0})},C=()=>{m(null),P(),u(!0)},N=j=>{m(j),g({name:j.name,avatar:j.avatar||"",intro:j.intro||"",tags:j.tags||"",priceSingle:j.priceSingle!=null?String(j.priceSingle):"",priceHalfYear:j.priceHalfYear!=null?String(j.priceHalfYear):"",priceYear:j.priceYear!=null?String(j.priceYear):"",quote:j.quote||"",whyFind:j.whyFind||"",offering:j.offering||"",judgmentStyle:j.judgmentStyle||"",sort:j.sort,enabled:j.enabled??!0}),u(!0)},b=async()=>{if(!x.name.trim()){alert("导师姓名不能为空");return}y(!0);try{const j=F=>F===""?void 0:parseFloat(F),_={name:x.name.trim(),avatar:x.avatar.trim()||void 0,intro:x.intro.trim()||void 0,tags:x.tags.trim()||void 0,priceSingle:j(x.priceSingle),priceHalfYear:j(x.priceHalfYear),priceYear:j(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 F=await zt("/api/db/mentors",{id:f.id,..._});F!=null&&F.success?(u(!1),E()):alert("更新失败: "+(F==null?void 0:F.error))}else{const F=await jt("/api/db/mentors",_);F!=null&&F.success?(u(!1),E()):alert("新增失败: "+(F==null?void 0:F.error))}}catch(j){console.error("Save error:",j),alert("保存失败")}finally{y(!1)}},k=async j=>{if(confirm("确定删除该导师?"))try{const _=await Ri(`/api/db/mentors?id=${j}`);_!=null&&_.success?E():alert("删除失败: "+(_==null?void 0:_.error))}catch(_){console.error("Delete error:",_),alert("删除失败")}},R=j=>j!=null?`¥${j}`:"-";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(xn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),t.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),t.jsxs(de,{onClick:C,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(pr,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Nr,{children:[t.jsx(br,{children:t.jsxs(dt,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx(Te,{className:"text-gray-400",children:"ID"}),t.jsx(Te,{className:"text-gray-400",children:"姓名"}),t.jsx(Te,{className:"text-gray-400",children:"简介"}),t.jsx(Te,{className:"text-gray-400",children:"单次"}),t.jsx(Te,{className:"text-gray-400",children:"半年"}),t.jsx(Te,{className:"text-gray-400",children:"年度"}),t.jsx(Te,{className:"text-gray-400",children:"排序"}),t.jsx(Te,{className:"text-right text-gray-400",children:"操作"})]})}),t.jsxs(Sr,{children:[r.map(j=>t.jsxs(dt,{className:"border-gray-700/50",children:[t.jsx(Ee,{className:"text-gray-300",children:j.id}),t.jsx(Ee,{className:"text-white",children:j.name}),t.jsx(Ee,{className:"text-gray-400 max-w-[200px] truncate",children:j.intro||"-"}),t.jsx(Ee,{className:"text-gray-400",children:R(j.priceSingle)}),t.jsx(Ee,{className:"text-gray-400",children:R(j.priceHalfYear)}),t.jsx(Ee,{className:"text-gray-400",children:R(j.priceYear)}),t.jsx(Ee,{className:"text-gray-400",children:j.sort}),t.jsxs(Ee,{className:"text-right",children:[t.jsx(de,{variant:"ghost",size:"sm",onClick:()=>N(j),className:"text-gray-400 hover:text-[#38bdac]",children:t.jsx(gr,{className:"w-4 h-4"})}),t.jsx(de,{variant:"ghost",size:"sm",onClick:()=>k(j.id),className:"text-gray-400 hover:text-red-400",children:t.jsx(Fa,{className:"w-4 h-4"})})]})]},j.id)),r.length===0&&t.jsx(dt,{children:t.jsx(Ee,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),t.jsx(Kt,{open:c,onOpenChange:u,children:t.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[t.jsx(Gt,{children:t.jsx(Yt,{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(q,{className:"text-gray-300",children:"姓名 *"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:x.name,onChange:j=>g(_=>({..._,name:j.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"排序"}),t.jsx(ne,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:x.sort,onChange:j=>g(_=>({..._,sort:parseInt(j.target.value,10)||0}))})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"头像 URL"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"https://...",value:x.avatar,onChange:j=>g(_=>({..._,avatar:j.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"简介"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:x.intro,onChange:j=>g(_=>({..._,intro:j.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:x.tags,onChange:j=>g(_=>({..._,tags:j.target.value}))})]}),t.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[t.jsx(q,{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(q,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),t.jsx(ne,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:x.priceSingle,onChange:j=>g(_=>({..._,priceSingle:j.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),t.jsx(ne,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:x.priceHalfYear,onChange:j=>g(_=>({..._,priceHalfYear:j.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),t.jsx(ne,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:x.priceYear,onChange:j=>g(_=>({..._,priceYear:j.target.value}))})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"引言"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:x.quote,onChange:j=>g(_=>({..._,quote:j.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"为什么找(文本)"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:x.whyFind,onChange:j=>g(_=>({..._,whyFind:j.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"提供什么(文本)"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:x.offering,onChange:j=>g(_=>({..._,offering:j.target.value}))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(q,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),t.jsx(ne,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:x.judgmentStyle,onChange:j=>g(_=>({..._,judgmentStyle:j.target.value}))})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"checkbox",id:"enabled",checked:x.enabled,onChange:j=>g(_=>({..._,enabled:j.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),t.jsx(q,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),t.jsxs(sn,{children:[t.jsxs(de,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300",children:[t.jsx(Pn,{className:"w-4 h-4 mr-2"}),"取消"]}),t.jsxs(de,{onClick:b,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[t.jsx(an,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存"]})]})]})})]})}function t4(){const[r,a]=p.useState([]),[l,o]=p.useState(!0),[c,u]=p.useState("");async function f(){o(!0);try{const g=c?`/api/db/mentor-consultations?status=${c}`:"/api/db/mentor-consultations",v=await He(g);v!=null&&v.success&&v.data&&a(v.data)}catch(g){console.error("Load consultations error:",g)}finally{o(!1)}}p.useEffect(()=>{f()},[c]);const m={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(Aa,{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(m).map(([g,v])=>t.jsx("option",{value:g,children:v},g))]}),t.jsxs(de,{onClick:f,disabled:l,variant:"outline",className:"border-gray-600 text-gray-300",children:[t.jsx(tt,{className:`w-4 h-4 mr-2 ${l?"animate-spin":""}`}),"刷新"]})]})]}),t.jsx(Ce,{className:"bg-[#0f2137] border-gray-700/50",children:t.jsx(ke,{className:"p-0",children:l?t.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):t.jsxs(Nr,{children:[t.jsx(br,{children:t.jsxs(dt,{className:"bg-[#0a1628] border-gray-700",children:[t.jsx(Te,{className:"text-gray-400",children:"ID"}),t.jsx(Te,{className:"text-gray-400",children:"用户ID"}),t.jsx(Te,{className:"text-gray-400",children:"导师ID"}),t.jsx(Te,{className:"text-gray-400",children:"类型"}),t.jsx(Te,{className:"text-gray-400",children:"金额"}),t.jsx(Te,{className:"text-gray-400",children:"状态"}),t.jsx(Te,{className:"text-gray-400",children:"创建时间"})]})}),t.jsxs(Sr,{children:[r.map(g=>t.jsxs(dt,{className:"border-gray-700/50",children:[t.jsx(Ee,{className:"text-gray-300",children:g.id}),t.jsx(Ee,{className:"text-gray-400",children:g.userId}),t.jsx(Ee,{className:"text-gray-400",children:g.mentorId}),t.jsx(Ee,{className:"text-gray-400",children:x[g.consultationType]||g.consultationType}),t.jsxs(Ee,{className:"text-white",children:["¥",g.amount]}),t.jsx(Ee,{className:"text-gray-400",children:m[g.status]||g.status}),t.jsx(Ee,{className:"text-gray-500 text-sm",children:g.createdAt})]},g.id)),r.length===0&&t.jsx(dt,{children:t.jsx(Ee,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function n4(){return t.jsxs("div",{className:"p-8 w-full",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[t.jsx(Wr,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"1. 接口总览"})}),t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"2. 书籍内容"})}),t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"3. 支付"})}),t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"4. 分销与用户"})}),t.jsxs(ke,{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(Ce,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[t.jsx(Be,{children:t.jsx(Ve,{className:"text-white",children:"5. 管理后台"})}),t.jsxs(ke,{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 r4(){const r=Jr();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(wj,{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:r.pathname}),t.jsx(de,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:t.jsxs(ip,{to:"/",children:[t.jsx(Yj,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function s4(){return t.jsxs(qy,{children:[t.jsx(at,{path:"/login",element:t.jsx(YN,{})}),t.jsxs(at,{path:"/",element:t.jsx(Xw,{}),children:[t.jsx(at,{index:!0,element:t.jsx(Gy,{to:"/dashboard",replace:!0})}),t.jsx(at,{path:"dashboard",element:t.jsx(qN,{})}),t.jsx(at,{path:"orders",element:t.jsx(L1,{})}),t.jsx(at,{path:"users",element:t.jsx(o2,{})}),t.jsx(at,{path:"distribution",element:t.jsx(c2,{})}),t.jsx(at,{path:"withdrawals",element:t.jsx(d2,{})}),t.jsx(at,{path:"content",element:t.jsx(pC,{})}),t.jsx(at,{path:"chapters",element:t.jsx(xC,{})}),t.jsx(at,{path:"referral-settings",element:t.jsx(FC,{})}),t.jsx(at,{path:"vip-roles",element:t.jsx(ZC,{})}),t.jsx(at,{path:"mentors",element:t.jsx(e4,{})}),t.jsx(at,{path:"mentor-consultations",element:t.jsx(t4,{})}),t.jsx(at,{path:"settings",element:t.jsx(UC,{})}),t.jsx(at,{path:"payment",element:t.jsx(WC,{})}),t.jsx(at,{path:"site",element:t.jsx(YC,{})}),t.jsx(at,{path:"qrcodes",element:t.jsx(QC,{})}),t.jsx(at,{path:"match",element:t.jsx(XC,{})}),t.jsx(at,{path:"match-records",element:t.jsx(JC,{})}),t.jsx(at,{path:"api-doc",element:t.jsx(n4,{})})]}),t.jsx(at,{path:"*",element:t.jsx(r4,{})})]})}Zv.createRoot(document.getElementById("root")).render(t.jsx(p.StrictMode,{children:t.jsx(rj,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:t.jsx(s4,{})})})); diff --git a/soul-admin/dist/index.html b/soul-admin/dist/index.html index da46fdbc..474a4839 100644 --- a/soul-admin/dist/index.html +++ b/soul-admin/dist/index.html @@ -4,7 +4,7 @@ 管理后台 - Soul创业派对 - + diff --git a/soul-admin/tsconfig.tsbuildinfo b/soul-admin/tsconfig.tsbuildinfo index 624423a2..919f6ddb 100644 --- a/soul-admin/tsconfig.tsbuildinfo +++ b/soul-admin/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/auth.ts","./src/api/client.ts","./src/components/modules/user/setvipmodal.tsx","./src/components/modules/user/userdetailmodal.tsx","./src/components/ui/pagination.tsx","./src/components/ui/badge.tsx","./src/components/ui/button.tsx","./src/components/ui/card.tsx","./src/components/ui/dialog.tsx","./src/components/ui/input.tsx","./src/components/ui/label.tsx","./src/components/ui/select.tsx","./src/components/ui/slider.tsx","./src/components/ui/switch.tsx","./src/components/ui/table.tsx","./src/components/ui/tabs.tsx","./src/components/ui/textarea.tsx","./src/hooks/usedebounce.ts","./src/layouts/adminlayout.tsx","./src/lib/utils.ts","./src/pages/api-doc/apidocpage.tsx","./src/pages/chapters/chapterspage.tsx","./src/pages/content/contentpage.tsx","./src/pages/dashboard/dashboardpage.tsx","./src/pages/distribution/distributionpage.tsx","./src/pages/login/loginpage.tsx","./src/pages/match/matchpage.tsx","./src/pages/match-records/matchrecordspage.tsx","./src/pages/not-found/notfoundpage.tsx","./src/pages/orders/orderspage.tsx","./src/pages/payment/paymentpage.tsx","./src/pages/qrcodes/qrcodespage.tsx","./src/pages/referral-settings/referralsettingspage.tsx","./src/pages/settings/settingspage.tsx","./src/pages/site/sitepage.tsx","./src/pages/users/userspage.tsx","./src/pages/vip-roles/viprolespage.tsx","./src/pages/withdrawals/withdrawalspage.tsx"],"version":"5.6.3"} \ No newline at end of file +{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/auth.ts","./src/api/client.ts","./src/components/modules/user/setvipmodal.tsx","./src/components/modules/user/userdetailmodal.tsx","./src/components/ui/pagination.tsx","./src/components/ui/badge.tsx","./src/components/ui/button.tsx","./src/components/ui/card.tsx","./src/components/ui/dialog.tsx","./src/components/ui/input.tsx","./src/components/ui/label.tsx","./src/components/ui/select.tsx","./src/components/ui/slider.tsx","./src/components/ui/switch.tsx","./src/components/ui/table.tsx","./src/components/ui/tabs.tsx","./src/components/ui/textarea.tsx","./src/hooks/usedebounce.ts","./src/layouts/adminlayout.tsx","./src/lib/utils.ts","./src/pages/api-doc/apidocpage.tsx","./src/pages/chapters/chapterspage.tsx","./src/pages/content/contentpage.tsx","./src/pages/dashboard/dashboardpage.tsx","./src/pages/distribution/distributionpage.tsx","./src/pages/login/loginpage.tsx","./src/pages/match/matchpage.tsx","./src/pages/match-records/matchrecordspage.tsx","./src/pages/mentor-consultations/mentorconsultationspage.tsx","./src/pages/mentors/mentorspage.tsx","./src/pages/not-found/notfoundpage.tsx","./src/pages/orders/orderspage.tsx","./src/pages/payment/paymentpage.tsx","./src/pages/qrcodes/qrcodespage.tsx","./src/pages/referral-settings/referralsettingspage.tsx","./src/pages/settings/settingspage.tsx","./src/pages/site/sitepage.tsx","./src/pages/users/userspage.tsx","./src/pages/vip-roles/viprolespage.tsx","./src/pages/withdrawals/withdrawalspage.tsx"],"version":"5.6.3"} \ No newline at end of file diff --git a/soul-api/.air.toml b/soul-api/.air.toml index 788dff85..f530a27d 100644 --- a/soul-api/.air.toml +++ b/soul-api/.air.toml @@ -1,6 +1,8 @@ # Air 热重载配置:改 .go 后自动重新编译并重启 +# 默认使用开发/测试环境:env_files 加载 .env.development root = "." tmp_dir = "tmp" +env_files = [".env", ".env.development"] # Windows 下用 .exe 避免系统弹出「选择应用打开 main」 [build] diff --git a/soul-api/internal/config/config.go b/soul-api/internal/config/config.go index ba2afd73..d3b4f252 100644 --- a/soul-api/internal/config/config.go +++ b/soul-api/internal/config/config.go @@ -64,6 +64,7 @@ var defaultCORSOrigins = []string{ "http://127.0.0.1:5174", "https://soul.quwanzhi.com", "http://soul.quwanzhi.com", + "https://souladmin.quwanzhi.com", "http://souladmin.quwanzhi.com", } @@ -95,12 +96,49 @@ func parseCORSOrigins() []string { return origins } -// Load 加载配置,端口等从 .env 读取。优先从可执行文件同目录加载 .env,再试当前目录 +// Load 加载配置,端口等从 .env 读取。 +// 环境区分:APP_ENV=development 加载 .env.development,APP_ENV=production 加载 .env.production; +// air 运行时通过 env_files 或 full_bin 设置 APP_ENV,开发用 .env.development,部署用 .env.production。 func Load() (*Config, error) { + workDir, _ := os.Getwd() + execDir := "" if execPath, err := os.Executable(); err == nil { - _ = godotenv.Load(filepath.Join(filepath.Dir(execPath), ".env")) + execDir = filepath.Dir(execPath) + } + loadEnv := func(name string) { + for _, dir := range []string{execDir, workDir, "."} { + if dir == "" { + continue + } + p := filepath.Join(dir, name) + if _, err := os.Stat(p); err == nil { + _ = godotenv.Load(p) + break + } + } + } + overloadEnv := func(name string) { + for _, dir := range []string{execDir, workDir, "."} { + if dir == "" { + continue + } + p := filepath.Join(dir, name) + if _, err := os.Stat(p); err == nil { + _ = godotenv.Overload(p) + break + } + } + } + + // 1. 加载 .env 作为基础 + loadEnv(".env") + // 2. 按 APP_ENV 覆盖(优先读已设置的 APP_ENV,如 air 的 env_files 已注入) + appEnv := strings.ToLower(strings.TrimSpace(os.Getenv("APP_ENV"))) + if appEnv == "development" { + overloadEnv(".env.development") + } else if appEnv == "production" { + overloadEnv(".env.production") } - _ = godotenv.Load(".env") port := os.Getenv("PORT") if port == "" { diff --git a/soul-api/internal/handler/admin_chapters.go b/soul-api/internal/handler/admin_chapters.go index 1101e53e..61c417e1 100644 --- a/soul-api/internal/handler/admin_chapters.go +++ b/soul-api/internal/handler/admin_chapters.go @@ -17,11 +17,13 @@ func AdminChaptersList(c *gin.Context) { return } type section struct { - ID string `json:"id"` - Title string `json:"title"` - Price float64 `json:"price"` - IsFree bool `json:"isFree"` - Status string `json:"status"` + ID string `json:"id"` + Title string `json:"title"` + Price float64 `json:"price"` + IsFree bool `json:"isFree"` + Status string `json:"status"` + EditionStandard *bool `json:"editionStandard,omitempty"` + EditionPremium *bool `json:"editionPremium,omitempty"` } type chapter struct { ID string `json:"id"` @@ -60,7 +62,10 @@ func AdminChaptersList(c *gin.Context) { if row.Status != nil { st = *row.Status } - ch.Sections = append(ch.Sections, section{ID: row.ID, Title: row.SectionTitle, Price: price, IsFree: isFree, Status: st}) + ch.Sections = append(ch.Sections, section{ + ID: row.ID, Title: row.SectionTitle, Price: price, IsFree: isFree, Status: st, + EditionStandard: row.EditionStandard, EditionPremium: row.EditionPremium, + }) } structure := make([]part, 0, len(partMap)) for _, p := range partMap { @@ -77,11 +82,13 @@ func AdminChaptersList(c *gin.Context) { // AdminChaptersAction POST/PUT/DELETE /api/admin/chapters func AdminChaptersAction(c *gin.Context) { var body struct { - Action string `json:"action"` - ID string `json:"id"` - Price *float64 `json:"price"` - IsFree *bool `json:"isFree"` - Status *string `json:"status"` + Action string `json:"action"` + ID string `json:"id"` + Price *float64 `json:"price"` + IsFree *bool `json:"isFree"` + Status *string `json:"status"` + EditionStandard *bool `json:"editionStandard"` + EditionPremium *bool `json:"editionPremium"` } if err := c.ShouldBindJSON(&body); err != nil { c.JSON(http.StatusOK, gin.H{"success": false, "error": "请求体无效"}) @@ -97,5 +104,17 @@ func AdminChaptersAction(c *gin.Context) { if body.Action == "updateStatus" && body.ID != "" && body.Status != nil { db.Model(&model.Chapter{}).Where("id = ?", body.ID).Update("status", *body.Status) } + if body.Action == "updateEdition" && body.ID != "" { + updates := make(map[string]interface{}) + if body.EditionStandard != nil { + updates["edition_standard"] = *body.EditionStandard + } + if body.EditionPremium != nil { + updates["edition_premium"] = *body.EditionPremium + } + if len(updates) > 0 { + db.Model(&model.Chapter{}).Where("id = ?", body.ID).Updates(updates) + } + } c.JSON(http.StatusOK, gin.H{"success": true}) } diff --git a/soul-api/internal/handler/book.go b/soul-api/internal/handler/book.go index a44bc502..39b15fb6 100644 --- a/soul-api/internal/handler/book.go +++ b/soul-api/internal/handler/book.go @@ -151,11 +151,18 @@ func BookChapters(c *gin.Context) { c.JSON(http.StatusBadRequest, gin.H{"success": false, "error": "缺少 id"}) return } - if err := db.Model(&model.Chapter{}).Where("id = ?", body.ID).Updates(map[string]interface{}{ + updates := map[string]interface{}{ "part_title": body.PartTitle, "chapter_title": body.ChapterTitle, "section_title": body.SectionTitle, "content": body.Content, "word_count": body.WordCount, "is_free": body.IsFree, "price": body.Price, "sort_order": body.SortOrder, "status": body.Status, - }).Error; err != nil { + } + if body.EditionStandard != nil { + updates["edition_standard"] = body.EditionStandard + } + if body.EditionPremium != nil { + updates["edition_premium"] = body.EditionPremium + } + if err := db.Model(&model.Chapter{}).Where("id = ?", body.ID).Updates(updates).Error; err != nil { c.JSON(http.StatusOK, gin.H{"success": false, "error": err.Error()}) return } diff --git a/soul-api/internal/handler/db_book.go b/soul-api/internal/handler/db_book.go index a60a9ed4..10c45c79 100644 --- a/soul-api/internal/handler/db_book.go +++ b/soul-api/internal/handler/db_book.go @@ -179,12 +179,14 @@ func DBBookAction(c *gin.Context) { } case http.MethodPut: var body struct { - ID string `json:"id"` - Title string `json:"title"` - Content string `json:"content"` - Price *float64 `json:"price"` - IsFree *bool `json:"isFree"` - IsNew *bool `json:"isNew"` // stitch_soul:标记最新新增 + ID string `json:"id"` + Title string `json:"title"` + Content string `json:"content"` + Price *float64 `json:"price"` + IsFree *bool `json:"isFree"` + IsNew *bool `json:"isNew"` // stitch_soul:标记最新新增 + EditionStandard *bool `json:"editionStandard"` // 是否属于普通版 + EditionPremium *bool `json:"editionPremium"` // 是否属于增值版 } if err := c.ShouldBindJSON(&body); err != nil || body.ID == "" { c.JSON(http.StatusOK, gin.H{"success": false, "error": "缺少 id 或请求体无效"}) @@ -209,6 +211,12 @@ func DBBookAction(c *gin.Context) { if body.IsNew != nil { updates["is_new"] = *body.IsNew } + if body.EditionStandard != nil { + updates["edition_standard"] = *body.EditionStandard + } + if body.EditionPremium != nil { + updates["edition_premium"] = *body.EditionPremium + } err := db.Model(&model.Chapter{}).Where("id = ?", body.ID).Updates(updates).Error if err != nil { c.JSON(http.StatusOK, gin.H{"success": false, "error": err.Error()}) diff --git a/soul-api/internal/handler/miniprogram.go b/soul-api/internal/handler/miniprogram.go index e10c73c4..7cdeae4b 100644 --- a/soul-api/internal/handler/miniprogram.go +++ b/soul-api/internal/handler/miniprogram.go @@ -757,17 +757,31 @@ func MiniprogramUsers(c *gin.Context) { var cnt int64 db.Model(&model.Order{}).Where("user_id = ? AND status = ? AND (product_type = ? OR product_type = ?)", id, "paid", "fullbook", "vip").Count(&cnt) - // 用户信息(nickname/avatar)与会员资料(vip*)区分,字段与 model 一致(camelCase) + // 用户信息与会员资料(vip*)、P3 资料扩展,供会员详情页完整展示 item := gin.H{ - "id": user.ID, - "nickname": getStringValue(user.Nickname), - "avatar": getStringValue(user.Avatar), - "vipName": getStringValue(user.VipName), - "vipAvatar": getStringValue(user.VipAvatar), - "vipContact": getStringValue(user.VipContact), - "vipProject": getStringValue(user.VipProject), - "vipBio": getStringValue(user.VipBio), - "is_vip": cnt > 0, + "id": user.ID, + "nickname": getStringValue(user.Nickname), + "avatar": getStringValue(user.Avatar), + "phone": getStringValue(user.Phone), + "wechatId": getStringValue(user.WechatID), + "vipName": getStringValue(user.VipName), + "vipAvatar": getStringValue(user.VipAvatar), + "vipContact": getStringValue(user.VipContact), + "vipProject": getStringValue(user.VipProject), + "vipBio": getStringValue(user.VipBio), + "mbti": getStringValue(user.Mbti), + "region": getStringValue(user.Region), + "industry": getStringValue(user.Industry), + "position": getStringValue(user.Position), + "businessScale": getStringValue(user.BusinessScale), + "skills": getStringValue(user.Skills), + "storyBestMonth": getStringValue(user.StoryBestMonth), + "storyAchievement": getStringValue(user.StoryAchievement), + "storyTurning": getStringValue(user.StoryTurning), + "helpOffer": getStringValue(user.HelpOffer), + "helpNeed": getStringValue(user.HelpNeed), + "projectIntro": getStringValue(user.ProjectIntro), + "is_vip": cnt > 0, } c.JSON(http.StatusOK, gin.H{"success": true, "data": item}) return diff --git a/soul-api/internal/model/chapter.go b/soul-api/internal/model/chapter.go index 888f8dbc..6f0272bb 100644 --- a/soul-api/internal/model/chapter.go +++ b/soul-api/internal/model/chapter.go @@ -18,8 +18,11 @@ type Chapter struct { SortOrder *int `gorm:"column:sort_order" json:"sortOrder,omitempty"` Status *string `gorm:"column:status;size:20" json:"status,omitempty"` IsNew *bool `gorm:"column:is_new" json:"isNew,omitempty"` // stitch_soul:目录/首页「最新新增」标记 - CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"` - UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"` + // 普通版/增值版:两者分开互斥,添加文章时勾选归属 + EditionStandard *bool `gorm:"column:edition_standard" json:"editionStandard,omitempty"` // 是否属于普通版 + EditionPremium *bool `gorm:"column:edition_premium" json:"editionPremium,omitempty"` // 是否属于增值版 + CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"` + UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"` } func (Chapter) TableName() string { return "chapters" } diff --git a/soul-api/soul-api b/soul-api/soul-api index 4b2abc42..8a689567 100755 Binary files a/soul-api/soul-api and b/soul-api/soul-api differ